jq-1.8.2/0000755000175100017510000000000015215513665005710 5jq-1.8.2/scripts/0000755000175100017510000000000015215513665007377 5jq-1.8.2/scripts/version0000755000175100017510000000047115215513536010731 #!/bin/sh set -eu cd "$(dirname "$0")/../" test -e .git || exit 1 if git describe --tags --match 'jq-*' >/dev/null 2>&1; then git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//' else branch=$(git rev-parse --abbrev-ref HEAD) commit=$(git describe --always --dirty) echo "${branch}-${commit}" fi jq-1.8.2/README.md0000644000175100017510000000460215215513536007106 # jq `jq` is a lightweight and flexible command-line JSON processor akin to `sed`,`awk`,`grep`, and friends for JSON data. It's written in portable C and has zero runtime dependencies, allowing you to easily slice, filter, map, and transform structured data. ## Documentation - **Official Documentation**: [jqlang.org](https://jqlang.org) - **Try jq Online**: [play.jqlang.org](https://play.jqlang.org) ## Installation ### Prebuilt Binaries Download the latest releases from the [GitHub release page](https://github.com/jqlang/jq/releases). ### Docker Image Pull the [jq image](https://github.com/jqlang/jq/pkgs/container/jq) to start quickly with Docker. #### Run with Docker ##### Example: Extracting the version from a `package.json` file ```bash docker run --rm -i ghcr.io/jqlang/jq:latest < package.json '.version' ``` ##### Example: Extracting the version from a `package.json` file with a mounted volume ```bash docker run --rm -i -v "$PWD:$PWD" -w "$PWD" ghcr.io/jqlang/jq:latest '.version' package.json ``` ### Building from source #### Dependencies - libtool - make - automake - autoconf #### Instructions ```console git submodule update --init # if building from git to get oniguruma autoreconf -i # if building from git ./configure --with-oniguruma=builtin make clean # if upgrading from a version previously built from source make -j8 make check sudo make install ``` Build a statically linked version: ```console make LDFLAGS=-all-static ``` If you're not using the latest git version but instead building a released tarball (available on the release page), skip the `autoreconf` step, and flex or bison won't be needed. ##### Cross-Compilation For details on cross-compilation, check out the [GitHub Actions file](.github/workflows/ci.yml) and the [cross-compilation wiki page](https://github.com/jqlang/jq/wiki/Cross-compilation). ## Community & Support - Questions & Help: [Stack Overflow (jq tag)](https://stackoverflow.com/questions/tagged/jq) - Chat & Community: [Join us on Discord](https://discord.gg/yg6yjNmgAC) - Wiki & Advanced Topics: [Explore the Wiki](https://github.com/jqlang/jq/wiki) ## License `jq` is released under the [MIT License](COPYING). `jq`'s documentation is licensed under the [Creative Commons CC BY 3.0](COPYING). `jq` uses parts of the open source C library "decNumber", which is distributed under [ICU License](COPYING) jq-1.8.2/m4/0000755000175100017510000000000015215513665006230 5jq-1.8.2/m4/ax_compare_version.m40000644000175100017510000001465215215513536012302 # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_compare_version.html # =========================================================================== # # SYNOPSIS # # AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # # DESCRIPTION # # This macro compares two version strings. Due to the various number of # minor-version numbers that can exist, and the fact that string # comparisons are not compatible with numeric comparisons, this is not # necessarily trivial to do in a autoconf script. This macro makes doing # these comparisons easy. # # The six basic comparisons are available, as well as checking equality # limited to a certain number of minor-version levels. # # The operator OP determines what type of comparison to do, and can be one # of: # # eq - equal (test A == B) # ne - not equal (test A != B) # le - less than or equal (test A <= B) # ge - greater than or equal (test A >= B) # lt - less than (test A < B) # gt - greater than (test A > B) # # Additionally, the eq and ne operator can have a number after it to limit # the test to that number of minor versions. # # eq0 - equal up to the length of the shorter version # ne0 - not equal up to the length of the shorter version # eqN - equal up to N sub-version levels # neN - not equal up to N sub-version levels # # When the condition is true, shell commands ACTION-IF-TRUE are run, # otherwise shell commands ACTION-IF-FALSE are run. The environment # variable 'ax_compare_version' is always set to either 'true' or 'false' # as well. # # Examples: # # AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) # AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) # # would both be true. # # AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) # AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) # # would both be false. # # AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) # # would be true because it is only comparing two minor versions. # # AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) # # would be true because it is only comparing the lesser number of minor # versions of the two values. # # Note: The characters that separate the version numbers do not matter. An # empty string is the same as version 0. OP is evaluated by autoconf, not # configure, so must be a string, not a variable. # # The author would like to acknowledge Guido Draheim whose advice about # the m4_case and m4_ifvaln functions make this macro only include the # portions necessary to perform the specific comparison specified by the # OP argument in the final configure script. # # LICENSE # # Copyright (c) 2008 Tim Toolan # # 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 any # warranty. #serial 11 dnl ######################################################################### AC_DEFUN([AX_COMPARE_VERSION], [ AC_REQUIRE([AC_PROG_AWK]) # Used to indicate true or false condition ax_compare_version=false # Convert the two version strings to be compared into a format that # allows a simple string comparison. The end result is that a version # string of the form 1.12.5-r617 will be converted to the form # 0001001200050617. In other words, each number is zero padded to four # digits, and non digits are removed. AS_VAR_PUSHDEF([A],[ax_compare_version_A]) A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/[[^0-9]]//g'` AS_VAR_PUSHDEF([B],[ax_compare_version_B]) B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/[[^0-9]]//g'` dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary dnl # then the first line is used to determine if the condition is true. dnl # The sed right after the echo is to remove any indented white space. m4_case(m4_tolower($2), [lt],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` ], [gt],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` ], [le],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` ], [ge],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` ],[ dnl Split the operator from the subversion count if present. m4_bmatch(m4_substr($2,2), [0],[ # A count of zero means use the length of the shorter version. # Determine the number of characters in A and B. ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` # Set A to no more than B's length and B to no more than A's length. A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` ], [[0-9]+],[ # A count greater than zero means use only that many subversions A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` ], [.+],[ AC_WARNING( [illegal OP numeric parameter: $2]) ],[]) # Pad zeros at end of numbers to make same length. ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" B="$B`echo $A | sed 's/./0/g'`" A="$ax_compare_version_tmp_A" # Check for equality or inequality as necessary. m4_case(m4_tolower(m4_substr($2,0,2)), [eq],[ test "x$A" = "x$B" && ax_compare_version=true ], [ne],[ test "x$A" != "x$B" && ax_compare_version=true ],[ AC_WARNING([illegal OP parameter: $2]) ]) ]) AS_VAR_POPDEF([A])dnl AS_VAR_POPDEF([B])dnl dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. if test "$ax_compare_version" = "true" ; then m4_ifvaln([$4],[$4],[:])dnl m4_ifvaln([$5],[else $5])dnl fi ]) dnl AX_COMPARE_VERSION jq-1.8.2/m4/ax_pthread.m40000644000175100017510000005403415215513536010534 # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS # # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. It # sets the PTHREAD_LIBS output variable to the threads library and linker # flags, and the PTHREAD_CFLAGS output variable to any special C compiler # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # # Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is # needed for multi-threaded programs (defaults to the value of CC # respectively CXX otherwise). (This is necessary on e.g. AIX to use the # special cc_r/CC_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also to link with them as well. For example, you might link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threaded programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # CXX="$PTHREAD_CXX" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the # PTHREAD_PRIO_INHERIT symbol is defined when compiling with # PTHREAD_CFLAGS. # # ACTION-IF-FOUND is a list of shell commands to run if a threads library # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it # is not found. If ACTION-IF-FOUND is not specified, the default action # will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or if # you have any other suggestions or comments. This macro was based on work # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by # Alejandro Forero Cuervo to the autoconf macro repository. We are also # grateful for the helpful feedback of numerous users. # # Updated for Autoconf 2.68 by Daniel Richard G. # # LICENSE # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2011 Daniel Richard G. # Copyright (c) 2019 Marc Stevens # # 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 . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 31 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_SED]) AC_LANG_PUSH([C]) ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on Tru64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then ax_pthread_save_CC="$CC" ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"]) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) AC_MSG_RESULT([$ax_pthread_ok]) if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi CC="$ax_pthread_save_CC" CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items with a "," contain both # C compiler flags (before ",") and linker flags (after ","). Other items # starting with a "-" are C compiler flags, and remaining items are # library names, except for "none" which indicates that we try without # any flags at all, and "pthread-config" which is a program returning # the flags for the Pth emulation library. ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 # (Note: HP C rejects this with "bad form for `-t' option") # -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads and # -D_REENTRANT too), HP C (must be checked before -lpthread, which # is present but should not be used directly; and before -mthreads, # because the compiler interprets this as "-mt" + "-hreads") # -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case $host_os in freebsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) ax_pthread_flags="-kthread lthread $ax_pthread_flags" ;; hpux*) # From the cc(1) man page: "[-mt] Sets various -D flags to enable # multi-threading and also sets -lpthread." ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" ;; openedition*) # IBM z/OS requires a feature-test macro to be defined in order to # enable POSIX threads at all, so give the user a hint if this is # not set. (We don't define these ourselves, as they can affect # other portions of the system API in unpredictable ways.) AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], [ # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) AX_PTHREAD_ZOS_MISSING # endif ], [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) ;; solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (N.B.: The stubs are missing # pthread_cleanup_push, or rather a function called by this macro, # so we could check for that, but who knows whether they'll stub # that too in a future libc.) So we'll check first for the # standard Solaris way of linking pthreads (-mt -lpthread). ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" ;; esac # Are we compiling with Clang? AC_CACHE_CHECK([whether $CC is Clang], [ax_cv_PTHREAD_CLANG], [ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ # if defined(__clang__) && defined(__llvm__) AX_PTHREAD_CC_IS_CLANG # endif ], [ax_cv_PTHREAD_CLANG=yes]) fi ]) ax_pthread_clang="$ax_cv_PTHREAD_CLANG" # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) # Note that for GCC and Clang -pthread generally implies -lpthread, # except when -nostdlib is passed. # This is problematic using libtool to build C++ shared libraries with pthread: # [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 # [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 # [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 # To solve this, first try -pthread together with -lpthread for GCC AS_IF([test "x$GCC" = "xyes"], [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"]) # Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first AS_IF([test "x$ax_pthread_clang" = "xyes"], [ax_pthread_flags="-pthread,-lpthread -pthread"]) # The presence of a feature test macro requesting re-entrant function # definitions is, on some systems, a strong hint that pthreads support is # correctly enabled case $host_os in darwin* | hpux* | linux* | osf* | solaris*) ax_pthread_check_macro="_REENTRANT" ;; aix*) ax_pthread_check_macro="_THREAD_SAFE" ;; *) ax_pthread_check_macro="--" ;; esac AS_IF([test "x$ax_pthread_check_macro" = "x--"], [ax_pthread_check_cond=0], [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) if test "x$ax_pthread_ok" = "xno"; then for ax_pthread_try_flag in $ax_pthread_flags; do case $ax_pthread_try_flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; *,*) PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_LINK_IFELSE([AC_LANG_PROGRAM([#include # if $ax_pthread_check_cond # error "$ax_pthread_check_macro must be defined" # endif static void *some_global = NULL; static void routine(void *a) { /* To avoid any unused-parameter or unused-but-set-parameter warning. */ some_global = a; } static void *start_routine(void *a) { return a; }], [pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */])], [ax_pthread_ok=yes], []) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" AC_MSG_RESULT([$ax_pthread_ok]) AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Clang needs special handling, because older versions handle the -pthread # option in a rather... idiosyncratic way if test "x$ax_pthread_clang" = "xyes"; then # Clang takes -pthread; it has never supported any other flag # (Note 1: This will need to be revisited if a system that Clang # supports has POSIX threads in a separate library. This tends not # to be the way of modern systems, but it's conceivable.) # (Note 2: On some systems, notably Darwin, -pthread is not needed # to get POSIX threads support; the API is always present and # active. We could reasonably leave PTHREAD_CFLAGS empty. But # -pthread does define _REENTRANT, and while the Darwin headers # ignore this macro, third-party headers might not.) # However, older versions of Clang make a point of warning the user # that, in an invocation where only linking and no compilation is # taking place, the -pthread option has no effect ("argument unused # during compilation"). They expect -pthread to be passed in only # when source code is being compiled. # # Problem is, this is at odds with the way Automake and most other # C build frameworks function, which is that the same flags used in # compilation (CFLAGS) are also used in linking. Many systems # supported by AX_PTHREAD require exactly this for POSIX threads # support, and in fact it is often not straightforward to specify a # flag that is used only in the compilation phase and not in # linking. Such a scenario is extremely rare in practice. # # Even though use of the -pthread flag in linking would only print # a warning, this can be a nuisance for well-run software projects # that build with -Werror. So if the active version of Clang has # this misfeature, we search for an option to squash it. AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second # step ax_pthread_save_ac_link="$ac_link" ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"` ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ax_pthread_save_CFLAGS="$CFLAGS" for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" ac_link="$ax_pthread_save_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [ac_link="$ax_pthread_2step_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [break]) ]) done ac_link="$ax_pthread_save_ac_link" CFLAGS="$ax_pthread_save_CFLAGS" AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" ]) case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in no | unknown) ;; *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; esac fi # $ax_pthread_clang = yes # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_CACHE_CHECK([for joinable pthread attribute], [ax_cv_PTHREAD_JOINABLE_ATTR], [ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int attr = $ax_pthread_attr; return attr /* ; */])], [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], []) done ]) AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ test "x$ax_pthread_joinable_attr_defined" != "xyes"], [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$ax_cv_PTHREAD_JOINABLE_ATTR], [Define to necessary symbol if this constant uses a non-standard name on your system.]) ax_pthread_joinable_attr_defined=yes ]) AC_CACHE_CHECK([whether more special flags are required for pthreads], [ax_cv_PTHREAD_SPECIAL_FLAGS], [ax_cv_PTHREAD_SPECIAL_FLAGS=no case $host_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac ]) AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ test "x$ax_pthread_special_flags_added" != "xyes"], [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" ax_pthread_special_flags_added=yes]) AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], [ax_cv_PTHREAD_PRIO_INHERIT], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT; return i;]])], [ax_cv_PTHREAD_PRIO_INHERIT=yes], [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ test "x$ax_pthread_prio_inherit_defined" != "xyes"], [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) ax_pthread_prio_inherit_defined=yes ]) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant if test "x$GCC" != "xyes"; then case $host_os in aix*) AS_CASE(["x/$CC"], [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], [#handle absolute path differently from PATH based program lookup AS_CASE(["x$CC"], [x/*], [ AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"]) AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])]) ], [ AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC]) AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])]) ] ) ]) ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" AC_SUBST([PTHREAD_LIBS]) AC_SUBST([PTHREAD_CFLAGS]) AC_SUBST([PTHREAD_CC]) AC_SUBST([PTHREAD_CXX]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) : else ax_pthread_ok=no $2 fi AC_LANG_POP ])dnl AX_PTHREAD jq-1.8.2/m4/ax_prog_bison_version.m40000644000175100017510000000373515215513536013015 # =========================================================================== # Modified from # http://www.gnu.org/software/autoconf-archive/ax_prog_perl_version.html # =========================================================================== # # SYNOPSIS # # AX_PROG_BISON_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE]) # # DESCRIPTION # # Makes sure that bison supports the version indicated. If true the shell # commands in ACTION-IF-TRUE are executed. If not the shell commands in # ACTION-IF-FALSE are run. Note if $PERL is not set the macro will fail. # # Example: # # AC_PROG_YACC # AX_PROG_BISON_VERSION([3.0.0],[ ... ],[ ... ]) # # This will check to make sure that the bison you have supports at least # version 3.0.0. # # NOTE: This macro uses the $YACC variable to perform the check. # AX_WITH_YACC can be used to set that variable prior to running this # macro. The $BISON_VERSION variable will be set with the detected # version. # # LICENSE # # Copyright (c) 2009 Francesco Salvestrini # # 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 any # warranty. #serial 12 AC_DEFUN([AX_PROG_BISON_VERSION],[ AC_REQUIRE([AC_PROG_SED]) AC_REQUIRE([AC_PROG_GREP]) AS_IF([test -n "$YACC"],[ ax_bison_version="$1" AC_MSG_CHECKING([for bison version]) changequote(<<,>>) bison_version=`$YACC --version 2>&1 \ | $GREP bison \ | $SED -e 's/^[^0-9]*//' -e 's/[^0-9]*$//'` changequote([,]) AC_MSG_RESULT($bison_version) AC_SUBST([BISON_VERSION],[$bison_version]) AX_COMPARE_VERSION([$ax_bison_version],[le],[$bison_version],[ : $2 ],[ : $3 ]) ],[ AC_MSG_WARN([could not find bison]) $3 ]) ]) jq-1.8.2/docs/0000755000175100017510000000000015215513665006640 5jq-1.8.2/docs/content/0000755000175100017510000000000015215513536010307 5jq-1.8.2/docs/content/index.yml0000644000175100017510000000607615215513536012072 headline: jq blurb: | jq is a lightweight and flexible command-line JSON processor. body1: | jq is like `sed` for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that `sed`, `awk`, `grep` and friends let you play with text. body2: | jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, `scp` it to a far away machine of the same type, and expect it to work. body3: | jq can mangle the data format that you have into the one that you want with very little effort, and the program to do so is often shorter and simpler than you'd expect. tail: | Go read the [tutorial](./tutorial/) for more, or the [manual](./manual/) for *way* more. Have a question related to jq? You can seek answers on [Stack Overflow](https://stackoverflow.com/) by using the [jq tag](https://stackoverflow.com/questions/tagged/jq), or in the [#jq channel](https://web.libera.chat/#jq) on [Libera.Chat](https://libera.chat/). For more interactive discussions, feel free to join our [Discord server](https://discord.gg/yg6yjNmgAC). news: - date: 1 July 2025 body: | jq 1.8.1 released. See [release notes](https://github.com/jqlang/jq/releases/tag/jq-1.8.1) for details. - date: 1 June 2025 body: | jq 1.8.0 released. See [release notes](https://github.com/jqlang/jq/releases/tag/jq-1.8.0) for details. - date: 13 December 2023 body: | jq 1.7.1 released. Security (CVE-2023-50246, CVE-2023-50268) and bug fixes. See [release notes](https://github.com/jqlang/jq/releases/tag/jq-1.7.1) for details. - date: 7 September 2023 body: | After a five-year hiatus, we've returned with a revitalized [GitHub organization](https://github.com/jqlang) and a much-anticipated 1.7 release, thanks to our new admins and maintainers. Check out the [download](./download/) page for installation options and see the [release notes](https://github.com/jqlang/jq/releases/tag/jq-1.7) for details. - date: 1 November 2018 body: | jq 1.6 released. See installation options on the [download](./download/) page, and the [release notes](https://github.com/jqlang/jq/releases/tag/jq-1.6) for details. - date: 15 August 2015 body: | jq 1.5 released, including new datetime, math, and regexp functions, try/catch syntax, array and object destructuring, a streaming parser, and a module system. See installation options on the [download](./download/) page, and the [release notes](https://github.com/jqlang/jq/releases/tag/jq-1.5) for details. - date: 26 July 2015 body: | jq 1.5rc2 is available. Get it on the [releases](https://github.com/jqlang/jq/releases) page. - date: 01 January 2015 body: | jq 1.5rc1 is available. Get it on the [releases](https://github.com/jqlang/jq/releases) page. - date: 09 June 2014 body: | jq 1.4 (finally) released! Get it on the [download](./download/) page. - date: 19 May 2013 body: | jq 1.3 released. jq-1.8.2/docs/content/manual/0000755000175100017510000000000015215513536011564 5jq-1.8.2/docs/content/manual/v1.6/0000755000175100017510000000000015215513536012256 5jq-1.8.2/docs/content/manual/v1.6/manual.yml0000644000175100017510000037032115215513536014204 --- headline: jq 1.6 Manual body: | A jq program is a "filter": it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks. Filters can be combined in various ways - you can pipe the output of one filter into another filter, or collect the output of a filter into an array. Some filters produce multiple results, for instance there's one that produces all the elements of its input array. Piping that filter into a second runs the second filter for each element of the array. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq. It's important to remember that every filter has an input and an output. Even literals like "hello" or 42 are filters - they take an input but always produce the same literal as output. Operations that combine two filters, like addition, generally feed the same input to both and combine the results. So, you can implement an averaging filter as `add / length` - feeding the input array both to the `add` filter and the `length` filter and then performing the division. But that's getting ahead of ourselves. :) Let's start with something simpler: manpage_intro: | jq(1) -- Command-line JSON processor ==================================== ## SYNOPSIS `jq` [...] [...] `jq` can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents. For instance, running the command `jq 'map(.price) | add'` will take an array of JSON objects as input and return the sum of their "price" fields. `jq` can accept text input as well, but by default, `jq` reads a stream of JSON entities (including numbers and other literals) from `stdin`. Whitespace is only needed to separate entities such as 1 and 2, and true and false. One or more may be specified, in which case `jq` will read input from those instead. The are described in the [INVOKING JQ] section; they mostly concern input and output formatting. The is written in the jq language and specifies how to transform the input file or document. ## FILTERS manpage_epilogue: | ## BUGS Presumably. Report them or discuss them at: https://github.com/jqlang/jq/issues ## AUTHOR Stephen Dolan `` sections: - title: Invoking jq body: | jq filters run on a stream of JSON data. The input to jq is parsed as a sequence of whitespace-separated JSON values which are passed through the provided filter one at a time. The output(s) of the filter are written to standard output, as a sequence of newline-separated JSON data. Note: it is important to mind the shell's quoting rules. As a general rule it's best to always quote (with single-quote characters) the jq program, as too many characters with special meaning to jq are also shell meta-characters. For example, `jq "foo"` will fail on most Unix shells because that will be the same as `jq foo`, which will generally fail because `foo is not defined`. When using the Windows command shell (cmd.exe) it's best to use double quotes around your jq program when given on the command-line (instead of the `-f program-file` option), but then double-quotes in the jq program need backslash escaping. When using the Powershell (`powershell.exe`) or the Powershell Core (`pwsh`/`pwsh.exe`), use single-quote characters around the jq program and backslash-escaped double-quotes (`\"`) inside the jq program. * Unix shells: `jq '.["foo"]'` * Powershell: `jq '.[\"foo\"]'` * Windows command shell: `jq ".[\"foo\"]"` You can affect how jq reads and writes its input and output using some command-line options: * `--null-input` / `-n`: Don't read any input at all. Instead, the filter is run once using `null` as the input. This is useful when using jq as a simple calculator or to construct JSON data from scratch. * `--raw-input` / `-R`: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with `--slurp`, then the entire input is passed to the filter as a single long string. * `--slurp` / `-s`: Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. * `--compact-output` / `-c`: By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. * `--raw-output` / `-r`: With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. * `--join-output` / `-j`: Like `-r` but jq won't print a newline after each output. * `--ascii-output` / `-a`: jq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences (like "\u03bc"). Using this option, you can force jq to produce pure ASCII output with every non-ASCII character replaced with the equivalent escape sequence. * `--sort-keys` / `-S`: Output the fields of each object with the keys in sorted order. * `--color-output` / `-C` and `--monochrome-output` / `-M`: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using `-C`, and disable color with `-M`. Colors can be configured with the `JQ_COLORS` environment variable (see below). * `--tab`: Use a tab for each indentation level instead of two spaces. * `--indent n`: Use the given number of spaces (no more than 7) for indentation. * `--unbuffered`: Flush the output after each JSON object is printed (useful if you're piping a slow data source into jq and piping jq's output elsewhere). * `--stream`: Parse the input in streaming fashion, outputting arrays of path and leaf values (scalars and empty arrays or empty objects). For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]` becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`. This is useful for processing very large inputs. Use this in conjunction with filtering and the `reduce` and `foreach` syntax to reduce large inputs incrementally. * `--seq`: Use the `application/json-seq` MIME type scheme for separating JSON texts in jq's input and output. This means that an ASCII RS (record separator) character is printed before each value on output and an ASCII LF (line feed) is printed after every output. Input JSON texts that fail to parse are ignored (but warned about), discarding all subsequent input until the next RS. This mode also parses the output of jq without the `--seq` option. * `-f filename` / `--from-file filename`: Read filter from the file rather than from a command line, like awk's -f option. You can also use '#' to make comments. * `-L directory`: Prepend `directory` to the search list for modules. If this option is used then no builtin search list is used. See the section on modules below. * `--arg name value`: This option passes a value to the jq program as a predefined variable. If you run jq with `--arg foo bar`, then `$foo` is available in the program and has the value `"bar"`. Note that `value` will be treated as a string, so `--arg foo 123` will bind `$foo` to `"123"`. Named arguments are also available to the jq program as `$ARGS.named`. * `--argjson name JSON-text`: This option passes a JSON-encoded value to the jq program as a predefined variable. If you run jq with `--argjson foo 123`, then `$foo` is available in the program and has the value `123`. * `--slurpfile variable-name filename`: This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable. If you run jq with `--slurpfile foo bar`, then `$foo` is available in the program and has an array whose elements correspond to the texts in the file named `bar`. * `--rawfile variable-name filename`: This option reads in the named file and binds its content to the given global variable. If you run jq with `--rawfile foo bar`, then `$foo` is available in the program and has a string whose content is set to the text in the file named `bar`. * `--argfile variable-name filename`: Do not use. Use `--slurpfile` instead. (This option is like `--slurpfile`, but when the file has just one text, then that is used, else an array of texts is used as in `--slurpfile`.) * `--args`: Remaining arguments are positional string arguments. These are available to the jq program as `$ARGS.positional[]`. * `--jsonargs`: Remaining arguments are positional JSON text arguments. These are available to the jq program as `$ARGS.positional[]`. * `--exit-status` / `-e`: Sets the exit status of jq to 0 if the last output value was neither `false` nor `null`, 1 if the last output value was either `false` or `null`, or 4 if no valid result was ever produced. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran. Another way to set the exit status is with the `halt_error` builtin function. * `--version` / `-V`: Output the jq version and exit with zero. * `--help` / `-h`: Output the jq help and exit with zero. * `--run-tests [filename]`: Runs the tests in the given file or standard input. This must be the last option given and does not honor all preceding options. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line. Compilation failure tests start with a line containing only `%%FAIL`, then a line containing the program to compile, then a line containing an error message to compare to the actual. Be warned that this option can change backwards-incompatibly. - title: Basic filters entries: - title: "Identity: `.`" body: | The absolute simplest filter is `.` . This is a filter that takes its input and produces it unchanged as output. That is, this is the identity operator. Since jq by default pretty-prints all output, this trivial program can be a useful way of formatting JSON output from, say, `curl`. examples: - program: '.' input: '"Hello, world!"' output: ['"Hello, world!"'] - title: "Object Identifier-Index: `.foo`, `.foo.bar`" body: | The simplest *useful* filter is `.foo`. When given a JSON object (aka dictionary or hash) as input, it produces the value at the key "foo", or null if there's none present. A filter of the form `.foo.bar` is equivalent to `.foo|.bar`. This syntax only works for simple, identifier-like keys, that is, keys that are all made of alphanumeric characters and underscore, and which do not start with a digit. If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: `."foo$"`, or else `.["foo$"]`. For example `.["foo::bar"]` and `.["foo.bar"]` work while `.foo::bar` does not, and `.foo.bar` means `.["foo"].["bar"]`. examples: - program: '.foo' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]' input: '{"foo": 42}' output: ['42'] - title: "Optional Object Identifier-Index: `.foo?`" body: | Just like `.foo`, but does not output an error when `.` is not an object. examples: - program: '.foo?' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo?' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]?' input: '{"foo": 42}' output: ['42'] - program: '[.foo?]' input: '[1,2]' output: ['[]'] - title: "Object Index: `.[]`" body: | You can also look up fields of an object using syntax like `.["foo"]` (`.foo` above is a shorthand version of this, but only for identifier-like strings). - title: "Array Index: `.[]`" body: | When the index value is an integer, `.[]` can index arrays. Arrays are zero-based, so `.[2]` returns the third element. Negative indices are allowed, with -1 referring to the last element, -2 referring to the next to last element, and so on. examples: - program: '.[0]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['{"name":"JSON", "good":true}'] - program: '.[2]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['null'] - program: '.[-2]' input: '[1,2,3]' output: ['2'] - title: "Array/String Slice: `.[:]`" body: | The `.[:]` syntax can be used to return a subarray of an array or substring of a string. The array returned by `.[10:15]` will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array). Indices are zero-based. examples: - program: '.[2:4]' input: '["a","b","c","d","e"]' output: ['["c", "d"]'] - program: '.[2:4]' input: '"abcdefghi"' output: ['"cd"'] - program: '.[:3]' input: '["a","b","c","d","e"]' output: ['["a", "b", "c"]'] - program: '.[-2:]' input: '["a","b","c","d","e"]' output: ['["d", "e"]'] - title: "Array/Object Value Iterator: `.[]`" body: | If you use the `.[index]` syntax, but omit the index entirely, it will return *all* of the elements of an array. Running `.[]` with the input `[1,2,3]` will produce the numbers as three separate results, rather than as a single array. A filter of the form `.foo[]` is equivalent to `.foo | .[]`. You can also use this on an object, and it will return all the values of the object. examples: - program: '.[]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: - '{"name":"JSON", "good":true}' - '{"name":"XML", "good":false}' - program: '.[]' input: '[]' output: [] - program: '.foo[]' input: '{"foo":[1,2,3]}' output: ['1','2','3'] - program: '.[]' input: '{"a": 1, "b": 1}' output: ['1', '1'] - title: "`.[]?`" body: | Like `.[]`, but no errors will be output if . is not an array or object. A filter of the form `.foo[]?` is equivalent to `.foo | .[]?`. - title: "Comma: `,`" body: | If two filters are separated by a comma, then the same input will be fed into both and the two filters' output value streams will be concatenated in order: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right. For instance, filter `.foo, .bar`, produces both the "foo" fields and "bar" fields as separate outputs. examples: - program: '.foo, .bar' input: '{"foo": 42, "bar": "something else", "baz": true}' output: ['42', '"something else"'] - program: ".user, .projects[]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['"stedolan"', '"jq"', '"wikiflow"'] - program: '.[4,2]' input: '["a","b","c","d","e"]' output: ['"e"', '"c"'] - title: "Pipe: `|`" body: | The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right. It's pretty much the same as the Unix shell's pipe, if you're used to that. If the one on the left produces multiple results, the one on the right will be run for each of those results. So, the expression `.[] | .foo` retrieves the "foo" field of each element of the input array. Note that `.a.b.c` is the same as `.a | .b | .c`. Note too that `.` is the input value at the particular stage in a "pipeline", specifically: where the `.` expression appears. Thus `.a | . | .b` is the same as `.a.b`, as the `.` in the middle refers to whatever value `.a` produced. examples: - program: '.[] | .name' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['"JSON"', '"XML"'] - title: "Parenthesis" body: | Parenthesis work as a grouping operator just as in any typical programming language. examples: - program: '(. + 2) * 5' input: '1' output: ['15'] - title: Types and Values body: | jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string keys), and "null". Booleans, null, strings and numbers are written the same way as in JSON. Just like everything else in jq, these simple values take an input and produce an output - `42` is a valid jq expression that takes an input, ignores it, and returns 42 instead. entries: - title: "Array construction: `[]`" body: | As in JSON, `[]` is used to construct arrays, as in `[1,2,3]`. The elements of the arrays can be any jq expression, including a pipeline. All of the results produced by all of the expressions are collected into one big array. You can use it to construct an array out of a known quantity of values (as in `[.foo, .bar, .baz]`) or to "collect" all the results of a filter into an array (as in `[.items[].name]`) Once you understand the "," operator, you can look at jq's array syntax in a different light: the expression `[1,2,3]` is not using a built-in syntax for comma-separated arrays, but is instead applying the `[]` operator (collect results) to the expression 1,2,3 (which produces three different results). If you have a filter `X` that produces four results, then the expression `[X]` will produce a single result, an array of four elements. examples: - program: "[.user, .projects[]]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['["stedolan", "jq", "wikiflow"]'] - program: "[ .[] | . * 2]" input: '[1, 2, 3]' output: ['[2, 4, 6]'] - title: "Object Construction: `{}`" body: | Like JSON, `{}` is for constructing objects (aka dictionaries or hashes), as in: `{"a": 42, "b": 17}`. If the keys are "identifier-like", then the quotes can be left off, as in `{a:42, b:17}`. Keys generated by expressions need to be parenthesized, e.g., `{("a"+"b"):59}`. The value can be any expression (although you may need to wrap it in parentheses if it's a complicated one), which gets applied to the {} expression's input (remember, all filters have an input and an output). {foo: .bar} will produce the JSON object `{"foo": 42}` if given the JSON object `{"bar":42, "baz":43}` as its input. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write {user: .user, title: .title} Because that is so common, there's a shortcut syntax for it: `{user, title}`. If one of the expressions produces multiple results, multiple dictionaries will be produced. If the input's {"user":"stedolan","titles":["JQ Primer", "More JQ"]} then the expression {user, title: .titles[]} will produce two outputs: {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} Putting parentheses around the key means it will be evaluated as an expression. With the same input as above, {(.user): .titles} produces {"stedolan": ["JQ Primer", "More JQ"]} examples: - program: '{user, title: .titles[]}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: - '{"user":"stedolan", "title": "JQ Primer"}' - '{"user":"stedolan", "title": "More JQ"}' - program: '{(.user): .titles}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: ['{"stedolan": ["JQ Primer", "More JQ"]}'] - title: "Recursive Descent: `..`" body: | Recursively descends `.`, producing every value. This is the same as the zero-argument `recurse` builtin (see below). This is intended to resemble the XPath `//` operator. Note that `..a` does not work; use `.. | .a` instead. In the example below we use `.. | .a?` to find all the values of object keys "a" in any object found "below" `.`. This is particularly useful in conjunction with `path(EXP)` (also see below) and the `?` operator. examples: - program: '.. | .a?' input: '[[{"a":1}]]' output: ['1'] - title: Builtin operators and functions body: | Some jq operators (for instance, `+`) do different things depending on the type of their arguments (arrays, numbers, etc.). However, jq never does implicit type conversions. If you try to add a string to an object you'll get an error message and no result. entries: - title: "Addition: `+`" body: | The operator `+` takes two filters, applies them both to the same input, and adds the results together. What "adding" means depends on the types involved: - **Numbers** are added by normal arithmetic. - **Arrays** are added by being concatenated into a larger array. - **Strings** are added by being joined into a larger string. - **Objects** are added by merging, that is, inserting all the key-value pairs from both objects into a single combined object. If both objects contain a value for the same key, the object on the right of the `+` wins. (For recursive merge use the `*` operator.) `null` can be added to any value, and returns the other value unchanged. examples: - program: '.a + 1' input: '{"a": 7}' output: ['8'] - program: '.a + .b' input: '{"a": [1,2], "b": [3,4]}' output: ['[1,2,3,4]'] - program: '.a + null' input: '{"a": 1}' output: ['1'] - program: '.a + 1' input: '{}' output: ['1'] - program: '{a: 1} + {b: 2} + {c: 3} + {a: 42}' input: 'null' output: ['{"a": 42, "b": 2, "c": 3}'] - title: "Subtraction: `-`" body: | As well as normal arithmetic subtraction on numbers, the `-` operator can be used on arrays to remove all occurrences of the second array's elements from the first array. examples: - program: '4 - .a' input: '{"a":3}' output: ['1'] - program: . - ["xml", "yaml"] input: '["xml", "yaml", "json"]' output: ['["json"]'] - title: "Multiplication, division, modulo: `*`, `/`, `%`" body: | These infix operators behave as expected when given two numbers. Division by zero raises an error. `x % y` computes x modulo y. Multiplying a string by a number produces the concatenation of that string that many times. `"x" * 0` produces **null**. Dividing a string by another splits the first using the second as separators. Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy. examples: - program: '10 / . * 3' input: '5' output: ['6'] - program: '. / ", "' input: '"a, b,c,d, e"' output: ['["a","b,c,d","e"]'] - program: '{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}' input: 'null' output: ['{"k": {"a": 0, "b": 2, "c": 3}}'] - program: '.[] | (1 / .)?' input: '[1,0,-1]' output: ['1', '-1'] - title: "`length`" body: | The builtin function `length` gets the length of various different types of value: - The length of a **string** is the number of Unicode codepoints it contains (which will be the same as its JSON-encoded length in bytes if it's pure ASCII). - The length of a **number** is its absolute value. - The length of an **array** is the number of elements. - The length of an **object** is the number of key-value pairs. - The length of **null** is zero. - It is an error to use `length` on a **boolean**. examples: - program: '.[] | length' input: '[[1,2], "string", {"a":2}, null, -5]' output: ['2', '6', '1', '0', '5'] - title: "`utf8bytelength`" body: | The builtin function `utf8bytelength` outputs the number of bytes used to encode a string in UTF-8. examples: - program: 'utf8bytelength' input: '"\u03bc"' output: ['2'] - title: "`keys`, `keys_unsorted`" body: | The builtin function `keys`, when given an object, returns its keys in an array. The keys are sorted "alphabetically", by unicode codepoint order. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings. When `keys` is given an array, it returns the valid indices for that array: the integers from 0 to length-1. The `keys_unsorted` function is just like `keys`, but if the input is an object then the keys will not be sorted, instead the keys will roughly be in insertion order. examples: - program: 'keys' input: '{"abc": 1, "abcd": 2, "Foo": 3}' output: ['["Foo", "abc", "abcd"]'] - program: 'keys' input: '[42,3,35]' output: ['[0,1,2]'] - title: "`has(key)`" body: | The builtin function `has` returns whether the input object has the given key, or the input array has an element at the given index. `has($key)` has the same effect as checking whether `$key` is a member of the array returned by `keys`, although `has` will be faster. examples: - program: 'map(has("foo"))' input: '[{"foo": 42}, {}]' output: ['[true, false]'] - program: 'map(has(2))' input: '[[0,1], ["a","b","c"]]' output: ['[false, true]'] - title: "`in`" body: | The builtin function `in` returns whether or not the input key is in the given object, or the input index corresponds to an element in the given array. It is, essentially, an inversed version of `has`. examples: - program: '.[] | in({"foo": 42})' input: '["foo", "bar"]' output: ['true', 'false'] - program: 'map(in([0,1]))' input: '[2, 0]' output: ['[false, true]'] - title: "`map(f)`, `map_values(f)`" body: | For any filter `f`, `map(f)` will run that filter for each element of the input array, and return the outputs in a new array. `map(.+1)` will increment each element of an array of numbers. Similarly, `map_values(f)` will run that filter for each element, but it will return an object when an object is passed. `map(f)` is equivalent to `[.[] | f]`. In fact, this is how it's defined. Similarly, `map_values(f)` is defined as `.[] |= f`. examples: - program: 'map(.+1)' input: '[1,2,3]' output: ['[2,3,4]'] - program: 'map_values(.+1)' input: '{"a": 1, "b": 2, "c": 3}' output: ['{"a": 2, "b": 3, "c": 4}'] - title: "`path(path_expression)`" body: | Outputs array representations of the given path expression in `.`. The outputs are arrays of strings (object keys) and/or numbers (array indices). Path expressions are jq expressions like `.a`, but also `.[]`. There are two types of path expressions: ones that can match exactly, and ones that cannot. For example, `.a.b.c` is an exact match path expression, while `.a[].b` is not. `path(exact_path_expression)` will produce the array representation of the path expression even if it does not exist in `.`, if `.` is `null` or an array or an object. `path(pattern)` will produce array representations of the paths matching `pattern` if the paths exist in `.`. Note that the path expressions are not different from normal expressions. The expression `path(..|select(type=="boolean"))` outputs all the paths to boolean values in `.`, and only those paths. examples: - program: 'path(.a[0].b)' input: 'null' output: ['["a",0,"b"]'] - program: '[path(..)]' input: '{"a":[{"b":1}]}' output: ['[[],["a"],["a",0],["a",0,"b"]]'] - title: "`del(path_expression)`" body: | The builtin function `del` removes a key and its corresponding value from an object. examples: - program: 'del(.foo)' input: '{"foo": 42, "bar": 9001, "baz": 42}' output: ['{"bar": 9001, "baz": 42}'] - program: 'del(.[1, 2])' input: '["foo", "bar", "baz"]' output: ['["foo"]'] - title: "`getpath(PATHS)`" body: | The builtin function `getpath` outputs the values in `.` found at each path in `PATHS`. examples: - program: 'getpath(["a","b"])' input: 'null' output: ['null'] - program: '[getpath(["a","b"], ["a","c"])]' input: '{"a":{"b":0, "c":1}}' output: ['[0, 1]'] - title: "`setpath(PATHS; VALUE)`" body: | The builtin function `setpath` sets the `PATHS` in `.` to `VALUE`. examples: - program: 'setpath(["a","b"]; 1)' input: 'null' output: ['{"a": {"b": 1}}'] - program: 'setpath(["a","b"]; 1)' input: '{"a":{"b":0}}' output: ['{"a": {"b": 1}}'] - program: 'setpath([0,"a"]; 1)' input: 'null' output: ['[{"a":1}]'] - title: "`delpaths(PATHS)`" body: | The builtin function `delpaths` sets the `PATHS` in `.`. `PATHS` must be an array of paths, where each path is an array of strings and numbers. examples: - program: 'delpaths([["a","b"]])' input: '{"a":{"b":1},"x":{"y":2}}' output: ['{"a":{},"x":{"y":2}}'] - title: "`to_entries`, `from_entries`, `with_entries(f)`" body: | These functions convert between an object and an array of key-value pairs. If `to_entries` is passed an object, then for each `k: v` entry in the input, the output array includes `{"key": k, "value": v}`. `from_entries` does the opposite conversion, and `with_entries(f)` is a shorthand for `to_entries | map(f) | from_entries`, useful for doing some operation to all keys and values of an object. `from_entries` accepts `"key"`, `"Key"`, `"name"`, `"Name"`, `"value"`, and `"Value"` as keys. examples: - program: 'to_entries' input: '{"a": 1, "b": 2}' output: ['[{"key":"a", "value":1}, {"key":"b", "value":2}]'] - program: 'from_entries' input: '[{"key":"a", "value":1}, {"key":"b", "value":2}]' output: ['{"a": 1, "b": 2}'] - program: 'with_entries(.key |= "KEY_" + .)' input: '{"a": 1, "b": 2}' output: ['{"KEY_a": 1, "KEY_b": 2}'] - title: "`select(boolean_expression)`" body: | The function `select(f)` produces its input unchanged if `f` returns true for that input, and produces no output otherwise. It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))` will give you `[2,3]`. examples: - program: 'map(select(. >= 2))' input: '[1,5,3,0,7]' output: ['[5,3,7]'] - program: '.[] | select(.id == "second")' input: '[{"id": "first", "val": 1}, {"id": "second", "val": 2}]' output: ['{"id": "second", "val": 2}'] - title: "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `normals`, `finites`, `strings`, `nulls`, `values`, `scalars`" body: | These built-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, normal numbers, finite numbers, strings, null, non-null values, and non-iterables, respectively. examples: - program: '.[]|numbers' input: '[[],{},1,"foo",null,true,false]' output: ['1'] - title: "`empty`" body: | `empty` returns no results. None at all. Not even `null`. It's useful on occasion. You'll know if you need it :) examples: - program: '1, empty, 2' input: 'null' output: ['1', '2'] - program: '[1,2,empty,3]' input: 'null' output: ['[1,2,3]'] - title: "`error`, `error(message)`" body: | Produces an error with the input value, or with the message given as the argument. Errors can be caught with try/catch; see below. When the error value is `null`, it produces nothing and works just like `empty`. So `[null | error]` and `[error(null)]` both emit `[]`. examples: - program: 'try error catch .' input: '"error message"' output: ['"error message"'] - program: 'try error("invalid value: \(.)") catch .' input: '42' output: ['"invalid value: 42"'] - title: "`halt`" body: | Stops the jq program with no further outputs. jq will exit with exit status `0`. - title: "`halt_error`, `halt_error(exit_code)`" body: | Stops the jq program with no further outputs. The input will be printed on `stderr` as raw output (i.e., strings will not have double quotes) with no decoration, not even a newline. The given `exit_code` (defaulting to `5`) will be jq's exit status. For example, `"Error: something went wrong\n"|halt_error(1)`. - title: "`$__loc__`" body: | Produces an object with a "file" key and a "line" key, with the filename and line number where `$__loc__` occurs, as values. examples: - program: 'try error("\($__loc__)") catch .' input: 'null' output: ['"{\"file\":\"\",\"line\":1}"'] - title: "`paths`, `paths(node_filter)`, `leaf_paths`" body: | `paths` outputs the paths to all the elements in its input (except it does not output the empty list, representing . itself). `paths(f)` outputs the paths to any values for which `f` is `true`. That is, `paths(type == "number")` outputs the paths to all numeric values. `leaf_paths` is an alias of `paths(scalars)`; `leaf_paths` is *deprecated* and will be removed in the next major release. examples: - program: '[paths]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1],[1,0],[1,1],[1,1,"a"]]'] - program: '[paths(type == "number")]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1,1,"a"]]'] - title: "`add`" body: | The filter `add` takes as input an array, and produces as output the elements of the array added together. This might mean summed, concatenated or merged depending on the types of the elements of the input array - the rules are the same as those for the `+` operator (described above). If the input is an empty array, `add` returns `null`. examples: - program: add input: '["a","b","c"]' output: ['"abc"'] - program: add input: '[1, 2, 3]' output: ['6'] - program: add input: '[]' output: ["null"] - title: "`any`, `any(condition)`, `any(generator; condition)`" body: | The filter `any` takes as input an array of boolean values, and produces `true` as output if any of the elements of the array are `true`. If the input is an empty array, `any` returns `false`. The `any(condition)` form applies the given condition to the elements of the input array. The `any(generator; condition)` form applies the given condition to all the outputs of the given generator. examples: - program: any input: '[true, false]' output: ["true"] - program: any input: '[false, false]' output: ["false"] - program: any input: '[]' output: ["false"] - title: "`all`, `all(condition)`, `all(generator; condition)`" body: | The filter `all` takes as input an array of boolean values, and produces `true` as output if all of the elements of the array are `true`. The `all(condition)` form applies the given condition to the elements of the input array. The `all(generator; condition)` form applies the given condition to all the outputs of the given generator. If the input is an empty array, `all` returns `true`. examples: - program: all input: '[true, false]' output: ["false"] - program: all input: '[true, true]' output: ["true"] - program: all input: '[]' output: ["true"] - title: "`flatten`, `flatten(depth)`" body: | The filter `flatten` takes as input an array of nested arrays, and produces a flat array in which all arrays inside the original array have been recursively replaced by their values. You can pass an argument to it to specify how many levels of nesting to flatten. `flatten(2)` is like `flatten`, but going only up to two levels deep. examples: - program: flatten input: '[1, [2], [[3]]]' output: ["[1, 2, 3]"] - program: flatten(1) input: '[1, [2], [[3]]]' output: ["[1, 2, [3]]"] - program: flatten input: '[[]]' output: ["[]"] - program: flatten input: '[{"foo": "bar"}, [{"foo": "baz"}]]' output: ['[{"foo": "bar"}, {"foo": "baz"}]'] - title: "`range(upto)`, `range(from; upto)`, `range(from; upto; by)`" body: | The `range` function produces a range of numbers. `range(4; 10)` produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers are produced as separate outputs. Use `[range(4; 10)]` to get a range as an array. The one argument form generates numbers from 0 to the given number, with an increment of 1. The two argument form generates numbers from `from` to `upto` with an increment of 1. The three argument form generates numbers `from` to `upto` with an increment of `by`. examples: - program: 'range(2; 4)' input: 'null' output: ['2', '3'] - program: '[range(2; 4)]' input: 'null' output: ['[2,3]'] - program: '[range(4)]' input: 'null' output: ['[0,1,2,3]'] - program: '[range(0; 10; 3)]' input: 'null' output: ['[0,3,6,9]'] - program: '[range(0; 10; -1)]' input: 'null' output: ['[]'] - program: '[range(0; -5; -1)]' input: 'null' output: ['[0,-1,-2,-3,-4]'] - title: "`floor`" body: | The `floor` function returns the floor of its numeric input. examples: - program: 'floor' input: '3.14159' output: ['3'] - title: "`sqrt`" body: | The `sqrt` function returns the square root of its numeric input. examples: - program: 'sqrt' input: '9' output: ['3'] - title: "`tonumber`" body: | The `tonumber` function parses its input as a number. It will convert correctly-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input. examples: - program: '.[] | tonumber' input: '[1, "1"]' output: ['1', '1'] - title: "`tostring`" body: | The `tostring` function prints its input as a string. Strings are left unchanged, and all other values are JSON-encoded. examples: - program: '.[] | tostring' input: '[1, "1", [1]]' output: ['"1"', '"1"', '"[1]"'] - title: "`type`" body: | The `type` function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object. examples: - program: 'map(type)' input: '[0, false, [], {}, null, "hello"]' output: ['["number", "boolean", "array", "object", "null", "string"]'] - title: "`infinite`, `nan`, `isinfinite`, `isnan`, `isfinite`, `isnormal`" body: | Some arithmetic operations can yield infinities and "not a number" (NaN) values. The `isinfinite` builtin returns `true` if its input is infinite. The `isnan` builtin returns `true` if its input is a NaN. The `infinite` builtin returns a positive infinite value. The `nan` builtin returns a NaN. The `isnormal` builtin returns true if its input is a normal number. Note that division by zero raises an error. Currently most arithmetic operations operating on infinities, NaNs, and sub-normals do not raise errors. examples: - program: '.[] | (infinite * .) < 0' input: '[-1, 1]' output: ['true', 'false'] - program: 'infinite, nan | type' input: 'null' output: ['"number"', '"number"'] - title: "`sort`, `sort_by(path_expression)`" body: | The `sort` functions sorts its input, which must be an array. Values are sorted in the following order: * `null` * `false` * `true` * numbers * strings, in alphabetical order (by unicode codepoint value) * arrays, in lexical order * objects The ordering for objects is a little complex: first they're compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key. `sort_by` may be used to sort by a particular field of an object, or by applying any jq filter. `sort_by(f)` compares two elements by comparing the result of `f` on each element. When `f` produces multiple values, it firstly compares the first values, and the second values if the first values are equal, and so on. examples: - program: 'sort' input: '[8,3,null,6]' output: ['[null,3,6,8]'] - program: 'sort_by(.foo)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}]'] - program: 'sort_by(.foo, .bar)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}]'] - title: "`group_by(path_expression)`" body: | `group_by(.foo)` takes as input an array, groups the elements having the same `.foo` field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the `.foo` field. Any jq expression, not just a field access, may be used in place of `.foo`. The sorting order is the same as described in the `sort` function above. examples: - program: 'group_by(.foo)' input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]' output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]'] - title: "`min`, `max`, `min_by(path_exp)`, `max_by(path_exp)`" body: | Find the minimum or maximum element of the input array. The `min_by(path_exp)` and `max_by(path_exp)` functions allow you to specify a particular field or property to examine, e.g. `min_by(.foo)` finds the object with the smallest `foo` field. examples: - program: 'min' input: '[5,4,2,7]' output: ['2'] - program: 'max_by(.foo)' input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]' output: ['{"foo":2, "bar":3}'] - title: "`unique`, `unique_by(path_exp)`" body: | The `unique` function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed. The `unique_by(path_exp)` function will keep only one element for each value obtained by applying the argument. Think of it as making an array by taking one element out of every group produced by `group`. examples: - program: 'unique' input: '[1,2,5,3,5,3,1,3]' output: ['[1,2,3,5]'] - program: 'unique_by(.foo)' input: '[{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}]' output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]'] - program: 'unique_by(length)' input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]' output: ['["bacon", "chunky", "asparagus"]'] - title: "`reverse`" body: | This function reverses an array. examples: - program: 'reverse' input: '[1,2,3,4]' output: ['[4,3,2,1]'] - title: "`contains(element)`" body: | The filter `contains(b)` will produce true if b is completely contained within the input. A string B is contained in a string A if B is a substring of A. An array B is contained in an array A if all elements in B are contained in any element in A. An object B is contained in object A if all of the values in B are contained in the value in A with the same key. All other types are assumed to be contained in each other if they are equal. examples: - program: 'contains("bar")' input: '"foobar"' output: ['true'] - program: 'contains(["baz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['true'] - program: 'contains(["bazzzzz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['false'] - program: 'contains({foo: 12, bar: [{barp: 12}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['true'] - program: 'contains({foo: 12, bar: [{barp: 15}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['false'] - title: "`indices(s)`" body: | Outputs an array containing the indices in `.` where `s` occurs. The input may be an array, in which case if `s` is an array then the indices output will be those where all elements in `.` match those of `s`. examples: - program: 'indices(", ")' input: '"a,b, cd, efg, hijk"' output: ['[3,7,12]'] - program: 'indices(1)' input: '[0,1,2,1,3,1,4]' output: ['[1,3,5]'] - program: 'indices([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['[1,8]'] - title: "`index(s)`, `rindex(s)`" body: | Outputs the index of the first (`index`) or last (`rindex`) occurrence of `s` in the input. examples: - program: 'index(", ")' input: '"a,b, cd, efg, hijk"' output: ['3'] - program: 'index(1)' input: '[0,1,2,1,3,1,4]' output: ['1'] - program: 'index([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['1'] - program: 'rindex(", ")' input: '"a,b, cd, efg, hijk"' output: ['12'] - program: 'rindex(1)' input: '[0,1,2,1,3,1,4]' output: ['5'] - program: 'rindex([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['8'] - title: "`inside`" body: | The filter `inside(b)` will produce true if the input is completely contained within b. It is, essentially, an inversed version of `contains`. examples: - program: 'inside("foobar")' input: '"bar"' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["baz", "bar"]' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["bazzzzz", "bar"]' output: ['false'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 12}]}' output: ['true'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 15}]}' output: ['false'] - title: "`startswith(str)`" body: | Outputs `true` if . starts with the given string argument. examples: - program: '[.[]|startswith("foo")]' input: '["fo", "foo", "barfoo", "foobar", "barfoob"]' output: ['[false, true, false, true, false]'] - title: "`endswith(str)`" body: | Outputs `true` if . ends with the given string argument. examples: - program: '[.[]|endswith("foo")]' input: '["foobar", "barfoo"]' output: ['[false, true]'] - title: "`combinations`, `combinations(n)`" body: | Outputs all combinations of the elements of the arrays in the input array. If given an argument `n`, it outputs all combinations of `n` repetitions of the input array. examples: - program: 'combinations' input: '[[1,2], [3, 4]]' output: ['[1, 3]', '[1, 4]', '[2, 3]', '[2, 4]'] - program: 'combinations(2)' input: '[0, 1]' output: ['[0, 0]', '[0, 1]', '[1, 0]', '[1, 1]'] - title: "`ltrimstr(str)`" body: | Outputs its input with the given prefix string removed, if it starts with it. examples: - program: '[.[]|ltrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "afoo"]' output: ['["fo","","barfoo","bar","afoo"]'] - title: "`rtrimstr(str)`" body: | Outputs its input with the given suffix string removed, if it ends with it. examples: - program: '[.[]|rtrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "foob"]' output: ['["fo","","bar","foobar","foob"]'] - title: "`explode`" body: | Converts an input string into an array of the string's codepoint numbers. examples: - program: 'explode' input: '"foobar"' output: ['[102,111,111,98,97,114]'] - title: "`implode`" body: | The inverse of explode. examples: - program: 'implode' input: '[65, 66, 67]' output: ['"ABC"'] - title: "`split(str)`" body: | Splits an input string on the separator argument. examples: - program: 'split(", ")' input: '"a, b,c,d, e, "' output: ['["a","b,c,d","e",""]'] - title: "`join(str)`" body: | Joins the array of elements given as input, using the argument as separator. It is the inverse of `split`: that is, running `split("foo") | join("foo")` over any input string returns said input string. Numbers and booleans in the input are converted to strings. Null values are treated as empty strings. Arrays and objects in the input are not supported. examples: - program: 'join(", ")' input: '["a","b,c,d","e"]' output: ['"a, b,c,d, e"'] - program: 'join(" ")' input: '["a",1,2.3,true,null,false]' output: ['"a 1 2.3 true false"'] - title: "`ascii_downcase`, `ascii_upcase`" body: | Emit a copy of the input string with its alphabetic characters (a-z and A-Z) converted to the specified case. examples: - program: 'ascii_upcase' input: '"useful but not for é"' output: ['"USEFUL BUT NOT FOR é"'] - title: "`while(cond; update)`" body: | The `while(cond; update)` function allows you to repeatedly apply an update to `.` until `cond` is false. Note that `while(cond; update)` is internally defined as a recursive jq function. Recursive calls within `while` will not consume additional memory if `update` produces at most one output for each input. See advanced topics below. examples: - program: '[while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: "`until(cond; next)`" body: | The `until(cond; next)` function allows you to repeatedly apply the expression `next`, initially to `.` then to its own output, until `cond` is true. For example, this can be used to implement a factorial function (see below). Note that `until(cond; next)` is internally defined as a recursive jq function. Recursive calls within `until()` will not consume additional memory if `next` produces at most one output for each input. See advanced topics below. examples: - program: '[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]' input: '4' output: ['24'] - title: "`recurse(f)`, `recurse`, `recurse(f; condition)`, `recurse_down`" body: | The `recurse(f)` function allows you to search through a recursive structure, and extract interesting data from all levels. Suppose your input represents a filesystem: {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} Now suppose you want to extract all of the filenames present. You need to retrieve `.name`, `.children[].name`, `.children[].children[].name`, and so on. You can do this with: recurse(.children[]) | .name When called without an argument, `recurse` is equivalent to `recurse(.[]?)`. `recurse(f)` is identical to `recurse(f; true)` and can be used without concerns about recursion depth. `recurse(f; condition)` is a generator which begins by emitting . and then emits in turn .|f, .|f|f, .|f|f|f, ... so long as the computed value satisfies the condition. For example, to generate all the integers, at least in principle, one could write `recurse(.+1; true)`. For legacy reasons, `recurse_down` exists as an alias to calling `recurse` without arguments. This alias is considered *deprecated* and will be removed in the next major release. The recursive calls in `recurse` will not consume additional memory whenever `f` produces at most a single output for each input. examples: - program: 'recurse(.foo[])' input: '{"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}' output: - '{"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}' - '{"foo":[]}' - '{"foo":[{"foo":[]}]}' - '{"foo":[]}' - program: 'recurse' input: '{"a":0,"b":[1]}' output: - '{"a":0,"b":[1]}' - '0' - '[1]' - '1' - program: 'recurse(. * .; . < 20)' input: '2' output: ['2', '4', '16'] - title: "`walk(f)`" body: | The `walk(f)` function applies f recursively to every component of the input entity. When an array is encountered, f is first applied to its elements and then to the array itself; when an object is encountered, f is first applied to all the values and then to the object. In practice, f will usually test the type of its input, as illustrated in the following examples. The first example highlights the usefulness of processing the elements of an array of arrays before processing the array itself. The second example shows how all the keys of all the objects within the input can be considered for alteration. examples: - program: 'walk(if type == "array" then sort else . end)' input: '[[4, 1, 7], [8, 5, 2], [3, 6, 9]]' output: - '[[1,4,7],[2,5,8],[3,6,9]]' - program: 'walk( if type == "object" then with_entries( .key |= sub( "^_+"; "") ) else . end )' input: '[ { "_a": { "__b": 2 } } ]' output: - '[{"a":{"b":2}}]' - title: "`$ENV`, `env`" body: | `$ENV` is an object representing the environment variables as set when the jq program started. `env` outputs an object representing jq's current environment. At the moment there is no builtin for setting environment variables. examples: - program: '$ENV.PAGER' input: 'null' output: ['"less"'] - program: 'env.PAGER' input: 'null' output: ['"less"'] - title: "`transpose`" body: | Transpose a possibly jagged matrix (an array of arrays). Rows are padded with nulls so the result is always rectangular. examples: - program: 'transpose' input: '[[1], [2,3]]' output: ['[[1,2],[null,3]]'] - title: "`bsearch(x)`" body: | `bsearch(x)` conducts a binary search for x in the input array. If the input is sorted and contains x, then `bsearch(x)` will return its index in the array; otherwise, if the array is sorted, it will return (-1 - ix) where ix is an insertion point such that the array would still be sorted after the insertion of x at ix. If the array is not sorted, `bsearch(x)` will return an integer that is probably of no interest. examples: - program: 'bsearch(0)' input: '[0,1]' output: ['0'] - program: 'bsearch(0)' input: '[1,2,3]' output: ['-1'] - program: 'bsearch(4) as $ix | if $ix < 0 then .[-(1+$ix)] = 4 else . end' input: '[1,2,3]' output: ['[1,2,3,4]'] - title: "String interpolation: `\\(exp)`" body: | Inside a string, you can put an expression inside parens after a backslash. Whatever the expression returns will be interpolated into the string. examples: - program: '"The input was \(.), which is one less than \(.+1)"' input: '42' output: ['"The input was 42, which is one less than 43"'] - title: "Convert to/from JSON" body: | The `tojson` and `fromjson` builtins dump values as JSON texts or parse JSON texts into values, respectively. The `tojson` builtin differs from `tostring` in that `tostring` returns strings unmodified, while `tojson` encodes strings as JSON strings. examples: - program: '[.[]|tostring]' input: '[1, "foo", ["foo"]]' output: ['["1","foo","[\"foo\"]"]'] - program: '[.[]|tojson]' input: '[1, "foo", ["foo"]]' output: ['["1","\"foo\"","[\"foo\"]"]'] - program: '[.[]|tojson|fromjson]' input: '[1, "foo", ["foo"]]' output: ['[1,"foo",["foo"]]'] - title: "Format strings and escaping" body: | The `@foo` syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth. `@foo` can be used as a filter on its own, the possible escapings are: * `@text`: Calls `tostring`, see that function for details. * `@json`: Serializes the input as JSON. * `@html`: Applies HTML/XML escaping, by mapping the characters `<>&'"` to their entity equivalents `<`, `>`, `&`, `'`, `"`. * `@uri`: Applies percent-encoding, by mapping all reserved URI characters to a `%XX` sequence. * `@csv`: The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition. * `@tsv`: The input must be an array, and it is rendered as TSV (tab-separated values). Each input array will be printed as a single line. Fields are separated by a single tab (ascii `0x09`). Input characters line-feed (ascii `0x0a`), carriage-return (ascii `0x0d`), tab (ascii `0x09`) and backslash (ascii `0x5c`) will be output as escape sequences `\n`, `\r`, `\t`, `\\` respectively. * `@sh`: The input is escaped suitable for use in a command-line for a POSIX shell. If the input is an array, the output will be a series of space-separated strings. * `@base64`: The input is converted to base64 as specified by RFC 4648. * `@base64d`: The inverse of `@base64`, input is decoded as specified by RFC 4648. Note\: If the decoded string is not UTF-8, the results are undefined. This syntax can be combined with string interpolation in a useful way. You can follow a `@foo` token with a string literal. The contents of the string literal will *not* be escaped. However, all interpolations made inside that string literal will be escaped. For instance, @uri "https://www.google.com/search?q=\(.search)" will produce the following output for the input `{"search":"what is jq?"}`: "https://www.google.com/search?q=what%20is%20jq%3F" Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. examples: - program: '@html' input: '"This works if x < y"' output: ['"This works if x < y"'] - program: '@sh "echo \(.)"' input: "\"O'Hara's Ale\"" output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""] - program: '@base64' input: '"This is a message"' output: ['"VGhpcyBpcyBhIG1lc3NhZ2U="'] - program: '@base64d' input: '"VGhpcyBpcyBhIG1lc3NhZ2U="' output: ['"This is a message"'] - title: "Dates" body: | jq provides some basic date handling functionality, with some high-level and low-level builtins. In all cases these builtins deal exclusively with time in UTC. The `fromdateiso8601` builtin parses datetimes in the ISO 8601 format to a number of seconds since the Unix epoch (1970-01-01T00:00:00Z). The `todateiso8601` builtin does the inverse. The `fromdate` builtin parses datetime strings. Currently `fromdate` only supports ISO 8601 datetime strings, but in the future it will attempt to parse datetime strings in more formats. The `todate` builtin is an alias for `todateiso8601`. The `now` builtin outputs the current time, in seconds since the Unix epoch. Low-level jq interfaces to the C-library time functions are also provided: `strptime`, `strftime`, `strflocaltime`, `mktime`, `gmtime`, and `localtime`. Refer to your host operating system's documentation for the format strings used by `strptime` and `strftime`. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality. The `gmtime` builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of Greenwich Mean Time as an array of numbers representing (in this order): the year, the month (zero-based), the day of the month (one-based), the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year -- all one-based unless otherwise stated. The day of the week number may be wrong on some systems for dates before March 1st 1900, or after December 31 2099. The `localtime` builtin works like the `gmtime` builtin, but using the local timezone setting. The `mktime` builtin consumes "broken down time" representations of time output by `gmtime` and `strptime`. The `strptime(fmt)` builtin parses input strings matching the `fmt` argument. The output is in the "broken down time" representation consumed by `mktime` and output by `gmtime`. The `strftime(fmt)` builtin formats a time (GMT) with the given format. The `strflocaltime` does the same, but using the local timezone setting. The format strings for `strptime` and `strftime` are described in typical C library documentation. The format string for ISO 8601 datetime is `"%Y-%m-%dT%H:%M:%SZ"`. jq may not support some or all of this date functionality on some systems. In particular, the `%u` and `%j` specifiers for `strptime(fmt)` are not supported on macOS. examples: - program: 'fromdate' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")' input: '"2015-03-05T23:51:47Z"' output: ['[2015,2,5,23,51,47,4,63]'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")|mktime' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - title: "SQL-Style Operators" body: | jq provides a few SQL-style operators. * INDEX(stream; index_expression): This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream. * JOIN($idx; stream; idx_expr; join_expr): This builtin joins the values from the given stream to the given index. The index's keys are computed by applying the given index expression to each value from the given stream. An array of the value in the stream and the corresponding value from the index is fed to the given join expression to produce each result. * JOIN($idx; stream; idx_expr): Same as `JOIN($idx; stream; idx_expr; .)`. * JOIN($idx; idx_expr): This builtin joins the input `.` to the given index, applying the given index expression to `.` to compute the index key. The join operation is as described above. * IN(s): This builtin outputs `true` if `.` appears in the given stream, otherwise it outputs `false`. * IN(source; s): This builtin outputs `true` if any value in the source stream appears in the second stream, otherwise it outputs `false`. - title: "`builtins`" body: | Returns a list of all builtin functions in the format `name/arity`. Since functions with the same name but different arities are considered separate functions, `all/0`, `all/1`, and `all/2` would all be present in the list. - title: Conditionals and Comparisons entries: - title: "`==`, `!=`" body: | The expression 'a == b' will produce 'true' if the result of a and b are equal (that is, if they represent equivalent JSON documents) and 'false' otherwise. In particular, strings are never considered equal to numbers. If you're coming from JavaScript, jq's == is like JavaScript's === - considering values equal only when they have the same type as well as the same value. != is "not equal", and 'a != b' returns the opposite value of 'a == b' examples: - program: '.[] == 1' input: '[1, 1.0, "1", "banana"]' output: ['true', 'true', 'false', 'false'] - title: if-then-else-end body: | `if A then B else C end` will act the same as `B` if `A` produces a value other than false or null, but act the same as `C` otherwise. Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you'll sometimes have to be more explicit about the condition you want. You can't test whether, e.g. a string is empty using `if .name then A else B end`, you'll need something more like `if .name == "" then A else B end` instead. If the condition `A` produces multiple results, then `B` is evaluated once for each result that is not false or null, and `C` is evaluated once for each false or null. More cases can be added to an if using `elif A then B` syntax. examples: - program: |- if . == 0 then "zero" elif . == 1 then "one" else "many" end input: '2' output: ['"many"'] - title: "`>`, `>=`, `<=`, `<`" body: | The comparison operators `>`, `>=`, `<=`, `<` return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively). The ordering is the same as that described for `sort`, above. examples: - program: '. < 5' input: '2' output: ['true'] - title: "`and`, `or`, `not`" body: | jq supports the normal Boolean operators `and`, `or`, `not`. They have the same standard of truth as if expressions - `false` and `null` are considered "false values", and anything else is a "true value". If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input. `not` is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in `.foo and .bar | not`. These three only produce the values `true` and `false`, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default". If you want to use this form of "or", picking between two values rather than evaluating a condition, see the `//` operator below. examples: - program: '42 and "a string"' input: 'null' output: ['true'] - program: '(true, false) or false' input: 'null' output: ['true', 'false'] - program: '(true, true) and (true, false)' input: 'null' output: ['true', 'false', 'true', 'false'] - program: '[true, false | not]' input: 'null' output: ['[false, true]'] - title: "Alternative operator: `//`" body: | A filter of the form `a // b` produces the same results as `a`, if `a` produces results other than `false` and `null`. Otherwise, `a // b` produces the same results as `b`. This is useful for providing defaults: `.foo // 1` will evaluate to `1` if there's no `.foo` element in the input. It's similar to how `or` is sometimes used in Python (jq's `or` operator is reserved for strictly Boolean operations). examples: - program: '.foo // 42' input: '{"foo": 19}' output: ['19'] - program: '.foo // 42' input: '{}' output: ['42'] - title: try-catch body: | Errors can be caught by using `try EXP catch EXP`. The first expression is executed, and if it fails then the second is executed with the error message. The output of the handler, if any, is output as if it had been the output of the expression to try. The `try EXP` form uses `empty` as the exception handler. examples: - program: 'try .a catch ". is not an object"' input: 'true' output: ['". is not an object"'] - program: '[.[]|try .a]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: 'try error("some exception") catch .' input: 'true' output: ['"some exception"'] - title: Breaking out of control structures body: | A convenient use of try/catch is to break out of control structures like `reduce`, `foreach`, `while`, and so on. For example: # Repeat an expression until it raises "break" as an # error, then stop repeating without re-raising the error. # But if the error caught is not "break" then re-raise it. try repeat(exp) catch if .=="break" then empty else error jq has a syntax for named lexical labels to "break" or "go (back) to": label $out | ... break $out ... The `break $label_name` expression will cause the program to act as though the nearest (to the left) `label $label_name` produced `empty`. The relationship between the `break` and corresponding `label` is lexical: the label has to be "visible" from the break. To break out of a `reduce`, for example: label $out | reduce .[] as $item (null; if .==false then break $out else ... end) The following jq program produces a syntax error: break $out because no label `$out` is visible. - title: "Error Suppression / Optional Operator: `?`" body: | The `?` operator, used as `EXP?`, is shorthand for `try EXP`. examples: - program: '[.[] | .a?]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: '[.[] | tonumber?]' input: '["1", "invalid", "3", 4]' output: ['[1, 3, 4]'] - title: Regular expressions body: | jq uses the Oniguruma regular expression library, as do PHP, Ruby, TextMate, Sublime Text, etc, so the description here will focus on jq specifics. The jq regex filters are defined so that they can be used using one of these patterns: STRING | FILTER(REGEX) STRING | FILTER(REGEX; FLAGS) STRING | FILTER([REGEX]) STRING | FILTER([REGEX, FLAGS]) where: * STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation; * REGEX, after string interpolation, should be a valid regular expression; * FILTER is one of `test`, `match`, or `capture`, as described below. FLAGS is a string consisting of one of more of the supported flags: * `g` - Global search (find all matches, not just the first) * `i` - Case insensitive search * `m` - Multi line mode (`.` will match newlines) * `n` - Ignore empty matches * `p` - Both s and m modes are enabled * `s` - Single line mode (`^` -> `\A`, `$` -> `\Z`) * `l` - Find longest possible matches * `x` - Extended regex format (ignore whitespace and comments) To match a whitespace with the `x` flag, use `\s`, e.g. jq -n '"a b" | test("a\\sb"; "x")' Note that certain flags may also be specified within REGEX, e.g. jq -n '("test", "TEst", "teST", "TEST") | test("(?i)te(?-i)st")' evaluates to: `true`, `true`, `false`, `false`. entries: - title: "`test(val)`, `test(regex; flags)`" body: | Like `match`, but does not return match objects, only `true` or `false` for whether or not the regex matches the input. examples: - program: 'test("foo")' input: '"foo"' output: ['true'] - program: '.[] | test("a b c # spaces are ignored"; "ix")' input: '["xabcd", "ABC"]' output: ['true', 'true'] - title: "`match(val)`, `match(regex; flags)`" body: | **match** outputs an object for each match it finds. Matches have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of the match * `string` - the string that it matched * `captures` - an array of objects representing capturing groups. Capturing group objects have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of this capturing group * `string` - the string that was captured * `name` - the name of the capturing group (or `null` if it was unnamed) Capturing groups that did not match anything return an offset of -1 examples: - program: 'match("(abc)+"; "g")' input: '"abc abc"' output: - '{"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]}' - '{"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]}' - program: 'match("foo")' input: '"foo bar foo"' output: ['{"offset": 0, "length": 3, "string": "foo", "captures": []}'] - program: 'match(["foo", "ig"])' input: '"foo bar FOO"' output: - '{"offset": 0, "length": 3, "string": "foo", "captures": []}' - '{"offset": 8, "length": 3, "string": "FOO", "captures": []}' - program: 'match("foo (?bar)? foo"; "ig")' input: '"foo bar foo foo foo"' output: - '{"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]}' - '{"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}' - program: '[ match("."; "g")] | length' input: '"abc"' output: ['3'] - title: "`capture(val)`, `capture(regex; flags)`" body: | Collects the named captures in a JSON object, with the name of each capture as the key, and the matched string as the corresponding value. examples: - program: 'capture("(?[a-z]+)-(?[0-9]+)")' input: '"xyzzy-14"' output: ['{ "a": "xyzzy", "n": "14" }'] - title: "`scan(regex)`, `scan(regex; flags)`" body: | Emit a stream of the non-overlapping substrings of the input that match the regex in accordance with the flags, if any have been specified. If there is no match, the stream is empty. To capture all the matches for each input string, use the idiom `[ expr ]`, e.g. `[ scan(regex) ]`. examples: - program: 'scan("c")' input: '"abcdefabc"' output: ['"c"', '"c"'] - title: "`split(regex; flags)`" body: | For backwards compatibility, `split` splits on a string, not a regex. examples: - program: 'split(", *"; null)' input: '"ab,cd, ef"' output: ['["ab","cd","ef"]'] - title: "`splits(regex)`, `splits(regex; flags)`" body: | These provide the same results as their `split` counterparts, but as a stream instead of an array. examples: - program: 'splits(", *")' input: '"ab,cd, ef, gh"' output: ['"ab"','"cd"','"ef"','"gh"'] - title: "`sub(regex; tostring)`, `sub(regex; string; flags)`" body: | Emit the string obtained by replacing the first match of regex in the input string with `tostring`, after interpolation. `tostring` should be a jq string, and may contain references to named captures. The named captures are, in effect, presented as a JSON object (as constructed by `capture`) to `tostring`, so a reference to a captured variable named "x" would take the form: `"\(.x)"`. examples: - program: 'sub("[^a-z]*(?[a-z]+)"; "Z\(.x)"; "g")' input: '"123abc456def"' output: ['"ZabcZdef"'] - title: "`gsub(regex; string)`, `gsub(regex; string; flags)`" body: | `gsub` is like `sub` but all the non-overlapping occurrences of the regex are replaced by the string, after interpolation. examples: - program: 'gsub("(?.)[^a]*"; "+\(.x)-")' input: '"Abcabc"' output: ['"+A-+a-"'] - title: Advanced features body: | Variables are an absolute necessity in most programming languages, but they're relegated to an "advanced feature" in jq. In most languages, variables are the only means of passing around data. If you calculate a value, and you want to use it more than once, you'll need to store it in a variable. To pass a value to another part of the program, you'll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data. It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq's standard library (many jq functions such as `map` and `select` are in fact written in jq). jq has reduction operators, which are very powerful but a bit tricky. Again, these are mostly used internally, to define some useful bits of jq's standard library. It may not be obvious at first, but jq is all about generators (yes, as often found in other languages). Some utilities are provided to help deal with generators. Some minimal I/O support (besides reading JSON from standard input, and writing JSON to standard output) is available. Finally, there is a module/library system. entries: - title: "Variable / Symbolic Binding Operator: `... as $identifier | ...`" body: | In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next. Many expressions, for instance `a + b`, pass their input to two distinct subexpressions (here `a` and `b` are both passed the same input), so variables aren't usually necessary in order to use a value twice. For instance, calculating the average value of an array of numbers requires a few variables in most languages - at least one to hold the array, perhaps one for each element or for a loop counter. In jq, it's simply `add / length` - the `add` expression is given the array and produces its sum, and the `length` expression is given the array and produces its length. So, there's generally a cleaner way to solve most problems in jq than defining variables. Still, sometimes they do make things easier, so jq lets you define variables using `expression as $variable`. All variable names start with `$`. Here's a slightly uglier version of the array-averaging example: length as $array_length | add / $array_length We'll need a more complicated problem to find a situation where using variables actually makes our lives easier. Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names. Our input looks like: {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} We want to produce the posts with the author field containing a real name, as in: {"title": "First post", "author": "Anonymous Coward"} {"title": "A well-written article", "author": "Person McPherson"} We use a variable, $names, to store the realnames object, so that we can refer to it later when looking up author usernames: .realnames as $names | .posts[] | {title, author: $names[.author]} The expression `exp as $x | ...` means: for each value of expression `exp`, run the rest of the pipeline with the entire original input, and with `$x` set to that value. Thus `as` functions as something of a foreach loop. Just as `{foo}` is a handy way of writing `{foo: .foo}`, so `{$foo}` is a handy way of writing `{foo: $foo}`. Multiple variables may be declared using a single `as` expression by providing a pattern that matches the structure of the input (this is known as "destructuring"): . as {realnames: $names, posts: [$first, $second]} | ... The variable declarations in array patterns (e.g., `. as [$first, $second]`) bind to the elements of the array in from the element at index zero on up, in order. When there is no value at the index for an array pattern element, `null` is bound to that variable. Variables are scoped over the rest of the expression that defines them, so .realnames as $names | (.posts[] | {title, author: $names[.author]}) will work, but (.realnames as $names | .posts[]) | {title, author: $names[.author]} won't. For programming language theorists, it's more accurate to say that jq variables are lexically-scoped bindings. In particular there's no way to change the value of a binding; one can only setup a new binding with the same name, but which will not be visible where the old one was. examples: - program: '.bar as $x | .foo | . + $x' input: '{"foo":10, "bar":200}' output: ['210'] - program: '. as $i|[(.*2|. as $i| $i), $i]' input: '5' output: ['[10,5]'] - program: '. as [$a, $b, {c: $c}] | $a + $b + $c' input: '[2, 3, {"c": 4, "d": 5}]' output: ['9'] - program: '.[] as [$a, $b] | {a: $a, b: $b}' input: '[[0], [0, 1], [2, 1, 0]]' output: ['{"a":0,"b":null}', '{"a":0,"b":1}', '{"a":2,"b":1}'] - title: 'Destructuring Alternative Operator: `?//`' body: | The destructuring alternative operator provides a concise mechanism for destructuring an input that can take one of several forms. Suppose we have an API that returns a list of resources and events associated with them, and we want to get the user_id and timestamp of the first event for each resource. The API (having been clumsily converted from XML) will only wrap the events in an array if the resource has multiple events: {"resources": [{"id": 1, "kind": "widget", "events": {"action": "create", "user_id": 1, "ts": 13}}, {"id": 2, "kind": "widget", "events": [{"action": "create", "user_id": 1, "ts": 14}, {"action": "destroy", "user_id": 1, "ts": 15}]}]} We can use the destructuring alternative operator to handle this structural change simply: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$user_id, $ts}]} | {$user_id, $kind, $id, $ts} Or, if we aren't sure if the input is an array of values or an object: .[] as [$id, $kind, $user_id, $ts] ?// {$id, $kind, $user_id, $ts} | ... Each alternative need not define all of the same variables, but all named variables will be available to the subsequent expression. Variables not matched in the alternative that succeeded will be `null`: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$first_user_id, $first_ts}]} | {$user_id, $first_user_id, $kind, $id, $ts, $first_ts} Additionally, if the subsequent expression returns an error, the alternative operator will attempt to try the next binding. Errors that occur during the final alternative are passed through. [[3]] | .[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end examples: - program: '.[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":4}', '{"a":1,"b":2,"d":3,"e":4}'] - program: '.[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":null}', '{"a":1,"b":2,"d":null,"e":4}'] - program: '.[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end' input: '[[3]]' output: ['{"a":null,"b":3}'] - title: 'Defining Functions' body: | You can give a filter a name using "def" syntax: def increment: . + 1; From then on, `increment` is usable as a filter just like a builtin function (in fact, this is how many of the builtins are defined). A function may take arguments: def map(f): [.[] | f]; Arguments are passed as _filters_ (functions with no arguments), _not_ as values. The same argument may be referenced multiple times with different inputs (here `f` is run for each element of the input array). Arguments to a function work more like callbacks than like value arguments. This is important to understand. Consider: def foo(f): f|f; 5|foo(.*2) The result will be 20 because `f` is `.*2`, and during the first invocation of `f` `.` will be 5, and the second time it will be 10 (5 * 2), so the result will be 20. Function arguments are filters, and filters expect an input when invoked. If you want the value-argument behaviour for defining simple functions, you can just use a variable: def addvalue(f): f as $f | map(. + $f); Or use the short-hand: def addvalue($f): ...; With either definition, `addvalue(.foo)` will add the current input's `.foo` field to each element of the array. Do note that calling `addvalue(.[])` will cause the `map(. + $f)` part to be evaluated once per value in the value of `.` at the call site. Multiple definitions using the same function name are allowed. Each re-definition replaces the previous one for the same number of function arguments, but only for references from functions (or main program) subsequent to the re-definition. See also the section below on scoping. examples: - program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))' input: '[[1,2],[10,20]]' output: ['[[1,2,1], [10,20,10]]'] - program: 'def addvalue(f): f as $x | map(. + $x); addvalue(.[0])' input: '[[1,2],[10,20]]' output: ['[[1,2,1,2], [10,20,1,2]]'] - title: 'Scoping' body: | There are two types of symbols in jq: value bindings (a.k.a., "variables"), and functions. Both are scoped lexically, with expressions being able to refer only to symbols that have been defined "to the left" of them. The only exception to this rule is that functions can refer to themselves so as to be able to create recursive functions. For example, in the following expression there is a binding which is visible "to the right" of it, `... | .*3 as $times_three | [. + $times_three] | ...`, but not "to the left". Consider this expression now, `... | (.*3 as $times_three | [. + $times_three]) | ...`: here the binding `$times_three` is _not_ visible past the closing parenthesis. - title: "`isempty(exp)`" body: | Returns true if `exp` produces no outputs, false otherwise. examples: - program: 'isempty(empty)' input: 'null' output: ['true'] - program: 'isempty(.[])' input: '[]' output: ['true'] - program: 'isempty(.[])' input: '[1,2,3]' output: ['false'] - title: "`limit(n; exp)`" body: | The `limit` function extracts up to `n` outputs from `exp`. examples: - program: '[limit(3;.[])]' input: '[0,1,2,3,4,5,6,7,8,9]' output: ['[0,1,2]'] - title: "`first(expr)`, `last(expr)`, `nth(n; expr)`" body: | The `first(expr)` and `last(expr)` functions extract the first and last values from `expr`, respectively. The `nth(n; expr)` function extracts the nth value output by `expr`. This can be defined as `def nth(n; expr): last(limit(n + 1; expr));`. Note that `nth(n; expr)` doesn't support negative values of `n`. examples: - program: '[first(range(.)), last(range(.)), nth(./2; range(.))]' input: '10' output: ['[0,9,5]'] - title: "`first`, `last`, `nth(n)`" body: | The `first` and `last` functions extract the first and last values from any array at `.`. The `nth(n)` function extracts the nth value of any array at `.`. examples: - program: '[range(.)]|[first, last, nth(5)]' input: '10' output: ['[0,9,5]'] - title: "`reduce`" body: | The `reduce` syntax allows you to combine all of the results of an expression by accumulating them into a single answer. The form is `reduce EXP as $var (INIT; UPDATE)`. As an example, we'll pass `[1,2,3]` to this expression: reduce .[] as $item (0; . + $item) For each result that `.[]` produces, `. + $item` is run to accumulate a running total, starting from 0 as the input value. In this example, `.[]` produces the results `1`, `2`, and `3`, so the effect is similar to running something like this: 0 | 1 as $item | . + $item | 2 as $item | . + $item | 3 as $item | . + $item examples: - program: 'reduce .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['15'] - program: 'reduce .[] as [$i,$j] (0; . + $i * $j)' input: '[[1,2],[3,4],[5,6]]' output: ['44'] - program: 'reduce .[] as {$x,$y} (null; .x += $x | .y += [$y])' input: '[{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}]' output: ['{"x":"abc","y":[1,2,3]}'] - title: "`foreach`" body: | The `foreach` syntax is similar to `reduce`, but intended to allow the construction of `limit` and reducers that produce intermediate results. The form is `foreach EXP as $var (INIT; UPDATE; EXTRACT)`. As an example, we'll pass `[1,2,3]` to this expression: foreach .[] as $item (0; . + $item; [$item, . * 2]) Like the `reduce` syntax, `. + $item` is run for each result that `.[]` produces, but `[$item, . * 2]` is run for each intermediate values. In this example, since the intermediate values are `1`, `3`, and `6`, the `foreach` expression produces `[1,2]`, `[2,6]`, and `[3,12]`. So the effect is similar to running something like this: 0 | 1 as $item | . + $item | [$item, . * 2], 2 as $item | . + $item | [$item, . * 2], 3 as $item | . + $item | [$item, . * 2] When `EXTRACT` is omitted, the identity filter is used. That is, it outputs the intermediate values as they are. examples: - program: 'foreach .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['1','3','6','10','15'] - program: 'foreach .[] as $item (0; . + $item; [$item, . * 2])' input: '[1,2,3,4,5]' output: ['[1,2]','[2,6]','[3,12]','[4,20]','[5,30]'] - program: 'foreach .[] as $item (0; . + 1; {index: ., $item})' input: '["foo", "bar", "baz"]' output: - '{"index":1,"item":"foo"}' - '{"index":2,"item":"bar"}' - '{"index":3,"item":"baz"}' - title: Recursion body: | As described above, `recurse` uses recursion, and any jq function can be recursive. The `while` builtin is also implemented in terms of recursion. Tail calls are optimized whenever the expression to the left of the recursive call outputs its last value. In practice this means that the expression to the left of the recursive call should not produce more than one output for each input. For example: def recurse(f): def r: ., (f | select(. != null) | r); r; def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; def repeat(exp): def _repeat: exp, _repeat; _repeat; - title: Generators and iterators body: | Some jq operators and functions are actually generators in that they can produce zero, one, or more values for each input, just as one might expect in other programming languages that have generators. For example, `.[]` generates all the values in its input (which must be an array or an object), `range(0; 10)` generates the integers between 0 and 10, and so on. Even the comma operator is a generator, generating first the values generated by the expression to the left of the comma, then for each of those, the values generate by the expression on the right of the comma. The `empty` builtin is the generator that produces zero outputs. The `empty` builtin backtracks to the preceding generator expression. All jq functions can be generators just by using builtin generators. It is also possible to define new generators using only recursion and the comma operator. If the recursive call(s) is(are) "in tail position" then the generator will be efficient. In the example below the recursive call by `_range` to itself is in tail position. The example shows off three advanced topics: tail recursion, generator construction, and sub-functions. examples: - program: 'def range(init; upto; by): def _range: if (by > 0 and . < upto) or (by < 0 and . > upto) then ., ((.+by)|_range) else . end; if by == 0 then init else init|_range end | select((by > 0 and . < upto) or (by < 0 and . > upto)); range(0; 10; 3)' input: 'null' output: ['0', '3', '6', '9'] - program: 'def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; [while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: 'Math' body: | jq currently only has IEEE754 double-precision (64-bit) floating point number support. Besides simple arithmetic operators such as `+`, jq also has most standard math functions from the C math library. C math functions that take a single input argument (e.g., `sin()`) are available as zero-argument jq functions. C math functions that take two input arguments (e.g., `pow()`) are available as two-argument jq functions that ignore `.`. C math functions that take three input arguments are available as three-argument jq functions that ignore `.`. Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library. Unavailable math functions will be defined but will raise an error. One-input C math functions: `acos` `acosh` `asin` `asinh` `atan` `atanh` `cbrt` `ceil` `cos` `cosh` `erf` `erfc` `exp` `exp10` `exp2` `expm1` `fabs` `floor` `gamma` `j0` `j1` `lgamma` `log` `log10` `log1p` `log2` `logb` `nearbyint` `pow10` `rint` `round` `significand` `sin` `sinh` `sqrt` `tan` `tanh` `tgamma` `trunc` `y0` `y1`. Two-input C math functions: `atan2` `copysign` `drem` `fdim` `fmax` `fmin` `fmod` `frexp` `hypot` `jn` `ldexp` `modf` `nextafter` `nexttoward` `pow` `remainder` `scalb` `scalbln` `yn`. Three-input C math functions: `fma`. See your system's manual for more information on each of these. - title: 'I/O' body: | At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read. Two builtins functions are provided for this, `input` and `inputs`, that read from the same sources (e.g., `stdin`, files named on the command-line) as jq itself. These two builtins, and jq's own reading actions, can be interleaved with each other. Two builtins provide minimal output capabilities, `debug`, and `stderr`. (Recall that a jq program's output values are always output as JSON texts on `stdout`.) The `debug` builtin can have application-specific behavior, such as for executables that use the libjq C API but aren't the jq executable itself. The `stderr` builtin outputs its input in raw mode to stderr with no additional decoration, not even a newline. Most jq builtins are referentially transparent, and yield constant and repeatable value streams when applied to constant inputs. This is not true of I/O builtins. entries: - title: "`input`" body: | Outputs one new input. echo 1 2 3 4 | jq '[., input]' # [1,2] [3,4] - title: "`inputs`" body: | Outputs all remaining inputs, one by one. This is primarily useful for reductions over a program's inputs. echo 1 2 3 | jq -n 'reduce inputs as $i (0; . + $i)' # 6 - title: "`debug`" body: | Causes a debug message based on the input value to be produced. The jq executable wraps the input value with `["DEBUG:", ]` and prints that and a newline on stderr, compactly. This may change in the future. - title: "`stderr`" body: | Prints its input in raw and compact mode to stderr with no additional decoration, not even a newline. - title: "`input_filename`" body: | Returns the name of the file whose input is currently being filtered. Note that this will not work well unless jq is running in a UTF-8 locale. - title: "`input_line_number`" body: | Returns the line number of the input currently being filtered. - title: 'Streaming' body: | With the `--stream` option jq can parse input texts in a streaming fashion, allowing jq programs to start processing large JSON texts immediately rather than after the parse completes. If you have a single JSON text that is 1GB in size, streaming it will allow you to process it much more quickly. However, streaming isn't easy to deal with as the jq program will have `[, ]` (and a few other forms) as inputs. Several builtins are provided to make handling streams easier. The examples below use the streamed form of `[0,[1]]`, which is `[[0],0],[[1,0],1],[[1,0]],[[1]]`. Streaming forms include `[, ]` (to indicate any scalar value, empty array, or empty object), and `[]` (to indicate the end of an array or object). Future versions of jq run with `--stream` and `--seq` may output additional forms such as `["error message"]` when an input text fails to parse. entries: - title: "`truncate_stream(stream_expression)`" body: | Consumes a number as input and truncates the corresponding number of path elements from the left of the outputs of the given streaming expression. examples: - program: 'truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]])' input: '1' output: ['[[0],2]', '[[0]]'] - title: "`fromstream(stream_expression)`" body: | Outputs values corresponding to the stream expression's outputs. examples: - program: 'fromstream(1|truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]]))' input: 'null' output: ['[2]'] - title: "`tostream`" body: | The `tostream` builtin outputs the streamed form of its input. examples: - program: '. as $dot|fromstream($dot|tostream)|.==$dot' input: '[0,[1,{"a":1},{"b":2}]]' output: ['true'] - title: Assignment body: | Assignment works a little differently in jq than in most programming languages. jq doesn't distinguish between references to and copies of something - two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object". If an object has two fields which are arrays, `.foo` and `.bar`, and you append something to `.foo`, then `.bar` will not get bigger, even if you've previously set `.bar = .foo`. If you're used to programming in languages like Python, Java, Ruby, JavaScript, etc. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance it doesn't actually do that, but that's the general idea). This means that it's impossible to build circular values in jq (such as an array whose first element is itself). This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON. All the assignment operators in jq have path expressions on the left-hand side (LHS). The right-hand side (RHS) provides values to set to the paths named by the LHS path expressions. Values in jq are always immutable. Internally, assignment works by using a reduction to compute new, replacement values for `.` that have had all the desired assignments applied to `.`, then outputting the modified value. This might be made clear by this example: `{a:{b:{c:1}}} | (.a.b|=3), .`. This will output `{"a":{"b":3}}` and `{"a":{"b":{"c":1}}}` because the last sub-expression, `.`, sees the original value, not the modified value. Most users will want to use modification assignment operators, such as `|=` or `+=`, rather than `=`. Note that the LHS of assignment operators refers to a value in `.`. Thus `$var.foo = 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo = 1` instead. Note too that `.a,.b=0` does not set `.a` and `.b`, but `(.a,.b)=0` sets both. entries: - title: "Update-assignment: `|=`" body: | This is the "update" operator `|=`. It takes a filter on the right-hand side and works out the new value for the property of `.` being assigned to by running the old value through this expression. For instance, `(.foo, .bar) |= .+1` will build an object with the "foo" field set to the input's "foo" plus 1, and the "bar" field set to the input's "bar" plus 1. The left-hand side can be any general path expression; see `path()`. Note that the left-hand side of `|=` refers to a value in `.`. Thus `$var.foo |= . + 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo |= . + 1` instead. If the right-hand side outputs no values (i.e., `empty`), then the left-hand side path will be deleted, as with `del(path)`. If the right-hand side outputs multiple values, only the first one will be used (COMPATIBILITY NOTE: in jq 1.5 and earlier releases, it used to be that only the last one was used). examples: - program: '(..|select(type=="boolean")) |= if . then 1 else 0 end' input: '[true,false,[5,true,[true,[false]],false]]' output: ['[1,0,[5,1,[1,[0]],0]]'] - title: "Arithmetic update-assignment: `+=`, `-=`, `*=`, `/=`, `%=`, `//=`" body: | jq has a few operators of the form `a op= b`, which are all equivalent to `a |= . op b`. So, `+= 1` can be used to increment values, being the same as `|= . + 1`. examples: - program: .foo += 1 input: '{"foo": 42}' output: ['{"foo": 43}'] - title: "Plain assignment: `=`" body: | This is the plain assignment operator. Unlike the others, the input to the right-hand-side (RHS) is the same as the input to the left-hand-side (LHS) rather than the value at the LHS path, and all values output by the RHS will be used (as shown below). If the RHS of '=' produces multiple values, then for each such value jq will set the paths on the left-hand side to the value and then it will output the modified `.`. For example, `(.a,.b)=range(2)` outputs `{"a":0,"b":0}`, then `{"a":1,"b":1}`. The "update" assignment forms (see above) do not do this. This example should show the difference between '=' and '|=': Provide input `{"a": {"b": 10}, "b": 20}` to the programs: `.a = .b` `.a |= .b` The former will set the "a" field of the input to the "b" field of the input, and produce the output `{"a": 20, "b": 20}`. The latter will set the "a" field of the input to the "a" field's "b" field, producing `{"a": 10, "b": 20}`. Another example of the difference between `=` and `|=`: `null|(.a,.b)=range(3)` outputs `{"a":0,"b":0}, {"a":1,"b":1}, {"a":2,"b":2}`, while `null|(.a,.b)|=range(3)` outputs just `{"a":0,"b":0}`. - title: Complex assignments body: | Lots more things are allowed on the left-hand side of a jq assignment than in most languages. We've already seen simple field accesses on the left hand side, and it's no surprise that array accesses work just as well: .posts[0].title = "JQ Manual" What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: .posts[].comments |= . + ["this is great"] That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts). When jq encounters an assignment like 'a = b', it records the "path" taken to select a part of the input document while executing a. This path is then used to find which part of the input to change while executing the assignment. Any filter may be used on the left-hand side of an equals - whichever paths it selects from the input will be where the assignment is performed. This is a very powerful operation. Suppose we wanted to add a comment to blog posts, using the same "blog" input above. This time, we only want to comment on the posts written by "stedolan". We can find those posts using the "select" function described earlier: .posts[] | select(.author == "stedolan") The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] - title: Modules body: | jq has a library/module system. Modules are files whose names end in `.jq`. Modules imported by a program are searched for in a default search path (see below). The `import` and `include` directives allow the importer to alter this path. Paths in the search path are subject to various substitutions. For paths starting with "~/", the user's home directory is substituted for "~". For paths starting with "$ORIGIN/", the directory where the jq executable is located is substituted for "$ORIGIN". For paths starting with "./" or paths that are ".", the path of the including file is substituted for ".". For top-level programs given on the command-line, the current directory is used. Import directives can optionally specify a search path to which the default is appended. The default search path is the search path given to the `-L` command-line option, else `["~/.jq", "$ORIGIN/../lib/jq", "$ORIGIN/../lib"]`. Null and empty string path elements terminate search path processing. A dependency with relative path "foo/bar" would be searched for in "foo/bar.jq" and "foo/bar/bar.jq" in the given search path. This is intended to allow modules to be placed in a directory along with, for example, version control files, README files, and so on, but also to allow for single-file modules. Consecutive components with the same name are not allowed to avoid ambiguities (e.g., "foo/foo"). For example, with `-L$HOME/.jq` a module `foo` can be found in `$HOME/.jq/foo.jq` and `$HOME/.jq/foo/foo.jq`. If "$HOME/.jq" is a file, it is sourced into the main program. entries: - title: "`import RelativePathString as NAME [];`" body: | Imports a module found at the given path relative to a directory in a search path. A ".jq" suffix will be added to the relative path string. The module's symbols are prefixed with "NAME::". The optional metadata must be a constant jq expression. It should be an object with keys like "homepage" and so on. At this time jq only uses the "search" key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The "search" key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`include RelativePathString [];`" body: | Imports a module found at the given path relative to a directory in a search path as if it were included in place. A ".jq" suffix will be added to the relative path string. The module's symbols are imported into the caller's namespace as if the module's content had been included directly. The optional metadata must be a constant jq expression. It should be an object with keys like "homepage" and so on. At this time jq only uses the "search" key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. - title: "`import RelativePathString as $NAME [];`" body: | Imports a JSON file found at the given path relative to a directory in a search path. A ".json" suffix will be added to the relative path string. The file's data will be available as `$NAME::NAME`. The optional metadata must be a constant jq expression. It should be an object with keys like "homepage" and so on. At this time jq only uses the "search" key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The "search" key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`module ;`" body: | This directive is entirely optional. It's not required for proper operation. It serves only the purpose of providing metadata that can be read with the `modulemeta` builtin. The metadata must be a constant jq expression. It should be an object with keys like "homepage". At this time jq doesn't use this metadata, but it is made available to users via the `modulemeta` builtin. - title: "`modulemeta`" body: | Takes a module name as input and outputs the module's metadata as an object, with the module's imports (including metadata) as an array value for the "deps" key. Programs can use this to query a module's metadata, which they could then use to, for example, search for, download, and install missing dependencies. - title: Colors body: | To configure alternative colors just set the `JQ_COLORS` environment variable to colon-delimited list of partial terminal escape sequences like `"1;31"`, in this order: - color for `null` - color for `false` - color for `true` - color for numbers - color for strings - color for arrays - color for objects The default color scheme is the same as setting `"JQ_COLORS=1;30:0;39:0;39:0;39:0;32:1;39:1;39"`. This is not a manual for VT100/ANSI escapes. However, each of these color specifications should consist of two numbers separated by a semi-colon, where the first number is one of these: - 1 (bright) - 2 (dim) - 4 (underscore) - 5 (blink) - 7 (reverse) - 8 (hidden) and the second is one of these: - 30 (black) - 31 (red) - 32 (green) - 33 (yellow) - 34 (blue) - 35 (magenta) - 36 (cyan) - 37 (white) jq-1.8.2/docs/content/manual/v1.3/0000755000175100017510000000000015215513536012253 5jq-1.8.2/docs/content/manual/v1.3/manual.yml0000644000175100017510000013345515215513536014206 --- headline: jq 1.3 Manual body: | A jq program is a "filter": it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks. Filters can be combined in various ways - you can pipe the output of one filter into another filter, or collect the output of a filter into an array. Some filters produce multiple results, for instance there's one that produces all the elements of its input array. Piping that filter into a second runs the second filter for each element of the array. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq. It's important to remember that every filter has an input and an output. Even literals like "hello" or 42 are filters - they take an input but always produce the same literal as output. Operations that combine two filters, like addition, generally feed the same input to both and combine the results. So, you can implement an averaging filter as `add / length` - feeding the input array both to the `add` filter and the `length` filter and dividing the results. But that's getting ahead of ourselves. :) Let's start with something simpler: manpage_intro: | jq(1) -- Command-line JSON processor ==================================== ## SYNOPSIS `jq` [...] [...] `jq` can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents. For instance, running the command `jq 'map(.price) | add'` will take an array of JSON objects as input and return the sum of their "price" fields. By default, `jq` reads a stream of JSON objects (whitespace separated) from `stdin`. One or more may be specified, in which case `jq` will read input from those instead. The are described in the [INVOKING JQ] section, they mostly concern input and output formatting. The is written in the jq language and specifies how to transform the input document. ## FILTERS manpage_epilogue: | ## BUGS Presumably. Report them or discuss them at: https://github.com/jqlang/jq/issues ## AUTHOR Stephen Dolan `` sections: - title: Invoking jq body: | jq filters run on a stream of JSON data. The input to jq is parsed as a sequence of whitespace-separated JSON values which are passed through the provided filter one at a time. The output(s) of the filter are written to standard output, as a sequence of newline-separated JSON data. You can affect how jq reads and writes its input and output using some command-line options: * `--null-input` / `-n`: Don't read any input at all. Instead, the filter is run once using `null` as the input. This is useful when using jq as a simple calculator or to construct JSON data from scratch. * `--raw-input` / `-R`: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with `--slurp`, then the entire input is passed to the filter as a single long string. * `--slurp` / `-s`: Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. * `--compact-output` / `-c`: By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. * `--raw-output` / `-r`: With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. * `--ascii-output` / `-a`: jq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences (like "\u03bc"). Using this option, you can force jq to produce pure ASCII output with every non-ASCII character replaced with the equivalent escape sequence. * `--color-output` / `-C` and `--monochrome-output` / `-M`: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using `-C`, and disable color with `-M`. * `--arg name value`: This option passes a value to the jq program as a predefined variable. If you run jq with `--arg foo bar`, then `$foo` is available in the program and has the value `"bar"`. - title: Basic filters entries: - title: "`.`" body: | The absolute simplest (and least interesting) filter is `.`. This is a filter that takes its input and produces it unchanged as output. Since jq by default pretty-prints all output, this trivial program can be a useful way of formatting JSON output from, say, `curl`. examples: - program: '.' input: '"Hello, world!"' output: ['"Hello, world!"'] - title: "`.foo`" body: | The simplest *useful* filter is .foo. When given a JSON object (aka dictionary or hash) as input, it produces the value at the key "foo", or null if there's none present. examples: - program: '.foo' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - title: "`.[foo]`, `.[2]`, `.[10:15]`" body: | You can also look up fields of an object using syntax like `.["foo"]` (`.foo` above is a shorthand version of this). This one works for arrays as well, if the key is an integer. Arrays are zero-based, so `.[2]` returns the third element of the array. The `.[10:15]` syntax can be used to return a subarray of an array. The array returned by `.[10:15]` will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array). examples: - program: '.[0]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['{"name":"JSON", "good":true}'] - program: '.[2]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['null'] - program: '.[2:4]' input: '["a","b","c","d","e"]' output: ['["c", "d"]'] - program: '.[:3]' input: '["a","b","c","d","e"]' output: ['["a", "b", "c"]'] - program: '.[-2:]' input: '["a","b","c","d","e"]' output: ['["d", "e"]'] - title: "`.[]`" body: | If you use the `.[foo]` syntax, but omit the index entirely, it will return *all* of the elements of an array. Running `.[]` with the input `[1,2,3]` will produce the numbers as three separate results, rather than as a single array. You can also use this on an object, and it will return all the values of the object. examples: - program: '.[]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: - '{"name":"JSON", "good":true}' - '{"name":"XML", "good":false}' - program: '.[]' input: '[]' output: [] - program: '.[]' input: '{"a": 1, "b": 1}' output: ['1', '1'] - title: "`,`" body: | If two filters are separated by a comma, then the input will be fed into both and there will be multiple outputs: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right. For instance, filter `.foo, .bar`, produces both the "foo" fields and "bar" fields as separate outputs. examples: - program: '.foo, .bar' input: '{"foo": 42, "bar": "something else", "baz": true}' output: ['42', '"something else"'] - program: ".user, .projects[]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['"stedolan"', '"jq"', '"wikiflow"'] - program: '.[4,2]' input: '["a","b","c","d","e"]' output: ['"e"', '"c"'] - title: "`|`" body: | The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right. It's pretty much the same as the Unix shell's pipe, if you're used to that. If the one on the left produces multiple results, the one on the right will be run for each of those results. So, the expression `.[] | .foo` retrieves the "foo" field of each element of the input array. examples: - program: '.[] | .name' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['"JSON"', '"XML"'] - title: Types and Values body: | jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string keys), and "null". Booleans, null, strings and numbers are written the same way as in JSON. Just like everything else in jq, these simple values take an input and produce an output - `42` is a valid jq expression that takes an input, ignores it, and returns 42 instead. entries: - title: "Array construction: `[]`" body: | As in JSON, `[]` is used to construct arrays, as in `[1,2,3]`. The elements of the arrays can be any jq expression. All of the results produced by all of the expressions are collected into one big array. You can use it to construct an array out of a known quantity of values (as in `[.foo, .bar, .baz]`) or to "collect" all the results of a filter into an array (as in `[.items[].name]`) Once you understand the "," operator, you can look at jq's array syntax in a different light: the expression `[1,2,3]` is not using a built-in syntax for comma-separated arrays, but is instead applying the `[]` operator (collect results) to the expression 1,2,3 (which produces three different results). If you have a filter `X` that produces four results, then the expression `[X]` will produce a single result, an array of four elements. examples: - program: "[.user, .projects[]]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['["stedolan", "jq", "wikiflow"]'] - title: "Objects: `{}`" body: | Like JSON, `{}` is for constructing objects (aka dictionaries or hashes), as in: `{"a": 42, "b": 17}`. If the keys are "sensible" (all alphabetic characters), then the quotes can be left off. The value can be any expression (although you may need to wrap it in parentheses if it's a complicated one), which gets applied to the {} expression's input (remember, all filters have an input and an output). {foo: .bar} will produce the JSON object `{"foo": 42}` if given the JSON object `{"bar":42, "baz":43}`. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write {user: .user, title: .title} Because that's so common, there's a shortcut syntax: `{user, title}`. If one of the expressions produces multiple results, multiple dictionaries will be produced. If the input's {"user":"stedolan","titles":["JQ Primer", "More JQ"]} then the expression {user, title: .titles[]} will produce two outputs: {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} Putting parentheses around the key means it will be evaluated as an expression. With the same input as above, {(.user): .titles} produces {"stedolan": ["JQ Primer", "More JQ"]} examples: - program: '{user, title: .titles[]}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: - '{"user":"stedolan", "title": "JQ Primer"}' - '{"user":"stedolan", "title": "More JQ"}' - program: '{(.user): .titles}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: ['{"stedolan": ["JQ Primer", "More JQ"]}'] - title: Builtin operators and functions body: | Some jq operators (for instance, `+`) do different things depending on the type of their arguments (arrays, numbers, etc.). However, jq never does implicit type conversions. If you try to add a string to an object you'll get an error message and no result. entries: - title: "Addition: `+`" body: | The operator `+` takes two filters, applies them both to the same input, and adds the results together. What "adding" means depends on the types involved: - **Numbers** are added by normal arithmetic. - **Arrays** are added by being concatenated into a larger array. - **Strings** are added by being joined into a larger string. - **Objects** are added by merging, that is, inserting all the key-value pairs from both objects into a single combined object. If both objects contain a value for the same key, the object on the right of the `+` wins. `null` can be added to any value, and returns the other value unchanged. examples: - program: '.a + 1' input: '{"a": 7}' output: ['8'] - program: '.a + .b' input: '{"a": [1,2], "b": [3,4]}' output: ['[1,2,3,4]'] - program: '.a + null' input: '{"a": 1}' output: ['1'] - program: '.a + 1' input: '{}' output: ['1'] - program: '{a: 1} + {b: 2} + {c: 3} + {a: 42}' input: 'null' output: ['{"a": 42, "b": 2, "c": 3}'] - title: "Subtraction: `-`" body: | As well as normal arithmetic subtraction on numbers, the `-` operator can be used on arrays to remove all occurrences of the second array's elements from the first array. examples: - program: '4 - .a' input: '{"a":3}' output: ['1'] - program: . - ["xml", "yaml"] input: '["xml", "yaml", "json"]' output: ['["json"]'] - title: "Multiplication, division: `*` and `/`" body: | These operators only work on numbers, and do the expected. examples: - program: '10 / . * 3' input: '5' output: ['6'] - title: '`length`' body: | The builtin function `length` gets the length of various different types of value: - The length of a **string** is the number of Unicode codepoints it contains (which will be the same as its JSON-encoded length in bytes if it's pure ASCII). - The length of an **array** is the number of elements. - The length of an **object** is the number of key-value pairs. - The length of **null** is zero. examples: - program: '.[] | length' input: '[[1,2], "string", {"a":2}, null]' output: ['2', '6', '1', '0'] - title: '`keys`' body: | The builtin function `keys`, when given an object, returns its keys in an array. The keys are sorted "alphabetically", by unicode codepoint order. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings. When `keys` is given an array, it returns the valid indices for that array: the integers from 0 to length-1. examples: - program: 'keys' input: '{"abc": 1, "abcd": 2, "Foo": 3}' output: ['["Foo", "abc", "abcd"]'] - program: 'keys' input: '[42,3,35]' output: ['[0,1,2]'] - title: '`has`' body: | The builtin function `has` returns whether the input object has the given key, or the input array has an element at the given index. `has($key)` has the same effect as checking whether `$key` is a member of the array returned by `keys`, although `has` will be faster. examples: - program: 'map(has("foo"))' input: '[{"foo": 42}, {}]' output: ['[true, false]'] - program: 'map(has(2))' input: '[[0,1], ["a","b","c"]]' output: ['[false, true]'] - title: "`to_entries`, `from_entries`, `with_entries(f)`" body: | These functions convert between an object and an array of key-value pairs. If `to_entries` is passed an object, then for each `k: v` entry in the input, the output array includes `{"key": k, "value": v}`. `from_entries` does the opposite conversion, and `with_entries(f)` is a shorthand for `to_entries | map(f) | from_entries`, useful for doing some operation to all keys and values of an object. examples: - program: 'to_entries' input: '{"a": 1, "b": 2}' output: ['[{"key":"a", "value":1}, {"key":"b", "value":2}]'] - program: 'from_entries' input: '[{"key":"a", "value":1}, {"key":"b", "value":2}]' output: ['{"a": 1, "b": 2}'] - program: 'with_entries(.key |= "KEY_" + .)' input: '{"a": 1, "b": 2}' output: ['{"KEY_a": 1, "KEY_b": 2}'] - title: '`select`' body: | The function `select(foo)` produces its input unchanged if `foo` returns true for that input, and produces no output otherwise. It's useful for filtering lists: '`[1,2,3] | map(select(. >= 2))`' will give you `[3]`. examples: - program: 'map(select(. >= 2))' input: '[1,5,3,0,7]' output: ['[5,3,7]'] - title: '`empty`' body: | `empty` returns no results. None at all. Not even `null`. It's useful on occasion. You'll know if you need it :) examples: - program: '1, empty, 2' input: 'null' output: ['1', '2'] - program: '[1,2,empty,3]' input: 'null' output: ['[1,2,3]'] - title: '`map(f)`' body: | For any filter `f`, `map(f)` will run that filter for each element of the input array, and produce the outputs a new array. `map(.+1)` will increment each element of an array of numbers. `map(f)` is equivalent to `[.[] | f]`. In fact, this is how it's defined. examples: - program: 'map(.+1)' input: '[1,2,3]' output: ['[2,3,4]'] - title: '`add`' body: | The filter `add` takes as input an array, and produces as output the elements of the array added together. This might mean summed, concatenated or merged depending on the types of the elements of the input array - the rules are the same as those for the `+` operator (described above). If the input is an empty array, `add` returns `null`. examples: - program: add input: '["a","b","c"]' output: ['"abc"'] - program: add input: '[1, 2, 3]' output: ['6'] - program: add input: '[]' output: ["null"] - title: '`range`' body: | The `range` function produces a range of numbers. `range(4;10)` produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers are produced as separate outputs. Use `[range(4;10)]` to get a range as an array. examples: - program: 'range(2;4)' input: 'null' output: ['2', '3'] - program: '[range(2;4)]' input: 'null' output: ['[2,3]'] - title: '`tonumber`' body: | The `tonumber` function parses its input as a number. It will convert correctly-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input. examples: - program: '.[] | tonumber' input: '[1, "1"]' output: ['1', '1'] - title: '`tostring`' body: | The `tostring` function prints its input as a string. Strings are left unchanged, and all other values are JSON-encoded. examples: - program: '.[] | tostring' input: '[1, "1", [1]]' output: ['"1"', '"1"', '"[1]"'] - title: '`type`' body: | The `type` function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object. examples: - program: 'map(type)' input: '[0, false, [], {}, null, "hello"]' output: ['["number", "boolean", "array", "object", "null", "string"]'] - title: '`sort`, `sort_by`' body: | The `sort` functions sorts its input, which must be an array. Values are sorted in the following order: * `null` * `false` * `true` * numbers * strings, in alphabetical order (by unicode codepoint value) * arrays, in lexical order * objects The ordering for objects is a little complex: first they're compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key. `sort_by` may be used to sort by a particular field of an object, or by applying any jq filter. `sort_by(foo)` compares two elements by comparing the result of `foo` on each element. examples: - program: 'sort' input: '[8,3,null,6]' output: ['[null,3,6,8]'] - program: 'sort_by(.foo)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":100}, {"foo":2, "bar":1}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":100}, {"foo":4, "bar":10}]'] - title: '`group_by`' body: | `group_by(.foo)` takes as input an array, groups the elements having the same `.foo` field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the `.foo` field. Any jq expression, not just a field access, may be used in place of `.foo`. The sorting order is the same as described in the `sort` function above. examples: - program: 'group_by(.foo)' input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]' output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]'] - title: '`min`, `max`, `min_by`, `max_by`' body: | Find the minimum or maximum element of the input array. The `_by` versions allow you to specify a particular field or property to examine, e.g. `min_by(.foo)` finds the object with the smallest `foo` field. examples: - program: 'min' input: '[5,4,2,7]' output: ['2'] - program: 'max_by(.foo)' input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]' output: ['{"foo":2, "bar":3}'] - title: '`unique`' body: | The `unique` function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed. examples: - program: 'unique' input: '[1,2,5,3,5,3,1,3]' output: ['[1,2,3,5]'] - title: '`reverse`' body: | This function reverses an array. examples: - program: 'reverse' input: '[1,2,3,4]' output: ['[4,3,2,1]'] - title: '`contains`' body: | The filter `contains(b)` will produce true if b is completely contained within the input. A string B is contained in a string A if B is a substring of A. An array B is contained in an array A is all elements in B are contained in any element in A. An object B is contained in object A if all of the values in B are contained in the value in A with the same key. All other types are assumed to be contained in each other if they are equal. examples: - program: 'contains("bar")' input: '"foobar"' output: ['true'] - program: 'contains(["baz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['true'] - program: 'contains(["bazzzzz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['false'] - program: 'contains({foo: 12, bar: [{barp: 12}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['true'] - program: 'contains({foo: 12, bar: [{barp: 15}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['false'] - title: '`recurse`' body: | The `recurse` function allows you to search through a recursive structure, and extract interesting data from all levels. Suppose your input represents a filesystem: {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} Now suppose you want to extract all of the filenames present. You need to retrieve `.name`, `.children[].name`, `.children[].children[].name`, and so on. You can do this with: recurse(.children[]) | .name examples: - program: 'recurse(.foo[])' input: '{"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}' output: - '{"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}' - '{"foo":[]}' - '{"foo":[{"foo":[]}]}' - '{"foo":[]}' - title: "String interpolation: `\\(exp)`" body: | Inside a string, you can put an expression inside parens after a backslash. Whatever the expression returns will be interpolated into the string. examples: - program: '"The input was \(.), which is one less than \(.+1)"' input: '42' output: ['"The input was 42, which is one less than 43"'] - title: "Format strings and escaping" body: | The `@foo` syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth. `@foo` can be used as a filter on its own, the possible escapings are: * `@text`: Calls `tostring`, see that function for details. * `@json`: Serialises the input as JSON. * `@html`: Applies HTML/XML escaping, by mapping the characters `<>&'"` to their entity equivalents `<`, `>`, `&`, `'`, `"`. * `@uri`: Applies percent-encoding, by mapping all reserved URI characters to a `%xx` sequence. * `@csv`: The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition. * `@sh`: The input is escaped suitable for use in a command-line for a POSIX shell. If the input is an array, the output will be a series of space-separated strings. * `@base64`: The input is converted to base64 as specified by RFC 4648. This syntax can be combined with string interpolation in a useful way. You can follow a `@foo` token with a string literal. The contents of the string literal will *not* be escaped. However, all interpolations made inside that string literal will be escaped. For instance, @uri "https://www.google.com/search?q=\(.search)" will produce the following output for the input `{"search":"jq!"}`: https://www.google.com/search?q=jq%21 Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. examples: - program: '@html' input: '"This works if x < y"' output: ['"This works if x < y"'] - program: '@sh "echo \(.)"' input: "\"O'Hara's Ale\"" output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""] - title: Conditionals and Comparisons entries: - title: '`==`, `!=`' body: | The expression 'a == b' will produce 'true' if the result of a and b are equal (that is, if they represent equivalent JSON documents) and 'false' otherwise. In particular, strings are never considered equal to numbers. If you're coming from JavaScript, jq's == is like JavaScript's === - considering values equal only when they have the same type as well as the same value. != is "not equal", and 'a != b' returns the opposite value of 'a == b' examples: - program: '.[] == 1' input: '[1, 1.0, "1", "banana"]' output: ['true', 'true', 'false', 'false'] - title: if-then-else-end body: | `if A then B else C end` will act the same as `B` if `A` produces a value other than false or null, but act the same as `C` otherwise. Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you'll sometimes have to be more explicit about the condition you want: you can't test whether, e.g. a string is empty using `if .name then A else B end`, you'll need something more like `if (.name | length) > 0 then A else B end` instead. If the condition `A` produces multiple results, then `B` is evaluated once for each result that is not false or null, and `C` is evaluated once for each false or null. More cases can be added to an if using `elif A then B` syntax. examples: - program: |- if . == 0 then "zero" elif . == 1 then "one" else "many" end input: '2' output: ['"many"'] - title: "`>`, `>=`, `<=`, `<`" body: | The comparison operators `>`, `>=`, `<=`, `<` return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively). The ordering is the same as that described for `sort`, above. examples: - program: '. < 5' input: '2' output: ['true'] - title: "`and`, `or`, `not`" body: | jq supports the normal Boolean operators `and`, `or`, `not`. They have the same standard of truth as if expressions - `false` and `null` are considered "false values", and anything else is a "true value". If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input. `not` is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in `.foo and .bar | not`. These three only produce the values `true` and `false`, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default". If you want to use this form of "or", picking between two values rather than evaluating a condition, see the `//` operator below. examples: - program: '42 and "a string"' input: 'null' output: ['true'] - program: '(true, false) or false' input: 'null' output: ['true', 'false'] - program: '(true, true) and (true, false)' input: 'null' output: ['true', 'false', 'true', 'false'] - program: '[true, false | not]' input: 'null' output: ['[false, true]'] - title: "Alternative operator: `//`" body: | A filter of the form `a // b` produces the same results as `a`, if `a` produces results other than `false` and `null`. Otherwise, `a // b` produces the same results as `b`. This is useful for providing defaults: `.foo // 1` will evaluate to `1` if there's no `.foo` element in the input. It's similar to how `or` is sometimes used in Python (jq's `or` operator is reserved for strictly Boolean operations). examples: - program: '.foo // 42' input: '{"foo": 19}' output: ['19'] - program: '.foo // 42' input: '{}' output: ['42'] - title: Advanced features body: | Variables are an absolute necessity in most programming languages, but they're relegated to an "advanced feature" in jq. In most languages, variables are the only means of passing around data. If you calculate a value, and you want to use it more than once, you'll need to store it in a variable. To pass a value to another part of the program, you'll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data. It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq's standard library (many jq functions such as `map` and `select` are in fact written in jq). Finally, jq has a `reduce` operation, which is very powerful but a bit tricky. Again, it's mostly used internally, to define some useful bits of jq's standard library. entries: - title: Variables body: | In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next. Many expressions, for instance `a + b`, pass their input to two distinct subexpressions (here `a` and `b` are both passed the same input), so variables aren't usually necessary in order to use a value twice. For instance, calculating the average value of an array of numbers requires a few variables in most languages - at least one to hold the array, perhaps one for each element or for a loop counter. In jq, it's simply `add / length` - the `add` expression is given the array and produces its sum, and the `length` expression is given the array and produces its length. So, there's generally a cleaner way to solve most problems in jq than defining variables. Still, sometimes they do make things easier, so jq lets you define variables using `expression as $variable`. All variable names start with `$`. Here's a slightly uglier version of the array-averaging example: length as $array_length | add / $array_length We'll need a more complicated problem to find a situation where using variables actually makes our lives easier. Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names. Our input looks like: {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} We want to produce the posts with the author field containing a real name, as in: {"title": "First post", "author": "Anonymous Coward"} {"title": "A well-written article", "author": "Person McPherson"} We use a variable, $names, to store the realnames object, so that we can refer to it later when looking up author usernames: .realnames as $names | .posts[] | {title, author: $names[.author]} The expression `exp as $x | ...` means: for each value of expression `exp`, run the rest of the pipeline with the entire original input, and with `$x` set to that value. Thus `as` functions as something of a foreach loop. Variables are scoped over the rest of the expression that defines them, so .realnames as $names | (.posts[] | {title, author: $names[.author]}) will work, but (.realnames as $names | .posts[]) | {title, author: $names[.author]} won't. examples: - program: '.bar as $x | .foo | . + $x' input: '{"foo":10, "bar":200}' output: ['210'] - title: 'Defining Functions' body: | You can give a filter a name using "def" syntax: def increment: . + 1; From then on, `increment` is usable as a filter just like a builtin function (in fact, this is how some of the builtins are defined). A function may take arguments: def map(f): [.[] | f]; Arguments are passed as filters, not as values. The same argument may be referenced multiple times with different inputs (here `f` is run for each element of the input array). Arguments to a function work more like callbacks than like value arguments. If you want the value-argument behaviour for defining simple functions, you can just use a variable: def addvalue(f): f as $value | map(. + $value); With that definition, `addvalue(.foo)` will add the current input's `.foo` field to each element of the array. examples: - program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))' input: '[[1,2],[10,20]]' output: ['[[1,2,1], [10,20,10]]'] - program: 'def addvalue(f): f as $x | map(. + $x); addvalue(.[0])' input: '[[1,2],[10,20]]' output: ['[[1,2,1,2], [10,20,1,2]]'] - title: "`reduce`" body: | The `reduce` syntax allows you to combine all of the results of an expression by accumulating them into a single answer. The form is `reduce EXP as $var (INIT; UPDATE)`. As an example, we'll pass `[1,2,3]` to this expression: reduce .[] as $item (0; . + $item) For each result that `.[]` produces, `. + $item` is run to accumulate a running total, starting from 0 as the input value. In this example, `.[]` produces the results `1`, `2`, and `3`, so the effect is similar to running something like this: 0 | 1 as $item | . + $item | 2 as $item | . + $item | 3 as $item | . + $item examples: - program: 'reduce .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['15'] - title: Assignment body: | Assignment works a little differently in jq than in most programming languages. jq doesn't distinguish between references to and copies of something - two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object". If an object has two fields which are arrays, `.foo` and `.bar`, and you append something to `.foo`, then `.bar` will not get bigger. Even if you've just set `.bar = .foo`. If you're used to programming in languages like Python, Java, Ruby, JavaScript, etc. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance, it doesn't actually do that, but that's the general idea). entries: - title: "`=`" body: | The filter `.foo = 1` will take as input an object and produce as output an object with the "foo" field set to 1. There is no notion of "modifying" or "changing" something in jq - all jq values are immutable. For instance, .foo = .bar | .foo.baz = 1 will not have the side-effect of setting .bar.baz to be set to 1, as the similar-looking program in JavaScript, Python, Ruby or other languages would. Unlike these languages (but like Haskell and some other functional languages), there is no notion of two arrays or objects being "the same array" or "the same object". They can be equal, or not equal, but if we change one of them in no circumstances will the other change behind our backs. This means that it's impossible to build circular values in jq (such as an array whose first element is itself). This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON. - title: "`|=`" body: | As well as the assignment operator '=', jq provides the "update" operator '|=', which takes a filter on the right-hand side and works out the new value for the property being assigned to by running the old value through this expression. For instance, .foo |= .+1 will build an object with the "foo" field set to the input's "foo" plus 1. This example should show the difference between '=' and '|=': Provide input '{"a": {"b": 10}, "b": 20}' to the programs: .a = .b .a |= .b The former will set the "a" field of the input to the "b" field of the input, and produce the output {"a": 20}. The latter will set the "a" field of the input to the "a" field's "b" field, producing {"a": 10}. - title: "`+=`, `-=`, `*=`, `/=`, `//=`" body: | jq has a few operators of the form `a op= b`, which are all equivalent to `a |= . op b`. So, `+= 1` can be used to increment values. examples: - program: .foo += 1 input: '{"foo": 42}' output: ['{"foo": 43}'] - title: Complex assignments body: | Lots more things are allowed on the left-hand side of a jq assignment than in most languages. We've already seen simple field accesses on the left hand side, and it's no surprise that array accesses work just as well: .posts[0].title = "JQ Manual" What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: .posts[].comments |= . + ["this is great"] That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts). When jq encounters an assignment like 'a = b', it records the "path" taken to select a part of the input document while executing a. This path is then used to find which part of the input to change while executing the assignment. Any filter may be used on the left-hand side of an equals - whichever paths it selects from the input will be where the assignment is performed. This is a very powerful operation. Suppose we wanted to add a comment to blog posts, using the same "blog" input above. This time, we only want to comment on the posts written by "stedolan". We can find those posts using the "select" function described earlier: .posts[] | select(.author == "stedolan") The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] jq-1.8.2/docs/content/manual/dev/0000755000175100017510000000000015215513536012342 5jq-1.8.2/docs/content/manual/dev/manual.yml0000644000175100017510000043754115215513536014300 --- headline: jq Manual (development version) body: | A jq program is a "filter": it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks. Filters can be combined in various ways - you can pipe the output of one filter into another filter, or collect the output of a filter into an array. Some filters produce multiple results, for instance there's one that produces all the elements of its input array. Piping that filter into a second runs the second filter for each element of the array. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq. It's important to remember that every filter has an input and an output. Even literals like "hello" or 42 are filters - they take an input but always produce the same literal as output. Operations that combine two filters, like addition, generally feed the same input to both and combine the results. So, you can implement an averaging filter as `add / length` - feeding the input array both to the `add` filter and the `length` filter and then performing the division. But that's getting ahead of ourselves. :) Let's start with something simpler: manpage_intro: | jq(1) -- Command-line JSON processor ==================================== ## SYNOPSIS `jq` [...] [...] `jq` can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents. For instance, running the command `jq 'map(.price) | add'` will take an array of JSON objects as input and return the sum of their "price" fields. `jq` can accept text input as well, but by default, `jq` reads a stream of JSON entities (including numbers and other literals) from `stdin`. Whitespace is only needed to separate entities such as 1 and 2, and true and false. One or more may be specified, in which case `jq` will read input from those instead. The are described in the [INVOKING JQ] section; they mostly concern input and output formatting. The is written in the jq language and specifies how to transform the input file or document. ## FILTERS manpage_epilogue: | ## BUGS Presumably. Report them or discuss them at: https://github.com/jqlang/jq/issues ## AUTHOR Stephen Dolan `` sections: - title: Invoking jq body: | jq filters run on a stream of JSON data. The input to jq is parsed as a sequence of whitespace-separated JSON values which are passed through the provided filter one at a time. The output(s) of the filter are written to standard output, as a sequence of newline-separated JSON data. The simplest and most common filter (or jq program) is `.`, which is the identity operator, copying the inputs of the jq processor to the output stream. Because the default behavior of the jq processor is to read JSON texts from the input stream, and to pretty-print outputs, the `.` program's main use is to validate and pretty-print the inputs. The jq programming language is quite rich and allows for much more than just validation and pretty-printing. Note: it is important to mind the shell's quoting rules. As a general rule it's best to always quote (with single-quote characters on Unix shells) the jq program, as too many characters with special meaning to jq are also shell meta-characters. For example, `jq "foo"` will fail on most Unix shells because that will be the same as `jq foo`, which will generally fail because `foo is not defined`. When using the Windows command shell (cmd.exe) it's best to use double quotes around your jq program when given on the command-line (instead of the `-f program-file` option), but then double-quotes in the jq program need backslash escaping. When using the Powershell (`powershell.exe`) or the Powershell Core (`pwsh`/`pwsh.exe`), use single-quote characters around the jq program and backslash-escaped double-quotes (`\"`) inside the jq program. * Unix shells: `jq '.["foo"]'` * Powershell: `jq '.[\"foo\"]'` * Windows command shell: `jq ".[\"foo\"]"` Note: jq allows user-defined functions, but every jq program must have a top-level expression. You can affect how jq reads and writes its input and output using some command-line options: * `--null-input` / `-n`: Don't read any input at all. Instead, the filter is run once using `null` as the input. This is useful when using jq as a simple calculator or to construct JSON data from scratch. * `--raw-input` / `-R`: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with `--slurp`, then the entire input is passed to the filter as a single long string. * `--slurp` / `-s`: Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. * `--compact-output` / `-c`: By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. * `--raw-output` / `-r`: With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. * `--raw-output0`: Like `-r` but jq will print NUL instead of newline after each output. This can be useful when the values being output can contain newlines. When the output value contains NUL, jq exits with non-zero code. * `--join-output` / `-j`: Like `-r` but jq won't print a newline after each output. * `--ascii-output` / `-a`: jq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences (like "\u03bc"). Using this option, you can force jq to produce pure ASCII output with every non-ASCII character replaced with the equivalent escape sequence. * `--sort-keys` / `-S`: Output the fields of each object with the keys in sorted order. * `--color-output` / `-C` and `--monochrome-output` / `-M`: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using `-C`, and disable color with `-M`. When the `NO_COLOR` environment variable is not empty, jq disables colored output by default, but you can enable it by `-C`. Colors can be configured with the `JQ_COLORS` environment variable (see below). * `--tab`: Use a tab for each indentation level instead of two spaces. * `--indent n`: Use the given number of spaces (no more than 7) for indentation. * `--unbuffered`: Flush the output after each JSON object is printed (useful if you're piping a slow data source into jq and piping jq's output elsewhere). * `--stream`: Parse the input in streaming fashion, outputting arrays of path and leaf values (scalars and empty arrays or empty objects). For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]` becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`. This is useful for processing very large inputs. Use this in conjunction with filtering and the `reduce` and `foreach` syntax to reduce large inputs incrementally. * `--stream-errors`: Like `--stream`, but invalid JSON inputs yield array values where the first element is the error and the second is a path. For example, `["a",n]` produces `["Invalid literal at line 1, column 7",[1]]`. Implies `--stream`. Invalid JSON inputs produce no error values when `--stream` without `--stream-errors`. * `--seq`: Use the `application/json-seq` MIME type scheme for separating JSON texts in jq's input and output. This means that an ASCII RS (record separator) character is printed before each value on output and an ASCII LF (line feed) is printed after every output. Input JSON texts that fail to parse are ignored (but warned about), discarding all subsequent input until the next RS. This mode also parses the output of jq without the `--seq` option. * `-f` / `--from-file`: Read the filter from a file rather than from a command line, like awk's -f option. This changes the filter argument to be interpreted as a filename, instead of the source of a program. * `-L directory` / `--library-path directory`: Prepend `directory` to the search list for modules. If this option is used then no builtin search list is used. See the section on modules below. * `--arg name value`: This option passes a value to the jq program as a predefined variable. If you run jq with `--arg foo bar`, then `$foo` is available in the program and has the value `"bar"`. Note that `value` will be treated as a string, so `--arg foo 123` will bind `$foo` to `"123"`. Named arguments are also available to the jq program as `$ARGS.named`. When the name is not a valid identifier, this is the only way to access it. * `--argjson name JSON-text`: This option passes a JSON-encoded value to the jq program as a predefined variable. If you run jq with `--argjson foo 123`, then `$foo` is available in the program and has the value `123`. * `--slurpfile variable-name filename`: This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable. If you run jq with `--slurpfile foo bar`, then `$foo` is available in the program and has an array whose elements correspond to the texts in the file named `bar`. * `--rawfile variable-name filename`: This option reads in the named file and binds its content to the given global variable. If you run jq with `--rawfile foo bar`, then `$foo` is available in the program and has a string whose content is set to the text in the file named `bar`. * `--args`: Remaining arguments are positional string arguments. These are available to the jq program as `$ARGS.positional[]`. * `--jsonargs`: Remaining arguments are positional JSON text arguments. These are available to the jq program as `$ARGS.positional[]`. * `--exit-status` / `-e`: Sets the exit status of jq to 0 if the last output value was neither `false` nor `null`, 1 if the last output value was either `false` or `null`, or 4 if no valid result was ever produced. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran. Another way to set the exit status is with the `halt_error` builtin function. * `--binary` / `-b`: Windows users using WSL, MSYS2, or Cygwin, should use this option when using a native jq.exe, otherwise jq will turn newlines (LFs) into carriage-return-then-newline (CRLF). * `--version` / `-V`: Output the jq version and exit with zero. * `--build-configuration`: Output the build configuration of jq and exit with zero. This output has no supported format or structure and may change without notice in future releases. * `--help` / `-h`: Output the jq help and exit with zero. * `--`: Terminates argument processing. Remaining arguments are not interpreted as options. * `--run-tests [filename]`: Runs the tests in the given file or standard input. This must be the last option given and does not honor all preceding options. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line. Compilation failure tests start with a line containing only `%%FAIL`, then a line containing the program to compile, then a line containing an error message to compare to the actual. Be warned that this option can change backwards-incompatibly. - title: Basic filters entries: - title: "Identity: `.`" body: | The absolute simplest filter is `.` . This filter takes its input and produces the same value as output. That is, this is the identity operator. Since jq by default pretty-prints all output, a trivial program consisting of nothing but `.` can be used to format JSON output from, say, `curl`. Although the identity filter never modifies the value of its input, jq processing can sometimes make it appear as though it does. For example, using the current implementation of jq, we would see that the expression: 1E1234567890 | . produces `1.7976931348623157e+308` on at least one platform. This is because, in the process of parsing the number, this particular version of jq has converted it to an IEEE754 double-precision representation, losing precision. The way in which jq handles numbers has changed over time and further changes are likely within the parameters set by the relevant JSON standards. Moreover, build configuration options can alter how jq processes numbers. The following remarks are therefore offered with the understanding that they are intended to be descriptive of the current version of jq and should not be interpreted as being prescriptive: (1) Any arithmetic operation on a number that has not already been converted to an IEEE754 double precision representation will trigger a conversion to the IEEE754 representation. (2) jq will attempt to maintain the original decimal precision of number literals (if the `--disable-decnum` build configuration option was not used), but in expressions such `1E1234567890`, precision will be lost if the exponent is too large. (3) Comparisons are carried out using the untruncated big decimal representation of numbers if available, as illustrated in one of the following examples. The examples below use the builtin function `have_decnum` in order to demonstrate the expected effects of using / not using the `--disable-decnum` build configuration option, and also to allow automated tests derived from these examples to pass regardless of whether that option is used. examples: - program: '.' input: '"Hello, world!"' output: ['"Hello, world!"'] - program: '.' input: '0.12345678901234567890123456789' output: ['0.12345678901234567890123456789'] - program: '[., tojson] == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end' input: '12345678909876543212345' output: ['true'] - program: '[1234567890987654321,-1234567890987654321 | tojson] == if have_decnum then ["1234567890987654321","-1234567890987654321"] else ["1234567890987654400","-1234567890987654400"] end' input: 'null' output: ['true'] - program: '. < 0.12345678901234567890123456788' input: '0.12345678901234567890123456789' output: ['false'] - program: 'map([., . == 1]) | tojson == if have_decnum then "[[1,true],[1.000,true],[1.0,true],[1.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end' input: '[1, 1.000, 1.0, 100e-2]' output: ['true'] - program: '. as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000) | . == if have_decnum then [true, false] else [false, false] end' input: '10000000000000000000000000000001' output: ['true'] - title: "Object Identifier-Index: `.foo`, `.foo.bar`" body: | The simplest *useful* filter has the form `.foo`. When given a JSON object (aka dictionary or hash) as input, `.foo` produces the value at the key "foo" if the key is present, or null otherwise. A filter of the form `.foo.bar` is equivalent to `.foo | .bar`. The `.foo` syntax only works for simple, identifier-like keys, that is, keys that are all made of alphanumeric characters and underscore, and which do not start with a digit. If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: `."foo$"`, or else `.["foo$"]`. For example `.["foo::bar"]` and `.["foo.bar"]` work while `.foo::bar` does not. examples: - program: '.foo' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]' input: '{"foo": 42}' output: ['42'] - title: "Optional Object Identifier-Index: `.foo?`" body: | Just like `.foo`, but does not output an error when `.` is not an object. examples: - program: '.foo?' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo?' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]?' input: '{"foo": 42}' output: ['42'] - program: '[.foo?]' input: '[1,2]' output: ['[]'] - title: "Object Index: `.[]`" body: | You can also look up fields of an object using syntax like `.["foo"]` (`.foo` above is a shorthand version of this, but only for identifier-like strings). - title: "Array Index: `.[]`" body: | When the index value is an integer, `.[]` can index arrays. Arrays are zero-based, so `.[2]` returns the third element. Negative indices are allowed, with -1 referring to the last element, -2 referring to the next to last element, and so on. examples: - program: '.[0]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['{"name":"JSON", "good":true}'] - program: '.[2]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['null'] - program: '.[-2]' input: '[1,2,3]' output: ['2'] - title: "Array/String Slice: `.[:]`" body: | The `.[:]` syntax can be used to return a subarray of an array or substring of a string. The array returned by `.[10:15]` will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array). Indices are zero-based. examples: - program: '.[2:4]' input: '["a","b","c","d","e"]' output: ['["c", "d"]'] - program: '.[2:4]' input: '"abcdefghi"' output: ['"cd"'] - program: '.[:3]' input: '["a","b","c","d","e"]' output: ['["a", "b", "c"]'] - program: '.[-2:]' input: '["a","b","c","d","e"]' output: ['["d", "e"]'] - title: "Array/Object Value Iterator: `.[]`" body: | If you use the `.[index]` syntax, but omit the index entirely, it will return *all* of the elements of an array. Running `.[]` with the input `[1,2,3]` will produce the numbers as three separate results, rather than as a single array. A filter of the form `.foo[]` is equivalent to `.foo | .[]`. You can also use this on an object, and it will return all the values of the object. Note that the iterator operator is a generator of values. examples: - program: '.[]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: - '{"name":"JSON", "good":true}' - '{"name":"XML", "good":false}' - program: '.[]' input: '[]' output: [] - program: '.foo[]' input: '{"foo":[1,2,3]}' output: ['1','2','3'] - program: '.[]' input: '{"a": 1, "b": 1}' output: ['1', '1'] - title: "`.[]?`" body: | Like `.[]`, but no errors will be output if . is not an array or object. A filter of the form `.foo[]?` is equivalent to `.foo | .[]?`. - title: "Comma: `,`" body: | If two filters are separated by a comma, then the same input will be fed into both and the two filters' output value streams will be concatenated in order: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right. For instance, filter `.foo, .bar`, produces both the "foo" fields and "bar" fields as separate outputs. The `,` operator is one way to construct generators. examples: - program: '.foo, .bar' input: '{"foo": 42, "bar": "something else", "baz": true}' output: ['42', '"something else"'] - program: ".user, .projects[]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['"stedolan"', '"jq"', '"wikiflow"'] - program: '.[4,2]' input: '["a","b","c","d","e"]' output: ['"e"', '"c"'] - title: "Pipe: `|`" body: | The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right. It's similar to the Unix shell's pipe, if you're used to that. If the one on the left produces multiple results, the one on the right will be run for each of those results. So, the expression `.[] | .foo` retrieves the "foo" field of each element of the input array. This is a cartesian product, which can be surprising. Note that `.a.b.c` is the same as `.a | .b | .c`. Note too that `.` is the input value at the particular stage in a "pipeline", specifically: where the `.` expression appears. Thus `.a | . | .b` is the same as `.a.b`, as the `.` in the middle refers to whatever value `.a` produced. examples: - program: '.[] | .name' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['"JSON"', '"XML"'] - title: "Parenthesis" body: | Parenthesis work as a grouping operator just as in any typical programming language. examples: - program: '(. + 2) * 5' input: '1' output: ['15'] - title: Types and Values body: | jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string keys), and "null". Booleans, null, strings and numbers are written the same way as in JSON. Just like everything else in jq, these simple values take an input and produce an output - `42` is a valid jq expression that takes an input, ignores it, and returns 42 instead. Numbers in jq are internally represented by their IEEE754 double precision approximation. Any arithmetic operation with numbers, whether they are literals or results of previous filters, will produce a double precision floating point result. However, when parsing a literal jq will store the original literal string. If no mutation is applied to this value then it will make to the output in its original form, even if conversion to double would result in a loss. entries: - title: "Array construction: `[]`" body: | As in JSON, `[]` is used to construct arrays, as in `[1,2,3]`. The elements of the arrays can be any jq expression, including a pipeline. All of the results produced by all of the expressions are collected into one big array. You can use it to construct an array out of a known quantity of values (as in `[.foo, .bar, .baz]`) or to "collect" all the results of a filter into an array (as in `[.items[].name]`) Once you understand the "," operator, you can look at jq's array syntax in a different light: the expression `[1,2,3]` is not using a built-in syntax for comma-separated arrays, but is instead applying the `[]` operator (collect results) to the expression 1,2,3 (which produces three different results). If you have a filter `X` that produces four results, then the expression `[X]` will produce a single result, an array of four elements. examples: - program: "[.user, .projects[]]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['["stedolan", "jq", "wikiflow"]'] - program: "[ .[] | . * 2]" input: '[1, 2, 3]' output: ['[2, 4, 6]'] - title: "Object Construction: `{}`" body: | Like JSON, `{}` is for constructing objects (aka dictionaries or hashes), as in: `{"a": 42, "b": 17}`. If the keys are "identifier-like", then the quotes can be left off, as in `{a:42, b:17}`. Variable references as key expressions use the value of the variable as the key. Key expressions other than constant literals, identifiers, or variable references, need to be parenthesized, e.g., `{("a"+"b"):59}`. The value can be any expression (although you may need to wrap it in parentheses if, for example, it contains colons), which gets applied to the {} expression's input (remember, all filters have an input and an output). {foo: .bar} will produce the JSON object `{"foo": 42}` if given the JSON object `{"bar":42, "baz":43}` as its input. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write {user: .user, title: .title} Because that is so common, there's a shortcut syntax for it: `{user, title}`. If one of the expressions produces multiple results, multiple dictionaries will be produced. If the input's {"user":"stedolan","titles":["JQ Primer", "More JQ"]} then the expression {user, title: .titles[]} will produce two outputs: {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} Putting parentheses around the key means it will be evaluated as an expression. With the same input as above, {(.user): .titles} produces {"stedolan": ["JQ Primer", "More JQ"]} Variable references as keys use the value of the variable as the key. Without a value then the variable's name becomes the key and its value becomes the value, "f o o" as $foo | "b a r" as $bar | {$foo, $bar:$foo} produces {"foo":"f o o","b a r":"f o o"} examples: - program: '{user, title: .titles[]}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: - '{"user":"stedolan", "title": "JQ Primer"}' - '{"user":"stedolan", "title": "More JQ"}' - program: '{(.user): .titles}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: ['{"stedolan": ["JQ Primer", "More JQ"]}'] - title: "Recursive Descent: `..`" body: | Recursively descends `.`, producing every value. This is the same as the zero-argument `recurse` builtin (see below). This is intended to resemble the XPath `//` operator. Note that `..a` does not work; use `.. | .a` instead. In the example below we use `.. | .a?` to find all the values of object keys "a" in any object found "below" `.`. This is particularly useful in conjunction with `path(EXP)` (also see below) and the `?` operator. examples: - program: '.. | .a?' input: '[[{"a":1}]]' output: ['1'] - title: Builtin operators and functions body: | Some jq operators (for instance, `+`) do different things depending on the type of their arguments (arrays, numbers, etc.). However, jq never does implicit type conversions. If you try to add a string to an object you'll get an error message and no result. Please note that all numbers are converted to IEEE754 double precision floating point representation. Arithmetic and logical operators are working with these converted doubles. Results of all such operations are also limited to the double precision. The only exception to this behaviour of number is a snapshot of original number literal. When a number which originally was provided as a literal is never mutated until the end of the program then it is printed to the output in its original literal form. This also includes cases when the original literal would be truncated when converted to the IEEE754 double precision floating point number. entries: - title: "Addition: `+`" body: | The operator `+` takes two filters, applies them both to the same input, and adds the results together. What "adding" means depends on the types involved: - **Numbers** are added by normal arithmetic. - **Arrays** are added by being concatenated into a larger array. - **Strings** are added by being joined into a larger string. - **Objects** are added by merging, that is, inserting all the key-value pairs from both objects into a single combined object. If both objects contain a value for the same key, the object on the right of the `+` wins. (For recursive merge use the `*` operator.) `null` can be added to any value, and returns the other value unchanged. examples: - program: '.a + 1' input: '{"a": 7}' output: ['8'] - program: '.a + .b' input: '{"a": [1,2], "b": [3,4]}' output: ['[1,2,3,4]'] - program: '.a + null' input: '{"a": 1}' output: ['1'] - program: '.a + 1' input: '{}' output: ['1'] - program: '{a: 1} + {b: 2} + {c: 3} + {a: 42}' input: 'null' output: ['{"a": 42, "b": 2, "c": 3}'] - title: "Subtraction: `-`" body: | As well as normal arithmetic subtraction on numbers, the `-` operator can be used on arrays to remove all occurrences of the second array's elements from the first array. examples: - program: '4 - .a' input: '{"a":3}' output: ['1'] - program: . - ["xml", "yaml"] input: '["xml", "yaml", "json"]' output: ['["json"]'] - title: "Multiplication, division, modulo: `*`, `/`, `%`" body: | These infix operators behave as expected when given two numbers. Division by zero raises an error. `x % y` computes x modulo y. Multiplying a string by a number produces the concatenation of that string that many times. `"x" * 0` produces `""`. Dividing a string by another splits the first using the second as separators. Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy. examples: - program: '10 / . * 3' input: '5' output: ['6'] - program: '. / ", "' input: '"a, b,c,d, e"' output: ['["a","b,c,d","e"]'] - program: '{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}' input: 'null' output: ['{"k": {"a": 0, "b": 2, "c": 3}}'] - program: '.[] | (1 / .)?' input: '[1,0,-1]' output: ['1', '-1'] - title: "`abs`" body: | The builtin function `abs` is defined naively as: `if . < 0 then - . else . end`. For numeric input, this is the absolute value. See the section on the identity filter for the implications of this definition for numeric input. To compute the absolute value of a number as a floating point number, you may wish use `fabs`. examples: - program: 'map(abs)' input: '[-10, -1.1, -1e-1]' output: ['[10,1.1,1e-1]'] - title: "`length`" body: | The builtin function `length` gets the length of various different types of value: - The length of a **string** is the number of Unicode codepoints it contains (which will be the same as its JSON-encoded length in bytes if it's pure ASCII). - The length of a **number** is its absolute value. - The length of an **array** is the number of elements. - The length of an **object** is the number of key-value pairs. - The length of **null** is zero. - It is an error to use `length` on a **boolean**. examples: - program: '.[] | length' input: '[[1,2], "string", {"a":2}, null, -5]' output: ['2', '6', '1', '0', '5'] - title: "`utf8bytelength`" body: | The builtin function `utf8bytelength` outputs the number of bytes used to encode a string in UTF-8. examples: - program: 'utf8bytelength' input: '"\u03bc"' output: ['2'] - title: "`keys`, `keys_unsorted`" body: | The builtin function `keys`, when given an object, returns its keys in an array. The keys are sorted "alphabetically", by unicode codepoint order. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings. When `keys` is given an array, it returns the valid indices for that array: the integers from 0 to length-1. The `keys_unsorted` function is just like `keys`, but if the input is an object then the keys will not be sorted, instead the keys will roughly be in insertion order. examples: - program: 'keys' input: '{"abc": 1, "abcd": 2, "Foo": 3}' output: ['["Foo", "abc", "abcd"]'] - program: 'keys' input: '[42,3,35]' output: ['[0,1,2]'] - title: "`has(key)`" body: | The builtin function `has` returns whether the input object has the given key, or the input array has an element at the given index. `has($key)` has the same effect as checking whether `$key` is a member of the array returned by `keys`, although `has` will be faster. examples: - program: 'map(has("foo"))' input: '[{"foo": 42}, {}]' output: ['[true, false]'] - program: 'map(has(2))' input: '[[0,1], ["a","b","c"]]' output: ['[false, true]'] - title: "`in`" body: | The builtin function `in` returns whether or not the input key is in the given object, or the input index corresponds to an element in the given array. It is, essentially, an inversed version of `has`. examples: - program: '.[] | in({"foo": 42})' input: '["foo", "bar"]' output: ['true', 'false'] - program: 'map(in([0,1]))' input: '[2, 0]' output: ['[false, true]'] - title: "`map(f)`, `map_values(f)`" body: | For any filter `f`, `map(f)` and `map_values(f)` apply `f` to each of the values in the input array or object, that is, to the values of `.[]`. In the absence of errors, `map(f)` always outputs an array whereas `map_values(f)` outputs an array if given an array, or an object if given an object. When the input to `map_values(f)` is an object, the output object has the same keys as the input object except for those keys whose values when piped to `f` produce no values at all. The key difference between `map(f)` and `map_values(f)` is that the former simply forms an array from all the values of `($x|f)` for each value, `$x`, in the input array or object, but `map_values(f)` only uses `first($x|f)`. Specifically, for object inputs, `map_values(f)` constructs the output object by examining in turn the value of `first(.[$k]|f)` for each key, `$k`, of the input. If this expression produces no values, then the corresponding key will be dropped; otherwise, the output object will have that value at the key, `$k`. Here are some examples to clarify the behavior of `map` and `map_values` when applied to arrays. These examples assume the input is `[1]` in all cases: map(.+1) #=> [2] map(., .) #=> [1,1] map(empty) #=> [] map_values(.+1) #=> [2] map_values(., .) #=> [1] map_values(empty) #=> [] `map(f)` is equivalent to `[.[] | f]` and `map_values(f)` is equivalent to `.[] |= f`. In fact, these are their implementations. examples: - program: 'map(.+1)' input: '[1,2,3]' output: ['[2,3,4]'] - program: 'map_values(.+1)' input: '{"a": 1, "b": 2, "c": 3}' output: ['{"a": 2, "b": 3, "c": 4}'] - program: 'map(., .)' input: '[1,2]' output: ['[1,1,2,2]'] - program: 'map_values(. // empty)' input: '{"a": null, "b": true, "c": false}' output: ['{"b":true}'] - title: "`pick(pathexps)`" body: | Emit the projection of the input object or array defined by the specified sequence of path expressions, such that if `p` is any one of these specifications, then `(. | p)` will evaluate to the same value as `(. | pick(pathexps) | p)`. For arrays, negative indices and `.[m:n]` specifications should not be used. examples: - program: 'pick(.a, .b.c, .x)' input: '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4}' output: ['{"a":1,"b":{"c":2},"x":null}'] - program: 'pick(.[2], .[0], .[0])' input: '[1,2,3,4]' output: ['[1,null,3]'] - title: "`path(path_expression)`" body: | Outputs array representations of the given path expression in `.`. The outputs are arrays of strings (object keys) and/or numbers (array indices). Path expressions are jq expressions like `.a`, but also `.[]`. There are two types of path expressions: ones that can match exactly, and ones that cannot. For example, `.a.b.c` is an exact match path expression, while `.a[].b` is not. `path(exact_path_expression)` will produce the array representation of the path expression even if it does not exist in `.`, if `.` is `null` or an array or an object. `path(pattern)` will produce array representations of the paths matching `pattern` if the paths exist in `.`. Note that the path expressions are not different from normal expressions. The expression `path(..|select(type=="boolean"))` outputs all the paths to boolean values in `.`, and only those paths. examples: - program: 'path(.a[0].b)' input: 'null' output: ['["a",0,"b"]'] - program: '[path(..)]' input: '{"a":[{"b":1}]}' output: ['[[],["a"],["a",0],["a",0,"b"]]'] - title: "`del(path_expression)`" body: | The builtin function `del` removes a key and its corresponding value from an object. examples: - program: 'del(.foo)' input: '{"foo": 42, "bar": 9001, "baz": 42}' output: ['{"bar": 9001, "baz": 42}'] - program: 'del(.[1, 2])' input: '["foo", "bar", "baz"]' output: ['["foo"]'] - title: "`getpath(PATHS)`" body: | The builtin function `getpath` outputs the values in `.` found at each path in `PATHS`. examples: - program: 'getpath(["a","b"])' input: 'null' output: ['null'] - program: '[getpath(["a","b"], ["a","c"])]' input: '{"a":{"b":0, "c":1}}' output: ['[0, 1]'] - title: "`setpath(PATHS; VALUE)`" body: | The builtin function `setpath` sets the `PATHS` in `.` to `VALUE`. examples: - program: 'setpath(["a","b"]; 1)' input: 'null' output: ['{"a": {"b": 1}}'] - program: 'setpath(["a","b"]; 1)' input: '{"a":{"b":0}}' output: ['{"a": {"b": 1}}'] - program: 'setpath([0,"a"]; 1)' input: 'null' output: ['[{"a":1}]'] - title: "`delpaths(PATHS)`" body: | The builtin function `delpaths` deletes the `PATHS` in `.`. `PATHS` must be an array of paths, where each path is an array of strings and numbers. examples: - program: 'delpaths([["a","b"]])' input: '{"a":{"b":1},"x":{"y":2}}' output: ['{"a":{},"x":{"y":2}}'] - title: "`to_entries`, `from_entries`, `with_entries(f)`" body: | These functions convert between an object and an array of key-value pairs. If `to_entries` is passed an object, then for each `k: v` entry in the input, the output array includes `{"key": k, "value": v}`. `from_entries` does the opposite conversion, and `with_entries(f)` is a shorthand for `to_entries | map(f) | from_entries`, useful for doing some operation to all keys and values of an object. `from_entries` accepts `"key"`, `"Key"`, `"name"`, `"Name"`, `"value"`, and `"Value"` as keys. examples: - program: 'to_entries' input: '{"a": 1, "b": 2}' output: ['[{"key":"a", "value":1}, {"key":"b", "value":2}]'] - program: 'from_entries' input: '[{"key":"a", "value":1}, {"key":"b", "value":2}]' output: ['{"a": 1, "b": 2}'] - program: 'with_entries(.key |= "KEY_" + .)' input: '{"a": 1, "b": 2}' output: ['{"KEY_a": 1, "KEY_b": 2}'] - title: "`select(boolean_expression)`" body: | The function `select(f)` produces its input unchanged if `f` returns true for that input, and produces no output otherwise. It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))` will give you `[2,3]`. examples: - program: 'map(select(. >= 2))' input: '[1,5,3,0,7]' output: ['[5,3,7]'] - program: '.[] | select(.id == "second")' input: '[{"id": "first", "val": 1}, {"id": "second", "val": 2}]' output: ['{"id": "second", "val": 2}'] - title: "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `normals`, `finites`, `strings`, `nulls`, `values`, `scalars`" body: | These built-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, normal numbers, finite numbers, strings, null, non-null values, and non-iterables, respectively. examples: - program: '.[]|numbers' input: '[[],{},1,"foo",null,true,false]' output: ['1'] - title: "`empty`" body: | `empty` returns no results. None at all. Not even `null`. It's useful on occasion. You'll know if you need it :) examples: - program: '1, empty, 2' input: 'null' output: ['1', '2'] - program: '[1,2,empty,3]' input: 'null' output: ['[1,2,3]'] - title: "`error`, `error(message)`" body: | Produces an error with the input value, or with the message given as the argument. Errors can be caught with try/catch; see below. examples: - program: 'try error catch .' input: '"error message"' output: ['"error message"'] - program: 'try error("invalid value: \(.)") catch .' input: '42' output: ['"invalid value: 42"'] - title: "`halt`" body: | Stops the jq program with no further outputs. jq will exit with exit status `0`. - title: "`halt_error`, `halt_error(exit_code)`" body: | Stops the jq program with no further outputs. The input will be printed on `stderr` as raw output (i.e., strings will not have double quotes) with no decoration, not even a newline. The given `exit_code` (defaulting to `5`) will be jq's exit status. For example, `"Error: something went wrong\n"|halt_error(1)`. - title: "`$__loc__`" body: | Produces an object with a "file" key and a "line" key, with the filename and line number where `$__loc__` occurs, as values. examples: - program: 'try error("\($__loc__)") catch .' input: 'null' output: ['"{\"file\":\"\",\"line\":1}"'] - title: "`paths`, `paths(node_filter)`" body: | `paths` outputs the paths to all the elements in its input (except it does not output the empty list, representing . itself). `paths(f)` outputs the paths to any values for which `f` is `true`. That is, `paths(type == "number")` outputs the paths to all numeric values. examples: - program: '[paths]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1],[1,0],[1,1],[1,1,"a"]]'] - program: '[paths(type == "number")]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1,1,"a"]]'] - title: "`add`, `add(generator)`" body: | The filter `add` takes as input an array, and produces as output the elements of the array added together. This might mean summed, concatenated or merged depending on the types of the elements of the input array - the rules are the same as those for the `+` operator (described above). If the input is an empty array, `add` returns `null`. `add(generator)` operates on the given generator rather than the input. examples: - program: add input: '["a","b","c"]' output: ['"abc"'] - program: add input: '[1, 2, 3]' output: ['6'] - program: add input: '[]' output: ["null"] - program: add(.[].a) input: '[{"a":3}, {"a":5}, {"b":6}]' output: ['8'] - title: "`any`, `any(condition)`, `any(generator; condition)`" body: | The filter `any` takes as input an array of boolean values, and produces `true` as output if any of the elements of the array are `true`. If the input is an empty array, `any` returns `false`. The `any(condition)` form applies the given condition to the elements of the input array. The `any(generator; condition)` form applies the given condition to all the outputs of the given generator. examples: - program: any input: '[true, false]' output: ["true"] - program: any input: '[false, false]' output: ["false"] - program: any input: '[]' output: ["false"] - title: "`all`, `all(condition)`, `all(generator; condition)`" body: | The filter `all` takes as input an array of boolean values, and produces `true` as output if all of the elements of the array are `true`. The `all(condition)` form applies the given condition to the elements of the input array. The `all(generator; condition)` form applies the given condition to all the outputs of the given generator. If the input is an empty array, `all` returns `true`. examples: - program: all input: '[true, false]' output: ["false"] - program: all input: '[true, true]' output: ["true"] - program: all input: '[]' output: ["true"] - title: "`flatten`, `flatten(depth)`" body: | The filter `flatten` takes as input an array of nested arrays, and produces a flat array in which all arrays inside the original array have been recursively replaced by their values. You can pass an argument to it to specify how many levels of nesting to flatten. `flatten(2)` is like `flatten`, but going only up to two levels deep. examples: - program: flatten input: '[1, [2], [[3]]]' output: ["[1, 2, 3]"] - program: flatten(1) input: '[1, [2], [[3]]]' output: ["[1, 2, [3]]"] - program: flatten input: '[[]]' output: ["[]"] - program: flatten input: '[{"foo": "bar"}, [{"foo": "baz"}]]' output: ['[{"foo": "bar"}, {"foo": "baz"}]'] - title: "`range(upto)`, `range(from; upto)`, `range(from; upto; by)`" body: | The `range` function produces a range of numbers. `range(4; 10)` produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers are produced as separate outputs. Use `[range(4; 10)]` to get a range as an array. The one argument form generates numbers from 0 to the given number, with an increment of 1. The two argument form generates numbers from `from` to `upto` with an increment of 1. The three argument form generates numbers `from` to `upto` with an increment of `by`. examples: - program: 'range(2; 4)' input: 'null' output: ['2', '3'] - program: '[range(2; 4)]' input: 'null' output: ['[2,3]'] - program: '[range(4)]' input: 'null' output: ['[0,1,2,3]'] - program: '[range(0; 10; 3)]' input: 'null' output: ['[0,3,6,9]'] - program: '[range(0; 10; -1)]' input: 'null' output: ['[]'] - program: '[range(0; -5; -1)]' input: 'null' output: ['[0,-1,-2,-3,-4]'] - title: "`floor`" body: | The `floor` function returns the floor of its numeric input. examples: - program: 'floor' input: '3.14159' output: ['3'] - title: "`sqrt`" body: | The `sqrt` function returns the square root of its numeric input. examples: - program: 'sqrt' input: '9' output: ['3'] - title: "`tonumber`" body: | The `tonumber` function parses its input as a number. It will convert correctly-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input. examples: - program: '.[] | tonumber' input: '[1, "1"]' output: ['1', '1'] - title: "`toboolean`" body: | The `toboolean` function parses its input as a boolean. It will convert correctly-formatted strings to their boolean equivalent, leave booleans alone, and give an error on all other input. examples: - program: '.[] | toboolean' input: '["true", "false", true, false]' output: ['true', 'false', 'true', 'false'] - title: "`tostring`" body: | The `tostring` function prints its input as a string. Strings are left unchanged, and all other values are JSON-encoded. examples: - program: '.[] | tostring' input: '[1, "1", [1]]' output: ['"1"', '"1"', '"[1]"'] - title: "`type`" body: | The `type` function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object. examples: - program: 'map(type)' input: '[0, false, [], {}, null, "hello"]' output: ['["number", "boolean", "array", "object", "null", "string"]'] - title: "`infinite`, `nan`, `isinfinite`, `isnan`, `isfinite`, `isnormal`" body: | Some arithmetic operations can yield infinities and "not a number" (NaN) values. The `isinfinite` builtin returns `true` if its input is infinite. The `isnan` builtin returns `true` if its input is a NaN. The `infinite` builtin returns a positive infinite value. The `nan` builtin returns a NaN. The `isnormal` builtin returns true if its input is a normal number. Note that division by zero raises an error. Currently most arithmetic operations operating on infinities, NaNs, and sub-normals do not raise errors. examples: - program: '.[] | (infinite * .) < 0' input: '[-1, 1]' output: ['true', 'false'] - program: 'infinite, nan | type' input: 'null' output: ['"number"', '"number"'] - title: "`sort`, `sort_by(path_expression)`" body: | The `sort` functions sorts its input, which must be an array. Values are sorted in the following order: * `null` * `false` * `true` * numbers * strings, in alphabetical order (by unicode codepoint value) * arrays, in lexical order * objects The ordering for objects is a little complex: first they're compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key. `sort_by` may be used to sort by a particular field of an object, or by applying any jq filter. `sort_by(f)` compares two elements by comparing the result of `f` on each element. When `f` produces multiple values, it firstly compares the first values, and the second values if the first values are equal, and so on. examples: - program: 'sort' input: '[8,3,null,6]' output: ['[null,3,6,8]'] - program: 'sort_by(.foo)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}]'] - program: 'sort_by(.foo, .bar)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}]'] - title: "`group_by(path_expression)`" body: | `group_by(.foo)` takes as input an array, groups the elements having the same `.foo` field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the `.foo` field. Any jq expression, not just a field access, may be used in place of `.foo`. The sorting order is the same as described in the `sort` function above. examples: - program: 'group_by(.foo)' input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]' output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]'] - title: "`min`, `max`, `min_by(path_exp)`, `max_by(path_exp)`" body: | Find the minimum or maximum element of the input array. The `min_by(path_exp)` and `max_by(path_exp)` functions allow you to specify a particular field or property to examine, e.g. `min_by(.foo)` finds the object with the smallest `foo` field. examples: - program: 'min' input: '[5,4,2,7]' output: ['2'] - program: 'max_by(.foo)' input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]' output: ['{"foo":2, "bar":3}'] - title: "`unique`, `unique_by(path_exp)`" body: | The `unique` function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed. The `unique_by(path_exp)` function will keep only one element for each value obtained by applying the argument. Think of it as making an array by taking one element out of every group produced by `group`. examples: - program: 'unique' input: '[1,2,5,3,5,3,1,3]' output: ['[1,2,3,5]'] - program: 'unique_by(.foo)' input: '[{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}]' output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]'] - program: 'unique_by(length)' input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]' output: ['["bacon", "chunky", "asparagus"]'] - title: "`reverse`" body: | This function reverses an array. examples: - program: 'reverse' input: '[1,2,3,4]' output: ['[4,3,2,1]'] - title: "`contains(element)`" body: | The filter `contains(b)` will produce true if b is completely contained within the input. A string B is contained in a string A if B is a substring of A. An array B is contained in an array A if all elements in B are contained in any element in A. An object B is contained in object A if all of the values in B are contained in the value in A with the same key. All other types are assumed to be contained in each other if they are equal. examples: - program: 'contains("bar")' input: '"foobar"' output: ['true'] - program: 'contains(["baz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['true'] - program: 'contains(["bazzzzz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['false'] - program: 'contains({foo: 12, bar: [{barp: 12}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['true'] - program: 'contains({foo: 12, bar: [{barp: 15}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['false'] - title: "`indices(s)`" body: | Outputs an array containing the indices in `.` where `s` occurs. The input may be an array, in which case if `s` is an array then the indices output will be those where all elements in `.` match those of `s`. examples: - program: 'indices(", ")' input: '"a,b, cd, efg, hijk"' output: ['[3,7,12]'] - program: 'indices(1)' input: '[0,1,2,1,3,1,4]' output: ['[1,3,5]'] - program: 'indices([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['[1,8]'] - title: "`index(s)`, `rindex(s)`" body: | Outputs the index of the first (`index`) or last (`rindex`) occurrence of `s` in the input. examples: - program: 'index(", ")' input: '"a,b, cd, efg, hijk"' output: ['3'] - program: 'index(1)' input: '[0,1,2,1,3,1,4]' output: ['1'] - program: 'index([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['1'] - program: 'rindex(", ")' input: '"a,b, cd, efg, hijk"' output: ['12'] - program: 'rindex(1)' input: '[0,1,2,1,3,1,4]' output: ['5'] - program: 'rindex([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['8'] - title: "`inside`" body: | The filter `inside(b)` will produce true if the input is completely contained within b. It is, essentially, an inversed version of `contains`. examples: - program: 'inside("foobar")' input: '"bar"' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["baz", "bar"]' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["bazzzzz", "bar"]' output: ['false'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 12}]}' output: ['true'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 15}]}' output: ['false'] - title: "`startswith(str)`" body: | Outputs `true` if . starts with the given string argument. examples: - program: '[.[]|startswith("foo")]' input: '["fo", "foo", "barfoo", "foobar", "barfoob"]' output: ['[false, true, false, true, false]'] - title: "`endswith(str)`" body: | Outputs `true` if . ends with the given string argument. examples: - program: '[.[]|endswith("foo")]' input: '["foobar", "barfoo"]' output: ['[false, true]'] - title: "`combinations`, `combinations(n)`" body: | Outputs all combinations of the elements of the arrays in the input array. If given an argument `n`, it outputs all combinations of `n` repetitions of the input array. examples: - program: 'combinations' input: '[[1,2], [3, 4]]' output: ['[1, 3]', '[1, 4]', '[2, 3]', '[2, 4]'] - program: 'combinations(2)' input: '[0, 1]' output: ['[0, 0]', '[0, 1]', '[1, 0]', '[1, 1]'] - title: "`ltrimstr(str)`" body: | Outputs its input with the given prefix string removed, if it starts with it. examples: - program: '[.[]|ltrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "afoo"]' output: ['["fo","","barfoo","bar","afoo"]'] - title: "`rtrimstr(str)`" body: | Outputs its input with the given suffix string removed, if it ends with it. examples: - program: '[.[]|rtrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "foob"]' output: ['["fo","","bar","foobar","foob"]'] - title: "`trimstr(str)`" body: | Outputs its input with the given string removed at both ends, if it starts or ends with it. examples: - program: '[.[]|trimstr("foo")]' input: '["fo", "foo", "barfoo", "foobarfoo", "foob"]' output: ['["fo","","bar","bar","b"]'] - title: "`trim`, `ltrim`, `rtrim`" body: | `trim` trims both leading and trailing whitespace. `ltrim` trims only leading (left side) whitespace. `rtrim` trims only trailing (right side) whitespace. Whitespace characters are the usual `" "`, `"\n"` `"\t"`, `"\r"` and also all characters in the Unicode character database with the whitespace property. Note that what considers whitespace might change in the future. examples: - program: 'trim, ltrim, rtrim' input: '" abc "' output: ['"abc"', '"abc "', '" abc"'] - title: "`explode`" body: | Converts an input string into an array of the string's codepoint numbers. examples: - program: 'explode' input: '"foobar"' output: ['[102,111,111,98,97,114]'] - title: "`implode`" body: | The inverse of explode. examples: - program: 'implode' input: '[65, 66, 67]' output: ['"ABC"'] - title: "`split(str)`" body: | Splits an input string on the separator argument. `split` can also split on regex matches when called with two arguments (see the regular expressions section below). examples: - program: 'split(", ")' input: '"a, b,c,d, e, "' output: ['["a","b,c,d","e",""]'] - title: "`join(str)`" body: | Joins the array of elements given as input, using the argument as separator. It is the inverse of `split`: that is, running `split("foo") | join("foo")` over any input string returns said input string. Numbers and booleans in the input are converted to strings. Null values are treated as empty strings. Arrays and objects in the input are not supported. examples: - program: 'join(", ")' input: '["a","b,c,d","e"]' output: ['"a, b,c,d, e"'] - program: 'join(" ")' input: '["a",1,2.3,true,null,false]' output: ['"a 1 2.3 true false"'] - title: "`ascii_downcase`, `ascii_upcase`" body: | Emit a copy of the input string with its alphabetic characters (a-z and A-Z) converted to the specified case. examples: - program: 'ascii_upcase' input: '"useful but not for é"' output: ['"USEFUL BUT NOT FOR é"'] - title: "`while(cond; update)`" body: | The `while(cond; update)` function allows you to repeatedly apply an update to `.` until `cond` is false. Note that `while(cond; update)` is internally defined as a recursive jq function. Recursive calls within `while` will not consume additional memory if `update` produces at most one output for each input. See advanced topics below. examples: - program: '[while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: "`repeat(exp)`" body: | The `repeat(exp)` function allows you to repeatedly apply expression `exp` to `.` until an error is raised. Note that `repeat(exp)` is internally defined as a recursive jq function. Recursive calls within `repeat` will not consume additional memory if `exp` produces at most one output for each input. See advanced topics below. examples: - program: '[repeat(.*2, error)?]' input: '1' output: ['[2]'] - title: "`until(cond; next)`" body: | The `until(cond; next)` function allows you to repeatedly apply the expression `next`, initially to `.` then to its own output, until `cond` is true. For example, this can be used to implement a factorial function (see below). Note that `until(cond; next)` is internally defined as a recursive jq function. Recursive calls within `until()` will not consume additional memory if `next` produces at most one output for each input. See advanced topics below. examples: - program: '[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]' input: '4' output: ['24'] - title: "`recurse(f)`, `recurse`, `recurse(f; condition)`" body: | The `recurse(f)` function allows you to search through a recursive structure, and extract interesting data from all levels. Suppose your input represents a filesystem: {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} Now suppose you want to extract all of the filenames present. You need to retrieve `.name`, `.children[].name`, `.children[].children[].name`, and so on. You can do this with: recurse(.children[]) | .name When called without an argument, `recurse` is equivalent to `recurse(.[]?)`. `recurse(f)` is identical to `recurse(f; true)` and can be used without concerns about recursion depth. `recurse(f; condition)` is a generator which begins by emitting . and then emits in turn .|f, .|f|f, .|f|f|f, ... so long as the computed value satisfies the condition. For example, to generate all the integers, at least in principle, one could write `recurse(.+1; true)`. The recursive calls in `recurse` will not consume additional memory whenever `f` produces at most a single output for each input. examples: - program: 'recurse(.foo[])' input: '{"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}' output: - '{"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}' - '{"foo":[]}' - '{"foo":[{"foo":[]}]}' - '{"foo":[]}' - program: 'recurse' input: '{"a":0,"b":[1]}' output: - '{"a":0,"b":[1]}' - '0' - '[1]' - '1' - program: 'recurse(. * .; . < 20)' input: '2' output: ['2', '4', '16'] - title: "`walk(f)`" body: | The `walk(f)` function applies f recursively to every component of the input entity. When an array is encountered, f is first applied to its elements and then to the array itself; when an object is encountered, f is first applied to all the values and then to the object. In practice, f will usually test the type of its input, as illustrated in the following examples. The first example highlights the usefulness of processing the elements of an array of arrays before processing the array itself. The second example shows how all the keys of all the objects within the input can be considered for alteration. examples: - program: 'walk(if type == "array" then sort else . end)' input: '[[4, 1, 7], [8, 5, 2], [3, 6, 9]]' output: - '[[1,4,7],[2,5,8],[3,6,9]]' - program: 'walk( if type == "object" then with_entries( .key |= sub( "^_+"; "") ) else . end )' input: '[ { "_a": { "__b": 2 } } ]' output: - '[{"a":{"b":2}}]' - title: "`have_literal_numbers`" body: | This builtin returns true if jq's build configuration includes support for preservation of input number literals. - title: "`have_decnum`" body: | This builtin returns true if jq was built with "decnum", which is the current literal number preserving numeric backend implementation for jq. - title: "`$JQ_BUILD_CONFIGURATION`" body: | This builtin binding shows the jq executable's build configuration. Its value has no particular format, but it can be expected to be at least the `./configure` command-line arguments, and may be enriched in the future to include the version strings for the build tooling used. Note that this can be overridden in the command-line with `--arg` and related options. - title: "`$ENV`, `env`" body: | `$ENV` is an object representing the environment variables as set when the jq program started. `env` outputs an object representing jq's current environment. At the moment there is no builtin for setting environment variables. examples: - program: '$ENV.PAGER' input: 'null' output: ['"less"'] - program: 'env.PAGER' input: 'null' output: ['"less"'] - title: "`transpose`" body: | Transpose a possibly jagged matrix (an array of arrays). Rows are padded with nulls so the result is always rectangular. examples: - program: 'transpose' input: '[[1], [2,3]]' output: ['[[1,2],[null,3]]'] - title: "`bsearch(x)`" body: | `bsearch(x)` conducts a binary search for x in the input array. If the input is sorted and contains x, then `bsearch(x)` will return its index in the array; otherwise, if the array is sorted, it will return (-1 - ix) where ix is an insertion point such that the array would still be sorted after the insertion of x at ix. If the array is not sorted, `bsearch(x)` will return an integer that is probably of no interest. examples: - program: 'bsearch(0)' input: '[0,1]' output: ['0'] - program: 'bsearch(0)' input: '[1,2,3]' output: ['-1'] - program: 'bsearch(4) as $ix | if $ix < 0 then .[-(1+$ix)] = 4 else . end' input: '[1,2,3]' output: ['[1,2,3,4]'] - title: "String interpolation: `\\(exp)`" body: | Inside a string, you can put an expression inside parens after a backslash. Whatever the expression returns will be interpolated into the string. examples: - program: '"The input was \(.), which is one less than \(.+1)"' input: '42' output: ['"The input was 42, which is one less than 43"'] - title: "Convert to/from JSON" body: | The `tojson` and `fromjson` builtins dump values as JSON texts or parse JSON texts into values, respectively. The `tojson` builtin differs from `tostring` in that `tostring` returns strings unmodified, while `tojson` encodes strings as JSON strings. examples: - program: '[.[]|tostring]' input: '[1, "foo", ["foo"]]' output: ['["1","foo","[\"foo\"]"]'] - program: '[.[]|tojson]' input: '[1, "foo", ["foo"]]' output: ['["1","\"foo\"","[\"foo\"]"]'] - program: '[.[]|tojson|fromjson]' input: '[1, "foo", ["foo"]]' output: ['[1,"foo",["foo"]]'] - title: "Format strings and escaping" body: | The `@foo` syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth. `@foo` can be used as a filter on its own, the possible escapings are: * `@text`: Calls `tostring`, see that function for details. * `@json`: Serializes the input as JSON. * `@html`: Applies HTML/XML escaping, by mapping the characters `<>&'"` to their entity equivalents `<`, `>`, `&`, `'`, `"`. * `@uri`: Applies percent-encoding, by mapping all reserved URI characters to a `%XX` sequence. * `@urid`: The inverse of `@uri`, applies percent-decoding, by mapping all `%XX` sequences to their corresponding URI characters. * `@csv`: The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition. * `@tsv`: The input must be an array, and it is rendered as TSV (tab-separated values). Each input array will be printed as a single line. Fields are separated by a single tab (ascii `0x09`). Input characters line-feed (ascii `0x0a`), carriage-return (ascii `0x0d`), tab (ascii `0x09`) and backslash (ascii `0x5c`) will be output as escape sequences `\n`, `\r`, `\t`, `\\` respectively. * `@sh`: The input is escaped suitable for use in a command-line for a POSIX shell. If the input is an array, the output will be a series of space-separated strings. * `@base64`: The input is converted to base64 as specified by RFC 4648. * `@base64d`: The inverse of `@base64`, input is decoded as specified by RFC 4648. Note\: If the decoded string is not UTF-8, the results are undefined. This syntax can be combined with string interpolation in a useful way. You can follow a `@foo` token with a string literal. The contents of the string literal will *not* be escaped. However, all interpolations made inside that string literal will be escaped. For instance, @uri "https://www.google.com/search?q=\(.search)" will produce the following output for the input `{"search":"what is jq?"}`: "https://www.google.com/search?q=what%20is%20jq%3F" Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. examples: - program: '@html' input: '"This works if x < y"' output: ['"This works if x < y"'] - program: '@sh "echo \(.)"' input: "\"O'Hara's Ale\"" output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""] - program: '@base64' input: '"This is a message"' output: ['"VGhpcyBpcyBhIG1lc3NhZ2U="'] - program: '@base64d' input: '"VGhpcyBpcyBhIG1lc3NhZ2U="' output: ['"This is a message"'] - title: "Dates" body: | jq provides some basic date handling functionality, with some high-level and low-level builtins. In all cases these builtins deal exclusively with time in UTC. The `fromdateiso8601` builtin parses datetimes in the ISO 8601 format to a number of seconds since the Unix epoch (1970-01-01T00:00:00Z). The `todateiso8601` builtin does the inverse. The `fromdate` builtin parses datetime strings. Currently `fromdate` only supports ISO 8601 datetime strings, but in the future it will attempt to parse datetime strings in more formats. The `todate` builtin is an alias for `todateiso8601`. The `now` builtin outputs the current time, in seconds since the Unix epoch. Low-level jq interfaces to the C-library time functions are also provided: `strptime`, `strftime`, `strflocaltime`, `mktime`, `gmtime`, and `localtime`. Refer to your host operating system's documentation for the format strings used by `strptime` and `strftime`. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality. The `gmtime` builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of Greenwich Mean Time as an array of numbers representing (in this order): the year, the month (zero-based), the day of the month (one-based), the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year -- all one-based unless otherwise stated. The day of the week number may be wrong on some systems for dates before March 1st 1900, or after December 31 2099. The `localtime` builtin works like the `gmtime` builtin, but using the local timezone setting. The `mktime` builtin consumes "broken down time" representations of time output by `gmtime` and `strptime`. The `strptime(fmt)` builtin parses input strings matching the `fmt` argument. The output is in the "broken down time" representation consumed by `mktime` and output by `gmtime`. The `strftime(fmt)` builtin formats a time (GMT) with the given format. The `strflocaltime` does the same, but using the local timezone setting. The format strings for `strptime` and `strftime` are described in typical C library documentation. The format string for ISO 8601 datetime is `"%Y-%m-%dT%H:%M:%SZ"`. jq may not support some or all of this date functionality on some systems. In particular, the `%u` and `%j` specifiers for `strptime(fmt)` are not supported on macOS. examples: - program: 'fromdate' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")' input: '"2015-03-05T23:51:47Z"' output: ['[2015,2,5,23,51,47,4,63]'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")|mktime' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - title: "SQL-Style Operators" body: | jq provides a few SQL-style operators. * `INDEX(stream; index_expression)`: This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream. * `JOIN($idx; stream; idx_expr; join_expr)`: This builtin joins the values from the given stream to the given index. The index's keys are computed by applying the given index expression to each value from the given stream. An array of the value in the stream and the corresponding value from the index is fed to the given join expression to produce each result. * `JOIN($idx; stream; idx_expr)`: Same as `JOIN($idx; stream; idx_expr; .)`. * `JOIN($idx; idx_expr)`: This builtin joins the input `.` to the given index, applying the given index expression to `.` to compute the index key. The join operation is as described above. * `IN(s)`: This builtin outputs `true` if `.` appears in the given stream, otherwise it outputs `false`. * `IN(source; s)`: This builtin outputs `true` if any value in the source stream appears in the second stream, otherwise it outputs `false`. - title: "`builtins`" body: | Returns a list of all builtin functions in the format `name/arity`. Since functions with the same name but different arities are considered separate functions, `all/0`, `all/1`, and `all/2` would all be present in the list. - title: Conditionals and Comparisons entries: - title: "`==`, `!=`" body: | The expression 'a == b' will produce 'true' if the results of evaluating a and b are equal (that is, if they represent equivalent JSON values) and 'false' otherwise. In particular, strings are never considered equal to numbers. In checking for the equality of JSON objects, the ordering of keys is irrelevant. If you're coming from JavaScript, please note that jq's `==` is like JavaScript's `===`, the "strict equality" operator. != is "not equal", and 'a != b' returns the opposite value of 'a == b' examples: - program: '. == false' input: 'null' output: ['false'] - program: '. == {"b": {"d": (4 + 1e-20), "c": 3}, "a":1}' input: '{"a":1, "b": {"c": 3, "d": 4}}' output: ['true'] - program: '.[] == 1' input: '[1, 1.0, "1", "banana"]' output: ['true', 'true', 'false', 'false'] - title: if-then-else-end body: | `if A then B else C end` will act the same as `B` if `A` produces a value other than false or null, but act the same as `C` otherwise. `if A then B end` is the same as `if A then B else . end`. That is, the `else` branch is optional, and if absent is the same as `.`. This also applies to `elif` with absent ending `else` branch. Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you'll sometimes have to be more explicit about the condition you want. You can't test whether, e.g. a string is empty using `if .name then A else B end`; you'll need something like `if .name == "" then A else B end` instead. If the condition `A` produces multiple results, then `B` is evaluated once for each result that is not false or null, and `C` is evaluated once for each false or null. More cases can be added to an if using `elif A then B` syntax. examples: - program: |- if . == 0 then "zero" elif . == 1 then "one" else "many" end input: '2' output: ['"many"'] - title: "`>`, `>=`, `<=`, `<`" body: | The comparison operators `>`, `>=`, `<=`, `<` return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively). The ordering is the same as that described for `sort`, above. examples: - program: '. < 5' input: '2' output: ['true'] - title: "`and`, `or`, `not`" body: | jq supports the normal Boolean operators `and`, `or`, `not`. They have the same standard of truth as if expressions - `false` and `null` are considered "false values", and anything else is a "true value". If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input. `not` is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in `.foo and .bar | not`. These three only produce the values `true` and `false`, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default". If you want to use this form of "or", picking between two values rather than evaluating a condition, see the `//` operator below. examples: - program: '42 and "a string"' input: 'null' output: ['true'] - program: '(true, false) or false' input: 'null' output: ['true', 'false'] - program: '(true, true) and (true, false)' input: 'null' output: ['true', 'false', 'true', 'false'] - program: '[true, false | not]' input: 'null' output: ['[false, true]'] - title: "Alternative operator: `//`" body: | The `//` operator produces all the values of its left-hand side that are neither `false` nor `null`. If the left-hand side produces no values other than `false` or `null`, then `//` produces all the values of its right-hand side. A filter of the form `a // b` produces all the results of `a` that are not `false` or `null`. If `a` produces no results, or no results other than `false` or `null`, then `a // b` produces the results of `b`. This is useful for providing defaults: `.foo // 1` will evaluate to `1` if there's no `.foo` element in the input. It's similar to how `or` is sometimes used in Python (jq's `or` operator is reserved for strictly Boolean operations). Note: `some_generator // defaults_here` is not the same as `some_generator | . // defaults_here`. The latter will produce default values for all non-`false`, non-`null` values of the left-hand side, while the former will not. Precedence rules can make this confusing. For example, in `false, 1 // 2` the left-hand side of `//` is `1`, not `false, 1` -- `false, 1 // 2` parses the same way as `false, (1 // 2)`. In `(false, null, 1) | . // 42` the left-hand side of `//` is `.`, which always produces just one value, while in `(false, null, 1) // 42` the left-hand side is a generator of three values, and since it produces a value other `false` and `null`, the default `42` is not produced. examples: - program: 'empty // 42' input: 'null' output: ['42'] - program: '.foo // 42' input: '{"foo": 19}' output: ['19'] - program: '.foo // 42' input: '{}' output: ['42'] - program: '(false, null, 1) // 42' input: 'null' output: ['1'] - program: '(false, null, 1) | . // 42' input: 'null' output: ['42', '42', '1'] - title: try-catch body: | Errors can be caught by using `try EXP catch EXP`. The first expression is executed, and if it fails then the second is executed with the error message. The output of the handler, if any, is output as if it had been the output of the expression to try. The `try EXP` form uses `empty` as the exception handler. examples: - program: 'try .a catch ". is not an object"' input: 'true' output: ['". is not an object"'] - program: '[.[]|try .a]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: 'try error("some exception") catch .' input: 'true' output: ['"some exception"'] - title: Breaking out of control structures body: | A convenient use of try/catch is to break out of control structures like `reduce`, `foreach`, `while`, and so on. For example: # Repeat an expression until it raises "break" as an # error, then stop repeating without re-raising the error. # But if the error caught is not "break" then re-raise it. try repeat(exp) catch if .=="break" then empty else error jq has a syntax for named lexical labels to "break" or "go (back) to": label $out | ... break $out ... The `break $label_name` expression will cause the program to act as though the nearest (to the left) `label $label_name` produced `empty`. The relationship between the `break` and corresponding `label` is lexical: the label has to be "visible" from the break. To break out of a `reduce`, for example: label $out | reduce .[] as $item (null; if .==false then break $out else ... end) The following jq program produces a syntax error: break $out because no label `$out` is visible. - title: "Error Suppression / Optional Operator: `?`" body: | The `?` operator, used as `EXP?`, is shorthand for `try EXP`. examples: - program: '[.[] | .a?]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: '[.[] | tonumber?]' input: '["1", "invalid", "3", 4]' output: ['[1, 3, 4]'] - title: Regular expressions body: | jq uses the [Oniguruma regular expression library](https://github.com/kkos/oniguruma/blob/master/doc/RE), as do PHP, TextMate, Sublime Text, etc, so the description here will focus on jq specifics. Oniguruma supports several flavors of regular expression, so it is important to know that jq uses the ["Perl NG" (Perl with named groups)](https://github.com/kkos/oniguruma/blob/master/doc/SYNTAX.md) flavor. The jq regex filters are defined so that they can be used using one of these patterns: STRING | FILTER(REGEX) STRING | FILTER(REGEX; FLAGS) STRING | FILTER([REGEX]) STRING | FILTER([REGEX, FLAGS]) where: * STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation; * REGEX, after string interpolation, should be a valid regular expression; * FILTER is one of `test`, `match`, or `capture`, as described below. Since REGEX must evaluate to a JSON string, some characters that are needed to form a regular expression must be escaped. For example, the regular expression `\s` signifying a whitespace character would be written as `"\\s"`. FLAGS is a string consisting of one of more of the supported flags: * `g` - Global search (find all matches, not just the first) * `i` - Case insensitive search * `m` - Multi line mode (`.` will match newlines) * `n` - Ignore empty matches * `p` - Both s and m modes are enabled * `s` - Single line mode (`^` -> `\A`, `$` -> `\Z`) * `l` - Find longest possible matches * `x` - Extended regex format (ignore whitespace and comments) To match a whitespace with the `x` flag, use `\s`, e.g. jq -n '"a b" | test("a\\sb"; "x")' Note that certain flags may also be specified within REGEX, e.g. jq -n '("test", "TEst", "teST", "TEST") | test("(?i)te(?-i)st")' evaluates to: `true`, `true`, `false`, `false`. entries: - title: "`test(val)`, `test(regex; flags)`" body: | Like `match`, but does not return match objects, only `true` or `false` for whether or not the regex matches the input. examples: - program: 'test("foo")' input: '"foo"' output: ['true'] - program: '.[] | test("a b c # spaces are ignored"; "ix")' input: '["xabcd", "ABC"]' output: ['true', 'true'] - title: "`match(val)`, `match(regex; flags)`" body: | **match** outputs an object for each match it finds. Matches have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of the match * `string` - the string that it matched * `captures` - an array of objects representing capturing groups. Capturing group objects have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of this capturing group * `string` - the string that was captured * `name` - the name of the capturing group (or `null` if it was unnamed) Capturing groups that did not match anything return an offset of -1 examples: - program: 'match("(abc)+"; "g")' input: '"abc abc"' output: - '{"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]}' - '{"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]}' - program: 'match("foo")' input: '"foo bar foo"' output: ['{"offset": 0, "length": 3, "string": "foo", "captures": []}'] - program: 'match(["foo", "ig"])' input: '"foo bar FOO"' output: - '{"offset": 0, "length": 3, "string": "foo", "captures": []}' - '{"offset": 8, "length": 3, "string": "FOO", "captures": []}' - program: 'match("foo (?bar)? foo"; "ig")' input: '"foo bar foo foo foo"' output: - '{"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]}' - '{"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}' - program: '[ match("."; "g")] | length' input: '"abc"' output: ['3'] - title: "`capture(val)`, `capture(regex; flags)`" body: | Collects the named captures in a JSON object, with the name of each capture as the key, and the matched string as the corresponding value. examples: - program: 'capture("(?[a-z]+)-(?[0-9]+)")' input: '"xyzzy-14"' output: ['{ "a": "xyzzy", "n": "14" }'] - title: "`scan(regex)`, `scan(regex; flags)`" body: | Emit a stream of the non-overlapping substrings of the input that match the regex in accordance with the flags, if any have been specified. If there is no match, the stream is empty. To capture all the matches for each input string, use the idiom `[ expr ]`, e.g. `[ scan(regex) ]`. If the regex contains capturing groups, the filter emits a stream of arrays, each of which contains the captured strings. examples: - program: 'scan("c")' input: '"abcdefabc"' output: ['"c"', '"c"'] - program: 'scan("(a+)(b+)")' input: '"abaabbaaabbb"' output: ['["a","b"]', '["aa","bb"]', '["aaa","bbb"]'] - title: "`split(regex; flags)`" body: | Splits an input string on each regex match. For backwards compatibility, when called with a single argument, `split` splits on a string, not a regex. examples: - program: 'split(", *"; null)' input: '"ab,cd, ef"' output: ['["ab","cd","ef"]'] - title: "`splits(regex)`, `splits(regex; flags)`" body: | These provide the same results as their `split` counterparts, but as a stream instead of an array. examples: - program: 'splits(", *")' input: '"ab,cd, ef, gh"' output: ['"ab"','"cd"','"ef"','"gh"'] - program: 'splits(",? *"; "n")' input: '"ab,cd ef, gh"' output: ['"ab"','"cd"','"ef"','"gh"'] - title: "`sub(regex; tostring)`, `sub(regex; tostring; flags)`" body: | Emit the string obtained by replacing the first match of regex in the input string with `tostring`, after interpolation. `tostring` should be a jq string or a stream of such strings, each of which may contain references to named captures. The named captures are, in effect, presented as a JSON object (as constructed by `capture`) to `tostring`, so a reference to a captured variable named "x" would take the form: `"\(.x)"`. examples: - program: 'sub("[^a-z]*(?[a-z]+)"; "Z\(.x)"; "g")' input: '"123abc456def"' output: ['"ZabcZdef"'] - program: '[sub("(?.)"; "\(.a|ascii_upcase)", "\(.a|ascii_downcase)")]' input: '"aB"' output: ['["AB","aB"]'] - title: "`gsub(regex; tostring)`, `gsub(regex; tostring; flags)`" body: | `gsub` is like `sub` but all the non-overlapping occurrences of the regex are replaced by `tostring`, after interpolation. If the second argument is a stream of jq strings, then `gsub` will produce a corresponding stream of JSON strings. examples: - program: 'gsub("(?.)[^a]*"; "+\(.x)-")' input: '"Abcabc"' output: ['"+A-+a-"'] - program: '[gsub("p"; "a", "b")]' input: '"p"' output: ['["a","b"]'] - title: Advanced features body: | Variables are an absolute necessity in most programming languages, but they're relegated to an "advanced feature" in jq. In most languages, variables are the only means of passing around data. If you calculate a value, and you want to use it more than once, you'll need to store it in a variable. To pass a value to another part of the program, you'll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data. It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq's standard library (many jq functions such as `map` and `select` are in fact written in jq). jq has reduction operators, which are very powerful but a bit tricky. Again, these are mostly used internally, to define some useful bits of jq's standard library. It may not be obvious at first, but jq is all about generators (yes, as often found in other languages). Some utilities are provided to help deal with generators. Some minimal I/O support (besides reading JSON from standard input, and writing JSON to standard output) is available. Finally, there is a module/library system. entries: - title: "Variable / Symbolic Binding Operator: `... as $identifier | ...`" body: | In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next. Many expressions, for instance `a + b`, pass their input to two distinct subexpressions (here `a` and `b` are both passed the same input), so variables aren't usually necessary in order to use a value twice. For instance, calculating the average value of an array of numbers requires a few variables in most languages - at least one to hold the array, perhaps one for each element or for a loop counter. In jq, it's simply `add / length` - the `add` expression is given the array and produces its sum, and the `length` expression is given the array and produces its length. So, there's generally a cleaner way to solve most problems in jq than defining variables. Still, sometimes they do make things easier, so jq lets you define variables using `expression as $variable`. All variable names start with `$`. Here's a slightly uglier version of the array-averaging example: length as $array_length | add / $array_length We'll need a more complicated problem to find a situation where using variables actually makes our lives easier. Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names. Our input looks like: {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} We want to produce the posts with the author field containing a real name, as in: {"title": "First post", "author": "Anonymous Coward"} {"title": "A well-written article", "author": "Person McPherson"} We use a variable, `$names`, to store the realnames object, so that we can refer to it later when looking up author usernames: .realnames as $names | .posts[] | {title, author: $names[.author]} The expression `exp as $x | ...` means: for each value of expression `exp`, run the rest of the pipeline with the entire original input, and with `$x` set to that value. Thus `as` functions as something of a foreach loop. Just as `{foo}` is a handy way of writing `{foo: .foo}`, so `{$foo}` is a handy way of writing `{foo: $foo}`. Multiple variables may be declared using a single `as` expression by providing a pattern that matches the structure of the input (this is known as "destructuring"): . as {realnames: $names, posts: [$first, $second]} | ... The variable declarations in array patterns (e.g., `. as [$first, $second]`) bind to the elements of the array in from the element at index zero on up, in order. When there is no value at the index for an array pattern element, `null` is bound to that variable. Variables are scoped over the rest of the expression that defines them, so .realnames as $names | (.posts[] | {title, author: $names[.author]}) will work, but (.realnames as $names | .posts[]) | {title, author: $names[.author]} won't. For programming language theorists, it's more accurate to say that jq variables are lexically-scoped bindings. In particular there's no way to change the value of a binding; one can only setup a new binding with the same name, but which will not be visible where the old one was. examples: - program: '.bar as $x | .foo | . + $x' input: '{"foo":10, "bar":200}' output: ['210'] - program: '. as $i|[(.*2|. as $i| $i), $i]' input: '5' output: ['[10,5]'] - program: '. as [$a, $b, {c: $c}] | $a + $b + $c' input: '[2, 3, {"c": 4, "d": 5}]' output: ['9'] - program: '.[] as [$a, $b] | {a: $a, b: $b}' input: '[[0], [0, 1], [2, 1, 0]]' output: ['{"a":0,"b":null}', '{"a":0,"b":1}', '{"a":2,"b":1}'] - title: 'Destructuring Alternative Operator: `?//`' body: | The destructuring alternative operator provides a concise mechanism for destructuring an input that can take one of several forms. Suppose we have an API that returns a list of resources and events associated with them, and we want to get the user_id and timestamp of the first event for each resource. The API (having been clumsily converted from XML) will only wrap the events in an array if the resource has multiple events: {"resources": [{"id": 1, "kind": "widget", "events": {"action": "create", "user_id": 1, "ts": 13}}, {"id": 2, "kind": "widget", "events": [{"action": "create", "user_id": 1, "ts": 14}, {"action": "destroy", "user_id": 1, "ts": 15}]}]} We can use the destructuring alternative operator to handle this structural change simply: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$user_id, $ts}]} | {$user_id, $kind, $id, $ts} Or, if we aren't sure if the input is an array of values or an object: .[] as [$id, $kind, $user_id, $ts] ?// {$id, $kind, $user_id, $ts} | ... Each alternative need not define all of the same variables, but all named variables will be available to the subsequent expression. Variables not matched in the alternative that succeeded will be `null`: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$first_user_id, $first_ts}]} | {$user_id, $first_user_id, $kind, $id, $ts, $first_ts} Additionally, if the subsequent expression returns an error, the alternative operator will attempt to try the next binding. Errors that occur during the final alternative are passed through. [[3]] | .[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end examples: - program: '.[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":4}', '{"a":1,"b":2,"d":3,"e":4}'] - program: '.[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":null}', '{"a":1,"b":2,"d":null,"e":4}'] - program: '.[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end' input: '[[3]]' output: ['{"a":null,"b":3}'] - title: 'Defining Functions' body: | You can give a filter a name using "def" syntax: def increment: . + 1; From then on, `increment` is usable as a filter just like a builtin function (in fact, this is how many of the builtins are defined). A function may take arguments: def map(f): [.[] | f]; Arguments are passed as _filters_ (functions with no arguments), _not_ as values. The same argument may be referenced multiple times with different inputs (here `f` is run for each element of the input array). Arguments to a function work more like callbacks than like value arguments. This is important to understand. Consider: def foo(f): f|f; 5|foo(.*2) The result will be 20 because `f` is `.*2`, and during the first invocation of `f` `.` will be 5, and the second time it will be 10 (5 * 2), so the result will be 20. Function arguments are filters, and filters expect an input when invoked. If you want the value-argument behaviour for defining simple functions, you can just use a variable: def addvalue(f): f as $f | map(. + $f); Or use the short-hand: def addvalue($f): ...; With either definition, `addvalue(.foo)` will add the current input's `.foo` field to each element of the array. Do note that calling `addvalue(.[])` will cause the `map(. + $f)` part to be evaluated once per value in the value of `.` at the call site. Multiple definitions using the same function name are allowed. Each re-definition replaces the previous one for the same number of function arguments, but only for references from functions (or main program) subsequent to the re-definition. See also the section below on scoping. examples: - program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))' input: '[[1,2],[10,20]]' output: ['[[1,2,1], [10,20,10]]'] - program: 'def addvalue(f): f as $x | map(. + $x); addvalue(.[0])' input: '[[1,2],[10,20]]' output: ['[[1,2,1,2], [10,20,1,2]]'] - title: 'Scoping' body: | There are two types of symbols in jq: value bindings (a.k.a., "variables"), and functions. Both are scoped lexically, with expressions being able to refer only to symbols that have been defined "to the left" of them. The only exception to this rule is that functions can refer to themselves so as to be able to create recursive functions. For example, in the following expression there is a binding which is visible "to the right" of it, `... | .*3 as $times_three | [. + $times_three] | ...`, but not "to the left". Consider this expression now, `... | (.*3 as $times_three | [. + $times_three]) | ...`: here the binding `$times_three` is _not_ visible past the closing parenthesis. - title: "`isempty(exp)`" body: | Returns true if `exp` produces no outputs, false otherwise. examples: - program: 'isempty(empty)' input: 'null' output: ['true'] - program: 'isempty(.[])' input: '[]' output: ['true'] - program: 'isempty(.[])' input: '[1,2,3]' output: ['false'] - title: "`limit(n; expr)`" body: | The `limit` function extracts up to `n` outputs from `expr`. examples: - program: '[limit(3; .[])]' input: '[0,1,2,3,4,5,6,7,8,9]' output: ['[0,1,2]'] - title: "`skip(n; expr)`" body: | The `skip` function skips the first `n` outputs from `expr`. examples: - program: '[skip(3; .[])]' input: '[0,1,2,3,4,5,6,7,8,9]' output: ['[3,4,5,6,7,8,9]'] - title: "`first(expr)`, `last(expr)`, `nth(n; expr)`" body: | The `first(expr)` and `last(expr)` functions extract the first and last values from `expr`, respectively. The `nth(n; expr)` function extracts the nth value output by `expr`. Note that `nth(n; expr)` doesn't support negative values of `n`. examples: - program: '[first(range(.)), last(range(.)), nth(5; range(.))]' input: '10' output: ['[0,9,5]'] - program: '[first(empty), last(empty), nth(5; empty)]' input: 'null' output: ['[]'] - title: "`first`, `last`, `nth(n)`" body: | The `first` and `last` functions extract the first and last values from any array at `.`. The `nth(n)` function extracts the nth value of any array at `.`. examples: - program: '[range(.)]|[first, last, nth(5)]' input: '10' output: ['[0,9,5]'] - title: "`reduce`" body: | The `reduce` syntax allows you to combine all of the results of an expression by accumulating them into a single answer. The form is `reduce EXP as $var (INIT; UPDATE)`. As an example, we'll pass `[1,2,3]` to this expression: reduce .[] as $item (0; . + $item) For each result that `.[]` produces, `. + $item` is run to accumulate a running total, starting from 0 as the input value. In this example, `.[]` produces the results `1`, `2`, and `3`, so the effect is similar to running something like this: 0 | 1 as $item | . + $item | 2 as $item | . + $item | 3 as $item | . + $item examples: - program: 'reduce .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['15'] - program: 'reduce .[] as [$i,$j] (0; . + $i * $j)' input: '[[1,2],[3,4],[5,6]]' output: ['44'] - program: 'reduce .[] as {$x,$y} (null; .x += $x | .y += [$y])' input: '[{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}]' output: ['{"x":"abc","y":[1,2,3]}'] - title: "`foreach`" body: | The `foreach` syntax is similar to `reduce`, but intended to allow the construction of `limit` and reducers that produce intermediate results. The form is `foreach EXP as $var (INIT; UPDATE; EXTRACT)`. As an example, we'll pass `[1,2,3]` to this expression: foreach .[] as $item (0; . + $item; [$item, . * 2]) Like the `reduce` syntax, `. + $item` is run for each result that `.[]` produces, but `[$item, . * 2]` is run for each intermediate values. In this example, since the intermediate values are `1`, `3`, and `6`, the `foreach` expression produces `[1,2]`, `[2,6]`, and `[3,12]`. So the effect is similar to running something like this: 0 | 1 as $item | . + $item | [$item, . * 2], 2 as $item | . + $item | [$item, . * 2], 3 as $item | . + $item | [$item, . * 2] When `EXTRACT` is omitted, the identity filter is used. That is, it outputs the intermediate values as they are. examples: - program: 'foreach .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['1','3','6','10','15'] - program: 'foreach .[] as $item (0; . + $item; [$item, . * 2])' input: '[1,2,3,4,5]' output: ['[1,2]','[2,6]','[3,12]','[4,20]','[5,30]'] - program: 'foreach .[] as $item (0; . + 1; {index: ., $item})' input: '["foo", "bar", "baz"]' output: - '{"index":1,"item":"foo"}' - '{"index":2,"item":"bar"}' - '{"index":3,"item":"baz"}' - title: Recursion body: | As described above, `recurse` uses recursion, and any jq function can be recursive. The `while` builtin is also implemented in terms of recursion. Tail calls are optimized whenever the expression to the left of the recursive call outputs its last value. In practice this means that the expression to the left of the recursive call should not produce more than one output for each input. For example: def recurse(f): def r: ., (f | select(. != null) | r); r; def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; def repeat(exp): def _repeat: exp, _repeat; _repeat; - title: Generators and iterators body: | Some jq operators and functions are actually generators in that they can produce zero, one, or more values for each input, just as one might expect in other programming languages that have generators. For example, `.[]` generates all the values in its input (which must be an array or an object), `range(0; 10)` generates the integers between 0 and 10, and so on. Even the comma operator is a generator, generating first the values generated by the expression to the left of the comma, then the values generated by the expression on the right of the comma. The `empty` builtin is the generator that produces zero outputs. The `empty` builtin backtracks to the preceding generator expression. All jq functions can be generators just by using builtin generators. It is also possible to construct new generators using only recursion and the comma operator. If recursive calls are "in tail position" then the generator will be efficient. In the example below the recursive call by `_range` to itself is in tail position. The example shows off three advanced topics: tail recursion, generator construction, and sub-functions. examples: - program: 'def range(init; upto; by): def _range: if (by > 0 and . < upto) or (by < 0 and . > upto) then ., ((.+by)|_range) else empty end; if init == upto then empty elif by == 0 then init else init|_range end; range(0; 10; 3)' input: 'null' output: ['0', '3', '6', '9'] - program: 'def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; [while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: 'Math' body: | jq currently only has IEEE754 double-precision (64-bit) floating point number support. Besides simple arithmetic operators such as `+`, jq also has most standard math functions from the C math library. C math functions that take a single input argument (e.g., `sin()`) are available as zero-argument jq functions. C math functions that take two input arguments (e.g., `pow()`) are available as two-argument jq functions that ignore `.`. C math functions that take three input arguments are available as three-argument jq functions that ignore `.`. Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library. Unavailable math functions will be defined but will raise an error. One-input C math functions: `acos` `acosh` `asin` `asinh` `atan` `atanh` `cbrt` `ceil` `cos` `cosh` `erf` `erfc` `exp` `exp10` `exp2` `expm1` `fabs` `floor` `gamma` `j0` `j1` `lgamma` `log` `log10` `log1p` `log2` `logb` `nearbyint` `rint` `round` `significand` `sin` `sinh` `sqrt` `tan` `tanh` `tgamma` `trunc` `y0` `y1`. Two-input C math functions: `atan2` `copysign` `drem` `fdim` `fmax` `fmin` `fmod` `frexp` `hypot` `jn` `ldexp` `modf` `nextafter` `nexttoward` `pow` `remainder` `scalb` `scalbln` `yn`. Three-input C math functions: `fma`. See your system's manual for more information on each of these. - title: 'I/O' body: | At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read. Two builtins functions are provided for this, `input` and `inputs`, that read from the same sources (e.g., `stdin`, files named on the command-line) as jq itself. These two builtins, and jq's own reading actions, can be interleaved with each other. They are commonly used in combination with the null input option `-n` to prevent one input from being read implicitly. Two builtins provide minimal output capabilities, `debug`, and `stderr`. (Recall that a jq program's output values are always output as JSON texts on `stdout`.) The `debug` builtin can have application-specific behavior, such as for executables that use the libjq C API but aren't the jq executable itself. The `stderr` builtin outputs its input in raw mode to stderr with no additional decoration, not even a newline. Most jq builtins are referentially transparent, and yield constant and repeatable value streams when applied to constant inputs. This is not true of I/O builtins. entries: - title: "`input`" body: | Outputs one new input. Note that when using `input` it is generally necessary to invoke jq with the `-n` command-line option, otherwise the first entity will be lost. echo 1 2 3 4 | jq '[., input]' # [1,2] [3,4] - title: "`inputs`" body: | Outputs all remaining inputs, one by one. This is primarily useful for reductions over a program's inputs. Note that when using `inputs` it is generally necessary to invoke jq with the `-n` command-line option, otherwise the first entity will be lost. echo 1 2 3 | jq -n 'reduce inputs as $i (0; . + $i)' # 6 - title: "`debug`, `debug(msgs)`" body: | These two filters are like `.` but have as a side-effect the production of one or more messages on stderr. The message produced by the `debug` filter has the form ["DEBUG:",] where `` is a compact rendition of the input value. This format may change in the future. The `debug(msgs)` filter is defined as `(msgs | debug | empty), .` thus allowing great flexibility in the content of the message, while also allowing multi-line debugging statements to be created. For example, the expression: 1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1) would produce the value 3 but with the following two lines being written to stderr: ["DEBUG:","Entering function foo with $x == 1"] ["DEBUG:",2] - title: "`stderr`" body: | Prints its input in raw and compact mode to stderr with no additional decoration, not even a newline. - title: "`input_filename`" body: | Returns the name of the file whose input is currently being filtered. Note that this will not work well unless jq is running in a UTF-8 locale. - title: "`input_line_number`" body: | Returns the line number of the input currently being filtered. - title: 'Streaming' body: | With the `--stream` option jq can parse input texts in a streaming fashion, allowing jq programs to start processing large JSON texts immediately rather than after the parse completes. If you have a single JSON text that is 1GB in size, streaming it will allow you to process it much more quickly. However, streaming isn't easy to deal with as the jq program will have `[, ]` (and a few other forms) as inputs. Several builtins are provided to make handling streams easier. The examples below use the streamed form of `["a",["b"]]`, which is `[[0],"a"],[[1,0],"b"],[[1,0]],[[1]]`. Streaming forms include `[, ]` (to indicate any scalar value, empty array, or empty object), and `[]` (to indicate the end of an array or object). Future versions of jq run with `--stream` and `--seq` may output additional forms such as `["error message"]` when an input text fails to parse. entries: - title: "`truncate_stream(stream_expression)`" body: | Consumes a number as input and truncates the corresponding number of path elements from the left of the outputs of the given streaming expression. examples: - program: 'truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]])' input: '1' output: ['[[0],"b"]', '[[0]]'] - title: "`fromstream(stream_expression)`" body: | Outputs values corresponding to the stream expression's outputs. examples: - program: 'fromstream(1|truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]]))' input: 'null' output: ['["b"]'] - title: "`tostream`" body: | The `tostream` builtin outputs the streamed form of its input. examples: - program: '. as $dot|fromstream($dot|tostream)|.==$dot' input: '[0,[1,{"a":1},{"b":2}]]' output: ['true'] - title: Assignment body: | Assignment works a little differently in jq than in most programming languages. jq doesn't distinguish between references to and copies of something - two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object". If an object has two fields which are arrays, `.foo` and `.bar`, and you append something to `.foo`, then `.bar` will not get bigger, even if you've previously set `.bar = .foo`. If you're used to programming in languages like Python, Java, Ruby, JavaScript, etc. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance it doesn't actually do that, but that's the general idea). This means that it's impossible to build circular values in jq (such as an array whose first element is itself). This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON. All the assignment operators in jq have path expressions on the left-hand side (LHS). The right-hand side (RHS) provides values to set to the paths named by the LHS path expressions. Values in jq are always immutable. Internally, assignment works by using a reduction to compute new, replacement values for `.` that have had all the desired assignments applied to `.`, then outputting the modified value. This might be made clear by this example: `{a:{b:{c:1}}} | (.a.b|=3), .`. This will output `{"a":{"b":3}}` and `{"a":{"b":{"c":1}}}` because the last sub-expression, `.`, sees the original value, not the modified value. Most users will want to use modification assignment operators, such as `|=` or `+=`, rather than `=`. Note that the LHS of assignment operators refers to a value in `.`. Thus `$var.foo = 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo = 1` instead. Note too that `.a,.b=0` does not set `.a` and `.b`, but `(.a,.b)=0` sets both. entries: - title: "Update-assignment: `|=`" body: | This is the "update" operator `|=`. It takes a filter on the right-hand side and works out the new value for the property of `.` being assigned to by running the old value through this expression. For instance, `(.foo, .bar) |= .+1` will build an object with the `foo` field set to the input's `foo` plus 1, and the `bar` field set to the input's `bar` plus 1. The left-hand side can be any general path expression; see `path()`. Note that the left-hand side of `|=` refers to a value in `.`. Thus `$var.foo |= . + 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo |= . + 1` instead. If the right-hand side outputs no values (i.e., `empty`), then the left-hand side path will be deleted, as with `del(path)`. If the right-hand side outputs multiple values, only the first one will be used (COMPATIBILITY NOTE: in jq 1.5 and earlier releases, it used to be that only the last one was used). examples: - program: '(..|select(type=="boolean")) |= if . then 1 else 0 end' input: '[true,false,[5,true,[true,[false]],false]]' output: ['[1,0,[5,1,[1,[0]],0]]'] - title: "Arithmetic update-assignment: `+=`, `-=`, `*=`, `/=`, `%=`, `//=`" body: | jq has a few operators of the form `a op= b`, which are all equivalent to `a |= . op b`. So, `+= 1` can be used to increment values, being the same as `|= . + 1`. examples: - program: .foo += 1 input: '{"foo": 42}' output: ['{"foo": 43}'] - title: "Plain assignment: `=`" body: | This is the plain assignment operator. Unlike the others, the input to the right-hand side (RHS) is the same as the input to the left-hand side (LHS) rather than the value at the LHS path, and all values output by the RHS will be used (as shown below). If the RHS of `=` produces multiple values, then for each such value jq will set the paths on the left-hand side to the value and then it will output the modified `.`. For example, `(.a,.b) = range(2)` outputs `{"a":0,"b":0}`, then `{"a":1,"b":1}`. The "update" assignment forms (see above) do not do this. This example should show the difference between `=` and `|=`: Provide input `{"a": {"b": 10}, "b": 20}` to the programs .a = .b and .a |= .b The former will set the `a` field of the input to the `b` field of the input, and produce the output `{"a": 20, "b": 20}`. The latter will set the `a` field of the input to the `a` field's `b` field, producing `{"a": 10, "b": 20}`. examples: - program: .a = .b input: '{"a": {"b": 10}, "b": 20}' output: ['{"a":20,"b":20}'] - program: .a |= .b input: '{"a": {"b": 10}, "b": 20}' output: ['{"a":10,"b":20}'] - program: (.a, .b) = range(3) input: 'null' output: - '{"a":0,"b":0}' - '{"a":1,"b":1}' - '{"a":2,"b":2}' - program: (.a, .b) |= range(3) input: 'null' output: ['{"a":0,"b":0}'] - title: Complex assignments body: | Lots more things are allowed on the left-hand side of a jq assignment than in most languages. We've already seen simple field accesses on the left hand side, and it's no surprise that array accesses work just as well: .posts[0].title = "JQ Manual" What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: .posts[].comments |= . + ["this is great"] That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts). When jq encounters an assignment like 'a = b', it records the "path" taken to select a part of the input document while executing a. This path is then used to find which part of the input to change while executing the assignment. Any filter may be used on the left-hand side of an equals - whichever paths it selects from the input will be where the assignment is performed. This is a very powerful operation. Suppose we wanted to add a comment to blog posts, using the same "blog" input above. This time, we only want to comment on the posts written by "stedolan". We can find those posts using the "select" function described earlier: .posts[] | select(.author == "stedolan") The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] - title: Comments body: | You can write comments in your jq filters using `#`. A `#` character (not part of a string) starts a comment. All characters from `#` to the end of the line are ignored. If the end of the line is preceded by an odd number of backslash characters, the following line is also considered part of the comment and is ignored. For example, the following code outputs `[1,3,4,7]` [ 1, # foo \ 2, # bar \\ 3, 4, # baz \\\ 5, \ 6, 7 # comment \ comment \ comment ] Backslash continuing the comment on the next line can be useful when writing the "shebang" for a jq script: #!/bin/sh -- # total - Output the sum of the given arguments (or stdin) # usage: total [numbers...] # \ exec jq --args -MRnf -- "$0" "$@" $ARGS.positional | reduce ( if . == [] then inputs else .[] end | . as $dot | try tonumber catch false | if not or isnan then @json "total: Invalid number \($dot).\n" | halt_error(1) end ) as $n (0; . + $n) The `exec` line is considered a comment by jq, so it is ignored. But it is not ignored by `sh`, since in `sh` a backslash at the end of the line does not continue the comment. With this trick, when the script is invoked as `total 1 2`, `/bin/sh -- /path/to/total 1 2` will be run, and `sh` will then run `exec jq --args -MRnf -- /path/to/total 1 2` replacing itself with a `jq` interpreter invoked with the specified options (`-M`, `-R`, `-n`, `--args`), that evaluates the current file (`$0`), with the arguments (`$@`) that were passed to `sh`. - title: Modules body: | jq has a library/module system. Modules are files whose names end in `.jq`. Modules imported by a program are searched for in a default search path (see below). The `import` and `include` directives allow the importer to alter this path. Paths in the search path are subject to various substitutions. For paths starting with `~/`, the user's home directory is substituted for `~`. For paths starting with `$ORIGIN/`, the directory where the jq executable is located is substituted for `$ORIGIN`. For paths starting with `./` or paths that are `.`, the path of the including file is substituted for `.`. For top-level programs given on the command-line, the current directory is used. Import directives can optionally specify a search path to which the default is appended. The default search path is the search path given to the `-L` command-line option, else `["~/.jq", "$ORIGIN/../lib/jq", "$ORIGIN/../lib"]`. Null and empty string path elements terminate search path processing. A dependency with relative path `foo/bar` would be searched for in `foo/bar.jq` and `foo/bar/bar.jq` in the given search path. This is intended to allow modules to be placed in a directory along with, for example, version control files, README files, and so on, but also to allow for single-file modules. Consecutive components with the same name are not allowed to avoid ambiguities (e.g., `foo/foo`). For example, with `-L$HOME/.jq` a module `foo` can be found in `$HOME/.jq/foo.jq` and `$HOME/.jq/foo/foo.jq`. If `.jq` exists in the user's home directory, and is a file (not a directory), it is automatically sourced into the main program. entries: - title: "`import RelativePathString as NAME [];`" body: | Imports a module found at the given path relative to a directory in a search path. A `.jq` suffix will be added to the relative path string. The module's symbols are prefixed with `NAME::`. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The `search` key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`include RelativePathString [];`" body: | Imports a module found at the given path relative to a directory in a search path as if it were included in place. A `.jq` suffix will be added to the relative path string. The module's symbols are imported into the caller's namespace as if the module's content had been included directly. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. - title: "`import RelativePathString as $NAME [];`" body: | Imports a JSON file found at the given path relative to a directory in a search path. A `.json` suffix will be added to the relative path string. The file's data will be available as `$NAME::NAME`. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The `search` key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`module ;`" body: | This directive is entirely optional. It's not required for proper operation. It serves only the purpose of providing metadata that can be read with the `modulemeta` builtin. The metadata must be a constant jq expression. It should be an object with keys like `homepage`. At this time jq doesn't use this metadata, but it is made available to users via the `modulemeta` builtin. - title: "`modulemeta`" body: | Takes a module name as input and outputs the module's metadata as an object, with the module's imports (including metadata) as an array value for the `deps` key and the module's defined functions as an array value for the `defs` key. Programs can use this to query a module's metadata, which they could then use to, for example, search for, download, and install missing dependencies. - title: Colors body: | To configure alternative colors just set the `JQ_COLORS` environment variable to colon-delimited list of partial terminal escape sequences like `"1;31"`, in this order: - color for `null` - color for `false` - color for `true` - color for numbers - color for strings - color for arrays - color for objects - color for object keys The default color scheme is the same as setting `JQ_COLORS="0;90:0;39:0;39:0;39:0;32:1;39:1;39:1;34"`. This is not a manual for VT100/ANSI escapes. However, each of these color specifications should consist of two numbers separated by a semi-colon, where the first number is one of these: - 1 (bright) - 2 (dim) - 4 (underscore) - 5 (blink) - 7 (reverse) - 8 (hidden) and the second is one of these: - 30 (black) - 31 (red) - 32 (green) - 33 (yellow) - 34 (blue) - 35 (magenta) - 36 (cyan) - 37 (white) jq-1.8.2/docs/content/manual/v1.7/0000755000175100017510000000000015215513536012257 5jq-1.8.2/docs/content/manual/v1.7/manual.yml0000644000175100017510000042443315215513536014211 --- headline: jq 1.7 Manual body: | A jq program is a "filter": it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks. Filters can be combined in various ways - you can pipe the output of one filter into another filter, or collect the output of a filter into an array. Some filters produce multiple results, for instance there's one that produces all the elements of its input array. Piping that filter into a second runs the second filter for each element of the array. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq. It's important to remember that every filter has an input and an output. Even literals like "hello" or 42 are filters - they take an input but always produce the same literal as output. Operations that combine two filters, like addition, generally feed the same input to both and combine the results. So, you can implement an averaging filter as `add / length` - feeding the input array both to the `add` filter and the `length` filter and then performing the division. But that's getting ahead of ourselves. :) Let's start with something simpler: manpage_intro: | jq(1) -- Command-line JSON processor ==================================== ## SYNOPSIS `jq` [...] [...] `jq` can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents. For instance, running the command `jq 'map(.price) | add'` will take an array of JSON objects as input and return the sum of their "price" fields. `jq` can accept text input as well, but by default, `jq` reads a stream of JSON entities (including numbers and other literals) from `stdin`. Whitespace is only needed to separate entities such as 1 and 2, and true and false. One or more may be specified, in which case `jq` will read input from those instead. The are described in the [INVOKING JQ] section; they mostly concern input and output formatting. The is written in the jq language and specifies how to transform the input file or document. ## FILTERS manpage_epilogue: | ## BUGS Presumably. Report them or discuss them at: https://github.com/jqlang/jq/issues ## AUTHOR Stephen Dolan `` sections: - title: Invoking jq body: | jq filters run on a stream of JSON data. The input to jq is parsed as a sequence of whitespace-separated JSON values which are passed through the provided filter one at a time. The output(s) of the filter are written to standard output, as a sequence of newline-separated JSON data. The simplest and most common filter (or jq program) is `.`, which is the identity operator, copying the inputs of the jq processor to the output stream. Because the default behavior of the jq processor is to read JSON texts from the input stream, and to pretty-print outputs, the `.` program's main use is to validate and pretty-print the inputs. The jq programming language is quite rich and allows for much more than just validation and pretty-printing. Note: it is important to mind the shell's quoting rules. As a general rule it's best to always quote (with single-quote characters on Unix shells) the jq program, as too many characters with special meaning to jq are also shell meta-characters. For example, `jq "foo"` will fail on most Unix shells because that will be the same as `jq foo`, which will generally fail because `foo is not defined`. When using the Windows command shell (cmd.exe) it's best to use double quotes around your jq program when given on the command-line (instead of the `-f program-file` option), but then double-quotes in the jq program need backslash escaping. When using the Powershell (`powershell.exe`) or the Powershell Core (`pwsh`/`pwsh.exe`), use single-quote characters around the jq program and backslash-escaped double-quotes (`\"`) inside the jq program. * Unix shells: `jq '.["foo"]'` * Powershell: `jq '.[\"foo\"]'` * Windows command shell: `jq ".[\"foo\"]"` Note: jq allows user-defined functions, but every jq program must have a top-level expression. You can affect how jq reads and writes its input and output using some command-line options: * `--null-input` / `-n`: Don't read any input at all. Instead, the filter is run once using `null` as the input. This is useful when using jq as a simple calculator or to construct JSON data from scratch. * `--raw-input` / `-R`: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with `--slurp`, then the entire input is passed to the filter as a single long string. * `--slurp` / `-s`: Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. * `--compact-output` / `-c`: By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. * `--raw-output` / `-r`: With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. * `--raw-output0`: Like `-r` but jq will print NUL instead of newline after each output. This can be useful when the values being output can contain newlines. When the output value contains NUL, jq exits with non-zero code. * `--join-output` / `-j`: Like `-r` but jq won't print a newline after each output. * `--ascii-output` / `-a`: jq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences (like "\u03bc"). Using this option, you can force jq to produce pure ASCII output with every non-ASCII character replaced with the equivalent escape sequence. * `--sort-keys` / `-S`: Output the fields of each object with the keys in sorted order. * `--color-output` / `-C` and `--monochrome-output` / `-M`: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using `-C`, and disable color with `-M`. When the `NO_COLOR` environment variable is not empty, jq disables colored output by default, but you can enable it by `-C`. Colors can be configured with the `JQ_COLORS` environment variable (see below). * `--tab`: Use a tab for each indentation level instead of two spaces. * `--indent n`: Use the given number of spaces (no more than 7) for indentation. * `--unbuffered`: Flush the output after each JSON object is printed (useful if you're piping a slow data source into jq and piping jq's output elsewhere). * `--stream`: Parse the input in streaming fashion, outputting arrays of path and leaf values (scalars and empty arrays or empty objects). For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]` becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`. This is useful for processing very large inputs. Use this in conjunction with filtering and the `reduce` and `foreach` syntax to reduce large inputs incrementally. * `--stream-errors`: Like `--stream`, but invalid JSON inputs yield array values where the first element is the error and the second is a path. For example, `["a",n]` produces `["Invalid literal at line 1, column 7",[1]]`. Implies `--stream`. Invalid JSON inputs produce no error values when `--stream` without `--stream-errors`. * `--seq`: Use the `application/json-seq` MIME type scheme for separating JSON texts in jq's input and output. This means that an ASCII RS (record separator) character is printed before each value on output and an ASCII LF (line feed) is printed after every output. Input JSON texts that fail to parse are ignored (but warned about), discarding all subsequent input until the next RS. This mode also parses the output of jq without the `--seq` option. * `-f filename` / `--from-file filename`: Read filter from the file rather than from a command line, like awk's -f option. You can also use '#' to make comments. * `-L directory`: Prepend `directory` to the search list for modules. If this option is used then no builtin search list is used. See the section on modules below. * `--arg name value`: This option passes a value to the jq program as a predefined variable. If you run jq with `--arg foo bar`, then `$foo` is available in the program and has the value `"bar"`. Note that `value` will be treated as a string, so `--arg foo 123` will bind `$foo` to `"123"`. Named arguments are also available to the jq program as `$ARGS.named`. * `--argjson name JSON-text`: This option passes a JSON-encoded value to the jq program as a predefined variable. If you run jq with `--argjson foo 123`, then `$foo` is available in the program and has the value `123`. * `--slurpfile variable-name filename`: This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable. If you run jq with `--slurpfile foo bar`, then `$foo` is available in the program and has an array whose elements correspond to the texts in the file named `bar`. * `--rawfile variable-name filename`: This option reads in the named file and binds its content to the given global variable. If you run jq with `--rawfile foo bar`, then `$foo` is available in the program and has a string whose content is set to the text in the file named `bar`. * `--args`: Remaining arguments are positional string arguments. These are available to the jq program as `$ARGS.positional[]`. * `--jsonargs`: Remaining arguments are positional JSON text arguments. These are available to the jq program as `$ARGS.positional[]`. * `--exit-status` / `-e`: Sets the exit status of jq to 0 if the last output value was neither `false` nor `null`, 1 if the last output value was either `false` or `null`, or 4 if no valid result was ever produced. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran. Another way to set the exit status is with the `halt_error` builtin function. * `--binary` / `-b`: Windows users using WSL, MSYS2, or Cygwin, should use this option when using a native jq.exe, otherwise jq will turn newlines (LFs) into carriage-return-then-newline (CRLF). * `--version` / `-V`: Output the jq version and exit with zero. * `--build-configuration`: Output the build configuration of jq and exit with zero. This output has no supported format or structure and may change without notice in future releases. * `--help` / `-h`: Output the jq help and exit with zero. * `--`: Terminates argument processing. Remaining arguments are positional, either strings, JSON texts, or input filenames, according to whether `--args` or `--jsonargs` were given. * `--run-tests [filename]`: Runs the tests in the given file or standard input. This must be the last option given and does not honor all preceding options. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line. Compilation failure tests start with a line containing only `%%FAIL`, then a line containing the program to compile, then a line containing an error message to compare to the actual. Be warned that this option can change backwards-incompatibly. - title: Basic filters entries: - title: "Identity: `.`" body: | The absolute simplest filter is `.` . This filter takes its input and produces the same value as output. That is, this is the identity operator. Since jq by default pretty-prints all output, a trivial program consisting of nothing but `.` can be used to format JSON output from, say, `curl`. Although the identity filter never modifies the value of its input, jq processing can sometimes make it appear as though it does. For example, using the current implementation of jq, we would see that the expression: 1E1234567890 | . produces `1.7976931348623157e+308` on at least one platform. This is because, in the process of parsing the number, this particular version of jq has converted it to an IEEE754 double-precision representation, losing precision. The way in which jq handles numbers has changed over time and further changes are likely within the parameters set by the relevant JSON standards. The following remarks are therefore offered with the understanding that they are intended to be descriptive of the current version of jq and should not be interpreted as being prescriptive: (1) Any arithmetic operation on a number that has not already been converted to an IEEE754 double precision representation will trigger a conversion to the IEEE754 representation. (2) jq will attempt to maintain the original decimal precision of number literals, but in expressions such `1E1234567890`, precision will be lost if the exponent is too large. (3) In jq programs, a leading minus sign will trigger the conversion of the number to an IEEE754 representation. (4) Comparisons are carried out using the untruncated big decimal representation of numbers if available, as illustrated in one of the following examples. examples: - program: '.' input: '"Hello, world!"' output: ['"Hello, world!"'] - program: '.' input: '0.12345678901234567890123456789' output: ['0.12345678901234567890123456789'] - program: '[., tojson]' input: '12345678909876543212345' output: ['[12345678909876543212345,"12345678909876543212345"]'] - program: '. < 0.12345678901234567890123456788' input: '0.12345678901234567890123456789' output: ['false'] - program: 'map([., . == 1]) | tojson' input: '[1, 1.000, 1.0, 100e-2]' output: ['"[[1,true],[1.000,true],[1.0,true],[1.00,true]]"'] - program: '. as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000)' input: '10000000000000000000000000000001' output: ['[true, false]'] - title: "Object Identifier-Index: `.foo`, `.foo.bar`" body: | The simplest *useful* filter has the form `.foo`. When given a JSON object (aka dictionary or hash) as input, `.foo` produces the value at the key "foo" if the key is present, or null otherwise. A filter of the form `.foo.bar` is equivalent to `.foo | .bar`. The `.foo` syntax only works for simple, identifier-like keys, that is, keys that are all made of alphanumeric characters and underscore, and which do not start with a digit. If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: `."foo$"`, or else `.["foo$"]`. For example `.["foo::bar"]` and `.["foo.bar"]` work while `.foo::bar` does not. examples: - program: '.foo' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]' input: '{"foo": 42}' output: ['42'] - title: "Optional Object Identifier-Index: `.foo?`" body: | Just like `.foo`, but does not output an error when `.` is not an object. examples: - program: '.foo?' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo?' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]?' input: '{"foo": 42}' output: ['42'] - program: '[.foo?]' input: '[1,2]' output: ['[]'] - title: "Object Index: `.[]`" body: | You can also look up fields of an object using syntax like `.["foo"]` (`.foo` above is a shorthand version of this, but only for identifier-like strings). - title: "Array Index: `.[]`" body: | When the index value is an integer, `.[]` can index arrays. Arrays are zero-based, so `.[2]` returns the third element. Negative indices are allowed, with -1 referring to the last element, -2 referring to the next to last element, and so on. examples: - program: '.[0]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['{"name":"JSON", "good":true}'] - program: '.[2]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['null'] - program: '.[-2]' input: '[1,2,3]' output: ['2'] - title: "Array/String Slice: `.[:]`" body: | The `.[:]` syntax can be used to return a subarray of an array or substring of a string. The array returned by `.[10:15]` will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array). Indices are zero-based. examples: - program: '.[2:4]' input: '["a","b","c","d","e"]' output: ['["c", "d"]'] - program: '.[2:4]' input: '"abcdefghi"' output: ['"cd"'] - program: '.[:3]' input: '["a","b","c","d","e"]' output: ['["a", "b", "c"]'] - program: '.[-2:]' input: '["a","b","c","d","e"]' output: ['["d", "e"]'] - title: "Array/Object Value Iterator: `.[]`" body: | If you use the `.[index]` syntax, but omit the index entirely, it will return *all* of the elements of an array. Running `.[]` with the input `[1,2,3]` will produce the numbers as three separate results, rather than as a single array. A filter of the form `.foo[]` is equivalent to `.foo | .[]`. You can also use this on an object, and it will return all the values of the object. Note that the iterator operator is a generator of values. examples: - program: '.[]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: - '{"name":"JSON", "good":true}' - '{"name":"XML", "good":false}' - program: '.[]' input: '[]' output: [] - program: '.foo[]' input: '{"foo":[1,2,3]}' output: ['1','2','3'] - program: '.[]' input: '{"a": 1, "b": 1}' output: ['1', '1'] - title: "`.[]?`" body: | Like `.[]`, but no errors will be output if . is not an array or object. A filter of the form `.foo[]?` is equivalent to `.foo | .[]?`. - title: "Comma: `,`" body: | If two filters are separated by a comma, then the same input will be fed into both and the two filters' output value streams will be concatenated in order: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right. For instance, filter `.foo, .bar`, produces both the "foo" fields and "bar" fields as separate outputs. The `,` operator is one way to construct generators. examples: - program: '.foo, .bar' input: '{"foo": 42, "bar": "something else", "baz": true}' output: ['42', '"something else"'] - program: ".user, .projects[]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['"stedolan"', '"jq"', '"wikiflow"'] - program: '.[4,2]' input: '["a","b","c","d","e"]' output: ['"e"', '"c"'] - title: "Pipe: `|`" body: | The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right. It's similar to the Unix shell's pipe, if you're used to that. If the one on the left produces multiple results, the one on the right will be run for each of those results. So, the expression `.[] | .foo` retrieves the "foo" field of each element of the input array. This is a cartesian product, which can be surprising. Note that `.a.b.c` is the same as `.a | .b | .c`. Note too that `.` is the input value at the particular stage in a "pipeline", specifically: where the `.` expression appears. Thus `.a | . | .b` is the same as `.a.b`, as the `.` in the middle refers to whatever value `.a` produced. examples: - program: '.[] | .name' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['"JSON"', '"XML"'] - title: "Parenthesis" body: | Parenthesis work as a grouping operator just as in any typical programming language. examples: - program: '(. + 2) * 5' input: '1' output: ['15'] - title: Types and Values body: | jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string keys), and "null". Booleans, null, strings and numbers are written the same way as in JSON. Just like everything else in jq, these simple values take an input and produce an output - `42` is a valid jq expression that takes an input, ignores it, and returns 42 instead. Numbers in jq are internally represented by their IEEE754 double precision approximation. Any arithmetic operation with numbers, whether they are literals or results of previous filters, will produce a double precision floating point result. However, when parsing a literal jq will store the original literal string. If no mutation is applied to this value then it will make to the output in its original form, even if conversion to double would result in a loss. entries: - title: "Array construction: `[]`" body: | As in JSON, `[]` is used to construct arrays, as in `[1,2,3]`. The elements of the arrays can be any jq expression, including a pipeline. All of the results produced by all of the expressions are collected into one big array. You can use it to construct an array out of a known quantity of values (as in `[.foo, .bar, .baz]`) or to "collect" all the results of a filter into an array (as in `[.items[].name]`) Once you understand the "," operator, you can look at jq's array syntax in a different light: the expression `[1,2,3]` is not using a built-in syntax for comma-separated arrays, but is instead applying the `[]` operator (collect results) to the expression 1,2,3 (which produces three different results). If you have a filter `X` that produces four results, then the expression `[X]` will produce a single result, an array of four elements. examples: - program: "[.user, .projects[]]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['["stedolan", "jq", "wikiflow"]'] - program: "[ .[] | . * 2]" input: '[1, 2, 3]' output: ['[2, 4, 6]'] - title: "Object Construction: `{}`" body: | Like JSON, `{}` is for constructing objects (aka dictionaries or hashes), as in: `{"a": 42, "b": 17}`. If the keys are "identifier-like", then the quotes can be left off, as in `{a:42, b:17}`. Variable references as key expressions use the value of the variable as the key. Key expressions other than constant literals, identifiers, or variable references, need to be parenthesized, e.g., `{("a"+"b"):59}`. The value can be any expression (although you may need to wrap it in parentheses if, for example, it contains colons), which gets applied to the {} expression's input (remember, all filters have an input and an output). {foo: .bar} will produce the JSON object `{"foo": 42}` if given the JSON object `{"bar":42, "baz":43}` as its input. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write {user: .user, title: .title} Because that is so common, there's a shortcut syntax for it: `{user, title}`. If one of the expressions produces multiple results, multiple dictionaries will be produced. If the input's {"user":"stedolan","titles":["JQ Primer", "More JQ"]} then the expression {user, title: .titles[]} will produce two outputs: {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} Putting parentheses around the key means it will be evaluated as an expression. With the same input as above, {(.user): .titles} produces {"stedolan": ["JQ Primer", "More JQ"]} Variable references as keys use the value of the variable as the key. Without a value then the variable's name becomes the key and its value becomes the value, "f o o" as $foo | "b a r" as $bar | {$foo, $bar:$foo} produces {"foo":"f o o","b a r":"f o o"} examples: - program: '{user, title: .titles[]}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: - '{"user":"stedolan", "title": "JQ Primer"}' - '{"user":"stedolan", "title": "More JQ"}' - program: '{(.user): .titles}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: ['{"stedolan": ["JQ Primer", "More JQ"]}'] - title: "Recursive Descent: `..`" body: | Recursively descends `.`, producing every value. This is the same as the zero-argument `recurse` builtin (see below). This is intended to resemble the XPath `//` operator. Note that `..a` does not work; use `.. | .a` instead. In the example below we use `.. | .a?` to find all the values of object keys "a" in any object found "below" `.`. This is particularly useful in conjunction with `path(EXP)` (also see below) and the `?` operator. examples: - program: '.. | .a?' input: '[[{"a":1}]]' output: ['1'] - title: Builtin operators and functions body: | Some jq operators (for instance, `+`) do different things depending on the type of their arguments (arrays, numbers, etc.). However, jq never does implicit type conversions. If you try to add a string to an object you'll get an error message and no result. Please note that all numbers are converted to IEEE754 double precision floating point representation. Arithmetic and logical operators are working with these converted doubles. Results of all such operations are also limited to the double precision. The only exception to this behaviour of number is a snapshot of original number literal. When a number which originally was provided as a literal is never mutated until the end of the program then it is printed to the output in its original literal form. This also includes cases when the original literal would be truncated when converted to the IEEE754 double precision floating point number. entries: - title: "Addition: `+`" body: | The operator `+` takes two filters, applies them both to the same input, and adds the results together. What "adding" means depends on the types involved: - **Numbers** are added by normal arithmetic. - **Arrays** are added by being concatenated into a larger array. - **Strings** are added by being joined into a larger string. - **Objects** are added by merging, that is, inserting all the key-value pairs from both objects into a single combined object. If both objects contain a value for the same key, the object on the right of the `+` wins. (For recursive merge use the `*` operator.) `null` can be added to any value, and returns the other value unchanged. examples: - program: '.a + 1' input: '{"a": 7}' output: ['8'] - program: '.a + .b' input: '{"a": [1,2], "b": [3,4]}' output: ['[1,2,3,4]'] - program: '.a + null' input: '{"a": 1}' output: ['1'] - program: '.a + 1' input: '{}' output: ['1'] - program: '{a: 1} + {b: 2} + {c: 3} + {a: 42}' input: 'null' output: ['{"a": 42, "b": 2, "c": 3}'] - title: "Subtraction: `-`" body: | As well as normal arithmetic subtraction on numbers, the `-` operator can be used on arrays to remove all occurrences of the second array's elements from the first array. examples: - program: '4 - .a' input: '{"a":3}' output: ['1'] - program: . - ["xml", "yaml"] input: '["xml", "yaml", "json"]' output: ['["json"]'] - title: "Multiplication, division, modulo: `*`, `/`, `%`" body: | These infix operators behave as expected when given two numbers. Division by zero raises an error. `x % y` computes x modulo y. Multiplying a string by a number produces the concatenation of that string that many times. `"x" * 0` produces `""`. Dividing a string by another splits the first using the second as separators. Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy. examples: - program: '10 / . * 3' input: '5' output: ['6'] - program: '. / ", "' input: '"a, b,c,d, e"' output: ['["a","b,c,d","e"]'] - program: '{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}' input: 'null' output: ['{"k": {"a": 0, "b": 2, "c": 3}}'] - program: '.[] | (1 / .)?' input: '[1,0,-1]' output: ['1', '-1'] - title: "`abs`" body: | The builtin function `abs` is defined naively as: `if . < 0 then - . else . end`. For numeric input, this is the absolute value. See the section on the identity filter for the implications of this definition for numeric input. To compute the absolute value of a number as a floating point number, you may wish use `fabs`. examples: - program: 'map(abs)' input: '[-10, -1.1, -1e-1]' output: ['[10,1.1,1e-1]'] - title: "`length`" body: | The builtin function `length` gets the length of various different types of value: - The length of a **string** is the number of Unicode codepoints it contains (which will be the same as its JSON-encoded length in bytes if it's pure ASCII). - The length of a **number** is its absolute value. - The length of an **array** is the number of elements. - The length of an **object** is the number of key-value pairs. - The length of **null** is zero. - It is an error to use `length` on a **boolean**. examples: - program: '.[] | length' input: '[[1,2], "string", {"a":2}, null, -5]' output: ['2', '6', '1', '0', '5'] - title: "`utf8bytelength`" body: | The builtin function `utf8bytelength` outputs the number of bytes used to encode a string in UTF-8. examples: - program: 'utf8bytelength' input: '"\u03bc"' output: ['2'] - title: "`keys`, `keys_unsorted`" body: | The builtin function `keys`, when given an object, returns its keys in an array. The keys are sorted "alphabetically", by unicode codepoint order. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings. When `keys` is given an array, it returns the valid indices for that array: the integers from 0 to length-1. The `keys_unsorted` function is just like `keys`, but if the input is an object then the keys will not be sorted, instead the keys will roughly be in insertion order. examples: - program: 'keys' input: '{"abc": 1, "abcd": 2, "Foo": 3}' output: ['["Foo", "abc", "abcd"]'] - program: 'keys' input: '[42,3,35]' output: ['[0,1,2]'] - title: "`has(key)`" body: | The builtin function `has` returns whether the input object has the given key, or the input array has an element at the given index. `has($key)` has the same effect as checking whether `$key` is a member of the array returned by `keys`, although `has` will be faster. examples: - program: 'map(has("foo"))' input: '[{"foo": 42}, {}]' output: ['[true, false]'] - program: 'map(has(2))' input: '[[0,1], ["a","b","c"]]' output: ['[false, true]'] - title: "`in`" body: | The builtin function `in` returns whether or not the input key is in the given object, or the input index corresponds to an element in the given array. It is, essentially, an inversed version of `has`. examples: - program: '.[] | in({"foo": 42})' input: '["foo", "bar"]' output: ['true', 'false'] - program: 'map(in([0,1]))' input: '[2, 0]' output: ['[false, true]'] - title: "`map(f)`, `map_values(f)`" body: | For any filter `f`, `map(f)` and `map_values(f)` apply `f` to each of the values in the input array or object, that is, to the values of `.[]`. In the absence of errors, `map(f)` always outputs an array whereas `map_values(f)` outputs an array if given an array, or an object if given an object. When the input to `map_values(f)` is an object, the output object has the same keys as the input object except for those keys whose values when piped to `f` produce no values at all. The key difference between `map(f)` and `map_values(f)` is that the former simply forms an array from all the values of `($x|f)` for each value, `$x`, in the input array or object, but `map_values(f)` only uses `first($x|f)`. Specifically, for object inputs, `map_values(f)` constructs the output object by examining in turn the value of `first(.[$k]|f)` for each key, `$k`, of the input. If this expression produces no values, then the corresponding key will be dropped; otherwise, the output object will have that value at the key, `$k`. Here are some examples to clarify the behavior of `map` and `map_values` when applied to arrays. These examples assume the input is `[1]` in all cases: map(.+1) #=> [2] map(., .) #=> [1,1] map(empty) #=> [] map_values(.+1) #=> [2] map_values(., .) #=> [1] map_values(empty) #=> [] `map(f)` is equivalent to `[.[] | f]` and `map_values(f)` is equivalent to `.[] |= f`. In fact, these are their implementations. examples: - program: 'map(.+1)' input: '[1,2,3]' output: ['[2,3,4]'] - program: 'map_values(.+1)' input: '{"a": 1, "b": 2, "c": 3}' output: ['{"a": 2, "b": 3, "c": 4}'] - program: 'map(., .)' input: '[1,2]' output: ['[1,1,2,2]'] - program: 'map_values(. // empty)' input: '{"a": null, "b": true, "c": false}' output: ['{"b":true}'] - title: "`pick(pathexps)`" body: | Emit the projection of the input object or array defined by the specified sequence of path expressions, such that if `p` is any one of these specifications, then `(. | p)` will evaluate to the same value as `(. | pick(pathexps) | p)`. For arrays, negative indices and `.[m:n]` specifications should not be used. examples: - program: 'pick(.a, .b.c, .x)' input: '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4}' output: ['{"a":1,"b":{"c":2},"x":null}'] - program: 'pick(.[2], .[0], .[0])' input: '[1,2,3,4]' output: ['[1,null,3]'] - title: "`path(path_expression)`" body: | Outputs array representations of the given path expression in `.`. The outputs are arrays of strings (object keys) and/or numbers (array indices). Path expressions are jq expressions like `.a`, but also `.[]`. There are two types of path expressions: ones that can match exactly, and ones that cannot. For example, `.a.b.c` is an exact match path expression, while `.a[].b` is not. `path(exact_path_expression)` will produce the array representation of the path expression even if it does not exist in `.`, if `.` is `null` or an array or an object. `path(pattern)` will produce array representations of the paths matching `pattern` if the paths exist in `.`. Note that the path expressions are not different from normal expressions. The expression `path(..|select(type=="boolean"))` outputs all the paths to boolean values in `.`, and only those paths. examples: - program: 'path(.a[0].b)' input: 'null' output: ['["a",0,"b"]'] - program: '[path(..)]' input: '{"a":[{"b":1}]}' output: ['[[],["a"],["a",0],["a",0,"b"]]'] - title: "`del(path_expression)`" body: | The builtin function `del` removes a key and its corresponding value from an object. examples: - program: 'del(.foo)' input: '{"foo": 42, "bar": 9001, "baz": 42}' output: ['{"bar": 9001, "baz": 42}'] - program: 'del(.[1, 2])' input: '["foo", "bar", "baz"]' output: ['["foo"]'] - title: "`getpath(PATHS)`" body: | The builtin function `getpath` outputs the values in `.` found at each path in `PATHS`. examples: - program: 'getpath(["a","b"])' input: 'null' output: ['null'] - program: '[getpath(["a","b"], ["a","c"])]' input: '{"a":{"b":0, "c":1}}' output: ['[0, 1]'] - title: "`setpath(PATHS; VALUE)`" body: | The builtin function `setpath` sets the `PATHS` in `.` to `VALUE`. examples: - program: 'setpath(["a","b"]; 1)' input: 'null' output: ['{"a": {"b": 1}}'] - program: 'setpath(["a","b"]; 1)' input: '{"a":{"b":0}}' output: ['{"a": {"b": 1}}'] - program: 'setpath([0,"a"]; 1)' input: 'null' output: ['[{"a":1}]'] - title: "`delpaths(PATHS)`" body: | The builtin function `delpaths` deletes the `PATHS` in `.`. `PATHS` must be an array of paths, where each path is an array of strings and numbers. examples: - program: 'delpaths([["a","b"]])' input: '{"a":{"b":1},"x":{"y":2}}' output: ['{"a":{},"x":{"y":2}}'] - title: "`to_entries`, `from_entries`, `with_entries(f)`" body: | These functions convert between an object and an array of key-value pairs. If `to_entries` is passed an object, then for each `k: v` entry in the input, the output array includes `{"key": k, "value": v}`. `from_entries` does the opposite conversion, and `with_entries(f)` is a shorthand for `to_entries | map(f) | from_entries`, useful for doing some operation to all keys and values of an object. `from_entries` accepts `"key"`, `"Key"`, `"name"`, `"Name"`, `"value"`, and `"Value"` as keys. examples: - program: 'to_entries' input: '{"a": 1, "b": 2}' output: ['[{"key":"a", "value":1}, {"key":"b", "value":2}]'] - program: 'from_entries' input: '[{"key":"a", "value":1}, {"key":"b", "value":2}]' output: ['{"a": 1, "b": 2}'] - program: 'with_entries(.key |= "KEY_" + .)' input: '{"a": 1, "b": 2}' output: ['{"KEY_a": 1, "KEY_b": 2}'] - title: "`select(boolean_expression)`" body: | The function `select(f)` produces its input unchanged if `f` returns true for that input, and produces no output otherwise. It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))` will give you `[2,3]`. examples: - program: 'map(select(. >= 2))' input: '[1,5,3,0,7]' output: ['[5,3,7]'] - program: '.[] | select(.id == "second")' input: '[{"id": "first", "val": 1}, {"id": "second", "val": 2}]' output: ['{"id": "second", "val": 2}'] - title: "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `normals`, `finites`, `strings`, `nulls`, `values`, `scalars`" body: | These built-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, normal numbers, finite numbers, strings, null, non-null values, and non-iterables, respectively. examples: - program: '.[]|numbers' input: '[[],{},1,"foo",null,true,false]' output: ['1'] - title: "`empty`" body: | `empty` returns no results. None at all. Not even `null`. It's useful on occasion. You'll know if you need it :) examples: - program: '1, empty, 2' input: 'null' output: ['1', '2'] - program: '[1,2,empty,3]' input: 'null' output: ['[1,2,3]'] - title: "`error`, `error(message)`" body: | Produces an error with the input value, or with the message given as the argument. Errors can be caught with try/catch; see below. examples: - program: 'try error catch .' input: '"error message"' output: ['"error message"'] - program: 'try error("invalid value: \(.)") catch .' input: '42' output: ['"invalid value: 42"'] - title: "`halt`" body: | Stops the jq program with no further outputs. jq will exit with exit status `0`. - title: "`halt_error`, `halt_error(exit_code)`" body: | Stops the jq program with no further outputs. The input will be printed on `stderr` as raw output (i.e., strings will not have double quotes) with no decoration, not even a newline. The given `exit_code` (defaulting to `5`) will be jq's exit status. For example, `"Error: something went wrong\n"|halt_error(1)`. - title: "`$__loc__`" body: | Produces an object with a "file" key and a "line" key, with the filename and line number where `$__loc__` occurs, as values. examples: - program: 'try error("\($__loc__)") catch .' input: 'null' output: ['"{\"file\":\"\",\"line\":1}"'] - title: "`paths`, `paths(node_filter)`" body: | `paths` outputs the paths to all the elements in its input (except it does not output the empty list, representing . itself). `paths(f)` outputs the paths to any values for which `f` is `true`. That is, `paths(type == "number")` outputs the paths to all numeric values. examples: - program: '[paths]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1],[1,0],[1,1],[1,1,"a"]]'] - program: '[paths(type == "number")]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1,1,"a"]]'] - title: "`add`" body: | The filter `add` takes as input an array, and produces as output the elements of the array added together. This might mean summed, concatenated or merged depending on the types of the elements of the input array - the rules are the same as those for the `+` operator (described above). If the input is an empty array, `add` returns `null`. examples: - program: add input: '["a","b","c"]' output: ['"abc"'] - program: add input: '[1, 2, 3]' output: ['6'] - program: add input: '[]' output: ["null"] - title: "`any`, `any(condition)`, `any(generator; condition)`" body: | The filter `any` takes as input an array of boolean values, and produces `true` as output if any of the elements of the array are `true`. If the input is an empty array, `any` returns `false`. The `any(condition)` form applies the given condition to the elements of the input array. The `any(generator; condition)` form applies the given condition to all the outputs of the given generator. examples: - program: any input: '[true, false]' output: ["true"] - program: any input: '[false, false]' output: ["false"] - program: any input: '[]' output: ["false"] - title: "`all`, `all(condition)`, `all(generator; condition)`" body: | The filter `all` takes as input an array of boolean values, and produces `true` as output if all of the elements of the array are `true`. The `all(condition)` form applies the given condition to the elements of the input array. The `all(generator; condition)` form applies the given condition to all the outputs of the given generator. If the input is an empty array, `all` returns `true`. examples: - program: all input: '[true, false]' output: ["false"] - program: all input: '[true, true]' output: ["true"] - program: all input: '[]' output: ["true"] - title: "`flatten`, `flatten(depth)`" body: | The filter `flatten` takes as input an array of nested arrays, and produces a flat array in which all arrays inside the original array have been recursively replaced by their values. You can pass an argument to it to specify how many levels of nesting to flatten. `flatten(2)` is like `flatten`, but going only up to two levels deep. examples: - program: flatten input: '[1, [2], [[3]]]' output: ["[1, 2, 3]"] - program: flatten(1) input: '[1, [2], [[3]]]' output: ["[1, 2, [3]]"] - program: flatten input: '[[]]' output: ["[]"] - program: flatten input: '[{"foo": "bar"}, [{"foo": "baz"}]]' output: ['[{"foo": "bar"}, {"foo": "baz"}]'] - title: "`range(upto)`, `range(from; upto)`, `range(from; upto; by)`" body: | The `range` function produces a range of numbers. `range(4; 10)` produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers are produced as separate outputs. Use `[range(4; 10)]` to get a range as an array. The one argument form generates numbers from 0 to the given number, with an increment of 1. The two argument form generates numbers from `from` to `upto` with an increment of 1. The three argument form generates numbers `from` to `upto` with an increment of `by`. examples: - program: 'range(2; 4)' input: 'null' output: ['2', '3'] - program: '[range(2; 4)]' input: 'null' output: ['[2,3]'] - program: '[range(4)]' input: 'null' output: ['[0,1,2,3]'] - program: '[range(0; 10; 3)]' input: 'null' output: ['[0,3,6,9]'] - program: '[range(0; 10; -1)]' input: 'null' output: ['[]'] - program: '[range(0; -5; -1)]' input: 'null' output: ['[0,-1,-2,-3,-4]'] - title: "`floor`" body: | The `floor` function returns the floor of its numeric input. examples: - program: 'floor' input: '3.14159' output: ['3'] - title: "`sqrt`" body: | The `sqrt` function returns the square root of its numeric input. examples: - program: 'sqrt' input: '9' output: ['3'] - title: "`tonumber`" body: | The `tonumber` function parses its input as a number. It will convert correctly-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input. examples: - program: '.[] | tonumber' input: '[1, "1"]' output: ['1', '1'] - title: "`tostring`" body: | The `tostring` function prints its input as a string. Strings are left unchanged, and all other values are JSON-encoded. examples: - program: '.[] | tostring' input: '[1, "1", [1]]' output: ['"1"', '"1"', '"[1]"'] - title: "`type`" body: | The `type` function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object. examples: - program: 'map(type)' input: '[0, false, [], {}, null, "hello"]' output: ['["number", "boolean", "array", "object", "null", "string"]'] - title: "`infinite`, `nan`, `isinfinite`, `isnan`, `isfinite`, `isnormal`" body: | Some arithmetic operations can yield infinities and "not a number" (NaN) values. The `isinfinite` builtin returns `true` if its input is infinite. The `isnan` builtin returns `true` if its input is a NaN. The `infinite` builtin returns a positive infinite value. The `nan` builtin returns a NaN. The `isnormal` builtin returns true if its input is a normal number. Note that division by zero raises an error. Currently most arithmetic operations operating on infinities, NaNs, and sub-normals do not raise errors. examples: - program: '.[] | (infinite * .) < 0' input: '[-1, 1]' output: ['true', 'false'] - program: 'infinite, nan | type' input: 'null' output: ['"number"', '"number"'] - title: "`sort`, `sort_by(path_expression)`" body: | The `sort` functions sorts its input, which must be an array. Values are sorted in the following order: * `null` * `false` * `true` * numbers * strings, in alphabetical order (by unicode codepoint value) * arrays, in lexical order * objects The ordering for objects is a little complex: first they're compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key. `sort_by` may be used to sort by a particular field of an object, or by applying any jq filter. `sort_by(f)` compares two elements by comparing the result of `f` on each element. When `f` produces multiple values, it firstly compares the first values, and the second values if the first values are equal, and so on. examples: - program: 'sort' input: '[8,3,null,6]' output: ['[null,3,6,8]'] - program: 'sort_by(.foo)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}]'] - program: 'sort_by(.foo, .bar)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}]'] - title: "`group_by(path_expression)`" body: | `group_by(.foo)` takes as input an array, groups the elements having the same `.foo` field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the `.foo` field. Any jq expression, not just a field access, may be used in place of `.foo`. The sorting order is the same as described in the `sort` function above. examples: - program: 'group_by(.foo)' input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]' output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]'] - title: "`min`, `max`, `min_by(path_exp)`, `max_by(path_exp)`" body: | Find the minimum or maximum element of the input array. The `min_by(path_exp)` and `max_by(path_exp)` functions allow you to specify a particular field or property to examine, e.g. `min_by(.foo)` finds the object with the smallest `foo` field. examples: - program: 'min' input: '[5,4,2,7]' output: ['2'] - program: 'max_by(.foo)' input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]' output: ['{"foo":2, "bar":3}'] - title: "`unique`, `unique_by(path_exp)`" body: | The `unique` function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed. The `unique_by(path_exp)` function will keep only one element for each value obtained by applying the argument. Think of it as making an array by taking one element out of every group produced by `group`. examples: - program: 'unique' input: '[1,2,5,3,5,3,1,3]' output: ['[1,2,3,5]'] - program: 'unique_by(.foo)' input: '[{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}]' output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]'] - program: 'unique_by(length)' input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]' output: ['["bacon", "chunky", "asparagus"]'] - title: "`reverse`" body: | This function reverses an array. examples: - program: 'reverse' input: '[1,2,3,4]' output: ['[4,3,2,1]'] - title: "`contains(element)`" body: | The filter `contains(b)` will produce true if b is completely contained within the input. A string B is contained in a string A if B is a substring of A. An array B is contained in an array A if all elements in B are contained in any element in A. An object B is contained in object A if all of the values in B are contained in the value in A with the same key. All other types are assumed to be contained in each other if they are equal. examples: - program: 'contains("bar")' input: '"foobar"' output: ['true'] - program: 'contains(["baz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['true'] - program: 'contains(["bazzzzz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['false'] - program: 'contains({foo: 12, bar: [{barp: 12}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['true'] - program: 'contains({foo: 12, bar: [{barp: 15}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['false'] - title: "`indices(s)`" body: | Outputs an array containing the indices in `.` where `s` occurs. The input may be an array, in which case if `s` is an array then the indices output will be those where all elements in `.` match those of `s`. examples: - program: 'indices(", ")' input: '"a,b, cd, efg, hijk"' output: ['[3,7,12]'] - program: 'indices(1)' input: '[0,1,2,1,3,1,4]' output: ['[1,3,5]'] - program: 'indices([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['[1,8]'] - title: "`index(s)`, `rindex(s)`" body: | Outputs the index of the first (`index`) or last (`rindex`) occurrence of `s` in the input. examples: - program: 'index(", ")' input: '"a,b, cd, efg, hijk"' output: ['3'] - program: 'index(1)' input: '[0,1,2,1,3,1,4]' output: ['1'] - program: 'index([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['1'] - program: 'rindex(", ")' input: '"a,b, cd, efg, hijk"' output: ['12'] - program: 'rindex(1)' input: '[0,1,2,1,3,1,4]' output: ['5'] - program: 'rindex([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['8'] - title: "`inside`" body: | The filter `inside(b)` will produce true if the input is completely contained within b. It is, essentially, an inversed version of `contains`. examples: - program: 'inside("foobar")' input: '"bar"' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["baz", "bar"]' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["bazzzzz", "bar"]' output: ['false'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 12}]}' output: ['true'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 15}]}' output: ['false'] - title: "`startswith(str)`" body: | Outputs `true` if . starts with the given string argument. examples: - program: '[.[]|startswith("foo")]' input: '["fo", "foo", "barfoo", "foobar", "barfoob"]' output: ['[false, true, false, true, false]'] - title: "`endswith(str)`" body: | Outputs `true` if . ends with the given string argument. examples: - program: '[.[]|endswith("foo")]' input: '["foobar", "barfoo"]' output: ['[false, true]'] - title: "`combinations`, `combinations(n)`" body: | Outputs all combinations of the elements of the arrays in the input array. If given an argument `n`, it outputs all combinations of `n` repetitions of the input array. examples: - program: 'combinations' input: '[[1,2], [3, 4]]' output: ['[1, 3]', '[1, 4]', '[2, 3]', '[2, 4]'] - program: 'combinations(2)' input: '[0, 1]' output: ['[0, 0]', '[0, 1]', '[1, 0]', '[1, 1]'] - title: "`ltrimstr(str)`" body: | Outputs its input with the given prefix string removed, if it starts with it. examples: - program: '[.[]|ltrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "afoo"]' output: ['["fo","","barfoo","bar","afoo"]'] - title: "`rtrimstr(str)`" body: | Outputs its input with the given suffix string removed, if it ends with it. examples: - program: '[.[]|rtrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "foob"]' output: ['["fo","","bar","foobar","foob"]'] - title: "`explode`" body: | Converts an input string into an array of the string's codepoint numbers. examples: - program: 'explode' input: '"foobar"' output: ['[102,111,111,98,97,114]'] - title: "`implode`" body: | The inverse of explode. examples: - program: 'implode' input: '[65, 66, 67]' output: ['"ABC"'] - title: "`split(str)`" body: | Splits an input string on the separator argument. `split` can also split on regex matches when called with two arguments (see the regular expressions section below). examples: - program: 'split(", ")' input: '"a, b,c,d, e, "' output: ['["a","b,c,d","e",""]'] - title: "`join(str)`" body: | Joins the array of elements given as input, using the argument as separator. It is the inverse of `split`: that is, running `split("foo") | join("foo")` over any input string returns said input string. Numbers and booleans in the input are converted to strings. Null values are treated as empty strings. Arrays and objects in the input are not supported. examples: - program: 'join(", ")' input: '["a","b,c,d","e"]' output: ['"a, b,c,d, e"'] - program: 'join(" ")' input: '["a",1,2.3,true,null,false]' output: ['"a 1 2.3 true false"'] - title: "`ascii_downcase`, `ascii_upcase`" body: | Emit a copy of the input string with its alphabetic characters (a-z and A-Z) converted to the specified case. examples: - program: 'ascii_upcase' input: '"useful but not for é"' output: ['"USEFUL BUT NOT FOR é"'] - title: "`while(cond; update)`" body: | The `while(cond; update)` function allows you to repeatedly apply an update to `.` until `cond` is false. Note that `while(cond; update)` is internally defined as a recursive jq function. Recursive calls within `while` will not consume additional memory if `update` produces at most one output for each input. See advanced topics below. examples: - program: '[while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: "`repeat(exp)`" body: | The `repeat(exp)` function allows you to repeatedly apply expression `exp` to `.` until an error is raised. Note that `repeat(exp)` is internally defined as a recursive jq function. Recursive calls within `repeat` will not consume additional memory if `exp` produces at most one output for each input. See advanced topics below. examples: - program: '[repeat(.*2, error)?]' input: '1' output: ['[2]'] - title: "`until(cond; next)`" body: | The `until(cond; next)` function allows you to repeatedly apply the expression `next`, initially to `.` then to its own output, until `cond` is true. For example, this can be used to implement a factorial function (see below). Note that `until(cond; next)` is internally defined as a recursive jq function. Recursive calls within `until()` will not consume additional memory if `next` produces at most one output for each input. See advanced topics below. examples: - program: '[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]' input: '4' output: ['24'] - title: "`recurse(f)`, `recurse`, `recurse(f; condition)`" body: | The `recurse(f)` function allows you to search through a recursive structure, and extract interesting data from all levels. Suppose your input represents a filesystem: {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} Now suppose you want to extract all of the filenames present. You need to retrieve `.name`, `.children[].name`, `.children[].children[].name`, and so on. You can do this with: recurse(.children[]) | .name When called without an argument, `recurse` is equivalent to `recurse(.[]?)`. `recurse(f)` is identical to `recurse(f; true)` and can be used without concerns about recursion depth. `recurse(f; condition)` is a generator which begins by emitting . and then emits in turn .|f, .|f|f, .|f|f|f, ... so long as the computed value satisfies the condition. For example, to generate all the integers, at least in principle, one could write `recurse(.+1; true)`. The recursive calls in `recurse` will not consume additional memory whenever `f` produces at most a single output for each input. examples: - program: 'recurse(.foo[])' input: '{"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}' output: - '{"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}' - '{"foo":[]}' - '{"foo":[{"foo":[]}]}' - '{"foo":[]}' - program: 'recurse' input: '{"a":0,"b":[1]}' output: - '{"a":0,"b":[1]}' - '0' - '[1]' - '1' - program: 'recurse(. * .; . < 20)' input: '2' output: ['2', '4', '16'] - title: "`walk(f)`" body: | The `walk(f)` function applies f recursively to every component of the input entity. When an array is encountered, f is first applied to its elements and then to the array itself; when an object is encountered, f is first applied to all the values and then to the object. In practice, f will usually test the type of its input, as illustrated in the following examples. The first example highlights the usefulness of processing the elements of an array of arrays before processing the array itself. The second example shows how all the keys of all the objects within the input can be considered for alteration. examples: - program: 'walk(if type == "array" then sort else . end)' input: '[[4, 1, 7], [8, 5, 2], [3, 6, 9]]' output: - '[[1,4,7],[2,5,8],[3,6,9]]' - program: 'walk( if type == "object" then with_entries( .key |= sub( "^_+"; "") ) else . end )' input: '[ { "_a": { "__b": 2 } } ]' output: - '[{"a":{"b":2}}]' - title: "`$JQ_BUILD_CONFIGURATION`" body: | This builtin binding shows the jq executable's build configuration. Its value has no particular format, but it can be expected to be at least the `./configure` command-line arguments, and may be enriched in the future to include the version strings for the build tooling used. Note that this can be overridden in the command-line with `--arg` and related options. - title: "`$ENV`, `env`" body: | `$ENV` is an object representing the environment variables as set when the jq program started. `env` outputs an object representing jq's current environment. At the moment there is no builtin for setting environment variables. examples: - program: '$ENV.PAGER' input: 'null' output: ['"less"'] - program: 'env.PAGER' input: 'null' output: ['"less"'] - title: "`transpose`" body: | Transpose a possibly jagged matrix (an array of arrays). Rows are padded with nulls so the result is always rectangular. examples: - program: 'transpose' input: '[[1], [2,3]]' output: ['[[1,2],[null,3]]'] - title: "`bsearch(x)`" body: | `bsearch(x)` conducts a binary search for x in the input array. If the input is sorted and contains x, then `bsearch(x)` will return its index in the array; otherwise, if the array is sorted, it will return (-1 - ix) where ix is an insertion point such that the array would still be sorted after the insertion of x at ix. If the array is not sorted, `bsearch(x)` will return an integer that is probably of no interest. examples: - program: 'bsearch(0)' input: '[0,1]' output: ['0'] - program: 'bsearch(0)' input: '[1,2,3]' output: ['-1'] - program: 'bsearch(4) as $ix | if $ix < 0 then .[-(1+$ix)] = 4 else . end' input: '[1,2,3]' output: ['[1,2,3,4]'] - title: "String interpolation: `\\(exp)`" body: | Inside a string, you can put an expression inside parens after a backslash. Whatever the expression returns will be interpolated into the string. examples: - program: '"The input was \(.), which is one less than \(.+1)"' input: '42' output: ['"The input was 42, which is one less than 43"'] - title: "Convert to/from JSON" body: | The `tojson` and `fromjson` builtins dump values as JSON texts or parse JSON texts into values, respectively. The `tojson` builtin differs from `tostring` in that `tostring` returns strings unmodified, while `tojson` encodes strings as JSON strings. examples: - program: '[.[]|tostring]' input: '[1, "foo", ["foo"]]' output: ['["1","foo","[\"foo\"]"]'] - program: '[.[]|tojson]' input: '[1, "foo", ["foo"]]' output: ['["1","\"foo\"","[\"foo\"]"]'] - program: '[.[]|tojson|fromjson]' input: '[1, "foo", ["foo"]]' output: ['[1,"foo",["foo"]]'] - title: "Format strings and escaping" body: | The `@foo` syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth. `@foo` can be used as a filter on its own, the possible escapings are: * `@text`: Calls `tostring`, see that function for details. * `@json`: Serializes the input as JSON. * `@html`: Applies HTML/XML escaping, by mapping the characters `<>&'"` to their entity equivalents `<`, `>`, `&`, `'`, `"`. * `@uri`: Applies percent-encoding, by mapping all reserved URI characters to a `%XX` sequence. * `@csv`: The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition. * `@tsv`: The input must be an array, and it is rendered as TSV (tab-separated values). Each input array will be printed as a single line. Fields are separated by a single tab (ascii `0x09`). Input characters line-feed (ascii `0x0a`), carriage-return (ascii `0x0d`), tab (ascii `0x09`) and backslash (ascii `0x5c`) will be output as escape sequences `\n`, `\r`, `\t`, `\\` respectively. * `@sh`: The input is escaped suitable for use in a command-line for a POSIX shell. If the input is an array, the output will be a series of space-separated strings. * `@base64`: The input is converted to base64 as specified by RFC 4648. * `@base64d`: The inverse of `@base64`, input is decoded as specified by RFC 4648. Note\: If the decoded string is not UTF-8, the results are undefined. This syntax can be combined with string interpolation in a useful way. You can follow a `@foo` token with a string literal. The contents of the string literal will *not* be escaped. However, all interpolations made inside that string literal will be escaped. For instance, @uri "https://www.google.com/search?q=\(.search)" will produce the following output for the input `{"search":"what is jq?"}`: "https://www.google.com/search?q=what%20is%20jq%3F" Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. examples: - program: '@html' input: '"This works if x < y"' output: ['"This works if x < y"'] - program: '@sh "echo \(.)"' input: "\"O'Hara's Ale\"" output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""] - program: '@base64' input: '"This is a message"' output: ['"VGhpcyBpcyBhIG1lc3NhZ2U="'] - program: '@base64d' input: '"VGhpcyBpcyBhIG1lc3NhZ2U="' output: ['"This is a message"'] - title: "Dates" body: | jq provides some basic date handling functionality, with some high-level and low-level builtins. In all cases these builtins deal exclusively with time in UTC. The `fromdateiso8601` builtin parses datetimes in the ISO 8601 format to a number of seconds since the Unix epoch (1970-01-01T00:00:00Z). The `todateiso8601` builtin does the inverse. The `fromdate` builtin parses datetime strings. Currently `fromdate` only supports ISO 8601 datetime strings, but in the future it will attempt to parse datetime strings in more formats. The `todate` builtin is an alias for `todateiso8601`. The `now` builtin outputs the current time, in seconds since the Unix epoch. Low-level jq interfaces to the C-library time functions are also provided: `strptime`, `strftime`, `strflocaltime`, `mktime`, `gmtime`, and `localtime`. Refer to your host operating system's documentation for the format strings used by `strptime` and `strftime`. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality. The `gmtime` builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of Greenwich Mean Time as an array of numbers representing (in this order): the year, the month (zero-based), the day of the month (one-based), the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year -- all one-based unless otherwise stated. The day of the week number may be wrong on some systems for dates before March 1st 1900, or after December 31 2099. The `localtime` builtin works like the `gmtime` builtin, but using the local timezone setting. The `mktime` builtin consumes "broken down time" representations of time output by `gmtime` and `strptime`. The `strptime(fmt)` builtin parses input strings matching the `fmt` argument. The output is in the "broken down time" representation consumed by `mktime` and output by `gmtime`. The `strftime(fmt)` builtin formats a time (GMT) with the given format. The `strflocaltime` does the same, but using the local timezone setting. The format strings for `strptime` and `strftime` are described in typical C library documentation. The format string for ISO 8601 datetime is `"%Y-%m-%dT%H:%M:%SZ"`. jq may not support some or all of this date functionality on some systems. In particular, the `%u` and `%j` specifiers for `strptime(fmt)` are not supported on macOS. examples: - program: 'fromdate' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")' input: '"2015-03-05T23:51:47Z"' output: ['[2015,2,5,23,51,47,4,63]'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")|mktime' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - title: "SQL-Style Operators" body: | jq provides a few SQL-style operators. * `INDEX(stream; index_expression)`: This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream. * `JOIN($idx; stream; idx_expr; join_expr)`: This builtin joins the values from the given stream to the given index. The index's keys are computed by applying the given index expression to each value from the given stream. An array of the value in the stream and the corresponding value from the index is fed to the given join expression to produce each result. * `JOIN($idx; stream; idx_expr)`: Same as `JOIN($idx; stream; idx_expr; .)`. * `JOIN($idx; idx_expr)`: This builtin joins the input `.` to the given index, applying the given index expression to `.` to compute the index key. The join operation is as described above. * `IN(s)`: This builtin outputs `true` if `.` appears in the given stream, otherwise it outputs `false`. * `IN(source; s)`: This builtin outputs `true` if any value in the source stream appears in the second stream, otherwise it outputs `false`. - title: "`builtins`" body: | Returns a list of all builtin functions in the format `name/arity`. Since functions with the same name but different arities are considered separate functions, `all/0`, `all/1`, and `all/2` would all be present in the list. - title: Conditionals and Comparisons entries: - title: "`==`, `!=`" body: | The expression 'a == b' will produce 'true' if the results of evaluating a and b are equal (that is, if they represent equivalent JSON values) and 'false' otherwise. In particular, strings are never considered equal to numbers. In checking for the equality of JSON objects, the ordering of keys is irrelevant. If you're coming from JavaScript, please note that jq's `==` is like JavaScript's `===`, the "strict equality" operator. != is "not equal", and 'a != b' returns the opposite value of 'a == b' examples: - program: '. == false' input: 'null' output: ['false'] - program: '. == {"b": {"d": (4 + 1e-20), "c": 3}, "a":1}' input: '{"a":1, "b": {"c": 3, "d": 4}}' output: ['true'] - program: '.[] == 1' input: '[1, 1.0, "1", "banana"]' output: ['true', 'true', 'false', 'false'] - title: if-then-else-end body: | `if A then B else C end` will act the same as `B` if `A` produces a value other than false or null, but act the same as `C` otherwise. `if A then B end` is the same as `if A then B else . end`. That is, the `else` branch is optional, and if absent is the same as `.`. This also applies to `elif` with absent ending `else` branch. Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you'll sometimes have to be more explicit about the condition you want. You can't test whether, e.g. a string is empty using `if .name then A else B end`; you'll need something like `if .name == "" then A else B end` instead. If the condition `A` produces multiple results, then `B` is evaluated once for each result that is not false or null, and `C` is evaluated once for each false or null. More cases can be added to an if using `elif A then B` syntax. examples: - program: |- if . == 0 then "zero" elif . == 1 then "one" else "many" end input: '2' output: ['"many"'] - title: "`>`, `>=`, `<=`, `<`" body: | The comparison operators `>`, `>=`, `<=`, `<` return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively). The ordering is the same as that described for `sort`, above. examples: - program: '. < 5' input: '2' output: ['true'] - title: "`and`, `or`, `not`" body: | jq supports the normal Boolean operators `and`, `or`, `not`. They have the same standard of truth as if expressions - `false` and `null` are considered "false values", and anything else is a "true value". If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input. `not` is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in `.foo and .bar | not`. These three only produce the values `true` and `false`, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default". If you want to use this form of "or", picking between two values rather than evaluating a condition, see the `//` operator below. examples: - program: '42 and "a string"' input: 'null' output: ['true'] - program: '(true, false) or false' input: 'null' output: ['true', 'false'] - program: '(true, true) and (true, false)' input: 'null' output: ['true', 'false', 'true', 'false'] - program: '[true, false | not]' input: 'null' output: ['[false, true]'] - title: "Alternative operator: `//`" body: | The `//` operator produces all the values of its left-hand side that are neither `false` nor `null`, or, if the left-hand side produces no values other than `false` or `null`, then `//` produces all the values of its right-hand side. A filter of the form `a // b` produces all the results of `a` that are not `false` or `null`. If `a` produces no results, or no results other than `false` or `null`, then `a // b` produces the results of `b`. This is useful for providing defaults: `.foo // 1` will evaluate to `1` if there's no `.foo` element in the input. It's similar to how `or` is sometimes used in Python (jq's `or` operator is reserved for strictly Boolean operations). Note: `some_generator // defaults_here` is not the same as `some_generator | . // defaults_here`. The latter will produce default values for all non-`false`, non-`null` values of the left-hand side, while the former will not. Precedence rules can make this confusing. For example, in `false, 1 // 2` the left-hand side of `//` is `1`, not `false, 1` -- `false, 1 // 2` parses the same way as `false, (1 // 2)`. In `(false, null, 1) | . // 42` the left-hand side of `//` is `.`, which always produces just one value, while in `(false, null, 1) // 42` the left-hand side is a generator of three values, and since it produces a value other `false` and `null`, the default `42` is not produced. examples: - program: 'empty // 42' input: 'null' output: ['42'] - program: '.foo // 42' input: '{"foo": 19}' output: ['19'] - program: '.foo // 42' input: '{}' output: ['42'] - program: '(false, null, 1) // 42' input: 'null' output: ['1'] - program: '(false, null, 1) | . // 42' input: 'null' output: ['42', '42', '1'] - title: try-catch body: | Errors can be caught by using `try EXP catch EXP`. The first expression is executed, and if it fails then the second is executed with the error message. The output of the handler, if any, is output as if it had been the output of the expression to try. The `try EXP` form uses `empty` as the exception handler. examples: - program: 'try .a catch ". is not an object"' input: 'true' output: ['". is not an object"'] - program: '[.[]|try .a]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: 'try error("some exception") catch .' input: 'true' output: ['"some exception"'] - title: Breaking out of control structures body: | A convenient use of try/catch is to break out of control structures like `reduce`, `foreach`, `while`, and so on. For example: # Repeat an expression until it raises "break" as an # error, then stop repeating without re-raising the error. # But if the error caught is not "break" then re-raise it. try repeat(exp) catch if .=="break" then empty else error jq has a syntax for named lexical labels to "break" or "go (back) to": label $out | ... break $out ... The `break $label_name` expression will cause the program to act as though the nearest (to the left) `label $label_name` produced `empty`. The relationship between the `break` and corresponding `label` is lexical: the label has to be "visible" from the break. To break out of a `reduce`, for example: label $out | reduce .[] as $item (null; if .==false then break $out else ... end) The following jq program produces a syntax error: break $out because no label `$out` is visible. - title: "Error Suppression / Optional Operator: `?`" body: | The `?` operator, used as `EXP?`, is shorthand for `try EXP`. examples: - program: '[.[] | .a?]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: '[.[] | tonumber?]' input: '["1", "invalid", "3", 4]' output: ['[1, 3, 4]'] - title: Regular expressions body: | jq uses the [Oniguruma regular expression library](https://github.com/kkos/oniguruma/blob/master/doc/RE), as do PHP, TextMate, Sublime Text, etc, so the description here will focus on jq specifics. Oniguruma supports several flavors of regular expression, so it is important to know that jq uses the ["Perl NG" (Perl with named groups)](https://github.com/kkos/oniguruma/blob/master/doc/SYNTAX.md) flavor. The jq regex filters are defined so that they can be used using one of these patterns: STRING | FILTER(REGEX) STRING | FILTER(REGEX; FLAGS) STRING | FILTER([REGEX]) STRING | FILTER([REGEX, FLAGS]) where: * STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation; * REGEX, after string interpolation, should be a valid regular expression; * FILTER is one of `test`, `match`, or `capture`, as described below. Since REGEX must evaluate to a JSON string, some characters that are needed to form a regular expression must be escaped. For example, the regular expression `\s` signifying a whitespace character would be written as `"\\s"`. FLAGS is a string consisting of one of more of the supported flags: * `g` - Global search (find all matches, not just the first) * `i` - Case insensitive search * `m` - Multi line mode (`.` will match newlines) * `n` - Ignore empty matches * `p` - Both s and m modes are enabled * `s` - Single line mode (`^` -> `\A`, `$` -> `\Z`) * `l` - Find longest possible matches * `x` - Extended regex format (ignore whitespace and comments) To match a whitespace with the `x` flag, use `\s`, e.g. jq -n '"a b" | test("a\\sb"; "x")' Note that certain flags may also be specified within REGEX, e.g. jq -n '("test", "TEst", "teST", "TEST") | test("(?i)te(?-i)st")' evaluates to: `true`, `true`, `false`, `false`. entries: - title: "`test(val)`, `test(regex; flags)`" body: | Like `match`, but does not return match objects, only `true` or `false` for whether or not the regex matches the input. examples: - program: 'test("foo")' input: '"foo"' output: ['true'] - program: '.[] | test("a b c # spaces are ignored"; "ix")' input: '["xabcd", "ABC"]' output: ['true', 'true'] - title: "`match(val)`, `match(regex; flags)`" body: | **match** outputs an object for each match it finds. Matches have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of the match * `string` - the string that it matched * `captures` - an array of objects representing capturing groups. Capturing group objects have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of this capturing group * `string` - the string that was captured * `name` - the name of the capturing group (or `null` if it was unnamed) Capturing groups that did not match anything return an offset of -1 examples: - program: 'match("(abc)+"; "g")' input: '"abc abc"' output: - '{"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]}' - '{"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]}' - program: 'match("foo")' input: '"foo bar foo"' output: ['{"offset": 0, "length": 3, "string": "foo", "captures": []}'] - program: 'match(["foo", "ig"])' input: '"foo bar FOO"' output: - '{"offset": 0, "length": 3, "string": "foo", "captures": []}' - '{"offset": 8, "length": 3, "string": "FOO", "captures": []}' - program: 'match("foo (?bar)? foo"; "ig")' input: '"foo bar foo foo foo"' output: - '{"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]}' - '{"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}' - program: '[ match("."; "g")] | length' input: '"abc"' output: ['3'] - title: "`capture(val)`, `capture(regex; flags)`" body: | Collects the named captures in a JSON object, with the name of each capture as the key, and the matched string as the corresponding value. examples: - program: 'capture("(?[a-z]+)-(?[0-9]+)")' input: '"xyzzy-14"' output: ['{ "a": "xyzzy", "n": "14" }'] - title: "`scan(regex)`, `scan(regex; flags)`" body: | Emit a stream of the non-overlapping substrings of the input that match the regex in accordance with the flags, if any have been specified. If there is no match, the stream is empty. To capture all the matches for each input string, use the idiom `[ expr ]`, e.g. `[ scan(regex) ]`. If the regex contains capturing groups, the filter emits a stream of arrays, each of which contains the captured strings. examples: - program: 'scan("c")' input: '"abcdefabc"' output: ['"c"', '"c"'] - program: 'scan("(a+)(b+)")' input: '"abaabbaaabbb"' output: ['["a","b"]', '["aa","bb"]', '["aaa","bbb"]'] - title: "`split(regex; flags)`" body: | Splits an input string on each regex match. For backwards compatibility, when called with a single argument, `split` splits on a string, not a regex. examples: - program: 'split(", *"; null)' input: '"ab,cd, ef"' output: ['["ab","cd","ef"]'] - title: "`splits(regex)`, `splits(regex; flags)`" body: | These provide the same results as their `split` counterparts, but as a stream instead of an array. examples: - program: 'splits(", *")' input: '"ab,cd, ef, gh"' output: ['"ab"','"cd"','"ef"','"gh"'] - title: "`sub(regex; tostring)`, `sub(regex; tostring; flags)`" body: | Emit the string obtained by replacing the first match of regex in the input string with `tostring`, after interpolation. `tostring` should be a jq string or a stream of such strings, each of which may contain references to named captures. The named captures are, in effect, presented as a JSON object (as constructed by `capture`) to `tostring`, so a reference to a captured variable named "x" would take the form: `"\(.x)"`. examples: - program: 'sub("[^a-z]*(?[a-z]+)"; "Z\(.x)"; "g")' input: '"123abc456def"' output: ['"ZabcZdef"'] - program: '[sub("(?.)"; "\(.a|ascii_upcase)", "\(.a|ascii_downcase)")]' input: '"aB"' output: ['["AB","aB"]'] - title: "`gsub(regex; tostring)`, `gsub(regex; tostring; flags)`" body: | `gsub` is like `sub` but all the non-overlapping occurrences of the regex are replaced by `tostring`, after interpolation. If the second argument is a stream of jq strings, then `gsub` will produce a corresponding stream of JSON strings. examples: - program: 'gsub("(?.)[^a]*"; "+\(.x)-")' input: '"Abcabc"' output: ['"+A-+a-"'] - program: '[gsub("p"; "a", "b")]' input: '"p"' output: ['["a","b"]'] - title: Advanced features body: | Variables are an absolute necessity in most programming languages, but they're relegated to an "advanced feature" in jq. In most languages, variables are the only means of passing around data. If you calculate a value, and you want to use it more than once, you'll need to store it in a variable. To pass a value to another part of the program, you'll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data. It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq's standard library (many jq functions such as `map` and `select` are in fact written in jq). jq has reduction operators, which are very powerful but a bit tricky. Again, these are mostly used internally, to define some useful bits of jq's standard library. It may not be obvious at first, but jq is all about generators (yes, as often found in other languages). Some utilities are provided to help deal with generators. Some minimal I/O support (besides reading JSON from standard input, and writing JSON to standard output) is available. Finally, there is a module/library system. entries: - title: "Variable / Symbolic Binding Operator: `... as $identifier | ...`" body: | In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next. Many expressions, for instance `a + b`, pass their input to two distinct subexpressions (here `a` and `b` are both passed the same input), so variables aren't usually necessary in order to use a value twice. For instance, calculating the average value of an array of numbers requires a few variables in most languages - at least one to hold the array, perhaps one for each element or for a loop counter. In jq, it's simply `add / length` - the `add` expression is given the array and produces its sum, and the `length` expression is given the array and produces its length. So, there's generally a cleaner way to solve most problems in jq than defining variables. Still, sometimes they do make things easier, so jq lets you define variables using `expression as $variable`. All variable names start with `$`. Here's a slightly uglier version of the array-averaging example: length as $array_length | add / $array_length We'll need a more complicated problem to find a situation where using variables actually makes our lives easier. Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names. Our input looks like: {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} We want to produce the posts with the author field containing a real name, as in: {"title": "First post", "author": "Anonymous Coward"} {"title": "A well-written article", "author": "Person McPherson"} We use a variable, `$names`, to store the realnames object, so that we can refer to it later when looking up author usernames: .realnames as $names | .posts[] | {title, author: $names[.author]} The expression `exp as $x | ...` means: for each value of expression `exp`, run the rest of the pipeline with the entire original input, and with `$x` set to that value. Thus `as` functions as something of a foreach loop. Just as `{foo}` is a handy way of writing `{foo: .foo}`, so `{$foo}` is a handy way of writing `{foo: $foo}`. Multiple variables may be declared using a single `as` expression by providing a pattern that matches the structure of the input (this is known as "destructuring"): . as {realnames: $names, posts: [$first, $second]} | ... The variable declarations in array patterns (e.g., `. as [$first, $second]`) bind to the elements of the array in from the element at index zero on up, in order. When there is no value at the index for an array pattern element, `null` is bound to that variable. Variables are scoped over the rest of the expression that defines them, so .realnames as $names | (.posts[] | {title, author: $names[.author]}) will work, but (.realnames as $names | .posts[]) | {title, author: $names[.author]} won't. For programming language theorists, it's more accurate to say that jq variables are lexically-scoped bindings. In particular there's no way to change the value of a binding; one can only setup a new binding with the same name, but which will not be visible where the old one was. examples: - program: '.bar as $x | .foo | . + $x' input: '{"foo":10, "bar":200}' output: ['210'] - program: '. as $i|[(.*2|. as $i| $i), $i]' input: '5' output: ['[10,5]'] - program: '. as [$a, $b, {c: $c}] | $a + $b + $c' input: '[2, 3, {"c": 4, "d": 5}]' output: ['9'] - program: '.[] as [$a, $b] | {a: $a, b: $b}' input: '[[0], [0, 1], [2, 1, 0]]' output: ['{"a":0,"b":null}', '{"a":0,"b":1}', '{"a":2,"b":1}'] - title: 'Destructuring Alternative Operator: `?//`' body: | The destructuring alternative operator provides a concise mechanism for destructuring an input that can take one of several forms. Suppose we have an API that returns a list of resources and events associated with them, and we want to get the user_id and timestamp of the first event for each resource. The API (having been clumsily converted from XML) will only wrap the events in an array if the resource has multiple events: {"resources": [{"id": 1, "kind": "widget", "events": {"action": "create", "user_id": 1, "ts": 13}}, {"id": 2, "kind": "widget", "events": [{"action": "create", "user_id": 1, "ts": 14}, {"action": "destroy", "user_id": 1, "ts": 15}]}]} We can use the destructuring alternative operator to handle this structural change simply: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$user_id, $ts}]} | {$user_id, $kind, $id, $ts} Or, if we aren't sure if the input is an array of values or an object: .[] as [$id, $kind, $user_id, $ts] ?// {$id, $kind, $user_id, $ts} | ... Each alternative need not define all of the same variables, but all named variables will be available to the subsequent expression. Variables not matched in the alternative that succeeded will be `null`: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$first_user_id, $first_ts}]} | {$user_id, $first_user_id, $kind, $id, $ts, $first_ts} Additionally, if the subsequent expression returns an error, the alternative operator will attempt to try the next binding. Errors that occur during the final alternative are passed through. [[3]] | .[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end examples: - program: '.[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":4}', '{"a":1,"b":2,"d":3,"e":4}'] - program: '.[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":null}', '{"a":1,"b":2,"d":null,"e":4}'] - program: '.[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end' input: '[[3]]' output: ['{"a":null,"b":3}'] - title: 'Defining Functions' body: | You can give a filter a name using "def" syntax: def increment: . + 1; From then on, `increment` is usable as a filter just like a builtin function (in fact, this is how many of the builtins are defined). A function may take arguments: def map(f): [.[] | f]; Arguments are passed as _filters_ (functions with no arguments), _not_ as values. The same argument may be referenced multiple times with different inputs (here `f` is run for each element of the input array). Arguments to a function work more like callbacks than like value arguments. This is important to understand. Consider: def foo(f): f|f; 5|foo(.*2) The result will be 20 because `f` is `.*2`, and during the first invocation of `f` `.` will be 5, and the second time it will be 10 (5 * 2), so the result will be 20. Function arguments are filters, and filters expect an input when invoked. If you want the value-argument behaviour for defining simple functions, you can just use a variable: def addvalue(f): f as $f | map(. + $f); Or use the short-hand: def addvalue($f): ...; With either definition, `addvalue(.foo)` will add the current input's `.foo` field to each element of the array. Do note that calling `addvalue(.[])` will cause the `map(. + $f)` part to be evaluated once per value in the value of `.` at the call site. Multiple definitions using the same function name are allowed. Each re-definition replaces the previous one for the same number of function arguments, but only for references from functions (or main program) subsequent to the re-definition. See also the section below on scoping. examples: - program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))' input: '[[1,2],[10,20]]' output: ['[[1,2,1], [10,20,10]]'] - program: 'def addvalue(f): f as $x | map(. + $x); addvalue(.[0])' input: '[[1,2],[10,20]]' output: ['[[1,2,1,2], [10,20,1,2]]'] - title: 'Scoping' body: | There are two types of symbols in jq: value bindings (a.k.a., "variables"), and functions. Both are scoped lexically, with expressions being able to refer only to symbols that have been defined "to the left" of them. The only exception to this rule is that functions can refer to themselves so as to be able to create recursive functions. For example, in the following expression there is a binding which is visible "to the right" of it, `... | .*3 as $times_three | [. + $times_three] | ...`, but not "to the left". Consider this expression now, `... | (.*3 as $times_three | [. + $times_three]) | ...`: here the binding `$times_three` is _not_ visible past the closing parenthesis. - title: "`isempty(exp)`" body: | Returns true if `exp` produces no outputs, false otherwise. examples: - program: 'isempty(empty)' input: 'null' output: ['true'] - program: 'isempty(.[])' input: '[]' output: ['true'] - program: 'isempty(.[])' input: '[1,2,3]' output: ['false'] - title: "`limit(n; exp)`" body: | The `limit` function extracts up to `n` outputs from `exp`. examples: - program: '[limit(3;.[])]' input: '[0,1,2,3,4,5,6,7,8,9]' output: ['[0,1,2]'] - title: "`first(expr)`, `last(expr)`, `nth(n; expr)`" body: | The `first(expr)` and `last(expr)` functions extract the first and last values from `expr`, respectively. The `nth(n; expr)` function extracts the nth value output by `expr`. Note that `nth(n; expr)` doesn't support negative values of `n`. examples: - program: '[first(range(.)), last(range(.)), nth(./2; range(.))]' input: '10' output: ['[0,9,5]'] - title: "`first`, `last`, `nth(n)`" body: | The `first` and `last` functions extract the first and last values from any array at `.`. The `nth(n)` function extracts the nth value of any array at `.`. examples: - program: '[range(.)]|[first, last, nth(5)]' input: '10' output: ['[0,9,5]'] - title: "`reduce`" body: | The `reduce` syntax allows you to combine all of the results of an expression by accumulating them into a single answer. The form is `reduce EXP as $var (INIT; UPDATE)`. As an example, we'll pass `[1,2,3]` to this expression: reduce .[] as $item (0; . + $item) For each result that `.[]` produces, `. + $item` is run to accumulate a running total, starting from 0 as the input value. In this example, `.[]` produces the results `1`, `2`, and `3`, so the effect is similar to running something like this: 0 | 1 as $item | . + $item | 2 as $item | . + $item | 3 as $item | . + $item examples: - program: 'reduce .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['15'] - program: 'reduce .[] as [$i,$j] (0; . + $i * $j)' input: '[[1,2],[3,4],[5,6]]' output: ['44'] - program: 'reduce .[] as {$x,$y} (null; .x += $x | .y += [$y])' input: '[{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}]' output: ['{"x":"abc","y":[1,2,3]}'] - title: "`foreach`" body: | The `foreach` syntax is similar to `reduce`, but intended to allow the construction of `limit` and reducers that produce intermediate results. The form is `foreach EXP as $var (INIT; UPDATE; EXTRACT)`. As an example, we'll pass `[1,2,3]` to this expression: foreach .[] as $item (0; . + $item; [$item, . * 2]) Like the `reduce` syntax, `. + $item` is run for each result that `.[]` produces, but `[$item, . * 2]` is run for each intermediate values. In this example, since the intermediate values are `1`, `3`, and `6`, the `foreach` expression produces `[1,2]`, `[2,6]`, and `[3,12]`. So the effect is similar to running something like this: 0 | 1 as $item | . + $item | [$item, . * 2], 2 as $item | . + $item | [$item, . * 2], 3 as $item | . + $item | [$item, . * 2] When `EXTRACT` is omitted, the identity filter is used. That is, it outputs the intermediate values as they are. examples: - program: 'foreach .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['1','3','6','10','15'] - program: 'foreach .[] as $item (0; . + $item; [$item, . * 2])' input: '[1,2,3,4,5]' output: ['[1,2]','[2,6]','[3,12]','[4,20]','[5,30]'] - program: 'foreach .[] as $item (0; . + 1; {index: ., $item})' input: '["foo", "bar", "baz"]' output: - '{"index":1,"item":"foo"}' - '{"index":2,"item":"bar"}' - '{"index":3,"item":"baz"}' - title: Recursion body: | As described above, `recurse` uses recursion, and any jq function can be recursive. The `while` builtin is also implemented in terms of recursion. Tail calls are optimized whenever the expression to the left of the recursive call outputs its last value. In practice this means that the expression to the left of the recursive call should not produce more than one output for each input. For example: def recurse(f): def r: ., (f | select(. != null) | r); r; def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; def repeat(exp): def _repeat: exp, _repeat; _repeat; - title: Generators and iterators body: | Some jq operators and functions are actually generators in that they can produce zero, one, or more values for each input, just as one might expect in other programming languages that have generators. For example, `.[]` generates all the values in its input (which must be an array or an object), `range(0; 10)` generates the integers between 0 and 10, and so on. Even the comma operator is a generator, generating first the values generated by the expression to the left of the comma, then the values generated by the expression on the right of the comma. The `empty` builtin is the generator that produces zero outputs. The `empty` builtin backtracks to the preceding generator expression. All jq functions can be generators just by using builtin generators. It is also possible to construct new generators using only recursion and the comma operator. If recursive calls are "in tail position" then the generator will be efficient. In the example below the recursive call by `_range` to itself is in tail position. The example shows off three advanced topics: tail recursion, generator construction, and sub-functions. examples: - program: 'def range(init; upto; by): def _range: if (by > 0 and . < upto) or (by < 0 and . > upto) then ., ((.+by)|_range) else empty end; if init == upto then empty elif by == 0 then init else init|_range end; range(0; 10; 3)' input: 'null' output: ['0', '3', '6', '9'] - program: 'def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; [while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: 'Math' body: | jq currently only has IEEE754 double-precision (64-bit) floating point number support. Besides simple arithmetic operators such as `+`, jq also has most standard math functions from the C math library. C math functions that take a single input argument (e.g., `sin()`) are available as zero-argument jq functions. C math functions that take two input arguments (e.g., `pow()`) are available as two-argument jq functions that ignore `.`. C math functions that take three input arguments are available as three-argument jq functions that ignore `.`. Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library. Unavailable math functions will be defined but will raise an error. One-input C math functions: `acos` `acosh` `asin` `asinh` `atan` `atanh` `cbrt` `ceil` `cos` `cosh` `erf` `erfc` `exp` `exp10` `exp2` `expm1` `fabs` `floor` `gamma` `j0` `j1` `lgamma` `log` `log10` `log1p` `log2` `logb` `nearbyint` `pow10` `rint` `round` `significand` `sin` `sinh` `sqrt` `tan` `tanh` `tgamma` `trunc` `y0` `y1`. Two-input C math functions: `atan2` `copysign` `drem` `fdim` `fmax` `fmin` `fmod` `frexp` `hypot` `jn` `ldexp` `modf` `nextafter` `nexttoward` `pow` `remainder` `scalb` `scalbln` `yn`. Three-input C math functions: `fma`. See your system's manual for more information on each of these. - title: 'I/O' body: | At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read. Two builtins functions are provided for this, `input` and `inputs`, that read from the same sources (e.g., `stdin`, files named on the command-line) as jq itself. These two builtins, and jq's own reading actions, can be interleaved with each other. They are commonly used in combination with the null input option `-n` to prevent one input from being read implicitly. Two builtins provide minimal output capabilities, `debug`, and `stderr`. (Recall that a jq program's output values are always output as JSON texts on `stdout`.) The `debug` builtin can have application-specific behavior, such as for executables that use the libjq C API but aren't the jq executable itself. The `stderr` builtin outputs its input in raw mode to stderr with no additional decoration, not even a newline. Most jq builtins are referentially transparent, and yield constant and repeatable value streams when applied to constant inputs. This is not true of I/O builtins. entries: - title: "`input`" body: | Outputs one new input. Note that when using `input` it is generally necessary to invoke jq with the `-n` command-line option, otherwise the first entity will be lost. echo 1 2 3 4 | jq '[., input]' # [1,2] [3,4] - title: "`inputs`" body: | Outputs all remaining inputs, one by one. This is primarily useful for reductions over a program's inputs. Note that when using `inputs` it is generally necessary to invoke jq with the `-n` command-line option, otherwise the first entity will be lost. echo 1 2 3 | jq -n 'reduce inputs as $i (0; . + $i)' # 6 - title: "`debug`, `debug(msgs)`" body: | These two filters are like `.` but have as a side-effect the production of one or more messages on stderr. The message produced by the `debug` filter has the form ["DEBUG:",] where `` is a compact rendition of the input value. This format may change in the future. The `debug(msgs)` filter is defined as `(msgs | debug | empty), .` thus allowing great flexibility in the content of the message, while also allowing multi-line debugging statements to be created. For example, the expression: 1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1) would produce the value 3 but with the following two lines being written to stderr: ["DEBUG:","Entering function foo with $x == 1"] ["DEBUG:",2] - title: "`stderr`" body: | Prints its input in raw and compact mode to stderr with no additional decoration, not even a newline. - title: "`input_filename`" body: | Returns the name of the file whose input is currently being filtered. Note that this will not work well unless jq is running in a UTF-8 locale. - title: "`input_line_number`" body: | Returns the line number of the input currently being filtered. - title: 'Streaming' body: | With the `--stream` option jq can parse input texts in a streaming fashion, allowing jq programs to start processing large JSON texts immediately rather than after the parse completes. If you have a single JSON text that is 1GB in size, streaming it will allow you to process it much more quickly. However, streaming isn't easy to deal with as the jq program will have `[, ]` (and a few other forms) as inputs. Several builtins are provided to make handling streams easier. The examples below use the streamed form of `["a",["b"]]`, which is `[[0],"a"],[[1,0],"b"],[[1,0]],[[1]]`. Streaming forms include `[, ]` (to indicate any scalar value, empty array, or empty object), and `[]` (to indicate the end of an array or object). Future versions of jq run with `--stream` and `--seq` may output additional forms such as `["error message"]` when an input text fails to parse. entries: - title: "`truncate_stream(stream_expression)`" body: | Consumes a number as input and truncates the corresponding number of path elements from the left of the outputs of the given streaming expression. examples: - program: 'truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]])' input: '1' output: ['[[0],"b"]', '[[0]]'] - title: "`fromstream(stream_expression)`" body: | Outputs values corresponding to the stream expression's outputs. examples: - program: 'fromstream(1|truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]]))' input: 'null' output: ['["b"]'] - title: "`tostream`" body: | The `tostream` builtin outputs the streamed form of its input. examples: - program: '. as $dot|fromstream($dot|tostream)|.==$dot' input: '[0,[1,{"a":1},{"b":2}]]' output: ['true'] - title: Assignment body: | Assignment works a little differently in jq than in most programming languages. jq doesn't distinguish between references to and copies of something - two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object". If an object has two fields which are arrays, `.foo` and `.bar`, and you append something to `.foo`, then `.bar` will not get bigger, even if you've previously set `.bar = .foo`. If you're used to programming in languages like Python, Java, Ruby, JavaScript, etc. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance it doesn't actually do that, but that's the general idea). This means that it's impossible to build circular values in jq (such as an array whose first element is itself). This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON. All the assignment operators in jq have path expressions on the left-hand side (LHS). The right-hand side (RHS) provides values to set to the paths named by the LHS path expressions. Values in jq are always immutable. Internally, assignment works by using a reduction to compute new, replacement values for `.` that have had all the desired assignments applied to `.`, then outputting the modified value. This might be made clear by this example: `{a:{b:{c:1}}} | (.a.b|=3), .`. This will output `{"a":{"b":3}}` and `{"a":{"b":{"c":1}}}` because the last sub-expression, `.`, sees the original value, not the modified value. Most users will want to use modification assignment operators, such as `|=` or `+=`, rather than `=`. Note that the LHS of assignment operators refers to a value in `.`. Thus `$var.foo = 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo = 1` instead. Note too that `.a,.b=0` does not set `.a` and `.b`, but `(.a,.b)=0` sets both. entries: - title: "Update-assignment: `|=`" body: | This is the "update" operator `|=`. It takes a filter on the right-hand side and works out the new value for the property of `.` being assigned to by running the old value through this expression. For instance, `(.foo, .bar) |= .+1` will build an object with the `foo` field set to the input's `foo` plus 1, and the `bar` field set to the input's `bar` plus 1. The left-hand side can be any general path expression; see `path()`. Note that the left-hand side of `|=` refers to a value in `.`. Thus `$var.foo |= . + 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo |= . + 1` instead. If the right-hand side outputs no values (i.e., `empty`), then the left-hand side path will be deleted, as with `del(path)`. If the right-hand side outputs multiple values, only the first one will be used (COMPATIBILITY NOTE: in jq 1.5 and earlier releases, it used to be that only the last one was used). examples: - program: '(..|select(type=="boolean")) |= if . then 1 else 0 end' input: '[true,false,[5,true,[true,[false]],false]]' output: ['[1,0,[5,1,[1,[0]],0]]'] - title: "Arithmetic update-assignment: `+=`, `-=`, `*=`, `/=`, `%=`, `//=`" body: | jq has a few operators of the form `a op= b`, which are all equivalent to `a |= . op b`. So, `+= 1` can be used to increment values, being the same as `|= . + 1`. examples: - program: .foo += 1 input: '{"foo": 42}' output: ['{"foo": 43}'] - title: "Plain assignment: `=`" body: | This is the plain assignment operator. Unlike the others, the input to the right-hand side (RHS) is the same as the input to the left-hand side (LHS) rather than the value at the LHS path, and all values output by the RHS will be used (as shown below). If the RHS of `=` produces multiple values, then for each such value jq will set the paths on the left-hand side to the value and then it will output the modified `.`. For example, `(.a,.b) = range(2)` outputs `{"a":0,"b":0}`, then `{"a":1,"b":1}`. The "update" assignment forms (see above) do not do this. This example should show the difference between `=` and `|=`: Provide input `{"a": {"b": 10}, "b": 20}` to the programs .a = .b and .a |= .b The former will set the `a` field of the input to the `b` field of the input, and produce the output `{"a": 20, "b": 20}`. The latter will set the `a` field of the input to the `a` field's `b` field, producing `{"a": 10, "b": 20}`. examples: - program: .a = .b input: '{"a": {"b": 10}, "b": 20}' output: ['{"a":20,"b":20}'] - program: .a |= .b input: '{"a": {"b": 10}, "b": 20}' output: ['{"a":10,"b":20}'] - program: (.a, .b) = range(3) input: 'null' output: - '{"a":0,"b":0}' - '{"a":1,"b":1}' - '{"a":2,"b":2}' - program: (.a, .b) |= range(3) input: 'null' output: ['{"a":0,"b":0}'] - title: Complex assignments body: | Lots more things are allowed on the left-hand side of a jq assignment than in most languages. We've already seen simple field accesses on the left hand side, and it's no surprise that array accesses work just as well: .posts[0].title = "JQ Manual" What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: .posts[].comments |= . + ["this is great"] That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts). When jq encounters an assignment like 'a = b', it records the "path" taken to select a part of the input document while executing a. This path is then used to find which part of the input to change while executing the assignment. Any filter may be used on the left-hand side of an equals - whichever paths it selects from the input will be where the assignment is performed. This is a very powerful operation. Suppose we wanted to add a comment to blog posts, using the same "blog" input above. This time, we only want to comment on the posts written by "stedolan". We can find those posts using the "select" function described earlier: .posts[] | select(.author == "stedolan") The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] - title: Modules body: | jq has a library/module system. Modules are files whose names end in `.jq`. Modules imported by a program are searched for in a default search path (see below). The `import` and `include` directives allow the importer to alter this path. Paths in the search path are subject to various substitutions. For paths starting with `~/`, the user's home directory is substituted for `~`. For paths starting with `$ORIGIN/`, the directory where the jq executable is located is substituted for `$ORIGIN`. For paths starting with `./` or paths that are `.`, the path of the including file is substituted for `.`. For top-level programs given on the command-line, the current directory is used. Import directives can optionally specify a search path to which the default is appended. The default search path is the search path given to the `-L` command-line option, else `["~/.jq", "$ORIGIN/../lib/jq", "$ORIGIN/../lib"]`. Null and empty string path elements terminate search path processing. A dependency with relative path `foo/bar` would be searched for in `foo/bar.jq` and `foo/bar/bar.jq` in the given search path. This is intended to allow modules to be placed in a directory along with, for example, version control files, README files, and so on, but also to allow for single-file modules. Consecutive components with the same name are not allowed to avoid ambiguities (e.g., `foo/foo`). For example, with `-L$HOME/.jq` a module `foo` can be found in `$HOME/.jq/foo.jq` and `$HOME/.jq/foo/foo.jq`. If `$HOME/.jq` is a file, it is sourced into the main program. entries: - title: "`import RelativePathString as NAME [];`" body: | Imports a module found at the given path relative to a directory in a search path. A `.jq` suffix will be added to the relative path string. The module's symbols are prefixed with `NAME::`. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The `search` key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`include RelativePathString [];`" body: | Imports a module found at the given path relative to a directory in a search path as if it were included in place. A `.jq` suffix will be added to the relative path string. The module's symbols are imported into the caller's namespace as if the module's content had been included directly. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. - title: "`import RelativePathString as $NAME [];`" body: | Imports a JSON file found at the given path relative to a directory in a search path. A `.json` suffix will be added to the relative path string. The file's data will be available as `$NAME::NAME`. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The `search` key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`module ;`" body: | This directive is entirely optional. It's not required for proper operation. It serves only the purpose of providing metadata that can be read with the `modulemeta` builtin. The metadata must be a constant jq expression. It should be an object with keys like `homepage`. At this time jq doesn't use this metadata, but it is made available to users via the `modulemeta` builtin. - title: "`modulemeta`" body: | Takes a module name as input and outputs the module's metadata as an object, with the module's imports (including metadata) as an array value for the `deps` key and the module's defined functions as an array value for the `defs` key. Programs can use this to query a module's metadata, which they could then use to, for example, search for, download, and install missing dependencies. - title: Colors body: | To configure alternative colors just set the `JQ_COLORS` environment variable to colon-delimited list of partial terminal escape sequences like `"1;31"`, in this order: - color for `null` - color for `false` - color for `true` - color for numbers - color for strings - color for arrays - color for objects - color for object keys The default color scheme is the same as setting `JQ_COLORS="0;90:0;37:0;37:0;37:0;32:1;37:1;37:1;34"`. This is not a manual for VT100/ANSI escapes. However, each of these color specifications should consist of two numbers separated by a semi-colon, where the first number is one of these: - 1 (bright) - 2 (dim) - 4 (underscore) - 5 (blink) - 7 (reverse) - 8 (hidden) and the second is one of these: - 30 (black) - 31 (red) - 32 (green) - 33 (yellow) - 34 (blue) - 35 (magenta) - 36 (cyan) - 37 (white) jq-1.8.2/docs/content/manual/manual.yml0000644000175100017510000043751715215513536013525 --- headline: jq 1.8 Manual body: | A jq program is a "filter": it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks. Filters can be combined in various ways - you can pipe the output of one filter into another filter, or collect the output of a filter into an array. Some filters produce multiple results, for instance there's one that produces all the elements of its input array. Piping that filter into a second runs the second filter for each element of the array. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq. It's important to remember that every filter has an input and an output. Even literals like "hello" or 42 are filters - they take an input but always produce the same literal as output. Operations that combine two filters, like addition, generally feed the same input to both and combine the results. So, you can implement an averaging filter as `add / length` - feeding the input array both to the `add` filter and the `length` filter and then performing the division. But that's getting ahead of ourselves. :) Let's start with something simpler: manpage_intro: | jq(1) -- Command-line JSON processor ==================================== ## SYNOPSIS `jq` [...] [...] `jq` can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents. For instance, running the command `jq 'map(.price) | add'` will take an array of JSON objects as input and return the sum of their "price" fields. `jq` can accept text input as well, but by default, `jq` reads a stream of JSON entities (including numbers and other literals) from `stdin`. Whitespace is only needed to separate entities such as 1 and 2, and true and false. One or more may be specified, in which case `jq` will read input from those instead. The are described in the [INVOKING JQ] section; they mostly concern input and output formatting. The is written in the jq language and specifies how to transform the input file or document. ## FILTERS manpage_epilogue: | ## BUGS Presumably. Report them or discuss them at: https://github.com/jqlang/jq/issues ## AUTHOR Stephen Dolan `` sections: - title: Invoking jq body: | jq filters run on a stream of JSON data. The input to jq is parsed as a sequence of whitespace-separated JSON values which are passed through the provided filter one at a time. The output(s) of the filter are written to standard output, as a sequence of newline-separated JSON data. The simplest and most common filter (or jq program) is `.`, which is the identity operator, copying the inputs of the jq processor to the output stream. Because the default behavior of the jq processor is to read JSON texts from the input stream, and to pretty-print outputs, the `.` program's main use is to validate and pretty-print the inputs. The jq programming language is quite rich and allows for much more than just validation and pretty-printing. Note: it is important to mind the shell's quoting rules. As a general rule it's best to always quote (with single-quote characters on Unix shells) the jq program, as too many characters with special meaning to jq are also shell meta-characters. For example, `jq "foo"` will fail on most Unix shells because that will be the same as `jq foo`, which will generally fail because `foo is not defined`. When using the Windows command shell (cmd.exe) it's best to use double quotes around your jq program when given on the command-line (instead of the `-f program-file` option), but then double-quotes in the jq program need backslash escaping. When using the Powershell (`powershell.exe`) or the Powershell Core (`pwsh`/`pwsh.exe`), use single-quote characters around the jq program and backslash-escaped double-quotes (`\"`) inside the jq program. * Unix shells: `jq '.["foo"]'` * Powershell: `jq '.[\"foo\"]'` * Windows command shell: `jq ".[\"foo\"]"` Note: jq allows user-defined functions, but every jq program must have a top-level expression. You can affect how jq reads and writes its input and output using some command-line options: * `--null-input` / `-n`: Don't read any input at all. Instead, the filter is run once using `null` as the input. This is useful when using jq as a simple calculator or to construct JSON data from scratch. * `--raw-input` / `-R`: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with `--slurp`, then the entire input is passed to the filter as a single long string. * `--slurp` / `-s`: Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. * `--compact-output` / `-c`: By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. * `--raw-output` / `-r`: With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. * `--raw-output0`: Like `-r` but jq will print NUL instead of newline after each output. This can be useful when the values being output can contain newlines. When the output value contains NUL, jq exits with non-zero code. * `--join-output` / `-j`: Like `-r` but jq won't print a newline after each output. * `--ascii-output` / `-a`: jq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences (like "\u03bc"). Using this option, you can force jq to produce pure ASCII output with every non-ASCII character replaced with the equivalent escape sequence. * `--sort-keys` / `-S`: Output the fields of each object with the keys in sorted order. * `--color-output` / `-C` and `--monochrome-output` / `-M`: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using `-C`, and disable color with `-M`. When the `NO_COLOR` environment variable is not empty, jq disables colored output by default, but you can enable it by `-C`. Colors can be configured with the `JQ_COLORS` environment variable (see below). * `--tab`: Use a tab for each indentation level instead of two spaces. * `--indent n`: Use the given number of spaces (no more than 7) for indentation. * `--unbuffered`: Flush the output after each JSON object is printed (useful if you're piping a slow data source into jq and piping jq's output elsewhere). * `--stream`: Parse the input in streaming fashion, outputting arrays of path and leaf values (scalars and empty arrays or empty objects). For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]` becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`. This is useful for processing very large inputs. Use this in conjunction with filtering and the `reduce` and `foreach` syntax to reduce large inputs incrementally. * `--stream-errors`: Like `--stream`, but invalid JSON inputs yield array values where the first element is the error and the second is a path. For example, `["a",n]` produces `["Invalid literal at line 1, column 7",[1]]`. Implies `--stream`. Invalid JSON inputs produce no error values when `--stream` without `--stream-errors`. * `--seq`: Use the `application/json-seq` MIME type scheme for separating JSON texts in jq's input and output. This means that an ASCII RS (record separator) character is printed before each value on output and an ASCII LF (line feed) is printed after every output. Input JSON texts that fail to parse are ignored (but warned about), discarding all subsequent input until the next RS. This mode also parses the output of jq without the `--seq` option. * `-f` / `--from-file`: Read the filter from a file rather than from a command line, like awk's -f option. This changes the filter argument to be interpreted as a filename, instead of the source of a program. * `-L directory` / `--library-path directory`: Prepend `directory` to the search list for modules. If this option is used then no builtin search list is used. See the section on modules below. * `--arg name value`: This option passes a value to the jq program as a predefined variable. If you run jq with `--arg foo bar`, then `$foo` is available in the program and has the value `"bar"`. Note that `value` will be treated as a string, so `--arg foo 123` will bind `$foo` to `"123"`. Named arguments are also available to the jq program as `$ARGS.named`. When the name is not a valid identifier, this is the only way to access it. * `--argjson name JSON-text`: This option passes a JSON-encoded value to the jq program as a predefined variable. If you run jq with `--argjson foo 123`, then `$foo` is available in the program and has the value `123`. * `--slurpfile variable-name filename`: This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable. If you run jq with `--slurpfile foo bar`, then `$foo` is available in the program and has an array whose elements correspond to the texts in the file named `bar`. * `--rawfile variable-name filename`: This option reads in the named file and binds its content to the given global variable. If you run jq with `--rawfile foo bar`, then `$foo` is available in the program and has a string whose content is set to the text in the file named `bar`. * `--args`: Remaining arguments are positional string arguments. These are available to the jq program as `$ARGS.positional[]`. * `--jsonargs`: Remaining arguments are positional JSON text arguments. These are available to the jq program as `$ARGS.positional[]`. * `--exit-status` / `-e`: Sets the exit status of jq to 0 if the last output value was neither `false` nor `null`, 1 if the last output value was either `false` or `null`, or 4 if no valid result was ever produced. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran. Another way to set the exit status is with the `halt_error` builtin function. * `--binary` / `-b`: Windows users using WSL, MSYS2, or Cygwin, should use this option when using a native jq.exe, otherwise jq will turn newlines (LFs) into carriage-return-then-newline (CRLF). * `--version` / `-V`: Output the jq version and exit with zero. * `--build-configuration`: Output the build configuration of jq and exit with zero. This output has no supported format or structure and may change without notice in future releases. * `--help` / `-h`: Output the jq help and exit with zero. * `--`: Terminates argument processing. Remaining arguments are not interpreted as options. * `--run-tests [filename]`: Runs the tests in the given file or standard input. This must be the last option given and does not honor all preceding options. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line. Compilation failure tests start with a line containing only `%%FAIL`, then a line containing the program to compile, then a line containing an error message to compare to the actual. Be warned that this option can change backwards-incompatibly. - title: Basic filters entries: - title: "Identity: `.`" body: | The absolute simplest filter is `.` . This filter takes its input and produces the same value as output. That is, this is the identity operator. Since jq by default pretty-prints all output, a trivial program consisting of nothing but `.` can be used to format JSON output from, say, `curl`. Although the identity filter never modifies the value of its input, jq processing can sometimes make it appear as though it does. For example, using the current implementation of jq, we would see that the expression: 1E1234567890 | . produces `1.7976931348623157e+308` on at least one platform. This is because, in the process of parsing the number, this particular version of jq has converted it to an IEEE754 double-precision representation, losing precision. The way in which jq handles numbers has changed over time and further changes are likely within the parameters set by the relevant JSON standards. Moreover, build configuration options can alter how jq processes numbers. The following remarks are therefore offered with the understanding that they are intended to be descriptive of the current version of jq and should not be interpreted as being prescriptive: (1) Any arithmetic operation on a number that has not already been converted to an IEEE754 double precision representation will trigger a conversion to the IEEE754 representation. (2) jq will attempt to maintain the original decimal precision of number literals (if the `--disable-decnum` build configuration option was not used), but in expressions such `1E1234567890`, precision will be lost if the exponent is too large. (3) Comparisons are carried out using the untruncated big decimal representation of numbers if available, as illustrated in one of the following examples. The examples below use the builtin function `have_decnum` in order to demonstrate the expected effects of using / not using the `--disable-decnum` build configuration option, and also to allow automated tests derived from these examples to pass regardless of whether that option is used. examples: - program: '.' input: '"Hello, world!"' output: ['"Hello, world!"'] - program: '.' input: '0.12345678901234567890123456789' output: ['0.12345678901234567890123456789'] - program: '[., tojson] == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end' input: '12345678909876543212345' output: ['true'] - program: '[1234567890987654321,-1234567890987654321 | tojson] == if have_decnum then ["1234567890987654321","-1234567890987654321"] else ["1234567890987654400","-1234567890987654400"] end' input: 'null' output: ['true'] - program: '. < 0.12345678901234567890123456788' input: '0.12345678901234567890123456789' output: ['false'] - program: 'map([., . == 1]) | tojson == if have_decnum then "[[1,true],[1.000,true],[1.0,true],[1.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end' input: '[1, 1.000, 1.0, 100e-2]' output: ['true'] - program: '. as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000) | . == if have_decnum then [true, false] else [false, false] end' input: '10000000000000000000000000000001' output: ['true'] - title: "Object Identifier-Index: `.foo`, `.foo.bar`" body: | The simplest *useful* filter has the form `.foo`. When given a JSON object (aka dictionary or hash) as input, `.foo` produces the value at the key "foo" if the key is present, or null otherwise. A filter of the form `.foo.bar` is equivalent to `.foo | .bar`. The `.foo` syntax only works for simple, identifier-like keys, that is, keys that are all made of alphanumeric characters and underscore, and which do not start with a digit. If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: `."foo$"`, or else `.["foo$"]`. For example `.["foo::bar"]` and `.["foo.bar"]` work while `.foo::bar` does not. examples: - program: '.foo' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]' input: '{"foo": 42}' output: ['42'] - title: "Optional Object Identifier-Index: `.foo?`" body: | Just like `.foo`, but does not output an error when `.` is not an object. examples: - program: '.foo?' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo?' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]?' input: '{"foo": 42}' output: ['42'] - program: '[.foo?]' input: '[1,2]' output: ['[]'] - title: "Object Index: `.[]`" body: | You can also look up fields of an object using syntax like `.["foo"]` (`.foo` above is a shorthand version of this, but only for identifier-like strings). - title: "Array Index: `.[]`" body: | When the index value is an integer, `.[]` can index arrays. Arrays are zero-based, so `.[2]` returns the third element. Negative indices are allowed, with -1 referring to the last element, -2 referring to the next to last element, and so on. examples: - program: '.[0]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['{"name":"JSON", "good":true}'] - program: '.[2]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['null'] - program: '.[-2]' input: '[1,2,3]' output: ['2'] - title: "Array/String Slice: `.[:]`" body: | The `.[:]` syntax can be used to return a subarray of an array or substring of a string. The array returned by `.[10:15]` will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array). Indices are zero-based. examples: - program: '.[2:4]' input: '["a","b","c","d","e"]' output: ['["c", "d"]'] - program: '.[2:4]' input: '"abcdefghi"' output: ['"cd"'] - program: '.[:3]' input: '["a","b","c","d","e"]' output: ['["a", "b", "c"]'] - program: '.[-2:]' input: '["a","b","c","d","e"]' output: ['["d", "e"]'] - title: "Array/Object Value Iterator: `.[]`" body: | If you use the `.[index]` syntax, but omit the index entirely, it will return *all* of the elements of an array. Running `.[]` with the input `[1,2,3]` will produce the numbers as three separate results, rather than as a single array. A filter of the form `.foo[]` is equivalent to `.foo | .[]`. You can also use this on an object, and it will return all the values of the object. Note that the iterator operator is a generator of values. examples: - program: '.[]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: - '{"name":"JSON", "good":true}' - '{"name":"XML", "good":false}' - program: '.[]' input: '[]' output: [] - program: '.foo[]' input: '{"foo":[1,2,3]}' output: ['1','2','3'] - program: '.[]' input: '{"a": 1, "b": 1}' output: ['1', '1'] - title: "`.[]?`" body: | Like `.[]`, but no errors will be output if . is not an array or object. A filter of the form `.foo[]?` is equivalent to `.foo | .[]?`. - title: "Comma: `,`" body: | If two filters are separated by a comma, then the same input will be fed into both and the two filters' output value streams will be concatenated in order: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right. For instance, filter `.foo, .bar`, produces both the "foo" fields and "bar" fields as separate outputs. The `,` operator is one way to construct generators. examples: - program: '.foo, .bar' input: '{"foo": 42, "bar": "something else", "baz": true}' output: ['42', '"something else"'] - program: ".user, .projects[]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['"stedolan"', '"jq"', '"wikiflow"'] - program: '.[4,2]' input: '["a","b","c","d","e"]' output: ['"e"', '"c"'] - title: "Pipe: `|`" body: | The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right. It's similar to the Unix shell's pipe, if you're used to that. If the one on the left produces multiple results, the one on the right will be run for each of those results. So, the expression `.[] | .foo` retrieves the "foo" field of each element of the input array. This is a cartesian product, which can be surprising. Note that `.a.b.c` is the same as `.a | .b | .c`. Note too that `.` is the input value at the particular stage in a "pipeline", specifically: where the `.` expression appears. Thus `.a | . | .b` is the same as `.a.b`, as the `.` in the middle refers to whatever value `.a` produced. examples: - program: '.[] | .name' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['"JSON"', '"XML"'] - title: "Parenthesis" body: | Parenthesis work as a grouping operator just as in any typical programming language. examples: - program: '(. + 2) * 5' input: '1' output: ['15'] - title: Types and Values body: | jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string keys), and "null". Booleans, null, strings and numbers are written the same way as in JSON. Just like everything else in jq, these simple values take an input and produce an output - `42` is a valid jq expression that takes an input, ignores it, and returns 42 instead. Numbers in jq are internally represented by their IEEE754 double precision approximation. Any arithmetic operation with numbers, whether they are literals or results of previous filters, will produce a double precision floating point result. However, when parsing a literal jq will store the original literal string. If no mutation is applied to this value then it will make to the output in its original form, even if conversion to double would result in a loss. entries: - title: "Array construction: `[]`" body: | As in JSON, `[]` is used to construct arrays, as in `[1,2,3]`. The elements of the arrays can be any jq expression, including a pipeline. All of the results produced by all of the expressions are collected into one big array. You can use it to construct an array out of a known quantity of values (as in `[.foo, .bar, .baz]`) or to "collect" all the results of a filter into an array (as in `[.items[].name]`) Once you understand the "," operator, you can look at jq's array syntax in a different light: the expression `[1,2,3]` is not using a built-in syntax for comma-separated arrays, but is instead applying the `[]` operator (collect results) to the expression 1,2,3 (which produces three different results). If you have a filter `X` that produces four results, then the expression `[X]` will produce a single result, an array of four elements. examples: - program: "[.user, .projects[]]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['["stedolan", "jq", "wikiflow"]'] - program: "[ .[] | . * 2]" input: '[1, 2, 3]' output: ['[2, 4, 6]'] - title: "Object Construction: `{}`" body: | Like JSON, `{}` is for constructing objects (aka dictionaries or hashes), as in: `{"a": 42, "b": 17}`. If the keys are "identifier-like", then the quotes can be left off, as in `{a:42, b:17}`. Variable references as key expressions use the value of the variable as the key. Key expressions other than constant literals, identifiers, or variable references, need to be parenthesized, e.g., `{("a"+"b"):59}`. The value can be any expression (although you may need to wrap it in parentheses if, for example, it contains colons), which gets applied to the {} expression's input (remember, all filters have an input and an output). {foo: .bar} will produce the JSON object `{"foo": 42}` if given the JSON object `{"bar":42, "baz":43}` as its input. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write {user: .user, title: .title} Because that is so common, there's a shortcut syntax for it: `{user, title}`. If one of the expressions produces multiple results, multiple dictionaries will be produced. If the input's {"user":"stedolan","titles":["JQ Primer", "More JQ"]} then the expression {user, title: .titles[]} will produce two outputs: {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} Putting parentheses around the key means it will be evaluated as an expression. With the same input as above, {(.user): .titles} produces {"stedolan": ["JQ Primer", "More JQ"]} Variable references as keys use the value of the variable as the key. Without a value then the variable's name becomes the key and its value becomes the value, "f o o" as $foo | "b a r" as $bar | {$foo, $bar:$foo} produces {"foo":"f o o","b a r":"f o o"} examples: - program: '{user, title: .titles[]}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: - '{"user":"stedolan", "title": "JQ Primer"}' - '{"user":"stedolan", "title": "More JQ"}' - program: '{(.user): .titles}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: ['{"stedolan": ["JQ Primer", "More JQ"]}'] - title: "Recursive Descent: `..`" body: | Recursively descends `.`, producing every value. This is the same as the zero-argument `recurse` builtin (see below). This is intended to resemble the XPath `//` operator. Note that `..a` does not work; use `.. | .a` instead. In the example below we use `.. | .a?` to find all the values of object keys "a" in any object found "below" `.`. This is particularly useful in conjunction with `path(EXP)` (also see below) and the `?` operator. examples: - program: '.. | .a?' input: '[[{"a":1}]]' output: ['1'] - title: Builtin operators and functions body: | Some jq operators (for instance, `+`) do different things depending on the type of their arguments (arrays, numbers, etc.). However, jq never does implicit type conversions. If you try to add a string to an object you'll get an error message and no result. Please note that all numbers are converted to IEEE754 double precision floating point representation. Arithmetic and logical operators are working with these converted doubles. Results of all such operations are also limited to the double precision. The only exception to this behaviour of number is a snapshot of original number literal. When a number which originally was provided as a literal is never mutated until the end of the program then it is printed to the output in its original literal form. This also includes cases when the original literal would be truncated when converted to the IEEE754 double precision floating point number. entries: - title: "Addition: `+`" body: | The operator `+` takes two filters, applies them both to the same input, and adds the results together. What "adding" means depends on the types involved: - **Numbers** are added by normal arithmetic. - **Arrays** are added by being concatenated into a larger array. - **Strings** are added by being joined into a larger string. - **Objects** are added by merging, that is, inserting all the key-value pairs from both objects into a single combined object. If both objects contain a value for the same key, the object on the right of the `+` wins. (For recursive merge use the `*` operator.) `null` can be added to any value, and returns the other value unchanged. examples: - program: '.a + 1' input: '{"a": 7}' output: ['8'] - program: '.a + .b' input: '{"a": [1,2], "b": [3,4]}' output: ['[1,2,3,4]'] - program: '.a + null' input: '{"a": 1}' output: ['1'] - program: '.a + 1' input: '{}' output: ['1'] - program: '{a: 1} + {b: 2} + {c: 3} + {a: 42}' input: 'null' output: ['{"a": 42, "b": 2, "c": 3}'] - title: "Subtraction: `-`" body: | As well as normal arithmetic subtraction on numbers, the `-` operator can be used on arrays to remove all occurrences of the second array's elements from the first array. examples: - program: '4 - .a' input: '{"a":3}' output: ['1'] - program: . - ["xml", "yaml"] input: '["xml", "yaml", "json"]' output: ['["json"]'] - title: "Multiplication, division, modulo: `*`, `/`, `%`" body: | These infix operators behave as expected when given two numbers. Division by zero raises an error. `x % y` computes x modulo y. Multiplying a string by a number produces the concatenation of that string that many times. `"x" * 0` produces `""`. Dividing a string by another splits the first using the second as separators. Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy. examples: - program: '10 / . * 3' input: '5' output: ['6'] - program: '. / ", "' input: '"a, b,c,d, e"' output: ['["a","b,c,d","e"]'] - program: '{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}' input: 'null' output: ['{"k": {"a": 0, "b": 2, "c": 3}}'] - program: '.[] | (1 / .)?' input: '[1,0,-1]' output: ['1', '-1'] - title: "`abs`" body: | The builtin function `abs` is defined naively as: `if . < 0 then - . else . end`. For numeric input, this is the absolute value. See the section on the identity filter for the implications of this definition for numeric input. To compute the absolute value of a number as a floating point number, you may wish use `fabs`. examples: - program: 'map(abs)' input: '[-10, -1.1, -1e-1]' output: ['[10,1.1,1e-1]'] - title: "`length`" body: | The builtin function `length` gets the length of various different types of value: - The length of a **string** is the number of Unicode codepoints it contains (which will be the same as its JSON-encoded length in bytes if it's pure ASCII). - The length of a **number** is its absolute value. - The length of an **array** is the number of elements. - The length of an **object** is the number of key-value pairs. - The length of **null** is zero. - It is an error to use `length` on a **boolean**. examples: - program: '.[] | length' input: '[[1,2], "string", {"a":2}, null, -5]' output: ['2', '6', '1', '0', '5'] - title: "`utf8bytelength`" body: | The builtin function `utf8bytelength` outputs the number of bytes used to encode a string in UTF-8. examples: - program: 'utf8bytelength' input: '"\u03bc"' output: ['2'] - title: "`keys`, `keys_unsorted`" body: | The builtin function `keys`, when given an object, returns its keys in an array. The keys are sorted "alphabetically", by unicode codepoint order. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings. When `keys` is given an array, it returns the valid indices for that array: the integers from 0 to length-1. The `keys_unsorted` function is just like `keys`, but if the input is an object then the keys will not be sorted, instead the keys will roughly be in insertion order. examples: - program: 'keys' input: '{"abc": 1, "abcd": 2, "Foo": 3}' output: ['["Foo", "abc", "abcd"]'] - program: 'keys' input: '[42,3,35]' output: ['[0,1,2]'] - title: "`has(key)`" body: | The builtin function `has` returns whether the input object has the given key, or the input array has an element at the given index. `has($key)` has the same effect as checking whether `$key` is a member of the array returned by `keys`, although `has` will be faster. examples: - program: 'map(has("foo"))' input: '[{"foo": 42}, {}]' output: ['[true, false]'] - program: 'map(has(2))' input: '[[0,1], ["a","b","c"]]' output: ['[false, true]'] - title: "`in`" body: | The builtin function `in` returns whether or not the input key is in the given object, or the input index corresponds to an element in the given array. It is, essentially, an inversed version of `has`. examples: - program: '.[] | in({"foo": 42})' input: '["foo", "bar"]' output: ['true', 'false'] - program: 'map(in([0,1]))' input: '[2, 0]' output: ['[false, true]'] - title: "`map(f)`, `map_values(f)`" body: | For any filter `f`, `map(f)` and `map_values(f)` apply `f` to each of the values in the input array or object, that is, to the values of `.[]`. In the absence of errors, `map(f)` always outputs an array whereas `map_values(f)` outputs an array if given an array, or an object if given an object. When the input to `map_values(f)` is an object, the output object has the same keys as the input object except for those keys whose values when piped to `f` produce no values at all. The key difference between `map(f)` and `map_values(f)` is that the former simply forms an array from all the values of `($x|f)` for each value, `$x`, in the input array or object, but `map_values(f)` only uses `first($x|f)`. Specifically, for object inputs, `map_values(f)` constructs the output object by examining in turn the value of `first(.[$k]|f)` for each key, `$k`, of the input. If this expression produces no values, then the corresponding key will be dropped; otherwise, the output object will have that value at the key, `$k`. Here are some examples to clarify the behavior of `map` and `map_values` when applied to arrays. These examples assume the input is `[1]` in all cases: map(.+1) #=> [2] map(., .) #=> [1,1] map(empty) #=> [] map_values(.+1) #=> [2] map_values(., .) #=> [1] map_values(empty) #=> [] `map(f)` is equivalent to `[.[] | f]` and `map_values(f)` is equivalent to `.[] |= f`. In fact, these are their implementations. examples: - program: 'map(.+1)' input: '[1,2,3]' output: ['[2,3,4]'] - program: 'map_values(.+1)' input: '{"a": 1, "b": 2, "c": 3}' output: ['{"a": 2, "b": 3, "c": 4}'] - program: 'map(., .)' input: '[1,2]' output: ['[1,1,2,2]'] - program: 'map_values(. // empty)' input: '{"a": null, "b": true, "c": false}' output: ['{"b":true}'] - title: "`pick(pathexps)`" body: | Emit the projection of the input object or array defined by the specified sequence of path expressions, such that if `p` is any one of these specifications, then `(. | p)` will evaluate to the same value as `(. | pick(pathexps) | p)`. For arrays, negative indices and `.[m:n]` specifications should not be used. examples: - program: 'pick(.a, .b.c, .x)' input: '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4}' output: ['{"a":1,"b":{"c":2},"x":null}'] - program: 'pick(.[2], .[0], .[0])' input: '[1,2,3,4]' output: ['[1,null,3]'] - title: "`path(path_expression)`" body: | Outputs array representations of the given path expression in `.`. The outputs are arrays of strings (object keys) and/or numbers (array indices). Path expressions are jq expressions like `.a`, but also `.[]`. There are two types of path expressions: ones that can match exactly, and ones that cannot. For example, `.a.b.c` is an exact match path expression, while `.a[].b` is not. `path(exact_path_expression)` will produce the array representation of the path expression even if it does not exist in `.`, if `.` is `null` or an array or an object. `path(pattern)` will produce array representations of the paths matching `pattern` if the paths exist in `.`. Note that the path expressions are not different from normal expressions. The expression `path(..|select(type=="boolean"))` outputs all the paths to boolean values in `.`, and only those paths. examples: - program: 'path(.a[0].b)' input: 'null' output: ['["a",0,"b"]'] - program: '[path(..)]' input: '{"a":[{"b":1}]}' output: ['[[],["a"],["a",0],["a",0,"b"]]'] - title: "`del(path_expression)`" body: | The builtin function `del` removes a key and its corresponding value from an object. examples: - program: 'del(.foo)' input: '{"foo": 42, "bar": 9001, "baz": 42}' output: ['{"bar": 9001, "baz": 42}'] - program: 'del(.[1, 2])' input: '["foo", "bar", "baz"]' output: ['["foo"]'] - title: "`getpath(PATHS)`" body: | The builtin function `getpath` outputs the values in `.` found at each path in `PATHS`. examples: - program: 'getpath(["a","b"])' input: 'null' output: ['null'] - program: '[getpath(["a","b"], ["a","c"])]' input: '{"a":{"b":0, "c":1}}' output: ['[0, 1]'] - title: "`setpath(PATHS; VALUE)`" body: | The builtin function `setpath` sets the `PATHS` in `.` to `VALUE`. examples: - program: 'setpath(["a","b"]; 1)' input: 'null' output: ['{"a": {"b": 1}}'] - program: 'setpath(["a","b"]; 1)' input: '{"a":{"b":0}}' output: ['{"a": {"b": 1}}'] - program: 'setpath([0,"a"]; 1)' input: 'null' output: ['[{"a":1}]'] - title: "`delpaths(PATHS)`" body: | The builtin function `delpaths` deletes the `PATHS` in `.`. `PATHS` must be an array of paths, where each path is an array of strings and numbers. examples: - program: 'delpaths([["a","b"]])' input: '{"a":{"b":1},"x":{"y":2}}' output: ['{"a":{},"x":{"y":2}}'] - title: "`to_entries`, `from_entries`, `with_entries(f)`" body: | These functions convert between an object and an array of key-value pairs. If `to_entries` is passed an object, then for each `k: v` entry in the input, the output array includes `{"key": k, "value": v}`. `from_entries` does the opposite conversion, and `with_entries(f)` is a shorthand for `to_entries | map(f) | from_entries`, useful for doing some operation to all keys and values of an object. `from_entries` accepts `"key"`, `"Key"`, `"name"`, `"Name"`, `"value"`, and `"Value"` as keys. examples: - program: 'to_entries' input: '{"a": 1, "b": 2}' output: ['[{"key":"a", "value":1}, {"key":"b", "value":2}]'] - program: 'from_entries' input: '[{"key":"a", "value":1}, {"key":"b", "value":2}]' output: ['{"a": 1, "b": 2}'] - program: 'with_entries(.key |= "KEY_" + .)' input: '{"a": 1, "b": 2}' output: ['{"KEY_a": 1, "KEY_b": 2}'] - title: "`select(boolean_expression)`" body: | The function `select(f)` produces its input unchanged if `f` returns true for that input, and produces no output otherwise. It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))` will give you `[2,3]`. examples: - program: 'map(select(. >= 2))' input: '[1,5,3,0,7]' output: ['[5,3,7]'] - program: '.[] | select(.id == "second")' input: '[{"id": "first", "val": 1}, {"id": "second", "val": 2}]' output: ['{"id": "second", "val": 2}'] - title: "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `normals`, `finites`, `strings`, `nulls`, `values`, `scalars`" body: | These built-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, normal numbers, finite numbers, strings, null, non-null values, and non-iterables, respectively. examples: - program: '.[]|numbers' input: '[[],{},1,"foo",null,true,false]' output: ['1'] - title: "`empty`" body: | `empty` returns no results. None at all. Not even `null`. It's useful on occasion. You'll know if you need it :) examples: - program: '1, empty, 2' input: 'null' output: ['1', '2'] - program: '[1,2,empty,3]' input: 'null' output: ['[1,2,3]'] - title: "`error`, `error(message)`" body: | Produces an error with the input value, or with the message given as the argument. Errors can be caught with try/catch; see below. examples: - program: 'try error catch .' input: '"error message"' output: ['"error message"'] - program: 'try error("invalid value: \(.)") catch .' input: '42' output: ['"invalid value: 42"'] - title: "`halt`" body: | Stops the jq program with no further outputs. jq will exit with exit status `0`. - title: "`halt_error`, `halt_error(exit_code)`" body: | Stops the jq program with no further outputs. The input will be printed on `stderr` as raw output (i.e., strings will not have double quotes) with no decoration, not even a newline. The given `exit_code` (defaulting to `5`) will be jq's exit status. For example, `"Error: something went wrong\n"|halt_error(1)`. - title: "`$__loc__`" body: | Produces an object with a "file" key and a "line" key, with the filename and line number where `$__loc__` occurs, as values. examples: - program: 'try error("\($__loc__)") catch .' input: 'null' output: ['"{\"file\":\"\",\"line\":1}"'] - title: "`paths`, `paths(node_filter)`" body: | `paths` outputs the paths to all the elements in its input (except it does not output the empty list, representing . itself). `paths(f)` outputs the paths to any values for which `f` is `true`. That is, `paths(type == "number")` outputs the paths to all numeric values. examples: - program: '[paths]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1],[1,0],[1,1],[1,1,"a"]]'] - program: '[paths(type == "number")]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1,1,"a"]]'] - title: "`add`, `add(generator)`" body: | The filter `add` takes as input an array, and produces as output the elements of the array added together. This might mean summed, concatenated or merged depending on the types of the elements of the input array - the rules are the same as those for the `+` operator (described above). If the input is an empty array, `add` returns `null`. `add(generator)` operates on the given generator rather than the input. examples: - program: add input: '["a","b","c"]' output: ['"abc"'] - program: add input: '[1, 2, 3]' output: ['6'] - program: add input: '[]' output: ["null"] - program: add(.[].a) input: '[{"a":3}, {"a":5}, {"b":6}]' output: ['8'] - title: "`any`, `any(condition)`, `any(generator; condition)`" body: | The filter `any` takes as input an array of boolean values, and produces `true` as output if any of the elements of the array are `true`. If the input is an empty array, `any` returns `false`. The `any(condition)` form applies the given condition to the elements of the input array. The `any(generator; condition)` form applies the given condition to all the outputs of the given generator. examples: - program: any input: '[true, false]' output: ["true"] - program: any input: '[false, false]' output: ["false"] - program: any input: '[]' output: ["false"] - title: "`all`, `all(condition)`, `all(generator; condition)`" body: | The filter `all` takes as input an array of boolean values, and produces `true` as output if all of the elements of the array are `true`. The `all(condition)` form applies the given condition to the elements of the input array. The `all(generator; condition)` form applies the given condition to all the outputs of the given generator. If the input is an empty array, `all` returns `true`. examples: - program: all input: '[true, false]' output: ["false"] - program: all input: '[true, true]' output: ["true"] - program: all input: '[]' output: ["true"] - title: "`flatten`, `flatten(depth)`" body: | The filter `flatten` takes as input an array of nested arrays, and produces a flat array in which all arrays inside the original array have been recursively replaced by their values. You can pass an argument to it to specify how many levels of nesting to flatten. `flatten(2)` is like `flatten`, but going only up to two levels deep. examples: - program: flatten input: '[1, [2], [[3]]]' output: ["[1, 2, 3]"] - program: flatten(1) input: '[1, [2], [[3]]]' output: ["[1, 2, [3]]"] - program: flatten input: '[[]]' output: ["[]"] - program: flatten input: '[{"foo": "bar"}, [{"foo": "baz"}]]' output: ['[{"foo": "bar"}, {"foo": "baz"}]'] - title: "`range(upto)`, `range(from; upto)`, `range(from; upto; by)`" body: | The `range` function produces a range of numbers. `range(4; 10)` produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers are produced as separate outputs. Use `[range(4; 10)]` to get a range as an array. The one argument form generates numbers from 0 to the given number, with an increment of 1. The two argument form generates numbers from `from` to `upto` with an increment of 1. The three argument form generates numbers `from` to `upto` with an increment of `by`. examples: - program: 'range(2; 4)' input: 'null' output: ['2', '3'] - program: '[range(2; 4)]' input: 'null' output: ['[2,3]'] - program: '[range(4)]' input: 'null' output: ['[0,1,2,3]'] - program: '[range(0; 10; 3)]' input: 'null' output: ['[0,3,6,9]'] - program: '[range(0; 10; -1)]' input: 'null' output: ['[]'] - program: '[range(0; -5; -1)]' input: 'null' output: ['[0,-1,-2,-3,-4]'] - title: "`floor`" body: | The `floor` function returns the floor of its numeric input. examples: - program: 'floor' input: '3.14159' output: ['3'] - title: "`sqrt`" body: | The `sqrt` function returns the square root of its numeric input. examples: - program: 'sqrt' input: '9' output: ['3'] - title: "`tonumber`" body: | The `tonumber` function parses its input as a number. It will convert correctly-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input. examples: - program: '.[] | tonumber' input: '[1, "1"]' output: ['1', '1'] - title: "`toboolean`" body: | The `toboolean` function parses its input as a boolean. It will convert correctly-formatted strings to their boolean equivalent, leave booleans alone, and give an error on all other input. examples: - program: '.[] | toboolean' input: '["true", "false", true, false]' output: ['true', 'false', 'true', 'false'] - title: "`tostring`" body: | The `tostring` function prints its input as a string. Strings are left unchanged, and all other values are JSON-encoded. examples: - program: '.[] | tostring' input: '[1, "1", [1]]' output: ['"1"', '"1"', '"[1]"'] - title: "`type`" body: | The `type` function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object. examples: - program: 'map(type)' input: '[0, false, [], {}, null, "hello"]' output: ['["number", "boolean", "array", "object", "null", "string"]'] - title: "`infinite`, `nan`, `isinfinite`, `isnan`, `isfinite`, `isnormal`" body: | Some arithmetic operations can yield infinities and "not a number" (NaN) values. The `isinfinite` builtin returns `true` if its input is infinite. The `isnan` builtin returns `true` if its input is a NaN. The `infinite` builtin returns a positive infinite value. The `nan` builtin returns a NaN. The `isnormal` builtin returns true if its input is a normal number. Note that division by zero raises an error. Currently most arithmetic operations operating on infinities, NaNs, and sub-normals do not raise errors. examples: - program: '.[] | (infinite * .) < 0' input: '[-1, 1]' output: ['true', 'false'] - program: 'infinite, nan | type' input: 'null' output: ['"number"', '"number"'] - title: "`sort`, `sort_by(path_expression)`" body: | The `sort` functions sorts its input, which must be an array. Values are sorted in the following order: * `null` * `false` * `true` * numbers * strings, in alphabetical order (by unicode codepoint value) * arrays, in lexical order * objects The ordering for objects is a little complex: first they're compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key. `sort_by` may be used to sort by a particular field of an object, or by applying any jq filter. `sort_by(f)` compares two elements by comparing the result of `f` on each element. When `f` produces multiple values, it firstly compares the first values, and the second values if the first values are equal, and so on. examples: - program: 'sort' input: '[8,3,null,6]' output: ['[null,3,6,8]'] - program: 'sort_by(.foo)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}]'] - program: 'sort_by(.foo, .bar)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}]'] - title: "`group_by(path_expression)`" body: | `group_by(.foo)` takes as input an array, groups the elements having the same `.foo` field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the `.foo` field. Any jq expression, not just a field access, may be used in place of `.foo`. The sorting order is the same as described in the `sort` function above. examples: - program: 'group_by(.foo)' input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]' output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]'] - title: "`min`, `max`, `min_by(path_exp)`, `max_by(path_exp)`" body: | Find the minimum or maximum element of the input array. The `min_by(path_exp)` and `max_by(path_exp)` functions allow you to specify a particular field or property to examine, e.g. `min_by(.foo)` finds the object with the smallest `foo` field. examples: - program: 'min' input: '[5,4,2,7]' output: ['2'] - program: 'max_by(.foo)' input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]' output: ['{"foo":2, "bar":3}'] - title: "`unique`, `unique_by(path_exp)`" body: | The `unique` function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed. The `unique_by(path_exp)` function will keep only one element for each value obtained by applying the argument. Think of it as making an array by taking one element out of every group produced by `group`. examples: - program: 'unique' input: '[1,2,5,3,5,3,1,3]' output: ['[1,2,3,5]'] - program: 'unique_by(.foo)' input: '[{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}]' output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]'] - program: 'unique_by(length)' input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]' output: ['["bacon", "chunky", "asparagus"]'] - title: "`reverse`" body: | This function reverses an array. examples: - program: 'reverse' input: '[1,2,3,4]' output: ['[4,3,2,1]'] - title: "`contains(element)`" body: | The filter `contains(b)` will produce true if b is completely contained within the input. A string B is contained in a string A if B is a substring of A. An array B is contained in an array A if all elements in B are contained in any element in A. An object B is contained in object A if all of the values in B are contained in the value in A with the same key. All other types are assumed to be contained in each other if they are equal. examples: - program: 'contains("bar")' input: '"foobar"' output: ['true'] - program: 'contains(["baz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['true'] - program: 'contains(["bazzzzz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['false'] - program: 'contains({foo: 12, bar: [{barp: 12}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['true'] - program: 'contains({foo: 12, bar: [{barp: 15}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['false'] - title: "`indices(s)`" body: | Outputs an array containing the indices in `.` where `s` occurs. The input may be an array, in which case if `s` is an array then the indices output will be those where all elements in `.` match those of `s`. examples: - program: 'indices(", ")' input: '"a,b, cd, efg, hijk"' output: ['[3,7,12]'] - program: 'indices(1)' input: '[0,1,2,1,3,1,4]' output: ['[1,3,5]'] - program: 'indices([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['[1,8]'] - title: "`index(s)`, `rindex(s)`" body: | Outputs the index of the first (`index`) or last (`rindex`) occurrence of `s` in the input. examples: - program: 'index(", ")' input: '"a,b, cd, efg, hijk"' output: ['3'] - program: 'index(1)' input: '[0,1,2,1,3,1,4]' output: ['1'] - program: 'index([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['1'] - program: 'rindex(", ")' input: '"a,b, cd, efg, hijk"' output: ['12'] - program: 'rindex(1)' input: '[0,1,2,1,3,1,4]' output: ['5'] - program: 'rindex([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['8'] - title: "`inside`" body: | The filter `inside(b)` will produce true if the input is completely contained within b. It is, essentially, an inversed version of `contains`. examples: - program: 'inside("foobar")' input: '"bar"' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["baz", "bar"]' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["bazzzzz", "bar"]' output: ['false'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 12}]}' output: ['true'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 15}]}' output: ['false'] - title: "`startswith(str)`" body: | Outputs `true` if . starts with the given string argument. examples: - program: '[.[]|startswith("foo")]' input: '["fo", "foo", "barfoo", "foobar", "barfoob"]' output: ['[false, true, false, true, false]'] - title: "`endswith(str)`" body: | Outputs `true` if . ends with the given string argument. examples: - program: '[.[]|endswith("foo")]' input: '["foobar", "barfoo"]' output: ['[false, true]'] - title: "`combinations`, `combinations(n)`" body: | Outputs all combinations of the elements of the arrays in the input array. If given an argument `n`, it outputs all combinations of `n` repetitions of the input array. examples: - program: 'combinations' input: '[[1,2], [3, 4]]' output: ['[1, 3]', '[1, 4]', '[2, 3]', '[2, 4]'] - program: 'combinations(2)' input: '[0, 1]' output: ['[0, 0]', '[0, 1]', '[1, 0]', '[1, 1]'] - title: "`ltrimstr(str)`" body: | Outputs its input with the given prefix string removed, if it starts with it. examples: - program: '[.[]|ltrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "afoo"]' output: ['["fo","","barfoo","bar","afoo"]'] - title: "`rtrimstr(str)`" body: | Outputs its input with the given suffix string removed, if it ends with it. examples: - program: '[.[]|rtrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "foob"]' output: ['["fo","","bar","foobar","foob"]'] - title: "`trimstr(str)`" body: | Outputs its input with the given string removed at both ends, if it starts or ends with it. examples: - program: '[.[]|trimstr("foo")]' input: '["fo", "foo", "barfoo", "foobarfoo", "foob"]' output: ['["fo","","bar","bar","b"]'] - title: "`trim`, `ltrim`, `rtrim`" body: | `trim` trims both leading and trailing whitespace. `ltrim` trims only leading (left side) whitespace. `rtrim` trims only trailing (right side) whitespace. Whitespace characters are the usual `" "`, `"\n"` `"\t"`, `"\r"` and also all characters in the Unicode character database with the whitespace property. Note that what considers whitespace might change in the future. examples: - program: 'trim, ltrim, rtrim' input: '" abc "' output: ['"abc"', '"abc "', '" abc"'] - title: "`explode`" body: | Converts an input string into an array of the string's codepoint numbers. examples: - program: 'explode' input: '"foobar"' output: ['[102,111,111,98,97,114]'] - title: "`implode`" body: | The inverse of explode. examples: - program: 'implode' input: '[65, 66, 67]' output: ['"ABC"'] - title: "`split(str)`" body: | Splits an input string on the separator argument. `split` can also split on regex matches when called with two arguments (see the regular expressions section below). examples: - program: 'split(", ")' input: '"a, b,c,d, e, "' output: ['["a","b,c,d","e",""]'] - title: "`join(str)`" body: | Joins the array of elements given as input, using the argument as separator. It is the inverse of `split`: that is, running `split("foo") | join("foo")` over any input string returns said input string. Numbers and booleans in the input are converted to strings. Null values are treated as empty strings. Arrays and objects in the input are not supported. examples: - program: 'join(", ")' input: '["a","b,c,d","e"]' output: ['"a, b,c,d, e"'] - program: 'join(" ")' input: '["a",1,2.3,true,null,false]' output: ['"a 1 2.3 true false"'] - title: "`ascii_downcase`, `ascii_upcase`" body: | Emit a copy of the input string with its alphabetic characters (a-z and A-Z) converted to the specified case. examples: - program: 'ascii_upcase' input: '"useful but not for é"' output: ['"USEFUL BUT NOT FOR é"'] - title: "`while(cond; update)`" body: | The `while(cond; update)` function allows you to repeatedly apply an update to `.` until `cond` is false. Note that `while(cond; update)` is internally defined as a recursive jq function. Recursive calls within `while` will not consume additional memory if `update` produces at most one output for each input. See advanced topics below. examples: - program: '[while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: "`repeat(exp)`" body: | The `repeat(exp)` function allows you to repeatedly apply expression `exp` to `.` until an error is raised. Note that `repeat(exp)` is internally defined as a recursive jq function. Recursive calls within `repeat` will not consume additional memory if `exp` produces at most one output for each input. See advanced topics below. examples: - program: '[repeat(.*2, error)?]' input: '1' output: ['[2]'] - title: "`until(cond; next)`" body: | The `until(cond; next)` function allows you to repeatedly apply the expression `next`, initially to `.` then to its own output, until `cond` is true. For example, this can be used to implement a factorial function (see below). Note that `until(cond; next)` is internally defined as a recursive jq function. Recursive calls within `until()` will not consume additional memory if `next` produces at most one output for each input. See advanced topics below. examples: - program: '[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]' input: '4' output: ['24'] - title: "`recurse(f)`, `recurse`, `recurse(f; condition)`" body: | The `recurse(f)` function allows you to search through a recursive structure, and extract interesting data from all levels. Suppose your input represents a filesystem: {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} Now suppose you want to extract all of the filenames present. You need to retrieve `.name`, `.children[].name`, `.children[].children[].name`, and so on. You can do this with: recurse(.children[]) | .name When called without an argument, `recurse` is equivalent to `recurse(.[]?)`. `recurse(f)` is identical to `recurse(f; true)` and can be used without concerns about recursion depth. `recurse(f; condition)` is a generator which begins by emitting . and then emits in turn .|f, .|f|f, .|f|f|f, ... so long as the computed value satisfies the condition. For example, to generate all the integers, at least in principle, one could write `recurse(.+1; true)`. The recursive calls in `recurse` will not consume additional memory whenever `f` produces at most a single output for each input. examples: - program: 'recurse(.foo[])' input: '{"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}' output: - '{"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}' - '{"foo":[]}' - '{"foo":[{"foo":[]}]}' - '{"foo":[]}' - program: 'recurse' input: '{"a":0,"b":[1]}' output: - '{"a":0,"b":[1]}' - '0' - '[1]' - '1' - program: 'recurse(. * .; . < 20)' input: '2' output: ['2', '4', '16'] - title: "`walk(f)`" body: | The `walk(f)` function applies f recursively to every component of the input entity. When an array is encountered, f is first applied to its elements and then to the array itself; when an object is encountered, f is first applied to all the values and then to the object. In practice, f will usually test the type of its input, as illustrated in the following examples. The first example highlights the usefulness of processing the elements of an array of arrays before processing the array itself. The second example shows how all the keys of all the objects within the input can be considered for alteration. examples: - program: 'walk(if type == "array" then sort else . end)' input: '[[4, 1, 7], [8, 5, 2], [3, 6, 9]]' output: - '[[1,4,7],[2,5,8],[3,6,9]]' - program: 'walk( if type == "object" then with_entries( .key |= sub( "^_+"; "") ) else . end )' input: '[ { "_a": { "__b": 2 } } ]' output: - '[{"a":{"b":2}}]' - title: "`have_literal_numbers`" body: | This builtin returns true if jq's build configuration includes support for preservation of input number literals. - title: "`have_decnum`" body: | This builtin returns true if jq was built with "decnum", which is the current literal number preserving numeric backend implementation for jq. - title: "`$JQ_BUILD_CONFIGURATION`" body: | This builtin binding shows the jq executable's build configuration. Its value has no particular format, but it can be expected to be at least the `./configure` command-line arguments, and may be enriched in the future to include the version strings for the build tooling used. Note that this can be overridden in the command-line with `--arg` and related options. - title: "`$ENV`, `env`" body: | `$ENV` is an object representing the environment variables as set when the jq program started. `env` outputs an object representing jq's current environment. At the moment there is no builtin for setting environment variables. examples: - program: '$ENV.PAGER' input: 'null' output: ['"less"'] - program: 'env.PAGER' input: 'null' output: ['"less"'] - title: "`transpose`" body: | Transpose a possibly jagged matrix (an array of arrays). Rows are padded with nulls so the result is always rectangular. examples: - program: 'transpose' input: '[[1], [2,3]]' output: ['[[1,2],[null,3]]'] - title: "`bsearch(x)`" body: | `bsearch(x)` conducts a binary search for x in the input array. If the input is sorted and contains x, then `bsearch(x)` will return its index in the array; otherwise, if the array is sorted, it will return (-1 - ix) where ix is an insertion point such that the array would still be sorted after the insertion of x at ix. If the array is not sorted, `bsearch(x)` will return an integer that is probably of no interest. examples: - program: 'bsearch(0)' input: '[0,1]' output: ['0'] - program: 'bsearch(0)' input: '[1,2,3]' output: ['-1'] - program: 'bsearch(4) as $ix | if $ix < 0 then .[-(1+$ix)] = 4 else . end' input: '[1,2,3]' output: ['[1,2,3,4]'] - title: "String interpolation: `\\(exp)`" body: | Inside a string, you can put an expression inside parens after a backslash. Whatever the expression returns will be interpolated into the string. examples: - program: '"The input was \(.), which is one less than \(.+1)"' input: '42' output: ['"The input was 42, which is one less than 43"'] - title: "Convert to/from JSON" body: | The `tojson` and `fromjson` builtins dump values as JSON texts or parse JSON texts into values, respectively. The `tojson` builtin differs from `tostring` in that `tostring` returns strings unmodified, while `tojson` encodes strings as JSON strings. examples: - program: '[.[]|tostring]' input: '[1, "foo", ["foo"]]' output: ['["1","foo","[\"foo\"]"]'] - program: '[.[]|tojson]' input: '[1, "foo", ["foo"]]' output: ['["1","\"foo\"","[\"foo\"]"]'] - program: '[.[]|tojson|fromjson]' input: '[1, "foo", ["foo"]]' output: ['[1,"foo",["foo"]]'] - title: "Format strings and escaping" body: | The `@foo` syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth. `@foo` can be used as a filter on its own, the possible escapings are: * `@text`: Calls `tostring`, see that function for details. * `@json`: Serializes the input as JSON. * `@html`: Applies HTML/XML escaping, by mapping the characters `<>&'"` to their entity equivalents `<`, `>`, `&`, `'`, `"`. * `@uri`: Applies percent-encoding, by mapping all reserved URI characters to a `%XX` sequence. * `@urid`: The inverse of `@uri`, applies percent-decoding, by mapping all `%XX` sequences to their corresponding URI characters. * `@csv`: The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition. * `@tsv`: The input must be an array, and it is rendered as TSV (tab-separated values). Each input array will be printed as a single line. Fields are separated by a single tab (ascii `0x09`). Input characters line-feed (ascii `0x0a`), carriage-return (ascii `0x0d`), tab (ascii `0x09`) and backslash (ascii `0x5c`) will be output as escape sequences `\n`, `\r`, `\t`, `\\` respectively. * `@sh`: The input is escaped suitable for use in a command-line for a POSIX shell. If the input is an array, the output will be a series of space-separated strings. * `@base64`: The input is converted to base64 as specified by RFC 4648. * `@base64d`: The inverse of `@base64`, input is decoded as specified by RFC 4648. Note\: If the decoded string is not UTF-8, the results are undefined. This syntax can be combined with string interpolation in a useful way. You can follow a `@foo` token with a string literal. The contents of the string literal will *not* be escaped. However, all interpolations made inside that string literal will be escaped. For instance, @uri "https://www.google.com/search?q=\(.search)" will produce the following output for the input `{"search":"what is jq?"}`: "https://www.google.com/search?q=what%20is%20jq%3F" Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. examples: - program: '@html' input: '"This works if x < y"' output: ['"This works if x < y"'] - program: '@sh "echo \(.)"' input: "\"O'Hara's Ale\"" output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""] - program: '@base64' input: '"This is a message"' output: ['"VGhpcyBpcyBhIG1lc3NhZ2U="'] - program: '@base64d' input: '"VGhpcyBpcyBhIG1lc3NhZ2U="' output: ['"This is a message"'] - title: "Dates" body: | jq provides some basic date handling functionality, with some high-level and low-level builtins. In all cases these builtins deal exclusively with time in UTC. The `fromdateiso8601` builtin parses datetimes in the ISO 8601 format to a number of seconds since the Unix epoch (1970-01-01T00:00:00Z). The `todateiso8601` builtin does the inverse. The `fromdate` builtin parses datetime strings. Currently `fromdate` only supports ISO 8601 datetime strings, but in the future it will attempt to parse datetime strings in more formats. The `todate` builtin is an alias for `todateiso8601`. The `now` builtin outputs the current time, in seconds since the Unix epoch. Low-level jq interfaces to the C-library time functions are also provided: `strptime`, `strftime`, `strflocaltime`, `mktime`, `gmtime`, and `localtime`. Refer to your host operating system's documentation for the format strings used by `strptime` and `strftime`. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality. The `gmtime` builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of Greenwich Mean Time as an array of numbers representing (in this order): the year, the month (zero-based), the day of the month (one-based), the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year -- all one-based unless otherwise stated. The day of the week number may be wrong on some systems for dates before March 1st 1900, or after December 31 2099. The `localtime` builtin works like the `gmtime` builtin, but using the local timezone setting. The `mktime` builtin consumes "broken down time" representations of time output by `gmtime` and `strptime`. The `strptime(fmt)` builtin parses input strings matching the `fmt` argument. The output is in the "broken down time" representation consumed by `mktime` and output by `gmtime`. The `strftime(fmt)` builtin formats a time (GMT) with the given format. The `strflocaltime` does the same, but using the local timezone setting. The format strings for `strptime` and `strftime` are described in typical C library documentation. The format string for ISO 8601 datetime is `"%Y-%m-%dT%H:%M:%SZ"`. jq may not support some or all of this date functionality on some systems. In particular, the `%u` and `%j` specifiers for `strptime(fmt)` are not supported on macOS. examples: - program: 'fromdate' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")' input: '"2015-03-05T23:51:47Z"' output: ['[2015,2,5,23,51,47,4,63]'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")|mktime' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - title: "SQL-Style Operators" body: | jq provides a few SQL-style operators. * `INDEX(stream; index_expression)`: This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream. * `JOIN($idx; stream; idx_expr; join_expr)`: This builtin joins the values from the given stream to the given index. The index's keys are computed by applying the given index expression to each value from the given stream. An array of the value in the stream and the corresponding value from the index is fed to the given join expression to produce each result. * `JOIN($idx; stream; idx_expr)`: Same as `JOIN($idx; stream; idx_expr; .)`. * `JOIN($idx; idx_expr)`: This builtin joins the input `.` to the given index, applying the given index expression to `.` to compute the index key. The join operation is as described above. * `IN(s)`: This builtin outputs `true` if `.` appears in the given stream, otherwise it outputs `false`. * `IN(source; s)`: This builtin outputs `true` if any value in the source stream appears in the second stream, otherwise it outputs `false`. - title: "`builtins`" body: | Returns a list of all builtin functions in the format `name/arity`. Since functions with the same name but different arities are considered separate functions, `all/0`, `all/1`, and `all/2` would all be present in the list. - title: Conditionals and Comparisons entries: - title: "`==`, `!=`" body: | The expression 'a == b' will produce 'true' if the results of evaluating a and b are equal (that is, if they represent equivalent JSON values) and 'false' otherwise. In particular, strings are never considered equal to numbers. In checking for the equality of JSON objects, the ordering of keys is irrelevant. If you're coming from JavaScript, please note that jq's `==` is like JavaScript's `===`, the "strict equality" operator. != is "not equal", and 'a != b' returns the opposite value of 'a == b' examples: - program: '. == false' input: 'null' output: ['false'] - program: '. == {"b": {"d": (4 + 1e-20), "c": 3}, "a":1}' input: '{"a":1, "b": {"c": 3, "d": 4}}' output: ['true'] - program: '.[] == 1' input: '[1, 1.0, "1", "banana"]' output: ['true', 'true', 'false', 'false'] - title: if-then-else-end body: | `if A then B else C end` will act the same as `B` if `A` produces a value other than false or null, but act the same as `C` otherwise. `if A then B end` is the same as `if A then B else . end`. That is, the `else` branch is optional, and if absent is the same as `.`. This also applies to `elif` with absent ending `else` branch. Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you'll sometimes have to be more explicit about the condition you want. You can't test whether, e.g. a string is empty using `if .name then A else B end`; you'll need something like `if .name == "" then A else B end` instead. If the condition `A` produces multiple results, then `B` is evaluated once for each result that is not false or null, and `C` is evaluated once for each false or null. More cases can be added to an if using `elif A then B` syntax. examples: - program: |- if . == 0 then "zero" elif . == 1 then "one" else "many" end input: '2' output: ['"many"'] - title: "`>`, `>=`, `<=`, `<`" body: | The comparison operators `>`, `>=`, `<=`, `<` return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively). The ordering is the same as that described for `sort`, above. examples: - program: '. < 5' input: '2' output: ['true'] - title: "`and`, `or`, `not`" body: | jq supports the normal Boolean operators `and`, `or`, `not`. They have the same standard of truth as if expressions - `false` and `null` are considered "false values", and anything else is a "true value". If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input. `not` is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in `.foo and .bar | not`. These three only produce the values `true` and `false`, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default". If you want to use this form of "or", picking between two values rather than evaluating a condition, see the `//` operator below. examples: - program: '42 and "a string"' input: 'null' output: ['true'] - program: '(true, false) or false' input: 'null' output: ['true', 'false'] - program: '(true, true) and (true, false)' input: 'null' output: ['true', 'false', 'true', 'false'] - program: '[true, false | not]' input: 'null' output: ['[false, true]'] - title: "Alternative operator: `//`" body: | The `//` operator produces all the values of its left-hand side that are neither `false` nor `null`. If the left-hand side produces no values other than `false` or `null`, then `//` produces all the values of its right-hand side. A filter of the form `a // b` produces all the results of `a` that are not `false` or `null`. If `a` produces no results, or no results other than `false` or `null`, then `a // b` produces the results of `b`. This is useful for providing defaults: `.foo // 1` will evaluate to `1` if there's no `.foo` element in the input. It's similar to how `or` is sometimes used in Python (jq's `or` operator is reserved for strictly Boolean operations). Note: `some_generator // defaults_here` is not the same as `some_generator | . // defaults_here`. The latter will produce default values for all non-`false`, non-`null` values of the left-hand side, while the former will not. Precedence rules can make this confusing. For example, in `false, 1 // 2` the left-hand side of `//` is `1`, not `false, 1` -- `false, 1 // 2` parses the same way as `false, (1 // 2)`. In `(false, null, 1) | . // 42` the left-hand side of `//` is `.`, which always produces just one value, while in `(false, null, 1) // 42` the left-hand side is a generator of three values, and since it produces a value other `false` and `null`, the default `42` is not produced. examples: - program: 'empty // 42' input: 'null' output: ['42'] - program: '.foo // 42' input: '{"foo": 19}' output: ['19'] - program: '.foo // 42' input: '{}' output: ['42'] - program: '(false, null, 1) // 42' input: 'null' output: ['1'] - program: '(false, null, 1) | . // 42' input: 'null' output: ['42', '42', '1'] - title: try-catch body: | Errors can be caught by using `try EXP catch EXP`. The first expression is executed, and if it fails then the second is executed with the error message. The output of the handler, if any, is output as if it had been the output of the expression to try. The `try EXP` form uses `empty` as the exception handler. examples: - program: 'try .a catch ". is not an object"' input: 'true' output: ['". is not an object"'] - program: '[.[]|try .a]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: 'try error("some exception") catch .' input: 'true' output: ['"some exception"'] - title: Breaking out of control structures body: | A convenient use of try/catch is to break out of control structures like `reduce`, `foreach`, `while`, and so on. For example: # Repeat an expression until it raises "break" as an # error, then stop repeating without re-raising the error. # But if the error caught is not "break" then re-raise it. try repeat(exp) catch if .=="break" then empty else error jq has a syntax for named lexical labels to "break" or "go (back) to": label $out | ... break $out ... The `break $label_name` expression will cause the program to act as though the nearest (to the left) `label $label_name` produced `empty`. The relationship between the `break` and corresponding `label` is lexical: the label has to be "visible" from the break. To break out of a `reduce`, for example: label $out | reduce .[] as $item (null; if .==false then break $out else ... end) The following jq program produces a syntax error: break $out because no label `$out` is visible. - title: "Error Suppression / Optional Operator: `?`" body: | The `?` operator, used as `EXP?`, is shorthand for `try EXP`. examples: - program: '[.[] | .a?]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: '[.[] | tonumber?]' input: '["1", "invalid", "3", 4]' output: ['[1, 3, 4]'] - title: Regular expressions body: | jq uses the [Oniguruma regular expression library](https://github.com/kkos/oniguruma/blob/master/doc/RE), as do PHP, TextMate, Sublime Text, etc, so the description here will focus on jq specifics. Oniguruma supports several flavors of regular expression, so it is important to know that jq uses the ["Perl NG" (Perl with named groups)](https://github.com/kkos/oniguruma/blob/master/doc/SYNTAX.md) flavor. The jq regex filters are defined so that they can be used using one of these patterns: STRING | FILTER(REGEX) STRING | FILTER(REGEX; FLAGS) STRING | FILTER([REGEX]) STRING | FILTER([REGEX, FLAGS]) where: * STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation; * REGEX, after string interpolation, should be a valid regular expression; * FILTER is one of `test`, `match`, or `capture`, as described below. Since REGEX must evaluate to a JSON string, some characters that are needed to form a regular expression must be escaped. For example, the regular expression `\s` signifying a whitespace character would be written as `"\\s"`. FLAGS is a string consisting of one of more of the supported flags: * `g` - Global search (find all matches, not just the first) * `i` - Case insensitive search * `m` - Multi line mode (`.` will match newlines) * `n` - Ignore empty matches * `p` - Both s and m modes are enabled * `s` - Single line mode (`^` -> `\A`, `$` -> `\Z`) * `l` - Find longest possible matches * `x` - Extended regex format (ignore whitespace and comments) To match a whitespace with the `x` flag, use `\s`, e.g. jq -n '"a b" | test("a\\sb"; "x")' Note that certain flags may also be specified within REGEX, e.g. jq -n '("test", "TEst", "teST", "TEST") | test("(?i)te(?-i)st")' evaluates to: `true`, `true`, `false`, `false`. entries: - title: "`test(val)`, `test(regex; flags)`" body: | Like `match`, but does not return match objects, only `true` or `false` for whether or not the regex matches the input. examples: - program: 'test("foo")' input: '"foo"' output: ['true'] - program: '.[] | test("a b c # spaces are ignored"; "ix")' input: '["xabcd", "ABC"]' output: ['true', 'true'] - title: "`match(val)`, `match(regex; flags)`" body: | **match** outputs an object for each match it finds. Matches have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of the match * `string` - the string that it matched * `captures` - an array of objects representing capturing groups. Capturing group objects have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of this capturing group * `string` - the string that was captured * `name` - the name of the capturing group (or `null` if it was unnamed) Capturing groups that did not match anything return an offset of -1 examples: - program: 'match("(abc)+"; "g")' input: '"abc abc"' output: - '{"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]}' - '{"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]}' - program: 'match("foo")' input: '"foo bar foo"' output: ['{"offset": 0, "length": 3, "string": "foo", "captures": []}'] - program: 'match(["foo", "ig"])' input: '"foo bar FOO"' output: - '{"offset": 0, "length": 3, "string": "foo", "captures": []}' - '{"offset": 8, "length": 3, "string": "FOO", "captures": []}' - program: 'match("foo (?bar)? foo"; "ig")' input: '"foo bar foo foo foo"' output: - '{"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]}' - '{"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}' - program: '[ match("."; "g")] | length' input: '"abc"' output: ['3'] - title: "`capture(val)`, `capture(regex; flags)`" body: | Collects the named captures in a JSON object, with the name of each capture as the key, and the matched string as the corresponding value. examples: - program: 'capture("(?[a-z]+)-(?[0-9]+)")' input: '"xyzzy-14"' output: ['{ "a": "xyzzy", "n": "14" }'] - title: "`scan(regex)`, `scan(regex; flags)`" body: | Emit a stream of the non-overlapping substrings of the input that match the regex in accordance with the flags, if any have been specified. If there is no match, the stream is empty. To capture all the matches for each input string, use the idiom `[ expr ]`, e.g. `[ scan(regex) ]`. If the regex contains capturing groups, the filter emits a stream of arrays, each of which contains the captured strings. examples: - program: 'scan("c")' input: '"abcdefabc"' output: ['"c"', '"c"'] - program: 'scan("(a+)(b+)")' input: '"abaabbaaabbb"' output: ['["a","b"]', '["aa","bb"]', '["aaa","bbb"]'] - title: "`split(regex; flags)`" body: | Splits an input string on each regex match. For backwards compatibility, when called with a single argument, `split` splits on a string, not a regex. examples: - program: 'split(", *"; null)' input: '"ab,cd, ef"' output: ['["ab","cd","ef"]'] - title: "`splits(regex)`, `splits(regex; flags)`" body: | These provide the same results as their `split` counterparts, but as a stream instead of an array. examples: - program: 'splits(", *")' input: '"ab,cd, ef, gh"' output: ['"ab"','"cd"','"ef"','"gh"'] - program: 'splits(",? *"; "n")' input: '"ab,cd ef, gh"' output: ['"ab"','"cd"','"ef"','"gh"'] - title: "`sub(regex; tostring)`, `sub(regex; tostring; flags)`" body: | Emit the string obtained by replacing the first match of regex in the input string with `tostring`, after interpolation. `tostring` should be a jq string or a stream of such strings, each of which may contain references to named captures. The named captures are, in effect, presented as a JSON object (as constructed by `capture`) to `tostring`, so a reference to a captured variable named "x" would take the form: `"\(.x)"`. examples: - program: 'sub("[^a-z]*(?[a-z]+)"; "Z\(.x)"; "g")' input: '"123abc456def"' output: ['"ZabcZdef"'] - program: '[sub("(?.)"; "\(.a|ascii_upcase)", "\(.a|ascii_downcase)")]' input: '"aB"' output: ['["AB","aB"]'] - title: "`gsub(regex; tostring)`, `gsub(regex; tostring; flags)`" body: | `gsub` is like `sub` but all the non-overlapping occurrences of the regex are replaced by `tostring`, after interpolation. If the second argument is a stream of jq strings, then `gsub` will produce a corresponding stream of JSON strings. examples: - program: 'gsub("(?.)[^a]*"; "+\(.x)-")' input: '"Abcabc"' output: ['"+A-+a-"'] - program: '[gsub("p"; "a", "b")]' input: '"p"' output: ['["a","b"]'] - title: Advanced features body: | Variables are an absolute necessity in most programming languages, but they're relegated to an "advanced feature" in jq. In most languages, variables are the only means of passing around data. If you calculate a value, and you want to use it more than once, you'll need to store it in a variable. To pass a value to another part of the program, you'll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data. It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq's standard library (many jq functions such as `map` and `select` are in fact written in jq). jq has reduction operators, which are very powerful but a bit tricky. Again, these are mostly used internally, to define some useful bits of jq's standard library. It may not be obvious at first, but jq is all about generators (yes, as often found in other languages). Some utilities are provided to help deal with generators. Some minimal I/O support (besides reading JSON from standard input, and writing JSON to standard output) is available. Finally, there is a module/library system. entries: - title: "Variable / Symbolic Binding Operator: `... as $identifier | ...`" body: | In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next. Many expressions, for instance `a + b`, pass their input to two distinct subexpressions (here `a` and `b` are both passed the same input), so variables aren't usually necessary in order to use a value twice. For instance, calculating the average value of an array of numbers requires a few variables in most languages - at least one to hold the array, perhaps one for each element or for a loop counter. In jq, it's simply `add / length` - the `add` expression is given the array and produces its sum, and the `length` expression is given the array and produces its length. So, there's generally a cleaner way to solve most problems in jq than defining variables. Still, sometimes they do make things easier, so jq lets you define variables using `expression as $variable`. All variable names start with `$`. Here's a slightly uglier version of the array-averaging example: length as $array_length | add / $array_length We'll need a more complicated problem to find a situation where using variables actually makes our lives easier. Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names. Our input looks like: {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} We want to produce the posts with the author field containing a real name, as in: {"title": "First post", "author": "Anonymous Coward"} {"title": "A well-written article", "author": "Person McPherson"} We use a variable, `$names`, to store the realnames object, so that we can refer to it later when looking up author usernames: .realnames as $names | .posts[] | {title, author: $names[.author]} The expression `exp as $x | ...` means: for each value of expression `exp`, run the rest of the pipeline with the entire original input, and with `$x` set to that value. Thus `as` functions as something of a foreach loop. Just as `{foo}` is a handy way of writing `{foo: .foo}`, so `{$foo}` is a handy way of writing `{foo: $foo}`. Multiple variables may be declared using a single `as` expression by providing a pattern that matches the structure of the input (this is known as "destructuring"): . as {realnames: $names, posts: [$first, $second]} | ... The variable declarations in array patterns (e.g., `. as [$first, $second]`) bind to the elements of the array in from the element at index zero on up, in order. When there is no value at the index for an array pattern element, `null` is bound to that variable. Variables are scoped over the rest of the expression that defines them, so .realnames as $names | (.posts[] | {title, author: $names[.author]}) will work, but (.realnames as $names | .posts[]) | {title, author: $names[.author]} won't. For programming language theorists, it's more accurate to say that jq variables are lexically-scoped bindings. In particular there's no way to change the value of a binding; one can only setup a new binding with the same name, but which will not be visible where the old one was. examples: - program: '.bar as $x | .foo | . + $x' input: '{"foo":10, "bar":200}' output: ['210'] - program: '. as $i|[(.*2|. as $i| $i), $i]' input: '5' output: ['[10,5]'] - program: '. as [$a, $b, {c: $c}] | $a + $b + $c' input: '[2, 3, {"c": 4, "d": 5}]' output: ['9'] - program: '.[] as [$a, $b] | {a: $a, b: $b}' input: '[[0], [0, 1], [2, 1, 0]]' output: ['{"a":0,"b":null}', '{"a":0,"b":1}', '{"a":2,"b":1}'] - title: 'Destructuring Alternative Operator: `?//`' body: | The destructuring alternative operator provides a concise mechanism for destructuring an input that can take one of several forms. Suppose we have an API that returns a list of resources and events associated with them, and we want to get the user_id and timestamp of the first event for each resource. The API (having been clumsily converted from XML) will only wrap the events in an array if the resource has multiple events: {"resources": [{"id": 1, "kind": "widget", "events": {"action": "create", "user_id": 1, "ts": 13}}, {"id": 2, "kind": "widget", "events": [{"action": "create", "user_id": 1, "ts": 14}, {"action": "destroy", "user_id": 1, "ts": 15}]}]} We can use the destructuring alternative operator to handle this structural change simply: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$user_id, $ts}]} | {$user_id, $kind, $id, $ts} Or, if we aren't sure if the input is an array of values or an object: .[] as [$id, $kind, $user_id, $ts] ?// {$id, $kind, $user_id, $ts} | ... Each alternative need not define all of the same variables, but all named variables will be available to the subsequent expression. Variables not matched in the alternative that succeeded will be `null`: .resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$first_user_id, $first_ts}]} | {$user_id, $first_user_id, $kind, $id, $ts, $first_ts} Additionally, if the subsequent expression returns an error, the alternative operator will attempt to try the next binding. Errors that occur during the final alternative are passed through. [[3]] | .[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end examples: - program: '.[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":4}', '{"a":1,"b":2,"d":3,"e":4}'] - program: '.[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e}' input: '[{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}]' output: ['{"a":1,"b":2,"d":3,"e":null}', '{"a":1,"b":2,"d":null,"e":4}'] - program: '.[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end' input: '[[3]]' output: ['{"a":null,"b":3}'] - title: 'Defining Functions' body: | You can give a filter a name using "def" syntax: def increment: . + 1; From then on, `increment` is usable as a filter just like a builtin function (in fact, this is how many of the builtins are defined). A function may take arguments: def map(f): [.[] | f]; Arguments are passed as _filters_ (functions with no arguments), _not_ as values. The same argument may be referenced multiple times with different inputs (here `f` is run for each element of the input array). Arguments to a function work more like callbacks than like value arguments. This is important to understand. Consider: def foo(f): f|f; 5|foo(.*2) The result will be 20 because `f` is `.*2`, and during the first invocation of `f` `.` will be 5, and the second time it will be 10 (5 * 2), so the result will be 20. Function arguments are filters, and filters expect an input when invoked. If you want the value-argument behaviour for defining simple functions, you can just use a variable: def addvalue(f): f as $f | map(. + $f); Or use the short-hand: def addvalue($f): ...; With either definition, `addvalue(.foo)` will add the current input's `.foo` field to each element of the array. Do note that calling `addvalue(.[])` will cause the `map(. + $f)` part to be evaluated once per value in the value of `.` at the call site. Multiple definitions using the same function name are allowed. Each re-definition replaces the previous one for the same number of function arguments, but only for references from functions (or main program) subsequent to the re-definition. See also the section below on scoping. examples: - program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))' input: '[[1,2],[10,20]]' output: ['[[1,2,1], [10,20,10]]'] - program: 'def addvalue(f): f as $x | map(. + $x); addvalue(.[0])' input: '[[1,2],[10,20]]' output: ['[[1,2,1,2], [10,20,1,2]]'] - title: 'Scoping' body: | There are two types of symbols in jq: value bindings (a.k.a., "variables"), and functions. Both are scoped lexically, with expressions being able to refer only to symbols that have been defined "to the left" of them. The only exception to this rule is that functions can refer to themselves so as to be able to create recursive functions. For example, in the following expression there is a binding which is visible "to the right" of it, `... | .*3 as $times_three | [. + $times_three] | ...`, but not "to the left". Consider this expression now, `... | (.*3 as $times_three | [. + $times_three]) | ...`: here the binding `$times_three` is _not_ visible past the closing parenthesis. - title: "`isempty(exp)`" body: | Returns true if `exp` produces no outputs, false otherwise. examples: - program: 'isempty(empty)' input: 'null' output: ['true'] - program: 'isempty(.[])' input: '[]' output: ['true'] - program: 'isempty(.[])' input: '[1,2,3]' output: ['false'] - title: "`limit(n; expr)`" body: | The `limit` function extracts up to `n` outputs from `expr`. examples: - program: '[limit(3; .[])]' input: '[0,1,2,3,4,5,6,7,8,9]' output: ['[0,1,2]'] - title: "`skip(n; expr)`" body: | The `skip` function skips the first `n` outputs from `expr`. examples: - program: '[skip(3; .[])]' input: '[0,1,2,3,4,5,6,7,8,9]' output: ['[3,4,5,6,7,8,9]'] - title: "`first(expr)`, `last(expr)`, `nth(n; expr)`" body: | The `first(expr)` and `last(expr)` functions extract the first and last values from `expr`, respectively. The `nth(n; expr)` function extracts the nth value output by `expr`. Note that `nth(n; expr)` doesn't support negative values of `n`. examples: - program: '[first(range(.)), last(range(.)), nth(5; range(.))]' input: '10' output: ['[0,9,5]'] - program: '[first(empty), last(empty), nth(5; empty)]' input: 'null' output: ['[]'] - title: "`first`, `last`, `nth(n)`" body: | The `first` and `last` functions extract the first and last values from any array at `.`. The `nth(n)` function extracts the nth value of any array at `.`. examples: - program: '[range(.)]|[first, last, nth(5)]' input: '10' output: ['[0,9,5]'] - title: "`reduce`" body: | The `reduce` syntax allows you to combine all of the results of an expression by accumulating them into a single answer. The form is `reduce EXP as $var (INIT; UPDATE)`. As an example, we'll pass `[1,2,3]` to this expression: reduce .[] as $item (0; . + $item) For each result that `.[]` produces, `. + $item` is run to accumulate a running total, starting from 0 as the input value. In this example, `.[]` produces the results `1`, `2`, and `3`, so the effect is similar to running something like this: 0 | 1 as $item | . + $item | 2 as $item | . + $item | 3 as $item | . + $item examples: - program: 'reduce .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['15'] - program: 'reduce .[] as [$i,$j] (0; . + $i * $j)' input: '[[1,2],[3,4],[5,6]]' output: ['44'] - program: 'reduce .[] as {$x,$y} (null; .x += $x | .y += [$y])' input: '[{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}]' output: ['{"x":"abc","y":[1,2,3]}'] - title: "`foreach`" body: | The `foreach` syntax is similar to `reduce`, but intended to allow the construction of `limit` and reducers that produce intermediate results. The form is `foreach EXP as $var (INIT; UPDATE; EXTRACT)`. As an example, we'll pass `[1,2,3]` to this expression: foreach .[] as $item (0; . + $item; [$item, . * 2]) Like the `reduce` syntax, `. + $item` is run for each result that `.[]` produces, but `[$item, . * 2]` is run for each intermediate values. In this example, since the intermediate values are `1`, `3`, and `6`, the `foreach` expression produces `[1,2]`, `[2,6]`, and `[3,12]`. So the effect is similar to running something like this: 0 | 1 as $item | . + $item | [$item, . * 2], 2 as $item | . + $item | [$item, . * 2], 3 as $item | . + $item | [$item, . * 2] When `EXTRACT` is omitted, the identity filter is used. That is, it outputs the intermediate values as they are. examples: - program: 'foreach .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['1','3','6','10','15'] - program: 'foreach .[] as $item (0; . + $item; [$item, . * 2])' input: '[1,2,3,4,5]' output: ['[1,2]','[2,6]','[3,12]','[4,20]','[5,30]'] - program: 'foreach .[] as $item (0; . + 1; {index: ., $item})' input: '["foo", "bar", "baz"]' output: - '{"index":1,"item":"foo"}' - '{"index":2,"item":"bar"}' - '{"index":3,"item":"baz"}' - title: Recursion body: | As described above, `recurse` uses recursion, and any jq function can be recursive. The `while` builtin is also implemented in terms of recursion. Tail calls are optimized whenever the expression to the left of the recursive call outputs its last value. In practice this means that the expression to the left of the recursive call should not produce more than one output for each input. For example: def recurse(f): def r: ., (f | select(. != null) | r); r; def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; def repeat(exp): def _repeat: exp, _repeat; _repeat; - title: Generators and iterators body: | Some jq operators and functions are actually generators in that they can produce zero, one, or more values for each input, just as one might expect in other programming languages that have generators. For example, `.[]` generates all the values in its input (which must be an array or an object), `range(0; 10)` generates the integers between 0 and 10, and so on. Even the comma operator is a generator, generating first the values generated by the expression to the left of the comma, then the values generated by the expression on the right of the comma. The `empty` builtin is the generator that produces zero outputs. The `empty` builtin backtracks to the preceding generator expression. All jq functions can be generators just by using builtin generators. It is also possible to construct new generators using only recursion and the comma operator. If recursive calls are "in tail position" then the generator will be efficient. In the example below the recursive call by `_range` to itself is in tail position. The example shows off three advanced topics: tail recursion, generator construction, and sub-functions. examples: - program: 'def range(init; upto; by): def _range: if (by > 0 and . < upto) or (by < 0 and . > upto) then ., ((.+by)|_range) else empty end; if init == upto then empty elif by == 0 then init else init|_range end; range(0; 10; 3)' input: 'null' output: ['0', '3', '6', '9'] - program: 'def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; [while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: 'Math' body: | jq currently only has IEEE754 double-precision (64-bit) floating point number support. Besides simple arithmetic operators such as `+`, jq also has most standard math functions from the C math library. C math functions that take a single input argument (e.g., `sin()`) are available as zero-argument jq functions. C math functions that take two input arguments (e.g., `pow()`) are available as two-argument jq functions that ignore `.`. C math functions that take three input arguments are available as three-argument jq functions that ignore `.`. Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library. Unavailable math functions will be defined but will raise an error. One-input C math functions: `acos` `acosh` `asin` `asinh` `atan` `atanh` `cbrt` `ceil` `cos` `cosh` `erf` `erfc` `exp` `exp10` `exp2` `expm1` `fabs` `floor` `gamma` `j0` `j1` `lgamma` `log` `log10` `log1p` `log2` `logb` `nearbyint` `rint` `round` `significand` `sin` `sinh` `sqrt` `tan` `tanh` `tgamma` `trunc` `y0` `y1`. Two-input C math functions: `atan2` `copysign` `drem` `fdim` `fmax` `fmin` `fmod` `frexp` `hypot` `jn` `ldexp` `modf` `nextafter` `nexttoward` `pow` `remainder` `scalb` `scalbln` `yn`. Three-input C math functions: `fma`. See your system's manual for more information on each of these. - title: 'I/O' body: | At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read. Two builtins functions are provided for this, `input` and `inputs`, that read from the same sources (e.g., `stdin`, files named on the command-line) as jq itself. These two builtins, and jq's own reading actions, can be interleaved with each other. They are commonly used in combination with the null input option `-n` to prevent one input from being read implicitly. Two builtins provide minimal output capabilities, `debug`, and `stderr`. (Recall that a jq program's output values are always output as JSON texts on `stdout`.) The `debug` builtin can have application-specific behavior, such as for executables that use the libjq C API but aren't the jq executable itself. The `stderr` builtin outputs its input in raw mode to stderr with no additional decoration, not even a newline. Most jq builtins are referentially transparent, and yield constant and repeatable value streams when applied to constant inputs. This is not true of I/O builtins. entries: - title: "`input`" body: | Outputs one new input. Note that when using `input` it is generally necessary to invoke jq with the `-n` command-line option, otherwise the first entity will be lost. echo 1 2 3 4 | jq '[., input]' # [1,2] [3,4] - title: "`inputs`" body: | Outputs all remaining inputs, one by one. This is primarily useful for reductions over a program's inputs. Note that when using `inputs` it is generally necessary to invoke jq with the `-n` command-line option, otherwise the first entity will be lost. echo 1 2 3 | jq -n 'reduce inputs as $i (0; . + $i)' # 6 - title: "`debug`, `debug(msgs)`" body: | These two filters are like `.` but have as a side-effect the production of one or more messages on stderr. The message produced by the `debug` filter has the form ["DEBUG:",] where `` is a compact rendition of the input value. This format may change in the future. The `debug(msgs)` filter is defined as `(msgs | debug | empty), .` thus allowing great flexibility in the content of the message, while also allowing multi-line debugging statements to be created. For example, the expression: 1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1) would produce the value 3 but with the following two lines being written to stderr: ["DEBUG:","Entering function foo with $x == 1"] ["DEBUG:",2] - title: "`stderr`" body: | Prints its input in raw and compact mode to stderr with no additional decoration, not even a newline. - title: "`input_filename`" body: | Returns the name of the file whose input is currently being filtered. Note that this will not work well unless jq is running in a UTF-8 locale. - title: "`input_line_number`" body: | Returns the line number of the input currently being filtered. - title: 'Streaming' body: | With the `--stream` option jq can parse input texts in a streaming fashion, allowing jq programs to start processing large JSON texts immediately rather than after the parse completes. If you have a single JSON text that is 1GB in size, streaming it will allow you to process it much more quickly. However, streaming isn't easy to deal with as the jq program will have `[, ]` (and a few other forms) as inputs. Several builtins are provided to make handling streams easier. The examples below use the streamed form of `["a",["b"]]`, which is `[[0],"a"],[[1,0],"b"],[[1,0]],[[1]]`. Streaming forms include `[, ]` (to indicate any scalar value, empty array, or empty object), and `[]` (to indicate the end of an array or object). Future versions of jq run with `--stream` and `--seq` may output additional forms such as `["error message"]` when an input text fails to parse. entries: - title: "`truncate_stream(stream_expression)`" body: | Consumes a number as input and truncates the corresponding number of path elements from the left of the outputs of the given streaming expression. examples: - program: 'truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]])' input: '1' output: ['[[0],"b"]', '[[0]]'] - title: "`fromstream(stream_expression)`" body: | Outputs values corresponding to the stream expression's outputs. examples: - program: 'fromstream(1|truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]]))' input: 'null' output: ['["b"]'] - title: "`tostream`" body: | The `tostream` builtin outputs the streamed form of its input. examples: - program: '. as $dot|fromstream($dot|tostream)|.==$dot' input: '[0,[1,{"a":1},{"b":2}]]' output: ['true'] - title: Assignment body: | Assignment works a little differently in jq than in most programming languages. jq doesn't distinguish between references to and copies of something - two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object". If an object has two fields which are arrays, `.foo` and `.bar`, and you append something to `.foo`, then `.bar` will not get bigger, even if you've previously set `.bar = .foo`. If you're used to programming in languages like Python, Java, Ruby, JavaScript, etc. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance it doesn't actually do that, but that's the general idea). This means that it's impossible to build circular values in jq (such as an array whose first element is itself). This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON. All the assignment operators in jq have path expressions on the left-hand side (LHS). The right-hand side (RHS) provides values to set to the paths named by the LHS path expressions. Values in jq are always immutable. Internally, assignment works by using a reduction to compute new, replacement values for `.` that have had all the desired assignments applied to `.`, then outputting the modified value. This might be made clear by this example: `{a:{b:{c:1}}} | (.a.b|=3), .`. This will output `{"a":{"b":3}}` and `{"a":{"b":{"c":1}}}` because the last sub-expression, `.`, sees the original value, not the modified value. Most users will want to use modification assignment operators, such as `|=` or `+=`, rather than `=`. Note that the LHS of assignment operators refers to a value in `.`. Thus `$var.foo = 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo = 1` instead. Note too that `.a,.b=0` does not set `.a` and `.b`, but `(.a,.b)=0` sets both. entries: - title: "Update-assignment: `|=`" body: | This is the "update" operator `|=`. It takes a filter on the right-hand side and works out the new value for the property of `.` being assigned to by running the old value through this expression. For instance, `(.foo, .bar) |= .+1` will build an object with the `foo` field set to the input's `foo` plus 1, and the `bar` field set to the input's `bar` plus 1. The left-hand side can be any general path expression; see `path()`. Note that the left-hand side of `|=` refers to a value in `.`. Thus `$var.foo |= . + 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo |= . + 1` instead. If the right-hand side outputs no values (i.e., `empty`), then the left-hand side path will be deleted, as with `del(path)`. If the right-hand side outputs multiple values, only the first one will be used (COMPATIBILITY NOTE: in jq 1.5 and earlier releases, it used to be that only the last one was used). examples: - program: '(..|select(type=="boolean")) |= if . then 1 else 0 end' input: '[true,false,[5,true,[true,[false]],false]]' output: ['[1,0,[5,1,[1,[0]],0]]'] - title: "Arithmetic update-assignment: `+=`, `-=`, `*=`, `/=`, `%=`, `//=`" body: | jq has a few operators of the form `a op= b`, which are all equivalent to `a |= . op b`. So, `+= 1` can be used to increment values, being the same as `|= . + 1`. examples: - program: .foo += 1 input: '{"foo": 42}' output: ['{"foo": 43}'] - title: "Plain assignment: `=`" body: | This is the plain assignment operator. Unlike the others, the input to the right-hand side (RHS) is the same as the input to the left-hand side (LHS) rather than the value at the LHS path, and all values output by the RHS will be used (as shown below). If the RHS of `=` produces multiple values, then for each such value jq will set the paths on the left-hand side to the value and then it will output the modified `.`. For example, `(.a,.b) = range(2)` outputs `{"a":0,"b":0}`, then `{"a":1,"b":1}`. The "update" assignment forms (see above) do not do this. This example should show the difference between `=` and `|=`: Provide input `{"a": {"b": 10}, "b": 20}` to the programs .a = .b and .a |= .b The former will set the `a` field of the input to the `b` field of the input, and produce the output `{"a": 20, "b": 20}`. The latter will set the `a` field of the input to the `a` field's `b` field, producing `{"a": 10, "b": 20}`. examples: - program: .a = .b input: '{"a": {"b": 10}, "b": 20}' output: ['{"a":20,"b":20}'] - program: .a |= .b input: '{"a": {"b": 10}, "b": 20}' output: ['{"a":10,"b":20}'] - program: (.a, .b) = range(3) input: 'null' output: - '{"a":0,"b":0}' - '{"a":1,"b":1}' - '{"a":2,"b":2}' - program: (.a, .b) |= range(3) input: 'null' output: ['{"a":0,"b":0}'] - title: Complex assignments body: | Lots more things are allowed on the left-hand side of a jq assignment than in most languages. We've already seen simple field accesses on the left hand side, and it's no surprise that array accesses work just as well: .posts[0].title = "JQ Manual" What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: .posts[].comments |= . + ["this is great"] That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts). When jq encounters an assignment like 'a = b', it records the "path" taken to select a part of the input document while executing a. This path is then used to find which part of the input to change while executing the assignment. Any filter may be used on the left-hand side of an equals - whichever paths it selects from the input will be where the assignment is performed. This is a very powerful operation. Suppose we wanted to add a comment to blog posts, using the same "blog" input above. This time, we only want to comment on the posts written by "stedolan". We can find those posts using the "select" function described earlier: .posts[] | select(.author == "stedolan") The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] - title: Comments body: | You can write comments in your jq filters using `#`. A `#` character (not part of a string) starts a comment. All characters from `#` to the end of the line are ignored. If the end of the line is preceded by an odd number of backslash characters, the following line is also considered part of the comment and is ignored. For example, the following code outputs `[1,3,4,7]` [ 1, # foo \ 2, # bar \\ 3, 4, # baz \\\ 5, \ 6, 7 # comment \ comment \ comment ] Backslash continuing the comment on the next line can be useful when writing the "shebang" for a jq script: #!/bin/sh -- # total - Output the sum of the given arguments (or stdin) # usage: total [numbers...] # \ exec jq --args -MRnf -- "$0" "$@" $ARGS.positional | reduce ( if . == [] then inputs else .[] end | . as $dot | try tonumber catch false | if not or isnan then @json "total: Invalid number \($dot).\n" | halt_error(1) end ) as $n (0; . + $n) The `exec` line is considered a comment by jq, so it is ignored. But it is not ignored by `sh`, since in `sh` a backslash at the end of the line does not continue the comment. With this trick, when the script is invoked as `total 1 2`, `/bin/sh -- /path/to/total 1 2` will be run, and `sh` will then run `exec jq --args -MRnf -- /path/to/total 1 2` replacing itself with a `jq` interpreter invoked with the specified options (`-M`, `-R`, `-n`, `--args`), that evaluates the current file (`$0`), with the arguments (`$@`) that were passed to `sh`. - title: Modules body: | jq has a library/module system. Modules are files whose names end in `.jq`. Modules imported by a program are searched for in a default search path (see below). The `import` and `include` directives allow the importer to alter this path. Paths in the search path are subject to various substitutions. For paths starting with `~/`, the user's home directory is substituted for `~`. For paths starting with `$ORIGIN/`, the directory where the jq executable is located is substituted for `$ORIGIN`. For paths starting with `./` or paths that are `.`, the path of the including file is substituted for `.`. For top-level programs given on the command-line, the current directory is used. Import directives can optionally specify a search path to which the default is appended. The default search path is the search path given to the `-L` command-line option, else `["~/.jq", "$ORIGIN/../lib/jq", "$ORIGIN/../lib"]`. Null and empty string path elements terminate search path processing. A dependency with relative path `foo/bar` would be searched for in `foo/bar.jq` and `foo/bar/bar.jq` in the given search path. This is intended to allow modules to be placed in a directory along with, for example, version control files, README files, and so on, but also to allow for single-file modules. Consecutive components with the same name are not allowed to avoid ambiguities (e.g., `foo/foo`). For example, with `-L$HOME/.jq` a module `foo` can be found in `$HOME/.jq/foo.jq` and `$HOME/.jq/foo/foo.jq`. If `.jq` exists in the user's home directory, and is a file (not a directory), it is automatically sourced into the main program. entries: - title: "`import RelativePathString as NAME [];`" body: | Imports a module found at the given path relative to a directory in a search path. A `.jq` suffix will be added to the relative path string. The module's symbols are prefixed with `NAME::`. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The `search` key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`include RelativePathString [];`" body: | Imports a module found at the given path relative to a directory in a search path as if it were included in place. A `.jq` suffix will be added to the relative path string. The module's symbols are imported into the caller's namespace as if the module's content had been included directly. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. - title: "`import RelativePathString as $NAME [];`" body: | Imports a JSON file found at the given path relative to a directory in a search path. A `.json` suffix will be added to the relative path string. The file's data will be available as `$NAME::NAME`. The optional metadata must be a constant jq expression. It should be an object with keys like `homepage` and so on. At this time jq only uses the `search` key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The `search` key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`module ;`" body: | This directive is entirely optional. It's not required for proper operation. It serves only the purpose of providing metadata that can be read with the `modulemeta` builtin. The metadata must be a constant jq expression. It should be an object with keys like `homepage`. At this time jq doesn't use this metadata, but it is made available to users via the `modulemeta` builtin. - title: "`modulemeta`" body: | Takes a module name as input and outputs the module's metadata as an object, with the module's imports (including metadata) as an array value for the `deps` key and the module's defined functions as an array value for the `defs` key. Programs can use this to query a module's metadata, which they could then use to, for example, search for, download, and install missing dependencies. - title: Colors body: | To configure alternative colors just set the `JQ_COLORS` environment variable to colon-delimited list of partial terminal escape sequences like `"1;31"`, in this order: - color for `null` - color for `false` - color for `true` - color for numbers - color for strings - color for arrays - color for objects - color for object keys The default color scheme is the same as setting `JQ_COLORS="0;90:0;39:0;39:0;39:0;32:1;39:1;39:1;34"`. This is not a manual for VT100/ANSI escapes. However, each of these color specifications should consist of two numbers separated by a semi-colon, where the first number is one of these: - 1 (bright) - 2 (dim) - 4 (underscore) - 5 (blink) - 7 (reverse) - 8 (hidden) and the second is one of these: - 30 (black) - 31 (red) - 32 (green) - 33 (yellow) - 34 (blue) - 35 (magenta) - 36 (cyan) - 37 (white) jq-1.8.2/docs/content/manual/v1.5/0000755000175100017510000000000015215513536012255 5jq-1.8.2/docs/content/manual/v1.5/manual.yml0000644000175100017510000032714315215513536014207 --- headline: jq 1.5 Manual body: | A jq program is a "filter": it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks. Filters can be combined in various ways - you can pipe the output of one filter into another filter, or collect the output of a filter into an array. Some filters produce multiple results, for instance there's one that produces all the elements of its input array. Piping that filter into a second runs the second filter for each element of the array. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq. It's important to remember that every filter has an input and an output. Even literals like "hello" or 42 are filters - they take an input but always produce the same literal as output. Operations that combine two filters, like addition, generally feed the same input to both and combine the results. So, you can implement an averaging filter as `add / length` - feeding the input array both to the `add` filter and the `length` filter and then performing the division. But that's getting ahead of ourselves. :) Let's start with something simpler: manpage_intro: | jq(1) -- Command-line JSON processor ==================================== ## SYNOPSIS `jq` [...] [...] `jq` can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents. For instance, running the command `jq 'map(.price) | add'` will take an array of JSON objects as input and return the sum of their "price" fields. `jq` can accept text input as well, but by default, `jq` reads a stream of JSON entities (including numbers and other literals) from `stdin`. Whitespace is only needed to separate entities such as 1 and 2, and true and false. One or more may be specified, in which case `jq` will read input from those instead. The are described in the [INVOKING JQ] section; they mostly concern input and output formatting. The is written in the jq language and specifies how to transform the input file or document. ## FILTERS manpage_epilogue: | ## BUGS Presumably. Report them or discuss them at: https://github.com/jqlang/jq/issues ## AUTHOR Stephen Dolan `` sections: - title: Invoking jq body: | jq filters run on a stream of JSON data. The input to jq is parsed as a sequence of whitespace-separated JSON values which are passed through the provided filter one at a time. The output(s) of the filter are written to standard output, as a sequence of newline-separated JSON data. Note: it is important to mind the shell's quoting rules. As a general rule it's best to always quote (with single-quote characters) the jq program, as too many characters with special meaning to jq are also shell meta-characters. For example, `jq "foo"` will fail on most Unix shells because that will be the same as `jq foo`, which will generally fail because `foo is not defined`. When using the Windows command shell (cmd.exe) it's best to use double quotes around your jq program when given on the command-line (instead of the `-f program-file` option), but then double-quotes in the jq program need backslash escaping. You can affect how jq reads and writes its input and output using some command-line options: * `--null-input` / `-n`: Don't read any input at all. Instead, the filter is run once using `null` as the input. This is useful when using jq as a simple calculator or to construct JSON data from scratch. * `--raw-input` / `-R`: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with `--slurp`, then the entire input is passed to the filter as a single long string. * `--slurp` / `-s`: Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. * `--compact-output` / `-c`: By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. * `--raw-output` / `-r`: With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. * `--join-output` / `-j`: Like `-r` but jq won't print a newline after each output. * `--ascii-output` / `-a`: jq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences (like "\u03bc"). Using this option, you can force jq to produce pure ASCII output with every non-ASCII character replaced with the equivalent escape sequence. * `--sort-keys` / `-S`: Output the fields of each object with the keys in sorted order. * `--color-output` / `-C` and `--monochrome-output` / `-M`: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using `-C`, and disable color with `-M`. * `--tab`: Use a tab for each indentation level instead of two spaces. * `--indent n`: Use the given number of spaces (no more than 7) for indentation. * `--unbuffered`: Flush the output after each JSON object is printed (useful if you're piping a slow data source into jq and piping jq's output elsewhere). * `--stream`: Parse the input in streaming fashion, outputting arrays of path and leaf values (scalars and empty arrays or empty objects). For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]` becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`. This is useful for processing very large inputs. Use this in conjunction with filtering and the `reduce` and `foreach` syntax to reduce large inputs incrementally. * `--seq`: Use the `application/json-seq` MIME type scheme for separating JSON texts in jq's input and output. This means that an ASCII RS (record separator) character is printed before each value on output and an ASCII LF (line feed) is printed after every output. Input JSON texts that fail to parse are ignored (but warned about), discarding all subsequent input until the next RS. This mode also parses the output of jq without the `--seq` option. * `-f filename` / `--from-file filename`: Read filter from the file rather than from a command line, like awk's -f option. You can also use '#' to make comments. * `-L directory`: Prepend `directory` to the search list for modules. If this option is used then no builtin search list is used. See the section on modules below. * `--arg name value`: This option passes a value to the jq program as a predefined variable. If you run jq with `--arg foo bar`, then `$foo` is available in the program and has the value `"bar"`. Note that `value` will be treated as a string, so `--arg foo 123` will bind `$foo` to `"123"`. * `--argjson name JSON-text`: This option passes a JSON-encoded value to the jq program as a predefined variable. If you run jq with `--argjson foo 123`, then `$foo` is available in the program and has the value `123`. * `--slurpfile variable-name filename`: This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable. If you run jq with `--slurpfile foo bar`, then `$foo` is available in the program and has an array whose elements correspond to the texts in the file named `bar`. * `--argfile variable-name filename`: Do not use. Use `--slurpfile` instead. (This option is like `--slurpfile`, but when the file has just one text, then that is used, else an array of texts is used as in `--slurpfile`.) * `--exit-status` / `-e`: Sets the exit status of jq to 0 if the last output value was neither `false` nor `null`, 1 if the last output value was either `false` or `null`, or 4 if no valid result was ever produced. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran. * `--version` / `-V`: Output the jq version and exit with zero. * `--help` / `-h`: Output the jq help and exit with zero. * `--run-tests [filename]`: Runs the tests in the given file or standard input. This must be the last option given and does not honor all preceding options. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line. Compilation failure tests start with a line containing only `%%FAIL`, then a line containing the program to compile, then a line containing an error message to compare to the actual. Be warned that this option can change backwards-incompatibly. - title: Basic filters entries: - title: "`.`" body: | The absolute simplest (and least interesting) filter is `.`. This is a filter that takes its input and produces it unchanged as output. Since jq by default pretty-prints all output, this trivial program can be a useful way of formatting JSON output from, say, `curl`. examples: - program: '.' input: '"Hello, world!"' output: ['"Hello, world!"'] - title: "`.foo`, `.foo.bar`" body: | The simplest *useful* filter is `.foo`. When given a JSON object (aka dictionary or hash) as input, it produces the value at the key "foo", or null if there's none present. If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: `."foo$"`. A filter of the form `.foo.bar` is equivalent to `.foo|.bar`. examples: - program: '.foo' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]' input: '{"foo": 42}' output: ['42'] - title: "`.foo?`" body: | Just like `.foo`, but does not output an error when `.` is not an object. examples: - program: '.foo?' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo?' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]?' input: '{"foo": 42}' output: ['42'] - program: '[.foo?]' input: '[1,2]' output: ['[]'] - title: "`.[]`, `.[]`, `.[:]`" body: | You can also look up fields of an object using syntax like `.["foo"]` (`.foo` above is a shorthand version of this). This one works for arrays as well, if the key is an integer. Arrays are zero-based, so `.[2]` returns the third element of the array. The `.[10:15]` syntax can be used to return a subarray of an array or substring of a string. The array returned by `.[10:15]` will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array). Indices are zero-based. The `.[2]` syntax can be used to return the element at the given index. Negative indices are allowed, with -1 referring to the last element, -2 referring to the next to last element, and so on. The `.foo` syntax only works for simple keys i.e. keys that are all alphanumeric characters. `.[]` works with keys that contain special characters such as colons and dots. For example `.["foo::bar"]` and `.["foo.bar"]` work while `.foo::bar` and `.foo.bar` would not. The `?` "operator" can also be used with the slice operator, as in `.[10:15]?`, which outputs values where the inputs are slice-able. examples: - program: '.[0]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['{"name":"JSON", "good":true}'] - program: '.[2]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['null'] - program: '.[2:4]' input: '["a","b","c","d","e"]' output: ['["c", "d"]'] - program: '.[2:4]' input: '"abcdefghi"' output: ['"cd"'] - program: '.[:3]' input: '["a","b","c","d","e"]' output: ['["a", "b", "c"]'] - program: '.[-2:]' input: '["a","b","c","d","e"]' output: ['["d", "e"]'] - program: '.[-2]' input: '[1,2,3]' output: ['2'] - title: "`.[]`" body: | If you use the `.[index]` syntax, but omit the index entirely, it will return *all* of the elements of an array. Running `.[]` with the input `[1,2,3]` will produce the numbers as three separate results, rather than as a single array. A filter of the form `.foo[]` is equivalent to `.foo | .[]`. You can also use this on an object, and it will return all the values of the object. examples: - program: '.[]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: - '{"name":"JSON", "good":true}' - '{"name":"XML", "good":false}' - program: '.[]' input: '[]' output: [] - program: '.foo[]' input: '{"foo":[1,2,3]}' output: ['1','2','3'] - program: '.[]' input: '{"a": 1, "b": 1}' output: ['1', '1'] - title: "`.[]?`" body: | Like `.[]`, but no errors will be output if . is not an array or object. A filter of the form `.foo[]?` is equivalent to `.foo | .[]?`. - title: "`,`" body: | If two filters are separated by a comma, then the input will be fed into both and there will be multiple outputs: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right. For instance, filter `.foo, .bar`, produces both the "foo" fields and "bar" fields as separate outputs. examples: - program: '.foo, .bar' input: '{"foo": 42, "bar": "something else", "baz": true}' output: ['42', '"something else"'] - program: ".user, .projects[]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['"stedolan"', '"jq"', '"wikiflow"'] - program: '.[4,2]' input: '["a","b","c","d","e"]' output: ['"e"', '"c"'] - title: "`|`" body: | The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right. It's pretty much the same as the Unix shell's pipe, if you're used to that. If the one on the left produces multiple results, the one on the right will be run for each of those results. So, the expression `.[] | .foo` retrieves the "foo" field of each element of the input array. examples: - program: '.[] | .name' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['"JSON"', '"XML"'] - title: Types and Values body: | jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string keys), and "null". Booleans, null, strings and numbers are written the same way as in JSON. Just like everything else in jq, these simple values take an input and produce an output - `42` is a valid jq expression that takes an input, ignores it, and returns 42 instead. entries: - title: "Array construction: `[]`" body: | As in JSON, `[]` is used to construct arrays, as in `[1,2,3]`. The elements of the arrays can be any jq expression. All of the results produced by all of the expressions are collected into one big array. You can use it to construct an array out of a known quantity of values (as in `[.foo, .bar, .baz]`) or to "collect" all the results of a filter into an array (as in `[.items[].name]`) Once you understand the "," operator, you can look at jq's array syntax in a different light: the expression `[1,2,3]` is not using a built-in syntax for comma-separated arrays, but is instead applying the `[]` operator (collect results) to the expression 1,2,3 (which produces three different results). If you have a filter `X` that produces four results, then the expression `[X]` will produce a single result, an array of four elements. examples: - program: "[.user, .projects[]]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['["stedolan", "jq", "wikiflow"]'] - title: "Objects: `{}`" body: | Like JSON, `{}` is for constructing objects (aka dictionaries or hashes), as in: `{"a": 42, "b": 17}`. If the keys are "sensible" (all alphabetic characters), then the quotes can be left off. The value can be any expression (although you may need to wrap it in parentheses if it's a complicated one), which gets applied to the {} expression's input (remember, all filters have an input and an output). {foo: .bar} will produce the JSON object `{"foo": 42}` if given the JSON object `{"bar":42, "baz":43}`. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write {user: .user, title: .title} Because that's so common, there's a shortcut syntax: `{user, title}`. If one of the expressions produces multiple results, multiple dictionaries will be produced. If the input's {"user":"stedolan","titles":["JQ Primer", "More JQ"]} then the expression {user, title: .titles[]} will produce two outputs: {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} Putting parentheses around the key means it will be evaluated as an expression. With the same input as above, {(.user): .titles} produces {"stedolan": ["JQ Primer", "More JQ"]} examples: - program: '{user, title: .titles[]}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: - '{"user":"stedolan", "title": "JQ Primer"}' - '{"user":"stedolan", "title": "More JQ"}' - program: '{(.user): .titles}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: ['{"stedolan": ["JQ Primer", "More JQ"]}'] - title: Builtin operators and functions body: | Some jq operators (for instance, `+`) do different things depending on the type of their arguments (arrays, numbers, etc.). However, jq never does implicit type conversions. If you try to add a string to an object you'll get an error message and no result. entries: - title: "Addition: `+`" body: | The operator `+` takes two filters, applies them both to the same input, and adds the results together. What "adding" means depends on the types involved: - **Numbers** are added by normal arithmetic. - **Arrays** are added by being concatenated into a larger array. - **Strings** are added by being joined into a larger string. - **Objects** are added by merging, that is, inserting all the key-value pairs from both objects into a single combined object. If both objects contain a value for the same key, the object on the right of the `+` wins. (For recursive merge use the `*` operator.) `null` can be added to any value, and returns the other value unchanged. examples: - program: '.a + 1' input: '{"a": 7}' output: ['8'] - program: '.a + .b' input: '{"a": [1,2], "b": [3,4]}' output: ['[1,2,3,4]'] - program: '.a + null' input: '{"a": 1}' output: ['1'] - program: '.a + 1' input: '{}' output: ['1'] - program: '{a: 1} + {b: 2} + {c: 3} + {a: 42}' input: 'null' output: ['{"a": 42, "b": 2, "c": 3}'] - title: "Subtraction: `-`" body: | As well as normal arithmetic subtraction on numbers, the `-` operator can be used on arrays to remove all occurrences of the second array's elements from the first array. examples: - program: '4 - .a' input: '{"a":3}' output: ['1'] - program: . - ["xml", "yaml"] input: '["xml", "yaml", "json"]' output: ['["json"]'] - title: "Multiplication, division, modulo: `*`, `/`, `%`" body: | These infix operators behave as expected when given two numbers. Division by zero raises an error. `x % y` computes x modulo y. Multiplying a string by a number produces the concatenation of that string that many times. `"x" * 0` produces **null**. Dividing a string by another splits the first using the second as separators. Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy. examples: - program: '10 / . * 3' input: '5' output: ['6'] - program: '. / ", "' input: '"a, b,c,d, e"' output: ['["a","b,c,d","e"]'] - program: '{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}' input: 'null' output: ['{"k": {"a": 0, "b": 2, "c": 3}}'] - program: '.[] | (1 / .)?' input: '[1,0,-1]' output: ['1', '-1'] - title: "`length`" body: | The builtin function `length` gets the length of various different types of value: - The length of a **string** is the number of Unicode codepoints it contains (which will be the same as its JSON-encoded length in bytes if it's pure ASCII). - The length of an **array** is the number of elements. - The length of an **object** is the number of key-value pairs. - The length of **null** is zero. examples: - program: '.[] | length' input: '[[1,2], "string", {"a":2}, null]' output: ['2', '6', '1', '0'] - title: "`keys`, `keys_unsorted`" body: | The builtin function `keys`, when given an object, returns its keys in an array. The keys are sorted "alphabetically", by unicode codepoint order. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings. When `keys` is given an array, it returns the valid indices for that array: the integers from 0 to length-1. The `keys_unsorted` function is just like `keys`, but if the input is an object then the keys will not be sorted, instead the keys will roughly be in insertion order. examples: - program: 'keys' input: '{"abc": 1, "abcd": 2, "Foo": 3}' output: ['["Foo", "abc", "abcd"]'] - program: 'keys' input: '[42,3,35]' output: ['[0,1,2]'] - title: "`has(key)`" body: | The builtin function `has` returns whether the input object has the given key, or the input array has an element at the given index. `has($key)` has the same effect as checking whether `$key` is a member of the array returned by `keys`, although `has` will be faster. examples: - program: 'map(has("foo"))' input: '[{"foo": 42}, {}]' output: ['[true, false]'] - program: 'map(has(2))' input: '[[0,1], ["a","b","c"]]' output: ['[false, true]'] - title: "`in`" body: | The builtin function `in` returns whether or not the input key is in the given object, or the input index corresponds to an element in the given array. It is, essentially, an inversed version of `has`. examples: - program: '.[] | in({"foo": 42})' input: '["foo", "bar"]' output: ['true', 'false'] - program: 'map(in([0,1]))' input: '[2, 0]' output: ['[false, true]'] - title: "`path(path_expression)`" body: | Outputs array representations of the given path expression in `.`. The outputs are arrays of strings (object keys) and/or numbers (array indices). Path expressions are jq expressions like `.a`, but also `.[]`. There are two types of path expressions: ones that can match exactly, and ones that cannot. For example, `.a.b.c` is an exact match path expression, while `.a[].b` is not. `path(exact_path_expression)` will produce the array representation of the path expression even if it does not exist in `.`, if `.` is `null` or an array or an object. `path(pattern)` will produce array representations of the paths matching `pattern` if the paths exist in `.`. Note that the path expressions are not different from normal expressions. The expression `path(..|select(type=="boolean"))` outputs all the paths to boolean values in `.`, and only those paths. examples: - program: 'path(.a[0].b)' input: 'null' output: ['["a",0,"b"]'] - program: '[path(..)]' input: '{"a":[{"b":1}]}' output: ['[[],["a"],["a",0],["a",0,"b"]]'] - title: "`del(path_expression)`" body: | The builtin function `del` removes a key and its corresponding value from an object. examples: - program: 'del(.foo)' input: '{"foo": 42, "bar": 9001, "baz": 42}' output: ['{"bar": 9001, "baz": 42}'] - program: 'del(.[1, 2])' input: '["foo", "bar", "baz"]' output: ['["foo"]'] - title: "`to_entries`, `from_entries`, `with_entries(f)`" body: | These functions convert between an object and an array of key-value pairs. If `to_entries` is passed an object, then for each `k: v` entry in the input, the output array includes `{"key": k, "value": v}`. `from_entries` does the opposite conversion, and `with_entries(f)` is a shorthand for `to_entries | map(f) | from_entries`, useful for doing some operation to all keys and values of an object. `from_entries` accepts `"key"`, `"Key"`, `"Name"`, `"value"`, and `"Value"` as keys. examples: - program: 'to_entries' input: '{"a": 1, "b": 2}' output: ['[{"key":"a", "value":1}, {"key":"b", "value":2}]'] - program: 'from_entries' input: '[{"key":"a", "value":1}, {"key":"b", "value":2}]' output: ['{"a": 1, "b": 2}'] - program: 'with_entries(.key |= "KEY_" + .)' input: '{"a": 1, "b": 2}' output: ['{"KEY_a": 1, "KEY_b": 2}'] - title: "`select(boolean_expression)`" body: | The function `select(f)` produces its input unchanged if `f` returns true for that input, and produces no output otherwise. It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))` will give you `[2,3]`. examples: - program: 'map(select(. >= 2))' input: '[1,5,3,0,7]' output: ['[5,3,7]'] - program: '.[] | select(.id == "second")' input: '[{"id": "first", "val": 1}, {"id": "second", "val": 2}]' output: ['{"id": "second", "val": 2}'] - title: "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `normals`, `finites`, `strings`, `nulls`, `values`, `scalars`" body: | These built-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, normal numbers, finite numbers, strings, null, non-null values, and non-iterables, respectively. examples: - program: '.[]|numbers' input: '[[],{},1,"foo",null,true,false]' output: ['1'] - title: "`empty`" body: | `empty` returns no results. None at all. Not even `null`. It's useful on occasion. You'll know if you need it :) examples: - program: '1, empty, 2' input: 'null' output: ['1', '2'] - program: '[1,2,empty,3]' input: 'null' output: ['[1,2,3]'] - title: "`error`, `error(message)`" body: | Produces an error with the input value, or with the message given as the argument. Errors can be caught with try/catch; see below. When the error value is `null`, it produces nothing and works just like `empty`. So `[null | error]` and `[error(null)]` both emit `[]`. examples: - program: 'try error catch .' input: '"error message"' output: ['"error message"'] - program: 'try error("invalid value: \(.)") catch .' input: '42' output: ['"invalid value: 42"'] - title: "`$__loc__`" body: | Produces an object with a "file" key and a "line" key, with the filename and line number where `$__loc__` occurs, as values. examples: - program: 'try error("\($__loc__)") catch .' input: 'null' output: ['"{\"file\":\"\",\"line\":1}"'] - title: "`map(f)`, `map_values(f)`" body: | For any filter `f`, `map(f)` will run that filter for each element of the input array, and return the outputs in a new array. `map(.+1)` will increment each element of an array of numbers. Similarly, `map_values(f)` will run that filter for each element, but it will return an object when an object is passed. `map(f)` is equivalent to `[.[] | f]`. In fact, this is how it's defined. Similarly, `map_values(f)` is defined as `.[] |= f`. examples: - program: 'map(.+1)' input: '[1,2,3]' output: ['[2,3,4]'] - program: 'map_values(.+1)' input: '{"a": 1, "b": 2, "c": 3}' output: ['{"a": 2, "b": 3, "c": 4}'] - title: "`paths`, `paths(node_filter)`, `leaf_paths`" body: | `paths` outputs the paths to all the elements in its input (except it does not output the empty list, representing . itself). `paths(f)` outputs the paths to any values for which `f` is `true`. That is, `paths(type == "number")` outputs the paths to all numeric values. `leaf_paths` is an alias of `paths(scalars)`; `leaf_paths` is *deprecated* and will be removed in the next major release. examples: - program: '[paths]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1],[1,0],[1,1],[1,1,"a"]]'] - program: '[paths(type == "number")]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1,1,"a"]]'] - title: "`add`" body: | The filter `add` takes as input an array, and produces as output the elements of the array added together. This might mean summed, concatenated or merged depending on the types of the elements of the input array - the rules are the same as those for the `+` operator (described above). If the input is an empty array, `add` returns `null`. examples: - program: add input: '["a","b","c"]' output: ['"abc"'] - program: add input: '[1, 2, 3]' output: ['6'] - program: add input: '[]' output: ["null"] - title: "`any`, `any(condition)`, `any(generator; condition)`" body: | The filter `any` takes as input an array of boolean values, and produces `true` as output if any of the elements of the array are `true`. If the input is an empty array, `any` returns `false`. The `any(condition)` form applies the given condition to the elements of the input array. The `any(generator; condition)` form applies the given condition to all the outputs of the given generator. examples: - program: any input: '[true, false]' output: ["true"] - program: any input: '[false, false]' output: ["false"] - program: any input: '[]' output: ["false"] - title: "`all`, `all(condition)`, `all(generator; condition)`" body: | The filter `all` takes as input an array of boolean values, and produces `true` as output if all of the elements of the array are `true`. The `all(condition)` form applies the given condition to the elements of the input array. The `all(generator; condition)` form applies the given condition to all the outputs of the given generator. If the input is an empty array, `all` returns `true`. examples: - program: all input: '[true, false]' output: ["false"] - program: all input: '[true, true]' output: ["true"] - program: all input: '[]' output: ["true"] - title: "`flatten`, `flatten(depth)`" body: | The filter `flatten` takes as input an array of nested arrays, and produces a flat array in which all arrays inside the original array have been recursively replaced by their values. You can pass an argument to it to specify how many levels of nesting to flatten. `flatten(2)` is like `flatten`, but going only up to two levels deep. examples: - program: flatten input: '[1, [2], [[3]]]' output: ["[1, 2, 3]"] - program: flatten(1) input: '[1, [2], [[3]]]' output: ["[1, 2, [3]]"] - program: flatten input: '[[]]' output: ["[]"] - program: flatten input: '[{"foo": "bar"}, [{"foo": "baz"}]]' output: ['[{"foo": "bar"}, {"foo": "baz"}]'] - title: "`range(upto)`, `range(from; upto)`, `range(from; upto; by)`" body: | The `range` function produces a range of numbers. `range(4; 10)` produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers are produced as separate outputs. Use `[range(4; 10)]` to get a range as an array. The one argument form generates numbers from 0 to the given number, with an increment of 1. The two argument form generates numbers from `from` to `upto` with an increment of 1. The three argument form generates numbers `from` to `upto` with an increment of `by`. examples: - program: 'range(2; 4)' input: 'null' output: ['2', '3'] - program: '[range(2; 4)]' input: 'null' output: ['[2,3]'] - program: '[range(4)]' input: 'null' output: ['[0,1,2,3]'] - program: '[range(0; 10; 3)]' input: 'null' output: ['[0,3,6,9]'] - program: '[range(0; 10; -1)]' input: 'null' output: ['[]'] - program: '[range(0; -5; -1)]' input: 'null' output: ['[0,-1,-2,-3,-4]'] - title: "`floor`" body: | The `floor` function returns the floor of its numeric input. examples: - program: 'floor' input: '3.14159' output: ['3'] - title: "`sqrt`" body: | The `sqrt` function returns the square root of its numeric input. examples: - program: 'sqrt' input: '9' output: ['3'] - title: "`tonumber`" body: | The `tonumber` function parses its input as a number. It will convert correctly-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input. examples: - program: '.[] | tonumber' input: '[1, "1"]' output: ['1', '1'] - title: "`tostring`" body: | The `tostring` function prints its input as a string. Strings are left unchanged, and all other values are JSON-encoded. examples: - program: '.[] | tostring' input: '[1, "1", [1]]' output: ['"1"', '"1"', '"[1]"'] - title: "`type`" body: | The `type` function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object. examples: - program: 'map(type)' input: '[0, false, [], {}, null, "hello"]' output: ['["number", "boolean", "array", "object", "null", "string"]'] - title: "`infinite`, `nan`, `isinfinite`, `isnan`, `isfinite`, `isnormal`" body: | Some arithmetic operations can yield infinities and "not a number" (NaN) values. The `isinfinite` builtin returns `true` if its input is infinite. The `isnan` builtin returns `true` if its input is a NaN. The `infinite` builtin returns a positive infinite value. The `nan` builtin returns a NaN. The `isnormal` builtin returns true if its input is a normal number. Note that division by zero raises an error. Currently most arithmetic operations operating on infinities, NaNs, and sub-normals do not raise errors. examples: - program: '.[] | (infinite * .) < 0' input: '[-1, 1]' output: ['true', 'false'] - program: 'infinite, nan | type' input: 'null' output: ['"number"', '"number"'] - title: "`sort`, `sort_by(path_expression)`" body: | The `sort` functions sorts its input, which must be an array. Values are sorted in the following order: * `null` * `false` * `true` * numbers * strings, in alphabetical order (by unicode codepoint value) * arrays, in lexical order * objects The ordering for objects is a little complex: first they're compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key. `sort_by` may be used to sort by a particular field of an object, or by applying any jq filter. `sort_by(f)` compares two elements by comparing the result of `f` on each element. When `f` produces multiple values, it firstly compares the first values, and the second values if the first values are equal, and so on. examples: - program: 'sort' input: '[8,3,null,6]' output: ['[null,3,6,8]'] - program: 'sort_by(.foo)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}]'] - program: 'sort_by(.foo, .bar)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}]'] - title: "`group_by(path_expression)`" body: | `group_by(.foo)` takes as input an array, groups the elements having the same `.foo` field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the `.foo` field. Any jq expression, not just a field access, may be used in place of `.foo`. The sorting order is the same as described in the `sort` function above. examples: - program: 'group_by(.foo)' input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]' output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]'] - title: "`min`, `max`, `min_by(path_exp)`, `max_by(path_exp)`" body: | Find the minimum or maximum element of the input array. The `min_by(path_exp)` and `max_by(path_exp)` functions allow you to specify a particular field or property to examine, e.g. `min_by(.foo)` finds the object with the smallest `foo` field. examples: - program: 'min' input: '[5,4,2,7]' output: ['2'] - program: 'max_by(.foo)' input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]' output: ['{"foo":2, "bar":3}'] - title: "`unique`, `unique_by(path_exp)`" body: | The `unique` function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed. The `unique_by(path_exp)` function will keep only one element for each value obtained by applying the argument. Think of it as making an array by taking one element out of every group produced by `group`. examples: - program: 'unique' input: '[1,2,5,3,5,3,1,3]' output: ['[1,2,3,5]'] - program: 'unique_by(.foo)' input: '[{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}]' output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]'] - program: 'unique_by(length)' input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]' output: ['["bacon", "chunky", "asparagus"]'] - title: "`reverse`" body: | This function reverses an array. examples: - program: 'reverse' input: '[1,2,3,4]' output: ['[4,3,2,1]'] - title: "`contains(element)`" body: | The filter `contains(b)` will produce true if b is completely contained within the input. A string B is contained in a string A if B is a substring of A. An array B is contained in an array A if all elements in B are contained in any element in A. An object B is contained in object A if all of the values in B are contained in the value in A with the same key. All other types are assumed to be contained in each other if they are equal. examples: - program: 'contains("bar")' input: '"foobar"' output: ['true'] - program: 'contains(["baz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['true'] - program: 'contains(["bazzzzz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['false'] - program: 'contains({foo: 12, bar: [{barp: 12}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['true'] - program: 'contains({foo: 12, bar: [{barp: 15}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['false'] - title: "`indices(s)`" body: | Outputs an array containing the indices in `.` where `s` occurs. The input may be an array, in which case if `s` is an array then the indices output will be those where all elements in `.` match those of `s`. examples: - program: 'indices(", ")' input: '"a,b, cd, efg, hijk"' output: ['[3,7,12]'] - program: 'indices(1)' input: '[0,1,2,1,3,1,4]' output: ['[1,3,5]'] - program: 'indices([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['[1,8]'] - title: "`index(s)`, `rindex(s)`" body: | Outputs the index of the first (`index`) or last (`rindex`) occurrence of `s` in the input. examples: - program: 'index(", ")' input: '"a,b, cd, efg, hijk"' output: ['3'] - program: 'index(1)' input: '[0,1,2,1,3,1,4]' output: ['1'] - program: 'index([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['1'] - program: 'rindex(", ")' input: '"a,b, cd, efg, hijk"' output: ['12'] - program: 'rindex(1)' input: '[0,1,2,1,3,1,4]' output: ['5'] - program: 'rindex([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['8'] - title: "`inside`" body: | The filter `inside(b)` will produce true if the input is completely contained within b. It is, essentially, an inversed version of `contains`. examples: - program: 'inside("foobar")' input: '"bar"' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["baz", "bar"]' output: ['true'] - program: 'inside(["foobar", "foobaz", "blarp"])' input: '["bazzzzz", "bar"]' output: ['false'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 12}]}' output: ['true'] - program: 'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})' input: '{"foo": 12, "bar": [{"barp": 15}]}' output: ['false'] - title: "`startswith(str)`" body: | Outputs `true` if . starts with the given string argument. examples: - program: '[.[]|startswith("foo")]' input: '["fo", "foo", "barfoo", "foobar", "barfoob"]' output: ['[false, true, false, true, false]'] - title: "`endswith(str)`" body: | Outputs `true` if . ends with the given string argument. examples: - program: '[.[]|endswith("foo")]' input: '["foobar", "barfoo"]' output: ['[false, true]'] - title: "`combinations`, `combinations(n)`" body: | Outputs all combinations of the elements of the arrays in the input array. If given an argument `n`, it outputs all combinations of `n` repetitions of the input array. examples: - program: 'combinations' input: '[[1,2], [3, 4]]' output: ['[1, 3]', '[1, 4]', '[2, 3]', '[2, 4]'] - program: 'combinations(2)' input: '[0, 1]' output: ['[0, 0]', '[0, 1]', '[1, 0]', '[1, 1]'] - title: "`ltrimstr(str)`" body: | Outputs its input with the given prefix string removed, if it starts with it. examples: - program: '[.[]|ltrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "afoo"]' output: ['["fo","","barfoo","bar","afoo"]'] - title: "`rtrimstr(str)`" body: | Outputs its input with the given suffix string removed, if it ends with it. examples: - program: '[.[]|rtrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "foob"]' output: ['["fo","","bar","foobar","foob"]'] - title: "`explode`" body: | Converts an input string into an array of the string's codepoint numbers. examples: - program: 'explode' input: '"foobar"' output: ['[102,111,111,98,97,114]'] - title: "`implode`" body: | The inverse of explode. examples: - program: 'implode' input: '[65, 66, 67]' output: ['"ABC"'] - title: "`split`" body: | Splits an input string on the separator argument. examples: - program: 'split(", ")' input: '"a, b,c,d, e, "' output: ['["a","b,c,d","e",""]'] - title: "`join(str)`" body: | Joins the array of elements given as input, using the argument as separator. It is the inverse of `split`: that is, running `split("foo") | join("foo")` over any input string returns said input string. examples: - program: 'join(", ")' input: '["a","b,c,d","e"]' output: ['"a, b,c,d, e"'] - title: "`ascii_downcase`, `ascii_upcase`" body: | Emit a copy of the input string with its alphabetic characters (a-z and A-Z) converted to the specified case. examples: - program: 'ascii_upcase' input: '"useful but not for é"' output: ['"USEFUL BUT NOT FOR é"'] - title: "`while(cond; update)`" body: | The `while(cond; update)` function allows you to repeatedly apply an update to `.` until `cond` is false. Note that `while(cond; update)` is internally defined as a recursive jq function. Recursive calls within `while` will not consume additional memory if `update` produces at most one output for each input. See advanced topics below. examples: - program: '[while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: "`until(cond; next)`" body: | The `until(cond; next)` function allows you to repeatedly apply the expression `next`, initially to `.` then to its own output, until `cond` is true. For example, this can be used to implement a factorial function (see below). Note that `until(cond; next)` is internally defined as a recursive jq function. Recursive calls within `until()` will not consume additional memory if `next` produces at most one output for each input. See advanced topics below. examples: - program: '[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]' input: '4' output: ['24'] - title: "`recurse(f)`, `recurse`, `recurse(f; condition)`, `recurse_down`" body: | The `recurse(f)` function allows you to search through a recursive structure, and extract interesting data from all levels. Suppose your input represents a filesystem: {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} Now suppose you want to extract all of the filenames present. You need to retrieve `.name`, `.children[].name`, `.children[].children[].name`, and so on. You can do this with: recurse(.children[]) | .name When called without an argument, `recurse` is equivalent to `recurse(.[]?)`. `recurse(f)` is identical to `recurse(f; . != null)` and can be used without concerns about recursion depth. `recurse(f; condition)` is a generator which begins by emitting . and then emits in turn .|f, .|f|f, .|f|f|f, ... so long as the computed value satisfies the condition. For example, to generate all the integers, at least in principle, one could write `recurse(.+1; true)`. For legacy reasons, `recurse_down` exists as an alias to calling `recurse` without arguments. This alias is considered *deprecated* and will be removed in the next major release. The recursive calls in `recurse` will not consume additional memory whenever `f` produces at most a single output for each input. examples: - program: 'recurse(.foo[])' input: '{"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}' output: - '{"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}' - '{"foo":[]}' - '{"foo":[{"foo":[]}]}' - '{"foo":[]}' - program: 'recurse' input: '{"a":0,"b":[1]}' output: - '{"a":0,"b":[1]}' - '0' - '[1]' - '1' - program: 'recurse(. * .; . < 20)' input: '2' output: ['2', '4', '16'] - title: "`..`" body: | Short-hand for `recurse` without arguments. This is intended to resemble the XPath `//` operator. Note that `..a` does not work; use `..|a` instead. In the example below we use `..|.a?` to find all the values of object keys "a" in any object found "below" `.`. examples: - program: '..|.a?' input: '[[{"a":1}]]' output: ['1'] - title: "`env`" body: | Outputs an object representing jq's environment. examples: - program: 'env.PAGER' input: 'null' output: ['"less"'] - title: "`transpose`" body: | Transpose a possibly jagged matrix (an array of arrays). Rows are padded with nulls so the result is always rectangular. examples: - program: 'transpose' input: '[[1], [2,3]]' output: ['[[1,2],[null,3]]'] - title: "`bsearch(x)`" body: | `bsearch(x)` conducts a binary search for x in the input array. If the input is sorted and contains x, then `bsearch(x)` will return its index in the array; otherwise, if the array is sorted, it will return (-1 - ix) where ix is an insertion point such that the array would still be sorted after the insertion of x at ix. If the array is not sorted, `bsearch(x)` will return an integer that is probably of no interest. examples: - program: 'bsearch(0)' input: '[0,1]' output: ['0'] - program: 'bsearch(0)' input: '[1,2,3]' output: ['-1'] - program: 'bsearch(4) as $ix | if $ix < 0 then .[-(1+$ix)] = 4 else . end' input: '[1,2,3]' output: ['[1,2,3,4]'] - title: "String interpolation: `\\(exp)`" body: | Inside a string, you can put an expression inside parens after a backslash. Whatever the expression returns will be interpolated into the string. examples: - program: '"The input was \(.), which is one less than \(.+1)"' input: '42' output: ['"The input was 42, which is one less than 43"'] - title: "Convert to/from JSON" body: | The `tojson` and `fromjson` builtins dump values as JSON texts or parse JSON texts into values, respectively. The tojson builtin differs from tostring in that tostring returns strings unmodified, while tojson encodes strings as JSON strings. examples: - program: '[.[]|tostring]' input: '[1, "foo", ["foo"]]' output: ['["1","foo","[\"foo\"]"]'] - program: '[.[]|tojson]' input: '[1, "foo", ["foo"]]' output: ['["1","\"foo\"","[\"foo\"]"]'] - program: '[.[]|tojson|fromjson]' input: '[1, "foo", ["foo"]]' output: ['[1,"foo",["foo"]]'] - title: "Format strings and escaping" body: | The `@foo` syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth. `@foo` can be used as a filter on its own, the possible escapings are: * `@text`: Calls `tostring`, see that function for details. * `@json`: Serializes the input as JSON. * `@html`: Applies HTML/XML escaping, by mapping the characters `<>&'"` to their entity equivalents `<`, `>`, `&`, `'`, `"`. * `@uri`: Applies percent-encoding, by mapping all reserved URI characters to a `%XX` sequence. * `@csv`: The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition. * `@tsv`: The input must be an array, and it is rendered as TSV (tab-separated values). Each input array will be printed as a single line. Fields are separated by a single tab (ascii `0x09`). Input characters line-feed (ascii `0x0a`), carriage-return (ascii `0x0d`), tab (ascii `0x09`) and backslash (ascii `0x5c`) will be output as escape sequences `\n`, `\r`, `\t`, `\\` respectively. * `@sh`: The input is escaped suitable for use in a command-line for a POSIX shell. If the input is an array, the output will be a series of space-separated strings. * `@base64`: The input is converted to base64 as specified by RFC 4648. This syntax can be combined with string interpolation in a useful way. You can follow a `@foo` token with a string literal. The contents of the string literal will *not* be escaped. However, all interpolations made inside that string literal will be escaped. For instance, @uri "https://www.google.com/search?q=\(.search)" will produce the following output for the input `{"search":"what is jq?"}`: "https://www.google.com/search?q=what%20is%20jq%3F" Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. examples: - program: '@html' input: '"This works if x < y"' output: ['"This works if x < y"'] - program: '@sh "echo \(.)"' input: "\"O'Hara's Ale\"" output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""] - title: "Dates" body: | jq provides some basic date handling functionality, with some high-level and low-level builtins. In all cases these builtins deal exclusively with time in UTC. The `fromdateiso8601` builtin parses datetimes in the ISO 8601 format to a number of seconds since the Unix epoch (1970-01-01T00:00:00Z). The `todateiso8601` builtin does the inverse. The `fromdate` builtin parses datetime strings. Currently `fromdate` only supports ISO 8601 datetime strings, but in the future it will attempt to parse datetime strings in more formats. The `todate` builtin is an alias for `todateiso8601`. The `now` builtin outputs the current time, in seconds since the Unix epoch. Low-level jq interfaces to the C-library time functions are also provided: `strptime`, `strftime`, `mktime`, and `gmtime`. Refer to your host operating system's documentation for the format strings used by `strptime` and `strftime`. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality. The `gmtime` builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of time as an array of numbers representing (in this order): the year, the month (zero-based), the day of the month, the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year -- all one-based unless otherwise stated. The `mktime` builtin consumes "broken down time" representations of time output by `gmtime` and `strptime`. The `strptime(fmt)` builtin parses input strings matching the `fmt` argument. The output is in the "broken down time" representation consumed by `mktime` and output by `gmtime`. The `strftime(fmt)` builtin formats a time with the given format. The format strings for `strptime` and `strftime` are described in typical C library documentation. The format string for ISO 8601 datetime is `"%Y-%m-%dT%H:%M:%SZ"`. jq may not support some or all of this date functionality on some systems. examples: - program: 'fromdate' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")' input: '"2015-03-05T23:51:47Z"' output: ['[2015,2,5,23,51,47,4,63]'] - program: 'strptime("%Y-%m-%dT%H:%M:%SZ")|mktime' input: '"2015-03-05T23:51:47Z"' output: ['1425599507'] - title: Conditionals and Comparisons entries: - title: "`==`, `!=`" body: | The expression 'a == b' will produce 'true' if the result of a and b are equal (that is, if they represent equivalent JSON documents) and 'false' otherwise. In particular, strings are never considered equal to numbers. If you're coming from JavaScript, jq's == is like JavaScript's === - considering values equal only when they have the same type as well as the same value. != is "not equal", and 'a != b' returns the opposite value of 'a == b' examples: - program: '.[] == 1' input: '[1, 1.0, "1", "banana"]' output: ['true', 'true', 'false', 'false'] - title: if-then-else-end body: | `if A then B else C end` will act the same as `B` if `A` produces a value other than false or null, but act the same as `C` otherwise. Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you'll sometimes have to be more explicit about the condition you want: you can't test whether, e.g. a string is empty using `if .name then A else B end`, you'll need something more like `if (.name | length) > 0 then A else B end` instead. If the condition `A` produces multiple results, then `B` is evaluated once for each result that is not false or null, and `C` is evaluated once for each false or null. More cases can be added to an if using `elif A then B` syntax. examples: - program: |- if . == 0 then "zero" elif . == 1 then "one" else "many" end input: '2' output: ['"many"'] - title: "`>`, `>=`, `<=`, `<`" body: | The comparison operators `>`, `>=`, `<=`, `<` return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively). The ordering is the same as that described for `sort`, above. examples: - program: '. < 5' input: '2' output: ['true'] - title: "`and`, `or`, `not`" body: | jq supports the normal Boolean operators `and`, `or`, `not`. They have the same standard of truth as if expressions - `false` and `null` are considered "false values", and anything else is a "true value". If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input. `not` is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in `.foo and .bar | not`. These three only produce the values `true` and `false`, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default". If you want to use this form of "or", picking between two values rather than evaluating a condition, see the `//` operator below. examples: - program: '42 and "a string"' input: 'null' output: ['true'] - program: '(true, false) or false' input: 'null' output: ['true', 'false'] - program: '(true, true) and (true, false)' input: 'null' output: ['true', 'false', 'true', 'false'] - program: '[true, false | not]' input: 'null' output: ['[false, true]'] - title: "Alternative operator: `//`" body: | A filter of the form `a // b` produces the same results as `a`, if `a` produces results other than `false` and `null`. Otherwise, `a // b` produces the same results as `b`. This is useful for providing defaults: `.foo // 1` will evaluate to `1` if there's no `.foo` element in the input. It's similar to how `or` is sometimes used in Python (jq's `or` operator is reserved for strictly Boolean operations). examples: - program: '.foo // 42' input: '{"foo": 19}' output: ['19'] - program: '.foo // 42' input: '{}' output: ['42'] - title: try-catch body: | Errors can be caught by using `try EXP catch EXP`. The first expression is executed, and if it fails then the second is executed with the error message. The output of the handler, if any, is output as if it had been the output of the expression to try. The `try EXP` form uses `empty` as the exception handler. examples: - program: 'try .a catch ". is not an object"' input: 'true' output: ['". is not an object"'] - program: '[.[]|try .a]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - program: 'try error("some exception") catch .' input: 'true' output: ['"some exception"'] - title: Breaking out of control structures body: | A convenient use of try/catch is to break out of control structures like `reduce`, `foreach`, `while`, and so on. For example: # Repeat an expression until it raises "break" as an # error, then stop repeating without re-raising the error. # But if the error caught is not "break" then re-raise it. try repeat(exp) catch if .=="break" then empty else error jq has a syntax for named lexical labels to "break" or "go (back) to": label $out | ... break $out ... The `break $label_name` expression will cause the program to act as though the nearest (to the left) `label $label_name` produced `empty`. The relationship between the `break` and corresponding `label` is lexical: the label has to be "visible" from the break. To break out of a `reduce`, for example: label $out | reduce .[] as $item (null; if .==false then break $out else ... end) The following jq program produces a syntax error: break $out because no label `$out` is visible. - title: "`?` operator" body: | The `?` operator, used as `EXP?`, is shorthand for `try EXP`. examples: - program: '[.[]|(.a)?]' input: '[{}, true, {"a":1}]' output: ['[null, 1]'] - title: Regular expressions body: | jq uses the Oniguruma regular expression library, as do PHP, Ruby, TextMate, Sublime Text, etc, so the description here will focus on jq specifics. The jq regex filters are defined so that they can be used using one of these patterns: STRING | FILTER(REGEX) STRING | FILTER(REGEX; FLAGS) STRING | FILTER([REGEX]) STRING | FILTER([REGEX, FLAGS]) where: * STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation; * REGEX, after string interpolation, should be a valid regular expression; * FILTER is one of `test`, `match`, or `capture`, as described below. FLAGS is a string consisting of one of more of the supported flags: * `g` - Global search (find all matches, not just the first) * `i` - Case insensitive search * `m` - Multi line mode (`.` will match newlines) * `n` - Ignore empty matches * `p` - Both s and m modes are enabled * `s` - Single line mode (`^` -> `\A`, `$` -> `\Z`) * `l` - Find longest possible matches * `x` - Extended regex format (ignore whitespace and comments) To match a whitespace with the `x` flag, use `\s`, e.g. jq -n '"a b" | test("a\\sb"; "x")' Note that certain flags may also be specified within REGEX, e.g. jq -n '("test", "TEst", "teST", "TEST") | test("(?i)te(?-i)st")' evaluates to: `true`, `true`, `false`, `false`. entries: - title: "`test(val)`, `test(regex; flags)`" body: | Like `match`, but does not return match objects, only `true` or `false` for whether or not the regex matches the input. examples: - program: 'test("foo")' input: '"foo"' output: ['true'] - program: '.[] | test("a b c # spaces are ignored"; "ix")' input: '["xabcd", "ABC"]' output: ['true', 'true'] - title: "`match(val)`, `match(regex; flags)`" body: | **match** outputs an object for each match it finds. Matches have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of the match * `string` - the string that it matched * `captures` - an array of objects representing capturing groups. Capturing group objects have the following fields: * `offset` - offset in UTF-8 codepoints from the beginning of the input * `length` - length in UTF-8 codepoints of this capturing group * `string` - the string that was captured * `name` - the name of the capturing group (or `null` if it was unnamed) Capturing groups that did not match anything return an offset of -1 examples: - program: 'match("(abc)+"; "g")' input: '"abc abc"' output: - '{"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]}' - '{"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]}' - program: 'match("foo")' input: '"foo bar foo"' output: ['{"offset": 0, "length": 3, "string": "foo", "captures": []}'] - program: 'match(["foo", "ig"])' input: '"foo bar FOO"' output: - '{"offset": 0, "length": 3, "string": "foo", "captures": []}' - '{"offset": 8, "length": 3, "string": "FOO", "captures": []}' - program: 'match("foo (?bar)? foo"; "ig")' input: '"foo bar foo foo foo"' output: - '{"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]}' - '{"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}' - program: '[ match("."; "g")] | length' input: '"abc"' output: ['3'] - title: "`capture(val)`, `capture(regex; flags)`" body: | Collects the named captures in a JSON object, with the name of each capture as the key, and the matched string as the corresponding value. examples: - program: 'capture("(?[a-z]+)-(?[0-9]+)")' input: '"xyzzy-14"' output: ['{ "a": "xyzzy", "n": "14" }'] - title: "`scan(regex)`, `scan(regex; flags)`" body: | Emit a stream of the non-overlapping substrings of the input that match the regex in accordance with the flags, if any have been specified. If there is no match, the stream is empty. To capture all the matches for each input string, use the idiom `[ expr ]`, e.g. `[ scan(regex) ]`. examples: - program: 'scan("c")' input: '"abcdefabc"' output: ['"c"', '"c"'] - title: "`split(regex; flags)`" body: | For backwards compatibility, `split` splits on a string, not a regex. examples: - program: 'split(", *"; null)' input: '"ab,cd, ef"' output: ['["ab","cd","ef"]'] - title: "`splits(regex)`, `splits(regex; flags)`" body: | These provide the same results as their `split` counterparts, but as a stream instead of an array. examples: - program: 'splits(", *")' input: '"ab,cd, ef, gh"' output: ['"ab"','"cd"','"ef"','"gh"'] - title: "`sub(regex; tostring)` `sub(regex; string; flags)`" body: | Emit the string obtained by replacing the first match of regex in the input string with `tostring`, after interpolation. `tostring` should be a jq string, and may contain references to named captures. The named captures are, in effect, presented as a JSON object (as constructed by `capture`) to `tostring`, so a reference to a captured variable named "x" would take the form: `"\(.x)"`. examples: - program: 'sub("[^a-z]*(?[a-z]+)"; "Z\(.x)"; "g")' input: '"123abc456def"' output: ['"ZabcZdef"'] - title: "`gsub(regex; string)`, `gsub(regex; string; flags)`" body: | `gsub` is like `sub` but all the non-overlapping occurrences of the regex are replaced by the string, after interpolation. examples: - program: 'gsub("(?.)[^a]*"; "+\(.x)-")' input: '"Abcabc"' output: ['"+A-+a-"'] - title: Advanced features body: | Variables are an absolute necessity in most programming languages, but they're relegated to an "advanced feature" in jq. In most languages, variables are the only means of passing around data. If you calculate a value, and you want to use it more than once, you'll need to store it in a variable. To pass a value to another part of the program, you'll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data. It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq's standard library (many jq functions such as `map` and `select` are in fact written in jq). jq has reduction operators, which are very powerful but a bit tricky. Again, these are mostly used internally, to define some useful bits of jq's standard library. It may not be obvious at first, but jq is all about generators (yes, as often found in other languages). Some utilities are provided to help deal with generators. Some minimal I/O support (besides reading JSON from standard input, and writing JSON to standard output) is available. Finally, there is a module/library system. entries: - title: Variables body: | In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next. Many expressions, for instance `a + b`, pass their input to two distinct subexpressions (here `a` and `b` are both passed the same input), so variables aren't usually necessary in order to use a value twice. For instance, calculating the average value of an array of numbers requires a few variables in most languages - at least one to hold the array, perhaps one for each element or for a loop counter. In jq, it's simply `add / length` - the `add` expression is given the array and produces its sum, and the `length` expression is given the array and produces its length. So, there's generally a cleaner way to solve most problems in jq than defining variables. Still, sometimes they do make things easier, so jq lets you define variables using `expression as $variable`. All variable names start with `$`. Here's a slightly uglier version of the array-averaging example: length as $array_length | add / $array_length We'll need a more complicated problem to find a situation where using variables actually makes our lives easier. Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names. Our input looks like: {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} We want to produce the posts with the author field containing a real name, as in: {"title": "First post", "author": "Anonymous Coward"} {"title": "A well-written article", "author": "Person McPherson"} We use a variable, $names, to store the realnames object, so that we can refer to it later when looking up author usernames: .realnames as $names | .posts[] | {title, author: $names[.author]} The expression `exp as $x | ...` means: for each value of expression `exp`, run the rest of the pipeline with the entire original input, and with `$x` set to that value. Thus `as` functions as something of a foreach loop. Just as `{foo}` is a handy way of writing `{foo: .foo}`, so `{$foo}` is a handy way of writing `{foo: $foo}`. Multiple variables may be declared using a single `as` expression by providing a pattern that matches the structure of the input (this is known as "destructuring"): . as {realnames: $names, posts: [$first, $second]} | ... The variable declarations in array patterns (e.g., `. as [$first, $second]`) bind to the elements of the array in from the element at index zero on up, in order. When there is no value at the index for an array pattern element, `null` is bound to that variable. Variables are scoped over the rest of the expression that defines them, so .realnames as $names | (.posts[] | {title, author: $names[.author]}) will work, but (.realnames as $names | .posts[]) | {title, author: $names[.author]} won't. For programming language theorists, it's more accurate to say that jq variables are lexically-scoped bindings. In particular there's no way to change the value of a binding; one can only setup a new binding with the same name, but which will not be visible where the old one was. examples: - program: '.bar as $x | .foo | . + $x' input: '{"foo":10, "bar":200}' output: ['210'] - program: '. as $i|[(.*2|. as $i| $i), $i]' input: '5' output: ['[10,5]'] - program: '. as [$a, $b, {c: $c}] | $a + $b + $c' input: '[2, 3, {"c": 4, "d": 5}]' output: ['9'] - program: '.[] as [$a, $b] | {a: $a, b: $b}' input: '[[0], [0, 1], [2, 1, 0]]' output: ['{"a":0,"b":null}', '{"a":0,"b":1}', '{"a":2,"b":1}'] - title: 'Defining Functions' body: | You can give a filter a name using "def" syntax: def increment: . + 1; From then on, `increment` is usable as a filter just like a builtin function (in fact, this is how some of the builtins are defined). A function may take arguments: def map(f): [.[] | f]; Arguments are passed as filters, not as values. The same argument may be referenced multiple times with different inputs (here `f` is run for each element of the input array). Arguments to a function work more like callbacks than like value arguments. This is important to understand. Consider: def foo(f): f|f; 5|foo(.*2) The result will be 20 because `f` is `.*2`, and during the first invocation of `f` `.` will be 5, and the second time it will be 10 (5 * 2), so the result will be 20. Function arguments are filters, and filters expect an input when invoked. If you want the value-argument behaviour for defining simple functions, you can just use a variable: def addvalue(f): f as $f | map(. + $f); Or use the short-hand: def addvalue($f): ...; With either definition, `addvalue(.foo)` will add the current input's `.foo` field to each element of the array. Multiple definitions using the same function name are allowed. Each re-definition replaces the previous one for the same number of function arguments, but only for references from functions (or main program) subsequent to the re-definition. examples: - program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))' input: '[[1,2],[10,20]]' output: ['[[1,2,1], [10,20,10]]'] - program: 'def addvalue(f): f as $x | map(. + $x); addvalue(.[0])' input: '[[1,2],[10,20]]' output: ['[[1,2,1,2], [10,20,1,2]]'] - title: "`limit(n; exp)`" body: | The `limit` function extracts up to `n` outputs from `exp`. examples: - program: '[limit(3;.[])]' input: '[0,1,2,3,4,5,6,7,8,9]' output: ['[0,1,2]'] - title: "`first(expr)`, `last(expr)`, `nth(n; expr)`" body: | The `first(expr)` and `last(expr)` functions extract the first and last values from `expr`, respectively. The `nth(n; expr)` function extracts the nth value output by `expr`. This can be defined as `def nth(n; expr): last(limit(n + 1; expr));`. Note that `nth(n; expr)` doesn't support negative values of `n`. examples: - program: '[first(range(.)), last(range(.)), nth(./2; range(.))]' input: '10' output: ['[0,9,5]'] - title: "`first`, `last`, `nth(n)`" body: | The `first` and `last` functions extract the first and last values from any array at `.`. The `nth(n)` function extracts the nth value of any array at `.`. examples: - program: '[range(.)]|[first, last, nth(5)]' input: '10' output: ['[0,9,5]'] - title: "`reduce`" body: | The `reduce` syntax allows you to combine all of the results of an expression by accumulating them into a single answer. The form is `reduce EXP as $var (INIT; UPDATE)`. As an example, we'll pass `[1,2,3]` to this expression: reduce .[] as $item (0; . + $item) For each result that `.[]` produces, `. + $item` is run to accumulate a running total, starting from 0 as the input value. In this example, `.[]` produces the results `1`, `2`, and `3`, so the effect is similar to running something like this: 0 | 1 as $item | . + $item | 2 as $item | . + $item | 3 as $item | . + $item examples: - program: 'reduce .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['15'] - program: 'reduce .[] as [$i,$j] (0; . + $i * $j)' input: '[[1,2],[3,4],[5,6]]' output: ['44'] - program: 'reduce .[] as {$x,$y} (null; .x += $x | .y += [$y])' input: '[{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}]' output: ['{"x":"abc","y":[1,2,3]}'] - title: "`foreach`" body: | The `foreach` syntax is similar to `reduce`, but intended to allow the construction of `limit` and reducers that produce intermediate results. The form is `foreach EXP as $var (INIT; UPDATE; EXTRACT)`. As an example, we'll pass `[1,2,3]` to this expression: foreach .[] as $item (0; . + $item; [$item, . * 2]) Like the `reduce` syntax, `. + $item` is run for each result that `.[]` produces, but `[$item, . * 2]` is run for each intermediate values. In this example, since the intermediate values are `1`, `3`, and `6`, the `foreach` expression produces `[1,2]`, `[2,6]`, and `[3,12]`. So the effect is similar to running something like this: 0 | 1 as $item | . + $item | [$item, . * 2], 2 as $item | . + $item | [$item, . * 2], 3 as $item | . + $item | [$item, . * 2] When `EXTRACT` is omitted, the identity filter is used. That is, it outputs the intermediate values as they are. examples: - program: 'foreach .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['1','3','6','10','15'] - program: 'foreach .[] as $item (0; . + $item; [$item, . * 2])' input: '[1,2,3,4,5]' output: ['[1,2]','[2,6]','[3,12]','[4,20]','[5,30]'] - program: 'foreach .[] as $item (0; . + 1; {index: ., $item})' input: '["foo", "bar", "baz"]' output: - '{"index":1,"item":"foo"}' - '{"index":2,"item":"bar"}' - '{"index":3,"item":"baz"}' - title: Recursion body: | As described above, `recurse` uses recursion, and any jq function can be recursive. The `while` builtin is also implemented in terms of recursion. Tail calls are optimized whenever the expression to the left of the recursive call outputs its last value. In practice this means that the expression to the left of the recursive call should not produce more than one output for each input. For example: def recurse(f): def r: ., (f | select(. != null) | r); r; def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; def repeat(exp): def _repeat: exp, _repeat; _repeat; - title: Generators and iterators body: | Some jq operators and functions are actually generators in that they can produce zero, one, or more values for each input, just as one might expect in other programming languages that have generators. For example, `.[]` generates all the values in its input (which must be an array or an object), `range(0; 10)` generates the integers between 0 and 10, and so on. Even the comma operator is a generator, generating first the values generated by the expression to the left of the comma, then for each of those, the values generate by the expression on the right of the comma. The `empty` builtin is the generator that produces zero outputs. The `empty` builtin backtracks to the preceding generator expression. All jq functions can be generators just by using builtin generators. It is also possible to define new generators using only recursion and the comma operator. If the recursive call(s) is(are) "in tail position" then the generator will be efficient. In the example below the recursive call by `_range` to itself is in tail position. The example shows off three advanced topics: tail recursion, generator construction, and sub-functions. examples: - program: 'def range(init; upto; by): def _range: if (by > 0 and . < upto) or (by < 0 and . > upto) then ., ((.+by)|_range) else . end; if by == 0 then init else init|_range end | select((by > 0 and . < upto) or (by < 0 and . > upto)); range(0; 10; 3)' input: 'null' output: ['0', '3', '6', '9'] - program: 'def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; [while(.<100; .*2)]' input: '1' output: ['[1,2,4,8,16,32,64]'] - title: 'Math' body: | jq currently only has IEEE754 double-precision (64-bit) floating point number support. Besides simple arithmetic operators such as `+`, jq also has most standard math functions from the C math library. C math functions that take a single input argument (e.g., `sin()`) are available as zero-argument jq functions. C math functions that take two input arguments (e.g., `pow()`) are available as two-argument jq functions that ignore `.`. Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library. Unavailable math functions will be defined but will raise an error. - title: 'I/O' body: | At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read. Two builtins functions are provided for this, `input` and `inputs`, that read from the same sources (e.g., `stdin`, files named on the command-line) as jq itself. These two builtins, and jq's own reading actions, can be interleaved with each other. One builtin provides minimal output capabilities, `debug`. (Recall that a jq program's output values are always output as JSON texts on `stdout`.) The `debug` builtin can have application-specific behavior, such as for executables that use the libjq C API but aren't the jq executable itself. entries: - title: "`input`" body: | Outputs one new input. echo 1 2 3 4 | jq '[., input]' # [1,2] [3,4] - title: "`inputs`" body: | Outputs all remaining inputs, one by one. This is primarily useful for reductions over a program's inputs. echo 1 2 3 | jq -n 'reduce inputs as $i (0; . + $i)' # 6 - title: "`debug`" body: | Causes a debug message based on the input value to be produced. The jq executable wraps the input value with `["DEBUG:", ]` and prints that and a newline on stderr, compactly. This may change in the future. - title: "`input_filename`" body: | Returns the name of the file whose input is currently being filtered. Note that this will not work well unless jq is running in a UTF-8 locale. - title: "`input_line_number`" body: | Returns the line number of the input currently being filtered. - title: 'Streaming' body: | With the `--stream` option jq can parse input texts in a streaming fashion, allowing jq programs to start processing large JSON texts immediately rather than after the parse completes. If you have a single JSON text that is 1GB in size, streaming it will allow you to process it much more quickly. However, streaming isn't easy to deal with as the jq program will have `[, ]` (and a few other forms) as inputs. Several builtins are provided to make handling streams easier. The examples below use the streamed form of `[0,[1]]`, which is `[[0],0],[[1,0],1],[[1,0]],[[1]]`. Streaming forms include `[, ]` (to indicate any scalar value, empty array, or empty object), and `[]` (to indicate the end of an array or object). Future versions of jq run with `--stream` and `--seq` may output additional forms such as `["error message"]` when an input text fails to parse. entries: - title: "`truncate_stream(stream_expression)`" body: | Consumes a number as input and truncates the corresponding number of path elements from the left of the outputs of the given streaming expression. examples: - program: 'truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]])' input: '1' output: ['[[0],2]', '[[0]]'] - title: "`fromstream(stream_expression)`" body: | Outputs values corresponding to the stream expression's outputs. examples: - program: 'fromstream(1|truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]]))' input: 'null' output: ['[2]'] - title: "`tostream`" body: | The `tostream` builtin outputs the streamed form of its input. examples: - program: '. as $dot|fromstream($dot|tostream)|.==$dot' input: '[0,[1,{"a":1},{"b":2}]]' output: ['true'] - title: Assignment body: | Assignment works a little differently in jq than in most programming languages. jq doesn't distinguish between references to and copies of something - two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object". If an object has two fields which are arrays, `.foo` and `.bar`, and you append something to `.foo`, then `.bar` will not get bigger. Even if you've just set `.bar = .foo`. If you're used to programming in languages like Python, Java, Ruby, JavaScript, etc. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance, it doesn't actually do that, but that's the general idea). All the assignment operators in jq have path expressions on the left-hand side. entries: - title: "`=`" body: | The filter `.foo = 1` will take as input an object and produce as output an object with the "foo" field set to 1. There is no notion of "modifying" or "changing" something in jq - all jq values are immutable. For instance, .foo = .bar | .foo.baz = 1 will not have the side-effect of setting .bar.baz to be set to 1, as the similar-looking program in JavaScript, Python, Ruby or other languages would. Unlike these languages (but like Haskell and some other functional languages), there is no notion of two arrays or objects being "the same array" or "the same object". They can be equal, or not equal, but if we change one of them in no circumstances will the other change behind our backs. This means that it's impossible to build circular values in jq (such as an array whose first element is itself). This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON. Note that the left-hand side of '=' refers to a value in `.`. Thus `$var.foo = 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo = 1` instead. If the right-hand side of '=' produces multiple values, then for each such value jq will set the paths on the left-hand side to the value and then it will output the modified `.`. For example, `(.a,.b)=range(2)` outputs `{"a":0,"b":0}`, then `{"a":1,"b":1}`. The "update" assignment forms (see below) do not do this. Note too that `.a,.b=0` does not set `.a` and `.b`, but `(.a,.b)=0` sets both. - title: "`|=`" body: | As well as the assignment operator '=', jq provides the "update" operator '|=', which takes a filter on the right-hand side and works out the new value for the property of `.` being assigned to by running the old value through this expression. For instance, .foo |= .+1 will build an object with the "foo" field set to the input's "foo" plus 1. This example should show the difference between '=' and '|=': Provide input '{"a": {"b": 10}, "b": 20}' to the programs: .a = .b .a |= .b The former will set the "a" field of the input to the "b" field of the input, and produce the output {"a": 20}. The latter will set the "a" field of the input to the "a" field's "b" field, producing {"a": 10}. The left-hand side can be any general path expression; see `path()`. Note that the left-hand side of '|=' refers to a value in `.`. Thus `$var.foo |= . + 1` won't work as expected (`$var.foo` is not a valid or useful path expression in `.`); use `$var | .foo |= . + 1` instead. If the right-hand side outputs multiple values, only the last one will be used. examples: - program: '(..|select(type=="boolean")) |= if . then 1 else 0 end' input: '[true,false,[5,true,[true,[false]],false]]' output: ['[1,0,[5,1,[1,[0]],0]]'] - title: "`+=`, `-=`, `*=`, `/=`, `%=`, `//=`" body: | jq has a few operators of the form `a op= b`, which are all equivalent to `a |= . op b`. So, `+= 1` can be used to increment values. examples: - program: .foo += 1 input: '{"foo": 42}' output: ['{"foo": 43}'] - title: Complex assignments body: | Lots more things are allowed on the left-hand side of a jq assignment than in most languages. We've already seen simple field accesses on the left hand side, and it's no surprise that array accesses work just as well: .posts[0].title = "JQ Manual" What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: .posts[].comments |= . + ["this is great"] That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts). When jq encounters an assignment like 'a = b', it records the "path" taken to select a part of the input document while executing a. This path is then used to find which part of the input to change while executing the assignment. Any filter may be used on the left-hand side of an equals - whichever paths it selects from the input will be where the assignment is performed. This is a very powerful operation. Suppose we wanted to add a comment to blog posts, using the same "blog" input above. This time, we only want to comment on the posts written by "stedolan". We can find those posts using the "select" function described earlier: .posts[] | select(.author == "stedolan") The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] - title: Modules body: | jq has a library/module system. Modules are files whose names end in `.jq`. Modules imported by a program are searched for in a default search path (see below). The `import` and `include` directives allow the importer to alter this path. Paths in the search path are subject to various substitutions. For paths starting with "~/", the user's home directory is substituted for "~". For paths starting with "$ORIGIN/", the directory where the jq executable is located is substituted for "$ORIGIN". For paths starting with "./" or paths that are ".", the path of the including file is substituted for ".". For top-level programs given on the command-line, the current directory is used. Import directives can optionally specify a search path to which the default is appended. The default search path is the search path given to the `-L` command-line option, else `["~/.jq", "$ORIGIN/../lib/jq", "$ORIGIN/../lib"]`. Null and empty string path elements terminate search path processing. A dependency with relative path "foo/bar" would be searched for in "foo/bar.jq" and "foo/bar/bar.jq" in the given search path. This is intended to allow modules to be placed in a directory along with, for example, version control files, README files, and so on, but also to allow for single-file modules. Consecutive components with the same name are not allowed to avoid ambiguities (e.g., "foo/foo"). For example, with `-L$HOME/.jq` a module `foo` can be found in `$HOME/.jq/foo.jq` and `$HOME/.jq/foo/foo.jq`. If "$HOME/.jq" is a file, it is sourced into the main program. entries: - title: "`import RelativePathString as NAME [];`" body: | Imports a module found at the given path relative to a directory in a search path. A ".jq" suffix will be added to the relative path string. The module's symbols are prefixed with "NAME::". The optional metadata must be a constant jq expression. It should be an object with keys like "homepage" and so on. At this time jq only uses the "search" key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The "search" key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`include RelativePathString [];`" body: | Imports a module found at the given path relative to a directory in a search path as if it were included in place. A ".jq" suffix will be added to the relative path string. The module's symbols are imported into the caller's namespace as if the module's content had been included directly. The optional metadata must be a constant jq expression. It should be an object with keys like "homepage" and so on. At this time jq only uses the "search" key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. - title: "`import RelativePathString as $NAME [];`" body: | Imports a JSON file found at the given path relative to a directory in a search path. A ".json" suffix will be added to the relative path string. The file's data will be available as `$NAME::NAME`. The optional metadata must be a constant jq expression. It should be an object with keys like "homepage" and so on. At this time jq only uses the "search" key/value of the metadata. The metadata is also made available to users via the `modulemeta` builtin. The "search" key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top-level search path. - title: "`module ;`" body: | This directive is entirely optional. It's not required for proper operation. It serves only the purpose of providing metadata that can be read with the `modulemeta` builtin. The metadata must be a constant jq expression. It should be an object with keys like "homepage". At this time jq doesn't use this metadata, but it is made available to users via the `modulemeta` builtin. - title: "`modulemeta`" body: | Takes a module name as input and outputs the module's metadata as an object, with the module's imports (including metadata) as an array value for the "deps" key. Programs can use this to query a module's metadata, which they could then use to, for example, search for, download, and install missing dependencies. jq-1.8.2/docs/content/manual/v1.8/0000755000175100017510000000000015215513536012260 5jq-1.8.2/docs/content/manual/v1.8/manual.yml0000644000175100017510000000000015215513536023202 1jq-1.8.2/docs/content/manual/manual.ymljq-1.8.2/docs/content/manual/v1.4/0000755000175100017510000000000015215513536012254 5jq-1.8.2/docs/content/manual/v1.4/manual.yml0000644000175100017510000016502715215513536014207 --- headline: jq 1.4 Manual body: | A jq program is a "filter": it takes an input, and produces an output. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks. Filters can be combined in various ways - you can pipe the output of one filter into another filter, or collect the output of a filter into an array. Some filters produce multiple results, for instance there's one that produces all the elements of its input array. Piping that filter into a second runs the second filter for each element of the array. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq. It's important to remember that every filter has an input and an output. Even literals like "hello" or 42 are filters - they take an input but always produce the same literal as output. Operations that combine two filters, like addition, generally feed the same input to both and combine the results. So, you can implement an averaging filter as `add / length` - feeding the input array both to the `add` filter and the `length` filter and dividing the results. But that's getting ahead of ourselves. :) Let's start with something simpler: manpage_intro: | jq(1) -- Command-line JSON processor ==================================== ## SYNOPSIS `jq` [...] [...] `jq` can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents. For instance, running the command `jq 'map(.price) | add'` will take an array of JSON objects as input and return the sum of their "price" fields. By default, `jq` reads a stream of JSON objects (whitespace separated) from `stdin`. One or more may be specified, in which case `jq` will read input from those instead. The are described in the [INVOKING JQ] section, they mostly concern input and output formatting. The is written in the jq language and specifies how to transform the input document. ## FILTERS manpage_epilogue: | ## BUGS Presumably. Report them or discuss them at: https://github.com/jqlang/jq/issues ## AUTHOR Stephen Dolan `` sections: - title: Invoking jq body: | jq filters run on a stream of JSON data. The input to jq is parsed as a sequence of whitespace-separated JSON values which are passed through the provided filter one at a time. The output(s) of the filter are written to standard output, as a sequence of newline-separated JSON data. Note: it is important to mind the shell's quoting rules. As a general rule it's best to always quote (with single-quote characters) the jq program, as too many characters with special meaning to jq are also shell meta-characters. For example, `jq "foo"` will fail on most Unix shells because that will be the same as `jq foo`, which will generally fail because `foo is not defined`. When using the Windows command shell (cmd.exe) it's best to use double quotes around your jq program when given on the command-line (instead of the `-f program-file` option), but then double-quotes in the jq program need backslash escaping. You can affect how jq reads and writes its input and output using some command-line options: * `--null-input` / `-n`: Don't read any input at all. Instead, the filter is run once using `null` as the input. This is useful when using jq as a simple calculator or to construct JSON data from scratch. * `--raw-input` / `-R`: Don't parse the input as JSON. Instead, each line of text is passed to the filter as a string. If combined with `--slurp`, then the entire input is passed to the filter as a single long string. * `--slurp` / `-s`: Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once. * `--online-input` / `-I`: When the top-level input value is an array produce its elements instead of the array. This allows on-line processing of potentially very large top-level arrays' elements. * `--compact-output` / `-c`: By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. * `--raw-output` / `-r`: With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. * `--ascii-output` / `-a`: jq usually outputs non-ASCII Unicode codepoints as UTF-8, even if the input specified them as escape sequences (like "\u03bc"). Using this option, you can force jq to produce pure ASCII output with every non-ASCII character replaced with the equivalent escape sequence. * `--sort-keys` / `-S`: Output the fields of each object with the keys in sorted order. * `--color-output` / `-C` and `--monochrome-output` / `-M`: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using `-C`, and disable color with `-M`. * `--unbuffered`: Flush the output after each JSON object is printed (useful if you're piping a slow data source into jq and piping jq's output elsewhere). * `-f filename` / `--from-file filename`: Read filter from the file rather than from a command line, like awk's -f option. You can also use '#' to make comments. * `--arg name value`: This option passes a value to the jq program as a predefined variable. If you run jq with `--arg foo bar`, then `$foo` is available in the program and has the value `"bar"`. * `--argfile name filename`: This option passes the first value from the named file as a value to the jq program as a predefined variable. If you run jq with `--argfile foo bar`, then `$foo` is available in the program and has the value resulting from parsing the content of the file named `bar`. * `--exit-status` / `-e`: Sets the exit status of jq to 0 if the last output value was neither `false` nor `null`, 1 if the last output value was either `false` or `null`, or 4 if no valid result was ever produced. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran. * `--version` / `-V`: Output the jq version and exit with zero. * `--help` / `-h`: Output the jq help and exit with zero. - title: Basic filters entries: - title: "`.`" body: | The absolute simplest (and least interesting) filter is `.`. This is a filter that takes its input and produces it unchanged as output. Since jq by default pretty-prints all output, this trivial program can be a useful way of formatting JSON output from, say, `curl`. examples: - program: '.' input: '"Hello, world!"' output: ['"Hello, world!"'] - title: "`.foo`, `.foo.bar`" body: | The simplest *useful* filter is `.foo`. When given a JSON object (aka dictionary or hash) as input, it produces the value at the key "foo", or null if there's none present. If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: `."foo$"`. A filter of the form `.foo.bar` is equivalent to `.foo|.bar`. examples: - program: '.foo' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]' input: '{"foo": 42}' output: ['42'] - title: "`.foo?`" body: | Just like `.foo`, but does not output an error when `.` is not an object. examples: - program: '.foo?' input: '{"foo": 42, "bar": "less interesting data"}' output: ['42'] - program: '.foo?' input: '{"notfoo": true, "alsonotfoo": false}' output: ['null'] - program: '.["foo"]?' input: '{"foo": 42}' output: ['42'] - program: '[.foo?]' input: '[1,2]' output: ['[]'] - title: "`.[]`, `.[]`, `.[:]`" body: | You can also look up fields of an object using syntax like `.["foo"]` (`.foo` above is a shorthand version of this). This one works for arrays as well, if the key is an integer. Arrays are zero-based, so `.[2]` returns the third element of the array. The `.[10:15]` syntax can be used to return a subarray of an array or substring of a string. The array returned by `.[10:15]` will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive). Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array). Indices are zero-based. The `?` "operator" can also be used with the slice operator, as in `.[10:15]?`, which outputs values where the inputs are slice-able. examples: - program: '.[0]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['{"name":"JSON", "good":true}'] - program: '.[2]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['null'] - program: '.[2:4]' input: '["a","b","c","d","e"]' output: ['["c", "d"]'] - program: '.[2:4]' input: '"abcdefghi"' output: ['"cd"'] - program: '.[:3]' input: '["a","b","c","d","e"]' output: ['["a", "b", "c"]'] - program: '.[-2:]' input: '["a","b","c","d","e"]' output: ['["d", "e"]'] - title: "`.[]`" body: | If you use the `.[index]` syntax, but omit the index entirely, it will return *all* of the elements of an array. Running `.[]` with the input `[1,2,3]` will produce the numbers as three separate results, rather than as a single array. You can also use this on an object, and it will return all the values of the object. examples: - program: '.[]' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: - '{"name":"JSON", "good":true}' - '{"name":"XML", "good":false}' - program: '.[]' input: '[]' output: [] - program: '.[]' input: '{"a": 1, "b": 1}' output: ['1', '1'] - title: "`.[]?`" body: | Like `.[]`, but no errors will be output if . is not an array or object. - title: "`,`" body: | If two filters are separated by a comma, then the input will be fed into both and there will be multiple outputs: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right. For instance, filter `.foo, .bar`, produces both the "foo" fields and "bar" fields as separate outputs. examples: - program: '.foo, .bar' input: '{"foo": 42, "bar": "something else", "baz": true}' output: ['42', '"something else"'] - program: ".user, .projects[]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['"stedolan"', '"jq"', '"wikiflow"'] - program: '.[4,2]' input: '["a","b","c","d","e"]' output: ['"e"', '"c"'] - title: "`|`" body: | The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right. It's pretty much the same as the Unix shell's pipe, if you're used to that. If the one on the left produces multiple results, the one on the right will be run for each of those results. So, the expression `.[] | .foo` retrieves the "foo" field of each element of the input array. examples: - program: '.[] | .name' input: '[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]' output: ['"JSON"', '"XML"'] - title: Types and Values body: | jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string keys), and "null". Booleans, null, strings and numbers are written the same way as in JSON. Just like everything else in jq, these simple values take an input and produce an output - `42` is a valid jq expression that takes an input, ignores it, and returns 42 instead. entries: - title: "Array construction: `[]`" body: | As in JSON, `[]` is used to construct arrays, as in `[1,2,3]`. The elements of the arrays can be any jq expression. All of the results produced by all of the expressions are collected into one big array. You can use it to construct an array out of a known quantity of values (as in `[.foo, .bar, .baz]`) or to "collect" all the results of a filter into an array (as in `[.items[].name]`) Once you understand the "," operator, you can look at jq's array syntax in a different light: the expression `[1,2,3]` is not using a built-in syntax for comma-separated arrays, but is instead applying the `[]` operator (collect results) to the expression 1,2,3 (which produces three different results). If you have a filter `X` that produces four results, then the expression `[X]` will produce a single result, an array of four elements. examples: - program: "[.user, .projects[]]" input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}' output: ['["stedolan", "jq", "wikiflow"]'] - title: "Objects: `{}`" body: | Like JSON, `{}` is for constructing objects (aka dictionaries or hashes), as in: `{"a": 42, "b": 17}`. If the keys are "sensible" (all alphabetic characters), then the quotes can be left off. The value can be any expression (although you may need to wrap it in parentheses if it's a complicated one), which gets applied to the {} expression's input (remember, all filters have an input and an output). {foo: .bar} will produce the JSON object `{"foo": 42}` if given the JSON object `{"bar":42, "baz":43}`. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write {user: .user, title: .title} Because that's so common, there's a shortcut syntax: `{user, title}`. If one of the expressions produces multiple results, multiple dictionaries will be produced. If the input's {"user":"stedolan","titles":["JQ Primer", "More JQ"]} then the expression {user, title: .titles[]} will produce two outputs: {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} Putting parentheses around the key means it will be evaluated as an expression. With the same input as above, {(.user): .titles} produces {"stedolan": ["JQ Primer", "More JQ"]} examples: - program: '{user, title: .titles[]}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: - '{"user":"stedolan", "title": "JQ Primer"}' - '{"user":"stedolan", "title": "More JQ"}' - program: '{(.user): .titles}' input: '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' output: ['{"stedolan": ["JQ Primer", "More JQ"]}'] - title: Builtin operators and functions body: | Some jq operators (for instance, `+`) do different things depending on the type of their arguments (arrays, numbers, etc.). However, jq never does implicit type conversions. If you try to add a string to an object you'll get an error message and no result. entries: - title: "Addition: `+`" body: | The operator `+` takes two filters, applies them both to the same input, and adds the results together. What "adding" means depends on the types involved: - **Numbers** are added by normal arithmetic. - **Arrays** are added by being concatenated into a larger array. - **Strings** are added by being joined into a larger string. - **Objects** are added by merging, that is, inserting all the key-value pairs from both objects into a single combined object. If both objects contain a value for the same key, the object on the right of the `+` wins. (For recursive merge use the `*` operator.) `null` can be added to any value, and returns the other value unchanged. examples: - program: '.a + 1' input: '{"a": 7}' output: ['8'] - program: '.a + .b' input: '{"a": [1,2], "b": [3,4]}' output: ['[1,2,3,4]'] - program: '.a + null' input: '{"a": 1}' output: ['1'] - program: '.a + 1' input: '{}' output: ['1'] - program: '{a: 1} + {b: 2} + {c: 3} + {a: 42}' input: 'null' output: ['{"a": 42, "b": 2, "c": 3}'] - title: "Subtraction: `-`" body: | As well as normal arithmetic subtraction on numbers, the `-` operator can be used on arrays to remove all occurrences of the second array's elements from the first array. examples: - program: '4 - .a' input: '{"a":3}' output: ['1'] - program: . - ["xml", "yaml"] input: '["xml", "yaml", "json"]' output: ['["json"]'] - title: "Multiplication, division, modulo: `*`, `/`, `%`" body: | These operators only work on numbers, and do the expected. Multiplying a string by a number produces the concatenation of that string that many times. Dividing a string by another splits the first using the second as separators. Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy. examples: - program: '10 / . * 3' input: '5' output: ['6'] - program: '. / ", "' input: '"a, b,c,d, e"' output: ['["a","b,c,d","e"]'] - program: '{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}' input: 'null' output: ['{"k": {"a": 0, "b": 2, "c": 3}}'] - title: "`length`" body: | The builtin function `length` gets the length of various different types of value: - The length of a **string** is the number of Unicode codepoints it contains (which will be the same as its JSON-encoded length in bytes if it's pure ASCII). - The length of an **array** is the number of elements. - The length of an **object** is the number of key-value pairs. - The length of **null** is zero. examples: - program: '.[] | length' input: '[[1,2], "string", {"a":2}, null]' output: ['2', '6', '1', '0'] - title: "`keys`" body: | The builtin function `keys`, when given an object, returns its keys in an array. The keys are sorted "alphabetically", by unicode codepoint order. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings. When `keys` is given an array, it returns the valid indices for that array: the integers from 0 to length-1. examples: - program: 'keys' input: '{"abc": 1, "abcd": 2, "Foo": 3}' output: ['["Foo", "abc", "abcd"]'] - program: 'keys' input: '[42,3,35]' output: ['[0,1,2]'] - title: "`has`" body: | The builtin function `has` returns whether the input object has the given key, or the input array has an element at the given index. `has($key)` has the same effect as checking whether `$key` is a member of the array returned by `keys`, although `has` will be faster. examples: - program: 'map(has("foo"))' input: '[{"foo": 42}, {}]' output: ['[true, false]'] - program: 'map(has(2))' input: '[[0,1], ["a","b","c"]]' output: ['[false, true]'] - title: "`del`" body: | The builtin function `del` removes a key and its corresponding value from an object. examples: - program: 'del(.foo)' input: '{"foo": 42, "bar": 9001, "baz": 42}' output: ['{"bar": 9001, "baz": 42}'] - program: 'del(.[1, 2])' input: '["foo", "bar", "baz"]' output: ['["foo"]'] - title: "`to_entries`, `from_entries`, `with_entries(f)`" body: | These functions convert between an object and an array of key-value pairs. If `to_entries` is passed an object, then for each `k: v` entry in the input, the output array includes `{"key": k, "value": v}`. `from_entries` does the opposite conversion, and `with_entries(f)` is a shorthand for `to_entries | map(f) | from_entries`, useful for doing some operation to all keys and values of an object. examples: - program: 'to_entries' input: '{"a": 1, "b": 2}' output: ['[{"key":"a", "value":1}, {"key":"b", "value":2}]'] - program: 'from_entries' input: '[{"key":"a", "value":1}, {"key":"b", "value":2}]' output: ['{"a": 1, "b": 2}'] - program: 'with_entries(.key |= "KEY_" + .)' input: '{"a": 1, "b": 2}' output: ['{"KEY_a": 1, "KEY_b": 2}'] - title: "`select`" body: | The function `select(foo)` produces its input unchanged if `foo` returns true for that input, and produces no output otherwise. It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))` will give you `[2,3]`. examples: - program: 'map(select(. >= 2))' input: '[1,5,3,0,7]' output: ['[5,3,7]'] - title: "`arrays`, `objects`, `iterables`, `booleans`, `numbers`, `strings`, `nulls`, `values`, `scalars`" body: | These built-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, strings, null, non-null values, and non-iterables, respectively. examples: - program: '.[]|numbers' input: '[[],{},1,"foo",null,true,false]' output: ['1'] - title: "`empty`" body: | `empty` returns no results. None at all. Not even `null`. It's useful on occasion. You'll know if you need it :) examples: - program: '1, empty, 2' input: 'null' output: ['1', '2'] - program: '[1,2,empty,3]' input: 'null' output: ['[1,2,3]'] - title: "`map(f)`" body: | For any filter `f`, `map(f)` will run that filter for each element of the input array, and produce the outputs a new array. `map(.+1)` will increment each element of an array of numbers. `map(f)` is equivalent to `[.[] | f]`. In fact, this is how it's defined. examples: - program: 'map(.+1)' input: '[1,2,3]' output: ['[2,3,4]'] - title: "`paths`" body: | Outputs the paths to all the elements in its input (except it does not output the empty list, representing . itself). `paths` is equivalent to def paths: path(recurse(if (type|. == "array" or . == "object") then .[] else empty end))|select(length > 0); examples: - program: '[paths]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1],[1,0],[1,1],[1,1,"a"]]'] - title: "`leaf_paths`" body: | Outputs the paths to all the leaves (non-array, non-object elements) in its input. examples: - program: '[leaf_paths]' input: '[1,[[],{"a":2}]]' output: ['[[0],[1,1,"a"]]'] - title: "`add`" body: | The filter `add` takes as input an array, and produces as output the elements of the array added together. This might mean summed, concatenated or merged depending on the types of the elements of the input array - the rules are the same as those for the `+` operator (described above). If the input is an empty array, `add` returns `null`. examples: - program: add input: '["a","b","c"]' output: ['"abc"'] - program: add input: '[1, 2, 3]' output: ['6'] - program: add input: '[]' output: ["null"] - title: "`any`" body: | The filter `any` takes as input an array of boolean values, and produces `true` as output if any of the elements of the array are `true`. If the input is an empty array, `any` returns `false`. examples: - program: any input: '[true, false]' output: ["true"] - program: any input: '[false, false]' output: ["false"] - program: any input: '[]' output: ["false"] - title: "`all`" body: | The filter `all` takes as input an array of boolean values, and produces `true` as output if all of the elements of the array are `true`. If the input is an empty array, `all` returns `true`. examples: - program: all input: '[true, false]' output: ["false"] - program: all input: '[true, true]' output: ["true"] - program: all input: '[]' output: ["true"] - title: "`range`" body: | The `range` function produces a range of numbers. `range(4;10)` produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers are produced as separate outputs. Use `[range(4;10)]` to get a range as an array. examples: - program: 'range(2;4)' input: 'null' output: ['2', '3'] - program: '[range(2;4)]' input: 'null' output: ['[2,3]'] - title: "`floor`" body: | The `floor` function returns the floor of its numeric input. examples: - program: 'floor' input: '3.14159' output: ['3'] - title: "`sqrt`" body: | The `sqrt` function returns the square root of its numeric input. examples: - program: 'sqrt' input: '9' output: ['3'] - title: "`tonumber`" body: | The `tonumber` function parses its input as a number. It will convert correctly-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input. examples: - program: '.[] | tonumber' input: '[1, "1"]' output: ['1', '1'] - title: "`tostring`" body: | The `tostring` function prints its input as a string. Strings are left unchanged, and all other values are JSON-encoded. examples: - program: '.[] | tostring' input: '[1, "1", [1]]' output: ['"1"', '"1"', '"[1]"'] - title: "`type`" body: | The `type` function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object. examples: - program: 'map(type)' input: '[0, false, [], {}, null, "hello"]' output: ['["number", "boolean", "array", "object", "null", "string"]'] - title: "`sort`, `sort_by`" body: | The `sort` functions sorts its input, which must be an array. Values are sorted in the following order: * `null` * `false` * `true` * numbers * strings, in alphabetical order (by unicode codepoint value) * arrays, in lexical order * objects The ordering for objects is a little complex: first they're compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key. `sort_by` may be used to sort by a particular field of an object, or by applying any jq filter. `sort_by(foo)` compares two elements by comparing the result of `foo` on each element. examples: - program: 'sort' input: '[8,3,null,6]' output: ['[null,3,6,8]'] - program: 'sort_by(.foo)' input: '[{"foo":4, "bar":10}, {"foo":3, "bar":100}, {"foo":2, "bar":1}]' output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":100}, {"foo":4, "bar":10}]'] - title: "`group_by`" body: | `group_by(.foo)` takes as input an array, groups the elements having the same `.foo` field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the `.foo` field. Any jq expression, not just a field access, may be used in place of `.foo`. The sorting order is the same as described in the `sort` function above. examples: - program: 'group_by(.foo)' input: '[{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}]' output: ['[[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]]'] - title: "`min`, `max`, `min_by`, `max_by`" body: | Find the minimum or maximum element of the input array. The `_by` versions allow you to specify a particular field or property to examine, e.g. `min_by(.foo)` finds the object with the smallest `foo` field. examples: - program: 'min' input: '[5,4,2,7]' output: ['2'] - program: 'max_by(.foo)' input: '[{"foo":1, "bar":14}, {"foo":2, "bar":3}]' output: ['{"foo":2, "bar":3}'] - title: "`unique`" body: | The `unique` function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed. examples: - program: 'unique' input: '[1,2,5,3,5,3,1,3]' output: ['[1,2,3,5]'] - title: "`unique_by`" body: | The `unique_by(.foo)` function takes as input an array and produces an array of the same elements, in sorted order, with elements with a duplicate `.foo` field removed. Think of it as making an array by taking one element out of every group produced by `group_by`. examples: - program: 'unique_by(.foo)' input: '[{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}]' output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]'] - program: 'unique_by(length)' input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]' output: ['["bacon", "chunky", "asparagus"]'] - title: "`reverse`" body: | This function reverses an array. examples: - program: 'reverse' input: '[1,2,3,4]' output: ['[4,3,2,1]'] - title: "`contains`" body: | The filter `contains(b)` will produce true if b is completely contained within the input. A string B is contained in a string A if B is a substring of A. An array B is contained in an array A is all elements in B are contained in any element in A. An object B is contained in object A if all of the values in B are contained in the value in A with the same key. All other types are assumed to be contained in each other if they are equal. examples: - program: 'contains("bar")' input: '"foobar"' output: ['true'] - program: 'contains(["baz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['true'] - program: 'contains(["bazzzzz", "bar"])' input: '["foobar", "foobaz", "blarp"]' output: ['false'] - program: 'contains({foo: 12, bar: [{barp: 12}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['true'] - program: 'contains({foo: 12, bar: [{barp: 15}]})' input: '{"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}' output: ['false'] - title: "`indices(s)`" body: | Outputs an array containing the indices in `.` where `s` occurs. The input may be an array, in which case if `s` is an array then the indices output will be those where all elements in `.` match those of `s`. examples: - program: 'indices(", ")' input: '"a,b, cd, efg, hijk"' output: ['[3,7,12]'] - program: 'indices(1)' input: '[0,1,2,1,3,1,4]' output: ['[1,3,5]'] - program: 'indices([1,2])' input: '[0,1,2,3,1,4,2,5,1,2,6,7]' output: ['[1,8]'] - title: "`index(s)`, `rindex(s)`" body: | Outputs the index of the first (`index`) or last (`rindex`) occurrence of `s` in the input. examples: - program: 'index(", ")' input: '"a,b, cd, efg, hijk"' output: ['3'] - program: 'rindex(", ")' input: '"a,b, cd, efg, hijk"' output: ['12'] - title: "`startswith`" body: | Outputs `true` if . starts with the given string argument. examples: - program: '[.[]|startswith("foo")]' input: '["fo", "foo", "barfoo", "foobar", "barfoob"]' output: ['[false, true, false, true, false]'] - title: "`endswith`" body: | Outputs `true` if . ends with the given string argument. examples: - program: '[.[]|endswith("foo")]' input: '["foobar", "barfoo"]' output: ['[false, true]'] - title: "`ltrimstr`" body: | Outputs its input with the given prefix string removed, if it starts with it. examples: - program: '[.[]|ltrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "afoo"]' output: ['["fo","","barfoo","bar","afoo"]'] - title: "`rtrimstr`" body: | Outputs its input with the given suffix string removed, if it starts with it. examples: - program: '[.[]|rtrimstr("foo")]' input: '["fo", "foo", "barfoo", "foobar", "foob"]' output: ['["fo","","bar","foobar","foob"]'] - title: "`explode`" body: | Converts an input string into an array of the string's codepoint numbers. examples: - program: 'explode' input: '"foobar"' output: ['[102,111,111,98,97,114]'] - title: "`implode`" body: | The inverse of explode. examples: - program: 'implode' input: '[65, 66, 67]' output: ['"ABC"'] - title: "`split`" body: | Splits an input string on the separator argument. examples: - program: 'split(", ")' input: '"a, b,c,d, e"' output: ['["a","b,c,d","e"]'] - title: "`join`" body: | Joins the array of elements given as input, using the argument as separator. It is the inverse of `split`: that is, running `split("foo") | join("foo")` over any input string returns said input string. examples: - program: 'join(", ")' input: '["a","b,c,d","e"]' output: ['"a, b,c,d, e"'] - title: "`recurse`" body: | The `recurse` function allows you to search through a recursive structure, and extract interesting data from all levels. Suppose your input represents a filesystem: {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} Now suppose you want to extract all of the filenames present. You need to retrieve `.name`, `.children[].name`, `.children[].children[].name`, and so on. You can do this with: recurse(.children[]) | .name examples: - program: 'recurse(.foo[])' input: '{"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]}' output: - '{"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}' - '{"foo":[]}' - '{"foo":[{"foo":[]}]}' - '{"foo":[]}' - title: "`recurse_down`" body: | A quieter version of `recurse(.[])`, equivalent to: def recurse_down: recurse(.[]?); - title: "`..`" body: | Short-hand for `recurse_down`. This is intended to resemble the XPath `//` operator. Note that `..a` does not work; use `..|a` instead. examples: - program: '..|.a?' input: '[[{"a":1}]]' output: ['1'] - title: "String interpolation: `\\(exp)`" body: | Inside a string, you can put an expression inside parens after a backslash. Whatever the expression returns will be interpolated into the string. examples: - program: '"The input was \(.), which is one less than \(.+1)"' input: '42' output: ['"The input was 42, which is one less than 43"'] - title: "Convert to/from JSON" body: | The `tojson` and `fromjson` builtins dump values as JSON texts or parse JSON texts into values, respectively. The tojson builtin differs from tostring in that tostring returns strings unmodified, while tojson encodes strings as JSON strings. examples: - program: '[.[]|tostring]' input: '[1, "foo", ["foo"]]' output: ['["1","foo","[\"foo\"]"]'] - program: '[.[]|tojson]' input: '[1, "foo", ["foo"]]' output: ['["1","\"foo\"","[\"foo\"]"]'] - program: '[.[]|tojson|fromjson]' input: '[1, "foo", ["foo"]]' output: ['[1,"foo",["foo"]]'] - title: "Format strings and escaping" body: | The `@foo` syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth. `@foo` can be used as a filter on its own, the possible escapings are: * `@text`: Calls `tostring`, see that function for details. * `@json`: Serialises the input as JSON. * `@html`: Applies HTML/XML escaping, by mapping the characters `<>&'"` to their entity equivalents `<`, `>`, `&`, `'`, `"`. * `@uri`: Applies percent-encoding, by mapping all reserved URI characters to a `%xx` sequence. * `@csv`: The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition. * `@sh`: The input is escaped suitable for use in a command-line for a POSIX shell. If the input is an array, the output will be a series of space-separated strings. * `@base64`: The input is converted to base64 as specified by RFC 4648. This syntax can be combined with string interpolation in a useful way. You can follow a `@foo` token with a string literal. The contents of the string literal will *not* be escaped. However, all interpolations made inside that string literal will be escaped. For instance, @uri "https://www.google.com/search?q=\(.search)" will produce the following output for the input `{"search":"what is jq?"}`: "https://www.google.com/search?q=what%20is%20jq%3f" Note that the slashes, question mark, etc. in the URL are not escaped, as they were part of the string literal. examples: - program: '@html' input: '"This works if x < y"' output: ['"This works if x < y"'] - program: '@sh "echo \(.)"' input: "\"O'Hara's Ale\"" output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""] - title: Conditionals and Comparisons entries: - title: "`==`, `!=`" body: | The expression 'a == b' will produce 'true' if the result of a and b are equal (that is, if they represent equivalent JSON documents) and 'false' otherwise. In particular, strings are never considered equal to numbers. If you're coming from JavaScript, jq's == is like JavaScript's === - considering values equal only when they have the same type as well as the same value. != is "not equal", and 'a != b' returns the opposite value of 'a == b' examples: - program: '.[] == 1' input: '[1, 1.0, "1", "banana"]' output: ['true', 'true', 'false', 'false'] - title: if-then-else-end body: | `if A then B else C end` will act the same as `B` if `A` produces a value other than false or null, but act the same as `C` otherwise. Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you'll sometimes have to be more explicit about the condition you want: you can't test whether, e.g. a string is empty using `if .name then A else B end`, you'll need something more like `if (.name | length) > 0 then A else B end` instead. If the condition `A` produces multiple results, then `B` is evaluated once for each result that is not false or null, and `C` is evaluated once for each false or null. More cases can be added to an if using `elif A then B` syntax. examples: - program: |- if . == 0 then "zero" elif . == 1 then "one" else "many" end input: '2' output: ['"many"'] - title: "`>`, `>=`, `<=`, `<`" body: | The comparison operators `>`, `>=`, `<=`, `<` return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively). The ordering is the same as that described for `sort`, above. examples: - program: '. < 5' input: '2' output: ['true'] - title: "`and`, `or`, `not`" body: | jq supports the normal Boolean operators `and`, `or`, `not`. They have the same standard of truth as if expressions - `false` and `null` are considered "false values", and anything else is a "true value". If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input. `not` is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in `.foo and .bar | not`. These three only produce the values `true` and `false`, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default". If you want to use this form of "or", picking between two values rather than evaluating a condition, see the `//` operator below. examples: - program: '42 and "a string"' input: 'null' output: ['true'] - program: '(true, false) or false' input: 'null' output: ['true', 'false'] - program: '(true, true) and (true, false)' input: 'null' output: ['true', 'false', 'true', 'false'] - program: '[true, false | not]' input: 'null' output: ['[false, true]'] - title: "Alternative operator: `//`" body: | A filter of the form `a // b` produces the same results as `a`, if `a` produces results other than `false` and `null`. Otherwise, `a // b` produces the same results as `b`. This is useful for providing defaults: `.foo // 1` will evaluate to `1` if there's no `.foo` element in the input. It's similar to how `or` is sometimes used in Python (jq's `or` operator is reserved for strictly Boolean operations). examples: - program: '.foo // 42' input: '{"foo": 19}' output: ['19'] - program: '.foo // 42' input: '{}' output: ['42'] - title: Advanced features body: | Variables are an absolute necessity in most programming languages, but they're relegated to an "advanced feature" in jq. In most languages, variables are the only means of passing around data. If you calculate a value, and you want to use it more than once, you'll need to store it in a variable. To pass a value to another part of the program, you'll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data. It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq's standard library (many jq functions such as `map` and `select` are in fact written in jq). Finally, jq has a `reduce` operation, which is very powerful but a bit tricky. Again, it's mostly used internally, to define some useful bits of jq's standard library. entries: - title: Variables body: | In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next. Many expressions, for instance `a + b`, pass their input to two distinct subexpressions (here `a` and `b` are both passed the same input), so variables aren't usually necessary in order to use a value twice. For instance, calculating the average value of an array of numbers requires a few variables in most languages - at least one to hold the array, perhaps one for each element or for a loop counter. In jq, it's simply `add / length` - the `add` expression is given the array and produces its sum, and the `length` expression is given the array and produces its length. So, there's generally a cleaner way to solve most problems in jq than defining variables. Still, sometimes they do make things easier, so jq lets you define variables using `expression as $variable`. All variable names start with `$`. Here's a slightly uglier version of the array-averaging example: length as $array_length | add / $array_length We'll need a more complicated problem to find a situation where using variables actually makes our lives easier. Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names. Our input looks like: {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} We want to produce the posts with the author field containing a real name, as in: {"title": "First post", "author": "Anonymous Coward"} {"title": "A well-written article", "author": "Person McPherson"} We use a variable, $names, to store the realnames object, so that we can refer to it later when looking up author usernames: .realnames as $names | .posts[] | {title, author: $names[.author]} The expression `exp as $x | ...` means: for each value of expression `exp`, run the rest of the pipeline with the entire original input, and with `$x` set to that value. Thus `as` functions as something of a foreach loop. Variables are scoped over the rest of the expression that defines them, so .realnames as $names | (.posts[] | {title, author: $names[.author]}) will work, but (.realnames as $names | .posts[]) | {title, author: $names[.author]} won't. examples: - program: '.bar as $x | .foo | . + $x' input: '{"foo":10, "bar":200}' output: ['210'] - title: 'Defining Functions' body: | You can give a filter a name using "def" syntax: def increment: . + 1; From then on, `increment` is usable as a filter just like a builtin function (in fact, this is how some of the builtins are defined). A function may take arguments: def map(f): [.[] | f]; Arguments are passed as filters, not as values. The same argument may be referenced multiple times with different inputs (here `f` is run for each element of the input array). Arguments to a function work more like callbacks than like value arguments. If you want the value-argument behaviour for defining simple functions, you can just use a variable: def addvalue(f): f as $value | map(. + $value); With that definition, `addvalue(.foo)` will add the current input's `.foo` field to each element of the array. examples: - program: 'def addvalue(f): . + [f]; map(addvalue(.[0]))' input: '[[1,2],[10,20]]' output: ['[[1,2,1], [10,20,10]]'] - program: 'def addvalue(f): f as $x | map(. + $x); addvalue(.[0])' input: '[[1,2],[10,20]]' output: ['[[1,2,1,2], [10,20,1,2]]'] - title: "`reduce`" body: | The `reduce` syntax allows you to combine all of the results of an expression by accumulating them into a single answer. The form is `reduce EXP as $var (INIT; UPDATE)`. As an example, we'll pass `[1,2,3]` to this expression: reduce .[] as $item (0; . + $item) For each result that `.[]` produces, `. + $item` is run to accumulate a running total, starting from 0 as the input value. In this example, `.[]` produces the results `1`, `2`, and `3`, so the effect is similar to running something like this: 0 | 1 as $item | . + $item | 2 as $item | . + $item | 3 as $item | . + $item examples: - program: 'reduce .[] as $item (0; . + $item)' input: '[1,2,3,4,5]' output: ['15'] - title: Assignment body: | Assignment works a little differently in jq than in most programming languages. jq doesn't distinguish between references to and copies of something - two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object". If an object has two fields which are arrays, `.foo` and `.bar`, and you append something to `.foo`, then `.bar` will not get bigger. Even if you've just set `.bar = .foo`. If you're used to programming in languages like Python, Java, Ruby, JavaScript, etc. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance, it doesn't actually do that, but that's the general idea). entries: - title: "`=`" body: | The filter `.foo = 1` will take as input an object and produce as output an object with the "foo" field set to 1. There is no notion of "modifying" or "changing" something in jq - all jq values are immutable. For instance, .foo = .bar | .foo.baz = 1 will not have the side-effect of setting .bar.baz to be set to 1, as the similar-looking program in JavaScript, Python, Ruby or other languages would. Unlike these languages (but like Haskell and some other functional languages), there is no notion of two arrays or objects being "the same array" or "the same object". They can be equal, or not equal, but if we change one of them in no circumstances will the other change behind our backs. This means that it's impossible to build circular values in jq (such as an array whose first element is itself). This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON. - title: "`|=`" body: | As well as the assignment operator '=', jq provides the "update" operator '|=', which takes a filter on the right-hand side and works out the new value for the property being assigned to by running the old value through this expression. For instance, .foo |= .+1 will build an object with the "foo" field set to the input's "foo" plus 1. This example should show the difference between '=' and '|=': Provide input '{"a": {"b": 10}, "b": 20}' to the programs: .a = .b .a |= .b The former will set the "a" field of the input to the "b" field of the input, and produce the output {"a": 20}. The latter will set the "a" field of the input to the "a" field's "b" field, producing {"a": 10}. - title: "`+=`, `-=`, `*=`, `/=`, `%=`, `//=`" body: | jq has a few operators of the form `a op= b`, which are all equivalent to `a |= . op b`. So, `+= 1` can be used to increment values. examples: - program: .foo += 1 input: '{"foo": 42}' output: ['{"foo": 43}'] - title: Complex assignments body: | Lots more things are allowed on the left-hand side of a jq assignment than in most languages. We've already seen simple field accesses on the left hand side, and it's no surprise that array accesses work just as well: .posts[0].title = "JQ Manual" What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: .posts[].comments |= . + ["this is great"] That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts). When jq encounters an assignment like 'a = b', it records the "path" taken to select a part of the input document while executing a. This path is then used to find which part of the input to change while executing the assignment. Any filter may be used on the left-hand side of an equals - whichever paths it selects from the input will be where the assignment is performed. This is a very powerful operation. Suppose we wanted to add a comment to blog posts, using the same "blog" input above. This time, we only want to comment on the posts written by "stedolan". We can find those posts using the "select" function described earlier: .posts[] | select(.author == "stedolan") The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: (.posts[] | select(.author == "stedolan") | .comments) |= . + ["terrible."] jq-1.8.2/docs/content/tutorial/0000755000175100017510000000000015215513536012152 5jq-1.8.2/docs/content/tutorial/default.yml0000644000175100017510000003416715215513536014254 headline: Tutorial body: - text: | GitHub has a JSON API, so let's play with that. This URL gets us the last 5 commits from the jq repo. - command: "curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5'" result: | [ { "sha": "cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "node_id": "C_kwDOAE3WVdoAKGNmZjUzMzZlYzcxYjZmZWUzOTZhOTViYjBlNGJlYTM2NWUwY2QxZTg", "commit": { "author": { "name": "Mattias Wadman", "email": "mattias.wadman@gmail.com", "date": "2021-06-09T14:02:22Z" }, "committer": { "name": "Nico Williams", "email": "nico@cryptonector.com", "date": "2022-05-26T21:04:32Z" }, "message": "docs: Document repeat(exp)", "tree": { "sha": "d67d5542df1f16d1a48e1fb75749f60482cd874b", "url": "https://api.github.com/repos/jqlang/jq/git/trees/d67d5542df1f16d1a48e1fb75749f60482cd874b" }, "url": "https://api.github.com/repos/jqlang/jq/git/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "comment_count": 0, "verification": { "verified": false, "reason": "unsigned", "signature": null, "payload": null } }, "url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "html_url": "https://github.com/jqlang/jq/commit/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "comments_url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8/comments", "author": { ... - text: | GitHub returns nicely formatted JSON. For servers that don't, it can be helpful to pipe the response through jq to pretty-print it. The simplest jq program is the expression `.`, which takes the input and produces it unchanged as output. - command: "curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5' | jq '.'" result: | [ { "sha": "cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "node_id": "C_kwDOAE3WVdoAKGNmZjUzMzZlYzcxYjZmZWUzOTZhOTViYjBlNGJlYTM2NWUwY2QxZTg", "commit": { "author": { "name": "Mattias Wadman", "email": "mattias.wadman@gmail.com", "date": "2021-06-09T14:02:22Z" }, "committer": { "name": "Nico Williams", "email": "nico@cryptonector.com", "date": "2022-05-26T21:04:32Z" }, "message": "docs: Document repeat(exp)", "tree": { "sha": "d67d5542df1f16d1a48e1fb75749f60482cd874b", "url": "https://api.github.com/repos/jqlang/jq/git/trees/d67d5542df1f16d1a48e1fb75749f60482cd874b" }, "url": "https://api.github.com/repos/jqlang/jq/git/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "comment_count": 0, "verification": { "verified": false, "reason": "unsigned", "signature": null, "payload": null } }, "url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "html_url": "https://github.com/jqlang/jq/commit/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "comments_url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8/comments", "author": { ... - text: | We can use jq to extract just the first commit. - command: "curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5' | jq '.[0]'" result: | { "sha": "cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "node_id": "C_kwDOAE3WVdoAKGNmZjUzMzZlYzcxYjZmZWUzOTZhOTViYjBlNGJlYTM2NWUwY2QxZTg", "commit": { "author": { "name": "Mattias Wadman", "email": "mattias.wadman@gmail.com", "date": "2021-06-09T14:02:22Z" }, "committer": { "name": "Nico Williams", "email": "nico@cryptonector.com", "date": "2022-05-26T21:04:32Z" }, "message": "docs: Document repeat(exp)", "tree": { "sha": "d67d5542df1f16d1a48e1fb75749f60482cd874b", "url": "https://api.github.com/repos/jqlang/jq/git/trees/d67d5542df1f16d1a48e1fb75749f60482cd874b" }, "url": "https://api.github.com/repos/jqlang/jq/git/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "comment_count": 0, "verification": { "verified": false, "reason": "unsigned", "signature": null, "payload": null } }, "url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "html_url": "https://github.com/jqlang/jq/commit/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8", "comments_url": "https://api.github.com/repos/jqlang/jq/commits/cff5336ec71b6fee396a95bb0e4bea365e0cd1e8/comments", "author": { "login": "wader", "id": 185566, "node_id": "MDQ6VXNlcjE4NTU2Ng==", "avatar_url": "https://avatars.githubusercontent.com/u/185566?v=4", "gravatar_id": "", "url": "https://api.github.com/users/wader", "html_url": "https://github.com/wader", "followers_url": "https://api.github.com/users/wader/followers", "following_url": "https://api.github.com/users/wader/following{/other_user}", "gists_url": "https://api.github.com/users/wader/gists{/gist_id}", "starred_url": "https://api.github.com/users/wader/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/wader/subscriptions", "organizations_url": "https://api.github.com/users/wader/orgs", "repos_url": "https://api.github.com/users/wader/repos", "events_url": "https://api.github.com/users/wader/events{/privacy}", "received_events_url": "https://api.github.com/users/wader/received_events", "type": "User", "site_admin": false }, "committer": { "login": "nicowilliams", "id": 604851, "node_id": "MDQ6VXNlcjYwNDg1MQ==", "avatar_url": "https://avatars.githubusercontent.com/u/604851?v=4", "gravatar_id": "", "url": "https://api.github.com/users/nicowilliams", "html_url": "https://github.com/nicowilliams", "followers_url": "https://api.github.com/users/nicowilliams/followers", "following_url": "https://api.github.com/users/nicowilliams/following{/other_user}", "gists_url": "https://api.github.com/users/nicowilliams/gists{/gist_id}", "starred_url": "https://api.github.com/users/nicowilliams/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/nicowilliams/subscriptions", "organizations_url": "https://api.github.com/users/nicowilliams/orgs", "repos_url": "https://api.github.com/users/nicowilliams/repos", "events_url": "https://api.github.com/users/nicowilliams/events{/privacy}", "received_events_url": "https://api.github.com/users/nicowilliams/received_events", "type": "User", "site_admin": false }, "parents": [ { "sha": "f2ad9517c72f6267ae317639ab56bbfd4a8653d4", "url": "https://api.github.com/repos/jqlang/jq/commits/f2ad9517c72f6267ae317639ab56bbfd4a8653d4", "html_url": "https://github.com/jqlang/jq/commit/f2ad9517c72f6267ae317639ab56bbfd4a8653d4" } ] } - text: | For the rest of the examples, I'll leave out the `curl` command - it's not going to change. There's a lot of info we don't care about there, so we'll restrict it down to the most interesting fields. - command: "jq '.[0] | {message: .commit.message, name: .commit.committer.name}'" result: | { "message": "docs: Document repeat(exp)", "name": "Nico Williams" } - text: | The `|` operator in jq feeds the output of one filter (`.[0]` which gets the first element of the array in the response) into the input of another (`{...}` which builds an object out of those fields). You can access nested attributes, such as `.commit.message`. Now let's get the rest of the commits. - command: "jq '.[] | {message: .commit.message, name: .commit.committer.name}'" result: | { "message": "docs: Document repeat(exp)", "name": "Nico Williams" } { "message": "Mention -n in IO-section and for input/inputs", "name": "Nico Williams" } { "message": "Fix iteration problem for non decimal string\n\nWhen the string transformation to number failed, all following\ntransformation failed too.\n\nThis happened because status in decNumberFromString function is\nupdated just in error case. Reusing the DEC_CONTEXT that failed\nbefore results into error even if the string is valid number.", "name": "Nico Williams" } { "message": "docs: point to Libera.Chat instead of Freenode", "name": "Nico Williams" } { "message": "Missing \"va_end\" call. This was found by running the cppcheck static analysis where it shows as error.", "name": "Nico Williams" } - text: | `.[]` returns each element of the array returned in the response, one at a time, which are all fed into `{message: .commit.message, name: .commit.committer.name}`. Data in jq is represented as streams of JSON values - every jq expression runs for each value in its input stream, and can produce any number of values to its output stream. Streams are serialised by just separating JSON values with whitespace. This is a `cat`-friendly format - you can just join two JSON streams together and get a valid JSON stream. If you want to get the output as a single array, you can tell jq to "collect" all of the answers by wrapping the filter in square brackets: - command: "jq '[.[] | {message: .commit.message, name: .commit.committer.name}]'" result: | [ { "message": "docs: Document repeat(exp)", "name": "Nico Williams" }, { "message": "Mention -n in IO-section and for input/inputs", "name": "Nico Williams" }, { "message": "Fix iteration problem for non decimal string\n\nWhen the string transformation to number failed, all following\ntransformation failed too.\n\nThis happened because status in decNumberFromString function is\nupdated just in error case. Reusing the DEC_CONTEXT that failed\nbefore results into error even if the string is valid number.", "name": "Nico Williams" }, { "message": "docs: point to Libera.Chat instead of Freenode", "name": "Nico Williams" }, { "message": "Missing \"va_end\" call. This was found by running the cppcheck static analysis where it shows as error.", "name": "Nico Williams" } ] - text: | - - - Next, let's try getting the URLs of the parent commits out of the API results as well. In each commit, the GitHub API includes information about "parent" commits. There can be one or many. "parents": [ { "sha": "f2ad9517c72f6267ae317639ab56bbfd4a8653d4", "url": "https://api.github.com/repos/jqlang/jq/commits/f2ad9517c72f6267ae317639ab56bbfd4a8653d4", "html_url": "https://github.com/jqlang/jq/commit/f2ad9517c72f6267ae317639ab56bbfd4a8653d4" } ] We want to pull out all of the "html_url" fields inside that array of parent commits and make a simple list of strings to go along with the "message" and "author" fields we already have. - command: "jq '[.[] | {message: .commit.message, name: .commit.committer.name, parents: [.parents[].html_url]}]'" result: | [ { "message": "docs: Document repeat(exp)", "name": "Nico Williams", "parents": [ "https://github.com/jqlang/jq/commit/f2ad9517c72f6267ae317639ab56bbfd4a8653d4" ] }, { "message": "Mention -n in IO-section and for input/inputs", "name": "Nico Williams", "parents": [ "https://github.com/jqlang/jq/commit/c4d39c4d22f2b12225ca1b311708f7e084ad9ff8" ] }, { "message": "Fix iteration problem for non decimal string\n\nWhen the string transformation to number failed, all following\ntransformation failed too.\n\nThis happened because status in decNumberFromString function is\nupdated just in error case. Reusing the DEC_CONTEXT that failed\nbefore results into error even if the string is valid number.", "name": "Nico Williams", "parents": [ "https://github.com/jqlang/jq/commit/174db0f93552bdb551ae1f3c5c64744df0ad8e2f" ] }, { "message": "docs: point to Libera.Chat instead of Freenode", "name": "Nico Williams", "parents": [ "https://github.com/jqlang/jq/commit/29cf77977ef52eec708982b19bf9d2ec17443337" ] }, { "message": "Missing \"va_end\" call. This was found by running the cppcheck static analysis where it shows as error.", "name": "Nico Williams", "parents": [ "https://github.com/jqlang/jq/commit/55e6e2c21829bd866bd4b18ee254b05c9020320a" ] } ] - text: | Here we're making an object as before, but this time the `parents` field is being set to `[.parents[].html_url]`, which collects all of the parent commit URLs defined in the parents object. - text: | - - - Here endeth the tutorial! There's lots more to play with. Go read [the manual](../manual/) if you're interested, and [download jq](../download/) if you haven't already. jq-1.8.2/docs/content/download/0000755000175100017510000000000015215513536012116 5jq-1.8.2/docs/content/download/default.yml0000644000175100017510000003200615215513536014206 headline: Download jq body: - text: | jq is written in C and has no runtime dependencies, so it should be possible to build it for nearly any platform. Prebuilt binaries are available for Linux, macOS and Windows. The binaries should just run, but on macOS and Linux you may need to make them executable first using `chmod +x jq`. jq is licensed under the MIT license. For all of the gory details, read the file `COPYING` in the source distribution. jq uses a C library for decimal number support. This is an ICU 1.8.1 licensed code obtained from the ICU downloads archive. ### Linux * jq is in the official [Debian](https://packages.debian.org/jq) and [Ubuntu](https://packages.ubuntu.com/jq) repositories. Install using `sudo apt-get install jq`. * jq is in the official [Fedora](https://src.fedoraproject.org/rpms/jq) repository. Install using `sudo dnf install jq`. * jq is in the official [openSUSE](https://software.opensuse.org/package/jq) repository. Install using `sudo zypper install jq`. * jq is in the official [Arch](https://archlinux.org/packages/?q=jq) repository. Install using `sudo pacman -S jq`. * jq 1.8.1 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-linux-amd64) or [ARM64](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-linux-arm64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-linux-i386). * jq 1.8.0 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-linux-amd64) or [ARM64](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-linux-arm64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-linux-i386). * jq 1.7.1 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64) or [ARM64](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-arm64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-i386). * jq 1.7 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-amd64) or [ARM64](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-arm64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-i386). * jq 1.6 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux32). * jq 1.5 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-linux32). * jq 1.4 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86_64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-linux-x86). * jq 1.3 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86_64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-linux-x86). ### macOS * Use [Homebrew](https://brew.sh/) to install jq with `brew install jq`. * Use [MacPorts](https://www.macports.org) to install jq with `port install jq`. * Use [Fink](https://finkproject.org) to install jq with `fink install jq`. * jq 1.8.1 binaries for [Apple Silicon](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-macos-arm64) or [Intel Mac](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-macos-amd64). * jq 1.8.0 binaries for [Apple Silicon](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-macos-arm64) or [Intel Mac](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-macos-amd64). * jq 1.7.1 binaries for [Apple Silicon](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64) or [Intel Mac](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-amd64). * jq 1.7 binaries for [Apple Silicon](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-arm64) or [Intel Mac](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-amd64). * jq 1.6 binary for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-osx-amd64). * jq 1.5 binary for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-osx-amd64). * jq 1.4 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86_64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-osx-x86). * jq 1.3 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86_64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-osx-x86). ### FreeBSD * `pkg install jq` as root installs a pre-built [binary package](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html). * `make -C /usr/ports/textproc/jq install clean` as root installs the [jq](https://www.freshports.org/textproc/jq/) [port](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html) from source. ### Solaris * `pkgutil -i jq` in [OpenCSW](https://www.opencsw.org/p/jq) for Solaris 10+, Sparc and x86. * jq 1.4 binaries for Solaris 11 [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-64) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-solaris11-32). ### Windows * Use [winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/) to install jq with `winget install jqlang.jq`. * Use [scoop](https://scoop.sh/) to install jq with `scoop install jq`. * Use [Chocolatey NuGet](https://chocolatey.org/) to install jq with `choco install jq`. * jq 1.8.1 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-windows-amd64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-windows-i386.exe). * jq 1.8.0 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-windows-amd64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-windows-i386.exe). * jq 1.7.1 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-windows-amd64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-windows-i386.exe). * jq 1.7 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-windows-amd64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-windows-i386.exe). * jq 1.6 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-win32.exe). * jq 1.5 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-win32.exe). * jq 1.4 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.4/jq-win32.exe). * jq 1.3 executables for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win64.exe) or [i386](https://github.com/jqlang/jq/releases/download/jq-1.3/jq-win32.exe). ### Checksums and signatures SHA-256 checksums are provided for all release and pre-release binaries. The checksums for jq 1.8.1 are in [sig/v1.8.1/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.8.1/sha256sum.txt). The checksums for jq 1.8.0 are in [sig/v1.8.0/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.8.0/sha256sum.txt). The checksums for jq 1.7.1 are in [sig/v1.7.1/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.7.1/sha256sum.txt). The checksums for jq 1.7 are in [sig/v1.7/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.7/sha256sum.txt). The checksums for jq 1.6 are in [sig/v1.6/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.6/sha256sum.txt). The checksums for jq 1.5 are in [sig/v1.5/sha256sum.txt](https://raw.githubusercontent.com/jqlang/jq/master/sig/v1.5/sha256sum.txt). Additionally, all release artifacts are signed by a jq release key. We have two release keys, [one for 1.6 and older releases](https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-old.key), and [one for 1.7 and newer releases](https://raw.githubusercontent.com/jqlang/jq/master/sig/jq-release-new.key). The signatures for jq 1.8.1 are in [sig/v1.8.1/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.8.1). The signatures for jq 1.8.0 are in [sig/v1.8.0/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.8.0). The signatures for jq 1.7.1 are in [sig/v1.7.1/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.7.1). The signatures for jq 1.7 are in [sig/v1.7/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.7). The signatures for jq 1.6 are in [sig/v1.6/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.6). The signatures for jq 1.5 are in [sig/v1.5/\*.asc](https://github.com/jqlang/jq/tree/master/sig/v1.5). You can use [GnuPG](https://gnupg.org/) to verify a signature by downloading the signature and running `gpg --verify signature.asc`. ### From source on Linux, macOS, Cygwin, and other POSIX-like operating systems * [Source tarball for jq 1.8.1](https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-1.8.1.tar.gz) * [Source tarball for jq 1.8.0](https://github.com/jqlang/jq/releases/download/jq-1.8.0/jq-1.8.0.tar.gz) * [Source tarball for jq 1.7.1](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-1.7.1.tar.gz) * [Source tarball for jq 1.7](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-1.7.tar.gz) * [Source tarball for jq 1.6](https://github.com/jqlang/jq/releases/download/jq-1.6/jq-1.6.tar.gz) * [Source tarball for jq 1.5](https://github.com/jqlang/jq/releases/download/jq-1.5/jq-1.5.tar.gz) You can build it using the usual `./configure && make && sudo make install` rigmarole. If you're interested in using the latest development version, try: git clone --recursive https://github.com/jqlang/jq.git cd jq autoreconf -i ./configure make sudo make install To build it from a git clone, you'll need to install a few packages first: * [GCC](https://gcc.gnu.org) * [Make](https://www.gnu.org/software/make/) * [Autotools](https://www.gnu.org/software/automake/) For Linux systems, these will all be in your system's package manager, and if you do development on the machine they're most likely already installed. On macOS, these are all included in Apple's command line tools, which can be installed from [Xcode](https://developer.apple.com/xcode/). However, you may find that you need a newer version of Bison than the one provided by Apple. This can be found in [Homebrew](https://brew.sh/) or [MacPorts](https://macports.org/). If you want to generate the lexer and parser from source you can use the `--enable-maintainer-mode` configure flag. This requires bison to be installed. [Flex](https://github.com/westes/flex) and [Bison](https://www.gnu.org/software/bison/). ### Docker Docker image is available from [GitHub Container Registry](https://github.com/jqlang/jq/pkgs/container/jq). docker run -i --rm ghcr.io/jqlang/jq -n 'range(3)' #### Building the documentation jq's documentation is compiled into static HTML using Python. To build the docs, run `pipenv run python3 build_website.py` in the `docs/` directory. To serve them locally, you can run `python3 -m http.server -d output`. You'll need a few Python dependencies, which can be installed by following the instructions in `docs/README.md`. The man page is built by `make jq.1`, or just `make`, also from the YAML docs, and you'll still need the Python dependencies to build the manpage. jq-1.8.2/docs/README.md0000644000175100017510000000204515215513536010035 Documentation ============= The jq website, manpages and some of the tests are generated from this directory. The manual is a YAML file in `content/manual`. To build the documentation (including building the jq manpage), you'll need `python3` and `pipenv`. You can install `pipenv` like so: pip install pipenv Though, you may need to say `pip3` instead, depending on your system. Once you have `pipenv` installed, you can install the dependencies by running `pipenv sync` from the `docs/` directory. Also, you may need to run `virtualenv -p /usr/bin/python3 venv/` and then `source venv/bin/activate`, and only then `pipenv sync`. Once this is done, rerun `./configure --enable-docs` in the jq root directory and then the `Makefile` will be able to generate the jq manpage. You can just run `make jq.1` to build the manpage manually, and `make tests/man.test` to update the manual tests. To build the website, run `pipenv run python3 build_website.py` in the `docs/` directory. To serve them locally, you can run `python3 -m http.server -d output`. jq-1.8.2/docs/manual_schema.yml0000644000175100017510000000247315215513536012103 type: object required: - headline - body - manpage_intro - manpage_epilogue - sections additionalProperties: false properties: headline: type: string body: type: string manpage_intro: type: string manpage_epilogue: type: string sections: type: array items: type: object required: - title additionalProperties: false properties: title: type: string body: type: string entries: type: array items: type: object required: - title - body additionalProperties: false properties: title: type: string body: type: string examples: type: array items: type: object required: - program - input - output additionalProperties: false properties: program: type: string input: type: string output: type: array items: type: string jq-1.8.2/docs/public/0000755000175100017510000000000015215513536010113 5jq-1.8.2/docs/public/icon.png0000644000175100017510000001154315215513536011475 ‰PNG  IHDR´´=Í2 pHYs7]7]€F]tEXtSoftwarewww.inkscape.org›î<ðIDATxœí�yLT×û‡?ÃjP@¨¢T”E-�""n© (BqAE¡š5µƴn©mZ¥©V+­ÖتiT(H#.hÅ*Uą bUD�¸¡È"ؑåþþðk¶Uçž;÷ÎÜ9¼ϟz–xæιç¼ç� ‚,LAÈ Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp Mp…•© ^MKK NŸ>�‚‚TUU¡}ûöðòòÂèѣáèèhêðT ­RÒÓӑ��€òòòÿüŸ­­-âââ°|ùr888˜ :õ¢A0uÄÿ#–.]Šm۶é-۫W/ìٳo½õ–"3h ­2֬Y#JføóÏ?1mÚ4<~üXá¨ÌZE”””`ýúõÌu¾ýö[…"2?Hh±qãF´´´0×۲e þúë/"2?Hh• <(©ncc#Ž?.sDæ ­ª««Q]]-¹þõë×eŒÆ|!¡U“'O ªßÐÐ S$æ ­\]]aa!ýÏáææ&c4æ ­lmmáïï/¹þ�!CdŒÆ|iÓB×ÔÔàƍhnn6u(€iӦIª7`ÀxyyÉ�yÒfW wî܉ääd´¶¶ÂÖÖýúõÄ �Fc’˜ž>}ŠaÆáڵk¢ëXZZb߾}ô„þmR貲2ÄÇÇãe?º§§'f͚…�š 2àڵk ãG�D•_µj,X pTæC›rìڵë¥2À�7°bÅ lذÁ$C:t¾¾¾¯-ggg‡ï¿ÿždþmî ]QQ�ٳg£µµUoٙ3gbƌFˆ꿴´´ 55{÷îEAAžA@^^.^¼ˆêêj‚€'Ož@§Ó1·õ:´Z-ÜÝÝ�.]ºÈڶPXXˆÂÂBTVV¢¶¶555Ðjµprr‚‹‹ zöì øøøuÜß&„®®®ƁD— D÷îݙûY¾|9~úé'æzRIHH@rr2BBB﫩© éééHIIÁ™3gD?ìíí1fÌLœ8!!!°µµýÇÿgeeaçΝ(++ƒN§C}}ý?þßÁÁ^^^˜;w.ƌ£·¿61m·eˤ¥¥‰.¿nÝ:ôë׏©�N<}ú”5<ƒèԩŠ‹‹ae¥ܳiÿþýøôÓOqóæMƒÚqqqÁüùó1{ölØÙ١  aaa¢êZYYáܹspwwm9îÇÐuuuøõ×_E—÷ñña–*++�.3ܻw·nÝR¤íªª*ÄÅÅáý÷ß7XfxðàV®\‰þýû#''%%%¢ë677ãôéÓzËq?äÈÊÊbڞ4eÊIý˜BæçTVVʞœtòäI|ðÁxøð¡¬íÏ>(±±±ððð`ª'f×Oh�N‡¬¬,Ñå]]]1lØ0É}™ ¹?LIII˜\–|+++=z………¨¯¯—°qãF½?«……üýý±iÓ&ÄÅÅaúôéxðà�ÔpEÁÕº¢¢üñ‡èòðññQ0"u“””Ä\ÇÉÉ 999Ì܀€¤¥¥)þ®Á•Щ©©¢&ߟ#õ ¸~ý: ™êXXX 99YïÞWѷo_,[¶LR]±p#ôƒ˜·WIIB⅜œæ:sæÌÁ»ï¾kP¿qqqè֭›Am¼n„NOOg:v ::ZÁhÔOnn.Sy­V‹ŋܯ­­­ä01p!ôãǏ±ÿ~ÑåÝÝÝ ~Ҙ3---8{ö,S�±cǢcǎ²ô/6Z \½oß>466Š.?uêT“÷¥®^½Êôû¤§վ tèÐA¶ö^Äì…~úô)SЍ³³3F�¥`Dê‡åì<àYâÖȑ#eëßÂÂB±Ã%Í^è0­FEFFÂÆÆFÁˆÔëß~[ö-^žžž²¶÷³ºµµ•)ET«Õbìر Fdܾ}›©¼Ôiº×ѣGÙÛÌ\輼<¦?NDDìììŒÈ<¨««c*¯„|J-°˜µÐ,)¢666˜4i’‚јÿ>*@o¼ñ†ì1(Ñ&`ÆBŸ;wŽéå&44NNN Fd>°&N‘ÐF`Ϟ=¢Ëʕ"ªVX§ Y7#(‘%§ԋ¹Y ]VV†sçΉ.?bÄ“™e,”Z‰oC¯±{f)4k’’K­j€Uh֣yï߿ÏT^ Jí�1;¡«ªª�——'ºü€¸Oešu»ëBŒHèÿ‘‘‘Á”„4}út£‘c5Èúr\TT${\,祰`VB7662¥=öîÝ}ûöU0"ù‘r¾ëºk׮Låkkk™ΡƒRw“›•ÐÙÙÙLwZÇÆÆ*�2H™Q`ZÊB‰”üé×!÷ä9f#tss3SR·nÝ0hÐ #RcœÀԻwoæÁ¾}ûd뿾¾²µ÷"f#ôѣGQUU%º|LLŒY¦ˆJyB³NÃ9::¢gϞLuŠ‹‹‘ŸŸÏTçU>|X±w³Z¦eîΝ;˚îhLŒuFÞСC™ëlذA–¾322diçe$´ ̉âR8sæ SÊã”)SÌö>?)O.)ßDR¦ÌÍÍEff&s½©¬¬dÞþÅs’kmm-222�ŸŸ�ŠŠ ´´´ÀÖÖ¾¾¾ ˜1cd—‰e™ÛÑÑ¡¡¡²öoLŒñRÆ ƒ“““è;ş³lÙ2øùùIÎÀ[¾|¹¢‡Ã3=¡�9‚™3gbçΝ¸yóæß_�:�çϟÇúõë/éð’WqõêU‰.ùŸ‹iÌ cLÛÏ6«J9ơªª “&MBee%sÝm۶1íý”‚h¡³²²°fͽCŒ[·naᅲÜɰ=�µZ-ƍ'K¿¦ÂXOh˜5k–¤oÓòòrŒ9Rô{MSS֮]k”ãzE ]RR‚͛7‹n´¡¡Ÿþ¹Á_-wïÞʼn'D—�ˆˆ€½½½A}šcœîéé)9ϥººñññÆæ͛qãƍü½AÀ•+W°eË 4k֬1Ê*¨¨1ô֭[™ѷoßFvv¶¤ ,Ÿ“––&º_ƒÏxVRžІ¼³,[¶ ™™™L+½ȅ pá¬X±�®®®555&¹ÖBïú޽{L§y¾ÈáÇ%ÕžM¾³\e,ÇÏj@ŠІä{xx`ѢE’뿈 ¸ÿ>ªªªLvG‹^¡/^¼(ù«¢´´Tò´^VV–èœY ƒ¾ Ԅ”!G»ví êsѢEÜ‹¦WhC¬–r5XSS²³³E— â&�_J⻡³:666øñÇÍö‚Ñ+´¡¿,){Ç<(úƒ¤Ñh¸:ETŠÐrìÏóööÆöíÛ½bÙèš5ÕðE´Z-sî­ øå—_D—Ó o§ˆJyç0t ý"áááHII‘µMc¢WhkkkLž<™¹a�F#麖$$???¼óÎ;Ì}¨)Oh¹wP�=iiièԩ“¬í¾ˆF£Qä*ÔˎÝ~«�:`óæÍHJJbΟ~ÎÎÎXµjòóó1bÄ"ü/¢Ÿù®®®HLLDTTÔ+¯vuuŒ%K°xñb毓ÊÊJ¦r5m¯*++CII ÓæݗqçΦM À³Üo¥™0aòóóñóÏ?cðàÁ̹#½zõÂêիqþüy,X°@їN¦9­V‹øøxÄÆƢ  ¨¯¯‡³³3|}}ѧOÉ_iii¢pºwï.)A]nZ[[±xñâ¿o“òõõEjjª䙡£G�2×1†ÐÀ³ūððp„‡‡ãöíÛ8v슋‹Q^^Žû÷®MMMÏlyyyÁ××£F�Rì,è—!iÒÑÞÞÁÁÁ²QSSÔô«ŠíU_|ñÅ?®F»|ù2"##‘››+)IjǎÌu”:gùutéÒ111FïW ª؂•™™ �N'ªl׮]1|øp…#ÒOff&6nÜøŸ¿zõ*.\ÈÜ^vv6Μ9Ã\�—%k¹0¹Ð:�Ži™;66V‘éJKK_+mff&~øáÑ핕•áã�?–ËàÁƒ%Õã“ ]^^.ún777Y‡:Rhjjœ9sôeõÙgŸaåʕzJNž<‰qãÆIº2Ø××ÞÞÞÌõxÆä ÷žžžðööu’δiÓL¾ùuõêոpá‚Þr‚ 11©©©ˆŠŠBHHºwï<|øgϞEzz:rss%g3Θ1CR=žÑÆØF ‡††$&&â·ß~{eWWWìرäÉ3gϞEhh¨"ç%³âä䄢¢"³ޡãíí͔͙��€ùó翶Œɇ`gg‡O>ù_ýõ+W£££Mž ¶zõjUÈ K–,1k™•BB?§ÿþشi¾úê+ :ô€IçHÈÍɓ'M€g«¤³fÍ2uªÄäcè£ÑhˆÀÀ@477£®®N5[«¼¼¼pùòe“ÆЮ];lݺõ•«µmU=¡ÿ�•••jd€ÄÄD“_ڹnÝ:ôéÓǤ1¨U ­6°nÝ:“¬Rj4|ù嗪Êa16b~ï$4#3fÌÀwß}gÔéC+++¬]»óæÍ3ZŸjDÌV3Z±±±HII1Êp¨sçÎÈÊʢ—@ˆ»}–„–HXX~ÿýwÅV.---‡'N`Ȑ!ŠôajXÓHÅÜÞEB€››ÒÒҐžž???Yڴ¶¶FTTòòòðÍ7ߨê¥XnXçÑ}}}õ–Qݴ�9„   "%%999L¹è߿?ÂÃà 777£U#GŽ}eÜĉáîœ*–¾yãùA…§N�Bii)nݺ…úúzÔÕÕA£ÑÀÅÅ;vD�=Я_?øûûÃÅÅÅÔa�N‡ääd?~wîÜACCñøñcØÛÛÃÞÞ Á̙3E­“ÐWÐšà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šà šàŠÿ¡-Bk~W- IEND®B`‚jq-1.8.2/docs/public/CNAME0000644000175100017510000000001315215513536010573 jqlang.org jq-1.8.2/docs/public/icon.svg0000644000175100017510000000175615215513536011515 jq-1.8.2/docs/public/jq.svg0000644000175100017510000000201315215513536011162 jq-1.8.2/docs/public/css/0000755000175100017510000000000015215513536010703 5jq-1.8.2/docs/public/css/style.css0000644000175100017510000000305315215513536012476 main { padding: 1rem; & * { scroll-margin-top: 4rem; } @media print { width: 100%!important; --bs-code-color: --bs-body-color; } } header { z-index: 1050!important; /* higher than #contents */ } section[id] { display: flow-root; > :first-child { .icon-link { opacity: 0; &:focus { opacity: .8; } } &:hover .icon-link { opacity: 1; } } } .offcanvas[aria-modal=true] .nav-link { padding: .7rem; } .offcanvas-md { --bs-offcanvas-width: auto; } ul { list-style: none; padding-left: 1rem; } pre { margin: 0 .5rem 1rem; padding: .5rem 1rem; background-color: var(--bs-secondary-bg-subtle); border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color); } button { &[aria-expanded=false] { .bi-chevron-down, .hide-result-text { display: none; } } &[aria-expanded=true] { .bi-chevron-right, .show-result-text { display: none; } } } mark { padding: 0; } .container-searchbox { position: relative; & input:focus ~ kbd { display: none; } & ul { position: absolute; width: 100%; top: 100%; padding: 0; background-color: var(--bs-body-bg); border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color); } & li { padding: .3em .6em; white-space: nowrap; overflow-x: hidden; &[aria-selected=true] { background-color: var(--bs-secondary-bg); } &:hover { cursor: pointer; background-color: var(--bs-secondary-bg-subtle); } } } jq-1.8.2/docs/public/robots.txt0000644000175100017510000000002615215513536012102 User-agent: * Allow: /jq-1.8.2/docs/public/js/0000755000175100017510000000000015215513536010527 5jq-1.8.2/docs/public/js/manual-search.js0000644000175100017510000000252515215513536013531 (() => { const searchInput = document.querySelector('input#searchbox'); const sectionIDs = JSON.parse(document.querySelector('#section-ids').innerText); const sanitize = (string) => string.replaceAll('<', '<').replaceAll('>', '>'); new autoComplete({ selector: `#${searchInput.id}`, wrapper: false, data: { src: Object.keys(sectionIDs), filter: (list) => list.sort((x, y) => x.match.indexOf('<') - y.match.indexOf('<') || x.value.length - y.value.length), }, searchEngine: (query, value) => { const index = value.toLowerCase().indexOf(query.toLowerCase()); if (index >= 0) { return sanitize(value.substring(0, index)) + `${sanitize(value.substring(index, index + query.length))}` + sanitize(value.substring(index + query.length)); } }, }); searchInput.addEventListener('selection', (event) => { event.target.value = event.detail.selection.value; location.hash = `#${sectionIDs[event.detail.selection.value]}`; }); document.addEventListener('keydown', (event) => { if (event.code === 'Slash' && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey && !/^(INPUT|TEXTAREA)$/.test(event.target.nodeName)) { searchInput.focus(); searchInput.select(); event.preventDefault(); } }); })(); jq-1.8.2/docs/public/.htaccess0000644000175100017510000000133715215513536011635 DirectoryIndex index.html FileETag All # Compress all static assets # compress content with type html, text, and css AddOutputFilterByType DEFLATE text/css text/html text/javascript application/javascript application/x-javascript text/js text/plain text/xml # properly handle requests coming from behind proxies Header append Vary User-Agent # Cache, aggressively ExpiresActive On ExpiresDefault "access plus 10 days" ExpiresDefault "access plus 10 years" # Mime-types AddType application/vnd.ms-fontobject .eot AddType font/ttf .ttf AddType font/otf .otf jq-1.8.2/docs/templates/0000755000175100017510000000000015215513536010633 5jq-1.8.2/docs/templates/index.html.j20000644000175100017510000000602615215513536013066 {% include "shared/_head.html.j2" %} {% include "shared/_navbar.html.j2" %}
{{ body1 | markdownify }}
{{ body2 | markdownify }}
{{ body3 | markdownify }}
{{ tail | markdownify }}

News

    {%- for item in news %}
  • {{ item.date }} {{ item.body | markdownify }}
  • {%- endfor %}
{% include "shared/_footer.html.j2" %} jq-1.8.2/docs/templates/default.html.j20000644000175100017510000000236515215513536013405 {% include "shared/_head.html.j2" %} {% include "shared/_navbar.html.j2" %}

{{ headline }}

{%- for item in body %} {%- if item.text %} {{ item.text | markdownify }} {%- endif %} {%- if item.command %} {%- set resultID = unique_id() %}
{{ item.command }}
{{ item.result }}
{%- endif %} {%- endfor %}
{% include "shared/_footer.html.j2" %} jq-1.8.2/docs/templates/shared/0000755000175100017510000000000015215513536012101 5jq-1.8.2/docs/templates/shared/_footer.html.j20000644000175100017510000000142415215513536014657

This website is made with Bootstrap, themed with Bootswatch.

jq is licensed under the MIT license (code) and the CC-BY-3.0 license (docs).

jq-1.8.2/docs/templates/shared/_head.html.j20000644000175100017510000000312615215513536014263 {{ headline }} jq-1.8.2/docs/templates/shared/_navbar.html.j20000644000175100017510000000636515215513536014643
Skip to main content {%- if navitem.startswith('manual') %} Skip to table of contents {%- endif %}
jq-1.8.2/docs/templates/manual.html.j20000644000175100017510000001403715215513536013235 {% include "shared/_head.html.j2" %} {% include "shared/_navbar.html.j2" %}
{%- set section_ids = {} %} {%- macro check_section_id(id) -%} {%- if section_ids.__contains__(id) %} {{- raise('Duplicate section id: ' ~ id) }} {%- endif %} {%- set _ = section_ids.__setitem__(id, true) %} {%- endmacro %}

{{ headline }}

For other versions, see 1.8, 1.7, 1.6, 1.5, 1.4, 1.3 or development version.

{{ body | markdownify }} {%- for section in sections %}
{{ check_section_id(section.title | section_id) }}

{{ section.title }}

{{ section.body | markdownify if section.body }} {%- for entry in section.entries %}
{{ check_section_id(entry.title | entry_id) }}

{{ entry.title | markdownify | no_paragraph }}

{{ entry.body | markdownify }} {%- if entry.examples %}
{%- set exampleID = unique_id() %}
{%- for example in entry.examples %} {%- if not example.output[0] %} {%- endif %} {%- for output in example.output %} {%- endfor %}
Command jq '{{ example.program }}'
Input {{ example.input }}
Output none
{% if loop.first %}Output{% endif %} {{ output }}
Run
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- endfor %}
{% include "shared/_footer.html.j2" %} jq-1.8.2/docs/Pipfile.lock0000644000175100017510000011552515215513536011030 { "_meta": { "hash": { "sha256": "14036c3c9f103c52a0c5a53346ef33c2fbef409697f9eb314da51ccdd3aa9fb2" }, "pipfile-spec": 6, "requires": {}, "sources": [ { "name": "pypi", "url": "https://pypi.org/simple", "verify_ssl": true } ] }, "default": { "attrs": { "hashes": [ "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11", "sha256:adcf7e2a1fb3b36ac48d97835bb6d8ade15b8dcce26aba8bf1d14847b57a3373" ], "markers": "python_version >= '3.9'", "version": "==25.4.0" }, "importlib-metadata": { "hashes": [ "sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000", "sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd" ], "markers": "python_version >= '3.9'", "version": "==8.7.0" }, "importlib-resources": { "hashes": [ "sha256:4cf94875a8368bd89531a756df9a9ebe1f150e0f885030b461237bc7f2d905f2", "sha256:d952faee11004c045f785bb5636e8f885bed30dc3c940d5d42798a2a4541c185" ], "index": "pypi", "version": "==6.0.0" }, "jinja2": { "hashes": [ "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67" ], "index": "pypi", "markers": "python_version >= '3.7'", "version": "==3.1.6" }, "jsonschema": { "hashes": [ "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce" ], "index": "pypi", "markers": "python_version >= '3.10'", "version": "==4.26.0" }, "jsonschema-specifications": { "hashes": [ "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d" ], "markers": "python_version >= '3.9'", "version": "==2025.9.1" }, "lxml": { "hashes": [ "sha256:05a82eb6e1530a64f26225b55cbd178113bd0b5af1c2b625f25e5296742c26d2", "sha256:07a4a68e286ee7a1ed7dfb8af83e615757c0ccfe9f18c6b4ea6771388d9ba8c9", "sha256:09dd5b7075dc2f7709654a46543ba1ea3c2e217b2ed8fbd413a8a945a0f40f60", "sha256:0b7e8a14c8634bf6f7a568634cb395305a6d964aeb5b7ee32248094bed3a7e2c", "sha256:104c09bda8d2a562824c0e319d0768ce26a779b7601e0931d33b09b53c392ef7", "sha256:126c93f7f56f0eda92f6d8c619edc463a4f23d9252f1c9d0405a76f25fa9f11a", "sha256:162af1091cd785f2f27e62d3547ae9bc58ec5c86dd314d67021fd02463708d83", "sha256:17e0e18d4ad8adbd0399291bc44845b69d9dd68439a3cdebdf35ff902ec05072", "sha256:18b73c339ae29b90fd2d06e58ebd555a751bde9cd6bbd36cc0281b9a2c94e9d8", "sha256:19607c6bbff2a44cf3fe8250abccd20942d3462473e0a721d01d379ed017e462", "sha256:19b7ab10b210b0b3ad7985d9ac4eb66ab09a90b20fe6e2f7ba55d01a234345d0", "sha256:1d4962d4c66bf830a7e59ed6cfc17d148149898a3aefa8ec6e59763e6e3ed085", "sha256:1db753c9115ec7100d073b744d17e25e88a8f90f5c39b2f5dd878149af59671f", "sha256:1dde6131244bba38a17c745836ba190bc753fd73c9291666287fd0a3fa3dcf30", "sha256:25c6997a9a534e016695a0ba06b2f07945de682731ff01065b6d5a4474179da1", "sha256:26e6eda8d38c1fcab1090dd196ee87cbd13788e531937610e2589085de074e77", "sha256:27acc820660aaffa4f7c087f29120e12980f7779d56d8492d263170111284740", "sha256:2a0217714657e023ef4293500f65aa20fce6164c8fd6b08fa5bd4a859fb14b9b", "sha256:2c8daa471358dc2d6fcf02165e80ec68f77871a286df95bc5cc3816153b0fd2c", "sha256:30a89d3ac8faec007453fb541f3f46807eeec88edd5826f6e3fe001752a2c621", "sha256:31033dc34636ea6b7d5cc11b1ddbda78a14de858ba9d3e1ed4b69a3085bc521e", "sha256:32ab449a5486f6c758e849bb86710d0e45edc24a04e250c01555f8f5653958f8", "sha256:3483644525531e1d5762b0c44a8e18b6efba321b6dcf8a8952de10b037618bca", "sha256:34c2d737beabfe35baada43941ed519251e9a12e779031496bcd5d539fcfd730", "sha256:3779def59032b81e44a5f70096ef6bf2082f8d901937dca354474ba09782e245", "sha256:37a58976370f36d9329d118ad0b953c5aeb9119ac9c6a4e258942a225d0573a1", "sha256:3893c14c4b6ac5b2d54ba8cf03e99fe5104e592de491f19bd6b82756c09f8004", "sha256:3a12689be69a28ddaa0ab99a5a1137da2afd5f8f16df7b5680b66f616d3eda1d", "sha256:3ab541146f1f6968c462d6c2ac495148e8cdba2f8347700b2141b6ec5a75bf52", "sha256:3abf332af33a74288675d936fe861fd4344da0dd6622193fbc4f2bfbb35536b5", "sha256:3fd9728a2735fda14f4e8235830c86b539e9661e849665bf926d3f867943b4bf", "sha256:424aa57aca0897eb922aef34395bd1289b3b6f04e6bae20ea123c0c7e333cffc", "sha256:441dd227fa0690eb9fc81edabc63cdcefc212bba99b906dcf6e32cc1a9d3e533", "sha256:469e3618338bd7ab5beb412d2439825479fcf0dab99e394ca563dbc4eaf6c834", "sha256:47402e62c52ff5988c1e8c6c63177f5708bccf48e366dea4e3dcf1e645e04947", "sha256:4f0dd2f01f9f8a89f565d000e03abcf0a13d692a346c8d22f628d49af098777a", "sha256:53b7d2b7a10b1c35c0a5e21e9224accf60c1bbfba523990732e521b2b73adef2", "sha256:53c909b62a0532183542fed00c5a7218258c56292d409bc789886fe1cb04c438", "sha256:54a7f95e4de5fb94e2f9f4b9055c6ba33bf3d628fd77a1d647c5923caa2cdcdc", "sha256:556e94a63c9b04716f8e4de2abb65775061f846e89331b6c5be79183a24f98ea", "sha256:55b03549819867ea141c0202242c4816c82e52ec36e7e648db9d8da5a3dc3ed6", "sha256:581d4c8ae690a6609e64862dd6b7c2489635c2d13907fc2b20f2bc200ff1d21e", "sha256:58bb955caba94e467d2a96da17660d2d704e0675894cba21ab8a775b8621fd1c", "sha256:5b7328b46d49fc9477d91ae8f6d55340347d827b7734ba3ea33faae0efef1383", "sha256:5ba186ad207446c65d3bb3d3e0412b032b1d9f595e59861e2354798c5703d955", "sha256:5bec7d03d78d853597d6107854c2310ce3f761fd218fe9fe91d5101fcf6c2efe", "sha256:5c6bf403fbb3b3e348a561a5f4f0b9961835657981c802a1df03653eef8a9074", "sha256:5f6994074ebae6ffb04447268e37dc16edc304f9859cf91acb86e0af6c1b395c", "sha256:62aeb7e85b5d60320b9d77eef2e773994e2c0ce10121b277e0a19804e1654a5a", "sha256:63876be28efefa04a1df615b46770e82042cce445cfdce55160522f57b231ccb", "sha256:639f6c857d91d9be29bd7502348d6736dab168b54b5158cd899abf11684dc186", "sha256:640f97d43d867bcb9c75b3af013b64850756b746cb6bce8ace83b70da3abba9d", "sha256:649dda677cf3bd6ac9ae14007ba0c824ded8ce5808b53fc7431d9140399118c1", "sha256:6540377fbd53fe1b629172288c464fb18db11ce1fa7dc15891da10aa9dcc3e7f", "sha256:6689e828a94eee4f139408c337bb198e014724bb8a8c26d3cfac49d119ed69a6", "sha256:68a9198d0fc122d14bb76837de9aa80cf84caed990b5b237f532ed87d3706736", "sha256:6b1761fbf9ec984e2e9d9c589ef5f5fd684b7c19f92aadd567a26c5224958db6", "sha256:70cdfd80589d59e43e18005dd7244e8895e93db8ab6a620b7e23df5445a4e3d2", "sha256:70ef8a7e102a1508f8121aae5b0867abd663f72c14f0a9c937e6554cb4587b7b", "sha256:73bc2086f141224ebddb7fc5c6a36ca58b31b94b561e1dfe8e073e3270fad1e7", "sha256:74a9717fd0d82effef5c2854f0d917231d5324b5a3eb7275c43ac9fa32f97a14", "sha256:752d3bbfe874715ccd0aec7f88d7fc623c0f1fd7aa7b3238a084e017bad2a009", "sha256:762ff394d5bd56da0cf034a23dcce4e13923f15321a2adfa2ac00201dc6d3fca", "sha256:76447f65250ed2501ead1a1552f5ce8edff159a86f308348e6a9c4acb5e1f1b4", "sha256:766b010012d59470072c1816b5b6c69f1d243e5db36ea5968e94accf430a4635", "sha256:787b2496d0dbe8cd180984e8d29e3a6f76e7ea34db781cb3bd55e4ba1ef8b4ee", "sha256:793033d6c5cdf33a573f910d9bea14ef8f5771820411d118da8e1182edb53d5e", "sha256:7d47866cb32fb503450b6edc9df355d10dc49836af2e89901bd6ac6b0896d9d9", "sha256:7f7a92e8583f06b1fd49d01158143b8461cfcd135dcb10ec807270a3051bd603", "sha256:80c2dfadb855da477cf73373ad29a333535dedb9b12bad02c9814c8e2b43bf08", "sha256:83b6b30eb131da7a75b601f28c5d6971e6ed3e887919bf6b6a1ad3c2df289080", "sha256:86281fbdd6a8162756f8d603f37e3435bfa38043adb79c6dc6a2dfee065e7525", "sha256:86c89b9d55ebf820ad7c90bc533410f0d098054f293351f10603c0c46ff598f5", "sha256:876e1ff5930ed8bf295ec5ef9a8155e9b6b1876bbf1deed8b3a8069311875a8f", "sha256:88136950da4d13c318bde414ce10219931937851327f44328f2df4d2c4614067", "sha256:88d8cb75b9d82858497a5393e3c63cfbf03035225e4b35a49ed7ccb151e4dc0e", "sha256:8be8ad51249698103d24b0571df35a10990fbe93dd043b6c024172189485f5e3", "sha256:8d43ca737b20e106e4aebc42b2f3ae19f00ba63d7eb731698ee083d72d15646f", "sha256:8dadbe5b217ff35b6a8d16610dd710219b59b76d13f0e3f0d9f36786206e4485", "sha256:9395002973c827b3ed67db77e6ec09f092919a587022174554096a269378fb13", "sha256:96f2ec43df44b1f76249ee0a615334f9b5b060e1c8bd90e706dad2d14d02f383", "sha256:98fc784c2c1440667aeedf8465bdfe10208acf0ead656a2c68627299f546b315", "sha256:9e36f163528fc50cbef305f02a5fd66d404edf7049cdaff211dbc2cba5a7013e", "sha256:9eb9b5a968f6e0f6d640092a567e14529ff8cea2e29d00da6f78a79fa49f013c", "sha256:9f76acfb5f68ba982635a53fd985a8044be98a35b43232c2a1ee235ffab3e1dd", "sha256:a088f287f7d8275a33c07f2cac6c50b9319309a0200a39e7e75d80c707723099", "sha256:a10bd2fd62e8ce916ececb342f348f190724a098c1faa056fdfb2a22ad5e8660", "sha256:a4bbea04c97f6d78a48e3fbc1cb9116d2780b1b39e03a23f6eb9b603fd61f510", "sha256:aa366a1e55b8ebfe8ca8ddc3cfe75c8ebade181aeb0f661d0cb05986b647f72a", "sha256:aa49e06d94aba782c6a02eecb7e507969e7e7a41b267f1b359bb35585f295d5b", "sha256:aad9aa39483ed8ec44d6d2e59e5b98a0d80676ef0d92f44bfc374836111f62f5", "sha256:aae97dfdb60715c164419ac2532a76d013c3918a665eb6cb7288098b5f349aaf", "sha256:abbefa31eee84842140f67acef1c828e28bba8bbf0c3bc6e5492a9af88152c28", "sha256:ac931cdc9442c1763b8a8f6cd62c0c938737eafc5be75eff88df55fc73bc0d00", "sha256:acd7d70b64c0aae0c7922cca83d288a16f5f6da523637697872253415269baef", "sha256:add8cf6ddf9a65116119a28ece0f7886e30af27ba724a7594305f1d1b58a92a1", "sha256:aee395f5d0927f947758b4ec119fd5fc8ec71f07a1c5c52077b30b04c0fa6955", "sha256:b1b963fd8f5caa68e99dfae060d54de1fe9cba899b8718b44a00cdca53c3e590", "sha256:b2d444f2e66624d68e9c6b211e28a76e22fff5fcabcfff4deac18b529b7d4137", "sha256:b8d812c6011c08b8111a15e54dd990b8923692d80adf35488bee34026c35accf", "sha256:ba96ae44888e0185281e937633a743ea90d5a196c6000f82565ebb0580012d40", "sha256:bdebcc8a75d38c7598dfb2c9ed852d7a9eb4a10d6e2d0764b919b802bf32ac88", "sha256:c07da4cebf6889f03ebac8d238f62318e29f495de0aa18a51ea14e61ae907e2e", "sha256:c08e5c694306507275f2290073350c4f32e383db15213b2c69e7ff39c1193840", "sha256:c4f469aebd783bb741c2ecb2a681008fd26bfe5c16a9a72ed5467f834e810df2", "sha256:c5d7152ec39ca7c402d8fb9bad86140a15b9503bd0c54484e3f1bbe3dd37ceca", "sha256:c674693f055fa2495de12292cb45e9944199d8eaef5a2dec45175c7c61cb73e3", "sha256:c6ed5141a5c7507cf3ee76bd363b0d6f801e3321adc35b5d825a23115faa5465", "sha256:c921ba5c51e4e9f63b8b00267d06566e1f63407408a0496da2d1d0bfc819c7fc", "sha256:c9a4b821dc7055bf9e05ff5719e18ec501f75c0f0bbfabd573b277559780833d", "sha256:c9f79d5325907f13e1be0b3e4dacc1049d1dffc4aeee3c995284bea5fe0fab7d", "sha256:cd312b9692e831d2ffcad61eab31d91d4b4655a962e61de8fb410472cbcd37aa", "sha256:cea3f4c1af79af13cdb2da0c028111d8f8522d4f22a000c82385535f24e5cf3a", "sha256:cecdd5dfdc87b1fd87dbf81d4b037a544f47f4c744200a67013771682d67686a", "sha256:cf9d57306d848218f3601fee7601fab1a327c942d56e2e97610583cb4dd74206", "sha256:d34bbf07dbc7ca5970671b1512e928991fb5e9d95365636c9b2d8b4f53af405e", "sha256:d49514be2f28d895c38cf9d2b72d7b9a07d00314519f456c0b50b53cfcf4c785", "sha256:d680fbcb768404c601ecb43519ecd8461f6954cb11c06a78962f666832ccfca8", "sha256:db1d75f6617a49c1c01bc7023713e0ff59ab32c9579ae62a7674c0e34f3b0b0a", "sha256:dcb292aa7fe485ceff7af4f92e46c5af397daec5dff64871a528f0fc47a3cc5b", "sha256:e07c65f443c887bbcf31cc1771d932ecc192a5273943589b3c7572b749f1ffb2", "sha256:e902da4b04e6b52e5893900d4b8ab46068f75f3561f01bf1080957f9fd932ed6", "sha256:e9308ff8241c532df3f3e570f9a5aeed6c853f888512ba4b75638d7c11c95ef6", "sha256:eb7c9811bfaa8b1ed5ed319f5d370dfbcaa59d52ea64be2a5a85e18195930354", "sha256:ebe6af670449830d6d9b752c256a983291c766a1365ba5d5460048f9e33a7818", "sha256:ed21202aec73cda4d55d1ce57b389aadb90ffb044e6cd1080b8347efe1b1ec84", "sha256:efe0374196335f93b53269acd811b944f2e6bdc88e8894f214bd636455484909", "sha256:f64ec5397ea6a41fc1b4af0380d79b44a755b5531dcaccd9940fb260dca93038", "sha256:f6ac4ef4d82dff54670227a69c67782ae0b811b5cf6b17954f1e8f7502fc0d1d", "sha256:f6f0ce10945fab9c4c06ce14e22af9059d1a87493a9af4501a5b0b9187e21cf2", "sha256:f8844cd288697c6425c9beba919302241e3278871dc6519515e72b04e987abcf", "sha256:fe0306bd29505a9177aac19f1877174b0e7422c222a59f70b2cd41633448c3dc", "sha256:ff3f333630ab480244a1bff72043e511a91eb22e7595dead8653ee5612dd8f3d", "sha256:ffecec8eb889b58ba9be5b95fb1cc78e22ea8eedea38e8736a1568fe1979250e" ], "index": "pypi", "markers": "python_version >= '3.8'", "version": "==6.1.1" }, "markdown": { "hashes": [ "sha256:994d51325d25ad8aa7ce4ebaec003febcce822c3f8c911e3b17c52f7f589f950", "sha256:e91464b71ae3ee7afd3017d9f358ef0baf158fd9a298db92f1d4761133824c36" ], "index": "pypi", "markers": "python_version >= '3.10'", "version": "==3.10.2" }, "markupsafe": { "hashes": [ "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4", "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30", "sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0", "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9", "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396", "sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13", "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028", "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca", "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557", "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832", "sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0", "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b", "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579", "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a", "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c", "sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff", "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c", "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22", "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094", "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb", "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e", "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5", "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a", "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d", "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a", "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b", "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8", "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225", "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c", "sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144", "sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f", "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87", "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d", "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93", "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf", "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158", "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84", "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb", "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48", "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171", "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c", "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6", "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd", "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d", "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1", "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d", "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca", "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a", "sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29", "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe", "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798", "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c", "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8", "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f", "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f", "sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a", "sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178", "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79", "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430", "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50" ], "markers": "python_version >= '3.9'", "version": "==3.0.2" }, "pkgutil-resolve-name": { "hashes": [ "sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174", "sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e" ], "markers": "python_version < '3.9'", "version": "==1.3.10" }, "pyyaml": { "hashes": [ "sha256:00c4bdeba853cc34e7dd471f16b4114f4162dc03e6b7afcc2128711f0eca823c", "sha256:0150219816b6a1fa26fb4699fb7daa9caf09eb1999f3b70fb6e786805e80375a", "sha256:02893d100e99e03eda1c8fd5c441d8c60103fd175728e23e431db1b589cf5ab3", "sha256:02ea2dfa234451bbb8772601d7b8e426c2bfa197136796224e50e35a78777956", "sha256:0f29edc409a6392443abf94b9cf89ce99889a1dd5376d94316ae5145dfedd5d6", "sha256:10892704fc220243f5305762e276552a0395f7beb4dbf9b14ec8fd43b57f126c", "sha256:16249ee61e95f858e83976573de0f5b2893b3677ba71c9dd36b9cf8be9ac6d65", "sha256:1d37d57ad971609cf3c53ba6a7e365e40660e3be0e5175fa9f2365a379d6095a", "sha256:1ebe39cb5fc479422b83de611d14e2c0d3bb2a18bbcb01f229ab3cfbd8fee7a0", "sha256:214ed4befebe12df36bcc8bc2b64b396ca31be9304b8f59e25c11cf94a4c033b", "sha256:2283a07e2c21a2aa78d9c4442724ec1eb15f5e42a723b99cb3d822d48f5f7ad1", "sha256:22ba7cfcad58ef3ecddc7ed1db3409af68d023b7f940da23c6c2a1890976eda6", "sha256:27c0abcb4a5dac13684a37f76e701e054692a9b2d3064b70f5e4eb54810553d7", "sha256:28c8d926f98f432f88adc23edf2e6d4921ac26fb084b028c733d01868d19007e", "sha256:2e71d11abed7344e42a8849600193d15b6def118602c4c176f748e4583246007", "sha256:34d5fcd24b8445fadc33f9cf348c1047101756fd760b4dacb5c3e99755703310", "sha256:37503bfbfc9d2c40b344d06b2199cf0e96e97957ab1c1b546fd4f87e53e5d3e4", "sha256:3c5677e12444c15717b902a5798264fa7909e41153cdf9ef7ad571b704a63dd9", "sha256:3ff07ec89bae51176c0549bc4c63aa6202991da2d9a6129d7aef7f1407d3f295", "sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea", "sha256:418cf3f2111bc80e0933b2cd8cd04f286338bb88bdc7bc8e6dd775ebde60b5e0", "sha256:44edc647873928551a01e7a563d7452ccdebee747728c1080d881d68af7b997e", "sha256:4a2e8cebe2ff6ab7d1050ecd59c25d4c8bd7e6f400f5f82b96557ac0abafd0ac", "sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9", "sha256:501a031947e3a9025ed4405a168e6ef5ae3126c59f90ce0cd6f2bfc477be31b7", "sha256:5190d403f121660ce8d1d2c1bb2ef1bd05b5f68533fc5c2ea899bd15f4399b35", "sha256:5498cd1645aa724a7c71c8f378eb29ebe23da2fc0d7a08071d89469bf1d2defb", "sha256:5cf4e27da7e3fbed4d6c3d8e797387aaad68102272f8f9752883bc32d61cb87b", "sha256:5e0b74767e5f8c593e8c9b5912019159ed0533c70051e9cce3e8b6aa699fcd69", "sha256:5ed875a24292240029e4483f9d4a4b8a1ae08843b9c54f43fcc11e404532a8a5", "sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b", "sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c", "sha256:6344df0d5755a2c9a276d4473ae6b90647e216ab4757f8426893b5dd2ac3f369", "sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd", "sha256:652cb6edd41e718550aad172851962662ff2681490a8a711af6a4d288dd96824", "sha256:66291b10affd76d76f54fad28e22e51719ef9ba22b29e1d7d03d6777a9174198", "sha256:66e1674c3ef6f541c35191caae2d429b967b99e02040f5ba928632d9a7f0f065", "sha256:6adc77889b628398debc7b65c073bcb99c4a0237b248cacaf3fe8a557563ef6c", "sha256:79005a0d97d5ddabfeeea4cf676af11e647e41d81c9a7722a193022accdb6b7c", "sha256:7c6610def4f163542a622a73fb39f534f8c101d690126992300bf3207eab9764", "sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196", "sha256:8098f252adfa6c80ab48096053f512f2321f0b998f98150cea9bd23d83e1467b", "sha256:850774a7879607d3a6f50d36d04f00ee69e7fc816450e5f7e58d7f17f1ae5c00", "sha256:8d1fab6bb153a416f9aeb4b8763bc0f22a5586065f86f7664fc23339fc1c1fac", "sha256:8da9669d359f02c0b91ccc01cac4a67f16afec0dac22c2ad09f46bee0697eba8", "sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e", "sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28", "sha256:93dda82c9c22deb0a405ea4dc5f2d0cda384168e466364dec6255b293923b2f3", "sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5", "sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4", "sha256:9c7708761fccb9397fe64bbc0395abcae8c4bf7b0eac081e12b809bf47700d0b", "sha256:9f3bfb4965eb874431221a3ff3fdcddc7e74e3b07799e0e84ca4a0f867d449bf", "sha256:a33284e20b78bd4a18c8c2282d549d10bc8408a2a7ff57653c0cf0b9be0afce5", "sha256:a80cb027f6b349846a3bf6d73b5e95e782175e52f22108cfa17876aaeff93702", "sha256:b30236e45cf30d2b8e7b3e85881719e98507abed1011bf463a8fa23e9c3e98a8", "sha256:b3bc83488de33889877a0f2543ade9f70c67d66d9ebb4ac959502e12de895788", "sha256:b865addae83924361678b652338317d1bd7e79b1f4596f96b96c77a5a34b34da", "sha256:b8bb0864c5a28024fac8a632c443c87c5aa6f215c0b126c449ae1a150412f31d", "sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc", "sha256:bdb2c67c6c1390b63c6ff89f210c8fd09d9a1217a465701eac7316313c915e4c", "sha256:c1ff362665ae507275af2853520967820d9124984e0f7466736aea23d8611fba", "sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f", "sha256:c3355370a2c156cffb25e876646f149d5d68f5e0a3ce86a5084dd0b64a994917", "sha256:c458b6d084f9b935061bc36216e8a69a7e293a2f1e68bf956dcd9e6cbcd143f5", "sha256:d0eae10f8159e8fdad514efdc92d74fd8d682c933a6dd088030f3834bc8e6b26", "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f", "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", "sha256:eda16858a3cab07b80edaf74336ece1f986ba330fdb8ee0d6c0d68fe82bc96be", "sha256:ee2922902c45ae8ccada2c5b501ab86c36525b883eff4255313a253a3160861c", "sha256:efd7b85f94a6f21e4932043973a7ba2613b059c4a000551892ac9f1d11f5baf3", "sha256:f7057c9a337546edc7973c0d3ba84ddcdf0daa14533c2065749c9075001090e6", "sha256:fa160448684b4e94d80416c0fa4aac48967a969efe22931448d853ada8baf926", "sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0" ], "index": "pypi", "markers": "python_version >= '3.8'", "version": "==6.0.3" }, "referencing": { "hashes": [ "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8" ], "markers": "python_version >= '3.10'", "version": "==0.37.0" }, "rpds-py": { "hashes": [ "sha256:07ae8a593e1c3c6b82ca3292efbe73c30b61332fd612e05abee07c79359f292f", "sha256:0a59119fc6e3f460315fe9d08149f8102aa322299deaa5cab5b40092345c2136", "sha256:0c0e95f6819a19965ff420f65578bacb0b00f251fefe2c8b23347c37174271f3", "sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7", "sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65", "sha256:12f90dd7557b6bd57f40abe7747e81e0c0b119bef015ea7726e69fe550e394a4", "sha256:1726859cd0de969f88dc8673bdd954185b9104e05806be64bcd87badbe313169", "sha256:1ab5b83dbcf55acc8b08fc62b796ef672c457b17dbd7820a11d6c52c06839bdf", "sha256:1b151685b23929ab7beec71080a8889d4d6d9fa9a983d213f07121205d48e2c4", "sha256:1f3587eb9b17f3789ad50824084fa6f81921bbf9a795826570bda82cb3ed91f2", "sha256:250fa00e9543ac9b97ac258bd37367ff5256666122c2d0f2bc97577c60a1818c", "sha256:2771c6c15973347f50fece41fc447c054b7ac2ae0502388ce3b6738cd366e3d4", "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3", "sha256:2e6ecb5a5bcacf59c3f912155044479af1d0b6681280048b338b28e364aca1f6", "sha256:32c8528634e1bf7121f3de08fa85b138f4e0dc47657866630611b03967f041d7", "sha256:33f559f3104504506a44bb666b93a33f5d33133765b0c216a5bf2f1e1503af89", "sha256:3896fa1be39912cf0757753826bc8bdc8ca331a28a7c4ae46b7a21280b06bb85", "sha256:389a2d49eded1896c3d48b0136ead37c48e221b391c052fba3f4055c367f60a6", "sha256:39c02563fc592411c2c61d26b6c5fe1e51eaa44a75aa2c8735ca88b0d9599daa", "sha256:3adbb8179ce342d235c31ab8ec511e66c73faa27a47e076ccc92421add53e2bb", "sha256:3d4a69de7a3e50ffc214ae16d79d8fbb0922972da0356dcf4d0fdca2878559c6", "sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87", "sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856", "sha256:422c3cb9856d80b09d30d2eb255d0754b23e090034e1deb4083f8004bd0761e4", "sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f", "sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53", "sha256:47b0ef6231c58f506ef0b74d44e330405caa8428e770fec25329ed2cb971a229", "sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad", "sha256:47f236970bccb2233267d89173d3ad2703cd36a0e2a6e92d0560d333871a3d23", "sha256:47f9a91efc418b54fb8190a6b4aa7813a23fb79c51f4bb84e418f5476c38b8db", "sha256:495aeca4b93d465efde585977365187149e75383ad2684f81519f504f5c13038", "sha256:4c5f36a861bc4b7da6516dbdf302c55313afa09b81931e8280361a4f6c9a2d27", "sha256:4cc2206b76b4f576934f0ed374b10d7ca5f457858b157ca52064bdfc26b9fc00", "sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18", "sha256:51a1234d8febafdfd33a42d97da7a43f5dcb120c1060e352a3fbc0c6d36e2083", "sha256:55f66022632205940f1827effeff17c4fa7ae1953d2b74a8581baaefb7d16f8c", "sha256:58edca431fb9b29950807e301826586e5bbf24163677732429770a697ffe6738", "sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898", "sha256:5ba103fb455be00f3b1c2076c9d4264bfcb037c976167a6047ed82f23153f02e", "sha256:5d4c2aa7c50ad4728a094ebd5eb46c452e9cb7edbfdb18f9e1221f597a73e1e7", "sha256:61046904275472a76c8c90c9ccee9013d70a6d0f73eecefd38c1ae7c39045a08", "sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6", "sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551", "sha256:669b1805bd639dd2989b281be2cfd951c6121b65e729d9b843e9639ef1fd555e", "sha256:679ae98e00c0e8d68a7fda324e16b90fd5260945b45d3b824c892cec9eea3288", "sha256:67b02ec25ba7a9e8fa74c63b6ca44cf5707f2fbfadae3ee8e7494297d56aa9df", "sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0", "sha256:692bef75a5525db97318e8cd061542b5a79812d711ea03dbc1f6f8dbb0c5f0d2", "sha256:6abc8880d9d036ecaafe709079969f56e876fcf107f7a8e9920ba6d5a3878d05", "sha256:6bdfdb946967d816e6adf9a3d8201bfad269c67efe6cefd7093ef959683c8de0", "sha256:6de2a32a1665b93233cde140ff8b3467bdb9e2af2b91079f0333a0974d12d464", "sha256:73c67f2db7bc334e518d097c6d1e6fed021bbc9b7d678d6cc433478365d1d5f5", "sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404", "sha256:76fec018282b4ead0364022e3c54b60bf368b9d926877957a8624b58419169b7", "sha256:7c64d38fb49b6cdeda16ab49e35fe0da2e1e9b34bc38bd78386530f218b37139", "sha256:7cee9c752c0364588353e627da8a7e808a66873672bcb5f52890c33fd965b394", "sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb", "sha256:806f36b1b605e2d6a72716f321f20036b9489d29c51c91f4dd29a3e3afb73b15", "sha256:858738e9c32147f78b3ac24dc0edb6610000e56dc0f700fd5f651d0a0f0eb9ff", "sha256:8d6d1cc13664ec13c1b84241204ff3b12f9bb82464b8ad6e7a5d3486975c2eed", "sha256:9027da1ce107104c50c81383cae773ef5c24d296dd11c99e2629dbd7967a20c6", "sha256:922e10f31f303c7c920da8981051ff6d8c1a56207dbdf330d9047f6d30b70e5e", "sha256:945dccface01af02675628334f7cf49c2af4c1c904748efc5cf7bbdf0b579f95", "sha256:946fe926af6e44f3697abbc305ea168c2c31d3e3ef1058cf68f379bf0335a78d", "sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950", "sha256:9854cf4f488b3d57b9aaeb105f06d78e5529d3145b1e4a41750167e8c213c6d3", "sha256:993914b8e560023bc0a8bf742c5f303551992dcb85e247b1e5c7f4a7d145bda5", "sha256:99b47d6ad9a6da00bec6aabe5a6279ecd3c06a329d4aa4771034a21e335c3a97", "sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e", "sha256:9cf69cdda1f5968a30a359aba2f7f9aa648a9ce4b580d6826437f2b291cfc86e", "sha256:a090322ca841abd453d43456ac34db46e8b05fd9b3b4ac0c78bcde8b089f959b", "sha256:a1010ed9524c73b94d15919ca4d41d8780980e1765babf85f9a2f90d247153dd", "sha256:a161f20d9a43006833cd7068375a94d035714d73a172b681d8881820600abfad", "sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8", "sha256:a2bffea6a4ca9f01b3f8e548302470306689684e61602aa3d141e34da06cf425", "sha256:a452763cc5198f2f98898eb98f7569649fe5da666c2dc6b5ddb10fde5a574221", "sha256:a4796a717bf12b9da9d3ad002519a86063dcac8988b030e405704ef7d74d2d9d", "sha256:a51033ff701fca756439d641c0ad09a41d9242fa69121c7d8769604a0a629825", "sha256:a8fa71a2e078c527c3e9dc9fc5a98c9db40bcc8a92b4e8858e36d329f8684b51", "sha256:ac37f9f516c51e5753f27dfdef11a88330f04de2d564be3991384b2f3535d02e", "sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f", "sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8", "sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f", "sha256:b40fb160a2db369a194cb27943582b38f79fc4887291417685f3ad693c5a1d5d", "sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07", "sha256:ba3af48635eb83d03f6c9735dfb21785303e73d22ad03d489e88adae6eab8877", "sha256:ba81a9203d07805435eb06f536d95a266c21e5b2dfbf6517748ca40c98d19e31", "sha256:c2262bdba0ad4fc6fb5545660673925c2d2a5d9e2e0fb603aad545427be0fc58", "sha256:c77afbd5f5250bf27bf516c7c4a016813eb2d3e116139aed0096940c5982da94", "sha256:ca28829ae5f5d569bb62a79512c842a03a12576375d5ece7d2cadf8abe96ec28", "sha256:cdc62c8286ba9bf7f47befdcea13ea0e26bf294bda99758fd90535cbaf408000", "sha256:d948b135c4693daff7bc2dcfc4ec57237a29bd37e60c2fabf5aff2bbacf3e2f1", "sha256:d96c2086587c7c30d44f31f42eae4eac89b60dabbac18c7669be3700f13c3ce1", "sha256:d9a0ca5da0386dee0655b4ccdf46119df60e0f10da268d04fe7cc87886872ba7", "sha256:da279aa314f00acbb803da1e76fa18666778e8a8f83484fba94526da5de2cba7", "sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40", "sha256:dc4f992dfe1e2bc3ebc7444f6c7051b4bc13cd8e33e43511e8ffd13bf407010d", "sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0", "sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84", "sha256:dea5b552272a944763b34394d04577cf0f9bd013207bc32323b5a89a53cf9c2f", "sha256:dff13836529b921e22f15cb099751209a60009731a68519630a24d61f0b1b30a", "sha256:e0b65193a413ccc930671c55153a03ee57cecb49e6227204b04fae512eb657a7", "sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419", "sha256:e7536cd91353c5273434b4e003cbda89034d67e7710eab8761fd918ec6c69cf8", "sha256:eb0b93f2e5c2189ee831ee43f156ed34e2a89a78a66b98cadad955972548be5a", "sha256:eb2c4071ab598733724c08221091e8d80e89064cd472819285a9ab0f24bcedb9", "sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be", "sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed", "sha256:ee6af14263f25eedc3bb918a3c04245106a42dfd4f5c2285ea6f997b1fc3f89a", "sha256:f14fc5df50a716f7ece6a80b6c78bb35ea2ca47c499e422aa4463455dd96d56d", "sha256:f207f69853edd6f6700b86efb84999651baf3789e78a466431df1331608e5324", "sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f", "sha256:f83424d738204d9770830d35290ff3273fbb02b41f919870479fab14b9d303b2", "sha256:f8d1736cfb49381ba528cd5baa46f82fdc65c06e843dab24dd70b63d09121b3f", "sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5" ], "markers": "python_version >= '3.10'", "version": "==0.30.0" }, "typing-extensions": { "hashes": [ "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548" ], "markers": "python_version >= '3.9'", "version": "==4.15.0" }, "zipp": { "hashes": [ "sha256:071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e", "sha256:a07157588a12518c9d4034df3fbbee09c814741a33ff63c05fa29d26a2404166" ], "markers": "python_version >= '3.9'", "version": "==3.23.0" } }, "develop": {} } jq-1.8.2/docs/Pipfile0000644000175100017510000000030615215513536010067 [[source]] name = "pypi" url = "https://pypi.org/simple" verify_ssl = true [dev-packages] [packages] jinja2 = "*" pyyaml = "*" markdown = "*" lxml = "*" jsonschema = "*" importlib_resources = "*" jq-1.8.2/docs/validate_manual_schema.py0000755000175100017510000000111015215513536013571 #!/usr/bin/env python3 import jsonschema import sys import yaml if len(sys.argv) < 2: sys.exit("Usage: {} MANUAL_FILE ...".format(sys.argv[0])) with open("manual_schema.yml", "r") as schema_file: manual_schema = yaml.safe_load(schema_file) for path in sys.argv[1:]: with open(path, "r") as manual_file: manual_data = yaml.safe_load(manual_file) try: jsonschema.validate(instance=manual_data, schema=manual_schema) except jsonschema.exceptions.ValidationError as e: print("Failed to validate:", path, file=sys.stderr) sys.exit(e) jq-1.8.2/docs/build_mantests.py0000755000175100017510000000155015215513536012150 #!/usr/bin/env python3 import yaml import re regex_program_pattern = re.compile( r'\b(?:test|match|capture|scan|split|splits|sub|gsub)\s*\(') with open('content/manual/dev/manual.yml') as source, \ open('../tests/man.test', 'w') as man, \ open('../tests/manonig.test', 'w') as manonig: manual = yaml.safe_load(source) for section in manual.get('sections', []): for entry in section.get('entries', []): for example in entry.get('examples', []): program = example.get('program', '').replace('\n', ' ') out = manonig if regex_program_pattern.search(program) else man print(program, file=out) print(example.get('input', ''), file=out) for s in example.get('output', []): print(s, file=out) print('', file=out) jq-1.8.2/docs/build_manpage.py0000755000175100017510000002171015215513536011722 #!/usr/bin/env python3 from datetime import date from io import StringIO from lxml import etree import markdown from markdown.extensions import Extension import re import os import sys from time import time import yaml # Prevent our markdown parser from trying to help by interpreting things in angle brackets as HTML tags. class EscapeHtml(Extension): def extendMarkdown(self, md): md.preprocessors.deregister('html_block') md.inlinePatterns.deregister('html') class RoffWalker(object): def __init__(self, tree, output=sys.stdout): self.tree = tree self.target = output self.f = StringIO() def walk(self): self._walk(self.tree, parent_tag=None) # We don't want to start lines with \. because that can confuse man # For lines that start with \., we need to prefix them with \& so it # knows not to treat that line as a directive data = re.sub(r'^\\\.', r'\&.', self.f.getvalue(), flags=re.MULTILINE) self.target.write(data) def _ul_is_special(self, root): if len(root) != 1: return False child = root[0] if child.tag != 'li': return False msg = ''.join(child.itertext()).strip() return msg.endswith(':') def _walk_child(self, root): if len(root) > 0: self._walk(root[0], parent_tag=root.tag) def _write_element(self, root, ensure_newline=True): if root.text is not None: text = self._sanitize(root.text) self.__write_raw(text) self._walk_child(root) self._write_tail(root, ensure_newline=ensure_newline) def _write_tail(self, root, ensure_newline=False, inline=False): if root.tail is not None: if inline or root.tail != '\n': text = self._sanitize(root.tail) if text.endswith('\n'): ensure_newline = False self.__write_raw(text) if ensure_newline: self.__write_raw('\n') def _walk(self, root, parent_tag=None): last_tag = None while root is not None: if root.tag == 'h1': epoch = int(os.environ.get('SOURCE_DATE_EPOCH', time())) self.__write_cmd('.TH "JQ" "1" "{}" "" ""'.format( date.fromtimestamp(epoch).strftime('%B %Y'))) self.__write_cmd('.SH "NAME"') # TODO: properly parse this self.__write_raw(r'\fBjq\fR \- Command\-line JSON processor' + "\n") elif root.tag == 'h2': self.__write_cmd('.SH "{}"'.format(''.join( root.itertext()).strip())) elif root.tag == 'h3': text = ''.join(root.itertext()).strip() self.__write_cmd('.SS "{}"'.format(self._h3_sanitize(text))) elif root.tag == 'p': if last_tag not in ['h2', 'h3'] and parent_tag not in ['li']: self.__write_cmd('.P') self._write_element(root, ensure_newline=(parent_tag != 'li')) elif root.tag == 'a': self._write_element(root, ensure_newline=(parent_tag != 'li')) elif root.tag == 'ul': if self._ul_is_special(root): li = root[0] self.__write_cmd('.TP') self._write_element(li) next = root.getnext() while next is not None and next.tag == 'p': if next.getnext() is not None and next.getnext( ).tag == 'pre': # we don't want to .IP these, because it'll look funny with the code indent break self.__write_cmd('.IP') self._write_element(next) root = next next = root.getnext() else: self._walk_child(root) self._write_tail(root) # A pre tag after the end of a list doesn't want two of the indentation commands if root.getnext() is None or root.getnext().tag != 'pre': self.__write_cmd('.IP "" 0') elif root.tag == 'li': self.__write_cmd(r'.IP "\(bu" 4') if root.text is not None and root.text.strip() != '': text = self._sanitize(root.text) self.__write_raw(text) self._walk_child(root) self._write_tail(root, ensure_newline=True) elif root.tag == 'strong': if root.text is not None: text = self._sanitize(root.text) self.__write_raw('\\fB{}\\fR'.format(text)) self._write_tail(root, inline=True) elif root.tag == 'em': if root.text is not None: text = self._sanitize(root.text) self.__write_raw('\\fI{}\\fR'.format(text)) self._write_tail(root, inline=True) elif root.tag == 'code': if root.text is not None: text = self._code_sanitize(root.text) self.__write_raw('\\fB{}\\fR'.format(text)) self._write_tail(root, inline=True) elif root.tag == 'pre': self.__write_cmd('.IP "" 4') self.__write_cmd('.nf\n') # extra newline for spacing reasons next = root first = True while next is not None and next.tag == 'pre': if not first: self.__write_raw('\n') text = ''.join(next.itertext(with_tail=False)) self.__write_raw(self._pre_sanitize(text)) first = False root = next next = next.getnext() self.__write_cmd('.fi') self.__write_cmd('.IP "" 0') else: self._walk_child(root) last_tag = root.tag root = root.getnext() def _base_sanitize(self, text): text = re.sub(r'\\', r'\\e', text) text = re.sub(r'\.', r'\\.', text) text = re.sub("'", r"\'", text) text = re.sub('-', r'\-', text) return text def _pre_sanitize(self, text): return self._base_sanitize(text) def _code_sanitize(self, text): text = self._base_sanitize(text) text = re.sub(r'\s', ' ', text) return text def _h3_sanitize(self, text): text = self._base_sanitize(text) text = re.sub(' \n|\n ', ' ', text) text = re.sub('\n', ' ', text) return text def _sanitize(self, text): text = self._base_sanitize(text) text = re.sub(r'<([^>]+)>', r'\\fI\1\\fR', text) text = re.sub(r' +', ' ', text) text = re.sub('\n', ' ', text) return text def __write_cmd(self, dat): print('.', dat, sep='\n', file=self.f) pass def __write_raw(self, dat): print(dat, sep='', end='', file=self.f) pass def load_yml_file(fn): with open(fn) as f: return yaml.safe_load(f) def dedent_body(body): lines = [re.sub(r'^ (\S)', r'\1', l) for l in body.split('\n')] return '\n'.join(lines) def convert_manual_to_markdown(): f = StringIO() manual = load_yml_file("content/manual/dev/manual.yml") f.write(manual.get('manpage_intro', '\n')) f.write(dedent_body(manual.get('body', '\n'))) for section in manual.get('sections', []): f.write('## {}\n'.format(section.get('title', '').upper())) f.write(dedent_body(section.get('body', '\n'))) f.write('\n') for entry in section.get('entries', []): f.write('### {}\n'.format(entry.get('title', ''))) f.write(dedent_body(entry.get('body', '\n'))) f.write('\n') if entry.get('examples') is not None: f.write("~~~~\n") first = True for example in entry.get('examples'): if not first: f.write('\n') f.write("jq '{}'\n".format(example.get('program', ''))) f.write(" {}\n".format(example.get('input', ''))) output = [str(x) for x in example.get('output', [])] f.write("=> {}\n".format(', '.join(output))) first = False f.write("~~~~\n") f.write('\n') f.write(manual.get('manpage_epilogue', '')) return f.getvalue() # Convert manual.yml to our special markdown format markdown_data = convert_manual_to_markdown() # Convert markdown to html html_data = markdown.markdown(markdown_data, extensions=[EscapeHtml(), 'fenced_code']) # Parse the html into a tree so we can walk it tr = etree.HTML(html_data, etree.HTMLParser()) # Convert the markdown to ROFF RoffWalker(tr).walk() jq-1.8.2/docs/build_website.py0000755000175100017510000000473715215513536011766 #!/usr/bin/env python3 import glob import itertools from jinja2 import Environment, FileSystemLoader, select_autoescape, pass_context from markdown import markdown from markupsafe import Markup import os import os.path import re import shutil import yaml env = Environment( loader=FileSystemLoader('templates'), autoescape=select_autoescape(['html.j2']), ) def load_yml_file(fn): with open(fn) as f: return yaml.safe_load(f) env.globals['url'] = 'https://jqlang.org' env.filters['search_id'] = lambda input: input.replace(r'`', '') env.filters['section_id'] = lambda input: re.sub( r'[^-a-zA-Z0-9_]', '', input.replace(' ', '-')).lower() env.filters['entry_id'] = lambda input: re.sub( r'^(split|first-last-nth)$', r'\1' + ('-1' if ';' not in input else '-2'), # avoid id conflict re.sub( r'\b([^-]+)(?:-\1)+\b', r'\1', # e.g. range-range-range -> range re.sub(r' ?/ ?|,? ', '-', re.sub(r'[`;]|: .*|\(.*?\)| \[.+\]', '', input)))).lower() env.filters['markdownify'] = lambda input: Markup(markdown(input)) env.filters['no_paragraph'] = lambda input: Markup(re.sub(r'', '', input)) env.globals['unique_id'] = pass_context( lambda ctx: str(next(ctx['unique_ctr']))) def raise_handler(message): raise Exception(message) env.globals['raise'] = raise_handler def generate_file(env, fname): path, base = os.path.split(fname) path = os.path.relpath(path, 'content') if path == '.': path = '' permalink = '' else: permalink = path + '/' output_dir = os.path.join('output', path) output_path = os.path.join(output_dir, 'index.html') template_name = re.sub(r'.yml$', '.html.j2', base) ctx = load_yml_file(fname) ctx.update(unique_ctr=itertools.count(1), permalink=permalink, navitem=path) os.makedirs(output_dir, exist_ok=True) env.get_template(template_name).stream(ctx).dump(output_path, encoding='utf-8') def copy_public_files(root=''): for f in os.scandir(os.path.join('public', root)): src = os.path.join(root, f.name) dst = os.path.join('output', src) if f.is_dir(): os.makedirs(dst, exist_ok=True) copy_public_files(src) else: shutil.copyfile(f.path, dst) os.makedirs('output', exist_ok=True) copy_public_files() for fn in glob.glob('content/**/*.yml', recursive=True): generate_file(env, fn) jq-1.8.2/src/0000755000175100017510000000000015215513665006477 5jq-1.8.2/src/bytecode.c0000644000175100017510000001120415215513536010354 #include #include #include #include "bytecode.h" #include "jv_alloc.h" // flags, length #define NONE 0, 1 #define CONSTANT OP_HAS_CONSTANT, 2 #define VARIABLE (OP_HAS_VARIABLE | OP_HAS_BINDING), 3 #define GLOBAL (OP_HAS_CONSTANT | OP_HAS_VARIABLE | OP_HAS_BINDING | OP_IS_CALL_PSEUDO), 4 #define BRANCH OP_HAS_BRANCH, 2 #define CFUNC (OP_HAS_CFUNC | OP_HAS_BINDING), 3 #define UFUNC (OP_HAS_UFUNC | OP_HAS_BINDING | OP_IS_CALL_PSEUDO), 4 #define DEFINITION (OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 0 #define CLOSURE_REF_IMM (OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 2 #define OP(name, imm, in, out) \ {name, #name, imm, in, out}, static const struct opcode_description opcode_descriptions[] = { #include "opcode_list.h" }; static const struct opcode_description invalid_opcode_description = { -1, "#INVALID", 0, 0, 0, 0 }; const struct opcode_description* opcode_describe(opcode op) { if ((int)op >= 0 && (int)op < NUM_OPCODES) { return &opcode_descriptions[op]; } else { return &invalid_opcode_description; } } int bytecode_operation_length(uint16_t* codeptr) { int length = opcode_describe(*codeptr)->length; if (*codeptr == CALL_JQ || *codeptr == TAIL_CALL_JQ) { length += codeptr[1] * 2; } return length; } static void dump_code(int indent, struct bytecode* bc) { int pc = 0; while (pc < bc->codelen) { printf("%*s", indent, ""); dump_operation(bc, bc->code + pc); printf("\n"); pc += bytecode_operation_length(bc->code + pc); } } static void symbol_table_free(struct symbol_table* syms) { jv_mem_free(syms->cfunctions); jv_free(syms->cfunc_names); jv_mem_free(syms); } void dump_disassembly(int indent, struct bytecode* bc) { if (bc->nclosures > 0) { printf("%*s[params: ", indent, ""); jv params = jv_object_get(jv_copy(bc->debuginfo), jv_string("params")); for (int i=0; inclosures; i++) { if (i) printf(", "); jv name = jv_array_get(jv_copy(params), i); printf("%s", jv_string_value(name)); jv_free(name); } jv_free(params); printf("]\n"); } dump_code(indent, bc); for (int i=0; insubfunctions; i++) { struct bytecode* subfn = bc->subfunctions[i]; jv name = jv_object_get(jv_copy(subfn->debuginfo), jv_string("name")); printf("%*s%s:%d:\n", indent, "", jv_string_value(name), i); jv_free(name); dump_disassembly(indent+2, subfn); } } static struct bytecode* getlevel(struct bytecode* bc, int level) { while (level > 0) { bc = bc->parent; level--; } return bc; } void dump_operation(struct bytecode* bc, uint16_t* codeptr) { int pc = codeptr - bc->code; printf("%04d ", pc); const struct opcode_description* op = opcode_describe(bc->code[pc++]); printf("%s", op->name); if (op->length > 1) { uint16_t imm = bc->code[pc++]; if (op->op == CALL_JQ || op->op == TAIL_CALL_JQ) { for (int i=0; icode[pc++]; uint16_t idx = bc->code[pc++]; jv name; if (idx & ARG_NEWCLOSURE) { idx &= ~ARG_NEWCLOSURE; name = jv_object_get(jv_copy(getlevel(bc,level)->subfunctions[idx]->debuginfo), jv_string("name")); } else { name = jv_array_get(jv_object_get(jv_copy(getlevel(bc,level)->debuginfo), jv_string("params")), idx); } printf(" %s:%d", jv_string_value(name), idx); jv_free(name); if (level) { printf("^%d", level); } } } else if (op->op == CALL_BUILTIN) { int func = bc->code[pc++]; jv name = jv_array_get(jv_copy(bc->globals->cfunc_names), func); printf(" %s", jv_string_value(name)); jv_free(name); } else if (op->flags & OP_HAS_BRANCH) { printf(" %04d", pc + imm); } else if (op->flags & OP_HAS_CONSTANT) { printf(" "); jv_dump(jv_array_get(jv_copy(bc->constants), imm), 0); } else if (op->flags & OP_HAS_VARIABLE) { uint16_t v = bc->code[pc++]; jv name = jv_array_get(jv_object_get(jv_copy(getlevel(bc,imm)->debuginfo), jv_string("locals")), v); printf(" $%s:%d", jv_string_value(name), v); jv_free(name); if (imm) { printf("^%d", imm); } } else { printf(" %d", imm); } } } void bytecode_free(struct bytecode* bc) { if (!bc) return; jv_mem_free(bc->code); jv_free(bc->constants); for (int i=0; insubfunctions; i++) bytecode_free(bc->subfunctions[i]); if (!bc->parent) symbol_table_free(bc->globals); jv_mem_free(bc->subfunctions); jv_free(bc->debuginfo); jv_mem_free(bc); } jq-1.8.2/src/lexer.l0000644000175100017510000001070415215513536007712 %{ #include #include "jv_alloc.h" #include "compile.h" struct lexer_param; #include "parser.h" /* Generated by bison. */ #define YY_USER_ACTION \ do { \ yylloc->start = yyget_extra(yyscanner); \ yylloc->end = yylloc->start + yyleng; \ yyset_extra(yylloc->end, yyscanner); \ } while (0); %} %s IN_PAREN %s IN_BRACKET %s IN_BRACE %s IN_QQINTERP %x IN_QQSTRING %x IN_COMMENT %{ static int enter(int opening, int state, yyscan_t yyscanner); static int try_exit(int closing, int state, yyscan_t yyscanner); %} %option noyywrap nounput noinput nodefault %option noyyalloc noyyrealloc noyyfree %option reentrant %option extra-type="int" %option bison-bridge bison-locations %option prefix="jq_yy" %option stack %% "#" { yy_push_state(IN_COMMENT, yyscanner); } { \\(\\|\r?\n)|. { } \r?\n { yy_pop_state(yyscanner); } } <> { yy_pop_state(yyscanner); } "!=" { return NEQ; } "==" { return EQ; } "as" { return AS; } "import" { return IMPORT; } "include" { return INCLUDE; } "module" { return MODULE; } "def" { return DEF; } "if" { return IF; } "then" { return THEN; } "else" { return ELSE; } "elif" { return ELSE_IF; } "and" { return AND; } "or" { return OR; } "end" { return END; } "reduce" { return REDUCE; } "foreach" { return FOREACH; } "//" { return DEFINEDOR; } "try" { return TRY; } "catch" { return CATCH; } "label" { return LABEL; } "break" { return BREAK; } "$__loc__" { return LOC; } "|=" { return SETPIPE; } "+=" { return SETPLUS; } "-=" { return SETMINUS; } "*=" { return SETMULT; } "/=" { return SETDIV; } "%=" { return SETMOD; } "//=" { return SETDEFINEDOR; } "<=" { return LESSEQ; } ">=" { return GREATEREQ; } ".." { return REC; } "?//" { return ALTERNATION; } "."|"?"|"="|";"|","|":"|"|"|"+"|"-"|"*"|"/"|"%"|"\$"|"<"|">" { return yytext[0];} "["|"{"|"(" { return enter(yytext[0], YY_START, yyscanner); } "]"|"}"|")" { return try_exit(yytext[0], YY_START, yyscanner); } "@"[a-zA-Z0-9_]+ { yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT; } ([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][+-]?[0-9]+)? { yylval->literal = jv_parse_sized(yytext, yyleng); return LITERAL; } "\"" { yy_push_state(IN_QQSTRING, yyscanner); return QQSTRING_START; } { "\\(" { return enter(QQSTRING_INTERP_START, YY_START, yyscanner); } "\"" { yy_pop_state(yyscanner); return QQSTRING_END; } (\\[^u(]|\\u[a-zA-Z0-9]{0,4})+ { /* pass escapes to the json parser */ jv escapes = jv_string_fmt("\"%.*s\"", (int)yyleng, yytext); yylval->literal = jv_parse_sized(jv_string_value(escapes), jv_string_length_bytes(jv_copy(escapes))); jv_free(escapes); return QQSTRING_TEXT; } [^\\\"]+ { yylval->literal = jv_string_sized(yytext, yyleng); return QQSTRING_TEXT; } . { return INVALID_CHARACTER; } } ([a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext); return IDENT;} \.[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return FIELD;} \$([a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]* { yylval->literal = jv_string(yytext+1); return BINDING;} [ \r\n\t]+ {} . { return INVALID_CHARACTER; } %% /* perhaps these should be calls... */ /* "true" { return TRUE; } "false" { return FALSE; } "null" { return NULL; } */ static int try_exit(int c, int state, yyscan_t yyscanner) { char match = 0; int ret; switch (state) { case IN_PAREN: match = ret = ')'; break; case IN_BRACKET: match = ret = ']'; break; case IN_BRACE: match = ret = '}'; break; case IN_QQINTERP: match = ')'; ret = QQSTRING_INTERP_END; break; default: // may not be the best error to give return INVALID_CHARACTER; } assert(match); if (match == c) { yy_pop_state(yyscanner); return ret; } else { // FIXME: should we pop? Give a better error at least return INVALID_CHARACTER; } } static int enter(int c, int currstate, yyscan_t yyscanner) { int state = 0; switch (c) { case '(': state = IN_PAREN; break; case '[': state = IN_BRACKET; break; case '{': state = IN_BRACE; break; case QQSTRING_INTERP_START: state = IN_QQINTERP; break; } assert(state); yy_push_state(state, yyscanner); return c; } void* yyalloc(size_t sz, void* extra) { return jv_mem_alloc(sz); } void* yyrealloc(void* p, size_t sz, void* extra) { return jv_mem_realloc(p, sz); } void yyfree(void* p, void* extra) { jv_mem_free(p); } jq-1.8.2/src/jv.h0000644000175100017510000002467015215513536007215 #ifndef JV_H #define JV_H #include #include #include #ifdef __cplusplus extern "C" { #endif #if (defined(__GNUC__) && __GNUC__ >= 7) || \ (defined(__clang__) && __clang_major__ >= 10) # define JQ_FALLTHROUGH __attribute__((fallthrough)) #else # define JQ_FALLTHROUGH do {} while (0) /* fallthrough */ #endif typedef enum { JV_KIND_INVALID, JV_KIND_NULL, JV_KIND_FALSE, JV_KIND_TRUE, JV_KIND_NUMBER, JV_KIND_STRING, JV_KIND_ARRAY, JV_KIND_OBJECT } jv_kind; struct jv_refcnt; /* All of the fields of this struct are private. Really. Do not play with them. */ typedef struct { unsigned char kind_flags; unsigned char pad_; unsigned short offset; /* array offsets */ int size; union { struct jv_refcnt* ptr; double number; } u; } jv; /* * All jv_* functions consume (decref) input and produce (incref) output * Except jv_copy */ jv_kind jv_get_kind(jv); const char* jv_kind_name(jv_kind); static int jv_is_valid(jv x) { return jv_get_kind(x) != JV_KIND_INVALID; } jv jv_copy(jv); void jv_free(jv); int jv_get_refcnt(jv); int jv_equal(jv, jv); int jv_identical(jv, jv); int jv_contains(jv, jv); jv jv_invalid(void); jv jv_invalid_with_msg(jv); jv jv_invalid_get_msg(jv); int jv_invalid_has_msg(jv); jv jv_null(void); jv jv_true(void); jv jv_false(void); jv jv_bool(int); jv jv_number(double); jv jv_number_with_literal(const char*); double jv_number_value(jv); int jv_is_integer(jv); jv jv_number_abs(jv); jv jv_number_negate(jv); int jv_number_has_literal(jv); const char* jv_number_get_literal(jv); jv jv_array(void); jv jv_array_sized(int); int jv_array_length(jv); jv jv_array_get(jv, int); jv jv_array_set(jv, int, jv); jv jv_array_append(jv, jv); jv jv_array_concat(jv, jv); jv jv_array_slice(jv, int, int); jv jv_array_indexes(jv, jv); #define jv_array_foreach(a, i, x) \ for (int jv_len__ = jv_array_length(jv_copy(a)), i=0, jv_j__ = 1; \ jv_j__; jv_j__ = 0) \ for (jv x; \ i < jv_len__ ? \ (x = jv_array_get(jv_copy(a), i), 1) : 0; \ i++) #define JV_ARRAY_1(e) (jv_array_append(jv_array(),e)) #define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2)) #define JV_ARRAY_3(e1,e2,e3) (jv_array_append(JV_ARRAY_2(e1,e2),e3)) #define JV_ARRAY_4(e1,e2,e3,e4) (jv_array_append(JV_ARRAY_3(e1,e2,e3),e4)) #define JV_ARRAY_5(e1,e2,e3,e4,e5) (jv_array_append(JV_ARRAY_4(e1,e2,e3,e4),e5)) #define JV_ARRAY_6(e1,e2,e3,e4,e5,e6) (jv_array_append(JV_ARRAY_5(e1,e2,e3,e4,e5),e6)) #define JV_ARRAY_7(e1,e2,e3,e4,e5,e6,e7) (jv_array_append(JV_ARRAY_6(e1,e2,e3,e4,e5,e6),e7)) #define JV_ARRAY_8(e1,e2,e3,e4,e5,e6,e7,e8) (jv_array_append(JV_ARRAY_7(e1,e2,e3,e4,e5,e6,e7),e8)) #define JV_ARRAY_9(e1,e2,e3,e4,e5,e6,e7,e8,e9) (jv_array_append(JV_ARRAY_8(e1,e2,e3,e4,e5,e6,e7,e8),e9)) #define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME #define JV_ARRAY(...) \ JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__) #ifdef __GNUC__ #define JV_PRINTF_LIKE(fmt_arg_num, args_num) \ __attribute__ ((__format__( __printf__, fmt_arg_num, args_num))) #define JV_VPRINTF_LIKE(fmt_arg_num) \ __attribute__ ((__format__( __printf__, fmt_arg_num, 0))) #else #define JV_PRINTF_LIKE(fmt_arg_num, args_num) #define JV_VPRINTF_LIKE(fmt_arg_num) #endif jv jv_string(const char*); jv jv_string_sized(const char*, int); jv jv_string_empty(int len); int jv_string_length_bytes(jv); int jv_string_length_codepoints(jv); unsigned long jv_string_hash(jv); const char* jv_string_value(jv); jv jv_string_indexes(jv j, jv k); jv jv_string_slice(jv j, int start, int end); jv jv_string_concat(jv, jv); jv jv_string_vfmt(const char*, va_list) JV_VPRINTF_LIKE(1); jv jv_string_fmt(const char*, ...) JV_PRINTF_LIKE(1, 2); jv jv_string_append_codepoint(jv a, uint32_t c); jv jv_string_append_buf(jv a, const char* buf, int len); jv jv_string_append_str(jv a, const char* str); jv jv_string_repeat(jv j, int n); jv jv_string_split(jv j, jv sep); jv jv_string_explode(jv j); jv jv_string_implode(jv j); jv jv_object(void); jv jv_object_get(jv object, jv key); int jv_object_has(jv object, jv key); jv jv_object_set(jv object, jv key, jv value); jv jv_object_delete(jv object, jv key); int jv_object_length(jv object); jv jv_object_merge(jv, jv); jv jv_object_merge_recursive(jv, jv); int jv_object_iter(jv); int jv_object_iter_next(jv, int); int jv_object_iter_valid(jv, int); jv jv_object_iter_key(jv, int); jv jv_object_iter_value(jv, int); #define jv_object_foreach(t, k, v) \ for (int jv_i__ = jv_object_iter(t), jv_j__ = 1; jv_j__; jv_j__ = 0) \ for (jv k, v; \ jv_object_iter_valid((t), jv_i__) ? \ (k = jv_object_iter_key(t, jv_i__), \ v = jv_object_iter_value(t, jv_i__), \ 1) \ : 0; \ jv_i__ = jv_object_iter_next(t, jv_i__)) \ #define jv_object_keys_foreach(t, k) \ for (int jv_i__ = jv_object_iter(t), jv_j__ = 1; jv_j__; jv_j__ = 0) \ for (jv k; \ jv_object_iter_valid((t), jv_i__) ? \ (k = jv_object_iter_key(t, jv_i__), \ 1) \ : 0; \ jv_i__ = jv_object_iter_next(t, jv_i__)) #define JV_OBJECT_1(k1) (jv_object_set(jv_object(),(k1),jv_null())) #define JV_OBJECT_2(k1,v1) (jv_object_set(jv_object(),(k1),(v1))) #define JV_OBJECT_3(k1,v1,k2) (jv_object_set(JV_OBJECT_2((k1),(v1)),(k2),jv_null())) #define JV_OBJECT_4(k1,v1,k2,v2) (jv_object_set(JV_OBJECT_2((k1),(v1)),(k2),(v2))) #define JV_OBJECT_5(k1,v1,k2,v2,k3) (jv_object_set(JV_OBJECT_4((k1),(v1),(k2),(v2)),(k3),jv_null())) #define JV_OBJECT_6(k1,v1,k2,v2,k3,v3) (jv_object_set(JV_OBJECT_4((k1),(v1),(k2),(v2)),(k3),(v3))) #define JV_OBJECT_7(k1,v1,k2,v2,k3,v3,k4) (jv_object_set(JV_OBJECT_6((k1),(v1),(k2),(v2),(k3),(v3)),(k4),jv_null())) #define JV_OBJECT_8(k1,v1,k2,v2,k3,v3,k4,v4) (jv_object_set(JV_OBJECT_6((k1),(v1),(k2),(v2),(k3),(v3)),(k4),(v4))) #define JV_OBJECT_9(k1,v1,k2,v2,k3,v3,k4,v4,k5) \ (jv_object_set(JV_OBJECT_8((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4)),(k5),jv_null())) #define JV_OBJECT_10(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5) \ (jv_object_set(JV_OBJECT_8((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4)),(k5),(v5))) #define JV_OBJECT_11(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6) \ (jv_object_set(JV_OBJECT_10((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5)),(k6),jv_null())) #define JV_OBJECT_12(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6) \ (jv_object_set(JV_OBJECT_10((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5)),(k6),(v6))) #define JV_OBJECT_13(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7) \ (jv_object_set(JV_OBJECT_12((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6)),(k7),jv_null())) #define JV_OBJECT_14(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7) \ (jv_object_set(JV_OBJECT_12((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6)),(k7),(v7))) #define JV_OBJECT_15(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8) \ (jv_object_set(JV_OBJECT_14((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7)),(k8),jv_null())) #define JV_OBJECT_16(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8,v8) \ (jv_object_set(JV_OBJECT_14((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7)),(k8),(v8))) #define JV_OBJECT_17(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8,v8,k9) \ (jv_object_set(JV_OBJECT_16((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7),(k8),(v8)),(k9),jv_null())) #define JV_OBJECT_18(k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8,v8,k9,v9) \ (jv_object_set(JV_OBJECT_16((k1),(v1),(k2),(v2),(k3),(v3),(k4),(v4),(k5),(v5),(k6),(v6),(k7),(v7),(k8),(v8)),(k9),(v9))) #define JV_OBJECT_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,NAME,...) NAME #define JV_OBJECT(...) \ JV_OBJECT_IDX(__VA_ARGS__, \ JV_OBJECT_18, JV_OBJECT_17, JV_OBJECT_16, JV_OBJECT_15, \ JV_OBJECT_14, JV_OBJECT_13, JV_OBJECT_12, JV_OBJECT_11, \ JV_OBJECT_10, JV_OBJECT_9, JV_OBJECT_8, JV_OBJECT_7, \ JV_OBJECT_6, JV_OBJECT_5, JV_OBJECT_4, JV_OBJECT_3, \ JV_OBJECT_2, JV_OBJECT_1)(__VA_ARGS__) int jv_get_refcnt(jv); enum jv_print_flags { JV_PRINT_PRETTY = 1, JV_PRINT_ASCII = 2, JV_PRINT_COLOR = 4, JV_PRINT_COLOUR = 4, JV_PRINT_SORTED = 8, JV_PRINT_INVALID = 16, JV_PRINT_REFCOUNT = 32, JV_PRINT_TAB = 64, JV_PRINT_ISATTY = 128, JV_PRINT_SPACE0 = 256, JV_PRINT_SPACE1 = 512, JV_PRINT_SPACE2 = 1024, }; #define JV_PRINT_INDENT_FLAGS(n) \ ((n) < 0 || (n) > 7 ? JV_PRINT_TAB | JV_PRINT_PRETTY : (n) << 8 | JV_PRINT_PRETTY) void jv_dumpf(jv, FILE *f, int flags); void jv_dump(jv, int flags); void jv_show(jv, int flags); jv jv_dump_string(jv, int flags); char *jv_dump_string_trunc(jv x, char *outbuf, size_t bufsize); enum { JV_PARSE_SEQ = 1, JV_PARSE_STREAMING = 2, JV_PARSE_STREAM_ERRORS = 4, }; jv jv_parse(const char* string); jv jv_parse_sized(const char* string, int length); jv jv_parse_custom_flags(const char* string, int flags); typedef void (*jv_nomem_handler_f)(void *); void jv_nomem_handler(jv_nomem_handler_f, void *); jv jv_load_file(const char *, int); typedef struct jv_parser jv_parser; jv_parser* jv_parser_new(int); void jv_parser_set_buf(jv_parser*, const char*, int, int); int jv_parser_remaining(jv_parser*); jv jv_parser_next(jv_parser*); void jv_parser_free(jv_parser*); jv jv_get(jv, jv); jv jv_set(jv, jv, jv); jv jv_has(jv, jv); jv jv_setpath(jv, jv, jv); jv jv_getpath(jv, jv); jv jv_delpaths(jv, jv); jv jv_keys(jv /*object or array*/); jv jv_keys_unsorted(jv /*object or array*/); int jv_cmp(jv, jv); jv jv_sort(jv, jv); jv jv_group(jv, jv); jv jv_unique(jv, jv); #ifdef __cplusplus } #endif #endif /* true/false/null: check kind number: introduce/eliminate jv to integer array: copy free slice index update updateslice? */ jq-1.8.2/src/jv_dtoa_tsd.h0000644000175100017510000000014415215513536011064 #ifndef JV_DTOA_TSD_H #define JV_DTOA_TSD_H struct dtoa_context *tsd_dtoa_context_get(void); #endif jq-1.8.2/src/util.h0000644000175100017510000000307415215513536007546 #ifndef UTIL_H #define UTIL_H #ifdef WIN32 /* For WriteFile() below */ #include #include #include #include #include #include #endif #include "jv.h" jv expand_path(jv); jv get_home(void); jv jq_realpath(jv); /* * The Windows CRT and console are something else. In order for the * console to get UTF-8 written to it correctly we have to bypass stdio * completely. No amount of fflush()ing helps. If the first byte of a * buffer being written with fwrite() is non-ASCII UTF-8 then the * console misinterprets the byte sequence. But one must not * WriteFile() if stdout is a file!1!! * * We carry knowledge of whether the FILE * is a tty everywhere we * output to it just so we can write with WriteFile() if stdout is a * console on WIN32. */ static void priv_fwrite(const char *s, size_t len, FILE *fout, int is_tty) { #ifdef WIN32 if (is_tty) WriteFile((HANDLE)_get_osfhandle(fileno(fout)), s, len, NULL, NULL); else fwrite(s, 1, len, fout); #else fwrite(s, 1, len, fout); #endif } const void *_jq_memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen); #ifndef MIN #define MIN(a,b) \ ({ __typeof__ (a) _a = (a); \ __typeof__ (b) _b = (b); \ _a < _b ? _a : _b; }) #endif #ifndef MAX #define MAX(a,b) \ ({ __typeof__ (a) _a = (a); \ __typeof__ (b) _b = (b); \ _a > _b ? _a : _b; }) #endif #include #ifndef HAVE_STRPTIME char* strptime(const char *buf, const char *fmt, struct tm *tm); #endif #endif /* UTIL_H */ jq-1.8.2/src/inject_errors.c0000644000175100017510000000545215215513536011436 #include #include #include #include #include #include static FILE *fail; static FILE *fail_read; static FILE *fail_write; static FILE *fail_close; static int error; static FILE * (*real_fopen)(const char *, const char *); static int (*real_fclose)(FILE *); static int (*real_ferror)(FILE *); static void (*real_clearerr)(FILE *); static char * (*real_fgets)(char *, int, FILE *); static size_t (*real_fread)(void *, size_t, size_t, FILE *); static size_t (*real_fwrite)(const void *, size_t, size_t, FILE *); #define GET_REAL(sym) \ do { \ if (real_ ## sym == 0) { \ real_ ## sym = dlsym(RTLD_NEXT, #sym); \ assert(real_ ## sym != 0); \ } \ } while (0) #define dbg_write(msg) (void)write(2, msg, sizeof(msg) - 1) #define dbg() \ do { \ dbg_write("here: "); \ dbg_write(__func__); \ dbg_write("!\n"); \ } while (0) FILE *fopen(const char *path, const char *mode) { GET_REAL(fopen); fail = fail_read = fail_write = fail_close = 0; FILE *f = real_fopen(path, mode); error = EIO; if (strcmp(path, "fail_read") == 0) { fail = fail_read = f; } else if (strncmp(path, "fail_write", sizeof("fail_write") - 1) == 0) { // Not that jq opens files for write anyways... fail = fail_write = f; if (strcmp(path, "fail_write_enospc") == 0) error = ENOSPC; } else if (strncmp(path, "fail_close", sizeof("fail_close") - 1) == 0) { fail = fail_close = f; if (strcmp(path, "fail_close_enospc") == 0) error = ENOSPC; } return f; } int fclose(FILE *f) { GET_REAL(fclose); int res = real_fclose(f); if (fail_close == f) { fail = fail_read = fail_write = fail_close = 0; return EOF; } return res; } char * fgets(char *buf, int len, FILE *f) { GET_REAL(fgets); char *res = real_fgets(buf, len, f); if (fail_read == f) return 0; return res; } size_t fread(void *buf, size_t sz, size_t nemb, FILE *f) { GET_REAL(fread); size_t res = real_fread(buf, sz, nemb, f); if (fail_read == f) return 0; return res; } size_t fwrite(const void *buf, size_t sz, size_t nemb, FILE *f) { GET_REAL(fwrite); size_t res = real_fwrite(buf, sz, nemb, f); if (fail_write == f) return 0; return res; } int ferror(FILE *f) { GET_REAL(ferror); int res = real_ferror(f); if (fail == f) { errno = error; return 1; } return res; } void clearerr(FILE *f) { GET_REAL(clearerr); real_clearerr(f); if (fail == f) { fail = fail_read = fail_write = fail_close = 0; error = 0; } } jq-1.8.2/src/parser.h0000644000175100017510000001527615215513536010074 /* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 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, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */ #ifndef YY_YY_SRC_PARSER_H_INCLUDED # define YY_YY_SRC_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; #endif /* "%code requires" blocks. */ #line 12 "src/parser.y" #include "locfile.h" struct lexer_param; #define YYLTYPE location #define YYLLOC_DEFAULT(Loc, Rhs, N) \ do { \ if (N) { \ (Loc).start = YYRHSLOC(Rhs, 1).start; \ (Loc).end = YYRHSLOC(Rhs, N).end; \ } else { \ (Loc).start = YYRHSLOC(Rhs, 0).end; \ (Loc).end = YYRHSLOC(Rhs, 0).end; \ } \ } while (0) #line 66 "src/parser.h" /* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { YYEMPTY = -2, YYEOF = 0, /* "end of file" */ YYerror = 256, /* error */ YYUNDEF = 257, /* "invalid token" */ INVALID_CHARACTER = 258, /* INVALID_CHARACTER */ IDENT = 259, /* IDENT */ FIELD = 260, /* FIELD */ BINDING = 261, /* BINDING */ LITERAL = 262, /* LITERAL */ FORMAT = 263, /* FORMAT */ REC = 264, /* ".." */ SETMOD = 265, /* "%=" */ EQ = 266, /* "==" */ NEQ = 267, /* "!=" */ DEFINEDOR = 268, /* "//" */ AS = 269, /* "as" */ DEF = 270, /* "def" */ MODULE = 271, /* "module" */ IMPORT = 272, /* "import" */ INCLUDE = 273, /* "include" */ IF = 274, /* "if" */ THEN = 275, /* "then" */ ELSE = 276, /* "else" */ ELSE_IF = 277, /* "elif" */ REDUCE = 278, /* "reduce" */ FOREACH = 279, /* "foreach" */ END = 280, /* "end" */ AND = 281, /* "and" */ OR = 282, /* "or" */ TRY = 283, /* "try" */ CATCH = 284, /* "catch" */ LABEL = 285, /* "label" */ BREAK = 286, /* "break" */ LOC = 287, /* "$__loc__" */ SETPIPE = 288, /* "|=" */ SETPLUS = 289, /* "+=" */ SETMINUS = 290, /* "-=" */ SETMULT = 291, /* "*=" */ SETDIV = 292, /* "/=" */ SETDEFINEDOR = 293, /* "//=" */ LESSEQ = 294, /* "<=" */ GREATEREQ = 295, /* ">=" */ ALTERNATION = 296, /* "?//" */ QQSTRING_START = 297, /* QQSTRING_START */ QQSTRING_TEXT = 298, /* QQSTRING_TEXT */ QQSTRING_INTERP_START = 299, /* QQSTRING_INTERP_START */ QQSTRING_INTERP_END = 300, /* QQSTRING_INTERP_END */ QQSTRING_END = 301, /* QQSTRING_END */ FUNCDEF = 302, /* FUNCDEF */ NONOPT = 303 /* NONOPT */ }; typedef enum yytokentype yytoken_kind_t; #endif /* Token kinds. */ #define YYEMPTY -2 #define YYEOF 0 #define YYerror 256 #define YYUNDEF 257 #define INVALID_CHARACTER 258 #define IDENT 259 #define FIELD 260 #define BINDING 261 #define LITERAL 262 #define FORMAT 263 #define REC 264 #define SETMOD 265 #define EQ 266 #define NEQ 267 #define DEFINEDOR 268 #define AS 269 #define DEF 270 #define MODULE 271 #define IMPORT 272 #define INCLUDE 273 #define IF 274 #define THEN 275 #define ELSE 276 #define ELSE_IF 277 #define REDUCE 278 #define FOREACH 279 #define END 280 #define AND 281 #define OR 282 #define TRY 283 #define CATCH 284 #define LABEL 285 #define BREAK 286 #define LOC 287 #define SETPIPE 288 #define SETPLUS 289 #define SETMINUS 290 #define SETMULT 291 #define SETDIV 292 #define SETDEFINEDOR 293 #define LESSEQ 294 #define GREATEREQ 295 #define ALTERNATION 296 #define QQSTRING_START 297 #define QQSTRING_TEXT 298 #define QQSTRING_INTERP_START 299 #define QQSTRING_INTERP_END 300 #define QQSTRING_END 301 #define FUNCDEF 302 #define NONOPT 303 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 32 "src/parser.y" jv literal; block blk; #line 187 "src/parser.h" }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif /* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE YYLTYPE; struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; }; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif int yyparse (block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr); #endif /* !YY_YY_SRC_PARSER_H_INCLUDED */ jq-1.8.2/src/parser.c0000644000175100017510000042451015215513536010062 /* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 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, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, especially those whose name start with YY_ or yy_. They are private implementation details that can be changed or removed. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output, and Bison version. */ #define YYBISON 30802 /* Bison version string. */ #define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* First part of user prologue. */ #line 1 "src/parser.y" #include #include #include #include #include "compile.h" #include "jv_alloc.h" #include "builtin.h" #define YYMALLOC jv_mem_alloc #define YYFREE jv_mem_free #line 83 "src/parser.c" # ifndef YY_CAST # ifdef __cplusplus # define YY_CAST(Type, Val) static_cast (Val) # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) # else # define YY_CAST(Type, Val) ((Type) (Val)) # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) # endif # endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # else # define YY_NULLPTR ((void*)0) # endif # endif /* Use api.header.include to #include this header instead of duplicating it here. */ #ifndef YY_YY_SRC_PARSER_H_INCLUDED # define YY_YY_SRC_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; #endif /* "%code requires" blocks. */ #line 12 "src/parser.y" #include "locfile.h" struct lexer_param; #define YYLTYPE location #define YYLLOC_DEFAULT(Loc, Rhs, N) \ do { \ if (N) { \ (Loc).start = YYRHSLOC(Rhs, 1).start; \ (Loc).end = YYRHSLOC(Rhs, N).end; \ } else { \ (Loc).start = YYRHSLOC(Rhs, 0).end; \ (Loc).end = YYRHSLOC(Rhs, 0).end; \ } \ } while (0) #line 135 "src/parser.c" /* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { YYEMPTY = -2, YYEOF = 0, /* "end of file" */ YYerror = 256, /* error */ YYUNDEF = 257, /* "invalid token" */ INVALID_CHARACTER = 258, /* INVALID_CHARACTER */ IDENT = 259, /* IDENT */ FIELD = 260, /* FIELD */ BINDING = 261, /* BINDING */ LITERAL = 262, /* LITERAL */ FORMAT = 263, /* FORMAT */ REC = 264, /* ".." */ SETMOD = 265, /* "%=" */ EQ = 266, /* "==" */ NEQ = 267, /* "!=" */ DEFINEDOR = 268, /* "//" */ AS = 269, /* "as" */ DEF = 270, /* "def" */ MODULE = 271, /* "module" */ IMPORT = 272, /* "import" */ INCLUDE = 273, /* "include" */ IF = 274, /* "if" */ THEN = 275, /* "then" */ ELSE = 276, /* "else" */ ELSE_IF = 277, /* "elif" */ REDUCE = 278, /* "reduce" */ FOREACH = 279, /* "foreach" */ END = 280, /* "end" */ AND = 281, /* "and" */ OR = 282, /* "or" */ TRY = 283, /* "try" */ CATCH = 284, /* "catch" */ LABEL = 285, /* "label" */ BREAK = 286, /* "break" */ LOC = 287, /* "$__loc__" */ SETPIPE = 288, /* "|=" */ SETPLUS = 289, /* "+=" */ SETMINUS = 290, /* "-=" */ SETMULT = 291, /* "*=" */ SETDIV = 292, /* "/=" */ SETDEFINEDOR = 293, /* "//=" */ LESSEQ = 294, /* "<=" */ GREATEREQ = 295, /* ">=" */ ALTERNATION = 296, /* "?//" */ QQSTRING_START = 297, /* QQSTRING_START */ QQSTRING_TEXT = 298, /* QQSTRING_TEXT */ QQSTRING_INTERP_START = 299, /* QQSTRING_INTERP_START */ QQSTRING_INTERP_END = 300, /* QQSTRING_INTERP_END */ QQSTRING_END = 301, /* QQSTRING_END */ FUNCDEF = 302, /* FUNCDEF */ NONOPT = 303 /* NONOPT */ }; typedef enum yytokentype yytoken_kind_t; #endif /* Token kinds. */ #define YYEMPTY -2 #define YYEOF 0 #define YYerror 256 #define YYUNDEF 257 #define INVALID_CHARACTER 258 #define IDENT 259 #define FIELD 260 #define BINDING 261 #define LITERAL 262 #define FORMAT 263 #define REC 264 #define SETMOD 265 #define EQ 266 #define NEQ 267 #define DEFINEDOR 268 #define AS 269 #define DEF 270 #define MODULE 271 #define IMPORT 272 #define INCLUDE 273 #define IF 274 #define THEN 275 #define ELSE 276 #define ELSE_IF 277 #define REDUCE 278 #define FOREACH 279 #define END 280 #define AND 281 #define OR 282 #define TRY 283 #define CATCH 284 #define LABEL 285 #define BREAK 286 #define LOC 287 #define SETPIPE 288 #define SETPLUS 289 #define SETMINUS 290 #define SETMULT 291 #define SETDIV 292 #define SETDEFINEDOR 293 #define LESSEQ 294 #define GREATEREQ 295 #define ALTERNATION 296 #define QQSTRING_START 297 #define QQSTRING_TEXT 298 #define QQSTRING_INTERP_START 299 #define QQSTRING_INTERP_END 300 #define QQSTRING_END 301 #define FUNCDEF 302 #define NONOPT 303 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 32 "src/parser.y" jv literal; block blk; #line 256 "src/parser.c" }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif /* Location type. */ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE YYLTYPE; struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; }; # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif int yyparse (block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr); #endif /* !YY_YY_SRC_PARSER_H_INCLUDED */ /* Symbol kind. */ enum yysymbol_kind_t { YYSYMBOL_YYEMPTY = -2, YYSYMBOL_YYEOF = 0, /* "end of file" */ YYSYMBOL_YYerror = 1, /* error */ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ YYSYMBOL_INVALID_CHARACTER = 3, /* INVALID_CHARACTER */ YYSYMBOL_IDENT = 4, /* IDENT */ YYSYMBOL_FIELD = 5, /* FIELD */ YYSYMBOL_BINDING = 6, /* BINDING */ YYSYMBOL_LITERAL = 7, /* LITERAL */ YYSYMBOL_FORMAT = 8, /* FORMAT */ YYSYMBOL_REC = 9, /* ".." */ YYSYMBOL_SETMOD = 10, /* "%=" */ YYSYMBOL_EQ = 11, /* "==" */ YYSYMBOL_NEQ = 12, /* "!=" */ YYSYMBOL_DEFINEDOR = 13, /* "//" */ YYSYMBOL_AS = 14, /* "as" */ YYSYMBOL_DEF = 15, /* "def" */ YYSYMBOL_MODULE = 16, /* "module" */ YYSYMBOL_IMPORT = 17, /* "import" */ YYSYMBOL_INCLUDE = 18, /* "include" */ YYSYMBOL_IF = 19, /* "if" */ YYSYMBOL_THEN = 20, /* "then" */ YYSYMBOL_ELSE = 21, /* "else" */ YYSYMBOL_ELSE_IF = 22, /* "elif" */ YYSYMBOL_REDUCE = 23, /* "reduce" */ YYSYMBOL_FOREACH = 24, /* "foreach" */ YYSYMBOL_END = 25, /* "end" */ YYSYMBOL_AND = 26, /* "and" */ YYSYMBOL_OR = 27, /* "or" */ YYSYMBOL_TRY = 28, /* "try" */ YYSYMBOL_CATCH = 29, /* "catch" */ YYSYMBOL_LABEL = 30, /* "label" */ YYSYMBOL_BREAK = 31, /* "break" */ YYSYMBOL_LOC = 32, /* "$__loc__" */ YYSYMBOL_SETPIPE = 33, /* "|=" */ YYSYMBOL_SETPLUS = 34, /* "+=" */ YYSYMBOL_SETMINUS = 35, /* "-=" */ YYSYMBOL_SETMULT = 36, /* "*=" */ YYSYMBOL_SETDIV = 37, /* "/=" */ YYSYMBOL_SETDEFINEDOR = 38, /* "//=" */ YYSYMBOL_LESSEQ = 39, /* "<=" */ YYSYMBOL_GREATEREQ = 40, /* ">=" */ YYSYMBOL_ALTERNATION = 41, /* "?//" */ YYSYMBOL_QQSTRING_START = 42, /* QQSTRING_START */ YYSYMBOL_QQSTRING_TEXT = 43, /* QQSTRING_TEXT */ YYSYMBOL_QQSTRING_INTERP_START = 44, /* QQSTRING_INTERP_START */ YYSYMBOL_QQSTRING_INTERP_END = 45, /* QQSTRING_INTERP_END */ YYSYMBOL_QQSTRING_END = 46, /* QQSTRING_END */ YYSYMBOL_FUNCDEF = 47, /* FUNCDEF */ YYSYMBOL_48_ = 48, /* '|' */ YYSYMBOL_49_ = 49, /* ',' */ YYSYMBOL_50_ = 50, /* '=' */ YYSYMBOL_51_ = 51, /* '<' */ YYSYMBOL_52_ = 52, /* '>' */ YYSYMBOL_53_ = 53, /* '+' */ YYSYMBOL_54_ = 54, /* '-' */ YYSYMBOL_55_ = 55, /* '*' */ YYSYMBOL_56_ = 56, /* '/' */ YYSYMBOL_57_ = 57, /* '%' */ YYSYMBOL_NONOPT = 58, /* NONOPT */ YYSYMBOL_59_ = 59, /* '?' */ YYSYMBOL_60_ = 60, /* '.' */ YYSYMBOL_61_ = 61, /* '[' */ YYSYMBOL_62_ = 62, /* ';' */ YYSYMBOL_63_ = 63, /* ':' */ YYSYMBOL_64_ = 64, /* '(' */ YYSYMBOL_65_ = 65, /* ')' */ YYSYMBOL_66_ = 66, /* ']' */ YYSYMBOL_67_ = 67, /* '{' */ YYSYMBOL_68_ = 68, /* '}' */ YYSYMBOL_69_ = 69, /* '$' */ YYSYMBOL_YYACCEPT = 70, /* $accept */ YYSYMBOL_TopLevel = 71, /* TopLevel */ YYSYMBOL_Module = 72, /* Module */ YYSYMBOL_Imports = 73, /* Imports */ YYSYMBOL_FuncDefs = 74, /* FuncDefs */ YYSYMBOL_Query = 75, /* Query */ YYSYMBOL_Expr = 76, /* Expr */ YYSYMBOL_Import = 77, /* Import */ YYSYMBOL_ImportWhat = 78, /* ImportWhat */ YYSYMBOL_ImportFrom = 79, /* ImportFrom */ YYSYMBOL_FuncDef = 80, /* FuncDef */ YYSYMBOL_Params = 81, /* Params */ YYSYMBOL_Param = 82, /* Param */ YYSYMBOL_StringStart = 83, /* StringStart */ YYSYMBOL_String = 84, /* String */ YYSYMBOL_QQString = 85, /* QQString */ YYSYMBOL_ElseBody = 86, /* ElseBody */ YYSYMBOL_Term = 87, /* Term */ YYSYMBOL_Args = 88, /* Args */ YYSYMBOL_Arg = 89, /* Arg */ YYSYMBOL_RepPatterns = 90, /* RepPatterns */ YYSYMBOL_Patterns = 91, /* Patterns */ YYSYMBOL_Pattern = 92, /* Pattern */ YYSYMBOL_ArrayPats = 93, /* ArrayPats */ YYSYMBOL_ObjPats = 94, /* ObjPats */ YYSYMBOL_ObjPat = 95, /* ObjPat */ YYSYMBOL_Keyword = 96, /* Keyword */ YYSYMBOL_DictPairs = 97, /* DictPairs */ YYSYMBOL_DictPair = 98, /* DictPair */ YYSYMBOL_DictExpr = 99 /* DictExpr */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; /* Second part of user prologue. */ #line 127 "src/parser.y" #include "lexer.h" struct lexer_param { yyscan_t lexer; }; #define FAIL(loc, msg) \ do { \ location l = loc; \ yyerror(&l, answer, errors, locations, lexer_param_ptr, msg); \ /*YYERROR*/; \ } while (0) void yyerror(YYLTYPE* loc, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr, const char *s){ (*errors)++; locfile_locate(locations, *loc, "jq: error: %s", s); } int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr) { yyscan_t lexer = lexer_param_ptr->lexer; int tok = jq_yylex(yylval, yylloc, lexer); if ((tok == LITERAL || tok == QQSTRING_TEXT) && !jv_is_valid(yylval->literal)) { jv msg = jv_invalid_get_msg(jv_copy(yylval->literal)); if (jv_get_kind(msg) == JV_KIND_STRING) { FAIL(*yylloc, jv_string_value(msg)); } else { FAIL(*yylloc, "Invalid literal"); } jv_free(msg); jv_free(yylval->literal); yylval->literal = jv_null(); } return tok; } /* Returns string message if the block is a constant that is not valid as an * object key. */ static jv check_object_key(block k) { if (block_is_const(k) && block_const_kind(k) != JV_KIND_STRING) { char errbuf[30]; return jv_string_fmt("Cannot use %s (%s) as object key", jv_kind_name(block_const_kind(k)), jv_dump_string_trunc(block_const(k), errbuf, sizeof(errbuf))); } return jv_invalid(); } static block gen_index(block obj, block key) { return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX)); } static block gen_index_opt(block obj, block key) { return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX_OPT)); } static block gen_slice_index(block obj, block start, block end, opcode idx_op) { block key = BLOCK(gen_subexp(gen_const(jv_object())), gen_subexp(gen_const(jv_string("start"))), gen_subexp(start), gen_op_simple(INSERT), gen_subexp(gen_const(jv_string("end"))), gen_subexp(end), gen_op_simple(INSERT)); return BLOCK(key, obj, gen_op_simple(idx_op)); } static block constant_fold(block a, block b, int op) { if (!block_is_single(a) || !block_is_const(a) || !block_is_single(b) || !block_is_const(b)) return gen_noop(); jv jv_a = block_const(a); block_free(a); jv jv_b = block_const(b); block_free(b); jv res = jv_invalid(); switch (op) { case '+': res = binop_plus(jv_a, jv_b); break; case '-': res = binop_minus(jv_a, jv_b); break; case '*': res = binop_multiply(jv_a, jv_b); break; case '/': res = binop_divide(jv_a, jv_b); break; case '%': res = binop_mod(jv_a, jv_b); break; case EQ: res = binop_equal(jv_a, jv_b); break; case NEQ: res = binop_notequal(jv_a, jv_b); break; case '<': res = binop_less(jv_a, jv_b); break; case '>': res = binop_greater(jv_a, jv_b); break; case LESSEQ: res = binop_lesseq(jv_a, jv_b); break; case GREATEREQ: res = binop_greatereq(jv_a, jv_b); break; } if (jv_is_valid(res)) return gen_const(res); return gen_error(jv_invalid_get_msg(res)); } static block gen_binop(block a, block b, int op) { block folded = constant_fold(a, b, op); if (!block_is_noop(folded)) return folded; const char* funcname = 0; switch (op) { case '+': funcname = "_plus"; break; case '-': funcname = "_minus"; break; case '*': funcname = "_multiply"; break; case '/': funcname = "_divide"; break; case '%': funcname = "_mod"; break; case EQ: funcname = "_equal"; break; case NEQ: funcname = "_notequal"; break; case '<': funcname = "_less"; break; case '>': funcname = "_greater"; break; case LESSEQ: funcname = "_lesseq"; break; case GREATEREQ: funcname = "_greatereq"; break; } assert(funcname); return gen_call(funcname, BLOCK(gen_lambda(a), gen_lambda(b))); } static block gen_format(block a, jv fmt) { return BLOCK(a, gen_call("format", gen_lambda(gen_const(fmt)))); } static block gen_definedor_assign(block object, block val) { block tmp = gen_op_var_fresh(STOREV, "tmp"); return BLOCK(gen_op_simple(DUP), val, tmp, gen_call("_modify", BLOCK(gen_lambda(object), gen_lambda(gen_definedor(gen_noop(), gen_op_bound(LOADV, tmp)))))); } static block gen_update(block object, block val, int optype) { block tmp = gen_op_var_fresh(STOREV, "tmp"); return BLOCK(gen_op_simple(DUP), val, tmp, gen_call("_modify", BLOCK(gen_lambda(object), gen_lambda(gen_binop(gen_noop(), gen_op_bound(LOADV, tmp), optype))))); } static block gen_loc_object(location *loc, struct locfile *locations) { return gen_const(JV_OBJECT(jv_string("file"), jv_copy(locations->fname), jv_string("line"), jv_number(locfile_get_line(locations, loc->start) + 1))); } #line 547 "src/parser.c" #ifdef short # undef short #endif /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure and (if available) are included so that the code can choose integer types of a good width. */ #ifndef __PTRDIFF_MAX__ # include /* INFRINGES ON USER NAME SPACE */ # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YY_STDINT_H # endif #endif /* Narrow types that promote to a signed type and that can represent a signed or unsigned integer of at least N bits. In tables they can save space and decrease cache pressure. Promoting to a signed type helps avoid bugs in integer arithmetic. */ #ifdef __INT_LEAST8_MAX__ typedef __INT_LEAST8_TYPE__ yytype_int8; #elif defined YY_STDINT_H typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef __INT_LEAST16_MAX__ typedef __INT_LEAST16_TYPE__ yytype_int16; #elif defined YY_STDINT_H typedef int_least16_t yytype_int16; #else typedef short yytype_int16; #endif /* Work around bug in HP-UX 11.23, which defines these macros incorrectly for preprocessor constants. This workaround can likely be removed in 2023, as HPE has promised support for HP-UX 11.23 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of . */ #ifdef __hpux # undef UINT_LEAST8_MAX # undef UINT_LEAST16_MAX # define UINT_LEAST8_MAX 255 # define UINT_LEAST16_MAX 65535 #endif #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ && UINT_LEAST8_MAX <= INT_MAX) typedef uint_least8_t yytype_uint8; #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX typedef unsigned char yytype_uint8; #else typedef short yytype_uint8; #endif #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ typedef __UINT_LEAST16_TYPE__ yytype_uint16; #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ && UINT_LEAST16_MAX <= INT_MAX) typedef uint_least16_t yytype_uint16; #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX typedef unsigned short yytype_uint16; #else typedef int yytype_uint16; #endif #ifndef YYPTRDIFF_T # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ # define YYPTRDIFF_T __PTRDIFF_TYPE__ # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ # elif defined PTRDIFF_MAX # ifndef ptrdiff_t # include /* INFRINGES ON USER NAME SPACE */ # endif # define YYPTRDIFF_T ptrdiff_t # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX # else # define YYPTRDIFF_T long # define YYPTRDIFF_MAXIMUM LONG_MAX # endif #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM \ YY_CAST (YYPTRDIFF_T, \ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ ? YYPTRDIFF_MAXIMUM \ : YY_CAST (YYSIZE_T, -1))) #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) /* Stored state numbers (used for stacks). */ typedef yytype_int16 yy_state_t; /* State numbers in computations. */ typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define YY_ATTRIBUTE_PURE # endif #endif #ifndef YY_ATTRIBUTE_UNUSED # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else # define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YY_USE(E) ((void) (E)) #else # define YY_USE(E) /* empty */ #endif /* Suppress an incorrect diagnostic about yylval being uninitialized. */ #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") # else # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ # define YY_IGNORE_USELESS_CAST_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") # define YY_IGNORE_USELESS_CAST_END \ _Pragma ("GCC diagnostic pop") #endif #ifndef YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_END #endif #define YY_ASSERT(E) ((void) (0 && (E))) #if 1 /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* 1 */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ + YYSIZEOF (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 31 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 1226 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 70 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 30 /* YYNRULES -- Number of rules. */ #define YYNRULES 168 /* YYNSTATES -- Number of states. */ #define YYNSTATES 312 /* YYMAXUTOK -- Last valid token kind. */ #define YYMAXUTOK 303 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ (0 <= (YYX) && (YYX) <= YYMAXUTOK \ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 69, 57, 2, 2, 64, 65, 55, 53, 49, 54, 60, 56, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 63, 62, 51, 50, 52, 59, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, 2, 66, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 67, 48, 68, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 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, 58 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 282, 282, 285, 290, 293, 308, 311, 316, 319, 325, 328, 331, 337, 340, 343, 349, 352, 355, 358, 361, 364, 367, 370, 373, 376, 379, 382, 385, 388, 391, 394, 397, 400, 403, 406, 409, 412, 415, 421, 424, 441, 445, 449, 455, 466, 471, 477, 480, 485, 489, 496, 499, 505, 512, 515, 518, 524, 527, 530, 536, 539, 542, 550, 554, 557, 560, 563, 566, 569, 572, 575, 578, 582, 588, 591, 594, 597, 600, 603, 606, 609, 612, 615, 618, 621, 624, 627, 630, 633, 636, 639, 642, 645, 648, 651, 654, 661, 664, 667, 670, 673, 677, 680, 684, 702, 706, 710, 713, 725, 730, 731, 732, 733, 736, 739, 744, 749, 752, 757, 760, 765, 769, 772, 777, 780, 785, 788, 793, 796, 799, 802, 805, 808, 816, 822, 825, 828, 831, 834, 837, 840, 843, 846, 849, 852, 855, 858, 861, 864, 867, 870, 873, 879, 882, 885, 890, 893, 896, 899, 903, 908, 912, 916, 920, 924, 932, 938, 941 }; #endif /** Accessing symbol of state STATE. */ #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) #if 1 /* The user-facing name of the symbol whose (internal) number is YYSYMBOL. No bounds checking. */ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "\"end of file\"", "error", "\"invalid token\"", "INVALID_CHARACTER", "IDENT", "FIELD", "BINDING", "LITERAL", "FORMAT", "\"..\"", "\"%=\"", "\"==\"", "\"!=\"", "\"//\"", "\"as\"", "\"def\"", "\"module\"", "\"import\"", "\"include\"", "\"if\"", "\"then\"", "\"else\"", "\"elif\"", "\"reduce\"", "\"foreach\"", "\"end\"", "\"and\"", "\"or\"", "\"try\"", "\"catch\"", "\"label\"", "\"break\"", "\"$__loc__\"", "\"|=\"", "\"+=\"", "\"-=\"", "\"*=\"", "\"/=\"", "\"//=\"", "\"<=\"", "\">=\"", "\"?//\"", "QQSTRING_START", "QQSTRING_TEXT", "QQSTRING_INTERP_START", "QQSTRING_INTERP_END", "QQSTRING_END", "FUNCDEF", "'|'", "','", "'='", "'<'", "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "NONOPT", "'?'", "'.'", "'['", "';'", "':'", "'('", "')'", "']'", "'{'", "'}'", "'$'", "$accept", "TopLevel", "Module", "Imports", "FuncDefs", "Query", "Expr", "Import", "ImportWhat", "ImportFrom", "FuncDef", "Params", "Param", "StringStart", "String", "QQString", "ElseBody", "Term", "Args", "Arg", "RepPatterns", "Patterns", "Pattern", "ArrayPats", "ObjPats", "ObjPat", "Keyword", "DictPairs", "DictPair", "DictExpr", YY_NULLPTR }; static const char * yysymbol_name (yysymbol_kind_t yysymbol) { return yytname[yysymbol]; } #endif #define YYPACT_NINF (-146) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-154) #define yytable_value_is_error(Yyn) \ ((Yyn) == YYTABLE_NINF) /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 31, 890, 44, 35, 11, 9, -146, -146, 38, -146, 85, 890, 956, 956, 956, 112, 26, -146, -146, 956, 279, 345, 412, 608, 59, 25, 1040, 890, -146, -146, -2, -146, 4, 4, 890, 35, 692, 890, -146, -146, 20, -18, 1073, 1105, 131, 86, -146, -146, -2, -146, 164, 38, 108, 107, -146, 22, 104, 0, -34, 121, 124, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 890, 135, 137, 134, 126, 141, 890, 890, -146, 956, 956, 956, 956, -5, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, 84, 177, 147, -146, 3, 173, 199, -146, -146, -146, 84, 890, -146, -146, 114, 84, 77, -146, 890, 13, 479, -5, -5, 546, 890, -146, -146, -146, -146, -146, -146, 956, -146, 956, 956, 78, 956, 956, -146, 663, 220, 84, -146, 1169, 505, 505, 1137, -146, -5, 1018, 187, 166, 188, 606, 205, 1169, 1169, 1169, 1169, 1169, 1169, 505, 505, 1169, 505, 505, 208, 208, -146, -146, -146, -146, 890, -146, -146, 758, 176, 175, 890, 184, 6, 57, -146, -146, 890, -146, 123, -146, -146, 83, -146, -146, 18, 185, 189, -146, -146, 84, 1137, 200, 200, 200, 203, 200, 200, 206, -146, -146, -146, -42, 207, 209, 210, 890, 212, -45, -146, 213, -5, 890, 33, 193, 28, -146, -146, 71, -146, 824, 218, -146, -146, -146, -146, 13, 215, 890, 890, -146, -146, 890, 890, 956, 956, -5, -146, -5, -5, -5, 103, -5, 1018, -146, -5, 227, 84, -146, -146, 222, 223, 226, 74, -146, -146, 890, -7, 2, 160, 163, 200, 200, -146, -146, -146, -146, 225, -146, -146, -146, -146, -146, -146, 235, 170, -146, 890, 890, 890, -5, -146, -146, 18, 105, 76, -146, -146, -146, 890, -146, 142, -146 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 4, 0, 0, 6, 108, 69, 106, 89, 91, 61, 0, 0, 0, 0, 0, 0, 0, 107, 52, 0, 0, 0, 0, 0, 0, 0, 15, 0, 54, 90, 38, 1, 0, 0, 8, 6, 0, 0, 65, 51, 0, 0, 0, 0, 104, 0, 63, 62, 92, 72, 0, 0, 71, 0, 95, 0, 0, 0, 0, 162, 161, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 163, 0, 159, 164, 0, 154, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 68, 88, 0, 0, 0, 44, 43, 3, 2, 8, 7, 39, 0, 116, 0, 114, 0, 0, 0, 0, 0, 0, 0, 73, 67, 111, 94, 110, 93, 0, 113, 0, 0, 0, 0, 0, 96, 0, 0, 13, 14, 31, 32, 33, 16, 121, 0, 0, 0, 0, 120, 19, 18, 21, 23, 25, 27, 30, 20, 36, 37, 17, 34, 35, 22, 24, 26, 28, 29, 55, 0, 53, 64, 0, 70, 0, 0, 79, 0, 0, 9, 40, 0, 109, 0, 50, 49, 0, 47, 101, 0, 0, 0, 103, 102, 12, 168, 166, 156, 160, 0, 158, 157, 0, 155, 105, 124, 0, 0, 0, 128, 0, 0, 0, 126, 0, 0, 0, 0, 81, 0, 66, 112, 0, 78, 0, 75, 42, 41, 115, 45, 0, 0, 0, 0, 59, 100, 0, 0, 0, 0, 0, 122, 0, 0, 0, 0, 0, 0, 123, 0, 119, 11, 56, 80, 77, 87, 86, 0, 74, 48, 0, 0, 0, 0, 0, 167, 165, 125, 134, 130, 129, 0, 132, 127, 131, 76, 84, 83, 85, 0, 58, 0, 0, 0, 0, 82, 46, 0, 0, 0, 133, 57, 97, 0, 99, 0, 98 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -146, -146, -146, 236, 179, -1, 1, -146, -146, 253, -8, -146, 53, -146, 5, -146, 7, 284, -146, 115, -146, 60, -100, -146, -146, 48, -145, 169, -146, -140 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_uint8 yydefgoto[] = { 0, 2, 3, 34, 121, 112, 26, 35, 36, 118, 27, 201, 202, 28, 29, 113, 250, 30, 128, 129, 162, 163, 164, 221, 227, 228, 82, 83, 84, 211 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 25, 159, 132, 114, 262, 212, 213, 255, 215, 216, 41, 51, 51, 42, 43, 44, 229, 199, 295, 200, 55, 57, 296, 263, 256, 52, 123, 46, 81, 143, 86, 87, 47, 122, 144, 126, 127, 119, 119, 247, 248, 86, 87, 249, 31, 18, 18, 1, 86, 87, 86, 87, 32, 33, 86, 87, 160, 115, 116, 117, 220, 241, 161, 242, 187, 142, 86, 87, 38, 239, 86, 87, 240, 86, 87, 37, 86, 87, 267, 147, 39, 86, 87, 130, 131, 153, 154, 88, 140, 40, 155, 156, 157, 158, 269, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 280, 281, 123, 192, 229, 45, 86, 87, 188, 86, 87, 86, 87, 86, 87, 85, 198, 265, 204, 86, 87, 136, 209, 208, 270, 308, 196, 293, 309, 197, 214, 210, 245, 210, 210, 246, 210, 210, 86, 87, 86, 87, 282, 81, 283, 284, 285, 135, 287, 86, 87, 289, 137, 226, 138, 286, 141, 307, 86, 87, 139, 189, 151, 195, 4, 5, 6, 7, 8, 9, 232, 145, 244, 234, 146, 10, 237, 86, 87, 11, 205, 206, 127, 12, 13, 148, 305, 149, 14, 150, 15, 16, 17, 186, 311, 86, 87, 152, 86, 87, 193, 231, 18, 90, 91, 86, 87, 183, 184, 297, 185, 260, 298, 219, 19, 230, -118, 266, 94, 301, 20, 21, 235, 190, 22, 272, 191, 23, 236, 24, 238, 102, 103, 276, 277, 253, 251, 278, 279, 268, 252, 210, 210, 105, 106, 107, 108, 109, 110, 111, 109, 110, 111, 254, 226, -117, 143, 257, 124, 258, 259, 294, 261, 264, 273, 275, -60, 49, 290, 291, 50, -60, 292, 120, 51, 299, -60, -60, -60, -60, -60, 300, 302, 303, 304, 274, -60, -60, -60, 194, 48, -60, -60, -60, 310, -60, 306, 288, 243, -60, -60, -60, -60, -60, -60, -60, -60, 218, 18, 0, 0, -60, 0, 0, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, 0, -60, -60, -60, -60, -60, 0, -60, -60, 53, -60, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 0, 22, 0, 54, 23, 56, 24, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 0, 22, 0, 0, 23, 203, 24, 0, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 0, 0, -154, -154, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 0, 22, -154, -154, 23, 207, 24, 0, 4, 5, 6, 7, 8, 9, -154, -154, 107, 108, 109, 110, 111, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 0, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 58, 22, 0, 59, 23, 60, 24, 51, 90, 91, 0, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 102, 103, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 105, 106, 107, 108, 109, 110, 111, 217, 0, 0, 59, 0, 60, 0, 51, 80, 0, 0, 0, -153, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 4, 5, 6, 7, 8, 9, 0, 0, 0, 18, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 80, 0, 0, 0, -153, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 125, 0, 22, 0, 0, 23, 0, 24, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 0, 22, 0, 233, 23, 0, 24, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 0, 22, 0, 271, 23, 0, 24, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 0, 22, 0, 0, 23, 0, 24, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 12, 13, 0, 0, 0, 14, 0, 0, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 20, 21, 0, 222, 22, 0, 223, 23, 224, 24, 51, 0, 0, 0, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 89, 90, 91, 92, 93, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 94, 95, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 0, 225, 89, 90, 91, 92, 133, 0, 0, 104, 105, 106, 107, 108, 109, 110, 111, 0, 94, 95, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 0, 89, 90, 91, 92, 134, 0, 0, 0, 104, 105, 106, 107, 108, 109, 110, 111, 94, 95, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 0, 89, 90, 91, 92, 0, 0, 0, 0, 104, 105, 106, 107, 108, 109, 110, 111, 94, 95, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 0, -154, 90, 91, 0, 0, 0, 0, 0, 104, 105, 106, 107, 108, 109, 110, 111, 94, 95, 0, 0, 0, 0, 0, -154, -154, -154, -154, -154, -154, 102, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, -154, 105, 106, 107, 108, 109, 110, 111 }; static const yytype_int16 yycheck[] = { 1, 6, 20, 5, 49, 145, 146, 49, 148, 149, 11, 8, 8, 12, 13, 14, 161, 4, 25, 6, 21, 22, 20, 68, 66, 20, 34, 1, 23, 63, 48, 49, 6, 34, 68, 36, 37, 32, 33, 21, 22, 48, 49, 25, 0, 42, 42, 16, 48, 49, 48, 49, 17, 18, 48, 49, 61, 59, 60, 61, 160, 4, 67, 6, 61, 65, 48, 49, 59, 63, 48, 49, 66, 48, 49, 64, 48, 49, 45, 80, 42, 48, 49, 63, 64, 86, 87, 62, 66, 4, 89, 90, 91, 92, 66, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 253, 254, 123, 117, 262, 6, 48, 49, 116, 48, 49, 48, 49, 48, 49, 69, 130, 230, 132, 48, 49, 48, 136, 135, 66, 62, 62, 66, 65, 65, 65, 143, 62, 145, 146, 65, 148, 149, 48, 49, 48, 49, 255, 151, 257, 258, 259, 29, 261, 48, 49, 264, 1, 161, 59, 65, 65, 65, 48, 49, 66, 1, 49, 62, 4, 5, 6, 7, 8, 9, 184, 63, 62, 187, 63, 15, 190, 48, 49, 19, 133, 134, 196, 23, 24, 63, 299, 63, 28, 68, 30, 31, 32, 59, 65, 48, 49, 69, 48, 49, 14, 48, 42, 11, 12, 48, 49, 43, 44, 62, 46, 225, 62, 6, 54, 41, 41, 231, 26, 62, 60, 61, 59, 63, 64, 239, 66, 67, 66, 69, 59, 39, 40, 247, 248, 48, 64, 251, 252, 59, 64, 253, 254, 51, 52, 53, 54, 55, 56, 57, 55, 56, 57, 63, 262, 41, 63, 63, 35, 63, 63, 275, 63, 63, 59, 63, 0, 1, 59, 59, 4, 5, 59, 33, 8, 63, 10, 11, 12, 13, 14, 59, 296, 297, 298, 245, 20, 21, 22, 123, 19, 25, 26, 27, 308, 29, 302, 262, 196, 33, 34, 35, 36, 37, 38, 39, 40, 151, 42, -1, -1, 45, -1, -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, 60, 61, 62, 63, -1, 65, 66, 1, 68, -1, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, -1, 64, -1, 66, 67, 1, 69, -1, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, -1, 64, -1, -1, 67, 1, 69, -1, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, -1, -1, 11, 12, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, -1, 64, 39, 40, 67, 1, 69, -1, 4, 5, 6, 7, 8, 9, 51, 52, 53, 54, 55, 56, 57, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, -1, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, 1, 64, -1, 4, 67, 6, 69, 8, 11, 12, -1, -1, -1, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, 39, 40, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, 51, 52, 53, 54, 55, 56, 57, 1, -1, -1, 4, -1, 6, -1, 8, 64, -1, -1, -1, 68, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 4, 5, 6, 7, 8, 9, -1, -1, -1, 42, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, 64, -1, -1, -1, 68, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, 62, -1, 64, -1, -1, 67, -1, 69, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, -1, 64, -1, 66, 67, -1, 69, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, -1, 64, -1, 66, 67, -1, 69, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, 15, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, -1, 64, -1, -1, 67, -1, 69, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, 23, 24, -1, -1, -1, 28, -1, -1, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, 1, 64, -1, 4, 67, 6, 69, 8, -1, -1, -1, -1, -1, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, 64, 10, 11, 12, 13, 14, -1, -1, 50, 51, 52, 53, 54, 55, 56, 57, -1, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, 10, 11, 12, 13, 14, -1, -1, -1, 50, 51, 52, 53, 54, 55, 56, 57, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, 10, 11, 12, 13, -1, -1, -1, -1, 50, 51, 52, 53, 54, 55, 56, 57, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, 10, 11, 12, -1, -1, -1, -1, -1, 50, 51, 52, 53, 54, 55, 56, 57, 26, 27, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 51, 52, 53, 54, 55, 56, 57 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { 0, 16, 71, 72, 4, 5, 6, 7, 8, 9, 15, 19, 23, 24, 28, 30, 31, 32, 42, 54, 60, 61, 64, 67, 69, 75, 76, 80, 83, 84, 87, 0, 17, 18, 73, 77, 78, 64, 59, 42, 4, 75, 76, 76, 76, 6, 1, 6, 87, 1, 4, 8, 84, 1, 66, 75, 1, 75, 1, 4, 6, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 64, 84, 96, 97, 98, 69, 48, 49, 62, 10, 11, 12, 13, 14, 26, 27, 33, 34, 35, 36, 37, 38, 39, 40, 50, 51, 52, 53, 54, 55, 56, 57, 75, 85, 5, 59, 60, 61, 79, 84, 79, 74, 75, 80, 73, 62, 75, 75, 88, 89, 63, 64, 20, 14, 14, 29, 48, 1, 59, 66, 66, 65, 65, 63, 68, 63, 63, 75, 63, 63, 68, 49, 69, 75, 75, 76, 76, 76, 76, 6, 61, 67, 90, 91, 92, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 43, 44, 46, 59, 61, 84, 1, 63, 66, 75, 14, 74, 62, 62, 65, 75, 4, 6, 81, 82, 1, 75, 91, 91, 1, 76, 75, 76, 99, 99, 99, 65, 99, 99, 1, 97, 6, 92, 93, 1, 4, 6, 64, 84, 94, 95, 96, 41, 48, 75, 66, 75, 59, 66, 75, 59, 63, 66, 4, 6, 89, 62, 62, 65, 21, 22, 25, 86, 64, 64, 48, 63, 49, 66, 63, 63, 63, 75, 63, 49, 68, 63, 92, 75, 45, 59, 66, 66, 66, 75, 59, 82, 63, 75, 75, 75, 75, 99, 99, 92, 92, 92, 92, 65, 92, 95, 92, 59, 59, 59, 66, 75, 25, 20, 62, 62, 63, 59, 62, 75, 75, 75, 92, 86, 65, 62, 65, 75, 65 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int8 yyr1[] = { 0, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, 78, 78, 78, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 85, 85, 85, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 95, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, 99 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ static const yytype_int8 yyr2[] = { 0, 2, 3, 3, 0, 3, 0, 2, 0, 2, 2, 5, 4, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 3, 4, 4, 2, 1, 5, 8, 1, 3, 1, 1, 2, 1, 3, 0, 2, 4, 5, 3, 1, 1, 1, 2, 2, 3, 2, 4, 3, 2, 1, 3, 2, 2, 3, 5, 4, 6, 5, 4, 3, 5, 4, 7, 6, 6, 6, 5, 5, 2, 1, 1, 1, 2, 3, 3, 2, 3, 9, 11, 9, 5, 4, 4, 4, 2, 4, 1, 1, 1, 4, 3, 3, 4, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 3, 1, 3, 1, 3, 1, 3, 3, 3, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 3, 3, 3, 3, 1, 3, 1, 1, 1, 1, 5, 3, 3, 1 }; enum { YYENOMEM = -2 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (&yylloc, answer, errors, locations, lexer_param_ptr, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Backward compatibility with an undocumented macro. Use YYerror or YYUNDEF. */ #define YYERRCODE YYUNDEF /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (0) #endif #define YYRHSLOC(Rhs, K) ((Rhs)[K]) /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* YYLOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ # ifndef YYLOCATION_PRINT # if defined YY_LOCATION_PRINT /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ # define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) # elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ YY_ATTRIBUTE_UNUSED static int yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) { int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; if (0 <= yylocp->first_line) { res += YYFPRINTF (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) res += YYFPRINTF (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { res += YYFPRINTF (yyo, "-%d", yylocp->last_line); if (0 <= end_col) res += YYFPRINTF (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) res += YYFPRINTF (yyo, "-%d", end_col); } return res; } # define YYLOCATION_PRINT yy_location_print_ /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ # define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) # else # define YYLOCATION_PRINT(File, Loc) ((void) 0) /* Temporary convenience wrapper in case some people defined the undocumented and private YY_LOCATION_PRINT macros. */ # define YY_LOCATION_PRINT YYLOCATION_PRINT # endif # endif /* !defined YYLOCATION_PRINT */ # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Kind, Value, Location, answer, errors, locations, lexer_param_ptr); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*-----------------------------------. | Print this symbol's value on YYO. | `-----------------------------------*/ static void yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr) { FILE *yyoutput = yyo; YY_USE (yyoutput); YY_USE (yylocationp); YY_USE (answer); YY_USE (errors); YY_USE (locations); YY_USE (lexer_param_ptr); if (!yyvaluep) return; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*---------------------------. | Print this symbol on YYO. | `---------------------------*/ static void yy_symbol_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr) { YYFPRINTF (yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); YYLOCATION_PRINT (yyo, yylocationp); YYFPRINTF (yyo, ": "); yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, answer, errors, locations, lexer_param_ptr); YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), &yyvsp[(yyi + 1) - (yynrhs)], &(yylsp[(yyi + 1) - (yynrhs)]), answer, errors, locations, lexer_param_ptr); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, yylsp, Rule, answer, errors, locations, lexer_param_ptr); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) ((void) 0) # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif /* Context of a parse error. */ typedef struct { yy_state_t *yyssp; yysymbol_kind_t yytoken; YYLTYPE *yylloc; } yypcontext_t; /* Put in YYARG at most YYARGN of the expected tokens given the current YYCTX, and return the number of tokens stored in YYARG. If YYARG is null, return the number of expected tokens (guaranteed to be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. Return 0 if there are more than YYARGN expected tokens, yet fill YYARG up to YYARGN. */ static int yypcontext_expected_tokens (const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn) { /* Actual size of YYARG. */ int yycount = 0; int yyn = yypact[+*yyctx->yyssp]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror && !yytable_value_is_error (yytable[yyx + yyn])) { if (!yyarg) ++yycount; else if (yycount == yyargn) return 0; else yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); } } if (yyarg && yycount == 0 && 0 < yyargn) yyarg[0] = YYSYMBOL_YYEMPTY; return yycount; } #ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ static YYPTRDIFF_T yystrlen (const char *yystr) { YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif #endif #ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif #endif #ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; else goto append; append: default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (yyres) return yystpcpy (yyres, yystr) - yyres; else return yystrlen (yystr); } #endif static int yy_syntax_error_arguments (const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn) { /* Actual size of YYARG. */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yyctx->yytoken != YYSYMBOL_YYEMPTY) { int yyn; if (yyarg) yyarg[yycount] = yyctx->yytoken; ++yycount; yyn = yypcontext_expected_tokens (yyctx, yyarg ? yyarg + 1 : yyarg, yyargn - 1); if (yyn == YYENOMEM) return YYENOMEM; else yycount += yyn; } return yycount; } /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the required number of bytes is too large to store. */ static int yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, const yypcontext_t *yyctx) { enum { YYARGS_MAX = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat: reported tokens (one for the "unexpected", one per "expected"). */ yysymbol_kind_t yyarg[YYARGS_MAX]; /* Cumulated lengths of YYARG. */ YYPTRDIFF_T yysize = 0; /* Actual size of YYARG. */ int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); if (yycount == YYENOMEM) return YYENOMEM; switch (yycount) { #define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); #undef YYCASE_ } /* Compute error message size. Don't count the "%s"s, but reserve room for the terminator. */ yysize = yystrlen (yyformat) - 2 * yycount + 1; { int yyi; for (yyi = 0; yyi < yycount; ++yyi) { YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return YYENOMEM; } } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return -1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); yyformat += 2; } else { ++yyp; ++yyformat; } } return 0; } /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr) { YY_USE (yyvaluep); YY_USE (yylocationp); YY_USE (answer); YY_USE (errors); YY_USE (locations); YY_USE (lexer_param_ptr); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN switch (yykind) { case YYSYMBOL_IDENT: /* IDENT */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2004 "src/parser.c" break; case YYSYMBOL_FIELD: /* FIELD */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2010 "src/parser.c" break; case YYSYMBOL_BINDING: /* BINDING */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2016 "src/parser.c" break; case YYSYMBOL_LITERAL: /* LITERAL */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2022 "src/parser.c" break; case YYSYMBOL_FORMAT: /* FORMAT */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2028 "src/parser.c" break; case YYSYMBOL_QQSTRING_TEXT: /* QQSTRING_TEXT */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2034 "src/parser.c" break; case YYSYMBOL_Module: /* Module */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2040 "src/parser.c" break; case YYSYMBOL_Imports: /* Imports */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2046 "src/parser.c" break; case YYSYMBOL_FuncDefs: /* FuncDefs */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2052 "src/parser.c" break; case YYSYMBOL_Query: /* Query */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2058 "src/parser.c" break; case YYSYMBOL_Expr: /* Expr */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2064 "src/parser.c" break; case YYSYMBOL_Import: /* Import */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2070 "src/parser.c" break; case YYSYMBOL_ImportWhat: /* ImportWhat */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2076 "src/parser.c" break; case YYSYMBOL_ImportFrom: /* ImportFrom */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2082 "src/parser.c" break; case YYSYMBOL_FuncDef: /* FuncDef */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2088 "src/parser.c" break; case YYSYMBOL_Params: /* Params */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2094 "src/parser.c" break; case YYSYMBOL_Param: /* Param */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2100 "src/parser.c" break; case YYSYMBOL_StringStart: /* StringStart */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2106 "src/parser.c" break; case YYSYMBOL_String: /* String */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2112 "src/parser.c" break; case YYSYMBOL_QQString: /* QQString */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2118 "src/parser.c" break; case YYSYMBOL_ElseBody: /* ElseBody */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2124 "src/parser.c" break; case YYSYMBOL_Term: /* Term */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2130 "src/parser.c" break; case YYSYMBOL_Args: /* Args */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2136 "src/parser.c" break; case YYSYMBOL_Arg: /* Arg */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2142 "src/parser.c" break; case YYSYMBOL_RepPatterns: /* RepPatterns */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2148 "src/parser.c" break; case YYSYMBOL_Patterns: /* Patterns */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2154 "src/parser.c" break; case YYSYMBOL_Pattern: /* Pattern */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2160 "src/parser.c" break; case YYSYMBOL_ArrayPats: /* ArrayPats */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2166 "src/parser.c" break; case YYSYMBOL_ObjPats: /* ObjPats */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2172 "src/parser.c" break; case YYSYMBOL_ObjPat: /* ObjPat */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2178 "src/parser.c" break; case YYSYMBOL_Keyword: /* Keyword */ #line 37 "src/parser.y" { jv_free(((*yyvaluep).literal)); } #line 2184 "src/parser.c" break; case YYSYMBOL_DictPairs: /* DictPairs */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2190 "src/parser.c" break; case YYSYMBOL_DictPair: /* DictPair */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2196 "src/parser.c" break; case YYSYMBOL_DictExpr: /* DictExpr */ #line 38 "src/parser.y" { block_free(((*yyvaluep).blk)); } #line 2202 "src/parser.c" break; default: break; } YY_IGNORE_MAYBE_UNINITIALIZED_END } /*----------. | yyparse. | `----------*/ int yyparse (block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr) { /* Lookahead token kind. */ int yychar; /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Location data for the lookahead symbol. */ static YYLTYPE yyloc_default # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL = { 1, 1, 1, 1 } # endif ; YYLTYPE yylloc = yyloc_default; /* Number of syntax errors so far. */ int yynerrs = 0; yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus = 0; /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* Their size. */ YYPTRDIFF_T yystacksize = YYINITDEPTH; /* The state stack: array, bottom, top. */ yy_state_t yyssa[YYINITDEPTH]; yy_state_t *yyss = yyssa; yy_state_t *yyssp = yyss; /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp = yyvs; /* The location stack: array, bottom, top. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp = yyls; int yyn; /* The return value of yyparse. */ int yyresult; /* Lookahead symbol kind. */ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[3]; /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ yylsp[0] = yylloc; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; /*--------------------------------------------------------------------. | yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ YYPTRDIFF_T yysize = yyssp - yyss + 1; # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF (*yyssp), &yyvs1, yysize * YYSIZEOF (*yyvsp), &yyls1, yysize * YYSIZEOF (*yylsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; yyls = yyls1; } # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yy_state_t *yyss1 = yyss; union yyalloc *yyptr = YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; YY_IGNORE_USELESS_CAST_BEGIN YYDPRINTF ((stderr, "Stack size increased to %ld\n", YY_CAST (long, yystacksize))); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (&yylval, &yylloc, answer, errors, locations, lexer_param_ptr); } if (yychar <= YYEOF) { yychar = YYEOF; yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else if (yychar == YYerror) { /* The scanner already issued an error message, process directly to error recovery. But do not keep the error token as lookahead, it is too special and may lead us to an endless loop in error recovery. */ yychar = YYUNDEF; yytoken = YYSYMBOL_YYerror; yyerror_range[1] = yylloc; goto yyerrlab1; } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END *++yylsp = yylloc; /* Discard the shifted token. */ yychar = YYEMPTY; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); yyerror_range[1] = yyloc; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: /* TopLevel: Module Imports Query */ #line 282 "src/parser.y" { *answer = BLOCK((yyvsp[-2].blk), (yyvsp[-1].blk), gen_op_simple(TOP), (yyvsp[0].blk)); } #line 2510 "src/parser.c" break; case 3: /* TopLevel: Module Imports FuncDefs */ #line 285 "src/parser.y" { *answer = BLOCK((yyvsp[-2].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } #line 2518 "src/parser.c" break; case 4: /* Module: %empty */ #line 290 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 2526 "src/parser.c" break; case 5: /* Module: "module" Query ';' */ #line 293 "src/parser.y" { if (!block_is_const((yyvsp[-1].blk))) { FAIL((yylsp[-1]), "Module metadata must be constant"); (yyval.blk) = gen_noop(); block_free((yyvsp[-1].blk)); } else if (block_const_kind((yyvsp[-1].blk)) != JV_KIND_OBJECT) { FAIL((yylsp[-1]), "Module metadata must be an object"); (yyval.blk) = gen_noop(); block_free((yyvsp[-1].blk)); } else { (yyval.blk) = gen_module((yyvsp[-1].blk)); } } #line 2544 "src/parser.c" break; case 6: /* Imports: %empty */ #line 308 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 2552 "src/parser.c" break; case 7: /* Imports: Import Imports */ #line 311 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), (yyvsp[0].blk)); } #line 2560 "src/parser.c" break; case 8: /* FuncDefs: %empty */ #line 316 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 2568 "src/parser.c" break; case 9: /* FuncDefs: FuncDef FuncDefs */ #line 319 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-1].blk), (yyvsp[0].blk)); } #line 2576 "src/parser.c" break; case 10: /* Query: FuncDef Query */ #line 325 "src/parser.y" { (yyval.blk) = block_bind_referenced((yyvsp[-1].blk), (yyvsp[0].blk), OP_IS_CALL_PSEUDO); } #line 2584 "src/parser.c" break; case 11: /* Query: Expr "as" Patterns '|' Query */ #line 328 "src/parser.y" { (yyval.blk) = gen_destructure((yyvsp[-4].blk), (yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2592 "src/parser.c" break; case 12: /* Query: "label" BINDING '|' Query */ #line 331 "src/parser.y" { jv v = jv_string_fmt("*label-%s", jv_string_value((yyvsp[-2].literal))); (yyval.blk) = gen_location((yyloc), locations, gen_label(jv_string_value(v), (yyvsp[0].blk))); jv_free((yyvsp[-2].literal)); jv_free(v); } #line 2603 "src/parser.c" break; case 13: /* Query: Query '|' Query */ #line 337 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2611 "src/parser.c" break; case 14: /* Query: Query ',' Query */ #line 340 "src/parser.y" { (yyval.blk) = gen_both((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2619 "src/parser.c" break; case 15: /* Query: Expr */ #line 343 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 2627 "src/parser.c" break; case 16: /* Expr: Expr "//" Expr */ #line 349 "src/parser.y" { (yyval.blk) = gen_definedor((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2635 "src/parser.c" break; case 17: /* Expr: Expr '=' Expr */ #line 352 "src/parser.y" { (yyval.blk) = gen_call("_assign", BLOCK(gen_lambda((yyvsp[-2].blk)), gen_lambda((yyvsp[0].blk)))); } #line 2643 "src/parser.c" break; case 18: /* Expr: Expr "or" Expr */ #line 355 "src/parser.y" { (yyval.blk) = gen_or((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2651 "src/parser.c" break; case 19: /* Expr: Expr "and" Expr */ #line 358 "src/parser.y" { (yyval.blk) = gen_and((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2659 "src/parser.c" break; case 20: /* Expr: Expr "//=" Expr */ #line 361 "src/parser.y" { (yyval.blk) = gen_definedor_assign((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2667 "src/parser.c" break; case 21: /* Expr: Expr "|=" Expr */ #line 364 "src/parser.y" { (yyval.blk) = gen_call("_modify", BLOCK(gen_lambda((yyvsp[-2].blk)), gen_lambda((yyvsp[0].blk)))); } #line 2675 "src/parser.c" break; case 22: /* Expr: Expr '+' Expr */ #line 367 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '+'); } #line 2683 "src/parser.c" break; case 23: /* Expr: Expr "+=" Expr */ #line 370 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '+'); } #line 2691 "src/parser.c" break; case 24: /* Expr: Expr '-' Expr */ #line 373 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '-'); } #line 2699 "src/parser.c" break; case 25: /* Expr: Expr "-=" Expr */ #line 376 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '-'); } #line 2707 "src/parser.c" break; case 26: /* Expr: Expr '*' Expr */ #line 379 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '*'); } #line 2715 "src/parser.c" break; case 27: /* Expr: Expr "*=" Expr */ #line 382 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '*'); } #line 2723 "src/parser.c" break; case 28: /* Expr: Expr '/' Expr */ #line 385 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '/'); } #line 2731 "src/parser.c" break; case 29: /* Expr: Expr '%' Expr */ #line 388 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '%'); } #line 2739 "src/parser.c" break; case 30: /* Expr: Expr "/=" Expr */ #line 391 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '/'); } #line 2747 "src/parser.c" break; case 31: /* Expr: Expr "%=" Expr */ #line 394 "src/parser.y" { (yyval.blk) = gen_update((yyvsp[-2].blk), (yyvsp[0].blk), '%'); } #line 2755 "src/parser.c" break; case 32: /* Expr: Expr "==" Expr */ #line 397 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), EQ); } #line 2763 "src/parser.c" break; case 33: /* Expr: Expr "!=" Expr */ #line 400 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), NEQ); } #line 2771 "src/parser.c" break; case 34: /* Expr: Expr '<' Expr */ #line 403 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '<'); } #line 2779 "src/parser.c" break; case 35: /* Expr: Expr '>' Expr */ #line 406 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), '>'); } #line 2787 "src/parser.c" break; case 36: /* Expr: Expr "<=" Expr */ #line 409 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), LESSEQ); } #line 2795 "src/parser.c" break; case 37: /* Expr: Expr ">=" Expr */ #line 412 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-2].blk), (yyvsp[0].blk), GREATEREQ); } #line 2803 "src/parser.c" break; case 38: /* Expr: Term */ #line 415 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 2811 "src/parser.c" break; case 39: /* Import: ImportWhat ';' */ #line 421 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } #line 2819 "src/parser.c" break; case 40: /* Import: ImportWhat Query ';' */ #line 424 "src/parser.y" { if (!block_is_const((yyvsp[-1].blk))) { FAIL((yylsp[-1]), "Module metadata must be constant"); (yyval.blk) = gen_noop(); block_free((yyvsp[-2].blk)); block_free((yyvsp[-1].blk)); } else if (block_const_kind((yyvsp[-1].blk)) != JV_KIND_OBJECT) { FAIL((yylsp[-1]), "Module metadata must be an object"); (yyval.blk) = gen_noop(); block_free((yyvsp[-2].blk)); block_free((yyvsp[-1].blk)); } else { (yyval.blk) = gen_import_meta((yyvsp[-2].blk), (yyvsp[-1].blk)); } } #line 2839 "src/parser.c" break; case 41: /* ImportWhat: "import" ImportFrom "as" BINDING */ #line 441 "src/parser.y" { (yyval.blk) = gen_import(block_const((yyvsp[-2].blk)), (yyvsp[0].literal), 1); block_free((yyvsp[-2].blk)); } #line 2848 "src/parser.c" break; case 42: /* ImportWhat: "import" ImportFrom "as" IDENT */ #line 445 "src/parser.y" { (yyval.blk) = gen_import(block_const((yyvsp[-2].blk)), (yyvsp[0].literal), 0); block_free((yyvsp[-2].blk)); } #line 2857 "src/parser.c" break; case 43: /* ImportWhat: "include" ImportFrom */ #line 449 "src/parser.y" { (yyval.blk) = gen_import(block_const((yyvsp[0].blk)), jv_invalid(), 0); block_free((yyvsp[0].blk)); } #line 2866 "src/parser.c" break; case 44: /* ImportFrom: String */ #line 455 "src/parser.y" { if (!block_is_const((yyvsp[0].blk))) { FAIL((yylsp[0]), "Import path must be constant"); (yyval.blk) = gen_const(jv_string("")); block_free((yyvsp[0].blk)); } else { (yyval.blk) = (yyvsp[0].blk); } } #line 2880 "src/parser.c" break; case 45: /* FuncDef: "def" IDENT ':' Query ';' */ #line 466 "src/parser.y" { (yyval.blk) = gen_function(jv_string_value((yyvsp[-3].literal)), gen_noop(), (yyvsp[-1].blk)); jv_free((yyvsp[-3].literal)); } #line 2889 "src/parser.c" break; case 46: /* FuncDef: "def" IDENT '(' Params ')' ':' Query ';' */ #line 471 "src/parser.y" { (yyval.blk) = gen_function(jv_string_value((yyvsp[-6].literal)), (yyvsp[-4].blk), (yyvsp[-1].blk)); jv_free((yyvsp[-6].literal)); } #line 2898 "src/parser.c" break; case 47: /* Params: Param */ #line 477 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 2906 "src/parser.c" break; case 48: /* Params: Params ';' Param */ #line 480 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2914 "src/parser.c" break; case 49: /* Param: BINDING */ #line 485 "src/parser.y" { (yyval.blk) = gen_param_regular(jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } #line 2923 "src/parser.c" break; case 50: /* Param: IDENT */ #line 489 "src/parser.y" { (yyval.blk) = gen_param(jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } #line 2932 "src/parser.c" break; case 51: /* StringStart: FORMAT QQSTRING_START */ #line 496 "src/parser.y" { (yyval.literal) = (yyvsp[-1].literal); } #line 2940 "src/parser.c" break; case 52: /* StringStart: QQSTRING_START */ #line 499 "src/parser.y" { (yyval.literal) = jv_string("text"); } #line 2948 "src/parser.c" break; case 53: /* String: StringStart QQString QQSTRING_END */ #line 505 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); jv_free((yyvsp[-2].literal)); } #line 2957 "src/parser.c" break; case 54: /* QQString: %empty */ #line 512 "src/parser.y" { (yyval.blk) = gen_const(jv_string("")); } #line 2965 "src/parser.c" break; case 55: /* QQString: QQString QQSTRING_TEXT */ #line 515 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-1].blk), gen_const((yyvsp[0].literal)), '+'); } #line 2973 "src/parser.c" break; case 56: /* QQString: QQString QQSTRING_INTERP_START Query QQSTRING_INTERP_END */ #line 518 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-3].blk), gen_format((yyvsp[-1].blk), jv_copy((yyvsp[-4].literal))), '+'); } #line 2981 "src/parser.c" break; case 57: /* ElseBody: "elif" Query "then" Query ElseBody */ #line 524 "src/parser.y" { (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } #line 2989 "src/parser.c" break; case 58: /* ElseBody: "else" Query "end" */ #line 527 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } #line 2997 "src/parser.c" break; case 59: /* ElseBody: "end" */ #line 530 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3005 "src/parser.c" break; case 60: /* Term: '.' */ #line 536 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3013 "src/parser.c" break; case 61: /* Term: ".." */ #line 539 "src/parser.y" { (yyval.blk) = gen_call("recurse", gen_noop()); } #line 3021 "src/parser.c" break; case 62: /* Term: "break" BINDING */ #line 542 "src/parser.y" { jv v = jv_string_fmt("*label-%s", jv_string_value((yyvsp[0].literal))); // impossible symbol (yyval.blk) = gen_location((yyloc), locations, BLOCK(gen_op_unbound(LOADV, jv_string_value(v)), gen_call("error", gen_noop()))); jv_free(v); jv_free((yyvsp[0].literal)); } #line 3034 "src/parser.c" break; case 63: /* Term: "break" error */ #line 550 "src/parser.y" { FAIL((yyloc), "break requires a label to break to"); (yyval.blk) = gen_noop(); } #line 3043 "src/parser.c" break; case 64: /* Term: Term FIELD '?' */ #line 554 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-2].blk), gen_const((yyvsp[-1].literal))); } #line 3051 "src/parser.c" break; case 65: /* Term: FIELD '?' */ #line 557 "src/parser.y" { (yyval.blk) = gen_index_opt(gen_noop(), gen_const((yyvsp[-1].literal))); } #line 3059 "src/parser.c" break; case 66: /* Term: Term '.' String '?' */ #line 560 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3067 "src/parser.c" break; case 67: /* Term: '.' String '?' */ #line 563 "src/parser.y" { (yyval.blk) = gen_index_opt(gen_noop(), (yyvsp[-1].blk)); } #line 3075 "src/parser.c" break; case 68: /* Term: Term FIELD */ #line 566 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-1].blk), gen_const((yyvsp[0].literal))); } #line 3083 "src/parser.c" break; case 69: /* Term: FIELD */ #line 569 "src/parser.y" { (yyval.blk) = gen_index(gen_noop(), gen_const((yyvsp[0].literal))); } #line 3091 "src/parser.c" break; case 70: /* Term: Term '.' String */ #line 572 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3099 "src/parser.c" break; case 71: /* Term: '.' String */ #line 575 "src/parser.y" { (yyval.blk) = gen_index(gen_noop(), (yyvsp[0].blk)); } #line 3107 "src/parser.c" break; case 72: /* Term: '.' error */ #line 578 "src/parser.y" { FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields"); (yyval.blk) = gen_noop(); } #line 3116 "src/parser.c" break; case 73: /* Term: '.' IDENT error */ #line 582 "src/parser.y" { jv_free((yyvsp[-1].literal)); FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields"); (yyval.blk) = gen_noop(); } #line 3126 "src/parser.c" break; case 74: /* Term: Term '[' Query ']' '?' */ #line 588 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-4].blk), (yyvsp[-2].blk)); } #line 3134 "src/parser.c" break; case 75: /* Term: Term '[' Query ']' */ #line 591 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3142 "src/parser.c" break; case 76: /* Term: Term '.' '[' Query ']' '?' */ #line 594 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-5].blk), (yyvsp[-2].blk)); } #line 3150 "src/parser.c" break; case 77: /* Term: Term '.' '[' Query ']' */ #line 597 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-4].blk), (yyvsp[-1].blk)); } #line 3158 "src/parser.c" break; case 78: /* Term: Term '[' ']' '?' */ #line 600 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH_OPT)); } #line 3166 "src/parser.c" break; case 79: /* Term: Term '[' ']' */ #line 603 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), gen_op_simple(EACH)); } #line 3174 "src/parser.c" break; case 80: /* Term: Term '.' '[' ']' '?' */ #line 606 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-4].blk), gen_op_simple(EACH_OPT)); } #line 3182 "src/parser.c" break; case 81: /* Term: Term '.' '[' ']' */ #line 609 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH)); } #line 3190 "src/parser.c" break; case 82: /* Term: Term '[' Query ':' Query ']' '?' */ #line 612 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-6].blk), (yyvsp[-4].blk), (yyvsp[-2].blk), INDEX_OPT); } #line 3198 "src/parser.c" break; case 83: /* Term: Term '[' Query ':' ']' '?' */ #line 615 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), gen_const(jv_null()), INDEX_OPT); } #line 3206 "src/parser.c" break; case 84: /* Term: Term '[' ':' Query ']' '?' */ #line 618 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), gen_const(jv_null()), (yyvsp[-2].blk), INDEX_OPT); } #line 3214 "src/parser.c" break; case 85: /* Term: Term '[' Query ':' Query ']' */ #line 621 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), INDEX); } #line 3222 "src/parser.c" break; case 86: /* Term: Term '[' Query ':' ']' */ #line 624 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-4].blk), (yyvsp[-2].blk), gen_const(jv_null()), INDEX); } #line 3230 "src/parser.c" break; case 87: /* Term: Term '[' ':' Query ']' */ #line 627 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-4].blk), gen_const(jv_null()), (yyvsp[-1].blk), INDEX); } #line 3238 "src/parser.c" break; case 88: /* Term: Term '?' */ #line 630 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[-1].blk), gen_op_simple(BACKTRACK)); } #line 3246 "src/parser.c" break; case 89: /* Term: LITERAL */ #line 633 "src/parser.y" { (yyval.blk) = gen_const((yyvsp[0].literal)); } #line 3254 "src/parser.c" break; case 90: /* Term: String */ #line 636 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3262 "src/parser.c" break; case 91: /* Term: FORMAT */ #line 639 "src/parser.y" { (yyval.blk) = gen_format(gen_noop(), (yyvsp[0].literal)); } #line 3270 "src/parser.c" break; case 92: /* Term: '-' Term */ #line 642 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[0].blk), gen_call("_negate", gen_noop())); } #line 3278 "src/parser.c" break; case 93: /* Term: '(' Query ')' */ #line 645 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } #line 3286 "src/parser.c" break; case 94: /* Term: '[' Query ']' */ #line 648 "src/parser.y" { (yyval.blk) = gen_collect((yyvsp[-1].blk)); } #line 3294 "src/parser.c" break; case 95: /* Term: '[' ']' */ #line 651 "src/parser.y" { (yyval.blk) = gen_const(jv_array()); } #line 3302 "src/parser.c" break; case 96: /* Term: '{' DictPairs '}' */ #line 654 "src/parser.y" { block o = gen_const_object((yyvsp[-1].blk)); if (o.first != NULL) (yyval.blk) = o; else (yyval.blk) = BLOCK(gen_subexp(gen_const(jv_object())), (yyvsp[-1].blk), gen_op_simple(POP)); } #line 3314 "src/parser.c" break; case 97: /* Term: "reduce" Expr "as" Patterns '(' Query ';' Query ')' */ #line 661 "src/parser.y" { (yyval.blk) = gen_reduce((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3322 "src/parser.c" break; case 98: /* Term: "foreach" Expr "as" Patterns '(' Query ';' Query ';' Query ')' */ #line 664 "src/parser.y" { (yyval.blk) = gen_foreach((yyvsp[-9].blk), (yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3330 "src/parser.c" break; case 99: /* Term: "foreach" Expr "as" Patterns '(' Query ';' Query ')' */ #line 667 "src/parser.y" { (yyval.blk) = gen_foreach((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), gen_noop()); } #line 3338 "src/parser.c" break; case 100: /* Term: "if" Query "then" Query ElseBody */ #line 670 "src/parser.y" { (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } #line 3346 "src/parser.c" break; case 101: /* Term: "if" Query "then" error */ #line 673 "src/parser.y" { FAIL((yyloc), "Possibly unterminated 'if' statement"); (yyval.blk) = (yyvsp[-2].blk); } #line 3355 "src/parser.c" break; case 102: /* Term: "try" Expr "catch" Expr */ #line 677 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3363 "src/parser.c" break; case 103: /* Term: "try" Expr "catch" error */ #line 680 "src/parser.y" { FAIL((yyloc), "Possibly unterminated 'try' statement"); (yyval.blk) = (yyvsp[-2].blk); } #line 3372 "src/parser.c" break; case 104: /* Term: "try" Expr */ #line 684 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[0].blk), gen_op_simple(BACKTRACK)); } #line 3380 "src/parser.c" break; case 105: /* Term: '$' '$' '$' BINDING */ #line 702 "src/parser.y" { (yyval.blk) = gen_location((yyloc), locations, gen_op_unbound(LOADVN, jv_string_value((yyvsp[0].literal)))); jv_free((yyvsp[0].literal)); } #line 3389 "src/parser.c" break; case 106: /* Term: BINDING */ #line 706 "src/parser.y" { (yyval.blk) = gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[0].literal)))); jv_free((yyvsp[0].literal)); } #line 3398 "src/parser.c" break; case 107: /* Term: "$__loc__" */ #line 710 "src/parser.y" { (yyval.blk) = gen_loc_object(&(yyloc), locations); } #line 3406 "src/parser.c" break; case 108: /* Term: IDENT */ #line 713 "src/parser.y" { const char *s = jv_string_value((yyvsp[0].literal)); if (strcmp(s, "false") == 0) (yyval.blk) = gen_const(jv_false()); else if (strcmp(s, "true") == 0) (yyval.blk) = gen_const(jv_true()); else if (strcmp(s, "null") == 0) (yyval.blk) = gen_const(jv_null()); else (yyval.blk) = gen_location((yyloc), locations, gen_call(s, gen_noop())); jv_free((yyvsp[0].literal)); } #line 3423 "src/parser.c" break; case 109: /* Term: IDENT '(' Args ')' */ #line 725 "src/parser.y" { (yyval.blk) = gen_call(jv_string_value((yyvsp[-3].literal)), (yyvsp[-1].blk)); (yyval.blk) = gen_location((yylsp[-3]), locations, (yyval.blk)); jv_free((yyvsp[-3].literal)); } #line 3433 "src/parser.c" break; case 110: /* Term: '(' error ')' */ #line 730 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3439 "src/parser.c" break; case 111: /* Term: '[' error ']' */ #line 731 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3445 "src/parser.c" break; case 112: /* Term: Term '[' error ']' */ #line 732 "src/parser.y" { (yyval.blk) = (yyvsp[-3].blk); } #line 3451 "src/parser.c" break; case 113: /* Term: '{' error '}' */ #line 733 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3457 "src/parser.c" break; case 114: /* Args: Arg */ #line 736 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3465 "src/parser.c" break; case 115: /* Args: Args ';' Arg */ #line 739 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3473 "src/parser.c" break; case 116: /* Arg: Query */ #line 744 "src/parser.y" { (yyval.blk) = gen_lambda((yyvsp[0].blk)); } #line 3481 "src/parser.c" break; case 117: /* RepPatterns: RepPatterns "?//" Pattern */ #line 749 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), gen_destructure_alt((yyvsp[0].blk))); } #line 3489 "src/parser.c" break; case 118: /* RepPatterns: Pattern */ #line 752 "src/parser.y" { (yyval.blk) = gen_destructure_alt((yyvsp[0].blk)); } #line 3497 "src/parser.c" break; case 119: /* Patterns: RepPatterns "?//" Pattern */ #line 757 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3505 "src/parser.c" break; case 120: /* Patterns: Pattern */ #line 760 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3513 "src/parser.c" break; case 121: /* Pattern: BINDING */ #line 765 "src/parser.y" { (yyval.blk) = gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } #line 3522 "src/parser.c" break; case 122: /* Pattern: '[' ArrayPats ']' */ #line 769 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP)); } #line 3530 "src/parser.c" break; case 123: /* Pattern: '{' ObjPats '}' */ #line 772 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP)); } #line 3538 "src/parser.c" break; case 124: /* ArrayPats: Pattern */ #line 777 "src/parser.y" { (yyval.blk) = gen_array_matcher(gen_noop(), (yyvsp[0].blk)); } #line 3546 "src/parser.c" break; case 125: /* ArrayPats: ArrayPats ',' Pattern */ #line 780 "src/parser.y" { (yyval.blk) = gen_array_matcher((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3554 "src/parser.c" break; case 126: /* ObjPats: ObjPat */ #line 785 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3562 "src/parser.c" break; case 127: /* ObjPats: ObjPats ',' ObjPat */ #line 788 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3570 "src/parser.c" break; case 128: /* ObjPat: BINDING */ #line 793 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[0].literal)), gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal)))); } #line 3578 "src/parser.c" break; case 129: /* ObjPat: BINDING ':' Pattern */ #line 796 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), BLOCK(gen_op_simple(DUP), gen_op_unbound(STOREV, jv_string_value((yyvsp[-2].literal))), (yyvsp[0].blk))); } #line 3586 "src/parser.c" break; case 130: /* ObjPat: IDENT ':' Pattern */ #line 799 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3594 "src/parser.c" break; case 131: /* ObjPat: Keyword ':' Pattern */ #line 802 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3602 "src/parser.c" break; case 132: /* ObjPat: String ':' Pattern */ #line 805 "src/parser.y" { (yyval.blk) = gen_object_matcher((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3610 "src/parser.c" break; case 133: /* ObjPat: '(' Query ')' ':' Pattern */ #line 808 "src/parser.y" { jv msg = check_object_key((yyvsp[-3].blk)); if (jv_is_valid(msg)) { FAIL((yylsp[-3]), jv_string_value(msg)); } jv_free(msg); (yyval.blk) = gen_object_matcher((yyvsp[-3].blk), (yyvsp[0].blk)); } #line 3623 "src/parser.c" break; case 134: /* ObjPat: error ':' Pattern */ #line 816 "src/parser.y" { FAIL((yyloc), "May need parentheses around object key expression"); (yyval.blk) = (yyvsp[0].blk); } #line 3632 "src/parser.c" break; case 135: /* Keyword: "as" */ #line 822 "src/parser.y" { (yyval.literal) = jv_string("as"); } #line 3640 "src/parser.c" break; case 136: /* Keyword: "def" */ #line 825 "src/parser.y" { (yyval.literal) = jv_string("def"); } #line 3648 "src/parser.c" break; case 137: /* Keyword: "module" */ #line 828 "src/parser.y" { (yyval.literal) = jv_string("module"); } #line 3656 "src/parser.c" break; case 138: /* Keyword: "import" */ #line 831 "src/parser.y" { (yyval.literal) = jv_string("import"); } #line 3664 "src/parser.c" break; case 139: /* Keyword: "include" */ #line 834 "src/parser.y" { (yyval.literal) = jv_string("include"); } #line 3672 "src/parser.c" break; case 140: /* Keyword: "if" */ #line 837 "src/parser.y" { (yyval.literal) = jv_string("if"); } #line 3680 "src/parser.c" break; case 141: /* Keyword: "then" */ #line 840 "src/parser.y" { (yyval.literal) = jv_string("then"); } #line 3688 "src/parser.c" break; case 142: /* Keyword: "else" */ #line 843 "src/parser.y" { (yyval.literal) = jv_string("else"); } #line 3696 "src/parser.c" break; case 143: /* Keyword: "elif" */ #line 846 "src/parser.y" { (yyval.literal) = jv_string("elif"); } #line 3704 "src/parser.c" break; case 144: /* Keyword: "reduce" */ #line 849 "src/parser.y" { (yyval.literal) = jv_string("reduce"); } #line 3712 "src/parser.c" break; case 145: /* Keyword: "foreach" */ #line 852 "src/parser.y" { (yyval.literal) = jv_string("foreach"); } #line 3720 "src/parser.c" break; case 146: /* Keyword: "end" */ #line 855 "src/parser.y" { (yyval.literal) = jv_string("end"); } #line 3728 "src/parser.c" break; case 147: /* Keyword: "and" */ #line 858 "src/parser.y" { (yyval.literal) = jv_string("and"); } #line 3736 "src/parser.c" break; case 148: /* Keyword: "or" */ #line 861 "src/parser.y" { (yyval.literal) = jv_string("or"); } #line 3744 "src/parser.c" break; case 149: /* Keyword: "try" */ #line 864 "src/parser.y" { (yyval.literal) = jv_string("try"); } #line 3752 "src/parser.c" break; case 150: /* Keyword: "catch" */ #line 867 "src/parser.y" { (yyval.literal) = jv_string("catch"); } #line 3760 "src/parser.c" break; case 151: /* Keyword: "label" */ #line 870 "src/parser.y" { (yyval.literal) = jv_string("label"); } #line 3768 "src/parser.c" break; case 152: /* Keyword: "break" */ #line 873 "src/parser.y" { (yyval.literal) = jv_string("break"); } #line 3776 "src/parser.c" break; case 153: /* DictPairs: %empty */ #line 879 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3784 "src/parser.c" break; case 154: /* DictPairs: DictPair */ #line 882 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3792 "src/parser.c" break; case 155: /* DictPairs: DictPair ',' DictPairs */ #line 885 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3800 "src/parser.c" break; case 156: /* DictPair: IDENT ':' DictExpr */ #line 890 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3808 "src/parser.c" break; case 157: /* DictPair: Keyword ':' DictExpr */ #line 893 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3816 "src/parser.c" break; case 158: /* DictPair: String ':' DictExpr */ #line 896 "src/parser.y" { (yyval.blk) = gen_dictpair((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3824 "src/parser.c" break; case 159: /* DictPair: String */ #line 899 "src/parser.y" { (yyval.blk) = gen_dictpair((yyvsp[0].blk), BLOCK(gen_op_simple(POP), gen_op_simple(DUP2), gen_op_simple(DUP2), gen_op_simple(INDEX))); } #line 3833 "src/parser.c" break; case 160: /* DictPair: BINDING ':' DictExpr */ #line 903 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[-2].literal)))), (yyvsp[0].blk)); jv_free((yyvsp[-2].literal)); } #line 3843 "src/parser.c" break; case 161: /* DictPair: BINDING */ #line 908 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[0].literal)), gen_location((yyloc), locations, gen_op_unbound(LOADV, jv_string_value((yyvsp[0].literal))))); } #line 3852 "src/parser.c" break; case 162: /* DictPair: IDENT */ #line 912 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))), gen_index(gen_noop(), gen_const((yyvsp[0].literal)))); } #line 3861 "src/parser.c" break; case 163: /* DictPair: "$__loc__" */ #line 916 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_string("__loc__")), gen_loc_object(&(yyloc), locations)); } #line 3870 "src/parser.c" break; case 164: /* DictPair: Keyword */ #line 920 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))), gen_index(gen_noop(), gen_const((yyvsp[0].literal)))); } #line 3879 "src/parser.c" break; case 165: /* DictPair: '(' Query ')' ':' DictExpr */ #line 924 "src/parser.y" { jv msg = check_object_key((yyvsp[-3].blk)); if (jv_is_valid(msg)) { FAIL((yylsp[-3]), jv_string_value(msg)); } jv_free(msg); (yyval.blk) = gen_dictpair((yyvsp[-3].blk), (yyvsp[0].blk)); } #line 3892 "src/parser.c" break; case 166: /* DictPair: error ':' DictExpr */ #line 932 "src/parser.y" { FAIL((yylsp[-2]), "May need parentheses around object key expression"); (yyval.blk) = (yyvsp[0].blk); } #line 3901 "src/parser.c" break; case 167: /* DictExpr: DictExpr '|' DictExpr */ #line 938 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3909 "src/parser.c" break; case 168: /* DictExpr: Expr */ #line 941 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3917 "src/parser.c" break; #line 3921 "src/parser.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; *++yyvsp = yyval; *++yylsp = yyloc; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ { const int yylhs = yyr1[yyn] - YYNTOKENS; const int yyi = yypgoto[yylhs] + *yyssp; yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp ? yytable[yyi] : yydefgoto[yylhs]); } goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; { yypcontext_t yyctx = {yyssp, yytoken, &yylloc}; char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == -1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (yymsg) { yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); yymsgp = yymsg; } else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = YYENOMEM; } } yyerror (&yylloc, answer, errors, locations, lexer_param_ptr, yymsgp); if (yysyntax_error_status == YYENOMEM) YYNOMEM; } } yyerror_range[1] = yylloc; if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, &yylloc, answer, errors, locations, lexer_param_ptr); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYSYMBOL_YYerror; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yyerror_range[1] = *yylsp; yydestruct ("Error: popping", YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, answer, errors, locations, lexer_param_ptr); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END yyerror_range[2] = yylloc; ++yylsp; YYLLOC_DEFAULT (*yylsp, yyerror_range, 2); /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturnlab; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturnlab; /*-----------------------------------------------------------. | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | `-----------------------------------------------------------*/ yyexhaustedlab: yyerror (&yylloc, answer, errors, locations, lexer_param_ptr, YY_("memory exhausted")); yyresult = 2; goto yyreturnlab; /*----------------------------------------------------------. | yyreturnlab -- parsing is finished, clean up and return. | `----------------------------------------------------------*/ yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, answer, errors, locations, lexer_param_ptr); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, answer, errors, locations, lexer_param_ptr); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); return yyresult; } #line 944 "src/parser.y" int jq_parse(struct locfile* locations, block* answer) { struct lexer_param scanner; YY_BUFFER_STATE buf; jq_yylex_init_extra(0, &scanner.lexer); buf = jq_yy_scan_bytes(locations->data, locations->length, scanner.lexer); int errors = 0; *answer = gen_noop(); yyparse(answer, &errors, locations, &scanner); jq_yy_delete_buffer(buf, scanner.lexer); jq_yylex_destroy(scanner.lexer); if (errors > 0) { block_free(*answer); *answer = gen_noop(); } return errors; } int jq_parse_library(struct locfile* locations, block* answer) { int errs = jq_parse(locations, answer); if (errs) return errs; if (block_has_main(*answer)) { locfile_locate(locations, UNKNOWN_LOCATION, "jq: error: library should only have function definitions, not a main expression"); return 1; } assert(block_has_only_binders_and_imports(*answer, OP_IS_CALL_PSEUDO)); return 0; } jq-1.8.2/src/parser.y0000644000175100017510000005355615215513536010120 %{ #include #include #include #include #include "compile.h" #include "jv_alloc.h" #include "builtin.h" #define YYMALLOC jv_mem_alloc #define YYFREE jv_mem_free %} %code requires { #include "locfile.h" struct lexer_param; #define YYLTYPE location #define YYLLOC_DEFAULT(Loc, Rhs, N) \ do { \ if (N) { \ (Loc).start = YYRHSLOC(Rhs, 1).start; \ (Loc).end = YYRHSLOC(Rhs, N).end; \ } else { \ (Loc).start = YYRHSLOC(Rhs, 0).end; \ (Loc).end = YYRHSLOC(Rhs, 0).end; \ } \ } while (0) } %locations %define parse.error verbose %define api.pure %union { jv literal; block blk; } %destructor { jv_free($$); } %destructor { block_free($$); } %parse-param {block* answer} %parse-param {int* errors} %parse-param {struct locfile* locations} %parse-param {struct lexer_param* lexer_param_ptr} %lex-param {block* answer} %lex-param {int* errors} %lex-param {struct locfile* locations} %lex-param {struct lexer_param* lexer_param_ptr} %token INVALID_CHARACTER %token IDENT %token FIELD %token BINDING %token LITERAL %token FORMAT %token REC ".." %token SETMOD "%=" %token EQ "==" %token NEQ "!=" %token DEFINEDOR "//" %token AS "as" %token DEF "def" %token MODULE "module" %token IMPORT "import" %token INCLUDE "include" %token IF "if" %token THEN "then" %token ELSE "else" %token ELSE_IF "elif" %token REDUCE "reduce" %token FOREACH "foreach" %token END "end" %token AND "and" %token OR "or" %token TRY "try" %token CATCH "catch" %token LABEL "label" %token BREAK "break" %token LOC "$__loc__" %token SETPIPE "|=" %token SETPLUS "+=" %token SETMINUS "-=" %token SETMULT "*=" %token SETDIV "/=" %token SETDEFINEDOR "//=" %token LESSEQ "<=" %token GREATEREQ ">=" %token ALTERNATION "?//" %token QQSTRING_START %token QQSTRING_TEXT %token QQSTRING_INTERP_START %token QQSTRING_INTERP_END %token QQSTRING_END /* Instead of raising this, find a way to use precedence to resolve * shift-reduce conflicts. */ %expect 0 %precedence FUNCDEF %right '|' %left ',' %right "//" %nonassoc '=' SETPIPE SETPLUS SETMINUS SETMULT SETDIV SETMOD SETDEFINEDOR %left OR %left AND %nonassoc NEQ EQ '<' '>' LESSEQ GREATEREQ %left '+' '-' %left '*' '/' '%' %precedence NONOPT /* non-optional; rules for which a specialized '?' rule should be preferred over Expr '?' */ %precedence '?' '.' '[' FIELD %precedence "try" %precedence "catch" %type Query Expr Term %type DictPairs DictPair DictExpr %type ElseBody %type String QQString %type FuncDef FuncDefs %type Module Import Imports ImportWhat ImportFrom %type Param Params Arg Args %type Patterns RepPatterns Pattern ArrayPats ObjPats ObjPat %type Keyword %type StringStart %{ #include "lexer.h" struct lexer_param { yyscan_t lexer; }; #define FAIL(loc, msg) \ do { \ location l = loc; \ yyerror(&l, answer, errors, locations, lexer_param_ptr, msg); \ /*YYERROR*/; \ } while (0) void yyerror(YYLTYPE* loc, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr, const char *s){ (*errors)++; locfile_locate(locations, *loc, "jq: error: %s", s); } int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr) { yyscan_t lexer = lexer_param_ptr->lexer; int tok = jq_yylex(yylval, yylloc, lexer); if ((tok == LITERAL || tok == QQSTRING_TEXT) && !jv_is_valid(yylval->literal)) { jv msg = jv_invalid_get_msg(jv_copy(yylval->literal)); if (jv_get_kind(msg) == JV_KIND_STRING) { FAIL(*yylloc, jv_string_value(msg)); } else { FAIL(*yylloc, "Invalid literal"); } jv_free(msg); jv_free(yylval->literal); yylval->literal = jv_null(); } return tok; } /* Returns string message if the block is a constant that is not valid as an * object key. */ static jv check_object_key(block k) { if (block_is_const(k) && block_const_kind(k) != JV_KIND_STRING) { char errbuf[30]; return jv_string_fmt("Cannot use %s (%s) as object key", jv_kind_name(block_const_kind(k)), jv_dump_string_trunc(block_const(k), errbuf, sizeof(errbuf))); } return jv_invalid(); } static block gen_index(block obj, block key) { return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX)); } static block gen_index_opt(block obj, block key) { return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX_OPT)); } static block gen_slice_index(block obj, block start, block end, opcode idx_op) { block key = BLOCK(gen_subexp(gen_const(jv_object())), gen_subexp(gen_const(jv_string("start"))), gen_subexp(start), gen_op_simple(INSERT), gen_subexp(gen_const(jv_string("end"))), gen_subexp(end), gen_op_simple(INSERT)); return BLOCK(key, obj, gen_op_simple(idx_op)); } static block constant_fold(block a, block b, int op) { if (!block_is_single(a) || !block_is_const(a) || !block_is_single(b) || !block_is_const(b)) return gen_noop(); jv jv_a = block_const(a); block_free(a); jv jv_b = block_const(b); block_free(b); jv res = jv_invalid(); switch (op) { case '+': res = binop_plus(jv_a, jv_b); break; case '-': res = binop_minus(jv_a, jv_b); break; case '*': res = binop_multiply(jv_a, jv_b); break; case '/': res = binop_divide(jv_a, jv_b); break; case '%': res = binop_mod(jv_a, jv_b); break; case EQ: res = binop_equal(jv_a, jv_b); break; case NEQ: res = binop_notequal(jv_a, jv_b); break; case '<': res = binop_less(jv_a, jv_b); break; case '>': res = binop_greater(jv_a, jv_b); break; case LESSEQ: res = binop_lesseq(jv_a, jv_b); break; case GREATEREQ: res = binop_greatereq(jv_a, jv_b); break; } if (jv_is_valid(res)) return gen_const(res); return gen_error(jv_invalid_get_msg(res)); } static block gen_binop(block a, block b, int op) { block folded = constant_fold(a, b, op); if (!block_is_noop(folded)) return folded; const char* funcname = 0; switch (op) { case '+': funcname = "_plus"; break; case '-': funcname = "_minus"; break; case '*': funcname = "_multiply"; break; case '/': funcname = "_divide"; break; case '%': funcname = "_mod"; break; case EQ: funcname = "_equal"; break; case NEQ: funcname = "_notequal"; break; case '<': funcname = "_less"; break; case '>': funcname = "_greater"; break; case LESSEQ: funcname = "_lesseq"; break; case GREATEREQ: funcname = "_greatereq"; break; } assert(funcname); return gen_call(funcname, BLOCK(gen_lambda(a), gen_lambda(b))); } static block gen_format(block a, jv fmt) { return BLOCK(a, gen_call("format", gen_lambda(gen_const(fmt)))); } static block gen_definedor_assign(block object, block val) { block tmp = gen_op_var_fresh(STOREV, "tmp"); return BLOCK(gen_op_simple(DUP), val, tmp, gen_call("_modify", BLOCK(gen_lambda(object), gen_lambda(gen_definedor(gen_noop(), gen_op_bound(LOADV, tmp)))))); } static block gen_update(block object, block val, int optype) { block tmp = gen_op_var_fresh(STOREV, "tmp"); return BLOCK(gen_op_simple(DUP), val, tmp, gen_call("_modify", BLOCK(gen_lambda(object), gen_lambda(gen_binop(gen_noop(), gen_op_bound(LOADV, tmp), optype))))); } static block gen_loc_object(location *loc, struct locfile *locations) { return gen_const(JV_OBJECT(jv_string("file"), jv_copy(locations->fname), jv_string("line"), jv_number(locfile_get_line(locations, loc->start) + 1))); } %} %% TopLevel: Module Imports Query { *answer = BLOCK($1, $2, gen_op_simple(TOP), $3); } | Module Imports FuncDefs { *answer = BLOCK($1, $2, $3); } Module: %empty { $$ = gen_noop(); } | "module" Query ';' { if (!block_is_const($2)) { FAIL(@2, "Module metadata must be constant"); $$ = gen_noop(); block_free($2); } else if (block_const_kind($2) != JV_KIND_OBJECT) { FAIL(@2, "Module metadata must be an object"); $$ = gen_noop(); block_free($2); } else { $$ = gen_module($2); } } Imports: %empty { $$ = gen_noop(); } | Import Imports { $$ = BLOCK($1, $2); } FuncDefs: %empty { $$ = gen_noop(); } | FuncDef FuncDefs { $$ = block_join($1, $2); } Query: FuncDef Query %prec FUNCDEF { $$ = block_bind_referenced($1, $2, OP_IS_CALL_PSEUDO); } | Expr "as" Patterns '|' Query { $$ = gen_destructure($1, $3, $5); } | "label" BINDING '|' Query { jv v = jv_string_fmt("*label-%s", jv_string_value($2)); $$ = gen_location(@$, locations, gen_label(jv_string_value(v), $4)); jv_free($2); jv_free(v); } | Query '|' Query { $$ = block_join($1, $3); } | Query ',' Query { $$ = gen_both($1, $3); } | Expr { $$ = $1; } Expr: Expr "//" Expr { $$ = gen_definedor($1, $3); } | Expr '=' Expr { $$ = gen_call("_assign", BLOCK(gen_lambda($1), gen_lambda($3))); } | Expr "or" Expr { $$ = gen_or($1, $3); } | Expr "and" Expr { $$ = gen_and($1, $3); } | Expr "//=" Expr { $$ = gen_definedor_assign($1, $3); } | Expr "|=" Expr { $$ = gen_call("_modify", BLOCK(gen_lambda($1), gen_lambda($3))); } | Expr '+' Expr { $$ = gen_binop($1, $3, '+'); } | Expr "+=" Expr { $$ = gen_update($1, $3, '+'); } | Expr '-' Expr { $$ = gen_binop($1, $3, '-'); } | Expr "-=" Expr { $$ = gen_update($1, $3, '-'); } | Expr '*' Expr { $$ = gen_binop($1, $3, '*'); } | Expr "*=" Expr { $$ = gen_update($1, $3, '*'); } | Expr '/' Expr { $$ = gen_binop($1, $3, '/'); } | Expr '%' Expr { $$ = gen_binop($1, $3, '%'); } | Expr "/=" Expr { $$ = gen_update($1, $3, '/'); } | Expr SETMOD Expr { $$ = gen_update($1, $3, '%'); } | Expr "==" Expr { $$ = gen_binop($1, $3, EQ); } | Expr "!=" Expr { $$ = gen_binop($1, $3, NEQ); } | Expr '<' Expr { $$ = gen_binop($1, $3, '<'); } | Expr '>' Expr { $$ = gen_binop($1, $3, '>'); } | Expr "<=" Expr { $$ = gen_binop($1, $3, LESSEQ); } | Expr ">=" Expr { $$ = gen_binop($1, $3, GREATEREQ); } | Term %prec NONOPT { $$ = $1; } Import: ImportWhat ';' { $$ = $1; } | ImportWhat Query ';' { if (!block_is_const($2)) { FAIL(@2, "Module metadata must be constant"); $$ = gen_noop(); block_free($1); block_free($2); } else if (block_const_kind($2) != JV_KIND_OBJECT) { FAIL(@2, "Module metadata must be an object"); $$ = gen_noop(); block_free($1); block_free($2); } else { $$ = gen_import_meta($1, $2); } } ImportWhat: "import" ImportFrom "as" BINDING { $$ = gen_import(block_const($2), $4, 1); block_free($2); } | "import" ImportFrom "as" IDENT { $$ = gen_import(block_const($2), $4, 0); block_free($2); } | "include" ImportFrom { $$ = gen_import(block_const($2), jv_invalid(), 0); block_free($2); } ImportFrom: String { if (!block_is_const($1)) { FAIL(@1, "Import path must be constant"); $$ = gen_const(jv_string("")); block_free($1); } else { $$ = $1; } } FuncDef: "def" IDENT ':' Query ';' { $$ = gen_function(jv_string_value($2), gen_noop(), $4); jv_free($2); } | "def" IDENT '(' Params ')' ':' Query ';' { $$ = gen_function(jv_string_value($2), $4, $7); jv_free($2); } Params: Param { $$ = $1; } | Params ';' Param { $$ = BLOCK($1, $3); } Param: BINDING { $$ = gen_param_regular(jv_string_value($1)); jv_free($1); } | IDENT { $$ = gen_param(jv_string_value($1)); jv_free($1); } StringStart: FORMAT QQSTRING_START { $$ = $1; } | QQSTRING_START { $$ = jv_string("text"); } String: StringStart QQString QQSTRING_END { $$ = $2; jv_free($1); }; QQString: %empty { $$ = gen_const(jv_string("")); } | QQString QQSTRING_TEXT { $$ = gen_binop($1, gen_const($2), '+'); } | QQString QQSTRING_INTERP_START Query QQSTRING_INTERP_END { $$ = gen_binop($1, gen_format($3, jv_copy($0)), '+'); } ElseBody: "elif" Query "then" Query ElseBody { $$ = gen_cond($2, $4, $5); } | "else" Query "end" { $$ = $2; } | "end" { $$ = gen_noop(); } Term: '.' { $$ = gen_noop(); } | REC { $$ = gen_call("recurse", gen_noop()); } | BREAK BINDING { jv v = jv_string_fmt("*label-%s", jv_string_value($2)); // impossible symbol $$ = gen_location(@$, locations, BLOCK(gen_op_unbound(LOADV, jv_string_value(v)), gen_call("error", gen_noop()))); jv_free(v); jv_free($2); } | BREAK error { FAIL(@$, "break requires a label to break to"); $$ = gen_noop(); } | Term FIELD '?' { $$ = gen_index_opt($1, gen_const($2)); } | FIELD '?' { $$ = gen_index_opt(gen_noop(), gen_const($1)); } | Term '.' String '?' { $$ = gen_index_opt($1, $3); } | '.' String '?' { $$ = gen_index_opt(gen_noop(), $2); } | Term FIELD %prec NONOPT { $$ = gen_index($1, gen_const($2)); } | FIELD %prec NONOPT { $$ = gen_index(gen_noop(), gen_const($1)); } | Term '.' String %prec NONOPT { $$ = gen_index($1, $3); } | '.' String %prec NONOPT { $$ = gen_index(gen_noop(), $2); } | '.' error { FAIL(@$, "try .[\"field\"] instead of .field for unusually named fields"); $$ = gen_noop(); } | '.' IDENT error { jv_free($2); FAIL(@$, "try .[\"field\"] instead of .field for unusually named fields"); $$ = gen_noop(); } | /* FIXME: string literals */ Term '[' Query ']' '?' { $$ = gen_index_opt($1, $3); } | Term '[' Query ']' %prec NONOPT { $$ = gen_index($1, $3); } | Term '.' '[' Query ']' '?' { $$ = gen_index_opt($1, $4); } | Term '.' '[' Query ']' %prec NONOPT { $$ = gen_index($1, $4); } | Term '[' ']' '?' { $$ = block_join($1, gen_op_simple(EACH_OPT)); } | Term '[' ']' %prec NONOPT { $$ = block_join($1, gen_op_simple(EACH)); } | Term '.' '[' ']' '?' { $$ = block_join($1, gen_op_simple(EACH_OPT)); } | Term '.' '[' ']' %prec NONOPT { $$ = block_join($1, gen_op_simple(EACH)); } | Term '[' Query ':' Query ']' '?' { $$ = gen_slice_index($1, $3, $5, INDEX_OPT); } | Term '[' Query ':' ']' '?' { $$ = gen_slice_index($1, $3, gen_const(jv_null()), INDEX_OPT); } | Term '[' ':' Query ']' '?' { $$ = gen_slice_index($1, gen_const(jv_null()), $4, INDEX_OPT); } | Term '[' Query ':' Query ']' %prec NONOPT { $$ = gen_slice_index($1, $3, $5, INDEX); } | Term '[' Query ':' ']' %prec NONOPT { $$ = gen_slice_index($1, $3, gen_const(jv_null()), INDEX); } | Term '[' ':' Query ']' %prec NONOPT { $$ = gen_slice_index($1, gen_const(jv_null()), $4, INDEX); } | Term '?' { $$ = gen_try($1, gen_op_simple(BACKTRACK)); } | LITERAL { $$ = gen_const($1); } | String { $$ = $1; } | FORMAT { $$ = gen_format(gen_noop(), $1); } | '-' Term { $$ = BLOCK($2, gen_call("_negate", gen_noop())); } | '(' Query ')' { $$ = $2; } | '[' Query ']' { $$ = gen_collect($2); } | '[' ']' { $$ = gen_const(jv_array()); } | '{' DictPairs '}' { block o = gen_const_object($2); if (o.first != NULL) $$ = o; else $$ = BLOCK(gen_subexp(gen_const(jv_object())), $2, gen_op_simple(POP)); } | "reduce" Expr "as" Patterns '(' Query ';' Query ')' { $$ = gen_reduce($2, $4, $6, $8); } | "foreach" Expr "as" Patterns '(' Query ';' Query ';' Query ')' { $$ = gen_foreach($2, $4, $6, $8, $10); } | "foreach" Expr "as" Patterns '(' Query ';' Query ')' { $$ = gen_foreach($2, $4, $6, $8, gen_noop()); } | "if" Query "then" Query ElseBody { $$ = gen_cond($2, $4, $5); } | "if" Query "then" error { FAIL(@$, "Possibly unterminated 'if' statement"); $$ = $2; } | "try" Expr "catch" Expr { $$ = gen_try($2, $4); } | "try" Expr "catch" error { FAIL(@$, "Possibly unterminated 'try' statement"); $$ = $2; } | "try" Expr { $$ = gen_try($2, gen_op_simple(BACKTRACK)); } | /* * This `$$$$varname` hack is strictly private to jq builtins. DO NOT USE!! * * This is used in `_modify`, in src/builtin.jq, to avoid holding on to a * reference to `.`. * * We could just have the compiler emit bytecode for `_modify` so it can use * LOADVN w/o needing jq syntax for LOADVN. * * This syntax, `$$$$varname`, violates referential transparency: it has * side-effects that are surprising. * * DO NOT USE!! I will break your jq code if you do use this outside * src/builtin.jq. */ '$' '$' '$' BINDING { $$ = gen_location(@$, locations, gen_op_unbound(LOADVN, jv_string_value($4))); jv_free($4); } | BINDING { $$ = gen_location(@$, locations, gen_op_unbound(LOADV, jv_string_value($1))); jv_free($1); } | "$__loc__" { $$ = gen_loc_object(&@$, locations); } | IDENT { const char *s = jv_string_value($1); if (strcmp(s, "false") == 0) $$ = gen_const(jv_false()); else if (strcmp(s, "true") == 0) $$ = gen_const(jv_true()); else if (strcmp(s, "null") == 0) $$ = gen_const(jv_null()); else $$ = gen_location(@$, locations, gen_call(s, gen_noop())); jv_free($1); } | IDENT '(' Args ')' { $$ = gen_call(jv_string_value($1), $3); $$ = gen_location(@1, locations, $$); jv_free($1); } | '(' error ')' { $$ = gen_noop(); } | '[' error ']' { $$ = gen_noop(); } | Term '[' error ']' { $$ = $1; } | '{' error '}' { $$ = gen_noop(); } Args: Arg { $$ = $1; } | Args ';' Arg { $$ = BLOCK($1, $3); } Arg: Query { $$ = gen_lambda($1); } RepPatterns: RepPatterns "?//" Pattern { $$ = BLOCK($1, gen_destructure_alt($3)); } | Pattern { $$ = gen_destructure_alt($1); } Patterns: RepPatterns "?//" Pattern { $$ = BLOCK($1, $3); } | Pattern { $$ = $1; } Pattern: BINDING { $$ = gen_op_unbound(STOREV, jv_string_value($1)); jv_free($1); } | '[' ArrayPats ']' { $$ = BLOCK($2, gen_op_simple(POP)); } | '{' ObjPats '}' { $$ = BLOCK($2, gen_op_simple(POP)); } ArrayPats: Pattern { $$ = gen_array_matcher(gen_noop(), $1); } | ArrayPats ',' Pattern { $$ = gen_array_matcher($1, $3); } ObjPats: ObjPat { $$ = $1; } | ObjPats ',' ObjPat { $$ = BLOCK($1, $3); } ObjPat: BINDING { $$ = gen_object_matcher(gen_const($1), gen_op_unbound(STOREV, jv_string_value($1))); } | BINDING ':' Pattern { $$ = gen_object_matcher(gen_const($1), BLOCK(gen_op_simple(DUP), gen_op_unbound(STOREV, jv_string_value($1)), $3)); } | IDENT ':' Pattern { $$ = gen_object_matcher(gen_const($1), $3); } | Keyword ':' Pattern { $$ = gen_object_matcher(gen_const($1), $3); } | String ':' Pattern { $$ = gen_object_matcher($1, $3); } | '(' Query ')' ':' Pattern { jv msg = check_object_key($2); if (jv_is_valid(msg)) { FAIL(@2, jv_string_value(msg)); } jv_free(msg); $$ = gen_object_matcher($2, $5); } | error ':' Pattern { FAIL(@$, "May need parentheses around object key expression"); $$ = $3; } Keyword: "as" { $$ = jv_string("as"); } | "def" { $$ = jv_string("def"); } | "module" { $$ = jv_string("module"); } | "import" { $$ = jv_string("import"); } | "include" { $$ = jv_string("include"); } | "if" { $$ = jv_string("if"); } | "then" { $$ = jv_string("then"); } | "else" { $$ = jv_string("else"); } | "elif" { $$ = jv_string("elif"); } | "reduce" { $$ = jv_string("reduce"); } | "foreach" { $$ = jv_string("foreach"); } | "end" { $$ = jv_string("end"); } | "and" { $$ = jv_string("and"); } | "or" { $$ = jv_string("or"); } | "try" { $$ = jv_string("try"); } | "catch" { $$ = jv_string("catch"); } | "label" { $$ = jv_string("label"); } | "break" { $$ = jv_string("break"); } DictPairs: %empty { $$ = gen_noop(); } | DictPair { $$ = $1; } | DictPair ',' DictPairs { $$ = block_join($1, $3); } DictPair: IDENT ':' DictExpr { $$ = gen_dictpair(gen_const($1), $3); } | Keyword ':' DictExpr { $$ = gen_dictpair(gen_const($1), $3); } | String ':' DictExpr { $$ = gen_dictpair($1, $3); } | String { $$ = gen_dictpair($1, BLOCK(gen_op_simple(POP), gen_op_simple(DUP2), gen_op_simple(DUP2), gen_op_simple(INDEX))); } | BINDING ':' DictExpr { $$ = gen_dictpair(gen_location(@$, locations, gen_op_unbound(LOADV, jv_string_value($1))), $3); jv_free($1); } | BINDING { $$ = gen_dictpair(gen_const($1), gen_location(@$, locations, gen_op_unbound(LOADV, jv_string_value($1)))); } | IDENT { $$ = gen_dictpair(gen_const(jv_copy($1)), gen_index(gen_noop(), gen_const($1))); } | "$__loc__" { $$ = gen_dictpair(gen_const(jv_string("__loc__")), gen_loc_object(&@$, locations)); } | Keyword { $$ = gen_dictpair(gen_const(jv_copy($1)), gen_index(gen_noop(), gen_const($1))); } | '(' Query ')' ':' DictExpr { jv msg = check_object_key($2); if (jv_is_valid(msg)) { FAIL(@2, jv_string_value(msg)); } jv_free(msg); $$ = gen_dictpair($2, $5); } | error ':' DictExpr { FAIL(@1, "May need parentheses around object key expression"); $$ = $3; } DictExpr: DictExpr '|' DictExpr { $$ = block_join($1, $3); } | Expr { $$ = $1; } %% int jq_parse(struct locfile* locations, block* answer) { struct lexer_param scanner; YY_BUFFER_STATE buf; jq_yylex_init_extra(0, &scanner.lexer); buf = jq_yy_scan_bytes(locations->data, locations->length, scanner.lexer); int errors = 0; *answer = gen_noop(); yyparse(answer, &errors, locations, &scanner); jq_yy_delete_buffer(buf, scanner.lexer); jq_yylex_destroy(scanner.lexer); if (errors > 0) { block_free(*answer); *answer = gen_noop(); } return errors; } int jq_parse_library(struct locfile* locations, block* answer) { int errs = jq_parse(locations, answer); if (errs) return errs; if (block_has_main(*answer)) { locfile_locate(locations, UNKNOWN_LOCATION, "jq: error: library should only have function definitions, not a main expression"); return 1; } assert(block_has_only_binders_and_imports(*answer, OP_IS_CALL_PSEUDO)); return 0; } jq-1.8.2/src/util.c0000644000175100017510000011073115215513536007540 /*- * Parts (strptime()) Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. * All rights reserved. * * This code was contributed to The NetBSD Foundation by Klaus Klein. * Heavily optimised by David Laight * * 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. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. */ #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_ALLOCA_H # include #elif !defined alloca # ifdef __GNUC__ # define alloca __builtin_alloca # elif defined _MSC_VER # include # define alloca _alloca # elif !defined HAVE_ALLOCA # ifdef __cplusplus extern "C" # endif void *alloca (size_t); # endif #endif #ifdef WIN32 #include #include #include #include #include #endif #include "util.h" #include "jq.h" #include "jv_alloc.h" #include "jv_unicode.h" #ifdef WIN32 FILE *fopen(const char *fname, const char *mode) { size_t sz = sizeof(wchar_t) * MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0); wchar_t *wfname = alloca(sz + 2); // +2 is not needed, but just in case MultiByteToWideChar(CP_UTF8, 0, fname, -1, wfname, sz); sz = sizeof(wchar_t) * MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0); wchar_t *wmode = alloca(sz + 2); // +2 is not needed, but just in case MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, sz); return _wfopen(wfname, wmode); } #endif jv expand_path(jv path) { assert(jv_get_kind(path) == JV_KIND_STRING); const char *pstr = jv_string_value(path); jv ret = path; if (jv_string_length_bytes(jv_copy(path)) > 1 && pstr[0] == '~' && pstr[1] == '/') { jv home = get_home(); if (jv_is_valid(home)) { ret = jv_string_fmt("%s/%s",jv_string_value(home),pstr+2); jv_free(home); } else { jv emsg = jv_invalid_get_msg(home); ret = jv_invalid_with_msg(jv_string_fmt("Could not expand %s. (%s)", pstr, jv_string_value(emsg))); jv_free(emsg); } jv_free(path); } return ret; } jv get_home(void) { jv ret; char *home = getenv("HOME"); if (!home) { #ifndef WIN32 ret = jv_invalid_with_msg(jv_string("Could not find home directory.")); #else home = getenv("USERPROFILE"); if (!home) { home = getenv("HOMEPATH"); if (!home) { ret = jv_invalid_with_msg(jv_string("Could not find home directory.")); } else { const char *hd = getenv("HOMEDRIVE"); if (!hd) hd = ""; ret = jv_string_fmt("%s%s",hd,home); } } else { ret = jv_string(home); } #endif } else { ret = jv_string(home); } return ret; } jv jq_realpath(jv path) { int path_max; char *buf = NULL; #ifdef _PC_PATH_MAX path_max = pathconf(jv_string_value(path),_PC_PATH_MAX); #else path_max = PATH_MAX; #endif if (path_max > 0) { buf = jv_mem_alloc(path_max); } #ifdef WIN32 char *tmp = _fullpath(buf, jv_string_value(path), path_max); #else char *tmp = realpath(jv_string_value(path), buf); #endif if (tmp == NULL) { free(buf); return path; } jv_free(path); path = jv_string(tmp); free(tmp); return path; } const void *_jq_memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) { #ifdef HAVE_MEMMEM return (const void*)memmem(haystack, haystacklen, needle, needlelen); #else const char *h = haystack; const char *n = needle; size_t hi, hi2, ni; if (haystacklen < needlelen || haystacklen == 0) return NULL; for (hi = 0; hi < (haystacklen - needlelen + 1); hi++) { for (ni = 0, hi2 = hi; ni < needlelen; ni++, hi2++) { if (h[hi2] != n[ni]) goto not_this; } return &h[hi]; not_this: continue; } return NULL; #endif /* !HAVE_MEMMEM */ } struct jq_util_input_state { jq_util_msg_cb err_cb; void *err_cb_data; jv_parser *parser; FILE* current_input; char **files; int nfiles; int curr_file; int failures; jv slurped; char buf[4096]; size_t buf_valid_len; jv current_filename; size_t current_line; }; static void fprinter(void *data, const char *fname) { fprintf((FILE *)data, "jq: error: Could not open file %s: %s\n", fname, strerror(errno)); } // If parser == NULL -> RAW jq_util_input_state *jq_util_input_init(jq_util_msg_cb err_cb, void *err_cb_data) { if (err_cb == NULL) { err_cb = fprinter; err_cb_data = stderr; } jq_util_input_state *new_state = jv_mem_calloc(1, sizeof(*new_state)); new_state->err_cb = err_cb; new_state->err_cb_data = err_cb_data; new_state->slurped = jv_invalid(); new_state->current_filename = jv_invalid(); return new_state; } void jq_util_input_set_parser(jq_util_input_state *state, jv_parser *parser, int slurp) { assert(!jv_is_valid(state->slurped)); state->parser = parser; if (parser == NULL && slurp) state->slurped = jv_string(""); else if (slurp) state->slurped = jv_array(); else state->slurped = jv_invalid(); } void jq_util_input_free(jq_util_input_state **state) { jq_util_input_state *old_state = *state; *state = NULL; if (old_state == NULL) return; if (old_state->parser != NULL) jv_parser_free(old_state->parser); for (int i = 0; i < old_state->nfiles; i++) free(old_state->files[i]); free(old_state->files); jv_free(old_state->slurped); jv_free(old_state->current_filename); jv_mem_free(old_state); } void jq_util_input_add_input(jq_util_input_state *state, const char *fname) { state->files = jv_mem_realloc(state->files, (state->nfiles + 1) * sizeof(state->files[0])); state->files[state->nfiles++] = jv_mem_strdup(fname); } int jq_util_input_errors(jq_util_input_state *state) { return state->failures; } static const char *next_file(jq_util_input_state *state) { if (state->curr_file < state->nfiles) return state->files[state->curr_file++]; return NULL; } static int jq_util_input_read_more(jq_util_input_state *state) { if (!state->current_input || feof(state->current_input) || ferror(state->current_input)) { if (state->current_input && ferror(state->current_input)) { // System-level input error on the stream. It will be closed (below). // TODO: report it. Can't use 'state->err_cb()' as it is hard-coded for // 'open' related problems. fprintf(stderr,"jq: error: %s\n", strerror(errno)); } if (state->current_input) { if (state->current_input == stdin) { clearerr(stdin); // perhaps we can read again; anyways, we don't fclose(stdin) } else { fclose(state->current_input); } state->current_input = NULL; } const char *f = next_file(state); if (f != NULL) { jv_free(state->current_filename); state->current_line = 0; if (!strcmp(f, "-")) { state->current_input = stdin; state->current_filename = jv_string(""); } else { state->current_input = fopen(f, "r"); state->current_filename = jv_string(f); if (!state->current_input) { state->err_cb(state->err_cb_data, f); state->failures++; } } } } state->buf[0] = 0; state->buf_valid_len = 0; if (state->current_input) { char *res; memset(state->buf, 0xff, sizeof(state->buf)); const int max_utf8_len = 4; const int max_gets_len = sizeof(state->buf) - max_utf8_len; while (!(res = fgets(state->buf, max_gets_len, state->current_input)) && ferror(state->current_input) && errno == EINTR) clearerr(state->current_input); if (res == NULL) { state->buf[0] = 0; if (ferror(state->current_input)) state->failures++; } else { const char *p = memchr(state->buf, '\n', max_gets_len); if (p != NULL) state->current_line++; if (p == NULL && feof(state->current_input)) { size_t i; /* * XXX We don't know how many bytes we've read! * * We can't use getline() because there need not be any newlines * in the input. The only entirely correct choices are: use * fgetc() or fread(). Using fread() will complicate buffer * management here. * * For now we check how much fgets() read by scanning backwards for the * terminating '\0'. This only works because we previously memset our * buffer with something nonzero. */ for (i = max_gets_len - 1; i > 0; i--) { if (state->buf[i] == '\0') break; } state->buf_valid_len = i; } else if (p == NULL) { state->buf_valid_len = max_gets_len - 1; char *end = state->buf + state->buf_valid_len; int len = 0; if (jvp_utf8_backtrack(end - 1, state->buf, &len) && len > 0) { state->buf_valid_len += fread(end, 1, len, state->current_input); } } else { state->buf_valid_len = (p - state->buf) + 1; } } } return state->curr_file == state->nfiles && !state->current_input; } jv jq_util_input_next_input_cb(jq_state *jq, void *data) { return jq_util_input_next_input((jq_util_input_state *)data); } // Return the current_filename:current_line jv jq_util_input_get_position(jq_state *jq) { jq_input_cb cb = NULL; void *cb_data = NULL; jq_get_input_cb(jq, &cb, &cb_data); assert(cb == jq_util_input_next_input_cb); if (cb != jq_util_input_next_input_cb) return jv_invalid_with_msg(jv_string("Invalid jq_util_input API usage")); jq_util_input_state *s = (jq_util_input_state *)cb_data; // We can't assert that current_filename is a string because if // the error was a JSON parser error then we may not have set // current_filename yet. if (jv_get_kind(s->current_filename) != JV_KIND_STRING) return jv_string(""); jv v = jv_string_fmt("%s:%lu", jv_string_value(s->current_filename), (unsigned long)s->current_line); return v; } jv jq_util_input_get_current_filename(jq_state* jq) { jq_input_cb cb=NULL; void *cb_data=NULL; jq_get_input_cb(jq, &cb, &cb_data); if (cb != jq_util_input_next_input_cb) return jv_invalid_with_msg(jv_string("Unknown input filename")); jq_util_input_state *s = (jq_util_input_state *)cb_data; jv v = jv_copy(s->current_filename); return v; } jv jq_util_input_get_current_line(jq_state* jq) { jq_input_cb cb=NULL; void *cb_data=NULL; jq_get_input_cb(jq, &cb, &cb_data); if (cb != jq_util_input_next_input_cb) return jv_invalid_with_msg(jv_string("Unknown input line number")); jq_util_input_state *s = (jq_util_input_state *)cb_data; jv v = jv_number(s->current_line); return v; } // Blocks to read one more input from stdin and/or given files // When slurping, it returns just one value jv jq_util_input_next_input(jq_util_input_state *state) { int is_last = 0; jv value = jv_invalid(); // need more input do { if (state->parser == NULL) { // Raw input is_last = jq_util_input_read_more(state); if (state->buf_valid_len == 0) continue; if (jv_is_valid(state->slurped)) { // Slurped raw input state->slurped = jv_string_concat(state->slurped, jv_string_sized(state->buf, state->buf_valid_len)); } else { if (!jv_is_valid(value)) value = jv_string(""); if (state->buf[state->buf_valid_len-1] == '\n') { // whole line state->buf[state->buf_valid_len-1] = 0; return jv_string_concat(value, jv_string_sized(state->buf, state->buf_valid_len-1)); } value = jv_string_concat(value, jv_string_sized(state->buf, state->buf_valid_len)); state->buf[0] = '\0'; state->buf_valid_len = 0; } } else { if (jv_parser_remaining(state->parser) == 0) { is_last = jq_util_input_read_more(state); jv_parser_set_buf(state->parser, state->buf, state->buf_valid_len, !is_last); } value = jv_parser_next(state->parser); if (jv_is_valid(state->slurped)) { if (jv_is_valid(value)) { state->slurped = jv_array_append(state->slurped, value); value = jv_invalid(); } else if (jv_invalid_has_msg(jv_copy(value))) return value; // Not slurped parsed input } else if (jv_is_valid(value) || jv_invalid_has_msg(jv_copy(value))) { return value; } } } while (!is_last); if (jv_is_valid(state->slurped)) { value = state->slurped; state->slurped = jv_invalid(); } return value; } #ifndef HAVE_STRPTIME /* http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/lib/libc/time/strptime.c?only_with_tag=HEAD * NetBSD implementation strptime(). * Format description: https://netbsd.gw.com/cgi-bin/man-cgi?strptime+3+NetBSD-current * Adapted by https://github.com/res2001 (https://github.com/res2001/strptime). */ #include #include #include #include static const unsigned char *conv_num(const unsigned char *, int *, unsigned int, unsigned int); static const unsigned char *find_string(const unsigned char *, int *, const char * const *, const char * const *, int); /* * We do not implement alternate representations. However, we always * check whether a given modifier is allowed for a certain conversion. */ #define ALT_E 0x01 #define ALT_O 0x02 #define LEGAL_ALT(x) { if (alt_format & ~(x)) return NULL; } #define TM_YEAR_BASE 1900 #define TM_SUNDAY 0 #define TM_MONDAY 1 #define TM_TUESDAY 2 #define TM_WEDNESDAY 3 #define TM_THURSDAY 4 #define TM_FRIDAY 5 #define TM_SATURDAY 6 #define S_YEAR (1 << 0) #define S_MON (1 << 1) #define S_YDAY (1 << 2) #define S_MDAY (1 << 3) #define S_WDAY (1 << 4) #define S_HOUR (1 << 5) #define HAVE_MDAY(s) (s & S_MDAY) #define HAVE_MON(s) (s & S_MON) #define HAVE_WDAY(s) (s & S_WDAY) #define HAVE_YDAY(s) (s & S_YDAY) #define HAVE_YEAR(s) (s & S_YEAR) #define HAVE_HOUR(s) (s & S_HOUR) #define SECSPERMIN 60 #define MINSPERHOUR 60 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) #define HOURSPERDAY 24 #define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y" #define HERE_D_FMT "%y/%m/%d" #define HERE_T_FMT_AMPM "%I:%M:%S %p" #define HERE_T_FMT "%H:%M:%S" #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) /* ** Since everything in isleap is modulo 400 (or a factor of 400), we know that ** isleap(y) == isleap(y % 400) ** and so ** isleap(a + b) == isleap((a + b) % 400) ** or ** isleap(a + b) == isleap(a % 400 + b % 400) ** This is true even if % means modulo rather than Fortran remainder ** (which is allowed by C89 but not by C99 or later). ** We use this to avoid addition overflow problems. */ #define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) #ifdef _MSC_VER #define tzname _tzname #define strncasecmp _strnicmp #endif #ifdef TM_ZONE static char* utc = "UTC"; #endif /* RFC-822/RFC-2822 */ static const char *const nast[] = { "EST", "CST", "MST", "PST", "\0\0\0" }; static const char *const nadt[] = { "EDT", "CDT", "MDT", "PDT", "\0\0\0" }; static const char *const weekday_name[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; static const char *const ab_weekday_name[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char *const month_name[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; static const char *const ab_month_name[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static const char *const am_pm[] = {"AM", "PM"}; /* * Table to determine the ordinal date for the start of a month. * Ref: http://en.wikipedia.org/wiki/ISO_week_date */ static const int start_of_month[2][13] = { /* non-leap year */ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, /* leap year */ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } }; /* * Calculate the week day of the first day of a year. Valid for * the Gregorian calendar, which began Sept 14, 1752 in the UK * and its colonies. Ref: * http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week */ static int first_wday_of(int yr) { return ((2 * (3 - (yr / 100) % 4)) + (yr % 100) + ((yr % 100) / 4) + (isleap(yr) ? 6 : 0) + 1) % 7; } #define delim(p) ((p) == '\0' || isspace((unsigned char)(p))) static int fromzone(const unsigned char **bp, struct tm *tm, int mandatory) { // timezone_t tz; char buf[512], *p; const unsigned char *rp; for (p = buf, rp = *bp; !delim(*rp) && p < &buf[sizeof(buf) - 1]; rp++) *p++ = *rp; *p = '\0'; if (mandatory) *bp = rp; if (!isalnum((unsigned char)*buf)) return 0; // tz = tzalloc(buf); // if (tz == NULL) // return 0; *bp = rp; tm->tm_isdst = 0; /* XXX */ #ifdef TM_GMTOFF tm->TM_GMTOFF = tzgetgmtoff(tz, tm->tm_isdst); #endif #ifdef TM_ZONE // Can't use tzgetname() here because we are going to free() tm->TM_ZONE = NULL; /* XXX */ #endif // tzfree(tz); return 1; } char* strptime(const char *buf, const char *fmt, struct tm *tm) { unsigned char c; const unsigned char *bp, *ep, *zname; int alt_format, i, split_year = 0, neg = 0, state = 0, day_offset = -1, week_offset = 0, offs, mandatory; const char *new_fmt; bp = (const unsigned char *)buf; while (bp != NULL && (c = *fmt++) != '\0') { /* Clear `alternate' modifier prior to new conversion. */ alt_format = 0; i = 0; /* Eat up white-space. */ if (isspace(c)) { while (isspace(*bp)) bp++; continue; } if (c != '%') goto literal; again: switch (c = *fmt++) { case '%': /* "%%" is converted to "%". */ literal: if (c != *bp++) return NULL; LEGAL_ALT(0); continue; /* * "Alternative" modifiers. Just set the appropriate flag * and start over again. */ case 'E': /* "%E?" alternative conversion modifier. */ LEGAL_ALT(0); alt_format |= ALT_E; goto again; case 'O': /* "%O?" alternative conversion modifier. */ LEGAL_ALT(0); alt_format |= ALT_O; goto again; /* * "Complex" conversion rules, implemented through recursion. */ case 'c': /* Date and time, using the locale's format. */ // new_fmt = _TIME_LOCALE(loc)->d_t_fmt; new_fmt = HERE_D_T_FMT; state |= S_WDAY | S_MON | S_MDAY | S_YEAR; goto recurse; case 'F': /* The date as "%Y-%m-%d". */ new_fmt = "%Y-%m-%d"; LEGAL_ALT(0); state |= S_MON | S_MDAY | S_YEAR; goto recurse; case 'R': /* The time as "%H:%M". */ new_fmt = "%H:%M"; LEGAL_ALT(0); goto recurse; case 'r': /* The time in 12-hour clock representation. */ // new_fmt = _TIME_LOCALE(loc)->t_fmt_ampm; new_fmt = HERE_T_FMT_AMPM; LEGAL_ALT(0); goto recurse; case 'X': /* The time, using the locale's format. */ /* fall through */ case 'T': /* The time as "%H:%M:%S". */ new_fmt = HERE_T_FMT; LEGAL_ALT(0); recurse: bp = (const unsigned char *)strptime((const char *)bp, new_fmt, tm); LEGAL_ALT(ALT_E); continue; case 'x': /* The date, using the locale's format. */ /* fall through */ case 'D': /* The date as "%y/%m/%d". */ { new_fmt = HERE_D_FMT; LEGAL_ALT(0); state |= S_MON | S_MDAY | S_YEAR; const int year = split_year ? tm->tm_year : 0; bp = (const unsigned char *)strptime((const char *)bp, new_fmt, tm); LEGAL_ALT(ALT_E); tm->tm_year += year; if (split_year && tm->tm_year % (2000 - TM_YEAR_BASE) <= 68) tm->tm_year -= 2000 - TM_YEAR_BASE; split_year = 1; continue; } /* * "Elementary" conversion rules. */ case 'A': /* The day of week, using the locale's form. */ case 'a': bp = find_string(bp, &tm->tm_wday, weekday_name, ab_weekday_name, 7); LEGAL_ALT(0); state |= S_WDAY; continue; case 'B': /* The month, using the locale's form. */ case 'b': case 'h': bp = find_string(bp, &tm->tm_mon, month_name, ab_month_name, 12); LEGAL_ALT(0); state |= S_MON; continue; case 'C': /* The century number. */ i = 20; bp = conv_num(bp, &i, 0, 99); i = i * 100 - TM_YEAR_BASE; if (split_year) i += tm->tm_year % 100; split_year = 1; tm->tm_year = i; LEGAL_ALT(ALT_E); state |= S_YEAR; continue; case 'd': /* The day of month. */ case 'e': bp = conv_num(bp, &tm->tm_mday, 1, 31); LEGAL_ALT(ALT_O); state |= S_MDAY; continue; case 'k': /* The hour (24-hour clock representation). */ LEGAL_ALT(0); /* FALLTHROUGH */ case 'H': bp = conv_num(bp, &tm->tm_hour, 0, 23); LEGAL_ALT(ALT_O); state |= S_HOUR; continue; case 'l': /* The hour (12-hour clock representation). */ LEGAL_ALT(0); /* FALLTHROUGH */ case 'I': bp = conv_num(bp, &tm->tm_hour, 1, 12); if (tm->tm_hour == 12) tm->tm_hour = 0; LEGAL_ALT(ALT_O); state |= S_HOUR; continue; case 'j': /* The day of year. */ i = 1; bp = conv_num(bp, &i, 1, 366); tm->tm_yday = i - 1; LEGAL_ALT(0); state |= S_YDAY; continue; case 'M': /* The minute. */ bp = conv_num(bp, &tm->tm_min, 0, 59); LEGAL_ALT(ALT_O); continue; case 'm': /* The month. */ i = 1; bp = conv_num(bp, &i, 1, 12); tm->tm_mon = i - 1; LEGAL_ALT(ALT_O); state |= S_MON; continue; case 'p': /* The locale's equivalent of AM/PM. */ bp = find_string(bp, &i, am_pm, NULL, 2); if (HAVE_HOUR(state) && tm->tm_hour > 11) return NULL; tm->tm_hour += i * 12; LEGAL_ALT(0); continue; case 'S': /* The seconds. */ bp = conv_num(bp, &tm->tm_sec, 0, 61); LEGAL_ALT(ALT_O); continue; case 's': { /* seconds since the epoch */ #ifdef _WIN32 const time_t TIME_MAX = INT32_MAX; #else const time_t TIME_MAX = INT64_MAX; #endif time_t sse, d; if (*bp < '0' || *bp > '9') { bp = NULL; continue; } sse = *bp++ - '0'; while (*bp >= '0' && *bp <= '9') { d = *bp++ - '0'; if (sse > TIME_MAX/10) { bp = NULL; break; } sse *= 10; if (sse > TIME_MAX - d) { bp = NULL; break; } sse += d; } if (bp == NULL) continue; #ifdef _WIN32 if (localtime_s(tm, &sse)) #else if (localtime_r(&sse, tm) == NULL) #endif bp = NULL; else state |= S_YDAY | S_WDAY | S_MON | S_MDAY | S_YEAR; continue; } case 'U': /* The week of year, beginning on sunday. */ case 'W': /* The week of year, beginning on monday. */ /* * This is bogus, as we can not assume any valid * information present in the tm structure at this * point to calculate a real value, so save the * week for now in case it can be used later. */ bp = conv_num(bp, &i, 0, 53); LEGAL_ALT(ALT_O); if (c == 'U') day_offset = TM_SUNDAY; else day_offset = TM_MONDAY; week_offset = i; continue; case 'w': /* The day of week, beginning on sunday. */ bp = conv_num(bp, &tm->tm_wday, 0, 6); LEGAL_ALT(ALT_O); state |= S_WDAY; continue; case 'u': /* The day of week, monday = 1. */ bp = conv_num(bp, &i, 1, 7); tm->tm_wday = i % 7; LEGAL_ALT(ALT_O); state |= S_WDAY; continue; case 'g': /* The year corresponding to the ISO week * number but without the century. */ bp = conv_num(bp, &i, 0, 99); continue; case 'G': /* The year corresponding to the ISO week * number with century. */ do bp++; while (isdigit(*bp)); continue; case 'V': /* The ISO 8601:1988 week number as decimal */ bp = conv_num(bp, &i, 0, 53); continue; case 'Y': /* The year. */ i = TM_YEAR_BASE; /* just for data sanity... */ bp = conv_num(bp, &i, 0, 9999); tm->tm_year = i - TM_YEAR_BASE; LEGAL_ALT(ALT_E); state |= S_YEAR; continue; case 'y': /* The year within 100 years of the epoch. */ /* LEGAL_ALT(ALT_E | ALT_O); */ bp = conv_num(bp, &i, 0, 99); if (split_year) /* preserve century */ i += (tm->tm_year / 100) * 100; else { split_year = 1; if (i <= 68) i = i + 2000 - TM_YEAR_BASE; } tm->tm_year = i; state |= S_YEAR; continue; case 'Z': // time zone name case 'z': // #ifdef _WIN32 _tzset(); #else tzset(); #endif mandatory = c == 'z'; /* * We recognize all ISO 8601 formats: * Z = Zulu time/UTC * [+-]hhmm * [+-]hh:mm * [+-]hh * We recognize all RFC-822/RFC-2822 formats: * UT|GMT * North American : UTC offsets * E[DS]T = Eastern : -4 | -5 * C[DS]T = Central : -5 | -6 * M[DS]T = Mountain: -6 | -7 * P[DS]T = Pacific : -7 | -8 * Nautical/Military * [A-IL-M] = -1 ... -9 (J not used) * [N-Y] = +1 ... +12 * Note: J maybe used to denote non-nautical * local time */ if (mandatory) while (isspace(*bp)) bp++; zname = bp; switch (*bp++) { case 'G': if (*bp++ != 'M') goto namedzone; /*FALLTHROUGH*/ case 'U': if (*bp++ != 'T') goto namedzone; else if (!delim(*bp) && *bp++ != 'C') goto namedzone; /*FALLTHROUGH*/ case 'Z': if (!delim(*bp)) goto namedzone; tm->tm_isdst = 0; #ifdef TM_GMTOFF tm->TM_GMTOFF = 0; #endif #ifdef TM_ZONE tm->TM_ZONE = utc; #endif continue; case '+': neg = 0; break; case '-': neg = 1; break; default: namedzone: bp = zname; /* Nautical / Military style */ if (delim(bp[1]) && ((*bp >= 'A' && *bp <= 'I') || (*bp >= 'L' && *bp <= 'Y'))) { #ifdef TM_GMTOFF /* Argh! No 'J'! */ if (*bp >= 'A' && *bp <= 'I') tm->TM_GMTOFF = (int)*bp - ('A' - 1); else if (*bp >= 'L' && *bp <= 'M') tm->TM_GMTOFF = (int)*bp - 'A'; else if (*bp >= 'N' && *bp <= 'Y') tm->TM_GMTOFF = 'M' - (int)*bp; tm->TM_GMTOFF *= SECSPERHOUR; #endif #ifdef TM_ZONE tm->TM_ZONE = NULL; /* XXX */ #endif bp++; continue; } /* 'J' is local time */ if (delim(bp[1]) && *bp == 'J') { #ifdef TM_GMTOFF tm->TM_GMTOFF = -timezone; #endif #ifdef TM_ZONE tm->TM_ZONE = NULL; /* XXX */ #endif bp++; continue; } /* * From our 3 letter hard-coded table * XXX: Can be removed, handled by tzload() */ if (delim(bp[0]) || delim(bp[1]) || delim(bp[2]) || !delim(bp[3])) goto loadzone; ep = find_string(bp, &i, nast, NULL, 4); if (ep != NULL) { #ifdef TM_GMTOFF tm->TM_GMTOFF = (-5 - i) * SECSPERHOUR; #endif #ifdef TM_ZONE tm->TM_ZONE = __UNCONST(nast[i]); #endif bp = ep; continue; } ep = find_string(bp, &i, nadt, NULL, 4); if (ep != NULL) { tm->tm_isdst = 1; #ifdef TM_GMTOFF tm->TM_GMTOFF = (-4 - i) * SECSPERHOUR; #endif #ifdef TM_ZONE tm->TM_ZONE = __UNCONST(nadt[i]); #endif bp = ep; continue; } /* * Our current timezone */ ep = find_string(bp, &i, (const char * const *)tzname, NULL, 2); if (ep != NULL) { tm->tm_isdst = i; #ifdef TM_GMTOFF tm->TM_GMTOFF = -timezone; #endif #ifdef TM_ZONE tm->TM_ZONE = tzname[i]; #endif bp = ep; continue; } loadzone: /* * The hard way, load the zone! */ if (fromzone(&bp, tm, mandatory)) continue; goto out; } offs = 0; for (i = 0; i < 4; ) { if (isdigit(*bp)) { offs = offs * 10 + (*bp++ - '0'); i++; continue; } if (i == 2 && *bp == ':') { bp++; continue; } break; } if (isdigit(*bp)) goto out; switch (i) { case 2: offs *= SECSPERHOUR; break; case 4: i = offs % 100; offs /= 100; if (i >= SECSPERMIN) goto out; /* Convert minutes into decimal */ offs = offs * SECSPERHOUR + i * SECSPERMIN; break; default: out: if (mandatory) return NULL; bp = zname; continue; } /* ISO 8601 & RFC 3339 limit to 23:59 max */ if (offs >= (HOURSPERDAY * SECSPERHOUR)) goto out; if (neg) offs = -offs; tm->tm_isdst = 0; /* XXX */ #ifdef TM_GMTOFF tm->TM_GMTOFF = offs; #endif #ifdef TM_ZONE tm->TM_ZONE = NULL; /* XXX */ #endif continue; /* * Miscellaneous conversions. */ case 'n': /* Any kind of white-space. */ case 't': while (isspace(*bp)) bp++; LEGAL_ALT(0); continue; default: /* Unknown/unsupported conversion. */ return NULL; } } if (!HAVE_YDAY(state) && HAVE_YEAR(state)) { if (HAVE_MON(state) && HAVE_MDAY(state)) { /* calculate day of year (ordinal date) */ tm->tm_yday = start_of_month[isleap_sum(tm->tm_year, TM_YEAR_BASE)][tm->tm_mon] + (tm->tm_mday - 1); state |= S_YDAY; } else if (day_offset != -1) { /* * Set the date to the first Sunday (or Monday) * of the specified week of the year. */ if (!HAVE_WDAY(state)) { tm->tm_wday = day_offset; state |= S_WDAY; } tm->tm_yday = (7 - first_wday_of(tm->tm_year + TM_YEAR_BASE) + day_offset) % 7 + (week_offset - 1) * 7 + tm->tm_wday - day_offset; state |= S_YDAY; } } if (HAVE_YDAY(state) && HAVE_YEAR(state)) { int isleap; if (!HAVE_MON(state)) { /* calculate month of day of year */ i = 0; isleap = isleap_sum(tm->tm_year, TM_YEAR_BASE); while (tm->tm_yday >= start_of_month[isleap][i]) i++; if (i > 12) { i = 1; tm->tm_yday -= start_of_month[isleap][12]; tm->tm_year++; } tm->tm_mon = i - 1; state |= S_MON; } if (!HAVE_MDAY(state)) { /* calculate day of month */ isleap = isleap_sum(tm->tm_year, TM_YEAR_BASE); tm->tm_mday = tm->tm_yday - start_of_month[isleap][tm->tm_mon] + 1; state |= S_MDAY; } if (!HAVE_WDAY(state)) { /* calculate day of week */ i = 0; week_offset = first_wday_of(tm->tm_year); while (i++ <= tm->tm_yday) { if (week_offset++ >= 6) week_offset = 0; } tm->tm_wday = week_offset; state |= S_WDAY; } } return (char*)bp; } static const unsigned char * conv_num(const unsigned char *buf, int *dest, unsigned int llim, unsigned int ulim) { unsigned int result = 0; unsigned char ch; /* The limit also determines the number of valid digits. */ unsigned int rulim = ulim; ch = *buf; if (ch < '0' || ch > '9') return NULL; do { result *= 10; result += ch - '0'; rulim /= 10; ch = *++buf; } while ((result <= ulim) && rulim && ch >= '0' && ch <= '9'); if (result < llim || result > ulim) return NULL; *dest = result; return buf; } static const unsigned char * find_string(const unsigned char *bp, int *tgt, const char * const *n1, const char * const *n2, int c) { int i; size_t len; /* check full name - then abbreviated ones */ for (; n1 != NULL; n1 = n2, n2 = NULL) { for (i = 0; i < c; i++, n1++) { len = strlen(*n1); if (strncasecmp(*n1, (const char *)bp, len) == 0) { *tgt = i; return bp + len; } } } /* Nothing matched */ return NULL; } #endif jq-1.8.2/src/jq_parser.h0000644000175100017510000000032015215513536010546 #ifndef JQ_PARSER_H #define JQ_PARSER_H #include "locfile.h" #include "compile.h" int jq_parse(struct locfile* source, block* answer); int jq_parse_library(struct locfile* locations, block* answer); #endif jq-1.8.2/src/lexer.h0000644000175100017510000004015315215513567007713 #ifndef jq_yyHEADER_H #define jq_yyHEADER_H 1 #define jq_yyIN_HEADER 1 #line 6 "src/lexer.h" #line 8 "src/lexer.h" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif #ifdef yy_create_buffer #define jq_yy_create_buffer_ALREADY_DEFINED #else #define yy_create_buffer jq_yy_create_buffer #endif #ifdef yy_delete_buffer #define jq_yy_delete_buffer_ALREADY_DEFINED #else #define yy_delete_buffer jq_yy_delete_buffer #endif #ifdef yy_scan_buffer #define jq_yy_scan_buffer_ALREADY_DEFINED #else #define yy_scan_buffer jq_yy_scan_buffer #endif #ifdef yy_scan_string #define jq_yy_scan_string_ALREADY_DEFINED #else #define yy_scan_string jq_yy_scan_string #endif #ifdef yy_scan_bytes #define jq_yy_scan_bytes_ALREADY_DEFINED #else #define yy_scan_bytes jq_yy_scan_bytes #endif #ifdef yy_init_buffer #define jq_yy_init_buffer_ALREADY_DEFINED #else #define yy_init_buffer jq_yy_init_buffer #endif #ifdef yy_flush_buffer #define jq_yy_flush_buffer_ALREADY_DEFINED #else #define yy_flush_buffer jq_yy_flush_buffer #endif #ifdef yy_load_buffer_state #define jq_yy_load_buffer_state_ALREADY_DEFINED #else #define yy_load_buffer_state jq_yy_load_buffer_state #endif #ifdef yy_switch_to_buffer #define jq_yy_switch_to_buffer_ALREADY_DEFINED #else #define yy_switch_to_buffer jq_yy_switch_to_buffer #endif #ifdef yypush_buffer_state #define jq_yypush_buffer_state_ALREADY_DEFINED #else #define yypush_buffer_state jq_yypush_buffer_state #endif #ifdef yypop_buffer_state #define jq_yypop_buffer_state_ALREADY_DEFINED #else #define yypop_buffer_state jq_yypop_buffer_state #endif #ifdef yyensure_buffer_stack #define jq_yyensure_buffer_stack_ALREADY_DEFINED #else #define yyensure_buffer_stack jq_yyensure_buffer_stack #endif #ifdef yylex #define jq_yylex_ALREADY_DEFINED #else #define yylex jq_yylex #endif #ifdef yyrestart #define jq_yyrestart_ALREADY_DEFINED #else #define yyrestart jq_yyrestart #endif #ifdef yylex_init #define jq_yylex_init_ALREADY_DEFINED #else #define yylex_init jq_yylex_init #endif #ifdef yylex_init_extra #define jq_yylex_init_extra_ALREADY_DEFINED #else #define yylex_init_extra jq_yylex_init_extra #endif #ifdef yylex_destroy #define jq_yylex_destroy_ALREADY_DEFINED #else #define yylex_destroy jq_yylex_destroy #endif #ifdef yyget_debug #define jq_yyget_debug_ALREADY_DEFINED #else #define yyget_debug jq_yyget_debug #endif #ifdef yyset_debug #define jq_yyset_debug_ALREADY_DEFINED #else #define yyset_debug jq_yyset_debug #endif #ifdef yyget_extra #define jq_yyget_extra_ALREADY_DEFINED #else #define yyget_extra jq_yyget_extra #endif #ifdef yyset_extra #define jq_yyset_extra_ALREADY_DEFINED #else #define yyset_extra jq_yyset_extra #endif #ifdef yyget_in #define jq_yyget_in_ALREADY_DEFINED #else #define yyget_in jq_yyget_in #endif #ifdef yyset_in #define jq_yyset_in_ALREADY_DEFINED #else #define yyset_in jq_yyset_in #endif #ifdef yyget_out #define jq_yyget_out_ALREADY_DEFINED #else #define yyget_out jq_yyget_out #endif #ifdef yyset_out #define jq_yyset_out_ALREADY_DEFINED #else #define yyset_out jq_yyset_out #endif #ifdef yyget_leng #define jq_yyget_leng_ALREADY_DEFINED #else #define yyget_leng jq_yyget_leng #endif #ifdef yyget_text #define jq_yyget_text_ALREADY_DEFINED #else #define yyget_text jq_yyget_text #endif #ifdef yyget_lineno #define jq_yyget_lineno_ALREADY_DEFINED #else #define yyget_lineno jq_yyget_lineno #endif #ifdef yyset_lineno #define jq_yyset_lineno_ALREADY_DEFINED #else #define yyset_lineno jq_yyset_lineno #endif #ifdef yyget_column #define jq_yyget_column_ALREADY_DEFINED #else #define yyget_column jq_yyget_column #endif #ifdef yyset_column #define jq_yyset_column_ALREADY_DEFINED #else #define yyset_column jq_yyset_column #endif #ifdef yywrap #define jq_yywrap_ALREADY_DEFINED #else #define yywrap jq_yywrap #endif #ifdef yyget_lval #define jq_yyget_lval_ALREADY_DEFINED #else #define yyget_lval jq_yyget_lval #endif #ifdef yyset_lval #define jq_yyset_lval_ALREADY_DEFINED #else #define yyset_lval jq_yyset_lval #endif #ifdef yyget_lloc #define jq_yyget_lloc_ALREADY_DEFINED #else #define yyget_lloc jq_yyget_lloc #endif #ifdef yyset_lloc #define jq_yyset_lloc_ALREADY_DEFINED #else #define yyset_lloc jq_yyset_lloc #endif #ifdef yyalloc #define jq_yyalloc_ALREADY_DEFINED #else #define yyalloc jq_yyalloc #endif #ifdef yyrealloc #define jq_yyrealloc_ALREADY_DEFINED #else #define yyrealloc jq_yyrealloc #endif #ifdef yyfree #define jq_yyfree_ALREADY_DEFINED #else #define yyfree jq_yyfree #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ /* begin standard C++ headers. */ /* TODO: this is always defined, so inline it */ #define yyconst const #if defined(__GNUC__) && __GNUC__ >= 3 #define yynoreturn __attribute__((__noreturn__)) #else #define yynoreturn #endif /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; #endif /* For convenience, these vars (plus the bison vars far below) are macros in the reentrant scanner. */ #define yyin yyg->yyin_r #define yyout yyg->yyout_r #define yyextra yyg->yyextra_r #define yyleng yyg->yyleng_r #define yytext yyg->yytext_r #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ void yyrestart ( FILE *input_file , yyscan_t yyscanner ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); void yypop_buffer_state ( yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); void *yyalloc ( yy_size_t , yyscan_t yyscanner ); void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); void yyfree ( void * , yyscan_t yyscanner ); /* Begin user sect3 */ #define jq_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r #ifdef YY_HEADER_EXPORT_START_CONDITIONS #define INITIAL 0 #define IN_PAREN 1 #define IN_BRACKET 2 #define IN_BRACE 3 #define IN_QQINTERP 4 #define IN_QQSTRING 5 #define IN_COMMENT 6 #endif #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #define YY_EXTRA_TYPE int int yylex_init (yyscan_t* scanner); int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy ( yyscan_t yyscanner ); int yyget_debug ( yyscan_t yyscanner ); void yyset_debug ( int debug_flag , yyscan_t yyscanner ); YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); FILE *yyget_in ( yyscan_t yyscanner ); void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); FILE *yyget_out ( yyscan_t yyscanner ); void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); int yyget_leng ( yyscan_t yyscanner ); char *yyget_text ( yyscan_t yyscanner ); int yyget_lineno ( yyscan_t yyscanner ); void yyset_lineno ( int _line_number , yyscan_t yyscanner ); int yyget_column ( yyscan_t yyscanner ); void yyset_column ( int _column_no , yyscan_t yyscanner ); YYSTYPE * yyget_lval ( yyscan_t yyscanner ); void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap ( yyscan_t yyscanner ); #else extern int yywrap ( yyscan_t yyscanner ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); #define YY_DECL int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ /* yy_get_previous_state - get the state just before the EOB char was reached */ #undef YY_NEW_FILE #undef YY_FLUSH_BUFFER #undef yy_set_bol #undef yy_new_buffer #undef yy_set_interactive #undef YY_DO_BEFORE_ACTION #ifdef YY_DECL_IS_OURS #undef YY_DECL_IS_OURS #undef YY_DECL #endif #ifndef jq_yy_create_buffer_ALREADY_DEFINED #undef yy_create_buffer #endif #ifndef jq_yy_delete_buffer_ALREADY_DEFINED #undef yy_delete_buffer #endif #ifndef jq_yy_scan_buffer_ALREADY_DEFINED #undef yy_scan_buffer #endif #ifndef jq_yy_scan_string_ALREADY_DEFINED #undef yy_scan_string #endif #ifndef jq_yy_scan_bytes_ALREADY_DEFINED #undef yy_scan_bytes #endif #ifndef jq_yy_init_buffer_ALREADY_DEFINED #undef yy_init_buffer #endif #ifndef jq_yy_flush_buffer_ALREADY_DEFINED #undef yy_flush_buffer #endif #ifndef jq_yy_load_buffer_state_ALREADY_DEFINED #undef yy_load_buffer_state #endif #ifndef jq_yy_switch_to_buffer_ALREADY_DEFINED #undef yy_switch_to_buffer #endif #ifndef jq_yypush_buffer_state_ALREADY_DEFINED #undef yypush_buffer_state #endif #ifndef jq_yypop_buffer_state_ALREADY_DEFINED #undef yypop_buffer_state #endif #ifndef jq_yyensure_buffer_stack_ALREADY_DEFINED #undef yyensure_buffer_stack #endif #ifndef jq_yylex_ALREADY_DEFINED #undef yylex #endif #ifndef jq_yyrestart_ALREADY_DEFINED #undef yyrestart #endif #ifndef jq_yylex_init_ALREADY_DEFINED #undef yylex_init #endif #ifndef jq_yylex_init_extra_ALREADY_DEFINED #undef yylex_init_extra #endif #ifndef jq_yylex_destroy_ALREADY_DEFINED #undef yylex_destroy #endif #ifndef jq_yyget_debug_ALREADY_DEFINED #undef yyget_debug #endif #ifndef jq_yyset_debug_ALREADY_DEFINED #undef yyset_debug #endif #ifndef jq_yyget_extra_ALREADY_DEFINED #undef yyget_extra #endif #ifndef jq_yyset_extra_ALREADY_DEFINED #undef yyset_extra #endif #ifndef jq_yyget_in_ALREADY_DEFINED #undef yyget_in #endif #ifndef jq_yyset_in_ALREADY_DEFINED #undef yyset_in #endif #ifndef jq_yyget_out_ALREADY_DEFINED #undef yyget_out #endif #ifndef jq_yyset_out_ALREADY_DEFINED #undef yyset_out #endif #ifndef jq_yyget_leng_ALREADY_DEFINED #undef yyget_leng #endif #ifndef jq_yyget_text_ALREADY_DEFINED #undef yyget_text #endif #ifndef jq_yyget_lineno_ALREADY_DEFINED #undef yyget_lineno #endif #ifndef jq_yyset_lineno_ALREADY_DEFINED #undef yyset_lineno #endif #ifndef jq_yyget_column_ALREADY_DEFINED #undef yyget_column #endif #ifndef jq_yyset_column_ALREADY_DEFINED #undef yyset_column #endif #ifndef jq_yywrap_ALREADY_DEFINED #undef yywrap #endif #ifndef jq_yyget_lval_ALREADY_DEFINED #undef yyget_lval #endif #ifndef jq_yyset_lval_ALREADY_DEFINED #undef yyset_lval #endif #ifndef jq_yyget_lloc_ALREADY_DEFINED #undef yyget_lloc #endif #ifndef jq_yyset_lloc_ALREADY_DEFINED #undef yyset_lloc #endif #ifndef jq_yyalloc_ALREADY_DEFINED #undef yyalloc #endif #ifndef jq_yyrealloc_ALREADY_DEFINED #undef yyrealloc #endif #ifndef jq_yyfree_ALREADY_DEFINED #undef yyfree #endif #ifndef jq_yytext_ALREADY_DEFINED #undef yytext #endif #ifndef jq_yyleng_ALREADY_DEFINED #undef yyleng #endif #ifndef jq_yyin_ALREADY_DEFINED #undef yyin #endif #ifndef jq_yyout_ALREADY_DEFINED #undef yyout #endif #ifndef jq_yy_flex_debug_ALREADY_DEFINED #undef yy_flex_debug #endif #ifndef jq_yylineno_ALREADY_DEFINED #undef yylineno #endif #ifndef jq_yytables_fload_ALREADY_DEFINED #undef yytables_fload #endif #ifndef jq_yytables_destroy_ALREADY_DEFINED #undef yytables_destroy #endif #ifndef jq_yyTABLES_NAME_ALREADY_DEFINED #undef yyTABLES_NAME #endif #line 137 "src/lexer.l" #line 739 "src/lexer.h" #undef jq_yyIN_HEADER #endif /* jq_yyHEADER_H */ jq-1.8.2/src/compile.c0000644000175100017510000012715015215513536010216 #include #include #include #include #include "compile.h" #include "bytecode.h" #include "locfile.h" #include "jv_alloc.h" #include "util.h" /* The intermediate representation for jq filters is as a sequence of struct inst, which form a doubly-linked list via the next and prev pointers. A "block" represents a sequence of "struct inst", which may be empty. Blocks are generated by the parser bottom-up, so may have free variables (refer to things not defined). See inst.bound_by and inst.symbol. */ struct inst { struct inst* next; struct inst* prev; opcode op; struct { uint16_t intval; struct inst* target; jv constant; const struct cfunction* cfunc; } imm; struct locfile* locfile; location source; // Binding // An instruction requiring binding (for parameters/variables/functions) // is in one of three states: // inst->bound_by = NULL - Unbound free variable // inst->bound_by = inst - This instruction binds a variable // inst->bound_by = other - Uses variable bound by other instruction // Unbound instructions (references to other things that may or may not // exist) are created by "gen_foo_unbound", and bindings are created by // block_bind(definition, body), which binds all instructions in // body which are unbound and refer to "definition" by name. struct inst* bound_by; char* symbol; int any_unbound; int referenced; int nformals; int nactuals; block subfn; // used by CLOSURE_CREATE (body of function) block arglist; // used by CLOSURE_CREATE (formals) and CALL_JQ (arguments) // This instruction is compiled as part of which function? // (only used during block_compile) struct bytecode* compiled; int bytecode_pos; // position just after this insn }; static inst* inst_new(opcode op) { inst* i = jv_mem_alloc(sizeof(inst)); i->next = i->prev = 0; i->op = op; i->bytecode_pos = -1; i->bound_by = 0; i->symbol = 0; i->any_unbound = 0; i->referenced = 0; i->nformals = -1; i->nactuals = -1; i->subfn = gen_noop(); i->arglist = gen_noop(); i->source = UNKNOWN_LOCATION; i->locfile = 0; return i; } static void inst_free(struct inst* i) { jv_mem_free(i->symbol); block_free(i->subfn); block_free(i->arglist); if (i->locfile) locfile_free(i->locfile); if (opcode_describe(i->op)->flags & OP_HAS_CONSTANT) { jv_free(i->imm.constant); } jv_mem_free(i); } static block inst_block(inst* i) { block b = {i,i}; return b; } int block_is_single(block b) { return b.first && b.first == b.last; } static inst* block_take(block* b) { if (b->first == 0) return 0; inst* i = b->first; if (i->next) { i->next->prev = 0; b->first = i->next; i->next = 0; } else { b->first = 0; b->last = 0; } return i; } block gen_location(location loc, struct locfile* l, block b) { for (inst* i = b.first; i; i = i->next) { if (i->source.start == UNKNOWN_LOCATION.start && i->source.end == UNKNOWN_LOCATION.end) { i->source = loc; i->locfile = locfile_retain(l); } } return b; } block gen_noop(void) { block b = {0,0}; return b; } int block_is_noop(block b) { return (b.first == 0 && b.last == 0); } block gen_op_simple(opcode op) { assert(opcode_describe(op)->length == 1); return inst_block(inst_new(op)); } block gen_error(jv constant) { assert(opcode_describe(ERRORK)->flags & OP_HAS_CONSTANT); inst *i = inst_new(ERRORK); i->imm.constant = constant; return inst_block(i); } block gen_const(jv constant) { assert(opcode_describe(LOADK)->flags & OP_HAS_CONSTANT); inst* i = inst_new(LOADK); i->imm.constant = constant; return inst_block(i); } block gen_const_global(jv constant, const char *name) { assert((opcode_describe(STORE_GLOBAL)->flags & (OP_HAS_CONSTANT | OP_HAS_VARIABLE | OP_HAS_BINDING)) == (OP_HAS_CONSTANT | OP_HAS_VARIABLE | OP_HAS_BINDING)); inst* i = inst_new(STORE_GLOBAL); i->imm.constant = constant; i->symbol = strdup(name); i->any_unbound = 0; return inst_block(i); } block gen_op_pushk_under(jv constant) { assert(opcode_describe(PUSHK_UNDER)->flags & OP_HAS_CONSTANT); inst* i = inst_new(PUSHK_UNDER); i->imm.constant = constant; return inst_block(i); } int block_is_const(block b) { return (block_is_single(b) && (b.first->op == LOADK || b.first->op == PUSHK_UNDER)); } jv_kind block_const_kind(block b) { assert(block_is_const(b)); return jv_get_kind(b.first->imm.constant); } jv block_const(block b) { assert(block_is_const(b)); return jv_copy(b.first->imm.constant); } block gen_op_target(opcode op, block target) { assert(opcode_describe(op)->flags & OP_HAS_BRANCH); assert(target.last); inst* i = inst_new(op); i->imm.target = target.last; return inst_block(i); } block gen_op_targetlater(opcode op) { assert(opcode_describe(op)->flags & OP_HAS_BRANCH); inst* i = inst_new(op); i->imm.target = 0; return inst_block(i); } void inst_set_target(block b, block target) { assert(block_is_single(b)); assert(opcode_describe(b.first->op)->flags & OP_HAS_BRANCH); assert(target.last); b.first->imm.target = target.last; } block gen_op_unbound(opcode op, const char* name) { assert(opcode_describe(op)->flags & OP_HAS_BINDING); inst* i = inst_new(op); i->symbol = strdup(name); i->any_unbound = 1; return inst_block(i); } block gen_op_var_fresh(opcode op, const char* name) { assert(opcode_describe(op)->flags & OP_HAS_VARIABLE); block b = gen_op_unbound(op, name); b.first->bound_by = b.first; return b; } block gen_op_bound(opcode op, block binder) { assert(block_is_single(binder)); block b = gen_op_unbound(op, binder.first->symbol); b.first->bound_by = binder.first; b.first->any_unbound = 0; return b; } block gen_dictpair(block k, block v) { return BLOCK(gen_subexp(k), gen_subexp(v), gen_op_simple(INSERT)); } static void inst_join(inst* a, inst* b) { assert(a && b); assert(!a->next); assert(!b->prev); a->next = b; b->prev = a; } void block_append(block* b, block b2) { if (b2.first) { if (b->last) { inst_join(b->last, b2.first); } else { b->first = b2.first; } b->last = b2.last; } } block block_join(block a, block b) { block c = a; block_append(&c, b); return c; } int block_has_only_binders_and_imports(block binders, int bindflags) { bindflags |= OP_HAS_BINDING; for (inst* curr = binders.first; curr; curr = curr->next) { if ((opcode_describe(curr->op)->flags & bindflags) != bindflags && curr->op != DEPS && curr->op != MODULEMETA) { return 0; } } return 1; } static int inst_is_binder(inst *i, int bindflags) { return !((opcode_describe(i->op)->flags & bindflags) != bindflags && i->op != MODULEMETA); } int block_has_only_binders(block binders, int bindflags) { bindflags |= OP_HAS_BINDING; bindflags &= ~OP_BIND_WILDCARD; for (inst* curr = binders.first; curr; curr = curr->next) { if ((opcode_describe(curr->op)->flags & bindflags) != bindflags && curr->op != MODULEMETA) { return 0; } } return 1; } // Count a call site's actual params static int block_count_actuals(block b) { int args = 0; for (inst* i = b.first; i; i = i->next) { switch (i->op) { default: assert(0 && "Unknown function type"); break; case CLOSURE_CREATE: case CLOSURE_PARAM: case CLOSURE_CREATE_C: args++; break; } } return args; } static int block_bind_subblock_inner(int* any_unbound, block binder, block body, int bindflags, int break_distance) { assert(block_is_single(binder)); assert((opcode_describe(binder.first->op)->flags & bindflags) == (bindflags & ~OP_BIND_WILDCARD)); assert(binder.first->symbol); assert(binder.first->bound_by == 0 || binder.first->bound_by == binder.first); assert(break_distance >= 0); binder.first->bound_by = binder.first; int nrefs = 0; for (inst* i = body.first; i; i = i->next) { if (i->any_unbound == 0) continue; int flags = opcode_describe(i->op)->flags; if ((flags & bindflags) == (bindflags & ~OP_BIND_WILDCARD) && i->bound_by == 0 && (!strcmp(i->symbol, binder.first->symbol) || // Check for break/break2/break3; see parser.y ((bindflags & OP_BIND_WILDCARD) && i->symbol[0] == '*' && break_distance <= 3 && (i->symbol[1] == '1' + break_distance) && i->symbol[2] == '\0'))) { // bind this instruction if (i->nactuals == -1 || i->nactuals == binder.first->nformals) { i->bound_by = binder.first; nrefs++; } } else if ((flags & bindflags) == (bindflags & ~OP_BIND_WILDCARD) && i->bound_by != 0 && !strncmp(binder.first->symbol, "*anonlabel", sizeof("*anonlabel") - 1) && !strncmp(i->symbol, "*anonlabel", sizeof("*anonlabel") - 1)) { // Increment the break distance required for this binder to match // a break whenever we come across a STOREV of *anonlabel... break_distance++; } i->any_unbound = (i->symbol && !i->bound_by); // binding recurses into closures nrefs += block_bind_subblock_inner(&i->any_unbound, binder, i->subfn, bindflags, break_distance); // binding recurses into argument list nrefs += block_bind_subblock_inner(&i->any_unbound, binder, i->arglist, bindflags, break_distance); if (i->any_unbound) *any_unbound = 1; } return nrefs; } static int block_bind_subblock(block binder, block body, int bindflags, int break_distance) { int any_unbound; return block_bind_subblock_inner(&any_unbound, binder, body, bindflags, break_distance); } static int block_bind_each(block binder, block body, int bindflags) { assert(block_has_only_binders(binder, bindflags)); bindflags |= OP_HAS_BINDING; int nrefs = 0; for (inst* curr = binder.first; curr; curr = curr->next) { nrefs += block_bind_subblock(inst_block(curr), body, bindflags, 0); } return nrefs; } static block block_bind(block binder, block body, int bindflags) { block_bind_each(binder, body, bindflags); return block_join(binder, body); } block block_bind_library(block binder, block body, int bindflags, const char *libname) { bindflags |= OP_HAS_BINDING; int matchlen = (libname == NULL) ? 0 : strlen(libname); char *matchname = jv_mem_alloc(matchlen+2+1); matchname[0] = '\0'; if (libname != NULL && libname[0] != '\0') { strcpy(matchname,libname); strcpy(matchname+matchlen, "::"); matchlen += 2; } assert(block_has_only_binders(binder, bindflags)); for (inst *curr = binder.last; curr; curr = curr->prev) { int bindflags2 = bindflags; char* cname = curr->symbol; char* tname = jv_mem_alloc(strlen(curr->symbol)+matchlen+1); strcpy(tname, matchname); strcpy(tname+matchlen, curr->symbol); // Ew if ((opcode_describe(curr->op)->flags & (OP_HAS_VARIABLE | OP_HAS_CONSTANT))) bindflags2 = OP_HAS_VARIABLE | OP_HAS_BINDING; // This mutation is ugly, even if we undo it curr->symbol = tname; block_bind_subblock(inst_block(curr), body, bindflags2, 0); curr->symbol = cname; free(tname); } free(matchname); return body; // We don't return a join because we don't want those sticking around... } static inst* block_take_last(block* b) { inst* i = b->last; if (i == 0) return 0; if (i->prev) { i->prev->next = i->next; b->last = i->prev; i->prev = 0; } else { b->first = 0; b->last = 0; } return i; } // Binds a sequence of binders, which *must not* already be bound to each other, // to body, throwing away unreferenced defs block block_bind_referenced(block binder, block body, int bindflags) { assert(block_has_only_binders(binder, bindflags)); bindflags |= OP_HAS_BINDING; inst* curr; while ((curr = block_take_last(&binder))) { block b = inst_block(curr); if (block_bind_subblock(b, body, bindflags, 0) == 0) { block_free(b); } else { body = BLOCK(b, body); } } return body; } block block_bind_self(block binder, int bindflags) { assert(block_has_only_binders(binder, bindflags)); bindflags |= OP_HAS_BINDING; block body = gen_noop(); inst* curr; while ((curr = block_take_last(&binder))) { block b = inst_block(curr); block_bind_subblock(b, body, bindflags, 0); body = BLOCK(b, body); } return body; } static void block_mark_referenced(block body) { int saw_top = 0; for (inst* i = body.last; i; i = i->prev) { if (saw_top && i->bound_by == i && !i->referenced) continue; if (i->op == TOP) { saw_top = 1; } if (i->bound_by) { i->bound_by->referenced = 1; } block_mark_referenced(i->arglist); block_mark_referenced(i->subfn); } } block block_drop_unreferenced(block body) { block_mark_referenced(body); block refd = gen_noop(); inst* curr; while ((curr = block_take(&body))) { if (curr->bound_by == curr && !curr->referenced) { inst_free(curr); } else { refd = BLOCK(refd, inst_block(curr)); } } return refd; } jv block_take_imports(block* body) { jv imports = jv_array(); /* Parser should never generate TOP before imports */ assert(!(body->first && body->first->op == TOP && body->first->next && (body->first->next->op == MODULEMETA || body->first->next->op == DEPS))); while (body->first && (body->first->op == MODULEMETA || body->first->op == DEPS)) { inst* dep = block_take(body); if (dep->op == DEPS) { imports = jv_array_append(imports, jv_copy(dep->imm.constant)); } inst_free(dep); } return imports; } jv block_list_funcs(block body, int omit_underscores) { jv funcs = jv_object(); // Use the keys for set semantics. for (inst *pos = body.first; pos != NULL; pos = pos->next) { if (pos->op == CLOSURE_CREATE || pos->op == CLOSURE_CREATE_C) { if (pos->symbol != NULL && (!omit_underscores || pos->symbol[0] != '_')) { funcs = jv_object_set(funcs, jv_string_fmt("%s/%i", pos->symbol, pos->nformals), jv_null()); } } } return jv_keys_unsorted(funcs); } block gen_module(block metadata) { assert(block_is_const(metadata) && block_const_kind(metadata) == JV_KIND_OBJECT); inst* i = inst_new(MODULEMETA); i->imm.constant = block_const(metadata); if (jv_get_kind(i->imm.constant) != JV_KIND_OBJECT) i->imm.constant = jv_object_set(jv_object(), jv_string("metadata"), i->imm.constant); block_free(metadata); return inst_block(i); } jv block_module_meta(block b) { if (b.first != NULL && b.first->op == MODULEMETA) return jv_copy(b.first->imm.constant); return jv_null(); } block gen_import(jv name, jv as, int is_data) { assert(jv_get_kind(name) == JV_KIND_STRING); assert(!jv_is_valid(as) || jv_get_kind(as) == JV_KIND_STRING); inst* i = inst_new(DEPS); jv meta = jv_object(); if (jv_is_valid(as)) meta = jv_object_set(meta, jv_string("as"), as); else jv_free(as); meta = jv_object_set(meta, jv_string("is_data"), is_data ? jv_true() : jv_false()); meta = jv_object_set(meta, jv_string("relpath"), name); i->imm.constant = meta; return inst_block(i); } block gen_import_meta(block import, block metadata) { assert(block_is_single(import) && import.first->op == DEPS); assert(block_is_const(metadata) && block_const_kind(metadata) == JV_KIND_OBJECT); inst *i = import.first; i->imm.constant = jv_object_merge(block_const(metadata), i->imm.constant); block_free(metadata); return import; } block gen_function(const char* name, block formals, block body) { inst* i = inst_new(CLOSURE_CREATE); int nformals = 0; for (inst* i = formals.last; i; i = i->prev) { nformals++; i->nformals = 0; if (i->op == CLOSURE_PARAM_REGULAR) { i->op = CLOSURE_PARAM; body = gen_var_binding(gen_call(i->symbol, gen_noop()), i->symbol, body); } block_bind_subblock(inst_block(i), body, OP_IS_CALL_PSEUDO | OP_HAS_BINDING, 0); } i->subfn = body; i->symbol = strdup(name); i->any_unbound = -1; i->nformals = nformals; i->arglist = formals; block b = inst_block(i); block_bind_subblock(b, b, OP_IS_CALL_PSEUDO | OP_HAS_BINDING, 0); return b; } block gen_param_regular(const char* name) { return gen_op_unbound(CLOSURE_PARAM_REGULAR, name); } block gen_param(const char* name) { return gen_op_unbound(CLOSURE_PARAM, name); } block gen_lambda(block body) { return gen_function("@lambda", gen_noop(), body); } block gen_call(const char* name, block args) { block b = gen_op_unbound(CALL_JQ, name); b.first->arglist = args; b.first->nactuals = block_count_actuals(b.first->arglist); return b; } block gen_subexp(block a) { if (block_is_noop(a)) { return gen_op_simple(DUP); } if (block_is_single(a) && a.first->op == LOADK) { jv c = block_const(a); block_free(a); return gen_op_pushk_under(c); } return BLOCK(gen_op_simple(SUBEXP_BEGIN), a, gen_op_simple(SUBEXP_END)); } block gen_both(block a, block b) { block jump = gen_op_targetlater(JUMP); block fork = gen_op_target(FORK, jump); block c = BLOCK(fork, a, jump, b); inst_set_target(jump, c); return c; } block gen_const_object(block expr) { int is_const = 1; jv o = jv_object(); jv k = jv_null(); jv v = jv_null(); for (inst *i = expr.first; i; i = i->next) { if (i->op == PUSHK_UNDER) { k = jv_copy(i->imm.constant); i = i->next; } else if (i->op != SUBEXP_BEGIN || i->next == NULL || i->next->op != LOADK || i->next->next == NULL || i->next->next->op != SUBEXP_END) { is_const = 0; break; } else { k = jv_copy(i->next->imm.constant); i = i->next->next->next; } if (i != NULL && i->op == PUSHK_UNDER) { v = jv_copy(i->imm.constant); i = i->next; } else if (i == NULL || i->op != SUBEXP_BEGIN || i->next == NULL || i->next->op != LOADK || i->next->next == NULL || i->next->next->op != SUBEXP_END) { is_const = 0; break; } else { v = jv_copy(i->next->imm.constant); i = i->next->next->next; } if (i == NULL || i->op != INSERT) { is_const = 0; break; } if (jv_get_kind(k) != JV_KIND_STRING) { is_const = 0; break; } o = jv_object_set(o, k, v); k = jv_null(); v = jv_null(); } if (!is_const) { jv_free(o); jv_free(k); jv_free(v); block b = {0,0}; return b; } block_free(expr); return gen_const(o); } static block gen_const_array(block expr) { /* * An expr of all constant elements looks like this: * * 0009 FORK 0027 * 0011 FORK 0023 * 0013 FORK 0019 * 0015 LOADK 1 * 0017 JUMP 0021 * 0019 LOADK 2 * 0021 JUMP 0025 * 0023 LOADK 3 * 0025 JUMP 0029 * 0027 LOADK 4 * * That's: N-1 commas for N elements, N LOADKs, and a JUMP between * every LOADK. The sequence ends in a LOADK. Any deviation and it's * not a list of constants. * * Here we check for this pattern almost exactly. We don't check that * the targets of the FORK and JUMP instructions are in the right * sequence. */ int all_const = 1; int commas = 0; int normal = 1; jv a = jv_array(); for (inst *i = expr.first; i; i = i->next) { if (i->op == FORK) { commas++; if (i->imm.target == NULL || i->imm.target->op != JUMP || jv_array_length(jv_copy(a)) > 0) { normal = 0; break; } } else if (all_const && i->op == LOADK) { if (i->next != NULL && i->next->op != JUMP) { normal = 0; break; } a = jv_array_append(a, jv_copy(i->imm.constant)); } else if (i->op != JUMP || i->imm.target == NULL || i->imm.target->op != LOADK) { all_const = 0; } } if (all_const && normal && (expr.last == NULL || expr.last->op == LOADK) && jv_array_length(jv_copy(a)) == commas + 1) { block_free(expr); return gen_const(a); } jv_free(a); block b = {0,0}; return b; } block gen_collect(block expr) { block const_array = gen_const_array(expr); if (const_array.first != NULL) return const_array; block array_var = gen_op_var_fresh(STOREV, "collect"); block c = BLOCK(gen_op_simple(DUP), gen_const(jv_array()), array_var); block tail = BLOCK(gen_op_bound(APPEND, array_var), gen_op_simple(BACKTRACK)); return BLOCK(c, gen_op_target(FORK, tail), expr, tail, gen_op_bound(LOADVN, array_var)); } static block bind_matcher(block matcher, block body) { // cannot call block_bind(matcher, body) because that requires // block_has_only_binders(matcher), which is not true here as matchers // may also contain code to extract the correct elements for (inst* i = matcher.first; i; i = i->next) { if ((i->op == STOREV || i->op == STOREVN) && !i->bound_by) block_bind_subblock(inst_block(i), body, OP_HAS_VARIABLE, 0); } return BLOCK(matcher, body); } // Extract destructuring var names from the block // *vars should be a jv_object (for set semantics) static void block_get_unbound_vars(block b, jv *vars) { assert(vars != NULL); assert(jv_get_kind(*vars) == JV_KIND_OBJECT); for (inst* i = b.first; i; i = i->next) { if (i->subfn.first) { block_get_unbound_vars(i->subfn, vars); continue; } if ((i->op == STOREV || i->op == STOREVN) && i->bound_by == NULL) { *vars = jv_object_set(*vars, jv_string(i->symbol), jv_true()); } } } /* Build wrappers around destructuring matchers so that we can chain them * when we have errors. The approach is as follows: * DESTRUCTURE_ALT NEXT_MATCHER (unless last matcher) * existing_matcher_block * JUMP BODY */ static block bind_alternation_matchers(block matchers, block body) { block preamble = {0}; block altmatchers = {0}; block mb = {0}; block final_matcher = matchers; // Pass through the matchers to find all destructured names. while (final_matcher.first && final_matcher.first->op == DESTRUCTURE_ALT) { block_append(&altmatchers, inst_block(block_take(&final_matcher))); } // We don't have any alternations here, so we can use the simplest case. if (altmatchers.first == NULL) { return bind_matcher(final_matcher, body); } // Collect var names jv all_vars = jv_object(); block_get_unbound_vars(altmatchers, &all_vars); block_get_unbound_vars(final_matcher, &all_vars); // We need a preamble of STOREVs to which to bind the matchers and the body. jv_object_keys_foreach(all_vars, key) { preamble = BLOCK(preamble, gen_op_simple(DUP), gen_const(jv_null()), gen_op_unbound(STOREV, jv_string_value(key))); jv_free(key); } jv_free(all_vars); // Now we build each matcher in turn for (inst *i = altmatchers.first; i; i = i->next) { block submatcher = i->subfn; // If we're successful, jump to the end of the matchers submatcher = BLOCK(submatcher, gen_op_target(JUMP, final_matcher)); // DESTRUCTURE_ALT to the end of this submatcher so we can skip to the next one on error mb = BLOCK(mb, gen_op_target(DESTRUCTURE_ALT, submatcher), submatcher); // We're done with this inst and we don't want it anymore // But we can't let it free the submatcher block. i->subfn.first = i->subfn.last = NULL; } // We're done with these insts now. block_free(altmatchers); return bind_matcher(preamble, BLOCK(mb, final_matcher, body)); } block gen_reduce(block source, block matcher, block init, block body) { block res_var = gen_op_var_fresh(STOREV, "reduce"); block loop = BLOCK(gen_op_simple(DUPN), source, bind_alternation_matchers(matcher, BLOCK(gen_op_bound(LOADVN, res_var), body, gen_op_bound(STOREV, res_var))), gen_op_simple(BACKTRACK)); return BLOCK(gen_op_simple(DUP), init, res_var, gen_op_target(FORK, loop), loop, gen_op_bound(LOADVN, res_var)); } block gen_foreach(block source, block matcher, block init, block update, block extract) { block state_var = gen_op_var_fresh(STOREV, "foreach"); return BLOCK(gen_op_simple(DUP), init, state_var, gen_op_simple(DUP), // get a value from the source expression: source, // destructure the value into variable(s) for all the code // in the body to see bind_alternation_matchers(matcher, // load the loop state variable BLOCK(gen_op_bound(LOADVN, state_var), // generate updated state update, // save the updated state for value extraction gen_op_simple(DUP), // save new state gen_op_bound(STOREV, state_var), // extract an output... extract))); } block gen_definedor(block a, block b) { // var found := false block found_var = gen_op_var_fresh(STOREV, "found"); block init = BLOCK(gen_op_simple(DUP), gen_const(jv_false()), found_var); // if found, backtrack. Otherwise execute b block backtrack = gen_op_simple(BACKTRACK); block tail = BLOCK(gen_op_simple(DUP), gen_op_bound(LOADV, found_var), gen_op_target(JUMP_F, backtrack), backtrack, gen_op_simple(POP), b); // try again block if_notfound = gen_op_simple(BACKTRACK); // found := true, produce result block if_found = BLOCK(gen_op_simple(DUP), gen_const(jv_true()), gen_op_bound(STOREV, found_var), gen_op_target(JUMP, tail)); return BLOCK(init, gen_op_target(FORK, if_notfound), a, gen_op_target(JUMP_F, if_found), if_found, if_notfound, tail); } int block_has_main(block top) { for (inst *c = top.first; c; c = c->next) { if (c->op == TOP) return 1; } return 0; } int block_is_funcdef(block b) { if (b.first != NULL && b.first->op == CLOSURE_CREATE) return 1; return 0; } block gen_condbranch(block iftrue, block iffalse) { iftrue = BLOCK(iftrue, gen_op_target(JUMP, iffalse)); return BLOCK(gen_op_target(JUMP_F, iftrue), iftrue, iffalse); } block gen_and(block a, block b) { // a and b = if a then (if b then true else false) else false return BLOCK(gen_op_simple(DUP), a, gen_condbranch(BLOCK(gen_op_simple(POP), b, gen_condbranch(gen_const(jv_true()), gen_const(jv_false()))), BLOCK(gen_op_simple(POP), gen_const(jv_false())))); } block gen_or(block a, block b) { // a or b = if a then true else (if b then true else false) return BLOCK(gen_op_simple(DUP), a, gen_condbranch(BLOCK(gen_op_simple(POP), gen_const(jv_true())), BLOCK(gen_op_simple(POP), b, gen_condbranch(gen_const(jv_true()), gen_const(jv_false()))))); } block gen_destructure_alt(block matcher) { for (inst *i = matcher.first; i; i = i->next) { if (i->op == STOREV) { i->op = STOREVN; } } inst* i = inst_new(DESTRUCTURE_ALT); i->subfn = matcher; return inst_block(i); } block gen_var_binding(block var, const char* name, block body) { return gen_destructure(var, gen_op_unbound(STOREV, name), body); } block gen_array_matcher(block left, block curr) { int index; if (block_is_noop(left)) index = 0; else { // `left` was returned by this function, so the third inst is the // constant containing the previously used index assert(left.first->op == DUP); assert(left.first->next != NULL); inst *i = NULL; if (left.first->next->op == PUSHK_UNDER) { i = left.first->next; } else { assert(left.first->next->op == SUBEXP_BEGIN); assert(left.first->next->next->op == LOADK); i = left.first->next->next; } index = 1 + (int) jv_number_value(i->imm.constant); } // `left` goes at the end so that the const index is in a predictable place return BLOCK(gen_op_simple(DUP), gen_subexp(gen_const(jv_number(index))), gen_op_simple(INDEX), curr, left); } block gen_object_matcher(block name, block curr) { return BLOCK(gen_op_simple(DUP), gen_subexp(name), gen_op_simple(INDEX), curr); } block gen_destructure(block var, block matchers, block body) { // var bindings can be added after coding the program; leave the TOP first. block top = gen_noop(); if (body.first && body.first->op == TOP) top = inst_block(block_take(&body)); if (matchers.first && matchers.first->op == DESTRUCTURE_ALT) { block_append(&var, gen_op_simple(DUP)); } else { top = BLOCK(top, gen_op_simple(DUP)); } return BLOCK(top, gen_subexp(var), gen_op_simple(POP), bind_alternation_matchers(matchers, body)); } // Like gen_var_binding(), but bind `break`'s wildcard unbound variable static block gen_wildvar_binding(block var, const char* name, block body) { return BLOCK(gen_op_simple(DUP), var, block_bind(gen_op_unbound(STOREV, name), body, OP_HAS_VARIABLE | OP_BIND_WILDCARD)); } block gen_cond(block cond, block iftrue, block iffalse) { return BLOCK(gen_op_simple(DUP), BLOCK(gen_subexp(cond), gen_op_simple(POP)), gen_condbranch(BLOCK(gen_op_simple(POP), iftrue), BLOCK(gen_op_simple(POP), iffalse))); } block gen_try(block exp, block handler) { /* * Produce: * * TRY_BEGIN handler * * TRY_END * JUMP past_handler * handler: * past_handler: * * If backtracks then TRY_BEGIN will backtrack. * * If produces a value then we'll execute whatever bytecode follows * this sequence. If that code raises an exception, then TRY_END will wrap * and re-raise that exception, and TRY_BEGIN will unwrap and re-raise the * exception (see jq_next()). * * If raises then the TRY_BEGIN will see a non-wrapped exception and * will jump to the handler (note the TRY_END will not execute in this case), * and if the handler produces any values, then we'll execute whatever * bytecode follows this sequence. Note that TRY_END will not execute in * this case, so if the handler raises an exception, or code past the handler * raises an exception, then that exception won't be wrapped and re-raised, * and the TRY_BEGIN will not catch it because it does not stack_save() when * it branches to the handler. */ if (block_is_noop(handler)) handler = BLOCK(gen_op_simple(DUP), gen_op_simple(POP)); block jump = gen_op_target(JUMP, handler); return BLOCK(gen_op_target(TRY_BEGIN, jump), exp, gen_op_simple(TRY_END), jump, handler); } block gen_label(const char *label, block exp) { block cond = gen_call("_equal", BLOCK(gen_lambda(gen_noop()), gen_lambda(gen_op_unbound(LOADV, label)))); return gen_wildvar_binding(gen_op_simple(GENLABEL), label, BLOCK(gen_op_simple(POP), // try exp catch if . == $label // then empty // else error end // // Can't use gen_binop(), as that's firmly // stuck in parser.y as it refers to things // like EQ. gen_try(exp, gen_cond(cond, gen_op_simple(BACKTRACK), gen_call("error", gen_noop()))))); } block gen_cbinding(const struct cfunction* cfunctions, int ncfunctions, block code) { for (int cfunc=0; cfuncimm.cfunc = &cfunctions[cfunc]; i->symbol = strdup(cfunctions[cfunc].name); i->nformals = cfunctions[cfunc].nargs - 1; i->any_unbound = 0; code = BLOCK(inst_block(i), code); } return code; } static uint16_t nesting_level(struct bytecode* bc, inst* target) { uint16_t level = 0; assert(bc && target && target->compiled); while (bc && target->compiled != bc) { level++; bc = bc->parent; } assert(bc && bc == target->compiled); return level; } static int count_cfunctions(block b) { int n = 0; for (inst* i = b.first; i; i = i->next) { if (i->op == CLOSURE_CREATE_C) n++; n += count_cfunctions(i->subfn); } return n; } #ifndef WIN32 extern char **environ; #endif static jv make_env(jv env) { if (jv_is_valid(env)) return jv_copy(env); jv r = jv_object(); if (environ == NULL) return r; for (size_t i = 0; environ[i] != NULL; i++) { const char *eq; if ((eq = strchr(environ[i], '=')) == NULL) r = jv_object_delete(r, jv_string(environ[i])); else r = jv_object_set(r, jv_string_sized(environ[i], eq - environ[i]), jv_string(eq + 1)); } return jv_copy(r); } // Expands call instructions into a calling sequence static int expand_call_arglist(block* b, jv args, jv *env) { int errors = 0; block ret = gen_noop(); for (inst* curr; (curr = block_take(b));) { if (opcode_describe(curr->op)->flags & OP_HAS_BINDING) { if (!curr->bound_by && curr->op == LOADV && strcmp(curr->symbol, "ENV") == 0) { curr->op = LOADK; *env = curr->imm.constant = make_env(*env); } else if (!curr->bound_by && curr->op == LOADV && jv_object_has(jv_copy(args), jv_string(curr->symbol))) { curr->op = LOADK; curr->imm.constant = jv_object_get(jv_copy(args), jv_string(curr->symbol)); } else if (!curr->bound_by) { if (curr->symbol[0] == '*' && curr->symbol[1] >= '1' && curr->symbol[1] <= '3' && curr->symbol[2] == '\0') locfile_locate(curr->locfile, curr->source, "jq: error: break used outside labeled control structure"); else if (curr->op == LOADV) locfile_locate(curr->locfile, curr->source, "jq: error: $%s is not defined", curr->symbol); else locfile_locate(curr->locfile, curr->source, "jq: error: %s/%d is not defined", curr->symbol, curr->nactuals); errors++; // don't process this instruction if it's not well-defined ret = BLOCK(ret, inst_block(curr)); continue; } } block prelude = gen_noop(); if (curr->op == CALL_JQ) { int actual_args = 0, desired_args = 0; // We expand the argument list as a series of instructions switch (curr->bound_by->op) { default: assert(0 && "Unknown function type"); break; case CLOSURE_CREATE: case CLOSURE_PARAM: { block callargs = gen_noop(); for (inst* i; (i = block_take(&curr->arglist));) { assert(opcode_describe(i->op)->flags & OP_IS_CALL_PSEUDO); block b = inst_block(i); switch (i->op) { default: assert(0 && "Unknown type of parameter"); break; case CLOSURE_REF: block_append(&callargs, b); break; case CLOSURE_CREATE: block_append(&prelude, b); block_append(&callargs, gen_op_bound(CLOSURE_REF, b)); break; } actual_args++; } curr->imm.intval = actual_args; curr->arglist = callargs; if (curr->bound_by->op == CLOSURE_CREATE) { for (inst* i = curr->bound_by->arglist.first; i; i = i->next) { assert(i->op == CLOSURE_PARAM); desired_args++; } } break; } case CLOSURE_CREATE_C: { for (inst* i; (i = block_take(&curr->arglist)); ) { assert(i->op == CLOSURE_CREATE); // FIXME block body = i->subfn; i->subfn = gen_noop(); inst_free(i); // arguments should be pushed in reverse order, prepend them to prelude errors += expand_call_arglist(&body, args, env); prelude = BLOCK(gen_subexp(body), prelude); actual_args++; } assert(curr->op == CALL_JQ); curr->op = CALL_BUILTIN; curr->imm.intval = actual_args + 1 /* include the implicit input in arg count */; assert(curr->bound_by->op == CLOSURE_CREATE_C); desired_args = curr->bound_by->imm.cfunc->nargs - 1; assert(!curr->arglist.first); break; } } assert(actual_args == desired_args); // because now handle this above } ret = BLOCK(ret, prelude, inst_block(curr)); } *b = ret; return errors; } static int compile(struct bytecode* bc, block b, struct locfile* lf, jv args, jv *env) { int errors = 0; int pos = 0; int var_frame_idx = 0; bc->nsubfunctions = 0; errors += expand_call_arglist(&b, args, env); b = BLOCK(b, gen_op_simple(RET)); jv localnames = jv_array(); for (inst* curr = b.first; curr; curr = curr->next) { if (!curr->next) assert(curr == b.last); int length = opcode_describe(curr->op)->length; if (curr->op == CALL_JQ) { for (inst* arg = curr->arglist.first; arg; arg = arg->next) { length += 2; } } pos += length; curr->bytecode_pos = pos; curr->compiled = bc; assert(curr->op != CLOSURE_REF && curr->op != CLOSURE_PARAM); if ((opcode_describe(curr->op)->flags & OP_HAS_VARIABLE) && curr->bound_by == curr) { curr->imm.intval = var_frame_idx++; localnames = jv_array_append(localnames, jv_string(curr->symbol)); } if (curr->op == CLOSURE_CREATE) { assert(curr->bound_by == curr); // Prevent subfunction index from overflowing into ARG_NEWCLOSURE flag if (bc->nsubfunctions >= ARG_NEWCLOSURE) { locfile_locate(lf, curr->source, "too many function parameters or local function definitions (max %d)", ARG_NEWCLOSURE - 1); errors++; break; } curr->imm.intval = bc->nsubfunctions++; } if (curr->op == CLOSURE_CREATE_C) { assert(curr->bound_by == curr); int idx = bc->globals->ncfunctions++; bc->globals->cfunc_names = jv_array_append(bc->globals->cfunc_names, jv_string(curr->symbol)); bc->globals->cfunctions[idx] = *curr->imm.cfunc; curr->imm.intval = idx; } } if (pos > 0xFFFF) { // too long for program counter to fit in uint16_t locfile_locate(lf, UNKNOWN_LOCATION, "function compiled to %d bytes which is too long", pos); errors++; } bc->codelen = pos; bc->debuginfo = jv_object_set(bc->debuginfo, jv_string("locals"), localnames); if (bc->nsubfunctions && !errors) { bc->subfunctions = jv_mem_calloc(bc->nsubfunctions, sizeof(struct bytecode*)); for (inst* curr = b.first; curr; curr = curr->next) { if (curr->op == CLOSURE_CREATE) { struct bytecode* subfn = jv_mem_alloc(sizeof(struct bytecode)); bc->subfunctions[curr->imm.intval] = subfn; subfn->globals = bc->globals; subfn->parent = bc; subfn->nclosures = 0; subfn->debuginfo = jv_object_set(jv_object(), jv_string("name"), jv_string(curr->symbol)); jv params = jv_array(); for (inst* param = curr->arglist.first; param; param = param->next) { assert(param->op == CLOSURE_PARAM); assert(param->bound_by == param); // Prevent closure index from overflowing into ARG_NEWCLOSURE flag if (subfn->nclosures >= ARG_NEWCLOSURE) { locfile_locate(lf, curr->source, "function has too many parameters (max %d)", ARG_NEWCLOSURE - 1); errors++; break; } param->imm.intval = subfn->nclosures++; param->compiled = subfn; params = jv_array_append(params, jv_string(param->symbol)); } subfn->debuginfo = jv_object_set(subfn->debuginfo, jv_string("params"), params); errors += compile(subfn, curr->subfn, lf, args, env); curr->subfn = gen_noop(); } } } else { bc->nsubfunctions = 0; bc->subfunctions = 0; } uint16_t* code = jv_mem_calloc(bc->codelen, sizeof(uint16_t)); bc->code = code; pos = 0; jv constant_pool = jv_array(); int maxvar = -1; if (!errors) for (inst* curr = b.first; curr; curr = curr->next) { const struct opcode_description* op = opcode_describe(curr->op); if (op->length == 0) continue; code[pos++] = curr->op; assert(curr->op != CLOSURE_REF && curr->op != CLOSURE_PARAM); if (curr->op == CALL_BUILTIN) { assert(curr->bound_by->op == CLOSURE_CREATE_C); assert(!curr->arglist.first); code[pos++] = (uint16_t)curr->imm.intval; code[pos++] = curr->bound_by->imm.intval; } else if (curr->op == CALL_JQ) { assert(curr->bound_by->op == CLOSURE_CREATE || curr->bound_by->op == CLOSURE_PARAM); code[pos++] = (uint16_t)curr->imm.intval; code[pos++] = nesting_level(bc, curr->bound_by); code[pos++] = curr->bound_by->imm.intval | (curr->bound_by->op == CLOSURE_CREATE ? ARG_NEWCLOSURE : 0); for (inst* arg = curr->arglist.first; arg; arg = arg->next) { assert(arg->op == CLOSURE_REF && arg->bound_by->op == CLOSURE_CREATE); code[pos++] = nesting_level(bc, arg->bound_by); code[pos++] = arg->bound_by->imm.intval | ARG_NEWCLOSURE; } } else if ((op->flags & OP_HAS_CONSTANT) && (op->flags & OP_HAS_VARIABLE)) { // STORE_GLOBAL: constant global, basically code[pos++] = jv_array_length(jv_copy(constant_pool)); constant_pool = jv_array_append(constant_pool, jv_copy(curr->imm.constant)); code[pos++] = nesting_level(bc, curr->bound_by); uint16_t var = (uint16_t)curr->bound_by->imm.intval; code[pos++] = var; if (var > maxvar) maxvar = var; } else if (op->flags & OP_HAS_CONSTANT) { code[pos++] = jv_array_length(jv_copy(constant_pool)); constant_pool = jv_array_append(constant_pool, jv_copy(curr->imm.constant)); } else if (op->flags & OP_HAS_VARIABLE) { code[pos++] = nesting_level(bc, curr->bound_by); uint16_t var = (uint16_t)curr->bound_by->imm.intval; code[pos++] = var; if (var > maxvar) maxvar = var; } else if (op->flags & OP_HAS_BRANCH) { assert(curr->imm.target->bytecode_pos != -1); assert(curr->imm.target->bytecode_pos > pos); // only forward branches code[pos] = curr->imm.target->bytecode_pos - (pos + 1); pos++; } else if (op->length > 1) { assert(0 && "codegen not implemented for this operation"); } } bc->constants = constant_pool; bc->nlocals = maxvar + 2; // FIXME: frames of size zero? block_free(b); return errors; } int block_compile(block b, struct bytecode** out, struct locfile* lf, jv args) { struct bytecode* bc = jv_mem_alloc(sizeof(struct bytecode)); bc->parent = 0; bc->nclosures = 0; bc->globals = jv_mem_alloc(sizeof(struct symbol_table)); int ncfunc = count_cfunctions(b); bc->globals->ncfunctions = 0; bc->globals->cfunctions = jv_mem_calloc(MAX(ncfunc, 1), sizeof(struct cfunction)); bc->globals->cfunc_names = jv_array(); bc->debuginfo = jv_object_set(jv_object(), jv_string("name"), jv_null()); jv env = jv_invalid(); int nerrors = compile(bc, b, lf, args, &env); jv_free(args); jv_free(env); assert(bc->globals->ncfunctions == ncfunc); if (nerrors > 0) { bytecode_free(bc); *out = 0; } else { *out = bc; } return nerrors; } void block_free(block b) { struct inst* next; for (struct inst* curr = b.first; curr; curr = next) { next = curr->next; inst_free(curr); } } jq-1.8.2/src/version.h0000644000175100017510000000003315215513567010252 #define JQ_VERSION "1.8.2" jq-1.8.2/src/execute.c0000644000175100017510000010755115215513536010233 #include #include #include #include #include #include #include #include "exec_stack.h" #include "bytecode.h" #include "jv_alloc.h" #include "locfile.h" #include "jv.h" #include "jq.h" #include "builtin.h" #include "linker.h" struct jq_state { void (*nomem_handler)(void *); void *nomem_handler_data; struct bytecode* bc; jq_msg_cb err_cb; void *err_cb_data; jv error; struct stack stk; stack_ptr curr_frame; stack_ptr stk_top; stack_ptr fork_top; jv path; jv value_at_path; int subexp_nest; int debug_trace_enabled; int initial_execution; unsigned next_label; int halted; jv exit_code; jv error_message; jv attrs; jq_input_cb input_cb; void *input_cb_data; jq_msg_cb debug_cb; void *debug_cb_data; jq_msg_cb stderr_cb; void *stderr_cb_data; }; struct closure { struct bytecode* bc; // jq bytecode stack_ptr env; // jq stack address of closed frame }; // locals for any function called: either a closure or a local variable union frame_entry { struct closure closure; jv localvar; }; // jq function call frame struct frame { struct bytecode* bc; // jq bytecode for callee stack_ptr env; // jq stack address of frame to return to stack_ptr retdata; // jq stack address to unwind to on RET uint16_t* retaddr; // jq bytecode return address union frame_entry entries[]; // nclosures + nlocals }; static int frame_size(struct bytecode* bc) { return sizeof(struct frame) + sizeof(union frame_entry) * (bc->nclosures + bc->nlocals); } static struct frame* frame_current(struct jq_state* jq) { struct frame* fp = stack_block(&jq->stk, jq->curr_frame); stack_ptr next = *stack_block_next(&jq->stk, jq->curr_frame); if (next) { struct frame* fpnext = stack_block(&jq->stk, next); struct bytecode* bc = fpnext->bc; assert(fp->retaddr >= bc->code && fp->retaddr < bc->code + bc->codelen); } else { assert(fp->retaddr == 0); } return fp; } static stack_ptr frame_get_level(struct jq_state* jq, int level) { stack_ptr fr = jq->curr_frame; for (int i=0; istk, fr); fr = fp->env; } return fr; } static jv* frame_local_var(struct jq_state* jq, int var, int level) { struct frame* fr = stack_block(&jq->stk, frame_get_level(jq, level)); assert(var >= 0); assert(var < fr->bc->nlocals); return &fr->entries[fr->bc->nclosures + var].localvar; } static struct closure make_closure(struct jq_state* jq, uint16_t* pc) { uint16_t level = *pc++; uint16_t idx = *pc++; stack_ptr fridx = frame_get_level(jq, level); struct frame* fr = stack_block(&jq->stk, fridx); if (idx & ARG_NEWCLOSURE) { // A new closure closing the frame identified by level, and with // the bytecode body of the idx'th subfunction of that frame int subfn_idx = idx & ~ARG_NEWCLOSURE; assert(subfn_idx < fr->bc->nsubfunctions); struct closure cl = {fr->bc->subfunctions[subfn_idx], fridx}; return cl; } else { // A reference to a closure from the frame identified by level; copy // it as-is int closure = idx; assert(closure >= 0); assert(closure < fr->bc->nclosures); return fr->entries[closure].closure; } } static struct frame* frame_push(struct jq_state* jq, struct closure callee, uint16_t* argdef, int nargs) { stack_ptr new_frame_idx = stack_push_block(&jq->stk, jq->curr_frame, frame_size(callee.bc)); struct frame* new_frame = stack_block(&jq->stk, new_frame_idx); new_frame->bc = callee.bc; new_frame->env = callee.env; assert(nargs == new_frame->bc->nclosures); union frame_entry* entries = new_frame->entries; for (int i=0; iclosure = make_closure(jq, argdef + i * 2); entries++; } for (int i=0; inlocals; i++) { entries->localvar = jv_invalid(); entries++; } jq->curr_frame = new_frame_idx; return new_frame; } static void frame_pop(struct jq_state* jq) { assert(jq->curr_frame); struct frame* fp = frame_current(jq); if (stack_pop_will_free(&jq->stk, jq->curr_frame)) { int nlocals = fp->bc->nlocals; for (int i=0; icurr_frame = stack_pop_block(&jq->stk, jq->curr_frame, frame_size(fp->bc)); } void stack_push(jq_state *jq, jv val) { assert(jv_is_valid(val)); jq->stk_top = stack_push_block(&jq->stk, jq->stk_top, sizeof(jv)); jv* sval = stack_block(&jq->stk, jq->stk_top); *sval = val; } jv stack_pop(jq_state *jq) { jv* sval = stack_block(&jq->stk, jq->stk_top); jv val = *sval; if (!stack_pop_will_free(&jq->stk, jq->stk_top)) { val = jv_copy(val); } jq->stk_top = stack_pop_block(&jq->stk, jq->stk_top, sizeof(jv)); assert(jv_is_valid(val)); return val; } // Like stack_pop(), but assert !stack_pop_will_free() and replace with // jv_null() on the stack. jv stack_popn(jq_state *jq) { jv* sval = stack_block(&jq->stk, jq->stk_top); jv val = *sval; if (!stack_pop_will_free(&jq->stk, jq->stk_top)) { *sval = jv_null(); } jq->stk_top = stack_pop_block(&jq->stk, jq->stk_top, sizeof(jv)); assert(jv_is_valid(val)); return val; } struct forkpoint { stack_ptr saved_data_stack; stack_ptr saved_curr_frame; int path_len, subexp_nest; jv value_at_path; uint16_t* return_address; }; struct stack_pos { stack_ptr saved_data_stack, saved_curr_frame; }; struct stack_pos stack_get_pos(jq_state* jq) { struct stack_pos sp = {jq->stk_top, jq->curr_frame}; return sp; } void stack_save(jq_state *jq, uint16_t* retaddr, struct stack_pos sp){ jq->fork_top = stack_push_block(&jq->stk, jq->fork_top, sizeof(struct forkpoint)); struct forkpoint* fork = stack_block(&jq->stk, jq->fork_top); fork->saved_data_stack = jq->stk_top; fork->saved_curr_frame = jq->curr_frame; fork->path_len = jv_get_kind(jq->path) == JV_KIND_ARRAY ? jv_array_length(jv_copy(jq->path)) : 0; fork->value_at_path = jv_copy(jq->value_at_path); fork->subexp_nest = jq->subexp_nest; fork->return_address = retaddr; jq->stk_top = sp.saved_data_stack; jq->curr_frame = sp.saved_curr_frame; } static int path_intact(jq_state *jq, jv curr) { if (jq->subexp_nest == 0 && jv_get_kind(jq->path) == JV_KIND_ARRAY) { return jv_identical(curr, jv_copy(jq->value_at_path)); } else { jv_free(curr); return 1; } } static void path_append(jq_state* jq, jv component, jv value_at_path) { if (jq->subexp_nest == 0 && jv_get_kind(jq->path) == JV_KIND_ARRAY) { int n1 = jv_array_length(jv_copy(jq->path)); jq->path = jv_array_append(jq->path, component); int n2 = jv_array_length(jv_copy(jq->path)); assert(n2 == n1 + 1); jv_free(jq->value_at_path); jq->value_at_path = value_at_path; } else { jv_free(component); jv_free(value_at_path); } } /* For f_getpath() */ jv _jq_path_append(jq_state *jq, jv v, jv p, jv value_at_path) { if (jq->subexp_nest != 0 || jv_get_kind(jq->path) != JV_KIND_ARRAY || !jv_is_valid(value_at_path)) { jv_free(v); jv_free(p); return value_at_path; } if (!jv_identical(v, jv_copy(jq->value_at_path))) { jv_free(p); return value_at_path; } if (jv_get_kind(p) == JV_KIND_ARRAY) jq->path = jv_array_concat(jq->path, p); else jq->path = jv_array_append(jq->path, p); jv_free(jq->value_at_path); return jv_copy(jq->value_at_path = value_at_path); } uint16_t* stack_restore(jq_state *jq){ while (!stack_pop_will_free(&jq->stk, jq->fork_top)) { if (stack_pop_will_free(&jq->stk, jq->stk_top)) { jv_free(stack_pop(jq)); } else if (stack_pop_will_free(&jq->stk, jq->curr_frame)) { frame_pop(jq); } else { assert(0); } } if (jq->fork_top == 0) { return 0; } struct forkpoint* fork = stack_block(&jq->stk, jq->fork_top); uint16_t* retaddr = fork->return_address; jq->stk_top = fork->saved_data_stack; jq->curr_frame = fork->saved_curr_frame; int path_len = fork->path_len; if (jv_get_kind(jq->path) == JV_KIND_ARRAY) { assert(path_len >= 0); jq->path = jv_array_slice(jq->path, 0, path_len); } else { fork->path_len = 0; } jv_free(jq->value_at_path); jq->value_at_path = fork->value_at_path; jq->subexp_nest = fork->subexp_nest; jq->fork_top = stack_pop_block(&jq->stk, jq->fork_top, sizeof(struct forkpoint)); return retaddr; } static void jq_reset(jq_state *jq) { while (stack_restore(jq)) {} assert(jq->stk_top == 0); assert(jq->fork_top == 0); assert(jq->curr_frame == 0); stack_reset(&jq->stk); jv_free(jq->error); jq->error = jv_null(); jq->halted = 0; jv_free(jq->exit_code); jq->exit_code = jv_invalid(); jv_free(jq->error_message); jq->error_message = jv_invalid(); if (jv_get_kind(jq->path) != JV_KIND_INVALID) jv_free(jq->path); jq->path = jv_null(); jv_free(jq->value_at_path); jq->value_at_path = jv_null(); jq->subexp_nest = 0; } void jq_report_error(jq_state *jq, jv value) { assert(jq->err_cb); // callback must jv_free() its jv argument jq->err_cb(jq->err_cb_data, value); } static void set_error(jq_state *jq, jv value) { // Record so try/catch can find it. jv_free(jq->error); jq->error = value; } #define ON_BACKTRACK(op) ((op)+NUM_OPCODES) jv jq_next(jq_state *jq) { jv_nomem_handler(jq->nomem_handler, jq->nomem_handler_data); uint16_t* pc = stack_restore(jq); assert(pc); int raising; int backtracking = !jq->initial_execution; jq->initial_execution = 0; assert(jv_get_kind(jq->error) == JV_KIND_NULL); while (1) { if (jq->halted) { if (jq->debug_trace_enabled) printf("\t\n"); return jv_invalid(); } uint16_t opcode = *pc; raising = 0; if (jq->debug_trace_enabled) { dump_operation(frame_current(jq)->bc, pc); printf("\t"); const struct opcode_description* opdesc = opcode_describe(opcode); stack_ptr param = 0; if (!backtracking) { int stack_in = opdesc->stack_in; if (stack_in == -1) stack_in = pc[1]; param = jq->stk_top; for (int i=0; istk, param); } if (!param) break; jv_dump(jv_copy(*(jv*)stack_block(&jq->stk, param)), JV_PRINT_REFCOUNT); //printf("<%d>", jv_get_refcnt(param->val)); //printf(" -- "); //jv_dump(jv_copy(jq->path), 0); } if (jq->debug_trace_enabled & JQ_DEBUG_TRACE_DETAIL) { while ((param = *stack_block_next(&jq->stk, param))) { printf(" || "); jv_dump(jv_copy(*(jv*)stack_block(&jq->stk, param)), JV_PRINT_REFCOUNT); } } } else { printf("\t"); } printf("\n"); } if (backtracking) { opcode = ON_BACKTRACK(opcode); backtracking = 0; raising = !jv_is_valid(jq->error); } pc++; switch (opcode) { default: assert(0 && "invalid instruction"); case TOP: break; case ERRORK: { jv v = jv_array_get(jv_copy(frame_current(jq)->bc->constants), *pc++); set_error(jq, jv_invalid_with_msg(v)); goto do_backtrack; } case LOADK: { jv v = jv_array_get(jv_copy(frame_current(jq)->bc->constants), *pc++); assert(jv_is_valid(v)); jv_free(stack_pop(jq)); stack_push(jq, v); break; } case GENLABEL: { stack_push(jq, JV_OBJECT(jv_string("__jq"), jv_number(jq->next_label++))); break; } case DUP: { jv v = stack_pop(jq); stack_push(jq, jv_copy(v)); stack_push(jq, v); break; } case DUPN: { jv v = stack_popn(jq); stack_push(jq, jv_copy(v)); stack_push(jq, v); break; } case DUP2: { jv keep = stack_pop(jq); jv v = stack_pop(jq); stack_push(jq, jv_copy(v)); stack_push(jq, keep); stack_push(jq, v); break; } case SUBEXP_BEGIN: { jv v = stack_pop(jq); stack_push(jq, jv_copy(v)); stack_push(jq, v); jq->subexp_nest++; break; } case SUBEXP_END: { assert(jq->subexp_nest > 0); jq->subexp_nest--; jv a = stack_pop(jq); jv b = stack_pop(jq); stack_push(jq, a); stack_push(jq, b); break; } case PUSHK_UNDER: { jv v = jv_array_get(jv_copy(frame_current(jq)->bc->constants), *pc++); assert(jv_is_valid(v)); jv v2 = stack_pop(jq); stack_push(jq, v); stack_push(jq, v2); break; } case POP: { jv_free(stack_pop(jq)); break; } case APPEND: { jv v = stack_pop(jq); uint16_t level = *pc++; uint16_t vidx = *pc++; jv* var = frame_local_var(jq, vidx, level); assert(jv_get_kind(*var) == JV_KIND_ARRAY); *var = jv_array_append(*var, v); break; } case INSERT: { jv stktop = stack_pop(jq); jv v = stack_pop(jq); jv k = stack_pop(jq); jv objv = stack_pop(jq); assert(jv_get_kind(objv) == JV_KIND_OBJECT); if (jv_get_kind(k) == JV_KIND_STRING) { stack_push(jq, jv_object_set(objv, k, v)); stack_push(jq, stktop); } else { char errbuf[30]; set_error(jq, jv_invalid_with_msg(jv_string_fmt( "Cannot use %s (%s) as object key", jv_kind_name(jv_get_kind(k)), jv_dump_string_trunc(jv_copy(k), errbuf, sizeof(errbuf))))); jv_free(stktop); jv_free(v); jv_free(k); jv_free(objv); goto do_backtrack; } break; } case ON_BACKTRACK(RANGE): case RANGE: { uint16_t level = *pc++; uint16_t v = *pc++; jv* var = frame_local_var(jq, v, level); jv max = stack_pop(jq); if (raising) { jv_free(max); goto do_backtrack; } if (jv_get_kind(*var) != JV_KIND_NUMBER || jv_get_kind(max) != JV_KIND_NUMBER) { set_error(jq, jv_invalid_with_msg(jv_string_fmt("Range bounds must be numeric"))); jv_free(max); goto do_backtrack; } else if (jv_number_value(*var) >= jv_number_value(max)) { /* finished iterating */ jv_free(max); goto do_backtrack; } else { jv curr = *var; *var = jv_number(jv_number_value(*var) + 1); struct stack_pos spos = stack_get_pos(jq); stack_push(jq, max); stack_save(jq, pc - 3, spos); stack_push(jq, curr); } break; } // FIXME: loadv/storev may do too much copying/freeing case LOADV: { uint16_t level = *pc++; uint16_t v = *pc++; jv* var = frame_local_var(jq, v, level); if (jq->debug_trace_enabled) { printf("V%d = ", v); jv_dump(jv_copy(*var), JV_PRINT_REFCOUNT); printf("\n"); } jv_free(stack_pop(jq)); stack_push(jq, jv_copy(*var)); break; } // Does a load but replaces the variable with null case LOADVN: { uint16_t level = *pc++; uint16_t v = *pc++; jv* var = frame_local_var(jq, v, level); if (jq->debug_trace_enabled) { printf("V%d = ", v); jv_dump(jv_copy(*var), JV_PRINT_REFCOUNT); printf("\n"); } jv_free(stack_popn(jq)); // This `stack_push()` invalidates the `var` reference, so stack_push(jq, *var); // we have to re-resolve `var` before we can set it to null var = frame_local_var(jq, v, level); *var = jv_null(); break; } case STOREVN: stack_save(jq, pc - 1, stack_get_pos(jq)); JQ_FALLTHROUGH; case STOREV: { uint16_t level = *pc++; uint16_t v = *pc++; jv* var = frame_local_var(jq, v, level); jv val = stack_pop(jq); if (jq->debug_trace_enabled) { printf("V%d = ", v); jv_dump(jv_copy(val), 0); printf(" (%d)\n", jv_get_refcnt(val)); } jv_free(*var); *var = val; break; } case ON_BACKTRACK(STOREVN): { uint16_t level = *pc++; uint16_t v = *pc++; jv* var = frame_local_var(jq, v, level); jv_free(*var); *var = jv_null(); goto do_backtrack; break; } case STORE_GLOBAL: { // Get the constant jv val = jv_array_get(jv_copy(frame_current(jq)->bc->constants), *pc++); assert(jv_is_valid(val)); // Store the var uint16_t level = *pc++; uint16_t v = *pc++; jv* var = frame_local_var(jq, v, level); if (jq->debug_trace_enabled) { printf("V%d = ", v); jv_dump(jv_copy(val), 0); printf(" (%d)\n", jv_get_refcnt(val)); } jv_free(*var); *var = val; break; } case PATH_BEGIN: { jv v = stack_pop(jq); stack_push(jq, jq->path); stack_save(jq, pc - 1, stack_get_pos(jq)); stack_push(jq, jv_number(jq->subexp_nest)); stack_push(jq, jq->value_at_path); stack_push(jq, jv_copy(v)); jq->path = jv_array(); jq->value_at_path = v; // next INDEX operation must index into v jq->subexp_nest = 0; break; } case PATH_END: { jv v = stack_pop(jq); // detect invalid path expression like path(.a | reverse) if (!path_intact(jq, jv_copy(v))) { char errbuf[30]; jv msg = jv_string_fmt( "Invalid path expression with result %s", jv_dump_string_trunc(v, errbuf, sizeof(errbuf))); set_error(jq, jv_invalid_with_msg(msg)); goto do_backtrack; } jv_free(v); // discard value, only keep path jv old_value_at_path = stack_pop(jq); int old_subexp_nest = (int)jv_number_value(stack_pop(jq)); jv path = jq->path; jq->path = stack_pop(jq); struct stack_pos spos = stack_get_pos(jq); stack_push(jq, jv_copy(path)); stack_save(jq, pc - 1, spos); stack_push(jq, path); jq->subexp_nest = old_subexp_nest; jv_free(jq->value_at_path); jq->value_at_path = old_value_at_path; break; } case ON_BACKTRACK(PATH_BEGIN): case ON_BACKTRACK(PATH_END): { jv_free(jq->path); jq->path = stack_pop(jq); goto do_backtrack; } case INDEX: case INDEX_OPT: { jv t = stack_pop(jq); jv k = stack_pop(jq); // detect invalid path expression like path(reverse | .a) if (!path_intact(jq, jv_copy(t))) { char keybuf[30]; char objbuf[30]; jv msg = jv_string_fmt( "Invalid path expression near attempt to access element %s of %s", jv_dump_string_trunc(k, keybuf, sizeof(keybuf)), jv_dump_string_trunc(t, objbuf, sizeof(objbuf))); set_error(jq, jv_invalid_with_msg(msg)); goto do_backtrack; } jv v = jv_get(t, jv_copy(k)); if (jv_is_valid(v)) { path_append(jq, k, jv_copy(v)); stack_push(jq, v); } else { jv_free(k); if (opcode == INDEX) set_error(jq, v); else jv_free(v); goto do_backtrack; } break; } case JUMP: { uint16_t offset = *pc++; pc += offset; break; } case JUMP_F: { uint16_t offset = *pc++; jv t = stack_pop(jq); jv_kind kind = jv_get_kind(t); if (kind == JV_KIND_FALSE || kind == JV_KIND_NULL) { pc += offset; } stack_push(jq, t); // FIXME do this better break; } case EACH: case EACH_OPT: { jv container = stack_pop(jq); // detect invalid path expression like path(reverse | .[]) if (!path_intact(jq, jv_copy(container))) { char errbuf[30]; jv msg = jv_string_fmt( "Invalid path expression near attempt to iterate through %s", jv_dump_string_trunc(container, errbuf, sizeof(errbuf))); set_error(jq, jv_invalid_with_msg(msg)); goto do_backtrack; } stack_push(jq, container); stack_push(jq, jv_number(-1)); JQ_FALLTHROUGH; } case ON_BACKTRACK(EACH): case ON_BACKTRACK(EACH_OPT): { int idx = jv_number_value(stack_pop(jq)); jv container = stack_pop(jq); int keep_going, is_last = 0; jv key, value; if (jv_get_kind(container) == JV_KIND_ARRAY) { if (opcode == EACH || opcode == EACH_OPT) idx = 0; else idx = idx + 1; int len = jv_array_length(jv_copy(container)); keep_going = idx < len; is_last = idx == len - 1; if (keep_going) { key = jv_number(idx); value = jv_array_get(jv_copy(container), idx); } } else if (jv_get_kind(container) == JV_KIND_OBJECT) { if (opcode == EACH || opcode == EACH_OPT) idx = jv_object_iter(container); else idx = jv_object_iter_next(container, idx); keep_going = jv_object_iter_valid(container, idx); if (keep_going) { key = jv_object_iter_key(container, idx); value = jv_object_iter_value(container, idx); } } else { assert(opcode == EACH || opcode == EACH_OPT); if (opcode == EACH) { char errbuf[30]; set_error(jq, jv_invalid_with_msg(jv_string_fmt( "Cannot iterate over %s (%s)", jv_kind_name(jv_get_kind(container)), jv_dump_string_trunc(jv_copy(container), errbuf, sizeof(errbuf))))); } keep_going = 0; } if (!keep_going || raising) { if (keep_going) { jv_free(key); jv_free(value); } jv_free(container); goto do_backtrack; } else if (is_last) { // we don't need to make a backtrack point jv_free(container); path_append(jq, key, jv_copy(value)); stack_push(jq, value); } else { struct stack_pos spos = stack_get_pos(jq); stack_push(jq, container); stack_push(jq, jv_number(idx)); stack_save(jq, pc - 1, spos); path_append(jq, key, jv_copy(value)); stack_push(jq, value); } break; } do_backtrack: case BACKTRACK: { pc = stack_restore(jq); if (!pc) { if (!jv_is_valid(jq->error)) { jv error = jq->error; jq->error = jv_null(); return error; } return jv_invalid(); } backtracking = 1; break; } case TRY_BEGIN: stack_save(jq, pc - 1, stack_get_pos(jq)); pc++; // skip handler offset this time break; case TRY_END: stack_save(jq, pc - 1, stack_get_pos(jq)); break; case ON_BACKTRACK(TRY_BEGIN): { if (!raising) { /* * `try EXP ...` -- EXP backtracked (e.g., EXP was `empty`), so we * backtrack more: */ jv_free(stack_pop(jq)); goto do_backtrack; } /* * Else `(try EXP ... ) | EXP2` raised an error. * * If the error was wrapped in another error, then that means EXP2 raised * the error. We unwrap it and re-raise it as it wasn't raised by EXP. * * See commentary in gen_try(). */ jv e = jv_invalid_get_msg(jv_copy(jq->error)); if (!jv_is_valid(e) && jv_invalid_has_msg(jv_copy(e))) { set_error(jq, e); goto do_backtrack; } jv_free(e); /* * Else we caught an error containing a non-error value, so we jump to * the handler. * * See commentary in gen_try(). */ uint16_t offset = *pc++; jv_free(stack_pop(jq)); // free the input stack_push(jq, jv_invalid_get_msg(jq->error)); // push the error's message jq->error = jv_null(); pc += offset; break; } case ON_BACKTRACK(TRY_END): // Wrap the error so the matching TRY_BEGIN doesn't catch it if (raising) set_error(jq, jv_invalid_with_msg(jv_copy(jq->error))); goto do_backtrack; case DESTRUCTURE_ALT: case FORK: { stack_save(jq, pc - 1, stack_get_pos(jq)); pc++; // skip offset this time break; } case ON_BACKTRACK(DESTRUCTURE_ALT): { if (jv_is_valid(jq->error)) { // `try EXP ...` backtracked here (no value, `empty`), so we backtrack more jv_free(stack_pop(jq)); goto do_backtrack; } // `try EXP ...` exception caught in EXP // DESTRUCTURE_ALT doesn't want the error message on the stack, // as we would just want to throw it away anyway. if (opcode != ON_BACKTRACK(DESTRUCTURE_ALT)) { jv_free(stack_pop(jq)); // free the input stack_push(jq, jv_invalid_get_msg(jq->error)); // push the error's message } else { jv_free(jq->error); } jq->error = jv_null(); uint16_t offset = *pc++; pc += offset; break; } case ON_BACKTRACK(FORK): { if (raising) goto do_backtrack; uint16_t offset = *pc++; pc += offset; break; } case CALL_BUILTIN: { int nargs = *pc++; struct cfunction* function = &frame_current(jq)->bc->globals->cfunctions[*pc++]; jv in[MAX_CFUNCTION_ARGS]; for (int i = 0; i < nargs; ++i) in[i] = stack_pop(jq); jv top; switch (function->nargs) { case 1: top = function->fptr.a1(jq, in[0]); break; case 2: top = function->fptr.a2(jq, in[0], in[1]); break; case 3: top = function->fptr.a3(jq, in[0], in[1], in[2]); break; case 4: top = function->fptr.a4(jq, in[0], in[1], in[2], in[3]); break; default: assert(0 && "Invalid number of arguments"); } if (!jv_is_valid(top)) { if (jv_invalid_has_msg(jv_copy(top))) set_error(jq, top); else jv_free(top); goto do_backtrack; } stack_push(jq, top); break; } case TAIL_CALL_JQ: case CALL_JQ: { /* * Bytecode layout here: * * CALL_JQ * (i.e., number of call arguments) * (what we're calling) * (frame reference + code pointer) * * * * Each closure consists of two uint16_t values: a "level" * identifying the frame to be closed over, and an index. * * The level is a relative number of call frames reachable from * the currently one; 0 -> current frame, 1 -> previous frame, and * so on. * * The index is either an index of the closed frame's subfunctions * or of the closed frame's parameter closures. If the latter, * that closure will be passed, else the closed frame's pointer * and the subfunction's code will form the closure to be passed. * * See make_closure() for more information. */ jv input = stack_pop(jq); uint16_t nclosures = *pc++; uint16_t* retaddr = pc + 2 + nclosures*2; stack_ptr retdata = jq->stk_top; struct frame* new_frame; struct closure cl = make_closure(jq, pc); if (opcode == TAIL_CALL_JQ) { retaddr = frame_current(jq)->retaddr; retdata = frame_current(jq)->retdata; frame_pop(jq); } new_frame = frame_push(jq, cl, pc + 2, nclosures); new_frame->retdata = retdata; new_frame->retaddr = retaddr; pc = new_frame->bc->code; stack_push(jq, input); break; } case RET: { jv value = stack_pop(jq); assert(jq->stk_top == frame_current(jq)->retdata); uint16_t* retaddr = frame_current(jq)->retaddr; if (retaddr) { // function return pc = retaddr; frame_pop(jq); } else { // top-level return, yielding value struct stack_pos spos = stack_get_pos(jq); stack_push(jq, jv_null()); stack_save(jq, pc - 1, spos); return value; } stack_push(jq, value); break; } case ON_BACKTRACK(RET): { // resumed after top-level return goto do_backtrack; } } } } jv jq_format_error(jv msg) { if (jv_get_kind(msg) == JV_KIND_NULL || (jv_get_kind(msg) == JV_KIND_INVALID && !jv_invalid_has_msg(jv_copy(msg)))) { jv_free(msg); fprintf(stderr, "jq: error: out of memory\n"); return jv_null(); } if (jv_get_kind(msg) == JV_KIND_STRING) return msg; // expected to already be formatted if (jv_get_kind(msg) == JV_KIND_INVALID) msg = jv_invalid_get_msg(msg); if (jv_get_kind(msg) == JV_KIND_NULL) return jq_format_error(msg); // ENOMEM // Invalid with msg; prefix with "jq: error: " if (jv_get_kind(msg) != JV_KIND_INVALID) { if (jv_get_kind(msg) == JV_KIND_STRING) { jv r = jv_string_fmt("jq: error: %s", jv_string_value(msg)); jv_free(msg); return r; } msg = jv_dump_string(msg, JV_PRINT_INVALID); if (jv_get_kind(msg) == JV_KIND_STRING) { jv r = jv_string_fmt("jq: error: %s", jv_string_value(msg)); jv_free(msg); return r; } jv_free(msg); return jq_format_error(jv_null()); // ENOMEM } // An invalid inside an invalid! return jq_format_error(jv_invalid_get_msg(msg)); } // XXX Refactor into a utility function that returns a jv and one that // uses it and then prints that jv's string as the complete error // message. static void default_err_cb(void *data, jv msg) { msg = jq_format_error(msg); fprintf((FILE *)data, "%s\n", jv_string_value(msg)); jv_free(msg); } jq_state *jq_init(void) { jq_state *jq; jq = jv_mem_alloc_unguarded(sizeof(*jq)); if (jq == NULL) return NULL; jq->bc = 0; jq->next_label = 0; stack_init(&jq->stk); jq->stk_top = 0; jq->fork_top = 0; jq->curr_frame = 0; jq->error = jv_null(); jq->halted = 0; jq->exit_code = jv_invalid(); jq->error_message = jv_invalid(); jq->input_cb = NULL; jq->input_cb_data = NULL; jq->debug_cb = NULL; jq->debug_cb_data = NULL; jq->stderr_cb = NULL; jq->stderr_cb_data = NULL; jq->err_cb = default_err_cb; jq->err_cb_data = stderr; jq->attrs = jv_object(); jq->path = jv_null(); jq->value_at_path = jv_null(); jq->nomem_handler = NULL; jq->nomem_handler_data = NULL; return jq; } void jq_set_error_cb(jq_state *jq, jq_msg_cb cb, void *data) { if (cb == NULL) { jq->err_cb = default_err_cb; jq->err_cb_data = stderr; } else { jq->err_cb = cb; jq->err_cb_data = data; } } void jq_get_error_cb(jq_state *jq, jq_msg_cb *cb, void **data) { *cb = jq->err_cb; *data = jq->err_cb_data; } void jq_set_nomem_handler(jq_state *jq, void (*nomem_handler)(void *), void *data) { jv_nomem_handler(nomem_handler, data); jq->nomem_handler = nomem_handler; jq->nomem_handler_data = data; } void jq_start(jq_state *jq, jv input, int flags) { jv_nomem_handler(jq->nomem_handler, jq->nomem_handler_data); jq_reset(jq); struct closure top = {jq->bc, -1}; struct frame* top_frame = frame_push(jq, top, 0, 0); top_frame->retdata = 0; top_frame->retaddr = 0; stack_push(jq, input); stack_save(jq, jq->bc->code, stack_get_pos(jq)); jq->debug_trace_enabled = flags & JQ_DEBUG_TRACE_ALL; jq->initial_execution = 1; } void jq_teardown(jq_state **jq) { jq_state *old_jq = *jq; if (old_jq == NULL) return; *jq = NULL; jq_reset(old_jq); bytecode_free(old_jq->bc); old_jq->bc = 0; jv_free(old_jq->attrs); jv_mem_free(old_jq); } static int ret_follows(uint16_t *pc) { if (*pc == RET) return 1; if (*pc++ != JUMP) return 0; return ret_follows(pc + *pc + 1); // FIXME, might be ironic } /* * Look for tail calls that can be optimized: tail calls with no * references left to the current frame. * * We're staring at this bytecode layout: * * CALL_JQ * * (2 units) * (2 units each) * * * A closure is: * * (a relative frame count chased via the current frame's env) * (an index of a subfunction or closure in that frame) * * We're looking for: * * a) the next instruction is a RET or a chain of unconditional JUMPs * that ends in a RET, and * * b) none of the closures -callee included- have level == 0. */ static uint16_t tail_call_analyze(uint16_t *pc) { assert(*pc == CALL_JQ); pc++; // + 1 for the callee closure for (uint16_t nclosures = *pc++ + 1; nclosures > 0; pc++, nclosures--) { if (*pc++ == 0) return CALL_JQ; } if (ret_follows(pc)) return TAIL_CALL_JQ; return CALL_JQ; } static struct bytecode *optimize_code(struct bytecode *bc) { uint16_t *pc = bc->code; // FIXME: Don't mutate bc->code... while (pc < bc->code + bc->codelen) { switch (*pc) { case CALL_JQ: *pc = tail_call_analyze(pc); break; // Other bytecode optimizations here. A peephole optimizer would // fit right in. default: break; } pc += bytecode_operation_length(pc); } return bc; } static struct bytecode *optimize(struct bytecode *bc) { for (int i=0; insubfunctions; i++) { bc->subfunctions[i] = optimize(bc->subfunctions[i]); } return optimize_code(bc); } static jv args2obj(jv args) { if (jv_get_kind(args) == JV_KIND_OBJECT) return args; assert(jv_get_kind(args) == JV_KIND_ARRAY); jv r = jv_object(); jv kk = jv_string("name"); jv vk = jv_string("value"); jv_array_foreach(args, i, v) r = jv_object_set(r, jv_object_get(jv_copy(v), jv_copy(kk)), jv_object_get(v, jv_copy(vk))); jv_free(args); jv_free(kk); jv_free(vk); return r; } int jq_compile_args(jq_state *jq, const char* str, jv args) { jv_nomem_handler(jq->nomem_handler, jq->nomem_handler_data); assert(jv_get_kind(args) == JV_KIND_ARRAY || jv_get_kind(args) == JV_KIND_OBJECT); struct locfile* locations; locations = locfile_init(jq, "", str, strlen(str)); block program; jq_reset(jq); if (jq->bc) { bytecode_free(jq->bc); jq->bc = 0; } int nerrors = load_program(jq, locations, &program); if (nerrors == 0) { nerrors = builtins_bind(jq, &program); if (nerrors == 0) nerrors = block_compile(program, &jq->bc, locations, args2obj(args)); else jv_free(args); } else jv_free(args); if (nerrors) jq_report_error(jq, jv_string_fmt("jq: %d compile %s", nerrors, nerrors > 1 ? "errors" : "error")); if (jq->bc) jq->bc = optimize(jq->bc); locfile_free(locations); return jq->bc != NULL; } int jq_compile(jq_state *jq, const char* str) { return jq_compile_args(jq, str, jv_object()); } jv jq_get_jq_origin(jq_state *jq) { return jq_get_attr(jq, jv_string("JQ_ORIGIN")); } jv jq_get_prog_origin(jq_state *jq) { return jq_get_attr(jq, jv_string("PROGRAM_ORIGIN")); } jv jq_get_lib_dirs(jq_state *jq) { jv lib_dirs = jq_get_attr(jq, jv_string("JQ_LIBRARY_PATH")); return jv_is_valid(lib_dirs) ? lib_dirs : jv_array(); } void jq_set_attrs(jq_state *jq, jv attrs) { assert(jv_get_kind(attrs) == JV_KIND_OBJECT); jv_free(jq->attrs); jq->attrs = attrs; } void jq_set_attr(jq_state *jq, jv attr, jv val) { jq->attrs = jv_object_set(jq->attrs, attr, val); } jv jq_get_attr(jq_state *jq, jv attr) { return jv_object_get(jv_copy(jq->attrs), attr); } void jq_dump_disassembly(jq_state *jq, int indent) { dump_disassembly(indent, jq->bc); } void jq_set_input_cb(jq_state *jq, jq_input_cb cb, void *data) { jq->input_cb = cb; jq->input_cb_data = data; } void jq_get_input_cb(jq_state *jq, jq_input_cb *cb, void **data) { *cb = jq->input_cb; *data = jq->input_cb_data; } void jq_set_debug_cb(jq_state *jq, jq_msg_cb cb, void *data) { jq->debug_cb = cb; jq->debug_cb_data = data; } void jq_get_debug_cb(jq_state *jq, jq_msg_cb *cb, void **data) { *cb = jq->debug_cb; *data = jq->debug_cb_data; } void jq_set_stderr_cb(jq_state *jq, jq_msg_cb cb, void *data) { jq->stderr_cb = cb; jq->stderr_cb_data = data; } void jq_get_stderr_cb(jq_state *jq, jq_msg_cb *cb, void **data) { *cb = jq->stderr_cb; *data = jq->stderr_cb_data; } void jq_halt(jq_state *jq, jv exit_code, jv error_message) { assert(!jq->halted); jq->halted = 1; jq->exit_code = exit_code; jq->error_message = error_message; } int jq_halted(jq_state *jq) { return jq->halted; } jv jq_get_exit_code(jq_state *jq) { return jv_copy(jq->exit_code); } jv jq_get_error_message(jq_state *jq) { return jv_copy(jq->error_message); } jq-1.8.2/src/jv_thread.h0000644000175100017510000000336615215513536010543 #ifndef JV_THREAD_H #define JV_THREAD_H #ifdef WIN32 #ifndef __MINGW32__ #include #include #include /* Copied from Heimdal: pthread-like mutexes for WIN32 -- see lib/base/heimbase.h in Heimdal */ typedef struct pthread_mutex { HANDLE h; } pthread_mutex_t; #define PTHREAD_MUTEX_INITIALIZER { INVALID_HANDLE_VALUE } static inline int pthread_mutex_init(pthread_mutex_t *m) { m->h = CreateSemaphore(NULL, 1, 1, NULL); if (m->h == INVALID_HANDLE_VALUE) return EAGAIN; return 0; } static inline int pthread_mutex_lock(pthread_mutex_t *m) { HANDLE h, new_h; int created = 0; h = InterlockedCompareExchangePointer(&m->h, m->h, m->h); if (h == INVALID_HANDLE_VALUE || h == NULL) { created = 1; new_h = CreateSemaphore(NULL, 0, 1, NULL); if (new_h == INVALID_HANDLE_VALUE) return EAGAIN; if (InterlockedCompareExchangePointer(&m->h, new_h, h) != h) { created = 0; CloseHandle(new_h); } } if (!created) WaitForSingleObject(m->h, INFINITE); return 0; } static inline int pthread_mutex_unlock(pthread_mutex_t *m) { if (ReleaseSemaphore(m->h, 1, NULL) == FALSE) return EPERM; return 0; } static inline int pthread_mutex_destroy(pthread_mutex_t *m) { HANDLE h; h = InterlockedCompareExchangePointer(&m->h, INVALID_HANDLE_VALUE, m->h); if (h != INVALID_HANDLE_VALUE) CloseHandle(h); return 0; } typedef unsigned long pthread_key_t; int pthread_key_create(pthread_key_t *, void (*)(void *)); int pthread_setspecific(pthread_key_t, void *); void *pthread_getspecific(pthread_key_t); #else #include #endif #else #include #endif #endif /* JV_THREAD_H */ jq-1.8.2/src/builtin.h0000644000175100017510000000065415215513536010240 #ifndef BUILTIN_H #define BUILTIN_H #include "jq.h" #include "bytecode.h" #include "compile.h" int builtins_bind(jq_state *, block*); #define BINOPS \ BINOP(plus) \ BINOP(minus) \ BINOP(multiply) \ BINOP(divide) \ BINOP(mod) \ BINOP(equal) \ BINOP(notequal) \ BINOP(less) \ BINOP(lesseq) \ BINOP(greater) \ BINOP(greatereq) \ #define BINOP(name) jv binop_ ## name(jv, jv); BINOPS #undef BINOP #endif jq-1.8.2/src/jq.h0000644000175100017510000000476615215513536007214 #ifndef JQ_H #define JQ_H #include #include "jv.h" #ifdef __cplusplus extern "C" { #endif enum { JQ_DEBUG_TRACE = 1, JQ_DEBUG_TRACE_DETAIL = 2, JQ_DEBUG_TRACE_ALL = JQ_DEBUG_TRACE | JQ_DEBUG_TRACE_DETAIL, }; typedef struct jq_state jq_state; typedef void (*jq_msg_cb)(void *, jv); jq_state *jq_init(void); void jq_set_error_cb(jq_state *, jq_msg_cb, void *); void jq_get_error_cb(jq_state *, jq_msg_cb *, void **); void jq_set_nomem_handler(jq_state *, void (*)(void *), void *); jv jq_format_error(jv msg); void jq_report_error(jq_state *, jv); int jq_compile(jq_state *, const char*); int jq_compile_args(jq_state *, const char*, jv); void jq_dump_disassembly(jq_state *, int); void jq_start(jq_state *, jv value, int); jv jq_next(jq_state *); void jq_teardown(jq_state **); void jq_halt(jq_state *, jv, jv); int jq_halted(jq_state *); jv jq_get_exit_code(jq_state *); jv jq_get_error_message(jq_state *); typedef jv (*jq_input_cb)(jq_state *, void *); void jq_set_input_cb(jq_state *, jq_input_cb, void *); void jq_get_input_cb(jq_state *, jq_input_cb *, void **); void jq_set_debug_cb(jq_state *, jq_msg_cb, void *); void jq_get_debug_cb(jq_state *, jq_msg_cb *, void **); void jq_set_stderr_cb(jq_state *, jq_msg_cb, void *); void jq_get_stderr_cb(jq_state *, jq_msg_cb *, void **); void jq_set_attrs(jq_state *, jv); jv jq_get_attrs(jq_state *); jv jq_get_jq_origin(jq_state *); jv jq_get_prog_origin(jq_state *); jv jq_get_lib_dirs(jq_state *); void jq_set_attr(jq_state *, jv, jv); jv jq_get_attr(jq_state *, jv); /* * We use char * instead of jf for filenames here because filenames * should be in the process' locale's codeset, which may not be UTF-8, * whereas jv string values must be in UTF-8. This way the caller * doesn't have to perform any codeset conversions. */ typedef struct jq_util_input_state jq_util_input_state; typedef void (*jq_util_msg_cb)(void *, const char *); jq_util_input_state *jq_util_input_init(jq_util_msg_cb, void *); void jq_util_input_set_parser(jq_util_input_state *, jv_parser *, int); void jq_util_input_free(jq_util_input_state **); void jq_util_input_add_input(jq_util_input_state *, const char *); int jq_util_input_errors(jq_util_input_state *); jv jq_util_input_next_input(jq_util_input_state *); jv jq_util_input_next_input_cb(jq_state *, void *); jv jq_util_input_get_position(jq_state*); jv jq_util_input_get_current_filename(jq_state*); jv jq_util_input_get_current_line(jq_state*); int jq_set_colors(const char *); #ifdef __cplusplus } #endif #endif /* !JQ_H */ jq-1.8.2/src/jv_dtoa.h0000644000175100017510000000113315215513536010211 #ifndef JV_DTOA_H #define JV_DTOA_H #define Kmax 7 struct Bigint; struct dtoa_context { struct Bigint *freelist[Kmax+1]; struct Bigint *p5s; }; void jvp_dtoa_context_init(struct dtoa_context* ctx); void jvp_dtoa_context_free(struct dtoa_context* ctx); double jvp_strtod(struct dtoa_context* C, const char* s, char** se); char* jvp_dtoa(struct dtoa_context* C, double dd, int mode, int ndigits, int *decpt, int *sign, char **rve); void jvp_freedtoa(struct dtoa_context* C, char *s); #define JVP_DTOA_FMT_MAX_LEN 64 char* jvp_dtoa_fmt(struct dtoa_context* C, register char *b, double x); #endif jq-1.8.2/src/jv_private.h0000644000175100017510000000016315215513536010736 #ifndef JV_PRIVATE #define JV_PRIVATE int jvp_number_cmp(jv, jv); int jvp_number_is_nan(jv); #endif //JV_PRIVATE jq-1.8.2/src/linker.c0000644000175100017510000004031515215513536010047 #include #include #include #include #include #include #include #include #include #ifdef WIN32 #include #endif #include "jq_parser.h" #include "locfile.h" #include "jv.h" #include "jq.h" #include "util.h" #include "compile.h" #include "jv_alloc.h" struct lib_entry { char *name; block def; int loading; }; struct lib_loading_state { struct lib_entry *entries; uint64_t ct; }; static int load_library(jq_state *jq, jv lib_path, int is_data, int raw, int optional, const char *as, block *out_block, struct lib_loading_state *lib_state); static int path_is_relative(jv p) { const char *s = jv_string_value(p); #ifdef WIN32 int res = PathIsRelativeA(s); #else int res = *s != '/'; #endif jv_free(p); return res; } // Given a lib_path to search first, creates a chain of search paths // in the following order: // 1. lib_path // 2. -L paths passed in on the command line (from jq_state*) or builtin list static jv build_lib_search_chain(jq_state *jq, jv search_path, jv jq_origin, jv lib_origin) { assert(jv_get_kind(search_path) == JV_KIND_ARRAY); jv expanded = jv_array(); jv expanded_elt; jv err = jv_null(); jv_array_foreach(search_path, i, path) { if (jv_get_kind(path) != JV_KIND_STRING) { jv_free(path); continue; } path = expand_path(path); if (!jv_is_valid(path)) { jv_free(err); err = path; path = jv_null(); continue; } if (strcmp(".",jv_string_value(path)) == 0) { expanded_elt = jv_copy(path); } else if (strncmp("$ORIGIN/",jv_string_value(path),sizeof("$ORIGIN/") - 1) == 0) { expanded_elt = jv_string_fmt("%s/%s", jv_string_value(jq_origin), jv_string_value(path) + sizeof ("$ORIGIN/") - 1); } else if (jv_get_kind(lib_origin) == JV_KIND_STRING && path_is_relative(jv_copy(path))) { expanded_elt = jv_string_fmt("%s/%s", jv_string_value(lib_origin), jv_string_value(path)); } else { expanded_elt = path; path = jv_invalid(); } expanded = jv_array_append(expanded, expanded_elt); jv_free(path); } jv_free(jq_origin); jv_free(lib_origin); jv_free(search_path); return JV_ARRAY(expanded, err); } // Doesn't actually check that name not be an absolute path, and we // don't have to: we always append relative paths to others (with a '/' // in between). static jv validate_relpath(jv name) { const char *s = jv_string_value(name); if (strlen(s) != (size_t)jv_string_length_bytes(jv_copy(name))) { jv_free(name); return jv_invalid_with_msg(jv_string("Module path contains a NUL byte")); } if (strchr(s, '\\')) { jv res = jv_invalid_with_msg(jv_string_fmt("Modules must be named by relative paths using '/', not '\\' (%s)", s)); jv_free(name); return res; } jv components = jv_string_split(jv_copy(name), jv_string("/")); jv_array_foreach(components, i, x) { if (!strcmp(jv_string_value(x), "..")) { jv_free(x); jv_free(components); jv res = jv_invalid_with_msg(jv_string_fmt("Relative paths to modules may not traverse to parent directories (%s)", s)); jv_free(name); return res; } if (i > 0 && jv_equal(jv_copy(x), jv_array_get(jv_copy(components), i - 1))) { jv_free(x); jv_free(components); jv res = jv_invalid_with_msg(jv_string_fmt("module names must not have equal consecutive components: %s", jv_string_value(name))); jv_free(name); return res; } jv_free(x); } jv_free(components); return name; } // Assumes name has been validated static jv jv_basename(jv name) { const char *s = jv_string_value(name); const char *p = strrchr(s, '/'); if (!p) return name; jv res = jv_string_fmt("%s", p); jv_free(name); return res; } // Asummes validated relative path to module static jv find_lib(jq_state *jq, jv rel_path, jv search, const char *suffix, jv jq_origin, jv lib_origin) { if (!jv_is_valid(rel_path)) { jv_free(search); jv_free(jq_origin); jv_free(lib_origin); return rel_path; } if (jv_get_kind(rel_path) != JV_KIND_STRING) { jv_free(rel_path); jv_free(search); jv_free(jq_origin); jv_free(lib_origin); return jv_invalid_with_msg(jv_string_fmt("Module path must be a string")); } if (jv_get_kind(search) != JV_KIND_ARRAY) { jv_free(rel_path); jv_free(search); jv_free(jq_origin); jv_free(lib_origin); return jv_invalid_with_msg(jv_string_fmt("Module search path must be an array")); } struct stat st; int ret; // Ideally we should cache this somewhere search = build_lib_search_chain(jq, search, jq_origin, lib_origin); jv err = jv_array_get(jv_copy(search), 1); search = jv_array_get(search, 0); jv bname = jv_basename(jv_copy(rel_path)); jv_array_foreach(search, i, spath) { if (jv_get_kind(spath) == JV_KIND_NULL) { jv_free(spath); break; } if (jv_get_kind(spath) != JV_KIND_STRING || strcmp(jv_string_value(spath), "") == 0) { jv_free(spath); continue; /* XXX report non-strings in search path?? */ } // Try ${search_dir}/${rel_path}.jq jv testpath = jq_realpath(jv_string_fmt("%s/%s%s", jv_string_value(spath), jv_string_value(rel_path), suffix)); ret = stat(jv_string_value(testpath),&st); if (ret == -1 && errno == ENOENT) { jv_free(testpath); // Try ${search_dir}/$(dirname ${rel_path})/jq/main.jq testpath = jq_realpath(jv_string_fmt("%s/%s/%s%s", jv_string_value(spath), jv_string_value(rel_path), "jq/main", suffix)); ret = stat(jv_string_value(testpath),&st); } if (ret == -1 && errno == ENOENT) { jv_free(testpath); // Try ${search_dir}/${rel_path}/$(basename ${rel_path}).jq testpath = jq_realpath(jv_string_fmt("%s/%s/%s%s", jv_string_value(spath), jv_string_value(rel_path), jv_string_value(bname), suffix)); ret = stat(jv_string_value(testpath),&st); } if (ret == 0) { jv_free(err); jv_free(rel_path); jv_free(search); jv_free(bname); jv_free(spath); return testpath; } jv_free(testpath); jv_free(spath); } jv output; if (!jv_is_valid(err)) { err = jv_invalid_get_msg(err); output = jv_invalid_with_msg(jv_string_fmt("module not found: %s (%s)", jv_string_value(rel_path), jv_string_value(err))); } else { output = jv_invalid_with_msg(jv_string_fmt("module not found: %s", jv_string_value(rel_path))); } jv_free(err); jv_free(rel_path); jv_free(search); jv_free(bname); return output; } static jv default_search(jq_state *jq, jv value) { if (!jv_is_valid(value)) { // dependent didn't say; prepend . to system search path listj jv_free(value); return jv_array_concat(JV_ARRAY(jv_string(".")), jq_get_lib_dirs(jq)); } if (jv_get_kind(value) != JV_KIND_ARRAY) return JV_ARRAY(value); return value; } // XXX Split this into a util that takes a callback, and then... static int process_dependencies(jq_state *jq, jv jq_origin, jv lib_origin, block *src_block, struct lib_loading_state *lib_state) { jv deps = block_take_imports(src_block); block bk = *src_block; int nerrors = 0; // XXX This is a backward jv_array_foreach because bindings go in reverse for (int i = jv_array_length(jv_copy(deps)); i > 0; ) { i--; jv dep = jv_array_get(jv_copy(deps), i); const char *as_str = NULL; int is_data = jv_get_kind(jv_object_get(jv_copy(dep), jv_string("is_data"))) == JV_KIND_TRUE; int raw = 0; jv v = jv_object_get(jv_copy(dep), jv_string("raw")); if (jv_get_kind(v) == JV_KIND_TRUE) raw = 1; int optional = 0; if (jv_get_kind(jv_object_get(jv_copy(dep), jv_string("optional"))) == JV_KIND_TRUE) optional = 1; jv_free(v); jv relpath = validate_relpath(jv_object_get(jv_copy(dep), jv_string("relpath"))); jv as = jv_object_get(jv_copy(dep), jv_string("as")); assert(!jv_is_valid(as) || jv_get_kind(as) == JV_KIND_STRING); if (jv_get_kind(as) == JV_KIND_STRING) as_str = jv_string_value(as); jv search = default_search(jq, jv_object_get(dep, jv_string("search"))); // dep is now freed; do not reuse // find_lib does a lot of work that could be cached... jv resolved = find_lib(jq, relpath, search, is_data ? ".json" : ".jq", jv_copy(jq_origin), jv_copy(lib_origin)); // XXX ...move the rest of this into a callback. if (!jv_is_valid(resolved)) { jv_free(as); if (optional) { jv_free(resolved); continue; } jv emsg = jv_invalid_get_msg(resolved); jq_report_error(jq, jv_string_fmt("jq: error: %s\n",jv_string_value(emsg))); jv_free(emsg); jv_free(deps); jv_free(jq_origin); jv_free(lib_origin); return 1; } if (is_data) { // Can't reuse data libs because the wrong name is bound block dep_def_block; nerrors += load_library(jq, resolved, is_data, raw, optional, as_str, &dep_def_block, lib_state); if (nerrors == 0) { // Bind as both $data::data and $data for backward compatibility vs common sense bk = block_bind_library(dep_def_block, bk, OP_IS_CALL_PSEUDO, as_str); bk = block_bind_library(dep_def_block, bk, OP_IS_CALL_PSEUDO, NULL); } } else { uint64_t state_idx = 0; for (; state_idx < lib_state->ct; ++state_idx) { if (strcmp(lib_state->entries[state_idx].name, jv_string_value(resolved)) == 0) break; } if (state_idx < lib_state->ct) { // Found if (lib_state->entries[state_idx].loading) { jq_report_error(jq, jv_string_fmt("jq: error: circular import of %s\n", jv_string_value(resolved))); jv_free(resolved); jv_free(as); jv_free(deps); jv_free(jq_origin); jv_free(lib_origin); return 1; } jv_free(resolved); // Bind the library to the program bk = block_bind_library(lib_state->entries[state_idx].def, bk, OP_IS_CALL_PSEUDO, as_str); } else { // Not found. Add it to the table before binding. block dep_def_block = gen_noop(); nerrors += load_library(jq, resolved, is_data, raw, optional, as_str, &dep_def_block, lib_state); // resolved has been freed if (nerrors == 0) { // Bind the library to the program bk = block_bind_library(dep_def_block, bk, OP_IS_CALL_PSEUDO, as_str); } } } jv_free(as); } jv_free(lib_origin); jv_free(jq_origin); jv_free(deps); return nerrors; } // Loads the library at lib_path into lib_state, putting the library's defs // into *out_block static int load_library(jq_state *jq, jv lib_path, int is_data, int raw, int optional, const char *as, block *out_block, struct lib_loading_state *lib_state) { int nerrors = 0; struct locfile* src = NULL; block program; jv data; if (is_data && !raw) data = jv_load_file(jv_string_value(lib_path), 0); else data = jv_load_file(jv_string_value(lib_path), 1); int state_idx; if (!jv_is_valid(data)) { program = gen_noop(); if (!optional) { if (jv_invalid_has_msg(jv_copy(data))) data = jv_invalid_get_msg(data); else data = jv_string("unknown error"); jq_report_error(jq, jv_string_fmt("jq: error loading data file %s: %s\n", jv_string_value(lib_path), jv_string_value(data))); nerrors++; } } else if (is_data) { // import "foo" as $bar; program = gen_const_global(jv_copy(data), as); state_idx = lib_state->ct++; lib_state->entries = jv_mem_realloc(lib_state->entries, lib_state->ct * sizeof(struct lib_entry)); lib_state->entries[state_idx].name = strdup(jv_string_value(lib_path)); lib_state->entries[state_idx].def = program; lib_state->entries[state_idx].loading = 0; } else { // import "foo" as bar; src = locfile_init(jq, jv_string_value(lib_path), jv_string_value(data), jv_string_length_bytes(jv_copy(data))); nerrors += jq_parse_library(src, &program); locfile_free(src); if (nerrors == 0) { // Register the library before processing its dependencies so that // circular imports can be detected. state_idx = lib_state->ct++; lib_state->entries = jv_mem_realloc(lib_state->entries, lib_state->ct * sizeof(struct lib_entry)); lib_state->entries[state_idx].name = strdup(jv_string_value(lib_path)); lib_state->entries[state_idx].def = gen_noop(); lib_state->entries[state_idx].loading = 1; char *lib_origin = strdup(jv_string_value(lib_path)); nerrors += process_dependencies(jq, jq_get_jq_origin(jq), jv_string(dirname(lib_origin)), &program, lib_state); free(lib_origin); program = block_bind_self(program, OP_IS_CALL_PSEUDO); lib_state->entries[state_idx].def = program; lib_state->entries[state_idx].loading = 0; } } *out_block = program; jv_free(lib_path); jv_free(data); return nerrors; } // FIXME It'd be nice to have an option to search the same search path // as we do in process_dependencies. jv load_module_meta(jq_state *jq, jv mod_relpath) { // We can't know the caller's origin; we could though, if it was passed in jv lib_path = find_lib(jq, validate_relpath(mod_relpath), jq_get_lib_dirs(jq), ".jq", jq_get_jq_origin(jq), jv_null()); if (!jv_is_valid(lib_path)) return lib_path; jv meta = jv_null(); jv data = jv_load_file(jv_string_value(lib_path), 1); if (jv_is_valid(data)) { block program; struct locfile* src = locfile_init(jq, jv_string_value(lib_path), jv_string_value(data), jv_string_length_bytes(jv_copy(data))); int nerrors = jq_parse_library(src, &program); if (nerrors == 0) { meta = block_module_meta(program); if (jv_get_kind(meta) == JV_KIND_NULL) meta = jv_object(); meta = jv_object_set(meta, jv_string("deps"), block_take_imports(&program)); meta = jv_object_set(meta, jv_string("defs"), block_list_funcs(program, 0)); } locfile_free(src); block_free(program); } jv_free(lib_path); jv_free(data); return meta; } int load_program(jq_state *jq, struct locfile* src, block *out_block) { int nerrors = 0; block program; struct lib_loading_state lib_state = {0,0}; nerrors = jq_parse(src, &program); if (nerrors) return nerrors; if (!block_has_main(program)) { jq_report_error(jq, jv_string("jq: error: Top-level program not given (try \".\")")); block_free(program); return 1; } jv home = get_home(); if (jv_is_valid(home)) { /* Import ~/.jq as a library named "" found in $HOME or %USERPROFILE% */ block import = gen_import_meta(gen_import(jv_string(""), jv_invalid(), 0), gen_const(JV_OBJECT( jv_string("optional"), jv_true(), jv_string("search"), home))); program = BLOCK(import, program); } else { // silently ignore if home dir not determined jv_free(home); } nerrors = process_dependencies(jq, jq_get_jq_origin(jq), jq_get_prog_origin(jq), &program, &lib_state); block libs = gen_noop(); for (uint64_t i = 0; i < lib_state.ct; ++i) { free(lib_state.entries[i].name); if (nerrors == 0 && !block_is_const(lib_state.entries[i].def)) libs = block_join(libs, lib_state.entries[i].def); else block_free(lib_state.entries[i].def); } free(lib_state.entries); if (nerrors) block_free(program); else *out_block = block_drop_unreferenced(block_join(libs, program)); return nerrors; } jq-1.8.2/src/exec_stack.h0000644000175100017510000000676315215513536010712 #ifndef EXEC_STACK_H #define EXEC_STACK_H #include #include #include #include #include #include #include "jv_alloc.h" /* * The stack is a directed forest of variably sized blocks. Each block has a * "next" block which is at a higher memory address, or 0 if the block has no * "next" block. More than one block may have no "next" block. A block may be * the "next" block of more than one other block. Pushed blocks are added at * the low-address end of the stack. * * Stack pointers are negative integers that are offsets relative to "mem_end", * the end of the allocated region. The stack "bound" is the stack pointer of * the last block that would be able to fit in the currently allocated region. * The stack "limit" is the stack pointer of the last block currently in the * stack. The stack pointer of the "next" block is stored directly below each * block. * * <- mem_end = 0x100 * 0xF8 +------------+ * 0xF0 | | * 0xE8 +------------+ <- stack_ptr1 = -0x18 * 0xE0 next = 0 * 0xD8 +------------+ * 0xD0 | | * 0xC8 | | * 0xC0 +------------+ <- stack_ptr2 = limit = -0x40 * 0xB8 next = -0x18 * 0xB0 * 0xA8 <- bound = -0x58 * 0xA0 */ struct determine_alignment { char x; union { int i; double d; uint64_t u64; size_t sz; void* ptr; } u; }; enum {ALIGNMENT = offsetof(struct determine_alignment, u)}; static size_t align_round_up(size_t sz) { return ((sz + (ALIGNMENT - 1)) / ALIGNMENT) * ALIGNMENT; } typedef int stack_ptr; struct stack { char* mem_end; // one-past-the-end of allocated region stack_ptr bound; stack_ptr limit; // 0 - stack is empty }; static void stack_init(struct stack* s) { s->mem_end = 0; s->bound = ALIGNMENT; s->limit = 0; } static void stack_reset(struct stack* s) { assert(s->limit == 0 && "stack freed while not empty"); if(s->mem_end != NULL) { char* mem_start = s->mem_end - ( -s->bound + ALIGNMENT); free(mem_start); } stack_init(s); } static int stack_pop_will_free(struct stack* s, stack_ptr p) { return p == s->limit; } static void* stack_block(struct stack* s, stack_ptr p) { return (void*)(s->mem_end + p); } static stack_ptr* stack_block_next(struct stack* s, stack_ptr p) { return &((stack_ptr*)stack_block(s, p))[-1]; } static void stack_reallocate(struct stack* s, size_t sz) { size_t old_mem_length = (size_t)(-(s->bound)) + ALIGNMENT; char* old_mem_start = s->mem_end != NULL ? s->mem_end - old_mem_length : NULL; size_t new_mem_length = align_round_up((old_mem_length + sz + 256) * 2); if (new_mem_length > INT_MAX) { fprintf(stderr, "jq: error: cannot allocate memory\n"); abort(); } char* new_mem_start = jv_mem_realloc(old_mem_start, new_mem_length); memmove(new_mem_start + (new_mem_length - old_mem_length), new_mem_start, old_mem_length); s->mem_end = new_mem_start + new_mem_length; s->bound = -(int)(new_mem_length - ALIGNMENT); } static stack_ptr stack_push_block(struct stack* s, stack_ptr p, size_t sz) { int alloc_sz = align_round_up(sz) + ALIGNMENT; stack_ptr r = s->limit - alloc_sz; if (r < s->bound) { stack_reallocate(s, alloc_sz); } s->limit = r; *stack_block_next(s, r) = p; return r; } static stack_ptr stack_pop_block(struct stack* s, stack_ptr p, size_t sz) { stack_ptr r = *stack_block_next(s, p); if (p == s->limit) { int alloc_sz = align_round_up(sz) + ALIGNMENT; s->limit += alloc_sz; } return r; } #endif jq-1.8.2/src/jv_alloc.h0000644000175100017510000000061415215513536010357 #ifndef JV_ALLOC_H #define JV_ALLOC_H #include void* jv_mem_alloc(size_t); void* jv_mem_alloc_unguarded(size_t); void* jv_mem_calloc(size_t, size_t); void* jv_mem_calloc_unguarded(size_t, size_t); char* jv_mem_strdup(const char *); char* jv_mem_strdup_unguarded(const char *); void jv_mem_free(void*); __attribute__((warn_unused_result)) void* jv_mem_realloc(void*, size_t); #endif jq-1.8.2/src/opcode_list.h0000644000175100017510000000233215215513536011071 OP(LOADK, CONSTANT, 1, 1) OP(DUP, NONE, 1, 2) OP(DUPN, NONE, 1, 2) OP(DUP2, NONE, 2, 3) OP(PUSHK_UNDER, CONSTANT, 1, 2) OP(POP, NONE, 1, 0) OP(LOADV, VARIABLE, 1, 1) OP(LOADVN, VARIABLE, 1, 1) OP(STOREV, VARIABLE, 1, 0) OP(STORE_GLOBAL, GLOBAL, 0, 0) OP(INDEX, NONE, 2, 1) OP(INDEX_OPT, NONE, 2, 1) OP(EACH, NONE, 1, 1) OP(EACH_OPT, NONE, 1, 1) OP(FORK, BRANCH, 0, 0) OP(TRY_BEGIN, BRANCH, 0, 0) OP(TRY_END, NONE, 0, 0) OP(JUMP, BRANCH, 0, 0) OP(JUMP_F,BRANCH, 1, 0) OP(BACKTRACK, NONE, 0, 0) OP(APPEND, VARIABLE,1, 0) OP(INSERT, NONE, 4, 2) OP(RANGE, VARIABLE, 1, 1) OP(SUBEXP_BEGIN, NONE, 1, 2) OP(SUBEXP_END, NONE, 2, 2) OP(PATH_BEGIN, NONE, 1, 2) OP(PATH_END, NONE, 2, 1) OP(CALL_BUILTIN, CFUNC, -1, 1) OP(CALL_JQ, UFUNC, 1, 1) OP(RET, NONE, 1, 1) OP(TAIL_CALL_JQ, UFUNC, 1, 1) OP(CLOSURE_PARAM, DEFINITION, 0, 0) OP(CLOSURE_REF, CLOSURE_REF_IMM, 0, 0) OP(CLOSURE_CREATE, DEFINITION, 0, 0) OP(CLOSURE_CREATE_C, DEFINITION, 0, 0) OP(TOP, NONE, 0, 0) OP(CLOSURE_PARAM_REGULAR, DEFINITION, 0, 0) OP(DEPS, CONSTANT, 0, 0) OP(MODULEMETA, CONSTANT, 0, 0) OP(GENLABEL, NONE, 0, 1) OP(DESTRUCTURE_ALT, BRANCH, 0, 0) OP(STOREVN, VARIABLE, 1, 0) OP(ERRORK, CONSTANT, 1, 0) jq-1.8.2/src/jv_dtoa.c0000644000175100017510000025536315215513536010224 /**************************************************************** * * The author of this software is David M. Gay. * * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. * * Permission to use, copy, modify, and distribute this software for any * purpose without fee is hereby granted, provided that this entire notice * is included in all copies of any software which is or includes a copy * or modification of this software and in all copies of the supporting * documentation for such software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. * ***************************************************************/ /* Please send bug reports to David M. Gay (dmg at acm dot org, * with " at " changed at "@" and " dot " changed to "."). */ /* On a machine with IEEE extended-precision registers, it is * necessary to specify double-precision (53-bit) rounding precision * before invoking strtod or dtoa. If the machine uses (the equivalent * of) Intel 80x87 arithmetic, the call * _control87(PC_53, MCW_PC); * does this with many compilers. Whether this or another call is * appropriate depends on the compiler; for this to work, it may be * necessary to #include "float.h" or another system-dependent header * file. */ /* strtod for IEEE-, VAX-, and IBM-arithmetic machines. * (Note that IEEE arithmetic is disabled by gcc's -ffast-math flag.) * * This strtod returns a nearest machine number to the input decimal * string (or sets errno to ERANGE). With IEEE arithmetic, ties are * broken by the IEEE round-even rule. Otherwise ties are broken by * biased rounding (add half and chop). * * Inspired loosely by William D. Clinger's paper "How to Read Floating * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. * * Modifications: * * 1. We only require IEEE, IBM, or VAX double-precision * arithmetic (not IEEE double-extended). * 2. We get by with floating-point arithmetic in a case that * Clinger missed -- when we're computing d * 10^n * for a small integer d and the integer n is not too * much larger than 22 (the maximum integer k for which * we can represent 10^k exactly), we may be able to * compute (d*10^k) * 10^(e-k) with just one roundoff. * 3. Rather than a bit-at-a-time adjustment of the binary * result in the hard case, we use floating-point * arithmetic to determine the adjustment to within * one bit; only in really hard cases do we need to * compute a second residual. * 4. Because of 3., we don't need a large table of powers of 10 * for ten-to-e (just some small tables, e.g. of 10^k * for 0 <= k <= 22). */ /* * #define IEEE_8087 for IEEE-arithmetic machines where the least * significant byte has the lowest address. * #define IEEE_MC68k for IEEE-arithmetic machines where the most * significant byte has the lowest address. * #define Long int on machines with 32-bit ints and 64-bit longs. * #define IBM for IBM mainframe-style floating-point arithmetic. * #define VAX for VAX-style floating-point arithmetic (D_floating). * #define No_leftright to omit left-right logic in fast floating-point * computation of dtoa. This will cause dtoa modes 4 and 5 to be * treated the same as modes 2 and 3 for some inputs. * #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 * and strtod and dtoa should round accordingly. Unless Trust_FLT_ROUNDS * is also #defined, fegetround() will be queried for the rounding mode. * Note that both FLT_ROUNDS and fegetround() are specified by the C99 * standard (and are specified to be consistent, with fesetround() * affecting the value of FLT_ROUNDS), but that some (Linux) systems * do not work correctly in this regard, so using fegetround() is more * portable than using FLT_ROUNDS directly. * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 * and Honor_FLT_ROUNDS is not #defined. * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines * that use extended-precision instructions to compute rounded * products and quotients) with IBM. * #define ROUND_BIASED for IEEE-format with biased rounding and arithmetic * that rounds toward +Infinity. * #define ROUND_BIASED_without_Round_Up for IEEE-format with biased * rounding when the underlying floating-point arithmetic uses * unbiased rounding. This prevent using ordinary floating-point * arithmetic when the result could be computed with one rounding error. * #define Inaccurate_Divide for IEEE-format with correctly rounded * products but inaccurate quotients, e.g., for Intel i860. * #define NO_LONG_LONG on machines that do not have a "long long" * integer type (of >= 64 bits). On such machines, you can * #define Just_16 to store 16 bits per 32-bit Long when doing * high-precision integer arithmetic. Whether this speeds things * up or slows things down depends on the machine and the number * being converted. If long long is available and the name is * something other than "long long", #define Llong to be the name, * and if "unsigned Llong" does not work as an unsigned version of * Llong, #define #ULLong to be the corresponding unsigned type. * #define KR_headers for old-style C function headers. * #define Bad_float_h if your system lacks a float.h or if it does not * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) * if memory is available and otherwise does something you deem * appropriate. If MALLOC is undefined, malloc will be invoked * directly -- and assumed always to succeed. Similarly, if you * want something other than the system's free() to be called to * recycle memory acquired from MALLOC, #define FREE to be the * name of the alternate routine. (FREE or free is only called in * pathological cases, e.g., in a dtoa call after a dtoa return in * mode 3 with thousands of digits requested.) * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making * memory allocations from a private pool of memory when possible. * When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes, * unless #defined to be a different length. This default length * suffices to get rid of MALLOC calls except for unusual cases, * such as decimal-to-binary conversion of a very long string of * digits. The longest string dtoa can return is about 751 bytes * long. For conversions by strtod of strings of 800 digits and * all dtoa conversions in single-threaded executions with 8-byte * pointers, PRIVATE_MEM >= 7400 appears to suffice; with 4-byte * pointers, PRIVATE_MEM >= 7112 appears adequate. * #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK * #defined automatically on IEEE systems. On such systems, * when INFNAN_CHECK is #defined, strtod checks * for Infinity and NaN (case insensitively). On some systems * (e.g., some HP systems), it may be necessary to #define NAN_WORD0 * appropriately -- to the most significant word of a quiet NaN. * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined, * strtod also accepts (case insensitively) strings of the form * NaN(x), where x is a string of hexadecimal digits and spaces; * if there is only one string of hexadecimal digits, it is taken * for the 52 fraction bits of the resulting NaN; if there are two * or more strings of hex digits, the first is for the high 20 bits, * the second and subsequent for the low 32 bits, with intervening * white space ignored; but if this results in none of the 52 * fraction bits being on (an IEEE Infinity symbol), then NAN_WORD0 * and NAN_WORD1 are used instead. * #define MULTIPLE_THREADS if the system offers preemptively scheduled * multiple threads. In this case, you must provide (or suitably * #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed * by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed * in pow5mult, ensures lazy evaluation of only one copy of high * powers of 5; omitting this lock would introduce a small * probability of wasting memory, but would otherwise be harmless.) * You must also invoke freedtoa(s) to free the value s returned by * dtoa. You may do so whether or not MULTIPLE_THREADS is #defined. * #define NO_IEEE_Scale to disable new (Feb. 1997) logic in strtod that * avoids underflows on inputs whose result does not underflow. * If you #define NO_IEEE_Scale on a machine that uses IEEE-format * floating-point numbers and flushes underflows to zero rather * than implementing gradual underflow, then you must also #define * Sudden_Underflow. * #define USE_LOCALE to use the current locale's decimal_point value. * #define SET_INEXACT if IEEE arithmetic is being used and extra * computation should be done to set the inexact flag when the * result is inexact and avoid setting inexact when the result * is exact. In this case, dtoa.c must be compiled in * an environment, perhaps provided by #include "dtoa.c" in a * suitable wrapper, that defines two functions, * int get_inexact(void); * void clear_inexact(void); * such that get_inexact() returns a nonzero value if the * inexact bit is already set, and clear_inexact() sets the * inexact bit to 0. When SET_INEXACT is #defined, strtod * also does extra computations to set the underflow and overflow * flags when appropriate (i.e., when the result is tiny and * inexact or when it is a numeric value rounded to +-infinity). * #define NO_ERRNO if strtod should not assign errno = ERANGE when * the result overflows to +-Infinity or underflows to 0. * #define NO_HEX_FP to omit recognition of hexadecimal floating-point * values by strtod. * #define NO_STRTOD_BIGCOMP (on IEEE-arithmetic systems only for now) * to disable logic for "fast" testing of very long input strings * to strtod. This testing proceeds by initially truncating the * input string, then if necessary comparing the whole string with * a decimal expansion to decide close cases. This logic is only * used for input more than STRTOD_DIGLIM digits long (default 40). */ #define NO_ERRNO #define NO_HEX_FP #define No_Hex_NaN #define Long int #include "jv_dtoa.h" #include "jv_alloc.h" #include "jv.h" #define MALLOC jv_mem_alloc #define FREE jv_mem_free #ifndef Long #define Long long #endif #ifndef ULong typedef unsigned Long ULong; #endif #ifdef DEBUG #include "stdio.h" #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} #endif #include "stdlib.h" #include "string.h" #ifdef USE_LOCALE #include "locale.h" #endif #ifdef Honor_FLT_ROUNDS #ifndef Trust_FLT_ROUNDS #include #endif #endif #ifdef MALLOC extern void *MALLOC(size_t); #else #define MALLOC malloc #endif #undef IEEE_Arith #undef Avoid_Underflow #ifdef IEEE_MC68k #define IEEE_Arith #endif #ifdef IEEE_8087 #define IEEE_Arith #endif #ifdef IEEE_Arith #ifndef NO_INFNAN_CHECK #undef INFNAN_CHECK #define INFNAN_CHECK #endif #else #undef INFNAN_CHECK #define NO_STRTOD_BIGCOMP #endif #include "errno.h" #ifdef Bad_float_h #ifdef IEEE_Arith #define DBL_DIG 15 #define DBL_MAX_10_EXP 308 #define DBL_MAX_EXP 1024 #define FLT_RADIX 2 #endif /*IEEE_Arith*/ #ifdef IBM #define DBL_DIG 16 #define DBL_MAX_10_EXP 75 #define DBL_MAX_EXP 63 #define FLT_RADIX 16 #define DBL_MAX 7.2370055773322621e+75 #endif #ifdef VAX #define DBL_DIG 16 #define DBL_MAX_10_EXP 38 #define DBL_MAX_EXP 127 #define FLT_RADIX 2 #define DBL_MAX 1.7014118346046923e+38 #endif #ifndef LONG_MAX #define LONG_MAX 2147483647 #endif #else /* ifndef Bad_float_h */ #include "float.h" #endif /* Bad_float_h */ #ifndef __MATH_H__ #include "math.h" #endif #ifdef __cplusplus extern "C" { #endif #ifndef CONST #define CONST const #endif #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1 # error Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. #endif typedef union { double d; ULong L[2]; } U; #ifdef IEEE_8087 #define word0(x) (x)->L[1] #define word1(x) (x)->L[0] #else #define word0(x) (x)->L[0] #define word1(x) (x)->L[1] #endif #define dval(x) (x)->d #ifndef STRTOD_DIGLIM #define STRTOD_DIGLIM 40 #endif #ifdef DIGLIM_DEBUG extern int strtod_diglim; #else #define strtod_diglim STRTOD_DIGLIM #endif /* The following definition of Storeinc is appropriate for MIPS processors. * An alternative that might be better on some machines is * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) */ #if defined(IEEE_8087) + defined(VAX) #define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ ((unsigned short *)a)[0] = (unsigned short)c, a++) #else #define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \ ((unsigned short *)a)[1] = (unsigned short)c, a++) #endif /* #define P DBL_MANT_DIG */ /* Ten_pmax = floor(P*log(2)/log(5)) */ /* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ /* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ /* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ #ifdef IEEE_Arith #define Exp_shift 20 #define Exp_shift1 20 #define Exp_msk1 0x100000 #define Exp_msk11 0x100000 #define Exp_mask 0x7ff00000 #define P 53 #define Nbits 53 #define Bias 1023 #define Emax 1023 #define Emin (-1022) #define Exp_1 0x3ff00000 #define Exp_11 0x3ff00000 #define Ebits 11 #define Frac_mask 0xfffff #define Frac_mask1 0xfffff #define Ten_pmax 22 #define Bletch 0x10 #define Bndry_mask 0xfffff #define Bndry_mask1 0xfffff #define LSB 1 #define Sign_bit 0x80000000 #define Log2P 1 #define Tiny0 0 #define Tiny1 1 #define Quick_max 14 #define Int_max 14 #ifndef NO_IEEE_Scale #define Avoid_Underflow #ifdef Flush_Denorm /* debugging option */ #undef Sudden_Underflow #endif #endif #ifndef Flt_Rounds #ifdef FLT_ROUNDS #define Flt_Rounds FLT_ROUNDS #else #define Flt_Rounds 1 #endif #endif /*Flt_Rounds*/ #ifdef Honor_FLT_ROUNDS #undef Check_FLT_ROUNDS #define Check_FLT_ROUNDS #else #define Rounding Flt_Rounds #endif #else /* ifndef IEEE_Arith */ #undef Check_FLT_ROUNDS #undef Honor_FLT_ROUNDS #undef SET_INEXACT #undef Sudden_Underflow #define Sudden_Underflow #ifdef IBM #undef Flt_Rounds #define Flt_Rounds 0 #define Exp_shift 24 #define Exp_shift1 24 #define Exp_msk1 0x1000000 #define Exp_msk11 0x1000000 #define Exp_mask 0x7f000000 #define P 14 #define Nbits 56 #define Bias 65 #define Emax 248 #define Emin (-260) #define Exp_1 0x41000000 #define Exp_11 0x41000000 #define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ #define Frac_mask 0xffffff #define Frac_mask1 0xffffff #define Bletch 4 #define Ten_pmax 22 #define Bndry_mask 0xefffff #define Bndry_mask1 0xffffff #define LSB 1 #define Sign_bit 0x80000000 #define Log2P 4 #define Tiny0 0x100000 #define Tiny1 0 #define Quick_max 14 #define Int_max 15 #else /* VAX */ #undef Flt_Rounds #define Flt_Rounds 1 #define Exp_shift 23 #define Exp_shift1 7 #define Exp_msk1 0x80 #define Exp_msk11 0x800000 #define Exp_mask 0x7f80 #define P 56 #define Nbits 56 #define Bias 129 #define Emax 126 #define Emin (-129) #define Exp_1 0x40800000 #define Exp_11 0x4080 #define Ebits 8 #define Frac_mask 0x7fffff #define Frac_mask1 0xffff007f #define Ten_pmax 24 #define Bletch 2 #define Bndry_mask 0xffff007f #define Bndry_mask1 0xffff007f #define LSB 0x10000 #define Sign_bit 0x8000 #define Log2P 1 #define Tiny0 0x80 #define Tiny1 0 #define Quick_max 15 #define Int_max 15 #endif /* IBM, VAX */ #endif /* IEEE_Arith */ #ifndef IEEE_Arith #define ROUND_BIASED #else #ifdef ROUND_BIASED_without_Round_Up #undef ROUND_BIASED #define ROUND_BIASED #endif #endif #ifdef RND_PRODQUOT #define rounded_product(a,b) a = rnd_prod(a, b) #define rounded_quotient(a,b) a = rnd_quot(a, b) extern double rnd_prod(double, double), rnd_quot(double, double); #else #define rounded_product(a,b) a *= b #define rounded_quotient(a,b) a /= b #endif #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) #define Big1 0xffffffff #ifndef Pack_32 #define Pack_32 #endif typedef struct BCinfo BCinfo; struct BCinfo { int dp0, dp1, dplen, dsign, e0, inexact, nd, nd0, rounding, scale, uflchk; }; #define FFFFFFFF 0xffffffffUL #ifdef NO_LONG_LONG #undef ULLong #ifdef Just_16 #undef Pack_32 /* When Pack_32 is not defined, we store 16 bits per 32-bit Long. * This makes some inner loops simpler and sometimes saves work * during multiplications, but it often seems to make things slightly * slower. Hence the default is now to store 32 bits per Long. */ #endif #else /* long long available */ #ifndef Llong #define Llong long long #endif #ifndef ULLong #define ULLong unsigned Llong #endif #endif /* NO_LONG_LONG */ struct Bigint { struct Bigint *next; int k, maxwds, sign, wds; ULong x[1]; }; typedef struct Bigint Bigint; void jvp_dtoa_context_init(struct dtoa_context* C) { int i; for (i=0; i<(int)(sizeof(C->freelist)/sizeof(C->freelist[0])); i++) { C->freelist[i] = 0; } C->p5s = 0; } static Bigint * Balloc(struct dtoa_context* C, int k) { int x; Bigint *rv; /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */ /* but this case seems very unlikely. */ if (k <= Kmax && (rv = C->freelist[k])) C->freelist[k] = rv->next; else { x = 1 << k; rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); rv->k = k; rv->maxwds = x; } rv->sign = rv->wds = 0; return rv; } static void Bfree (struct dtoa_context* C, Bigint *v) { if (v) { if (v->k > Kmax) #ifdef FREE FREE((void*)v); #else free((void*)v); #endif else { v->next = C->freelist[v->k]; C->freelist[v->k] = v; } } } void jvp_dtoa_context_free(struct dtoa_context* C) { int k; while (C->p5s) { Bigint* p5 = C->p5s; C->p5s = p5->next; Bfree(C, p5); } for (k=0; k<(int)(sizeof(C->freelist)/sizeof(C->freelist[0])); k++) { while (C->freelist[k]) { Bigint* v = C->freelist[k]; C->freelist[k] = v->next; FREE(v); } } } #define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ y->wds*sizeof(Long) + 2*sizeof(int)) static Bigint * multadd (struct dtoa_context* C, Bigint *b, int m, int a) /* multiply by m and add a */ { int i, wds; #ifdef ULLong ULong *x; ULLong carry, y; #else ULong carry, *x, y; #ifdef Pack_32 ULong xi, z; #endif #endif Bigint *b1; wds = b->wds; x = b->x; i = 0; carry = a; do { #ifdef ULLong y = *x * (ULLong)m + carry; carry = y >> 32; *x++ = y & FFFFFFFF; #else #ifdef Pack_32 xi = *x; y = (xi & 0xffff) * m + carry; z = (xi >> 16) * m + (y >> 16); carry = z >> 16; *x++ = (z << 16) + (y & 0xffff); #else y = *x * m + carry; carry = y >> 16; *x++ = y & 0xffff; #endif #endif } while(++i < wds); if (carry) { if (wds >= b->maxwds) { b1 = Balloc(C, b->k+1); Bcopy(b1, b); Bfree(C, b); b = b1; } b->x[wds++] = carry; b->wds = wds; } return b; } static Bigint * s2b (struct dtoa_context* C, const char *s, int nd0, int nd, ULong y9, int dplen) { Bigint *b; int i, k; Long x, y; x = (nd + 8) / 9; for(k = 0, y = 1; x > y; y <<= 1, k++) ; #ifdef Pack_32 b = Balloc(C, k); b->x[0] = y9; b->wds = 1; #else b = Balloc(C, k+1); b->x[0] = y9 & 0xffff; b->wds = (b->x[1] = y9 >> 16) ? 2 : 1; #endif i = 9; if (9 < nd0) { s += 9; do b = multadd(C, b, 10, *s++ - '0'); while(++i < nd0); s += dplen; } else s += dplen + 9; for(; i < nd; i++) b = multadd(C, b, 10, *s++ - '0'); return b; } static int hi0bits (struct dtoa_context* C, ULong x) { int k = 0; if (!(x & 0xffff0000)) { k = 16; x <<= 16; } if (!(x & 0xff000000)) { k += 8; x <<= 8; } if (!(x & 0xf0000000)) { k += 4; x <<= 4; } if (!(x & 0xc0000000)) { k += 2; x <<= 2; } if (!(x & 0x80000000)) { k++; if (!(x & 0x40000000)) return 32; } return k; } static int lo0bits (struct dtoa_context* C, ULong *y) { int k; ULong x = *y; if (x & 7) { if (x & 1) return 0; if (x & 2) { *y = x >> 1; return 1; } *y = x >> 2; return 2; } k = 0; if (!(x & 0xffff)) { k = 16; x >>= 16; } if (!(x & 0xff)) { k += 8; x >>= 8; } if (!(x & 0xf)) { k += 4; x >>= 4; } if (!(x & 0x3)) { k += 2; x >>= 2; } if (!(x & 1)) { k++; x >>= 1; if (!x) return 32; } *y = x; return k; } static Bigint * i2b (struct dtoa_context* C, int i) { Bigint *b; b = Balloc(C, 1); b->x[0] = i; b->wds = 1; return b; } static Bigint * mult (struct dtoa_context* C, Bigint *a, Bigint *b) { Bigint *c; int k, wa, wb, wc; ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; ULong y; #ifdef ULLong ULLong carry, z; #else ULong carry, z; #ifdef Pack_32 ULong z2; #endif #endif if (a->wds < b->wds) { c = a; a = b; b = c; } k = a->k; wa = a->wds; wb = b->wds; wc = wa + wb; if (wc > a->maxwds) k++; c = Balloc(C, k); for(x = c->x, xa = x + wc; x < xa; x++) *x = 0; xa = a->x; xae = xa + wa; xb = b->x; xbe = xb + wb; xc0 = c->x; #ifdef ULLong for(; xb < xbe; xc0++) { if ((y = *xb++)) { x = xa; xc = xc0; carry = 0; do { z = *x++ * (ULLong)y + *xc + carry; carry = z >> 32; *xc++ = z & FFFFFFFF; } while(x < xae); *xc = carry; } } #else #ifdef Pack_32 for(; xb < xbe; xb++, xc0++) { if (y = *xb & 0xffff) { x = xa; xc = xc0; carry = 0; do { z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; carry = z >> 16; z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; carry = z2 >> 16; Storeinc(xc, z2, z); } while(x < xae); *xc = carry; } if (y = *xb >> 16) { x = xa; xc = xc0; carry = 0; z2 = *xc; do { z = (*x & 0xffff) * y + (*xc >> 16) + carry; carry = z >> 16; Storeinc(xc, z, z2); z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; carry = z2 >> 16; } while(x < xae); *xc = z2; } } #else for(; xb < xbe; xc0++) { if (y = *xb++) { x = xa; xc = xc0; carry = 0; do { z = *x++ * y + *xc + carry; carry = z >> 16; *xc++ = z & 0xffff; } while(x < xae); *xc = carry; } } #endif #endif for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; c->wds = wc; return c; } static Bigint * pow5mult (struct dtoa_context* C, Bigint *b, int k) { Bigint *b1, *p5, *p51; int i; static const int p05[3] = { 5, 25, 125 }; if ((i = k & 3)) b = multadd(C, b, p05[i-1], 0); if (!(k >>= 2)) return b; if (!(p5 = C->p5s)) { /* first time */ p5 = C->p5s = i2b(C, 625); p5->next = 0; } for(;;) { if (k & 1) { b1 = mult(C, b, p5); Bfree(C, b); b = b1; } if (!(k >>= 1)) break; if (!(p51 = p5->next)) { p51 = p5->next = mult(C, p5,p5); p51->next = 0; } p5 = p51; } return b; } static Bigint * lshift (struct dtoa_context* C, Bigint *b, int k) { int i, k1, n, n1; Bigint *b1; ULong *x, *x1, *xe, z; #ifdef Pack_32 n = k >> 5; #else n = k >> 4; #endif k1 = b->k; n1 = n + b->wds + 1; for(i = b->maxwds; n1 > i; i <<= 1) k1++; b1 = Balloc(C, k1); x1 = b1->x; for(i = 0; i < n; i++) *x1++ = 0; x = b->x; xe = x + b->wds; #ifdef Pack_32 if (k &= 0x1f) { k1 = 32 - k; z = 0; do { *x1++ = *x << k | z; z = *x++ >> k1; } while(x < xe); if ((*x1 = z)) ++n1; } #else if (k &= 0xf) { k1 = 16 - k; z = 0; do { *x1++ = *x << k & 0xffff | z; z = *x++ >> k1; } while(x < xe); if (*x1 = z) ++n1; } #endif else do *x1++ = *x++; while(x < xe); b1->wds = n1 - 1; Bfree(C, b); return b1; } static int cmp (struct dtoa_context* C, Bigint *a, Bigint *b) { ULong *xa, *xa0, *xb, *xb0; int i, j; i = a->wds; j = b->wds; #ifdef DEBUG if (i > 1 && !a->x[i-1]) Bug("cmp called with a->x[a->wds-1] == 0"); if (j > 1 && !b->x[j-1]) Bug("cmp called with b->x[b->wds-1] == 0"); #endif if (i -= j) return i; xa0 = a->x; xa = xa0 + j; xb0 = b->x; xb = xb0 + j; for(;;) { if (*--xa != *--xb) return *xa < *xb ? -1 : 1; if (xa <= xa0) break; } return 0; } static Bigint * diff (struct dtoa_context* C, Bigint *a, Bigint *b) { Bigint *c; int i, wa, wb; ULong *xa, *xae, *xb, *xbe, *xc; #ifdef ULLong ULLong borrow, y; #else ULong borrow, y; #ifdef Pack_32 ULong z; #endif #endif i = cmp(C, a,b); if (!i) { c = Balloc(C, 0); c->wds = 1; c->x[0] = 0; return c; } if (i < 0) { c = a; a = b; b = c; i = 1; } else i = 0; c = Balloc(C, a->k); c->sign = i; wa = a->wds; xa = a->x; xae = xa + wa; wb = b->wds; xb = b->x; xbe = xb + wb; xc = c->x; borrow = 0; #ifdef ULLong do { y = (ULLong)*xa++ - *xb++ - borrow; borrow = y >> 32 & (ULong)1; *xc++ = y & FFFFFFFF; } while(xb < xbe); while(xa < xae) { y = *xa++ - borrow; borrow = y >> 32 & (ULong)1; *xc++ = y & FFFFFFFF; } #else #ifdef Pack_32 do { y = (*xa & 0xffff) - (*xb & 0xffff) - borrow; borrow = (y & 0x10000) >> 16; z = (*xa++ >> 16) - (*xb++ >> 16) - borrow; borrow = (z & 0x10000) >> 16; Storeinc(xc, z, y); } while(xb < xbe); while(xa < xae) { y = (*xa & 0xffff) - borrow; borrow = (y & 0x10000) >> 16; z = (*xa++ >> 16) - borrow; borrow = (z & 0x10000) >> 16; Storeinc(xc, z, y); } #else do { y = *xa++ - *xb++ - borrow; borrow = (y & 0x10000) >> 16; *xc++ = y & 0xffff; } while(xb < xbe); while(xa < xae) { y = *xa++ - borrow; borrow = (y & 0x10000) >> 16; *xc++ = y & 0xffff; } #endif #endif while(!*--xc) wa--; c->wds = wa; return c; } static double ulp (struct dtoa_context* C, U *x) { Long L; U u; L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; #ifndef Avoid_Underflow #ifndef Sudden_Underflow if (L > 0) { #endif #endif #ifdef IBM L |= Exp_msk1 >> 4; #endif word0(&u) = L; word1(&u) = 0; #ifndef Avoid_Underflow #ifndef Sudden_Underflow } else { L = -L >> Exp_shift; if (L < Exp_shift) { word0(&u) = 0x80000 >> L; word1(&u) = 0; } else { word0(&u) = 0; L -= Exp_shift; word1(&u) = L >= 31 ? 1 : 1 << 31 - L; } } #endif #endif return dval(&u); } static double b2d (struct dtoa_context* C, Bigint *a, int *e) { ULong *xa, *xa0, w, y, z; int k; U d; #ifdef VAX ULong d0, d1; #else #define d0 word0(&d) #define d1 word1(&d) #endif xa0 = a->x; xa = xa0 + a->wds; y = *--xa; #ifdef DEBUG if (!y) Bug("zero y in b2d"); #endif k = hi0bits(C, y); *e = 32 - k; #ifdef Pack_32 if (k < Ebits) { d0 = Exp_1 | y >> (Ebits - k); w = xa > xa0 ? *--xa : 0; d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); goto ret_d; } z = xa > xa0 ? *--xa : 0; if (k -= Ebits) { d0 = Exp_1 | y << k | z >> (32 - k); y = xa > xa0 ? *--xa : 0; d1 = z << k | y >> (32 - k); } else { d0 = Exp_1 | y; d1 = z; } #else if (k < Ebits + 16) { z = xa > xa0 ? *--xa : 0; d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k; w = xa > xa0 ? *--xa : 0; y = xa > xa0 ? *--xa : 0; d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k; goto ret_d; } z = xa > xa0 ? *--xa : 0; w = xa > xa0 ? *--xa : 0; k -= Ebits + 16; d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k; y = xa > xa0 ? *--xa : 0; d1 = w << k + 16 | y << k; #endif ret_d: #ifdef VAX word0(&d) = d0 >> 16 | d0 << 16; word1(&d) = d1 >> 16 | d1 << 16; #else #undef d0 #undef d1 #endif return dval(&d); } static Bigint * d2b (struct dtoa_context* C, U *d, int *e, int *bits) { Bigint *b; int de, k; ULong *x, y, z; #ifndef Sudden_Underflow int i; #endif #ifdef VAX ULong d0, d1; d0 = word0(d) >> 16 | word0(d) << 16; d1 = word1(d) >> 16 | word1(d) << 16; #else #define d0 word0(d) #define d1 word1(d) #endif #ifdef Pack_32 b = Balloc(C, 1); #else b = Balloc(C, 2); #endif x = b->x; z = d0 & Frac_mask; d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ #ifdef Sudden_Underflow de = (int)(d0 >> Exp_shift); #ifndef IBM z |= Exp_msk11; #endif #else if ((de = (int)(d0 >> Exp_shift))) z |= Exp_msk1; #endif #ifdef Pack_32 if ((y = d1)) { if ((k = lo0bits(C, &y))) { x[0] = y | z << (32 - k); z >>= k; } else x[0] = y; #ifndef Sudden_Underflow i = #endif b->wds = (x[1] = z) ? 2 : 1; } else { k = lo0bits(C, &z); x[0] = z; #ifndef Sudden_Underflow i = #endif b->wds = 1; k += 32; } #else if (y = d1) { if (k = lo0bits(C, &y)) if (k >= 16) { x[0] = y | z << 32 - k & 0xffff; x[1] = z >> k - 16 & 0xffff; x[2] = z >> k; i = 2; } else { x[0] = y & 0xffff; x[1] = y >> 16 | z << 16 - k & 0xffff; x[2] = z >> k & 0xffff; x[3] = z >> k+16; i = 3; } else { x[0] = y & 0xffff; x[1] = y >> 16; x[2] = z & 0xffff; x[3] = z >> 16; i = 3; } } else { #ifdef DEBUG if (!z) Bug("Zero passed to d2b"); #endif k = lo0bits(C, &z); if (k >= 16) { x[0] = z; i = 0; } else { x[0] = z & 0xffff; x[1] = z >> 16; i = 1; } k += 32; } while(!x[i]) --i; b->wds = i + 1; #endif #ifndef Sudden_Underflow if (de) { #endif #ifdef IBM *e = (de - Bias - (P-1) << 2) + k; *bits = 4*P + 8 - k - hi0bits(C, word0(d) & Frac_mask); #else *e = de - Bias - (P-1) + k; *bits = P - k; #endif #ifndef Sudden_Underflow } else { *e = de - Bias - (P-1) + 1 + k; #ifdef Pack_32 *bits = 32*i - hi0bits(C, x[i-1]); #else *bits = (i+2)*16 - hi0bits(C, x[i]); #endif } #endif return b; } #undef d0 #undef d1 static double ratio (struct dtoa_context* C, Bigint *a, Bigint *b) { U da, db; int k, ka, kb; dval(&da) = b2d(C, a, &ka); dval(&db) = b2d(C, b, &kb); #ifdef Pack_32 k = ka - kb + 32*(a->wds - b->wds); #else k = ka - kb + 16*(a->wds - b->wds); #endif #ifdef IBM if (k > 0) { word0(&da) += (k >> 2)*Exp_msk1; if (k &= 3) dval(&da) *= 1 << k; } else { k = -k; word0(&db) += (k >> 2)*Exp_msk1; if (k &= 3) dval(&db) *= 1 << k; } #else if (k > 0) word0(&da) += k*Exp_msk1; else { k = -k; word0(&db) += k*Exp_msk1; } #endif return dval(&da) / dval(&db); } static CONST double tens[] = { 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22 #ifdef VAX , 1e23, 1e24 #endif }; static CONST double #ifdef IEEE_Arith bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, #ifdef Avoid_Underflow 9007199254740992.*9007199254740992.e-256 /* = 2^106 * 1e-256 */ #else 1e-256 #endif }; /* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */ /* flag unnecessarily. It leads to a song and dance at the end of strtod. */ #define Scale_Bit 0x10 #define n_bigtens 5 #else #ifdef IBM bigtens[] = { 1e16, 1e32, 1e64 }; static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 }; #define n_bigtens 3 #else bigtens[] = { 1e16, 1e32 }; static CONST double tinytens[] = { 1e-16, 1e-32 }; #define n_bigtens 2 #endif #endif #undef Need_Hexdig #ifdef INFNAN_CHECK #ifndef No_Hex_NaN #define Need_Hexdig #endif #endif #ifndef Need_Hexdig #ifndef NO_HEX_FP #define Need_Hexdig #endif #endif #ifdef Need_Hexdig /*{*/ static unsigned char hexdig[256]; static void htinit(unsigned char *h, unsigned char *s, int inc) { int i, j; for(i = 0; (j = s[i]) !=0; i++) h[j] = i + inc; } static void hexdig_init(void) { #define USC (unsigned char *) htinit(hexdig, USC "0123456789", 0x10); htinit(hexdig, USC "abcdef", 0x10 + 10); htinit(hexdig, USC "ABCDEF", 0x10 + 10); } #endif /* } Need_Hexdig */ #ifdef INFNAN_CHECK #ifndef NAN_WORD0 #define NAN_WORD0 0x7ff80000 #endif #ifndef NAN_WORD1 #define NAN_WORD1 0 #endif static int match (struct dtoa_context* C, const char **sp, const char *t) { int c, d; CONST char *s = *sp; while((d = *t++)) { if ((c = *++s) >= 'A' && c <= 'Z') c += 'a' - 'A'; if (c != d) return 0; } *sp = s + 1; return 1; } #ifndef No_Hex_NaN static void hexnan (struct dtoa_context* C, U *rvp, const char **sp) { ULong c, x[2]; CONST char *s; int c1, havedig, udx0, xshift; if (!hexdig['0']) hexdig_init(); x[0] = x[1] = 0; havedig = xshift = 0; udx0 = 1; s = *sp; /* allow optional initial 0x or 0X */ while((c = *(CONST unsigned char*)(s+1)) && c <= ' ') ++s; if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')) s += 2; while((c = *(CONST unsigned char*)++s)) { if ((c1 = hexdig[c])) c = c1 & 0xf; else if (c <= ' ') { if (udx0 && havedig) { udx0 = 0; xshift = 1; } continue; } #ifdef GDTOA_NON_PEDANTIC_NANCHECK else if (/*(*/ c == ')' && havedig) { *sp = s + 1; break; } else return; /* invalid form: don't change *sp */ #else else { do { if (/*(*/ c == ')') { *sp = s + 1; break; } } while((c = *++s)); break; } #endif havedig = 1; if (xshift) { xshift = 0; x[0] = x[1]; x[1] = 0; } if (udx0) x[0] = (x[0] << 4) | (x[1] >> 28); x[1] = (x[1] << 4) | c; } if ((x[0] &= 0xfffff) || x[1]) { word0(rvp) = Exp_mask | x[0]; word1(rvp) = x[1]; } } #endif /*No_Hex_NaN*/ #endif /* INFNAN_CHECK */ #ifdef Pack_32 #define ULbits 32 #define kshift 5 #define kmask 31 #else #define ULbits 16 #define kshift 4 #define kmask 15 #endif #if !defined(NO_HEX_FP) || defined(Honor_FLT_ROUNDS) /*{*/ static Bigint * increment(struct dtoa_context* C, Bigint *b) { ULong *x, *xe; Bigint *b1; x = b->x; xe = x + b->wds; do { if (*x < (ULong)0xffffffffL) { ++*x; return b; } *x++ = 0; } while(x < xe); { if (b->wds >= b->maxwds) { b1 = Balloc(C, b->k+1); Bcopy(b1,b); Bfree(C, b); b = b1; } b->x[b->wds++] = 1; } return b; } #endif /*}*/ #ifndef NO_HEX_FP /*{*/ static void rshift(struct dtoa_context* C, Bigint *b, int k) { ULong *x, *x1, *xe, y; int n; x = x1 = b->x; n = k >> kshift; if (n < b->wds) { xe = x + b->wds; x += n; if (k &= kmask) { n = 32 - k; y = *x++ >> k; while(x < xe) { *x1++ = (y | (*x << n)) & 0xffffffff; y = *x++ >> k; } if ((*x1 = y) !=0) x1++; } else while(x < xe) *x1++ = *x++; } if ((b->wds = x1 - b->x) == 0) b->x[0] = 0; } static ULong any_on(Bigint *b, int k) { int n, nwds; ULong *x, *x0, x1, x2; x = b->x; nwds = b->wds; n = k >> kshift; if (n > nwds) n = nwds; else if (n < nwds && (k &= kmask)) { x1 = x2 = x[n]; x1 >>= k; x1 <<= k; if (x1 != x2) return 1; } x0 = x; x += n; while(x > x0) if (*--x) return 1; return 0; } enum { /* rounding values: same as FLT_ROUNDS */ Round_zero = 0, Round_near = 1, Round_up = 2, Round_down = 3 }; static void gethex(struct dtoa_context* C, CONST char **sp, U *rvp, int rounding, int sign) { Bigint *b; CONST unsigned char *decpt, *s0, *s, *s1; Long e, e1; ULong L, lostbits, *x; int big, denorm, esign, havedig, k, n, nbits, up, zret; #ifdef IBM int j; #endif enum { #ifdef IEEE_Arith /*{{*/ emax = 0x7fe - Bias - P + 1, emin = Emin - P + 1 #else /*}{*/ emin = Emin - P, #ifdef VAX emax = 0x7ff - Bias - P + 1 #endif #ifdef IBM emax = 0x7f - Bias - P #endif #endif /*}}*/ }; #ifdef USE_LOCALE int i; #ifdef NO_LOCALE_CACHE const unsigned char *decimalpoint = (unsigned char*) localeconv()->decimal_point; #else const unsigned char *decimalpoint; static unsigned char *decimalpoint_cache; if (!(s0 = decimalpoint_cache)) { s0 = (unsigned char*)localeconv()->decimal_point; if ((decimalpoint_cache = (unsigned char*) MALLOC(strlen((CONST char*)s0) + 1))) { strcpy((char*)decimalpoint_cache, (CONST char*)s0); s0 = decimalpoint_cache; } } decimalpoint = s0; #endif #endif if (!hexdig['0']) hexdig_init(); havedig = 0; s0 = *(CONST unsigned char **)sp + 2; while(s0[havedig] == '0') havedig++; s0 += havedig; s = s0; decpt = 0; zret = 0; e = 0; if (hexdig[*s]) havedig++; else { zret = 1; #ifdef USE_LOCALE for(i = 0; decimalpoint[i]; ++i) { if (s[i] != decimalpoint[i]) goto pcheck; } decpt = s += i; #else if (*s != '.') goto pcheck; decpt = ++s; #endif if (!hexdig[*s]) goto pcheck; while(*s == '0') s++; if (hexdig[*s]) zret = 0; havedig = 1; s0 = s; } while(hexdig[*s]) s++; #ifdef USE_LOCALE if (*s == *decimalpoint && !decpt) { for(i = 1; decimalpoint[i]; ++i) { if (s[i] != decimalpoint[i]) goto pcheck; } decpt = s += i; #else if (*s == '.' && !decpt) { decpt = ++s; #endif while(hexdig[*s]) s++; }/*}*/ if (decpt) e = -(((Long)(s-decpt)) << 2); pcheck: s1 = s; big = esign = 0; switch(*s) { case 'p': case 'P': switch(*++s) { case '-': esign = 1; /* no break */ JQ_FALLTHROUGH; case '+': s++; } if ((n = hexdig[*s]) == 0 || n > 0x19) { s = s1; break; } e1 = n - 0x10; while((n = hexdig[*++s]) !=0 && n <= 0x19) { if (e1 & 0xf8000000) big = 1; e1 = 10*e1 + n - 0x10; } if (esign) e1 = -e1; e += e1; } *sp = (char*)s; if (!havedig) *sp = (char*)s0 - 1; if (zret) goto retz1; if (big) { if (esign) { #ifdef IEEE_Arith switch(rounding) { case Round_up: if (sign) break; goto ret_tiny; case Round_down: if (!sign) break; goto ret_tiny; } #endif goto retz; #ifdef IEEE_Arith ret_tiny: #ifndef NO_ERRNO errno = ERANGE; #endif word0(rvp) = 0; word1(rvp) = 1; return; #endif /* IEEE_Arith */ } switch(rounding) { case Round_near: goto ovfl1; case Round_up: if (!sign) goto ovfl1; goto ret_big; case Round_down: if (sign) goto ovfl1; goto ret_big; } ret_big: word0(rvp) = Big0; word1(rvp) = Big1; return; } n = s1 - s0 - 1; for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1) k++; b = Balloc(C, k); x = b->x; n = 0; L = 0; #ifdef USE_LOCALE for(i = 0; decimalpoint[i+1]; ++i); #endif while(s1 > s0) { #ifdef USE_LOCALE if (*--s1 == decimalpoint[i]) { s1 -= i; continue; } #else if (*--s1 == '.') continue; #endif if (n == ULbits) { *x++ = L; L = 0; n = 0; } L |= (hexdig[*s1] & 0x0f) << n; n += 4; } *x++ = L; b->wds = n = x - b->x; n = ULbits*n - hi0bits(C, L); nbits = Nbits; lostbits = 0; x = b->x; if (n > nbits) { n -= nbits; if (any_on(b,n)) { lostbits = 1; k = n - 1; if (x[k>>kshift] & 1 << (k & kmask)) { lostbits = 2; if (k > 0 && any_on(b,k)) lostbits = 3; } } rshift(C, b, n); e += n; } else if (n < nbits) { n = nbits - n; b = lshift(C, b, n); e -= n; x = b->x; } if (e > Emax) { ovfl: Bfree(C, b); ovfl1: #ifndef NO_ERRNO errno = ERANGE; #endif word0(rvp) = Exp_mask; word1(rvp) = 0; return; } denorm = 0; if (e < emin) { denorm = 1; n = emin - e; if (n >= nbits) { #ifdef IEEE_Arith /*{*/ switch (rounding) { case Round_near: if (n == nbits && (n < 2 || any_on(b,n-1))) goto ret_tiny; break; case Round_up: if (!sign) goto ret_tiny; break; case Round_down: if (sign) goto ret_tiny; } #endif /* } IEEE_Arith */ Bfree(C, b); retz: #ifndef NO_ERRNO errno = ERANGE; #endif retz1: rvp->d = 0.; return; } k = n - 1; if (lostbits) lostbits = 1; else if (k > 0) lostbits = any_on(b,k); if (x[k>>kshift] & 1 << (k & kmask)) lostbits |= 2; nbits -= n; rshift(C, b,n); e = emin; } if (lostbits) { up = 0; switch(rounding) { case Round_zero: break; case Round_near: if (lostbits & 2 && (lostbits & 1) | (x[0] & 1)) up = 1; break; case Round_up: up = 1 - sign; break; case Round_down: up = sign; } if (up) { k = b->wds; b = increment(C, b); x = b->x; if (denorm) { #if 0 if (nbits == Nbits - 1 && x[nbits >> kshift] & 1 << (nbits & kmask)) denorm = 0; /* not currently used */ #endif } else if (b->wds > k || ((n = nbits & kmask) !=0 && hi0bits(C, x[k-1]) < 32-n)) { rshift(C, b,1); if (++e > Emax) goto ovfl; } } } #ifdef IEEE_Arith if (denorm) word0(rvp) = b->wds > 1 ? b->x[1] & ~0x100000 : 0; else word0(rvp) = (b->x[1] & ~0x100000) | ((e + 0x3ff + 52) << 20); word1(rvp) = b->x[0]; #endif #ifdef IBM if ((j = e & 3)) { k = b->x[0] & ((1 << j) - 1); rshift(C, b,j); if (k) { switch(rounding) { case Round_up: if (!sign) increment(b); break; case Round_down: if (sign) increment(b); break; case Round_near: j = 1 << (j-1); if (k & j && ((k & (j-1)) | lostbits)) increment(b); } } } e >>= 2; word0(rvp) = b->x[1] | ((e + 65 + 13) << 24); word1(rvp) = b->x[0]; #endif #ifdef VAX /* The next two lines ignore swap of low- and high-order 2 bytes. */ /* word0(rvp) = (b->x[1] & ~0x800000) | ((e + 129 + 55) << 23); */ /* word1(rvp) = b->x[0]; */ word0(rvp) = ((b->x[1] & ~0x800000) >> 16) | ((e + 129 + 55) << 7) | (b->x[1] << 16); word1(rvp) = (b->x[0] >> 16) | (b->x[0] << 16); #endif Bfree(C, b); } #endif /*!NO_HEX_FP}*/ static int dshift(struct dtoa_context* C, Bigint *b, int p2) { int rv = hi0bits(C, b->x[b->wds-1]) - 4; if (p2 > 0) rv -= p2; return rv & kmask; } static int quorem (struct dtoa_context* C, Bigint *b, Bigint *S) { int n; ULong *bx, *bxe, q, *sx, *sxe; #ifdef ULLong ULLong borrow, carry, y, ys; #else ULong borrow, carry, y, ys; #ifdef Pack_32 ULong si, z, zs; #endif #endif n = S->wds; #ifdef DEBUG /*debug*/ if (b->wds > n) /*debug*/ Bug("oversize b in quorem"); #endif if (b->wds < n) return 0; sx = S->x; sxe = sx + --n; bx = b->x; bxe = bx + n; q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ #ifdef DEBUG #ifdef NO_STRTOD_BIGCOMP /*debug*/ if (q > 9) #else /* An oversized q is possible when quorem is called from bigcomp and */ /* the input is near, e.g., twice the smallest denormalized number. */ /*debug*/ if (q > 15) #endif /*debug*/ Bug("oversized quotient in quorem"); #endif if (q) { borrow = 0; carry = 0; do { #ifdef ULLong ys = *sx++ * (ULLong)q + carry; carry = ys >> 32; y = *bx - (ys & FFFFFFFF) - borrow; borrow = y >> 32 & (ULong)1; *bx++ = y & FFFFFFFF; #else #ifdef Pack_32 si = *sx++; ys = (si & 0xffff) * q + carry; zs = (si >> 16) * q + (ys >> 16); carry = zs >> 16; y = (*bx & 0xffff) - (ys & 0xffff) - borrow; borrow = (y & 0x10000) >> 16; z = (*bx >> 16) - (zs & 0xffff) - borrow; borrow = (z & 0x10000) >> 16; Storeinc(bx, z, y); #else ys = *sx++ * q + carry; carry = ys >> 16; y = *bx - (ys & 0xffff) - borrow; borrow = (y & 0x10000) >> 16; *bx++ = y & 0xffff; #endif #endif } while(sx <= sxe); if (!*bxe) { bx = b->x; while(--bxe > bx && !*bxe) --n; b->wds = n; } } if (cmp(C, b, S) >= 0) { q++; borrow = 0; carry = 0; bx = b->x; sx = S->x; do { #ifdef ULLong ys = *sx++ + carry; carry = ys >> 32; y = *bx - (ys & FFFFFFFF) - borrow; borrow = y >> 32 & (ULong)1; *bx++ = y & FFFFFFFF; #else #ifdef Pack_32 si = *sx++; ys = (si & 0xffff) + carry; zs = (si >> 16) + (ys >> 16); carry = zs >> 16; y = (*bx & 0xffff) - (ys & 0xffff) - borrow; borrow = (y & 0x10000) >> 16; z = (*bx >> 16) - (zs & 0xffff) - borrow; borrow = (z & 0x10000) >> 16; Storeinc(bx, z, y); #else ys = *sx++ + carry; carry = ys >> 16; y = *bx - (ys & 0xffff) - borrow; borrow = (y & 0x10000) >> 16; *bx++ = y & 0xffff; #endif #endif } while(sx <= sxe); bx = b->x; bxe = bx + n; if (!*bxe) { while(--bxe > bx && !*bxe) --n; b->wds = n; } } return q; } #if defined(Avoid_Underflow) || !defined(NO_STRTOD_BIGCOMP) /*{*/ static double sulp (struct dtoa_context* C, U *x, BCinfo *bc) { U u; double rv; int i; rv = ulp(C, x); if (!bc->scale || (i = 2*P + 1 - ((word0(x) & Exp_mask) >> Exp_shift)) <= 0) return rv; /* Is there an example where i <= 0 ? */ word0(&u) = Exp_1 + (i << Exp_shift); word1(&u) = 0; return rv * u.d; } #endif /*}*/ #ifndef NO_STRTOD_BIGCOMP static void bigcomp (struct dtoa_context* C, U *rv, const char *s0, BCinfo *bc) { Bigint *b, *d; int b2, bbits, d2, dd=0, dig, dsign, i, j, nd, nd0, p2, p5, speccase; dsign = bc->dsign; nd = bc->nd; nd0 = bc->nd0; p5 = nd + bc->e0 - 1; speccase = 0; #ifndef Sudden_Underflow if (rv->d == 0.) { /* special case: value near underflow-to-zero */ /* threshold was rounded to zero */ b = i2b(C, 1); p2 = Emin - P + 1; bbits = 1; #ifdef Avoid_Underflow word0(rv) = (P+2) << Exp_shift; #else word1(rv) = 1; #endif i = 0; #ifdef Honor_FLT_ROUNDS if (bc->rounding == 1) #endif { speccase = 1; --p2; dsign = 0; goto have_i; } } else #endif b = d2b(C, rv, &p2, &bbits); #ifdef Avoid_Underflow p2 -= bc->scale; #endif /* floor(log2(rv)) == bbits - 1 + p2 */ /* Check for denormal case. */ i = P - bbits; if (i > (j = P - Emin - 1 + p2)) { #ifdef Sudden_Underflow Bfree(C, b); b = i2b(C, 1); p2 = Emin; i = P - 1; #ifdef Avoid_Underflow word0(rv) = (1 + bc->scale) << Exp_shift; #else word0(rv) = Exp_msk1; #endif word1(rv) = 0; #else i = j; #endif } #ifdef Honor_FLT_ROUNDS if (bc->rounding != 1) { if (i > 0) b = lshift(C, b, i); if (dsign) b = increment(b); } else #endif { b = lshift(C, b, ++i); b->x[0] |= 1; } #ifndef Sudden_Underflow have_i: #endif p2 -= p5 + i; d = i2b(C, 1); /* Arrange for convenient computation of quotients: * shift left if necessary so divisor has 4 leading 0 bits. */ if (p5 > 0) d = pow5mult(C, d, p5); else if (p5 < 0) b = pow5mult(C, b, -p5); if (p2 > 0) { b2 = p2; d2 = 0; } else { b2 = 0; d2 = -p2; } i = dshift(C, d, d2); if ((b2 += i) > 0) b = lshift(C, b, b2); if ((d2 += i) > 0) d = lshift(C, d, d2); /* Now b/d = exactly half-way between the two floating-point values */ /* on either side of the input string. Compute first digit of b/d. */ if (!(dig = quorem(C, b,d))) { b = multadd(C, b, 10, 0); /* very unlikely */ dig = quorem(C, b,d); } /* Compare b/d with s0 */ for(i = 0; i < nd0; ) { if ((dd = s0[i++] - '0' - dig)) goto ret; if (!b->x[0] && b->wds == 1) { if (i < nd) dd = 1; goto ret; } b = multadd(C, b, 10, 0); dig = quorem(C, b,d); } for(j = bc->dp1; i++ < nd;) { if ((dd = s0[j++] - '0' - dig)) goto ret; if (!b->x[0] && b->wds == 1) { if (i < nd) dd = 1; goto ret; } b = multadd(C, b, 10, 0); dig = quorem(C, b,d); } if (dig > 0 || b->x[0] || b->wds > 1) dd = -1; ret: Bfree(C, b); Bfree(C, d); #ifdef Honor_FLT_ROUNDS if (bc->rounding != 1) { if (dd < 0) { if (bc->rounding == 0) { if (!dsign) goto retlow1; } else if (dsign) goto rethi1; } else if (dd > 0) { if (bc->rounding == 0) { if (dsign) goto rethi1; goto ret1; } if (!dsign) goto rethi1; dval(rv) += 2.*sulp(C, rv,bc); } else { bc->inexact = 0; if (dsign) goto rethi1; } } else #endif if (speccase) { if (dd <= 0) rv->d = 0.; } else if (dd < 0) { if (!dsign) /* does not happen for round-near */ retlow1: dval(rv) -= sulp(C, rv,bc); } else if (dd > 0) { if (dsign) { rethi1: dval(rv) += sulp(C, rv,bc); } } else { /* Exact half-way case: apply round-even rule. */ if ((j = ((word0(rv) & Exp_mask) >> Exp_shift) - bc->scale) <= 0) { i = 1 - j; if (i <= 31) { if (word1(rv) & (0x1 << i)) goto odd; } else if (word0(rv) & (0x1 << (i-32))) goto odd; } else if (word1(rv) & 1) { odd: if (dsign) goto rethi1; goto retlow1; } } #ifdef Honor_FLT_ROUNDS ret1: #endif return; } #endif /* NO_STRTOD_BIGCOMP */ double jvp_strtod (struct dtoa_context* C, const char *s00, char **se) { int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1; #ifdef Honor_FLT_ROUNDS int test_scale; #endif int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign; CONST char *s, *s0, *s1; double aadj, aadj1; Long L; U aadj2, adj, rv, rv0; ULong y, z; BCinfo bc; Bigint *bb=0, *bb1, *bd=0, *bd0, *bs=0, *delta=0; #ifdef Avoid_Underflow ULong Lsb, Lsb1; #endif #ifdef SET_INEXACT int oldinexact; #endif #ifndef NO_STRTOD_BIGCOMP int req_bigcomp = 0; #endif #ifdef Honor_FLT_ROUNDS /*{*/ #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ bc.rounding = Flt_Rounds; #else /*}{*/ bc.rounding = 1; switch(fegetround()) { case FE_TOWARDZERO: bc.rounding = 0; break; case FE_UPWARD: bc.rounding = 2; break; case FE_DOWNWARD: bc.rounding = 3; } #endif /*}}*/ #endif /*}*/ #ifdef USE_LOCALE CONST char *s2; #endif sign = nz0 = nz1 = nz = bc.dplen = bc.uflchk = 0; dval(&rv) = 0.; switch(*(s = s00)) { case '-': sign = 1; /* no break */ JQ_FALLTHROUGH; case '+': if (*++s) break; /* no break */ JQ_FALLTHROUGH; case 0: goto ret0; default: break; } if (*s == '0') { #ifndef NO_HEX_FP /*{*/ switch(s[1]) { case 'x': case 'X': #ifdef Honor_FLT_ROUNDS gethex(C, &s, &rv, bc.rounding, sign); #else gethex(C, &s, &rv, 1, sign); #endif goto ret; } #endif /*}*/ nz0 = 1; while(*++s == '0') ; if (!*s) goto ret; } s0 = s; y = z = 0; for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) if (nd < 9) y = 10*y + c - '0'; else if (nd < 16) z = 10*z + c - '0'; nd0 = nd; bc.dp0 = bc.dp1 = s - s0; for(s1 = s; s1 > s0 && *--s1 == '0'; ) ++nz1; #ifdef USE_LOCALE s1 = localeconv()->decimal_point; if (c == *s1) { c = '.'; if (*++s1) { s2 = s; for(;;) { if (*++s2 != *s1) { c = 0; break; } if (!*++s1) { s = s2; break; } } } } #endif if (c == '.') { c = *++s; bc.dp1 = s - s0; bc.dplen = bc.dp1 - bc.dp0; if (!nd) { for(; c == '0'; c = *++s) nz++; if (c > '0' && c <= '9') { bc.dp0 = s0 - s; bc.dp1 = bc.dp0 + bc.dplen; s0 = s; nf += nz; nz = 0; goto have_dig; } goto dig_done; } for(; c >= '0' && c <= '9'; c = *++s) { have_dig: nz++; if (c -= '0') { nf += nz; for(i = 1; i < nz; i++) if (nd++ < 9) y *= 10; else if (nd <= DBL_DIG + 1) z *= 10; if (nd++ < 9) y = 10*y + c; else if (nd <= DBL_DIG + 1) z = 10*z + c; nz = nz1 = 0; } } } dig_done: e = 0; if (c == 'e' || c == 'E') { if (!nd && !nz && !nz0) { goto ret0; } s00 = s; esign = 0; switch(c = *++s) { case '-': esign = 1; JQ_FALLTHROUGH; case '+': c = *++s; } if (c >= '0' && c <= '9') { while(c == '0') c = *++s; if (c > '0' && c <= '9') { L = c - '0'; s1 = s; while((c = *++s) >= '0' && c <= '9') L = 10*L + c - '0'; if (s - s1 > 8 || L > 19999) /* Avoid confusion from exponents * so large that e might overflow. */ e = 19999; /* safe for 16 bit ints */ else e = (int)L; if (esign) e = -e; } else e = 0; } else s = s00; } if (!nd) { if (!nz && !nz0) { #ifdef INFNAN_CHECK /* Check for Nan and Infinity */ if (!bc.dplen) switch(c) { case 'i': case 'I': if (match(C, &s,"nf")) { --s; if (!match(C, &s,"inity")) ++s; word0(&rv) = 0x7ff00000; word1(&rv) = 0; goto ret; } break; case 'n': case 'N': if (match(C, &s, "an")) { word0(&rv) = NAN_WORD0; word1(&rv) = NAN_WORD1; #ifndef No_Hex_NaN if (*s == '(') /*)*/ hexnan(C, &rv, &s); #endif goto ret; } } #endif /* INFNAN_CHECK */ ret0: s = s00; sign = 0; } goto ret; } bc.e0 = e1 = e -= nf; /* Now we have nd0 digits, starting at s0, followed by a * decimal point, followed by nd-nd0 digits. The number we're * after is the integer represented by those digits times * 10**e */ if (!nd0) nd0 = nd; k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; dval(&rv) = y; if (k > 9) { #ifdef SET_INEXACT if (k > DBL_DIG) oldinexact = get_inexact(); #endif dval(&rv) = tens[k - 9] * dval(&rv) + z; } bd0 = 0; if (nd <= DBL_DIG #ifndef RND_PRODQUOT #ifndef Honor_FLT_ROUNDS && Flt_Rounds == 1 #endif #endif ) { if (!e) goto ret; #ifndef ROUND_BIASED_without_Round_Up if (e > 0) { if (e <= Ten_pmax) { #ifdef VAX goto vax_ovfl_check; #else #ifdef Honor_FLT_ROUNDS /* round correctly FLT_ROUNDS = 2 or 3 */ if (sign) { rv.d = -rv.d; sign = 0; } #endif /* rv = */ rounded_product(dval(&rv), tens[e]); goto ret; #endif } i = DBL_DIG - nd; if (e <= Ten_pmax + i) { /* A fancier test would sometimes let us do * this for larger i values. */ #ifdef Honor_FLT_ROUNDS /* round correctly FLT_ROUNDS = 2 or 3 */ if (sign) { rv.d = -rv.d; sign = 0; } #endif e -= i; dval(&rv) *= tens[i]; #ifdef VAX /* VAX exponent range is so narrow we must * worry about overflow here... */ vax_ovfl_check: word0(&rv) -= P*Exp_msk1; /* rv = */ rounded_product(dval(&rv), tens[e]); if ((word0(&rv) & Exp_mask) > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) goto ovfl; word0(&rv) += P*Exp_msk1; #else /* rv = */ rounded_product(dval(&rv), tens[e]); #endif goto ret; } } #ifndef Inaccurate_Divide else if (e >= -Ten_pmax) { #ifdef Honor_FLT_ROUNDS /* round correctly FLT_ROUNDS = 2 or 3 */ if (sign) { rv.d = -rv.d; sign = 0; } #endif /* rv = */ rounded_quotient(dval(&rv), tens[-e]); goto ret; } #endif #endif /* ROUND_BIASED_without_Round_Up */ } e1 += nd - k; #ifdef IEEE_Arith #ifdef SET_INEXACT bc.inexact = 1; if (k <= DBL_DIG) oldinexact = get_inexact(); #endif #ifdef Avoid_Underflow bc.scale = 0; #endif #ifdef Honor_FLT_ROUNDS if (bc.rounding >= 2) { if (sign) bc.rounding = bc.rounding == 2 ? 0 : 2; else if (bc.rounding != 2) bc.rounding = 0; } #endif #endif /*IEEE_Arith*/ /* Get starting approximation = rv * 10**e1 */ if (e1 > 0) { if ((i = e1 & 15)) dval(&rv) *= tens[i]; if (e1 &= ~15) { if (e1 > DBL_MAX_10_EXP) { ovfl: /* Can't trust HUGE_VAL */ #ifdef IEEE_Arith #ifdef Honor_FLT_ROUNDS switch(bc.rounding) { case 0: /* toward 0 */ case 3: /* toward -infinity */ word0(&rv) = Big0; word1(&rv) = Big1; break; default: word0(&rv) = Exp_mask; word1(&rv) = 0; } #else /*Honor_FLT_ROUNDS*/ word0(&rv) = Exp_mask; word1(&rv) = 0; #endif /*Honor_FLT_ROUNDS*/ #ifdef SET_INEXACT /* set overflow bit */ dval(&rv0) = 1e300; dval(&rv0) *= dval(&rv0); #endif #else /*IEEE_Arith*/ word0(&rv) = Big0; word1(&rv) = Big1; #endif /*IEEE_Arith*/ range_err: if (bd0) { Bfree(C, bb); Bfree(C, bd); Bfree(C, bs); Bfree(C, bd0); Bfree(C, delta); } #ifndef NO_ERRNO errno = ERANGE; #endif goto ret; } e1 >>= 4; for(j = 0; e1 > 1; j++, e1 >>= 1) if (e1 & 1) dval(&rv) *= bigtens[j]; /* The last multiplication could overflow. */ word0(&rv) -= P*Exp_msk1; dval(&rv) *= bigtens[j]; if ((z = word0(&rv) & Exp_mask) > Exp_msk1*(DBL_MAX_EXP+Bias-P)) goto ovfl; if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { /* set to largest number */ /* (Can't trust DBL_MAX) */ word0(&rv) = Big0; word1(&rv) = Big1; } else word0(&rv) += P*Exp_msk1; } } else if (e1 < 0) { e1 = -e1; if ((i = e1 & 15)) dval(&rv) /= tens[i]; if (e1 >>= 4) { if (e1 >= 1 << n_bigtens) goto undfl; #ifdef Avoid_Underflow if (e1 & Scale_Bit) bc.scale = 2*P; for(j = 0; e1 > 0; j++, e1 >>= 1) if (e1 & 1) dval(&rv) *= tinytens[j]; if (bc.scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask) >> Exp_shift)) > 0) { /* scaled rv is denormal; clear j low bits */ if (j >= 32) { if (j > 54) goto undfl; word1(&rv) = 0; if (j >= 53) word0(&rv) = (P+2)*Exp_msk1; else word0(&rv) &= 0xffffffff << (j-32); } else word1(&rv) &= 0xffffffff << j; } #else for(j = 0; e1 > 1; j++, e1 >>= 1) if (e1 & 1) dval(&rv) *= tinytens[j]; /* The last multiplication could underflow. */ dval(&rv0) = dval(&rv); dval(&rv) *= tinytens[j]; if (!dval(&rv)) { dval(&rv) = 2.*dval(&rv0); dval(&rv) *= tinytens[j]; #endif if (!dval(&rv)) { undfl: dval(&rv) = 0.; goto range_err; } #ifndef Avoid_Underflow word0(&rv) = Tiny0; word1(&rv) = Tiny1; /* The refinement below will clean * this approximation up. */ } #endif } } /* Now the hard part -- adjusting rv to the correct value.*/ /* Put digits into bd: true value = bd * 10^e */ bc.nd = nd - nz1; #ifndef NO_STRTOD_BIGCOMP bc.nd0 = nd0; /* Only needed if nd > strtod_diglim, but done here */ /* to silence an erroneous warning about bc.nd0 */ /* possibly not being initialized. */ if (nd > strtod_diglim) { /* ASSERT(strtod_diglim >= 18); 18 == one more than the */ /* minimum number of decimal digits to distinguish double values */ /* in IEEE arithmetic. */ i = j = 18; if (i > nd0) j += bc.dplen; for(;;) { if (--j < bc.dp1 && j >= bc.dp0) j = bc.dp0 - 1; if (s0[j] != '0') break; --i; } e += nd - i; nd = i; if (nd0 > nd) nd0 = nd; if (nd < 9) { /* must recompute y */ y = 0; for(i = 0; i < nd0; ++i) y = 10*y + s0[i] - '0'; for(j = bc.dp1; i < nd; ++i) y = 10*y + s0[j++] - '0'; } } #endif bd0 = s2b(C, s0, nd0, nd, y, bc.dplen); for(;;) { bd = Balloc(C, bd0->k); Bcopy(bd, bd0); bb = d2b(C, &rv, &bbe, &bbbits); /* rv = bb * 2^bbe */ bs = i2b(C, 1); if (e >= 0) { bb2 = bb5 = 0; bd2 = bd5 = e; } else { bb2 = bb5 = -e; bd2 = bd5 = 0; } if (bbe >= 0) bb2 += bbe; else bd2 -= bbe; bs2 = bb2; #ifdef Honor_FLT_ROUNDS if (bc.rounding != 1) bs2++; #endif #ifdef Avoid_Underflow Lsb = LSB; Lsb1 = 0; j = bbe - bc.scale; i = j + bbbits - 1; /* logb(rv) */ j = P + 1 - bbbits; if (i < Emin) { /* denormal */ i = Emin - i; j -= i; if (i < 32) Lsb <<= i; else if (i < 52) Lsb1 = Lsb << (i-32); else Lsb1 = Exp_mask; } #else /*Avoid_Underflow*/ #ifdef Sudden_Underflow #ifdef IBM j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3); #else j = P + 1 - bbbits; #endif #else /*Sudden_Underflow*/ j = bbe; i = j + bbbits - 1; /* logb(rv) */ if (i < Emin) /* denormal */ j += P - Emin; else j = P + 1 - bbbits; #endif /*Sudden_Underflow*/ #endif /*Avoid_Underflow*/ bb2 += j; bd2 += j; #ifdef Avoid_Underflow bd2 += bc.scale; #endif i = bb2 < bd2 ? bb2 : bd2; if (i > bs2) i = bs2; if (i > 0) { bb2 -= i; bd2 -= i; bs2 -= i; } if (bb5 > 0) { bs = pow5mult(C, bs, bb5); bb1 = mult(C, bs, bb); Bfree(C, bb); bb = bb1; } if (bb2 > 0) bb = lshift(C, bb, bb2); if (bd5 > 0) bd = pow5mult(C, bd, bd5); if (bd2 > 0) bd = lshift(C, bd, bd2); if (bs2 > 0) bs = lshift(C, bs, bs2); delta = diff(C, bb, bd); bc.dsign = delta->sign; delta->sign = 0; i = cmp(C, delta, bs); #ifndef NO_STRTOD_BIGCOMP /*{*/ if (bc.nd > nd && i <= 0) { if (bc.dsign) { /* Must use bigcomp(C, ). */ req_bigcomp = 1; break; } #ifdef Honor_FLT_ROUNDS if (bc.rounding != 1) { if (i < 0) { req_bigcomp = 1; break; } } else #endif i = -1; /* Discarded digits make delta smaller. */ } #endif /*}*/ #ifdef Honor_FLT_ROUNDS /*{*/ if (bc.rounding != 1) { if (i < 0) { /* Error is less than an ulp */ if (!delta->x[0] && delta->wds <= 1) { /* exact */ #ifdef SET_INEXACT bc.inexact = 0; #endif break; } if (bc.rounding) { if (bc.dsign) { adj.d = 1.; goto apply_adj; } } else if (!bc.dsign) { adj.d = -1.; if (!word1(&rv) && !(word0(&rv) & Frac_mask)) { y = word0(&rv) & Exp_mask; test_scale = y; #ifdef Avoid_Underflow test_scale = (!bc.scale || y > 2*P*Exp_msk1); #endif if (test_scale) { delta = lshift(C, delta,Log2P); if (cmp(C, delta, bs) <= 0) adj.d = -0.5; } } apply_adj: #ifdef Avoid_Underflow /*{*/ if (bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) word0(&adj) += (2*P+1)*Exp_msk1 - y; #else #ifdef Sudden_Underflow if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { word0(&rv) += P*Exp_msk1; dval(&rv) += adj.d*ulp(C, dval(&rv)); word0(&rv) -= P*Exp_msk1; } else #endif /*Sudden_Underflow*/ #endif /*Avoid_Underflow}*/ dval(&rv) += adj.d*ulp(C, &rv); } break; } adj.d = ratio(C, delta, bs); if (adj.d < 1.) adj.d = 1.; if (adj.d <= 0x7ffffffe) { /* adj = rounding ? ceil(adj) : floor(adj); */ y = adj.d; if (y != adj.d) { if (!((bc.rounding>>1) ^ bc.dsign)) y++; adj.d = y; } } #ifdef Avoid_Underflow /*{*/ if (bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) word0(&adj) += (2*P+1)*Exp_msk1 - y; #else #ifdef Sudden_Underflow if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { word0(&rv) += P*Exp_msk1; adj.d *= ulp(C, dval(&rv)); if (bc.dsign) dval(&rv) += adj.d; else dval(&rv) -= adj.d; word0(&rv) -= P*Exp_msk1; goto cont; } #endif /*Sudden_Underflow*/ #endif /*Avoid_Underflow}*/ adj.d *= ulp(C, &rv); if (bc.dsign) { if (word0(&rv) == Big0 && word1(&rv) == Big1) goto ovfl; dval(&rv) += adj.d; } else dval(&rv) -= adj.d; goto cont; } #endif /*}Honor_FLT_ROUNDS*/ if (i < 0) { /* Error is less than half an ulp -- check for * special case of mantissa a power of two. */ if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask #ifdef IEEE_Arith /*{*/ #ifdef Avoid_Underflow || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1 #else || (word0(&rv) & Exp_mask) <= Exp_msk1 #endif #endif /*}*/ ) { #ifdef SET_INEXACT if (!delta->x[0] && delta->wds <= 1) bc.inexact = 0; #endif break; } if (!delta->x[0] && delta->wds <= 1) { /* exact result */ #ifdef SET_INEXACT bc.inexact = 0; #endif break; } delta = lshift(C, delta,Log2P); if (cmp(C, delta, bs) > 0) goto drop_down; break; } if (i == 0) { /* exactly half-way between */ if (bc.dsign) { if ((word0(&rv) & Bndry_mask1) == Bndry_mask1 && word1(&rv) == ( #ifdef Avoid_Underflow (bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) ? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) : #endif 0xffffffff)) { /*boundary case -- increment exponent*/ if (word0(&rv) == Big0 && word1(&rv) == Big1) goto ovfl; word0(&rv) = (word0(&rv) & Exp_mask) + Exp_msk1 #ifdef IBM | Exp_msk1 >> 4 #endif ; word1(&rv) = 0; #ifdef Avoid_Underflow bc.dsign = 0; #endif break; } } else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) { drop_down: /* boundary case -- decrement exponent */ #ifdef Sudden_Underflow /*{{*/ L = word0(&rv) & Exp_mask; #ifdef IBM if (L < Exp_msk1) #else #ifdef Avoid_Underflow if (L <= (bc.scale ? (2*P+1)*Exp_msk1 : Exp_msk1)) #else if (L <= Exp_msk1) #endif /*Avoid_Underflow*/ #endif /*IBM*/ { if (bc.nd >nd) { bc.uflchk = 1; break; } goto undfl; } L -= Exp_msk1; #else /*Sudden_Underflow}{*/ #ifdef Avoid_Underflow if (bc.scale) { L = word0(&rv) & Exp_mask; if (L <= (2*P+1)*Exp_msk1) { if (L > (P+2)*Exp_msk1) /* round even ==> */ /* accept rv */ break; /* rv = smallest denormal */ if (bc.nd >nd) { bc.uflchk = 1; break; } goto undfl; } } #endif /*Avoid_Underflow*/ L = (word0(&rv) & Exp_mask) - Exp_msk1; #endif /*Sudden_Underflow}}*/ word0(&rv) = L | Bndry_mask1; word1(&rv) = 0xffffffff; #ifdef IBM goto cont; #else #ifndef NO_STRTOD_BIGCOMP if (bc.nd > nd) goto cont; #endif break; #endif } #ifndef ROUND_BIASED #ifdef Avoid_Underflow if (Lsb1) { if (!(word0(&rv) & Lsb1)) break; } else if (!(word1(&rv) & Lsb)) break; #else if (!(word1(&rv) & LSB)) break; #endif #endif if (bc.dsign) #ifdef Avoid_Underflow dval(&rv) += sulp(C, &rv, &bc); #else dval(&rv) += ulp(C, &rv); #endif #ifndef ROUND_BIASED else { #ifdef Avoid_Underflow dval(&rv) -= sulp(C, &rv, &bc); #else dval(&rv) -= ulp(C, &rv); #endif #ifndef Sudden_Underflow if (!dval(&rv)) { if (bc.nd >nd) { bc.uflchk = 1; break; } goto undfl; } #endif } #ifdef Avoid_Underflow bc.dsign = 1 - bc.dsign; #endif #endif break; } if ((aadj = ratio(C, delta, bs)) <= 2.) { if (bc.dsign) aadj = aadj1 = 1.; else if (word1(&rv) || word0(&rv) & Bndry_mask) { #ifndef Sudden_Underflow if (word1(&rv) == Tiny1 && !word0(&rv)) { if (bc.nd >nd) { bc.uflchk = 1; break; } goto undfl; } #endif aadj = 1.; aadj1 = -1.; } else { /* special case -- power of FLT_RADIX to be */ /* rounded down... */ if (aadj < 2./FLT_RADIX) aadj = 1./FLT_RADIX; else aadj *= 0.5; aadj1 = -aadj; } } else { aadj *= 0.5; aadj1 = bc.dsign ? aadj : -aadj; #ifdef Check_FLT_ROUNDS switch(bc.rounding) { case 2: /* towards +infinity */ aadj1 -= 0.5; break; case 0: /* towards 0 */ case 3: /* towards -infinity */ aadj1 += 0.5; } #else if (Flt_Rounds == 0) aadj1 += 0.5; #endif /*Check_FLT_ROUNDS*/ } y = word0(&rv) & Exp_mask; /* Check for overflow */ if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { dval(&rv0) = dval(&rv); word0(&rv) -= P*Exp_msk1; adj.d = aadj1 * ulp(C, &rv); dval(&rv) += adj.d; if ((word0(&rv) & Exp_mask) >= Exp_msk1*(DBL_MAX_EXP+Bias-P)) { if (word0(&rv0) == Big0 && word1(&rv0) == Big1) goto ovfl; word0(&rv) = Big0; word1(&rv) = Big1; goto cont; } else word0(&rv) += P*Exp_msk1; } else { #ifdef Avoid_Underflow if (bc.scale && y <= 2*P*Exp_msk1) { if (aadj <= 0x7fffffff) { if ((z = aadj) <= 0) z = 1; aadj = z; aadj1 = bc.dsign ? aadj : -aadj; } dval(&aadj2) = aadj1; word0(&aadj2) += (2*P+1)*Exp_msk1 - y; aadj1 = dval(&aadj2); adj.d = aadj1 * ulp(C, &rv); dval(&rv) += adj.d; if (rv.d == 0.) #ifdef NO_STRTOD_BIGCOMP goto undfl; #else { if (bc.nd > nd) bc.dsign = 1; break; } #endif } else { adj.d = aadj1 * ulp(C, &rv); dval(&rv) += adj.d; } #else #ifdef Sudden_Underflow if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { dval(&rv0) = dval(&rv); word0(&rv) += P*Exp_msk1; adj.d = aadj1 * ulp(C, &rv); dval(&rv) += adj.d; #ifdef IBM if ((word0(&rv) & Exp_mask) < P*Exp_msk1) #else if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) #endif { if (word0(&rv0) == Tiny0 && word1(&rv0) == Tiny1) { if (bc.nd >nd) { bc.uflchk = 1; break; } goto undfl; } word0(&rv) = Tiny0; word1(&rv) = Tiny1; goto cont; } else word0(&rv) -= P*Exp_msk1; } else { adj.d = aadj1 * ulp(C, &rv); dval(&rv) += adj.d; } #else /*Sudden_Underflow*/ /* Compute adj so that the IEEE rounding rules will * correctly round rv + adj in some half-way cases. * If rv * ulp(C, rv) is denormalized (i.e., * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid * trouble from bits lost to denormalization; * example: 1.2e-307 . */ if (y <= (P-1)*Exp_msk1 && aadj > 1.) { aadj1 = (double)(int)(aadj + 0.5); if (!bc.dsign) aadj1 = -aadj1; } adj.d = aadj1 * ulp(C, &rv); dval(&rv) += adj.d; #endif /*Sudden_Underflow*/ #endif /*Avoid_Underflow*/ } z = word0(&rv) & Exp_mask; #ifndef SET_INEXACT if (bc.nd == nd) { #ifdef Avoid_Underflow if (!bc.scale) #endif if (y == z) { /* Can we stop now? */ L = (Long)aadj; aadj -= L; /* The tolerances below are conservative. */ if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask) { if (aadj < .4999999 || aadj > .5000001) break; } else if (aadj < .4999999/FLT_RADIX) break; } } #endif cont: Bfree(C, bb); Bfree(C, bd); Bfree(C, bs); Bfree(C, delta); } Bfree(C, bb); Bfree(C, bd); Bfree(C, bs); Bfree(C, bd0); Bfree(C, delta); #ifndef NO_STRTOD_BIGCOMP if (req_bigcomp) { bd0 = 0; bc.e0 += nz1; bigcomp(C, &rv, s0, &bc); y = word0(&rv) & Exp_mask; if (y == Exp_mask) goto ovfl; if (y == 0 && rv.d == 0.) goto undfl; } #endif #ifdef SET_INEXACT if (bc.inexact) { if (!oldinexact) { word0(&rv0) = Exp_1 + (70 << Exp_shift); word1(&rv0) = 0; dval(&rv0) += 1.; } } else if (!oldinexact) clear_inexact(); #endif #ifdef Avoid_Underflow if (bc.scale) { word0(&rv0) = Exp_1 - 2*P*Exp_msk1; word1(&rv0) = 0; dval(&rv) *= dval(&rv0); #ifndef NO_ERRNO /* try to avoid the bug of testing an 8087 register value */ #ifdef IEEE_Arith if (!(word0(&rv) & Exp_mask)) #else if (word0(&rv) == 0 && word1(&rv) == 0) #endif errno = ERANGE; #endif } #endif /* Avoid_Underflow */ #ifdef SET_INEXACT if (bc.inexact && !(word0(&rv) & Exp_mask)) { /* set underflow bit */ dval(&rv0) = 1e-300; dval(&rv0) *= dval(&rv0); } #endif ret: if (se) *se = (char *)s; return sign ? -dval(&rv) : dval(&rv); } static char * rv_alloc(struct dtoa_context* C, int i) { int j, k, *r; j = sizeof(ULong); for(k = 0; (int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int)) + j <= i; j <<= 1) k++; r = (int*)Balloc(C, k); *r = k; return (char *)(r+1); } static char * nrv_alloc(struct dtoa_context* C, const char *s, char **rve, int n) { char *rv, *t; t = rv = rv_alloc(C, n); while((*t = *s++)) t++; if (rve) *rve = t; return rv; } /* freedtoa(s) must be used to free values s returned by dtoa * when MULTIPLE_THREADS is #defined. It should be used in all cases, * but for consistency with earlier versions of dtoa, it is optional * when MULTIPLE_THREADS is not defined. */ void jvp_freedtoa(struct dtoa_context* C, char *s) { Bigint *b = (Bigint *)((int *)s - 1); b->maxwds = 1 << (b->k = *(int*)b); Bfree(C, b); } /* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. * * Inspired by "How to Print Floating-Point Numbers Accurately" by * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. * * Modifications: * 1. Rather than iterating, we use a simple numeric overestimate * to determine k = floor(log10(d)). We scale relevant * quantities using O(log2(k)) rather than O(k) multiplications. * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't * try to generate digits strictly left to right. Instead, we * compute with fewer bits and propagate the carry if necessary * when rounding the final digit up. This is often faster. * 3. Under the assumption that input will be rounded nearest, * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. * That is, we allow equality in stopping tests when the * round-nearest rule will give the same floating-point value * as would satisfaction of the stopping test with strict * inequality. * 4. We remove common factors of powers of 2 from relevant * quantities. * 5. When converting floating-point integers less than 1e16, * we use floating-point arithmetic rather than resorting * to multiple-precision integers. * 6. When asked to produce fewer than 15 digits, we first try * to get by with floating-point arithmetic; we resort to * multiple-precision integer arithmetic only if we cannot * guarantee that the floating-point calculation has given * the correctly rounded result. For k requested digits and * "uniformly" distributed input, the probability is * something like 10^(k-15) that we must resort to the Long * calculation. */ char * jvp_dtoa (struct dtoa_context* C, double dd, int mode, int ndigits, int *decpt, int *sign, char **rve) { /* Arguments ndigits, decpt, sign are similar to those of ecvt and fcvt; trailing zeros are suppressed from the returned string. If not null, *rve is set to point to the end of the return value. If d is +-Infinity or NaN, then *decpt is set to 9999. mode: 0 ==> shortest string that yields d when read in and rounded to nearest. 1 ==> like 0, but with Steele & White stopping rule; e.g. with IEEE P754 arithmetic , mode 0 gives 1e23 whereas mode 1 gives 9.999999999999999e22. 2 ==> max(1,ndigits) significant digits. This gives a return value similar to that of ecvt, except that trailing zeros are suppressed. 3 ==> through ndigits past the decimal point. This gives a return value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative. 4,5 ==> similar to 2 and 3, respectively, but (in round-nearest mode) with the tests of mode 0 to possibly return a shorter string that rounds to d. With IEEE arithmetic and compilation with -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same as modes 2 and 3 when FLT_ROUNDS != 1. 6-9 ==> Debugging modes similar to mode - 4: don't try fast floating-point estimate (if applicable). Values of mode other than 0-9 are treated as mode 0. Sufficient space is allocated to the return value to hold the suppressed trailing zeros. */ int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, j, j1=0, k, k0, k_check, leftright, m2, m5, s2, s5, spec_case, try_quick; Long L; #ifndef Sudden_Underflow int denorm; ULong x; #endif Bigint *b, *b1, *delta, *mlo, *mhi, *S; U d2, eps, u; double ds; char *s, *s0; #ifndef No_leftright #ifdef IEEE_Arith U eps1; #endif #endif #ifdef SET_INEXACT int inexact, oldinexact; #endif #ifdef Honor_FLT_ROUNDS /*{*/ int Rounding; #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ Rounding = Flt_Rounds; #else /*}{*/ Rounding = 1; switch(fegetround()) { case FE_TOWARDZERO: Rounding = 0; break; case FE_UPWARD: Rounding = 2; break; case FE_DOWNWARD: Rounding = 3; } #endif /*}}*/ #endif /*}*/ u.d = dd; if (word0(&u) & Sign_bit) { /* set sign for everything, including 0's and NaNs */ *sign = 1; word0(&u) &= ~Sign_bit; /* clear sign bit */ } else *sign = 0; #if defined(IEEE_Arith) + defined(VAX) #ifdef IEEE_Arith if ((word0(&u) & Exp_mask) == Exp_mask) #else if (word0(&u) == 0x8000) #endif { /* Infinity or NaN */ *decpt = 9999; #ifdef IEEE_Arith if (!word1(&u) && !(word0(&u) & 0xfffff)) return nrv_alloc(C, "Infinity", rve, 8); #endif return nrv_alloc(C, "NaN", rve, 3); } #endif #ifdef IBM dval(&u) += 0; /* normalize */ #endif if (!dval(&u)) { *decpt = 1; return nrv_alloc(C, "0", rve, 1); } #ifdef SET_INEXACT try_quick = oldinexact = get_inexact(); inexact = 1; #endif #ifdef Honor_FLT_ROUNDS if (Rounding >= 2) { if (*sign) Rounding = Rounding == 2 ? 0 : 2; else if (Rounding != 2) Rounding = 0; } #endif b = d2b(C, &u, &be, &bbits); #ifdef Sudden_Underflow i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); #else if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) { #endif dval(&d2) = dval(&u); word0(&d2) &= Frac_mask1; word0(&d2) |= Exp_11; #ifdef IBM if (j = 11 - hi0bits(C, word0(&d2) & Frac_mask)) dval(&d2) /= 1 << j; #endif /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 * log10(x) = log(x) / log(10) * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) * * This suggests computing an approximation k to log10(d) by * * k = (i - Bias)*0.301029995663981 * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); * * We want k to be too large rather than too small. * The error in the first-order Taylor series approximation * is in our favor, so we just round up the constant enough * to compensate for any error in the multiplication of * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, * adding 1e-13 to the constant term more than suffices. * Hence we adjust the constant term to 0.1760912590558. * (We could get a more accurate k by invoking log10, * but this is probably not worthwhile.) */ i -= Bias; #ifdef IBM i <<= 2; i += j; #endif #ifndef Sudden_Underflow denorm = 0; } else { /* d is denormalized */ i = bbits + be + (Bias + (P-1) - 1); x = i > 32 ? word0(&u) << (64 - i) | word1(&u) >> (i - 32) : word1(&u) << (32 - i); dval(&d2) = x; word0(&d2) -= 31*Exp_msk1; /* adjust exponent */ i -= (Bias + (P-1) - 1) + 1; denorm = 1; } #endif ds = (dval(&d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; k = (int)ds; if (ds < 0. && ds != k) k--; /* want k = floor(ds) */ k_check = 1; if (k >= 0 && k <= Ten_pmax) { if (dval(&u) < tens[k]) k--; k_check = 0; } j = bbits - i - 1; if (j >= 0) { b2 = 0; s2 = j; } else { b2 = -j; s2 = 0; } if (k >= 0) { b5 = 0; s5 = k; s2 += k; } else { b2 -= k; b5 = -k; s5 = 0; } if (mode < 0 || mode > 9) mode = 0; #ifndef SET_INEXACT #ifdef Check_FLT_ROUNDS try_quick = Rounding == 1; #else try_quick = 1; #endif #endif /*SET_INEXACT*/ if (mode > 5) { mode -= 4; try_quick = 0; } leftright = 1; ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */ /* silence erroneous "gcc -Wall" warning. */ switch(mode) { case 0: case 1: i = 18; ndigits = 0; break; case 2: leftright = 0; /* no break */ JQ_FALLTHROUGH; case 4: if (ndigits <= 0) ndigits = 1; ilim = ilim1 = i = ndigits; break; case 3: leftright = 0; /* no break */ JQ_FALLTHROUGH; case 5: i = ndigits + k + 1; ilim = i; ilim1 = i - 1; if (i <= 0) i = 1; } s = s0 = rv_alloc(C, i); #ifdef Honor_FLT_ROUNDS if (mode > 1 && Rounding != 1) leftright = 0; #endif if (ilim >= 0 && ilim <= Quick_max && try_quick) { /* Try to get by with floating-point arithmetic. */ i = 0; dval(&d2) = dval(&u); k0 = k; ilim0 = ilim; ieps = 2; /* conservative */ if (k > 0) { ds = tens[k&0xf]; j = k >> 4; if (j & Bletch) { /* prevent overflows */ j &= Bletch - 1; dval(&u) /= bigtens[n_bigtens-1]; ieps++; } for(; j; j >>= 1, i++) if (j & 1) { ieps++; ds *= bigtens[i]; } dval(&u) /= ds; } else if ((j1 = -k)) { dval(&u) *= tens[j1 & 0xf]; for(j = j1 >> 4; j; j >>= 1, i++) if (j & 1) { ieps++; dval(&u) *= bigtens[i]; } } if (k_check && dval(&u) < 1. && ilim > 0) { if (ilim1 <= 0) goto fast_failed; ilim = ilim1; k--; dval(&u) *= 10.; ieps++; } dval(&eps) = ieps*dval(&u) + 7.; word0(&eps) -= (P-1)*Exp_msk1; if (ilim == 0) { S = mhi = 0; dval(&u) -= 5.; if (dval(&u) > dval(&eps)) goto one_digit; if (dval(&u) < -dval(&eps)) goto no_digits; goto fast_failed; } #ifndef No_leftright if (leftright) { /* Use Steele & White method of only * generating digits needed. */ dval(&eps) = 0.5/tens[ilim-1] - dval(&eps); #ifdef IEEE_Arith if (k0 < 0 && j1 >= 307) { eps1.d = 1.01e256; /* 1.01 allows roundoff in the next few lines */ word0(&eps1) -= Exp_msk1 * (Bias+P-1); dval(&eps1) *= tens[j1 & 0xf]; for(i = 0, j = (j1-256) >> 4; j; j >>= 1, i++) if (j & 1) dval(&eps1) *= bigtens[i]; if (eps.d < eps1.d) eps.d = eps1.d; } #endif for(i = 0;;) { L = dval(&u); dval(&u) -= L; *s++ = '0' + (int)L; if (1. - dval(&u) < dval(&eps)) goto bump_up; if (dval(&u) < dval(&eps)) goto ret1; if (++i >= ilim) break; dval(&eps) *= 10.; dval(&u) *= 10.; } } else { #endif /* Generate ilim digits, then fix them up. */ dval(&eps) *= tens[ilim-1]; for(i = 1;; i++, dval(&u) *= 10.) { L = (Long)(dval(&u)); if (!(dval(&u) -= L)) ilim = i; *s++ = '0' + (int)L; if (i == ilim) { if (dval(&u) > 0.5 + dval(&eps)) goto bump_up; else if (dval(&u) < 0.5 - dval(&eps)) { while(*--s == '0'); s++; goto ret1; } break; } } #ifndef No_leftright } #endif fast_failed: s = s0; dval(&u) = dval(&d2); k = k0; ilim = ilim0; } /* Do we have a "small" integer? */ if (be >= 0 && k <= Int_max) { /* Yes. */ ds = tens[k]; if (ndigits < 0 && ilim <= 0) { S = mhi = 0; if (ilim < 0 || dval(&u) <= 5*ds) goto no_digits; goto one_digit; } for(i = 1;; i++, dval(&u) *= 10.) { L = (Long)(dval(&u) / ds); dval(&u) -= L*ds; #ifdef Check_FLT_ROUNDS /* If FLT_ROUNDS == 2, L will usually be high by 1 */ if (dval(&u) < 0) { L--; dval(&u) += ds; } #endif *s++ = '0' + (int)L; if (!dval(&u)) { #ifdef SET_INEXACT inexact = 0; #endif break; } if (i == ilim) { #ifdef Honor_FLT_ROUNDS if (mode > 1) switch(Rounding) { case 0: goto ret1; case 2: goto bump_up; } #endif dval(&u) += dval(&u); #ifdef ROUND_BIASED if (dval(&u) >= ds) #else if (dval(&u) > ds || (dval(&u) == ds && L & 1)) #endif { bump_up: while(*--s == '9') if (s == s0) { k++; *s = '0'; break; } ++*s++; } break; } } goto ret1; } m2 = b2; m5 = b5; mhi = mlo = 0; if (leftright) { i = #ifndef Sudden_Underflow denorm ? be + (Bias + (P-1) - 1 + 1) : #endif #ifdef IBM 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); #else 1 + P - bbits; #endif b2 += i; s2 += i; mhi = i2b(C, 1); } if (m2 > 0 && s2 > 0) { i = m2 < s2 ? m2 : s2; b2 -= i; m2 -= i; s2 -= i; } if (b5 > 0) { if (leftright) { if (m5 > 0) { mhi = pow5mult(C, mhi, m5); b1 = mult(C, mhi, b); Bfree(C, b); b = b1; } if ((j = b5 - m5)) b = pow5mult(C, b, j); } else b = pow5mult(C, b, b5); } S = i2b(C, 1); if (s5 > 0) S = pow5mult(C, S, s5); /* Check for special case that d is a normalized power of 2. */ spec_case = 0; if ((mode < 2 || leftright) #ifdef Honor_FLT_ROUNDS && Rounding == 1 #endif ) { if (!word1(&u) && !(word0(&u) & Bndry_mask) #ifndef Sudden_Underflow && word0(&u) & (Exp_mask & ~Exp_msk1) #endif ) { /* The special case */ b2 += Log2P; s2 += Log2P; spec_case = 1; } } /* Arrange for convenient computation of quotients: * shift left if necessary so divisor has 4 leading 0 bits. * * Perhaps we should just compute leading 28 bits of S once * and for all and pass them and a shift to quorem, so it * can do shifts and ors to compute the numerator for q. */ i = dshift(C, S, s2); b2 += i; m2 += i; s2 += i; if (b2 > 0) b = lshift(C, b, b2); if (s2 > 0) S = lshift(C, S, s2); if (k_check) { if (cmp(C, b,S) < 0) { k--; b = multadd(C, b, 10, 0); /* we botched the k estimate */ if (leftright) mhi = multadd(C, mhi, 10, 0); ilim = ilim1; } } if (ilim <= 0 && (mode == 3 || mode == 5)) { if (ilim < 0 || cmp(C, b,S = multadd(C, S,5,0)) <= 0) { /* no digits, fcvt style */ no_digits: k = -1 - ndigits; goto ret; } one_digit: *s++ = '1'; k++; goto ret; } if (leftright) { if (m2 > 0) mhi = lshift(C, mhi, m2); /* Compute mlo -- check for special case * that d is a normalized power of 2. */ mlo = mhi; if (spec_case) { mhi = Balloc(C, mhi->k); Bcopy(mhi, mlo); mhi = lshift(C, mhi, Log2P); } for(i = 1;;i++) { dig = quorem(C, b,S) + '0'; /* Do we yet have the shortest decimal string * that will round to d? */ j = cmp(C, b, mlo); delta = diff(C, S, mhi); j1 = delta->sign ? 1 : cmp(C, b, delta); Bfree(C, delta); #ifndef ROUND_BIASED if (j1 == 0 && mode != 1 && !(word1(&u) & 1) #ifdef Honor_FLT_ROUNDS && Rounding >= 1 #endif ) { if (dig == '9') goto round_9_up; if (j > 0) dig++; #ifdef SET_INEXACT else if (!b->x[0] && b->wds <= 1) inexact = 0; #endif *s++ = dig; goto ret; } #endif if (j < 0 || (j == 0 && mode != 1 #ifndef ROUND_BIASED && !(word1(&u) & 1) #endif )) { if (!b->x[0] && b->wds <= 1) { #ifdef SET_INEXACT inexact = 0; #endif goto accept_dig; } #ifdef Honor_FLT_ROUNDS if (mode > 1) switch(Rounding) { case 0: goto accept_dig; case 2: goto keep_dig; } #endif /*Honor_FLT_ROUNDS*/ if (j1 > 0) { b = lshift(C, b, 1); j1 = cmp(C, b, S); #ifdef ROUND_BIASED if (j1 >= 0 /*)*/ #else if ((j1 > 0 || (j1 == 0 && dig & 1)) #endif && dig++ == '9') goto round_9_up; } accept_dig: *s++ = dig; goto ret; } if (j1 > 0) { #ifdef Honor_FLT_ROUNDS if (!Rounding) goto accept_dig; #endif if (dig == '9') { /* possible if i == 1 */ round_9_up: *s++ = '9'; goto roundoff; } *s++ = dig + 1; goto ret; } #ifdef Honor_FLT_ROUNDS keep_dig: #endif *s++ = dig; if (i == ilim) break; b = multadd(C, b, 10, 0); if (mlo == mhi) mlo = mhi = multadd(C, mhi, 10, 0); else { mlo = multadd(C, mlo, 10, 0); mhi = multadd(C, mhi, 10, 0); } } } else for(i = 1;; i++) { *s++ = dig = quorem(C, b,S) + '0'; if (!b->x[0] && b->wds <= 1) { #ifdef SET_INEXACT inexact = 0; #endif goto ret; } if (i >= ilim) break; b = multadd(C, b, 10, 0); } /* Round off last digit */ #ifdef Honor_FLT_ROUNDS switch(Rounding) { case 0: goto trimzeros; case 2: goto roundoff; } #endif b = lshift(C, b, 1); j = cmp(C, b, S); #ifdef ROUND_BIASED if (j >= 0) #else if (j > 0 || (j == 0 && dig & 1)) #endif { roundoff: while(*--s == '9') if (s == s0) { k++; *s++ = '1'; goto ret; } ++*s++; } else { #ifdef Honor_FLT_ROUNDS trimzeros: #endif while(*--s == '0'); s++; } ret: Bfree(C, S); if (mhi) { if (mlo && mlo != mhi) Bfree(C, mlo); Bfree(C, mhi); } ret1: #ifdef SET_INEXACT if (inexact) { if (!oldinexact) { word0(&u) = Exp_1 + (70 << Exp_shift); word1(&u) = 0; dval(&u) += 1.; } } else if (!oldinexact) clear_inexact(); #endif Bfree(C, b); *s = 0; *decpt = k + 1; if (rve) *rve = s; return s0; } #ifdef __cplusplus } #endif /**************************************************************** * * The author of this software is David M. Gay. * * Copyright (c) 1991, 1996 by Lucent Technologies. * * Permission to use, copy, modify, and distribute this software for any * purpose without fee is hereby granted, provided that this entire notice * is included in all copies of any software which is or includes a copy * or modification of this software and in all copies of the supporting * documentation for such software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. * ***************************************************************/ /* g_fmt(buf,x) stores the closest decimal approximation to x in buf; * it suffices to declare buf * char buf[32]; */ char * jvp_dtoa_fmt(struct dtoa_context* C, register char *b, double x) { register int i, k; register char *s; int decpt, j, sign; char *b0, *s0, *se; b0 = b; #ifdef IGNORE_ZERO_SIGN if (!x) { *b++ = '0'; *b = 0; goto done; } #endif s = s0 = jvp_dtoa(C, x, 0, 0, &decpt, &sign, &se); if (sign) *b++ = '-'; if (decpt == 9999) /* Infinity or Nan */ { while((*b++ = *s++)); goto done0; } if (decpt <= -4 || decpt > se - s + 15) { *b++ = *s++; if (*s) { *b++ = '.'; while((*b = *s++)) b++; } *b++ = 'e'; /* sprintf(b, "%+.2d", decpt - 1); */ if (--decpt < 0) { *b++ = '-'; decpt = -decpt; } else *b++ = '+'; for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10); for(;;) { i = decpt / k; *b++ = i + '0'; if (--j <= 0) break; decpt -= i*k; decpt *= 10; } *b = 0; } else if (decpt <= 0) { *b++ = '0'; *b++ = '.'; for(; decpt < 0; decpt++) *b++ = '0'; while((*b++ = *s++)); } else { while((*b = *s++)) { b++; if (--decpt == 0 && *s) *b++ = '.'; } for(; decpt > 0; decpt--) *b++ = '0'; *b = 0; } done0: jvp_freedtoa(C, s0); goto done; done: return b0; } jq-1.8.2/src/jv_unicode.h0000644000175100017510000000067715215513536010724 #ifndef JV_UNICODE_H #define JV_UNICODE_H const char* jvp_utf8_backtrack(const char* start, const char* min, int *missing_bytes); const char* jvp_utf8_next(const char* in, const char* end, int* codepoint); int jvp_utf8_is_valid(const char* in, const char* end); int jvp_utf8_decode_length(char startchar); int jvp_utf8_encode_length(int codepoint); int jvp_utf8_encode(int codepoint, char* out); int jvp_codepoint_is_whitespace(int c); #endif jq-1.8.2/src/libm.h0000644000175100017510000000755515215513536007524 #ifdef HAVE_ACOS LIBM_DD(acos) #else LIBM_DD_NO(acos) #endif #ifdef HAVE_ACOSH LIBM_DD(acosh) #else LIBM_DD_NO(acosh) #endif #ifdef HAVE_ASIN LIBM_DD(asin) #else LIBM_DD_NO(asin) #endif #ifdef HAVE_ASINH LIBM_DD(asinh) #else LIBM_DD_NO(asinh) #endif #ifdef HAVE_ATAN LIBM_DD(atan) #else LIBM_DD_NO(atan) #endif #ifdef HAVE_ATAN2 LIBM_DDD(atan2) #else LIBM_DDD_NO(atan2) #endif #ifdef HAVE_ATANH LIBM_DD(atanh) #else LIBM_DD_NO(atanh) #endif #ifdef HAVE_CBRT LIBM_DD(cbrt) #else LIBM_DD_NO(cbrt) #endif #ifdef HAVE_COS LIBM_DD(cos) #else LIBM_DD_NO(cos) #endif #ifdef HAVE_COSH LIBM_DD(cosh) #else LIBM_DD_NO(cosh) #endif #ifdef HAVE_EXP LIBM_DD(exp) #else LIBM_DD_NO(exp) #endif #ifdef HAVE_EXP2 LIBM_DD(exp2) #else LIBM_DD_NO(exp2) #endif #ifdef HAVE_FLOOR LIBM_DD(floor) #else LIBM_DD_NO(floor) #endif #ifdef HAVE_HYPOT LIBM_DDD(hypot) #else LIBM_DDD_NO(hypot) #endif #ifdef HAVE_J0 LIBM_DD(j0) #else LIBM_DD_NO(j0) #endif #ifdef HAVE_J1 LIBM_DD(j1) #else LIBM_DD_NO(j1) #endif #ifdef HAVE_LOG LIBM_DD(log) #else LIBM_DD_NO(log) #endif #ifdef HAVE_LOG10 LIBM_DD(log10) #else LIBM_DD_NO(log10) #endif #ifdef HAVE_LOG2 LIBM_DD(log2) #else LIBM_DD_NO(log2) #endif #ifdef HAVE_POW LIBM_DDD(pow) #else LIBM_DDD_NO(pow) #endif #ifdef HAVE_REMAINDER LIBM_DDD(remainder) #else LIBM_DDD_NO(remainder) #endif #ifdef HAVE_SIN LIBM_DD(sin) #else LIBM_DD_NO(sin) #endif #ifdef HAVE_SINH LIBM_DD(sinh) #else LIBM_DD_NO(sinh) #endif #ifdef HAVE_SQRT LIBM_DD(sqrt) #else LIBM_DD_NO(sqrt) #endif #ifdef HAVE_TAN LIBM_DD(tan) #else LIBM_DD_NO(tan) #endif #ifdef HAVE_TANH LIBM_DD(tanh) #else LIBM_DD_NO(tanh) #endif #ifdef HAVE_TGAMMA LIBM_DD(tgamma) #else LIBM_DD_NO(tgamma) #endif #ifdef HAVE_Y0 LIBM_DD(y0) #else LIBM_DD_NO(y0) #endif #ifdef HAVE_Y1 LIBM_DD(y1) #else LIBM_DD_NO(y1) #endif #ifdef HAVE_JN LIBM_DDD(jn) #endif #ifdef HAVE_YN LIBM_DDD(yn) #endif #ifdef HAVE_CEIL LIBM_DD(ceil) #else LIBM_DD_NO(ceil) #endif #ifdef HAVE_COPYSIGN LIBM_DDD(copysign) #else LIBM_DDD_NO(copysign) #endif #if defined(HAVE_DREM) && !defined(WIN32) LIBM_DDD(drem) #else LIBM_DDD_NO(drem) #endif #ifdef HAVE_ERF LIBM_DD(erf) #else LIBM_DD_NO(erf) #endif #ifdef HAVE_ERFC LIBM_DD(erfc) #else LIBM_DD_NO(erfc) #endif #if defined(HAVE_EXP10) && !defined(WIN32) LIBM_DD(exp10) #else LIBM_DD_NO(exp10) #endif #ifdef HAVE_EXPM1 LIBM_DD(expm1) #else LIBM_DD_NO(expm1) #endif #ifdef HAVE_FABS LIBM_DD(fabs) #else LIBM_DD_NO(fabs) #endif #ifdef HAVE_FDIM LIBM_DDD(fdim) #else LIBM_DDD_NO(fdim) #endif #ifdef HAVE_FMA LIBM_DDDD(fma) #else LIBM_DDDD_NO(fma) #endif #ifdef HAVE_FMAX LIBM_DDD(fmax) #else LIBM_DDD_NO(fmax) #endif #ifdef HAVE_FMIN LIBM_DDD(fmin) #else LIBM_DDD_NO(fmin) #endif #ifdef HAVE_FMOD LIBM_DDD(fmod) #else LIBM_DDD_NO(fmod) #endif #if defined(HAVE_GAMMA) LIBM_DD(gamma) #else LIBM_DD_NO(gamma) #endif #ifdef HAVE_LGAMMA LIBM_DD(lgamma) #else LIBM_DD_NO(lgamma) #endif #ifdef HAVE_LOG1P LIBM_DD(log1p) #else LIBM_DD_NO(log1p) #endif #ifdef HAVE_LOGB LIBM_DD(logb) #else LIBM_DD_NO(logb) #endif #ifdef HAVE_NEARBYINT LIBM_DD(nearbyint) #else LIBM_DD_NO(nearbyint) #endif #ifdef HAVE_NEXTAFTER LIBM_DDD(nextafter) #else LIBM_DDD_NO(nextafter) #endif #ifdef HAVE_NEXTTOWARD LIBM_DDD(nexttoward) #else LIBM_DDD_NO(nexttoward) #endif #ifdef HAVE_RINT LIBM_DD(rint) #else LIBM_DD_NO(rint) #endif #ifdef HAVE_ROUND LIBM_DD(round) #else LIBM_DD_NO(round) #endif #ifdef HAVE_SCALB LIBM_DDD(scalb) #else LIBM_DDD_NO(scalb) #endif #ifdef HAVE_SCALBLN LIBM_DDD(scalbln) #else LIBM_DDD_NO(scalbln) #endif #if defined(HAVE_SIGNIFICAND) && !defined(WIN32) LIBM_DD(significand) #else LIBM_DD_NO(significand) #endif #ifdef HAVE_TRUNC LIBM_DD(trunc) #else LIBM_DD_NO(trunc) #endif #ifdef HAVE_LDEXP LIBM_DDD(ldexp) #else LIBM_DDD_NO(ldexp) #endif #ifdef HAVE_MODF LIBM_DA(modf, double) #else LIBM_DA_NO(modf, double) #endif #ifdef HAVE_FREXP LIBM_DA(frexp, int) #else LIBM_DA_NO(frexp, int) #endif #ifdef HAVE_LGAMMA_R LIBM_DA(lgamma_r, int) #else LIBM_DA_NO(lgamma_r, int) #endif jq-1.8.2/src/bytecode.h0000644000175100017510000000333315215513536010365 #ifndef BYTECODE_H #define BYTECODE_H #include #include "jq.h" typedef enum { #define OP(name, imm, in, out) name, #include "opcode_list.h" #undef OP } opcode; enum { NUM_OPCODES = #define OP(name, imm, in, out) +1 #include "opcode_list.h" #undef OP }; enum { OP_HAS_CONSTANT = 2, OP_HAS_VARIABLE = 4, OP_HAS_BRANCH = 8, OP_HAS_CFUNC = 32, OP_HAS_UFUNC = 64, OP_IS_CALL_PSEUDO = 128, OP_HAS_BINDING = 1024, // NOTE: Not actually part of any op -- a pseudo-op flag for special // handling of `break`. OP_BIND_WILDCARD = 2048, }; struct opcode_description { opcode op; const char* name; int flags; // length in 16-bit units int length; int stack_in, stack_out; }; const struct opcode_description* opcode_describe(opcode op); #define MAX_CFUNCTION_ARGS 4 struct cfunction { union { jv (*a1)(jq_state *, jv); jv (*a2)(jq_state *, jv, jv); jv (*a3)(jq_state *, jv, jv, jv); jv (*a4)(jq_state *, jv, jv, jv, jv); } fptr; const char* name; int nargs; }; struct symbol_table { struct cfunction* cfunctions; int ncfunctions; jv cfunc_names; }; // The bytecode format matters in: // execute.c - interpreter // compile.c - compiler // bytecode.c - disassembler #define ARG_NEWCLOSURE 0x1000 struct bytecode { uint16_t* code; int codelen; int nlocals; int nclosures; jv constants; // JSON array of constants struct symbol_table* globals; struct bytecode** subfunctions; int nsubfunctions; struct bytecode* parent; jv debuginfo; }; void dump_disassembly(int, struct bytecode* code); void dump_operation(struct bytecode* bc, uint16_t* op); int bytecode_operation_length(uint16_t* codeptr); void bytecode_free(struct bytecode* bc); #endif jq-1.8.2/src/jv_unicode.c0000644000175100017510000001117715215513536010714 #include #include #include "jv_unicode.h" #include "jv_utf8_tables.h" // jvp_utf8_backtrack returns the beginning of the last codepoint in the // string, assuming that start is the last byte in the string. // If the last codepoint is incomplete, returns the number of missing bytes via // *missing_bytes. If there are no leading bytes or an invalid byte is // encountered, NULL is returned and *missing_bytes is not altered. const char* jvp_utf8_backtrack(const char* start, const char* min, int *missing_bytes) { assert(min <= start); if (min == start) { return min; } int length = 0; int seen = 1; while ((length = utf8_coding_length[(unsigned char)*start]) == UTF8_CONTINUATION_BYTE) { if (start == min) break; start--; seen++; } if (length == 0 || length == UTF8_CONTINUATION_BYTE || length - seen < 0) { return NULL; } if (missing_bytes) *missing_bytes = length - seen; return start; } const char* jvp_utf8_next(const char* in, const char* end, int* codepoint_ret) { assert(in <= end); if (in == end) { return 0; } int codepoint = -1; unsigned char first = (unsigned char)in[0]; int length = utf8_coding_length[first]; if ((first & 0x80) == 0) { /* Fast-path for ASCII */ codepoint = first; length = 1; } else if (length == 0 || length == UTF8_CONTINUATION_BYTE) { /* Bad single byte - either an invalid byte or an out-of-place continuation byte */ length = 1; } else if (length > end - in) { /* String ends before UTF8 sequence ends */ length = end - in; } else { codepoint = ((unsigned)in[0]) & utf8_coding_bits[first]; for (int i=1; i 0x10FFFF) { /* Outside Unicode range */ codepoint = -1; } } assert(length > 0); *codepoint_ret = codepoint; return in + length; } int jvp_utf8_is_valid(const char* in, const char* end) { int codepoint; while ((in = jvp_utf8_next(in, end, &codepoint))) { if (codepoint == -1) return 0; } return 1; } /* Assumes startchar is the first byte of a valid character sequence */ int jvp_utf8_decode_length(char startchar) { if ((startchar & 0x80) == 0) return 1; // 0___ ____ else if ((startchar & 0xE0) == 0xC0) return 2; // 110_ ____ else if ((startchar & 0xF0) == 0xE0) return 3; // 1110 ____ else return 4; // 1111 ____ } int jvp_utf8_encode_length(int codepoint) { if (codepoint <= 0x7F) return 1; else if (codepoint <= 0x7FF) return 2; else if (codepoint <= 0xFFFF) return 3; else return 4; } int jvp_utf8_encode(int codepoint, char* out) { assert(codepoint >= 0 && codepoint <= 0x10FFFF); char* start = out; if (codepoint <= 0x7F) { *out++ = codepoint; } else if (codepoint <= 0x7FF) { *out++ = 0xC0 + ((codepoint & 0x7C0) >> 6); *out++ = 0x80 + ((codepoint & 0x03F)); } else if(codepoint <= 0xFFFF) { *out++ = 0xE0 + ((codepoint & 0xF000) >> 12); *out++ = 0x80 + ((codepoint & 0x0FC0) >> 6); *out++ = 0x80 + ((codepoint & 0x003F)); } else { *out++ = 0xF0 + ((codepoint & 0x1C0000) >> 18); *out++ = 0x80 + ((codepoint & 0x03F000) >> 12); *out++ = 0x80 + ((codepoint & 0x000FC0) >> 6); *out++ = 0x80 + ((codepoint & 0x00003F)); } assert(out - start == jvp_utf8_encode_length(codepoint)); return out - start; } // characters with White_Space property in: // https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt int jvp_codepoint_is_whitespace(int c) { return (c >= 0x0009 && c <= 0x000D) || // .. c == 0x0020 || // SPACE c == 0x0085 || // c == 0x00A0 || // NO-BREAK SPACE c == 0x1680 || // OGHAM SPACE MARK (c >= 0x2000 && c <= 0x200A) || // EN QUAD..HAIR SPACE c == 0x2028 || // LINE SEPARATOR c == 0x2029 || // PARAGRAPH SEPARATOR c == 0x202F || // NARROW NO-BREAK SPACE c == 0x205F || // MEDIUM MATHEMATICAL SPACE c == 0x3000 // IDEOGRAPHIC SPACE ; } jq-1.8.2/src/jv_print.c0000644000175100017510000003147015215513536010420 #include #include #include #include #ifdef WIN32 #include #include #include #endif #include "jv.h" #include "jv_dtoa.h" #include "jv_dtoa_tsd.h" #include "jv_unicode.h" #include "jv_alloc.h" #include "jv_private.h" #include "util.h" #ifndef MAX_PRINT_DEPTH #define MAX_PRINT_DEPTH (10000) #endif #define ESC "\033" #define COL(c) (ESC "[" c "m") #define COLRESET (ESC "[0m") // Color table. See https://en.wikipedia.org/wiki/ANSI_escape_code#Colors // for how to choose these. The order is same as jv_kind definition, and // the last color is used for object keys. #define DEFAULT_COLORS \ {COL("0;90"), COL("0;39"), COL("0;39"), COL("0;39"),\ COL("0;32"), COL("1;39"), COL("1;39"), COL("1;34")}; static const char *const default_colors[] = DEFAULT_COLORS; static const char *colors[] = DEFAULT_COLORS; #define COLORS_LEN (sizeof(colors) / sizeof(colors[0])) #define FIELD_COLOR (colors[7]) static char *colors_buf = NULL; int jq_set_colors(const char *code_str) { if (code_str == NULL) return 1; // the start of each color code in the env var, and the byte after the end of the last one const char *codes[COLORS_LEN + 1]; size_t num_colors; // must be initialized before `goto default_colors`, used later to loop over every color size_t ci = 0; for (num_colors = 0;; num_colors++) { codes[num_colors] = code_str; code_str += strspn(code_str, "0123456789;"); if (code_str[0] == '\0' || num_colors + 1 >= COLORS_LEN) { break; } else if (code_str[0] != ':') { return 0; // invalid character } code_str++; } if (codes[num_colors] != code_str) { // count the last color and store its end (plus one byte for consistency with starts) // an empty last color would be ignored (for cases like "" and "0:") num_colors++; codes[num_colors] = code_str + 1; } else if (num_colors == 0) { if (colors_buf != NULL) { jv_mem_free(colors_buf); colors_buf = NULL; } goto default_colors; } colors_buf = jv_mem_realloc( colors_buf, // add ESC '[' 'm' to each string // '\0' is already included in difference of codes codes[num_colors] - codes[0] + 3 * num_colors ); char *cb = colors_buf; for (; ci < num_colors; ci++) { colors[ci] = cb; size_t len = codes[ci + 1] - 1 - codes[ci]; cb[0] = ESC[0]; cb[1] = '['; memcpy(cb + 2, codes[ci], len); cb[2 + len] = 'm'; cb[3 + len] = '\0'; cb += len + 4; } default_colors: for (; ci < COLORS_LEN; ci++) colors[ci] = default_colors[ci]; return 1; } static void put_buf(const char *s, int len, FILE *fout, jv *strout, int is_tty) { if (strout) { *strout = jv_string_append_buf(*strout, s, len); } else { #ifdef WIN32 /* See util.h */ if (is_tty) { wchar_t *ws; size_t wl; if (len == -1) len = strlen(s); wl = MultiByteToWideChar(CP_UTF8, 0, s, len, NULL, 0); ws = jv_mem_calloc(wl + 1, sizeof(*ws)); if (!ws) return; wl = MultiByteToWideChar(CP_UTF8, 0, s, len, ws, wl + 1); ws[wl] = 0; WriteConsoleW((HANDLE)_get_osfhandle(fileno(fout)), ws, wl, NULL, NULL); free(ws); } else fwrite(s, 1, len, fout); #else fwrite(s, 1, len, fout); #endif } } static void put_char(char c, FILE* fout, jv* strout, int T) { put_buf(&c, 1, fout, strout, T); } static void put_str(const char* s, FILE* fout, jv* strout, int T) { put_buf(s, strlen(s), fout, strout, T); } static void put_indent(int n, int flags, FILE* fout, jv* strout, int T) { if (flags & JV_PRINT_TAB) { while (n--) put_char('\t', fout, strout, T); } else { n *= ((flags & (JV_PRINT_SPACE0 | JV_PRINT_SPACE1 | JV_PRINT_SPACE2)) >> 8); while (n--) put_char(' ', fout, strout, T); } } static void jvp_dump_string(jv str, int ascii_only, FILE* F, jv* S, int T) { assert(jv_get_kind(str) == JV_KIND_STRING); const char* i = jv_string_value(str); const char* end = i + jv_string_length_bytes(jv_copy(str)); const char* cstart; int c = 0; char buf[32]; put_char('"', F, S, T); while ((i = jvp_utf8_next((cstart = i), end, &c))) { assert(c != -1); int unicode_escape = 0; if (0x20 <= c && c <= 0x7E) { // printable ASCII if (c == '"' || c == '\\') { put_char('\\', F, S, T); } put_char(c, F, S, T); } else if (c < 0x20 || c == 0x7F) { // ASCII control character switch (c) { case '\b': put_char('\\', F, S, T); put_char('b', F, S, T); break; case '\t': put_char('\\', F, S, T); put_char('t', F, S, T); break; case '\r': put_char('\\', F, S, T); put_char('r', F, S, T); break; case '\n': put_char('\\', F, S, T); put_char('n', F, S, T); break; case '\f': put_char('\\', F, S, T); put_char('f', F, S, T); break; default: unicode_escape = 1; break; } } else { if (ascii_only) { unicode_escape = 1; } else { put_buf(cstart, i - cstart, F, S, T); } } if (unicode_escape) { if (c <= 0xffff) { snprintf(buf, sizeof(buf), "\\u%04x", c); } else { c -= 0x10000; snprintf(buf, sizeof(buf), "\\u%04x\\u%04x", 0xD800 | ((c & 0xffc00) >> 10), 0xDC00 | (c & 0x003ff)); } put_str(buf, F, S, T); } } assert(c != -1); put_char('"', F, S, T); } static void put_refcnt(struct dtoa_context* C, int refcnt, FILE *F, jv* S, int T){ char buf[JVP_DTOA_FMT_MAX_LEN]; put_char(' ', F, S, T); put_char('(', F, S, T); put_str(jvp_dtoa_fmt(C, buf, refcnt), F, S, T); put_char(')', F, S, T); } static void jv_dump_term(struct dtoa_context* C, jv x, int flags, int indent, FILE* F, jv* S) { char buf[JVP_DTOA_FMT_MAX_LEN]; const char* color = 0; double refcnt = (flags & JV_PRINT_REFCOUNT) ? jv_get_refcnt(x) - 1 : -1; if ((flags & JV_PRINT_COLOR) && jv_get_kind(x) != JV_KIND_INVALID) { color = colors[(int)jv_get_kind(x) - 1]; put_str(color, F, S, flags & JV_PRINT_ISATTY); } if (indent > MAX_PRINT_DEPTH) { put_str("", F, S, flags & JV_PRINT_ISATTY); } else switch (jv_get_kind(x)) { default: case JV_KIND_INVALID: if (flags & JV_PRINT_INVALID) { jv msg = jv_invalid_get_msg(jv_copy(x)); if (jv_get_kind(msg) == JV_KIND_STRING) { put_str("', F, S, flags & JV_PRINT_ISATTY); } else { put_str("", F, S, flags & JV_PRINT_ISATTY); } } else { assert(0 && "Invalid value"); } break; case JV_KIND_NULL: put_str("null", F, S, flags & JV_PRINT_ISATTY); break; case JV_KIND_FALSE: put_str("false", F, S, flags & JV_PRINT_ISATTY); break; case JV_KIND_TRUE: put_str("true", F, S, flags & JV_PRINT_ISATTY); break; case JV_KIND_NUMBER: { if (jvp_number_is_nan(x)) { jv_dump_term(C, jv_null(), flags, indent, F, S); } else { #ifdef USE_DECNUM const char * literal_data = jv_number_get_literal(x); if (literal_data) { put_str(literal_data, F, S, flags & JV_PRINT_ISATTY); } else { #endif double d = jv_number_value(x); if (d != d) { // JSON doesn't have NaN, so we'll render it as "null" put_str("null", F, S, flags & JV_PRINT_ISATTY); } else { // Normalise infinities to something we can print in valid JSON if (d > DBL_MAX) d = DBL_MAX; if (d < -DBL_MAX) d = -DBL_MAX; put_str(jvp_dtoa_fmt(C, buf, d), F, S, flags & JV_PRINT_ISATTY); } } #ifdef USE_DECNUM } #endif break; } case JV_KIND_STRING: jvp_dump_string(x, flags & JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY); if (flags & JV_PRINT_REFCOUNT) put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY); break; case JV_KIND_ARRAY: { if (jv_array_length(jv_copy(x)) == 0) { put_str("[]", F, S, flags & JV_PRINT_ISATTY); break; } put_char('[', F, S, flags & JV_PRINT_ISATTY); jv_array_foreach(x, i, elem) { if (i!=0) { if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY); put_char(',', F, S, flags & JV_PRINT_ISATTY); } if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY); if (flags & JV_PRINT_PRETTY) { put_char('\n', F, S, flags & JV_PRINT_ISATTY); put_indent(indent + 1, flags, F, S, flags & JV_PRINT_ISATTY); } jv_dump_term(C, elem, flags, indent + 1, F, S); } if (flags & JV_PRINT_PRETTY) { put_char('\n', F, S, flags & JV_PRINT_ISATTY); put_indent(indent, flags, F, S, flags & JV_PRINT_ISATTY); } if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY); put_char(']', F, S, flags & JV_PRINT_ISATTY); if (flags & JV_PRINT_REFCOUNT) put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY); break; } case JV_KIND_OBJECT: { if (jv_object_length(jv_copy(x)) == 0) { put_str("{}", F, S, flags & JV_PRINT_ISATTY); break; } put_char('{', F, S, flags & JV_PRINT_ISATTY); int first = 1; int i = 0; jv keyset = jv_null(); while (1) { jv key, value; if (flags & JV_PRINT_SORTED) { if (first) { keyset = jv_keys(jv_copy(x)); i = 0; } else { i++; } if (i >= jv_array_length(jv_copy(keyset))) { jv_free(keyset); break; } key = jv_array_get(jv_copy(keyset), i); value = jv_object_get(jv_copy(x), jv_copy(key)); } else { if (first) { i = jv_object_iter(x); } else { i = jv_object_iter_next(x, i); } if (!jv_object_iter_valid(x, i)) break; key = jv_object_iter_key(x, i); value = jv_object_iter_value(x, i); } if (!first) { if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY); put_char(',', F, S, flags & JV_PRINT_ISATTY); } if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY); if (flags & JV_PRINT_PRETTY) { put_char('\n', F, S, flags & JV_PRINT_ISATTY); put_indent(indent + 1, flags, F, S, flags & JV_PRINT_ISATTY); } first = 0; if (color) put_str(FIELD_COLOR, F, S, flags & JV_PRINT_ISATTY); jvp_dump_string(key, flags & JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY); jv_free(key); if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY); if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY); put_char(':', F, S, flags & JV_PRINT_ISATTY); if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY); if (flags & JV_PRINT_PRETTY) { put_char(' ', F, S, flags & JV_PRINT_ISATTY); } jv_dump_term(C, value, flags, indent + 1, F, S); } if (flags & JV_PRINT_PRETTY) { put_char('\n', F, S, flags & JV_PRINT_ISATTY); put_indent(indent, flags, F, S, flags & JV_PRINT_ISATTY); } if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY); put_char('}', F, S, flags & JV_PRINT_ISATTY); if (flags & JV_PRINT_REFCOUNT) put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY); } } jv_free(x); if (color) { put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY); } } void jv_dumpf(jv x, FILE *f, int flags) { jv_dump_term(tsd_dtoa_context_get(), x, flags, 0, f, 0); } void jv_dump(jv x, int flags) { jv_dumpf(x, stdout, flags); } /* This one is nice for use in debuggers */ void jv_show(jv x, int flags) { if (flags == -1) flags = JV_PRINT_PRETTY | JV_PRINT_COLOR | JV_PRINT_INDENT_FLAGS(2); jv_dumpf(jv_copy(x), stderr, flags | JV_PRINT_INVALID); fflush(stderr); } jv jv_dump_string(jv x, int flags) { jv s = jv_string(""); jv_dump_term(tsd_dtoa_context_get(), x, flags, 0, 0, &s); return s; } char *jv_dump_string_trunc(jv x, char *outbuf, size_t bufsize) { assert(bufsize > 0); if (jv_get_kind(x) == JV_KIND_STRING && (size_t)jv_string_length_bytes(jv_copy(x)) > bufsize) { x = jv_string_slice(x, 0, bufsize); } x = jv_dump_string(x, 0); const char *str = jv_string_value(x); const size_t len = strlen(str); if (len > bufsize - 1 && bufsize >= 8) { char delim = 0; switch (str[0]) { case '"': delim = '"'; break; case '[': delim = ']'; break; case '{': delim = '}'; break; } size_t l = bufsize - (delim ? 5 : 4); // "...", delim (if any), '\0' const char *s = jvp_utf8_backtrack(str + l, str, NULL); if (s) l = s - str; memcpy(outbuf, str, l); outbuf[l++] = '.'; outbuf[l++] = '.'; outbuf[l++] = '.'; if (delim) outbuf[l++] = delim; outbuf[l] = '\0'; } else { size_t l = MIN(len, bufsize - 1); memcpy(outbuf, str, l); outbuf[l] = '\0'; } jv_free(x); return outbuf; } jq-1.8.2/src/locfile.h0000644000175100017510000000110215215513536010174 #ifndef LOCFILE_H #define LOCFILE_H #include "jq.h" typedef struct { int start, end; } location; static const location UNKNOWN_LOCATION = {-1, -1}; struct locfile { jv fname; const char* data; int length; int* linemap; int nlines; char *error; jq_state *jq; int refct; }; struct locfile* locfile_init(jq_state *, const char *, const char *, int); struct locfile* locfile_retain(struct locfile *); int locfile_get_line(struct locfile *, int); void locfile_free(struct locfile *); void locfile_locate(struct locfile *, location, const char *, ...); #endif jq-1.8.2/src/main.c0000644000175100017510000006461215215513536007515 #include #include #include #include #ifdef HAVE_SETLOCALE #include #endif #include #include #include #include #ifdef WIN32 #include #include #include #include #include #include #include extern void jv_tsd_dtoa_ctx_init(); #endif #ifdef HAVE_LIBONIG #include #endif #if !defined(HAVE_ISATTY) && defined(HAVE__ISATTY) #undef isatty #define isatty _isatty #endif #if defined(HAVE_ISATTY) || defined(HAVE__ISATTY) #define USE_ISATTY #endif #include "jv.h" #include "jq.h" #include "util.h" #include "src/version.h" #include "src/config_opts.inc" int jq_testsuite(jv lib_dirs, int verbose, int argc, char* argv[]); /* * For a longer help message we could use a better option parsing * strategy, one that lets stack options. */ static void usage(int code, int keep_it_short) { FILE *f = stderr; if (code == 0) f = stdout; int ret = fprintf(f, "jq - commandline JSON processor [version %s]\n" "\nUsage:\tjq [options] [file...]\n" "\tjq [options] --args [strings...]\n" "\tjq [options] --jsonargs [JSON_TEXTS...]\n\n" "jq is a tool for processing JSON inputs, applying the given filter to\n" "its JSON text inputs and producing the filter's results as JSON on\n" "standard output.\n\n" "The simplest filter is ., which copies jq's input to its output\n" "unmodified except for formatting. For more advanced filters see\n" "the jq(1) manpage (\"man jq\") and/or https://jqlang.org/.\n\n" "Example:\n\n\t$ echo '{\"foo\": 0}' | jq .\n" "\t{\n\t \"foo\": 0\n\t}\n\n", JQ_VERSION); if (keep_it_short) { fprintf(f, "For listing the command options, use jq --help.\n"); } else { (void) fprintf(f, "Command options:\n" " -n, --null-input use `null` as the single input value;\n" " -R, --raw-input read each line as string instead of JSON;\n" " -s, --slurp read all inputs into an array and use it as\n" " the single input value;\n" " -c, --compact-output compact instead of pretty-printed output;\n" " -r, --raw-output output strings without escapes and quotes;\n" " --raw-output0 implies -r and output NUL after each output;\n" " -j, --join-output implies -r and output without newline after\n" " each output;\n" " -a, --ascii-output output strings by only ASCII characters\n" " using escape sequences;\n" " -S, --sort-keys sort keys of each object on output;\n" " -C, --color-output colorize JSON output;\n" " -M, --monochrome-output disable colored output;\n" " --tab use tabs for indentation;\n" " --indent n use n spaces for indentation (max 7 spaces);\n" " --unbuffered flush output stream after each output;\n" " --stream parse the input value in streaming fashion;\n" " --stream-errors implies --stream and report parse error as\n" " an array;\n" " --seq parse input/output as application/json-seq;\n" " -f, --from-file load the filter from a file;\n" " -L, --library-path dir search modules from the directory;\n" " --arg name value set $name to the string value;\n" " --argjson name value set $name to the JSON value;\n" " --slurpfile name file set $name to an array of JSON values read\n" " from the file;\n" " --rawfile name file set $name to string contents of file;\n" " --args consume remaining arguments as positional\n" " string values;\n" " --jsonargs consume remaining arguments as positional\n" " JSON values;\n" " -e, --exit-status set exit status code based on the output;\n" #ifdef WIN32 " -b, --binary open input/output streams in binary mode;\n" #endif " -V, --version show the version;\n" " --build-configuration show jq's build configuration;\n" " -h, --help show the help;\n" " -- terminates argument processing;\n\n" "Named arguments are also available as $ARGS.named[], while\n" "positional arguments are available as $ARGS.positional[].\n"); } exit((ret < 0 && code == 0) ? 2 : code); } static void die(void) { fprintf(stderr, "Use jq --help for help with command-line options,\n"); fprintf(stderr, "or see the jq manpage, or online docs at https://jqlang.org\n"); exit(2); } static int isoptish(const char* text) { return text[0] == '-' && (text[1] == '-' || isalpha((unsigned char)text[1])); } static int isoption(const char** text, char shortopt, const char* longopt, int is_short) { if (is_short) { if (shortopt && **text == shortopt) { (*text)++; if (!**text) *text = NULL; return 1; } } else { if (!strcmp(*text, longopt)) { *text = NULL; return 1; } } return 0; } enum { SLURP = 1, RAW_INPUT = 2, PROVIDE_NULL = 4, RAW_OUTPUT = 8, RAW_OUTPUT0 = 16, ASCII_OUTPUT = 32, COLOR_OUTPUT = 64, NO_COLOR_OUTPUT = 128, SORTED_OUTPUT = 256, FROM_FILE = 512, RAW_NO_LF = 1024, UNBUFFERED_OUTPUT = 2048, EXIT_STATUS = 4096, SEQ = 16384, /* debugging only */ DUMP_DISASM = 32768, }; enum { JQ_OK = 0, JQ_OK_NULL_KIND = -1, /* exit 0 if --exit-status is not set*/ JQ_ERROR_SYSTEM = 2, JQ_ERROR_COMPILE = 3, JQ_OK_NO_OUTPUT = -4, /* exit 0 if --exit-status is not set*/ JQ_ERROR_UNKNOWN = 5, }; #define jq_exit_with_status(r) exit(abs(r)) #define jq_exit(r) exit( r > 0 ? r : 0 ) static int process(jq_state *jq, jv value, int flags, int dumpopts, int options) { int ret = JQ_OK_NO_OUTPUT; // No valid results && -e -> exit(4) jq_start(jq, value, flags); jv result; while (jv_is_valid(result = jq_next(jq))) { if ((options & RAW_OUTPUT) && jv_get_kind(result) == JV_KIND_STRING) { if (options & ASCII_OUTPUT) { jv_dumpf(jv_copy(result), stdout, JV_PRINT_ASCII); } else if ((options & RAW_OUTPUT0) && strlen(jv_string_value(result)) != (unsigned long)jv_string_length_bytes(jv_copy(result))) { jv_free(result); result = jv_invalid_with_msg(jv_string( "Cannot dump a string containing NUL with --raw-output0 option")); break; } else { priv_fwrite(jv_string_value(result), jv_string_length_bytes(jv_copy(result)), stdout, dumpopts & JV_PRINT_ISATTY); } ret = JQ_OK; jv_free(result); } else { if (jv_get_kind(result) == JV_KIND_FALSE || jv_get_kind(result) == JV_KIND_NULL) ret = JQ_OK_NULL_KIND; else ret = JQ_OK; if (options & SEQ) priv_fwrite("\036", 1, stdout, dumpopts & JV_PRINT_ISATTY); jv_dump(result, dumpopts); } if (!(options & RAW_NO_LF)) priv_fwrite("\n", 1, stdout, dumpopts & JV_PRINT_ISATTY); if (options & RAW_OUTPUT0) priv_fwrite("\0", 1, stdout, dumpopts & JV_PRINT_ISATTY); if (options & UNBUFFERED_OUTPUT) fflush(stdout); } if (jq_halted(jq)) { // jq program invoked `halt` or `halt_error` jv exit_code = jq_get_exit_code(jq); if (!jv_is_valid(exit_code)) ret = JQ_OK; else if (jv_get_kind(exit_code) == JV_KIND_NUMBER) ret = jv_number_value(exit_code); else ret = JQ_ERROR_UNKNOWN; jv_free(exit_code); jv error_message = jq_get_error_message(jq); if (jv_get_kind(error_message) == JV_KIND_STRING) { // No prefix should be added to the output of `halt_error`. priv_fwrite(jv_string_value(error_message), jv_string_length_bytes(jv_copy(error_message)), stderr, dumpopts & JV_PRINT_ISATTY); } else if (jv_get_kind(error_message) == JV_KIND_NULL) { // Halt with no output } else if (jv_is_valid(error_message)) { error_message = jv_dump_string(error_message, 0); fprintf(stderr, "%s\n", jv_string_value(error_message)); } // else no message on stderr; use --debug-trace to see a message fflush(stderr); jv_free(error_message); } else if (jv_invalid_has_msg(jv_copy(result))) { // Uncaught jq exception jv msg = jv_invalid_get_msg(jv_copy(result)); jv input_pos = jq_util_input_get_position(jq); if (jv_get_kind(msg) == JV_KIND_STRING) { fprintf(stderr, "jq: error (at %s): %s\n", jv_string_value(input_pos), jv_string_value(msg)); } else { msg = jv_dump_string(msg, 0); fprintf(stderr, "jq: error (at %s) (not a string): %s\n", jv_string_value(input_pos), jv_string_value(msg)); } ret = JQ_ERROR_UNKNOWN; jv_free(input_pos); jv_free(msg); } jv_free(result); return ret; } static void debug_cb(void *data, jv input) { int dumpopts = *(int *)data; jv_dumpf(JV_ARRAY(jv_string("DEBUG:"), input), stderr, dumpopts & ~(JV_PRINT_PRETTY)); fprintf(stderr, "\n"); } static void stderr_cb(void *data, jv input) { if (jv_get_kind(input) == JV_KIND_STRING) { int dumpopts = *(int *)data; priv_fwrite(jv_string_value(input), jv_string_length_bytes(jv_copy(input)), stderr, dumpopts & JV_PRINT_ISATTY); } else { input = jv_dump_string(input, 0); fprintf(stderr, "%s", jv_string_value(input)); } jv_free(input); } #ifdef WIN32 int umain(int argc, char* argv[]); int wmain(int argc, wchar_t* wargv[]) { size_t arg_sz; char **argv = alloca(argc * sizeof(wchar_t*)); for (int i = 0; i < argc; i++) { argv[i] = alloca((arg_sz = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, 0, 0, 0, 0))); WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, argv[i], arg_sz, 0, 0); } return umain(argc, argv); } int umain(int argc, char* argv[]) { #else /*}*/ int main(int argc, char* argv[]) { #endif jq_state *jq = NULL; jq_util_input_state *input_state = NULL; int ret = JQ_OK_NO_OUTPUT; int compiled = 0; int parser_flags = 0; int nfiles = 0; int last_result = -1; /* -1 = no result, 0=null or false, 1=true */ int badwrite; int options = 0; #ifdef HAVE_SETLOCALE (void) setlocale(LC_ALL, ""); #endif #ifdef HAVE_LIBONIG // use a lower regex parse depth limit than the default (4096) to protect // from stack-overflows // https://github.com/jqlang/jq/security/advisories/GHSA-f946-j5j2-4w5m onig_set_parse_depth_limit(1024); #endif #ifdef __OpenBSD__ if (pledge("stdio rpath", NULL) == -1) { perror("pledge"); exit(JQ_ERROR_SYSTEM); } #endif #ifdef WIN32 jv_tsd_dtoa_ctx_init(); fflush(stdout); fflush(stderr); _setmode(fileno(stdout), _O_TEXT | _O_U8TEXT); _setmode(fileno(stderr), _O_TEXT | _O_U8TEXT); #endif jv ARGS = jv_array(); /* positional arguments */ jv program_arguments = jv_object(); /* named arguments */ jq = jq_init(); if (jq == NULL) { perror("jq_init"); ret = JQ_ERROR_SYSTEM; goto out; } int dumpopts = JV_PRINT_INDENT_FLAGS(2); const char* program = 0; input_state = jq_util_input_init(NULL, NULL); // XXX add err_cb int further_args_are_strings = 0; int further_args_are_json = 0; int args_done = 0; int jq_flags = 0; jv lib_search_paths = jv_null(); for (int i=1; i= argc - 1) { fprintf(stderr, "-L takes a parameter: (e.g. -L /search/path or -L/search/path)\n"); die(); } else { lib_search_paths = jv_array_append(lib_search_paths, jq_realpath(jv_string(argv[i+1]))); i++; } } else if (isoption(&text, 'b', "binary", is_short)) { #ifdef WIN32 fflush(stdout); fflush(stderr); _setmode(fileno(stdin), _O_BINARY); _setmode(fileno(stdout), _O_BINARY); _setmode(fileno(stderr), _O_BINARY); #endif } else if (isoption(&text, 0, "tab", is_short)) { dumpopts &= ~JV_PRINT_INDENT_FLAGS(7); dumpopts |= JV_PRINT_TAB | JV_PRINT_PRETTY; } else if (isoption(&text, 0, "indent", is_short)) { if (i >= argc - 1) { fprintf(stderr, "jq: --indent takes one parameter\n"); die(); } char* end = NULL; errno = 0; long indent = strtol(argv[i+1], &end, 10); if (errno || indent < -1 || indent > 7 || isspace(*argv[i+1]) || end == argv[i+1] || *end) { fprintf(stderr, "jq: --indent takes a number between -1 and 7\n"); die(); } dumpopts &= ~(JV_PRINT_TAB | JV_PRINT_INDENT_FLAGS(7)); dumpopts |= JV_PRINT_INDENT_FLAGS(indent); i++; } else if (isoption(&text, 0, "seq", is_short)) { options |= SEQ; } else if (isoption(&text, 0, "stream", is_short)) { parser_flags |= JV_PARSE_STREAMING; } else if (isoption(&text, 0, "stream-errors", is_short)) { parser_flags |= JV_PARSE_STREAMING | JV_PARSE_STREAM_ERRORS; } else if (isoption(&text, 'e', "exit-status", is_short)) { options |= EXIT_STATUS; } else if (isoption(&text, 0, "args", is_short)) { further_args_are_strings = 1; further_args_are_json = 0; } else if (isoption(&text, 0, "jsonargs", is_short)) { further_args_are_strings = 0; further_args_are_json = 1; } else if (isoption(&text, 0, "arg", is_short)) { if (i >= argc - 2) { fprintf(stderr, "jq: --arg takes two parameters (e.g. --arg varname value)\n"); die(); } if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1]))) program_arguments = jv_object_set(program_arguments, jv_string(argv[i+1]), jv_string(argv[i+2])); i += 2; // skip the next two arguments } else if (isoption(&text, 0, "argjson", is_short)) { if (i >= argc - 2) { fprintf(stderr, "jq: --argjson takes two parameters (e.g. --argjson varname text)\n"); die(); } if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1]))) { jv v = jv_parse(argv[i+2]); if (!jv_is_valid(v)) { fprintf(stderr, "jq: invalid JSON text passed to --argjson\n"); die(); } program_arguments = jv_object_set(program_arguments, jv_string(argv[i+1]), v); } i += 2; // skip the next two arguments } else if ((raw = isoption(&text, 0, "rawfile", is_short)) || isoption(&text, 0, "slurpfile", is_short)) { const char *which = raw ? "rawfile" : "slurpfile"; if (i >= argc - 2) { fprintf(stderr, "jq: --%s takes two parameters (e.g. --%s varname filename)\n", which, which); die(); } if (!jv_object_has(jv_copy(program_arguments), jv_string(argv[i+1]))) { jv data = jv_load_file(argv[i+2], raw); if (!jv_is_valid(data)) { data = jv_invalid_get_msg(data); fprintf(stderr, "jq: Bad JSON in --%s %s %s: %s\n", which, argv[i+1], argv[i+2], jv_string_value(data)); jv_free(data); ret = JQ_ERROR_SYSTEM; goto out; } program_arguments = jv_object_set(program_arguments, jv_string(argv[i+1]), data); } i += 2; // skip the next two arguments } else if (isoption(&text, 0, "debug-dump-disasm", is_short)) { options |= DUMP_DISASM; } else if (isoption(&text, 0, "debug-trace=all", is_short)) { jq_flags |= JQ_DEBUG_TRACE_ALL; } else if (isoption(&text, 0, "debug-trace", is_short)) { jq_flags |= JQ_DEBUG_TRACE; } else if (isoption(&text, 'h', "help", is_short)) { usage(0, 0); } else if (isoption(&text, 'V', "version", is_short)) { printf("jq-%s\n", JQ_VERSION); ret = JQ_OK; goto out; } else if (isoption(&text, 0, "build-configuration", is_short)) { printf("%s\n", JQ_CONFIG); ret = JQ_OK; goto out; } else if (isoption(&text, 0, "run-tests", is_short)) { i++; // XXX Pass program_arguments, even a whole jq_state *, through; // could be useful for testing ret = jq_testsuite(lib_search_paths, (options & DUMP_DISASM) || (jq_flags & JQ_DEBUG_TRACE), argc - i, argv + i); goto out; } else { if (is_short) { fprintf(stderr, "jq: Unknown option -%c\n", text[0]); } else { fprintf(stderr, "jq: Unknown option --%s\n", text); } die(); } } } } #ifdef USE_ISATTY if (isatty(STDOUT_FILENO)) { #ifndef WIN32 dumpopts |= JV_PRINT_ISATTY | JV_PRINT_COLOR; #else /* Verify we actually have the console, as the NUL device is also regarded as tty. Windows can handle color if ANSICON (or ConEmu) is installed, or Windows 10 supports the virtual terminal */ DWORD mode; HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE); if (GetConsoleMode(con, &mode)) { dumpopts |= JV_PRINT_ISATTY; if (getenv("ANSICON") != NULL || SetConsoleMode(con, mode | 4/*ENABLE_VIRTUAL_TERMINAL_PROCESSING*/)) dumpopts |= JV_PRINT_COLOR; } #endif if (dumpopts & JV_PRINT_COLOR) { char *no_color = getenv("NO_COLOR"); if (no_color != NULL && no_color[0] != '\0') dumpopts &= ~JV_PRINT_COLOR; } } #endif if (options & SORTED_OUTPUT) dumpopts |= JV_PRINT_SORTED; if (options & ASCII_OUTPUT) dumpopts |= JV_PRINT_ASCII; if (options & COLOR_OUTPUT) dumpopts |= JV_PRINT_COLOR; if (options & NO_COLOR_OUTPUT) dumpopts &= ~JV_PRINT_COLOR; if (!jq_set_colors(getenv("JQ_COLORS"))) fprintf(stderr, "Failed to set $JQ_COLORS\n"); if (jv_get_kind(lib_search_paths) == JV_KIND_NULL) { // Default search path list lib_search_paths = JV_ARRAY(jv_string("~/.jq"), jv_string("$ORIGIN/../lib/jq"), jv_string("$ORIGIN/../lib")); } jq_set_attr(jq, jv_string("JQ_LIBRARY_PATH"), lib_search_paths); char *origin = strdup(argv[0]); if (origin == NULL) { fprintf(stderr, "jq: error: out of memory\n"); exit(1); } jq_set_attr(jq, jv_string("JQ_ORIGIN"), jv_string(dirname(origin))); free(origin); if (strchr(JQ_VERSION, '-') == NULL) jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string(JQ_VERSION)); else jq_set_attr(jq, jv_string("VERSION_DIR"), jv_string_fmt("%.*s-master", (int)(strchr(JQ_VERSION, '-') - JQ_VERSION), JQ_VERSION)); #ifdef USE_ISATTY if (!program && !(options & FROM_FILE) && (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO))) program = "."; #endif if (!program) usage(2, 1); if (options & FROM_FILE) { char *program_origin = strdup(program); if (program_origin == NULL) { perror("malloc"); exit(2); } jv data = jv_load_file(program, 1); if (!jv_is_valid(data)) { data = jv_invalid_get_msg(data); fprintf(stderr, "jq: %s\n", jv_string_value(data)); free(program_origin); jv_free(data); ret = JQ_ERROR_SYSTEM; goto out; } int len = jv_string_length_bytes(jv_copy(data)); if ((size_t)len != strlen(jv_string_value(data))) { fprintf(stderr, "jq: program file contains NUL bytes\n"); free(program_origin); jv_free(data); ret = JQ_ERROR_SYSTEM; goto out; } jq_set_attr(jq, jv_string("PROGRAM_ORIGIN"), jq_realpath(jv_string(dirname(program_origin)))); ARGS = JV_OBJECT(jv_string("positional"), ARGS, jv_string("named"), jv_copy(program_arguments)); program_arguments = jv_object_set(program_arguments, jv_string("ARGS"), jv_copy(ARGS)); if (!jv_object_has(jv_copy(program_arguments), jv_string("JQ_BUILD_CONFIGURATION"))) program_arguments = jv_object_set(program_arguments, jv_string("JQ_BUILD_CONFIGURATION"), jv_string(JQ_CONFIG)); /* named arguments */ compiled = jq_compile_args(jq, jv_string_value(data), jv_copy(program_arguments)); free(program_origin); jv_free(data); } else { jq_set_attr(jq, jv_string("PROGRAM_ORIGIN"), jq_realpath(jv_string("."))); // XXX is this good? ARGS = JV_OBJECT(jv_string("positional"), ARGS, jv_string("named"), jv_copy(program_arguments)); program_arguments = jv_object_set(program_arguments, jv_string("ARGS"), jv_copy(ARGS)); if (!jv_object_has(jv_copy(program_arguments), jv_string("JQ_BUILD_CONFIGURATION"))) program_arguments = jv_object_set(program_arguments, jv_string("JQ_BUILD_CONFIGURATION"), jv_string(JQ_CONFIG)); /* named arguments */ compiled = jq_compile_args(jq, program, jv_copy(program_arguments)); } if (!compiled){ ret = JQ_ERROR_COMPILE; goto out; } if (options & DUMP_DISASM) { jq_dump_disassembly(jq, 0); printf("\n"); } if ((options & SEQ)) parser_flags |= JV_PARSE_SEQ; if ((options & RAW_INPUT)) jq_util_input_set_parser(input_state, NULL, (options & SLURP) ? 1 : 0); else jq_util_input_set_parser(input_state, jv_parser_new(parser_flags), (options & SLURP) ? 1 : 0); // Let jq program read from inputs jq_set_input_cb(jq, jq_util_input_next_input_cb, input_state); // Let jq program call `debug` builtin and have that go somewhere jq_set_debug_cb(jq, debug_cb, &dumpopts); // Let jq program call `stderr` builtin and have that go somewhere jq_set_stderr_cb(jq, stderr_cb, &dumpopts); if (nfiles == 0) jq_util_input_add_input(input_state, "-"); if (options & PROVIDE_NULL) { ret = process(jq, jv_null(), jq_flags, dumpopts, options); } else { jv value; while (jq_util_input_errors(input_state) == 0 && (jv_is_valid((value = jq_util_input_next_input(input_state))) || jv_invalid_has_msg(jv_copy(value)))) { if (jv_is_valid(value)) { ret = process(jq, value, jq_flags, dumpopts, options); if (ret <= 0 && ret != JQ_OK_NO_OUTPUT) last_result = (ret != JQ_OK_NULL_KIND); if (jq_halted(jq)) break; continue; } // Parse error jv msg = jv_invalid_get_msg(value); if (!(options & SEQ)) { ret = JQ_ERROR_UNKNOWN; fprintf(stderr, "jq: parse error: %s\n", jv_string_value(msg)); jv_free(msg); break; } // --seq -> errors are not fatal fprintf(stderr, "jq: ignoring parse error: %s\n", jv_string_value(msg)); jv_free(msg); } } if (jq_util_input_errors(input_state) != 0) ret = JQ_ERROR_SYSTEM; out: badwrite = ferror(stdout); if (fclose(stdout)!=0 || badwrite) { fprintf(stderr,"jq: error: writing output failed: %s\n", strerror(errno)); ret = JQ_ERROR_SYSTEM; } jv_free(ARGS); jv_free(program_arguments); jq_util_input_free(&input_state); jq_teardown(&jq); if (options & EXIT_STATUS) { if (ret != JQ_OK_NO_OUTPUT) jq_exit_with_status(ret); else switch (last_result) { case -1: jq_exit_with_status(JQ_OK_NO_OUTPUT); case 0: jq_exit_with_status(JQ_OK_NULL_KIND); default: jq_exit_with_status(JQ_OK); } } else jq_exit(ret); } jq-1.8.2/src/jv_utf8_tables.h0000644000175100017510000000644715215513536011517 #define UTF8_CONTINUATION_BYTE ((unsigned char)255) static const unsigned char utf8_coding_length[] = {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static const unsigned char utf8_coding_bits[] = {0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static const int utf8_first_codepoint[] = {0x00, 0x00, 0x80, 0x800, 0x10000}; jq-1.8.2/src/jq_test.c0000644000175100017510000005340715215513536010242 #include #include #include #include #ifdef HAVE_PTHREAD #include #endif #include "jv.h" #include "jq.h" static void jv_test(void); static void run_jq_tests(jv, int, FILE *, int, int); static void run_jq_start_state_tests(void); static void run_jq_compile_args_tests(void); static void run_jq_recompile_tests(void); static void run_jq_exhaust_and_reuse_tests(void); #ifdef HAVE_PTHREAD static void run_jq_pthread_tests(void); #endif int jq_testsuite(jv libdirs, int verbose, int argc, char* argv[]) { int skip = -1; int take = -1; int nfiles = 0; jv_test(); for (int i = 0; i < argc; i++) { if (!strcmp(argv[i], "--skip")) { if (++i >= argc) { fprintf(stderr, "--skip requires an argument\n"); exit(1); } skip = atoi(argv[i]); } else if (!strcmp(argv[i], "--take")) { if (++i >= argc) { fprintf(stderr, "--take requires an argument\n"); exit(1); } take = atoi(argv[i]); } else { FILE *testdata = fopen(argv[i], "r"); if (!testdata) { perror("fopen"); exit(1); } run_jq_tests(jv_copy(libdirs), verbose, testdata, skip, take); fclose(testdata); nfiles++; } } if (nfiles == 0) run_jq_tests(jv_copy(libdirs), verbose, stdin, skip, take); jv_free(libdirs); run_jq_start_state_tests(); run_jq_compile_args_tests(); run_jq_recompile_tests(); run_jq_exhaust_and_reuse_tests(); #ifdef HAVE_PTHREAD run_jq_pthread_tests(); #endif return 0; } static int skipline(const char* buf) { int p = 0; while (buf[p] == ' ' || buf[p] == '\t') p++; if (buf[p] == '#' || buf[p] == '\n' || buf[p] == 0) return 1; return 0; } static int checkerrormsg(const char* buf) { return strcmp(buf, "%%FAIL\n") == 0; } static int checkfail(const char* buf) { return strcmp(buf, "%%FAIL\n") == 0 || strcmp(buf, "%%FAIL IGNORE MSG\n") == 0; } struct err_data { char buf[4096]; }; static void test_err_cb(void *data, jv e) { struct err_data *err_data = data; if (jv_get_kind(e) != JV_KIND_STRING) e = jv_dump_string(e, JV_PRINT_INVALID); if (!strncmp(jv_string_value(e), "jq: error", sizeof("jq: error") - 1)) snprintf(err_data->buf, sizeof(err_data->buf), "%s", jv_string_value(e)); jv_free(e); } static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int take) { char prog[4096] = {0}; char buf[4096]; struct err_data err_msg; int tests = 0, passed = 0, invalid = 0; unsigned int lineno = 0; int must_fail = 0; int check_msg = 0; jq_state *jq = NULL; int tests_to_skip = skip > 0 ? skip : 0; int tests_to_take = take; jq = jq_init(); assert(jq); if (jv_get_kind(lib_dirs) == JV_KIND_NULL) lib_dirs = jv_array(); jq_set_attr(jq, jv_string("JQ_LIBRARY_PATH"), lib_dirs); while (1) { if (!fgets(prog, sizeof(prog), testdata)) break; lineno++; if (skipline(prog)) continue; if (checkfail(prog)) { must_fail = 1; check_msg = checkerrormsg(prog); jq_set_error_cb(jq, test_err_cb, &err_msg); continue; } if (prog[strlen(prog)-1] == '\n') prog[strlen(prog)-1] = 0; if (skip > 0) { skip--; goto next; } else if (skip == 0) { printf("Skipped %d tests\n", tests_to_skip); skip = -1; } if (take > 0) { take--; } else if (take == 0) { printf("Hit the number of tests limit (%d), breaking\n", tests_to_take); break; } int pass = 1; tests++; printf("Test #%d: '%s' at line number %u\n", tests + tests_to_skip, prog, lineno); int compiled = jq_compile(jq, prog); if (must_fail) { jq_set_error_cb(jq, NULL, NULL); if (compiled) { printf("*** Test program compiled successfully, but should fail at line number %u: %s\n", lineno, prog); goto fail; } char *err_buf = err_msg.buf; while (fgets(buf, sizeof(buf), testdata)) { lineno++; if (skipline(buf)) break; if (check_msg) { if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; if (strncmp(buf, err_buf, strlen(buf)) != 0) { if (strchr(err_buf, '\n')) *strchr(err_buf, '\n') = '\0'; printf("*** Erroneous program failed with '%s', but expected '%s' at line number %u: %s\n", err_buf, buf, lineno, prog); goto fail; } err_buf += strlen(buf); if (*err_buf == '\n') err_buf++; } } if (check_msg && *err_buf != '\0') { if (strchr(err_buf, '\n')) *strchr(err_buf, '\n') = '\0'; printf("*** Erroneous program failed with extra message '%s' at line %u: %s\n", err_buf, lineno, prog); invalid++; pass = 0; } must_fail = 0; check_msg = 0; passed += pass; continue; } if (!compiled) { printf("*** Test program failed to compile at line %u: %s\n", lineno, prog); goto fail; } if (verbose) { printf("Disassembly:\n"); jq_dump_disassembly(jq, 2); printf("\n"); } if (!fgets(buf, sizeof(buf), testdata)) { invalid++; break; } lineno++; jv input = jv_parse(buf); if (!jv_is_valid(input)) { printf("*** Input is invalid on line %u: %s\n", lineno, buf); goto fail; } jq_start(jq, input, verbose ? JQ_DEBUG_TRACE : 0); while (fgets(buf, sizeof(buf), testdata)) { lineno++; if (skipline(buf)) break; jv expected = jv_parse(buf); if (!jv_is_valid(expected)) { printf("*** Expected result is invalid on line %u: %s\n", lineno, buf); goto fail; } jv actual = jq_next(jq); if (!jv_is_valid(actual)) { jv_free(expected); jv_free(actual); printf("*** Insufficient results for test at line number %u: %s\n", lineno, prog); pass = 0; break; } else if (!jv_equal(jv_copy(expected), jv_copy(actual))) { printf("*** Expected "); jv_dump(jv_copy(expected), 0); printf(", but got "); jv_dump(jv_copy(actual), 0); printf(" for test at line number %u: %s\n", lineno, prog); pass = 0; } #ifdef USE_DECNUM jv as_string = jv_dump_string(jv_copy(expected), 0); jv reparsed = jv_parse_sized(jv_string_value(as_string), jv_string_length_bytes(jv_copy(as_string))); if (!jv_equal(jv_copy(expected), jv_copy(reparsed))) { printf("*** Expected result should be equal after reparsing, but got "); jv_dump(jv_copy(reparsed), 0); printf(" for test at line %u: %s\n", lineno, buf); pass = 0; } jv_free(as_string); jv_free(reparsed); #endif jv_free(expected); jv_free(actual); } if (pass) { jv extra = jq_next(jq); if (jv_is_valid(extra)) { printf("*** Superfluous result: "); jv_dump(extra, 0); printf(" for test at line number %u, %s\n", lineno, prog); invalid++; pass = 0; } else { jv_free(extra); } } passed += pass; continue; fail: invalid++; next: while (fgets(buf, sizeof(buf), testdata)) { lineno++; if (skipline(buf)) break; } must_fail = 0; check_msg = 0; } jq_teardown(&jq); int total_skipped = tests_to_skip; if (skip > 0) { total_skipped = tests_to_skip - skip; } printf("%d of %d tests passed (%d malformed, %d skipped)\n", passed, tests, invalid, total_skipped); if (skip > 0) { printf("WARN: skipped past the end of file, exiting with status 2\n"); exit(2); } if (passed != tests) exit(1); } static int test_start_state(jq_state *jq, char *prog) { int pass = 1; jv message = jq_get_error_message(jq); if (jv_is_valid(message)) { printf("*** Expected error_message to be invalid after jq_start: %s\n", prog); pass = 0; } jv_free(message); jv exit_code = jq_get_exit_code(jq); if (jv_is_valid(exit_code)) { printf("*** Expected exit_code to be invalid after jq_start: %s\n", prog); pass = 0; } jv_free(exit_code); if (jq_halted(jq)) { printf("*** Expected jq to not be halted after jq_start: %s\n", prog); pass = 0; } return pass; } // Test jq_state is reset after subsequent calls to jq_start. static void test_jq_start_resets_state(char *prog, const char *input) { printf("Test jq_state: %s\n", prog); jq_state *jq = jq_init(); assert(jq); int compiled = jq_compile(jq, prog); assert(compiled); // First call to jq_start. Run until completion. jv parsed_input = jv_parse(input); assert(jv_is_valid(parsed_input)); jq_start(jq, parsed_input, 0); assert(test_start_state(jq, prog)); while (1) { jv result = jq_next(jq); int valid = jv_is_valid(result); jv_free(result); if (!valid) { break; } } // Second call to jq_start. jv parsed_input2 = jv_parse(input); assert(jv_is_valid(parsed_input2)); jq_start(jq, parsed_input2, 0); assert(test_start_state(jq, prog)); jq_teardown(&jq); } static void run_jq_start_state_tests(void) { test_jq_start_resets_state(".[]", "[1,2,3]"); test_jq_start_resets_state(".[] | if .%2 == 0 then halt_error else . end", "[1,2,3]"); } static void compile_args_and_check(jq_state *jq, const char *prog, jv args, jv input, jv expected) { printf(" subtest: %s\n", prog); int compiled = jq_compile_args(jq, prog, args); assert(compiled); jq_start(jq, input, 0); jv result = jq_next(jq); assert(jv_is_valid(result)); assert(jv_equal(result, expected)); jv extra = jq_next(jq); assert(!jv_is_valid(extra)); jv_free(extra); } // Test that jq_compile_args() with array arguments handles jv // refcounting correctly in args2obj(). The array path converts // [{"name":"k","value":"v"}, ...] into {"k":"v", ...}. static void run_jq_compile_args_tests(void) { printf("Test jq_compile_args with array args\n"); jq_state *jq = jq_init(); assert(jq); // Empty array: loop body never runs, kk/vk allocated and freed compile_args_and_check(jq, "42", jv_array(), jv_null(), jv_number(42)); // Single element: one iteration, no reuse of kk/vk compile_args_and_check(jq, "$val", JV_ARRAY(JV_OBJECT(jv_string("name"), jv_string("val"), jv_string("value"), jv_number(42))), jv_null(), jv_number(42)); // Two elements: minimum to trigger former UAF on iteration 2 compile_args_and_check(jq, "$x + $y", JV_ARRAY(JV_OBJECT(jv_string("name"), jv_string("x"), jv_string("value"), jv_number(1)), JV_OBJECT(jv_string("name"), jv_string("y"), jv_string("value"), jv_number(2))), jv_null(), jv_number(3)); // Three elements: exercises further loop iterations compile_args_and_check(jq, "$a + $b + $c", JV_ARRAY(JV_OBJECT(jv_string("name"), jv_string("a"), jv_string("value"), jv_string("hello")), JV_OBJECT(jv_string("name"), jv_string("b"), jv_string("value"), jv_string(" ")), JV_OBJECT(jv_string("name"), jv_string("c"), jv_string("value"), jv_string("world"))), jv_null(), jv_string("hello world")); // Object args: bypasses args2obj loop via early return compile_args_and_check(jq, "$x * $y", JV_OBJECT(jv_string("x"), jv_number(10), jv_string("y"), jv_number(20)), jv_null(), jv_number(200)); jq_teardown(&jq); } // Test that recompiling on the same jq_state doesn't leak or // double-free the previous bytecode, and that switching between // jq_compile and jq_compile_args works correctly. static void run_jq_recompile_tests(void) { printf("Test jq recompile on same state\n"); jq_state *jq = jq_init(); assert(jq); // First program via jq_compile int compiled = jq_compile(jq, ". + 1"); assert(compiled); jq_start(jq, jv_number(1), 0); jv r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == 2); jv_free(r); r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); // Recompile with a different program on the same state compiled = jq_compile(jq, ". * 2"); assert(compiled); jq_start(jq, jv_number(5), 0); r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == 10); jv_free(r); r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); // Recompile via jq_compile_args with array args (args2obj path) compiled = jq_compile_args(jq, "$n + $m", JV_ARRAY(JV_OBJECT(jv_string("name"), jv_string("n"), jv_string("value"), jv_number(100)), JV_OBJECT(jv_string("name"), jv_string("m"), jv_string("value"), jv_number(7)))); assert(compiled); jq_start(jq, jv_null(), 0); r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == 107); jv_free(r); r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); // Back to jq_compile after jq_compile_args compiled = jq_compile(jq, ". - 1"); assert(compiled); jq_start(jq, jv_number(10), 0); r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == 9); jv_free(r); r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); jq_teardown(&jq); } // Test that exhausting jq_next doesn't corrupt state, and that // the same jq_state can be reused with jq_start after exhaustion. static void run_jq_exhaust_and_reuse_tests(void) { printf("Test jq exhaust and reuse\n"); jq_state *jq = jq_init(); assert(jq); int compiled = jq_compile(jq, ".[]"); assert(compiled); // First run: drain all results jq_start(jq, jv_parse("[1,2,3]"), 0); for (int i = 1; i <= 3; i++) { jv r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == i); jv_free(r); } jv r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); // Reuse with new input on the same compiled program jq_start(jq, jv_parse("[10,20]"), 0); r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == 10); jv_free(r); r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == 20); jv_free(r); r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); // Reuse again with empty array (zero results) jq_start(jq, jv_parse("[]"), 0); r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); // Reuse once more after zero-result run jq_start(jq, jv_parse("[99]"), 0); r = jq_next(jq); assert(jv_is_valid(r)); assert(jv_number_value(r) == 99); jv_free(r); r = jq_next(jq); assert(!jv_is_valid(r)); jv_free(r); jq_teardown(&jq); } /// pthread regression test #ifdef HAVE_PTHREAD #define NUMBER_OF_THREADS 3 struct test_pthread_data { int result; }; static int test_pthread_jq_parse(jq_state *jq, struct jv_parser *parser) { int rv = 0; jv value; value = jv_parser_next(parser); while (jv_is_valid(value)) { jq_start(jq, value, 0); jv result = jq_next(jq); while (jv_is_valid(result)) { jv_free(result); result = jq_next(jq); } jv_free(result); value = jv_parser_next(parser); } jv_free(value); return rv; } static void *test_pthread_run(void *ptr) { int rv; jq_state *jq; const char *prg = ".data"; const char *buf = "{ \"data\": 1 }"; struct test_pthread_data *data = ptr; jq = jq_init(); if (jq_compile(jq, prg) == 0) { jq_teardown(&jq); return NULL; } struct jv_parser *parser = jv_parser_new(0); jv_parser_set_buf(parser, buf, strlen(buf), 0); rv = test_pthread_jq_parse(jq, parser); data->result = rv; jv_parser_free(parser); jq_teardown(&jq); return NULL; } static void run_jq_pthread_tests(void) { pthread_t threads[NUMBER_OF_THREADS]; struct test_pthread_data data[NUMBER_OF_THREADS]; int createerror; int a; memset(&threads, 0, sizeof(threads)); memset(&data, 0, sizeof(data)); // Create all threads for (a = 0; a < NUMBER_OF_THREADS; ++a) { createerror = pthread_create(&threads[a], NULL, test_pthread_run, &data[a]); assert(createerror == 0); } // wait for all threads for(a = 0; a < NUMBER_OF_THREADS; ++a) { #ifdef __MVS__ if (threads[a].__ != 0) { #else if (threads[a] != 0) { #endif pthread_join(threads[a], NULL); } } // check results for(a = 0; a < NUMBER_OF_THREADS; ++a) { assert(data[a].result == 0); } } #endif // HAVE_PTHREAD static void jv_test(void) { /// JSON parser regression tests { jv v = jv_parse("{\"a':\"12\"}"); assert(jv_get_kind(v) == JV_KIND_INVALID); v = jv_invalid_get_msg(v); assert(strcmp(jv_string_value(v), "Expected separator between values at line 1, column 9 (while parsing '{\"a':\"12\"}')") == 0); jv_free(v); } /// Arrays and numbers { jv a = jv_array(); assert(jv_get_kind(a) == JV_KIND_ARRAY); assert(jv_array_length(jv_copy(a)) == 0); assert(jv_array_length(jv_copy(a)) == 0); a = jv_array_append(a, jv_number(42)); assert(jv_array_length(jv_copy(a)) == 1); assert(jv_number_value(jv_array_get(jv_copy(a), 0)) == 42); jv a2 = jv_array_append(jv_array(), jv_number(42)); assert(jv_equal(jv_copy(a), jv_copy(a))); assert(jv_equal(jv_copy(a2), jv_copy(a2))); assert(jv_equal(jv_copy(a), jv_copy(a2))); assert(jv_equal(jv_copy(a2), jv_copy(a))); jv_free(a2); a2 = jv_array_append(jv_array(), jv_number(19)); assert(!jv_equal(jv_copy(a), jv_copy(a2))); assert(!jv_equal(jv_copy(a2), jv_copy(a))); jv_free(a2); assert(jv_get_refcnt(a) == 1); a = jv_array_append(a, jv_copy(a)); assert(jv_get_refcnt(a) == 1); assert(jv_array_length(jv_copy(a)) == 2); assert(jv_number_value(jv_array_get(jv_copy(a), 0)) == 42); for (int i=0; i<10; i++) { jv subarray = jv_array_get(jv_copy(a), 1); assert(jv_get_kind(subarray) == JV_KIND_ARRAY); assert(jv_array_length(jv_copy(subarray)) == 1); assert(jv_number_value(jv_array_get(jv_copy(subarray), 0)) == 42); jv_free(subarray); } jv subarray = jv_array_get(jv_copy(a), 1); assert(jv_get_kind(subarray) == JV_KIND_ARRAY); assert(jv_array_length(jv_copy(subarray)) == 1); assert(jv_number_value(jv_array_get(jv_copy(subarray), 0)) == 42); jv sub2 = jv_copy(subarray); sub2 = jv_array_append(sub2, jv_number(19)); assert(jv_get_kind(sub2) == JV_KIND_ARRAY); assert(jv_array_length(jv_copy(sub2)) == 2); assert(jv_number_value(jv_array_get(jv_copy(sub2), 0)) == 42); assert(jv_number_value(jv_array_get(jv_copy(sub2), 1)) == 19); assert(jv_get_kind(subarray) == JV_KIND_ARRAY); assert(jv_array_length(jv_copy(subarray)) == 1); assert(jv_number_value(jv_array_get(jv_copy(subarray), 0)) == 42); jv_free(subarray); void* before = sub2.u.ptr; sub2 = jv_array_append(sub2, jv_number(200)); void* after = sub2.u.ptr; assert(before == after); jv_free(sub2); jv a3 = jv_array_append(jv_copy(a), jv_number(19)); assert(jv_array_length(jv_copy(a3)) == 3); assert(jv_number_value(jv_array_get(jv_copy(a3), 0)) == 42); assert(jv_array_length(jv_array_get(jv_copy(a3), 1)) == 1); assert(jv_number_value(jv_array_get(jv_copy(a3), 2)) == 19); jv_free(a3); jv a4 = jv_array(); a4 = jv_array_append(a4, jv_number(1)); a4 = jv_array_append(a4, jv_number(2)); jv a5 = jv_copy(a4); a4 = jv_array_append(a4, jv_number(3)); a4 = jv_array_slice(a4, 0, 1); assert(jv_array_length(jv_copy(a4)) == 1); a4 = jv_array_append(a4, jv_number(4)); assert(jv_array_length(jv_copy(a4)) == 2); assert(jv_array_length(jv_copy(a5)) == 2); jv_free(a4); jv_free(a5); assert(jv_array_length(jv_copy(a)) == 2); assert(jv_number_value(jv_array_get(jv_copy(a), 0)) == 42); assert(jv_array_length(jv_array_get(jv_copy(a), 1)) == 1); //jv_dump(jv_copy(a), 0); printf("\n"); jv_free(a); } /// Strings { assert(jv_equal(jv_string("foo"), jv_string_sized("foo", 3))); char nasty[] = "foo\0"; jv shortstr = jv_string(nasty), longstr = jv_string_sized(nasty, sizeof(nasty)); assert(jv_string_length_bytes(jv_copy(shortstr)) == (int)strlen(nasty)); assert(jv_string_length_bytes(jv_copy(longstr)) == (int)sizeof(nasty)); jv_free(shortstr); jv_free(longstr); char a1s[] = "hello", a2s[] = "hello", bs[] = "goodbye"; jv a1 = jv_string(a1s), a2 = jv_string(a2s), b = jv_string(bs); assert(jv_equal(jv_copy(a1), jv_copy(a2))); assert(jv_equal(jv_copy(a2), jv_copy(a1))); assert(!jv_equal(jv_copy(a1), jv_copy(b))); assert(jv_string_hash(jv_copy(a1)) == jv_string_hash(jv_copy(a1))); assert(jv_string_hash(jv_copy(a1)) == jv_string_hash(jv_copy(a2))); assert(jv_string_hash(jv_copy(b)) != jv_string_hash(jv_copy(a1))); jv_free(a1); jv_free(a2); jv_free(b); assert(jv_equal(jv_string("hello42!"), jv_string_fmt("hello%d%s", 42, "!"))); char big[20000]; for (int i=0; i<(int)sizeof(big); i++) big[i] = 'a'; big[sizeof(big)-1] = 0; jv str = jv_string_fmt("%s", big); assert(jv_string_length_bytes(jv_copy(str)) == sizeof(big) - 1); assert(!strcmp(big, jv_string_value(str))); jv_free(str); } /// Objects { jv o1 = jv_object(); o1 = jv_object_set(o1, jv_string("foo"), jv_number(42)); o1 = jv_object_set(o1, jv_string("bar"), jv_number(24)); assert(jv_number_value(jv_object_get(jv_copy(o1), jv_string("foo"))) == 42); assert(jv_number_value(jv_object_get(jv_copy(o1), jv_string("bar"))) == 24); jv o2 = jv_object_set(jv_copy(o1), jv_string("foo"), jv_number(420)); o2 = jv_object_set(o2, jv_string("bar"), jv_number(240)); assert(jv_number_value(jv_object_get(jv_copy(o1), jv_string("foo"))) == 42); assert(jv_number_value(jv_object_get(jv_copy(o1), jv_string("bar"))) == 24); assert(jv_number_value(jv_object_get(jv_copy(o2), jv_string("foo"))) == 420); jv_free(o1); assert(jv_number_value(jv_object_get(jv_copy(o2), jv_string("bar"))) == 240); //jv_dump(jv_copy(o2), 0); printf("\n"); jv_free(o2); } } jq-1.8.2/src/linker.h0000644000175100017510000000024115215513536010046 #ifndef LINKER_H #define LINKER_H int load_program(jq_state *jq, struct locfile* src, block *out_block); jv load_module_meta(jq_state *jq, jv modname); #endif jq-1.8.2/src/jv_file.c0000644000175100017510000000455515215513536010207 #include #include #include #include #include #include #include #include "jv.h" #include "jv_unicode.h" jv jv_load_file(const char* filename, int raw) { struct stat sb; int fd = open(filename, O_RDONLY); if (fd == -1) { return jv_invalid_with_msg(jv_string_fmt("Could not open %s: %s", filename, strerror(errno))); } if (fstat(fd, &sb) == -1 || S_ISDIR(sb.st_mode)) { close(fd); return jv_invalid_with_msg(jv_string_fmt("Could not open %s: %s", filename, "It's a directory")); } FILE* file = fdopen(fd, "r"); struct jv_parser* parser = NULL; jv data; if (!file) { close(fd); return jv_invalid_with_msg(jv_string_fmt("Could not open %s: %s", filename, strerror(errno))); } if (raw) { data = jv_string(""); } else { data = jv_array(); parser = jv_parser_new(0); } // To avoid mangling UTF-8 multi-byte sequences that cross the end of our read // buffer, we need to be able to read the remainder of a sequence and add that // before appending. char buf[4096 + 4]; while (!feof(file) && !ferror(file)) { size_t n = fread(buf, 1, sizeof(buf) - 4, file); if (n == 0) continue; char *end = buf + n; int len = 0; if (jvp_utf8_backtrack(end - 1, buf, &len) && len > 0 && !feof(file) && !ferror(file)) { n += fread(end, 1, len, file); } if (raw) { data = jv_string_append_buf(data, buf, n); if (!jv_is_valid(data)) break; } else { jv_parser_set_buf(parser, buf, n, !feof(file)); jv value; while (jv_is_valid((value = jv_parser_next(parser)))) data = jv_array_append(data, value); if (jv_invalid_has_msg(jv_copy(value))) { jv_free(data); data = value; break; } jv_free(value); } } if (!raw) jv_parser_free(parser); int badread = ferror(file); if (fclose(file) != 0 || badread) { jv_free(data); return jv_invalid_with_msg(jv_string_fmt("Error reading from %s", filename)); } return data; } jq-1.8.2/src/locfile.c0000644000175100017510000000512715215513536010202 #include #include #include #include #include #include #include "jq.h" #include "jv_alloc.h" #include "locfile.h" #include "util.h" struct locfile* locfile_init(jq_state *jq, const char *fname, const char* data, int length) { struct locfile* l = jv_mem_alloc(sizeof(struct locfile)); l->jq = jq; l->fname = jv_string(fname); l->data = jv_mem_alloc(length); memcpy((char*)l->data,data,length); l->length = length; l->nlines = 1; l->refct = 1; for (int i=0; inlines++; } l->linemap = jv_mem_calloc(l->nlines + 1, sizeof(int)); l->linemap[0] = 0; int line = 1; for (int i=0; ilinemap[line] = i+1; // at start of line, not of \n line++; } } l->linemap[l->nlines] = length+1; // virtual last \n return l; } struct locfile* locfile_retain(struct locfile* l) { l->refct++; return l; } void locfile_free(struct locfile* l) { if (--(l->refct) == 0) { jv_free(l->fname); jv_mem_free(l->linemap); jv_mem_free((char*)l->data); jv_mem_free(l); } } int locfile_get_line(struct locfile* l, int pos) { assert(pos < l->length); int line = 1; while (l->linemap[line] <= pos) line++; // == if pos at start (before, never ==, because pos never on \n) assert(line-1 < l->nlines); return line-1; } static int locfile_line_length(struct locfile* l, int line) { assert(line < l->nlines); return l->linemap[line+1] - l->linemap[line] -1; // -1 to omit \n } void locfile_locate(struct locfile* l, location loc, const char* fmt, ...) { va_list fmtargs; va_start(fmtargs, fmt); jv m1 = jv_string_vfmt(fmt, fmtargs); va_end(fmtargs); if (!jv_is_valid(m1)) { jq_report_error(l->jq, m1); return; } if (loc.start == -1) { jq_report_error(l->jq, jv_string_fmt("jq: error: %s", jv_string_value(m1))); jv_free(m1); return; } int startline = locfile_get_line(l, loc.start); int offset = l->linemap[startline]; int end = MIN(loc.end, MAX(l->linemap[startline+1] - 1, loc.start + 1)); jv underline = jv_string_repeat(jv_string("^"), end - loc.start); jv m2 = jv_string_fmt("%s at %s, line %d, column %d:\n %.*s\n %*s", jv_string_value(m1), jv_string_value(l->fname), startline + 1, loc.start - offset + 1, locfile_line_length(l, startline), l->data + offset, end - offset, jv_string_value(underline)); jv_free(m1); jv_free(underline); jq_report_error(l->jq, m2); return; } jq-1.8.2/src/jv_aux.c0000644000175100017510000006142515215513536010064 #include #include #include #include #include #include "jv.h" #include "jv_alloc.h" #include "jv_private.h" // making this static verbose function here // until we introduce a less confusing naming scheme // of jv_* API with regards to the memory management static double jv_number_get_value_and_consume(jv number) { double value = jv_number_value(number); jv_free(number); return value; } #ifndef MAX_CMP_DEPTH #define MAX_CMP_DEPTH (10000) #endif struct sort_cmp_state { int too_deep; }; #ifdef _MSC_VER static __declspec(thread) struct sort_cmp_state sort_cmp_state; #else #ifdef HAVE___THREAD static __thread struct sort_cmp_state sort_cmp_state; #else static struct sort_cmp_state sort_cmp_state; #endif #endif static jv parse_slice(jv j, jv slice, int* pstart, int* pend) { // Array slices jv start_jv = jv_object_get(jv_copy(slice), jv_string("start")); jv end_jv = jv_object_get(slice, jv_string("end")); if (jv_get_kind(start_jv) == JV_KIND_NULL) { jv_free(start_jv); start_jv = jv_number(0); } int len; if (jv_get_kind(j) == JV_KIND_ARRAY) { len = jv_array_length(j); } else if (jv_get_kind(j) == JV_KIND_STRING) { len = jv_string_length_codepoints(j); } else { /* * XXX This should be dead code because callers shouldn't call this * function if `j' is neither an array nor a string. */ jv_free(j); jv_free(start_jv); jv_free(end_jv); return jv_invalid_with_msg(jv_string("Only arrays and strings can be sliced")); } if (jv_get_kind(end_jv) == JV_KIND_NULL) { jv_free(end_jv); end_jv = jv_number(len); } if (jv_get_kind(start_jv) != JV_KIND_NUMBER || jv_get_kind(end_jv) != JV_KIND_NUMBER) { jv_free(start_jv); jv_free(end_jv); return jv_invalid_with_msg(jv_string("Array/string slice indices must be integers")); } double dstart = jv_number_value(start_jv); double dend = jv_number_value(end_jv); int start, end; jv_free(start_jv); jv_free(end_jv); if (isnan(dstart)) dstart = 0; if (dstart < 0) dstart += len; if (dstart < 0) dstart = 0; if (dstart > len) dstart = len; start = dstart > INT_MAX ? INT_MAX : (int)dstart; // Rounds down if (isnan(dend)) dend = len; if (dend < 0) dend += len; if (dend < 0) dend = start; end = dend > INT_MAX ? INT_MAX : (int)dend; if (end > len) end = len; if (end < len) end += end < dend ? 1 : 0; // We round start down // but round end up if (end < start) end = start; assert(0 <= start && start <= end && end <= len); *pstart = start; *pend = end; return jv_true(); } jv jv_get(jv t, jv k) { jv v; if (jv_get_kind(t) == JV_KIND_OBJECT && jv_get_kind(k) == JV_KIND_STRING) { v = jv_object_get(t, k); if (!jv_is_valid(v)) { jv_free(v); v = jv_null(); } } else if (jv_get_kind(t) == JV_KIND_ARRAY && jv_get_kind(k) == JV_KIND_NUMBER) { if (jvp_number_is_nan(k)) { jv_free(t); v = jv_null(); } else { double didx = jv_number_value(k); if (didx < INT_MIN) didx = INT_MIN; if (didx > INT_MAX) didx = INT_MAX; int idx = (int)didx; if (idx < 0) idx += jv_array_length(jv_copy(t)); v = jv_array_get(t, idx); if (!jv_is_valid(v)) { jv_free(v); v = jv_null(); } } jv_free(k); } else if (jv_get_kind(t) == JV_KIND_ARRAY && jv_get_kind(k) == JV_KIND_OBJECT) { int start, end; jv e = parse_slice(jv_copy(t), k, &start, &end); if (jv_get_kind(e) == JV_KIND_TRUE) { v = jv_array_slice(t, start, end); } else { jv_free(t); v = e; } } else if (jv_get_kind(t) == JV_KIND_STRING && jv_get_kind(k) == JV_KIND_OBJECT) { int start, end; jv e = parse_slice(jv_copy(t), k, &start, &end); if (jv_get_kind(e) == JV_KIND_TRUE) { v = jv_string_slice(t, start, end); } else { jv_free(t); v = e; } } else if (jv_get_kind(t) == JV_KIND_ARRAY && jv_get_kind(k) == JV_KIND_ARRAY) { v = jv_array_indexes(t, k); } else if (jv_get_kind(t) == JV_KIND_NULL && (jv_get_kind(k) == JV_KIND_STRING || jv_get_kind(k) == JV_KIND_NUMBER || jv_get_kind(k) == JV_KIND_OBJECT)) { jv_free(t); jv_free(k); v = jv_null(); } else { char errbuf[30]; v = jv_invalid_with_msg(jv_string_fmt( "Cannot index %s with %s (%s)", jv_kind_name(jv_get_kind(t)), jv_kind_name(jv_get_kind(k)), jv_dump_string_trunc(jv_copy(k), errbuf, sizeof(errbuf)))); jv_free(t); jv_free(k); } return v; } jv jv_set(jv t, jv k, jv v) { if (!jv_is_valid(v)) { jv_free(t); jv_free(k); return v; } int isnull = jv_get_kind(t) == JV_KIND_NULL; if (jv_get_kind(k) == JV_KIND_STRING && (jv_get_kind(t) == JV_KIND_OBJECT || isnull)) { if (isnull) t = jv_object(); t = jv_object_set(t, k, v); } else if (jv_get_kind(k) == JV_KIND_NUMBER && (jv_get_kind(t) == JV_KIND_ARRAY || isnull)) { if (jvp_number_is_nan(k)) { jv_free(t); jv_free(k); jv_free(v); t = jv_invalid_with_msg(jv_string("Cannot set array element at NaN index")); } else { double didx = jv_number_value(k); if (didx < INT_MIN) didx = INT_MIN; if (didx > INT_MAX) didx = INT_MAX; if (isnull) t = jv_array(); t = jv_array_set(t, (int)didx, v); jv_free(k); } } else if (jv_get_kind(k) == JV_KIND_OBJECT && (jv_get_kind(t) == JV_KIND_ARRAY || isnull)) { if (isnull) t = jv_array(); int start, end; jv e = parse_slice(jv_copy(t), k, &start, &end); if (jv_get_kind(e) == JV_KIND_TRUE) { if (jv_get_kind(v) == JV_KIND_ARRAY) { int array_len = jv_array_length(jv_copy(t)); assert(0 <= start && start <= end && end <= array_len); int slice_len = end - start; int insert_len = jv_array_length(jv_copy(v)); if (slice_len < insert_len) { // array is growing int shift = insert_len - slice_len; for (int i = array_len - 1; i >= end && jv_is_valid(t); i--) { t = jv_array_set(t, i + shift, jv_array_get(jv_copy(t), i)); } } else if (slice_len > insert_len) { // array is shrinking int shift = slice_len - insert_len; for (int i = end; i < array_len && jv_is_valid(t); i++) { t = jv_array_set(t, i - shift, jv_array_get(jv_copy(t), i)); } if (jv_is_valid(t)) t = jv_array_slice(t, 0, array_len - shift); } for (int i = 0; i < insert_len && jv_is_valid(t); i++) { t = jv_array_set(t, start + i, jv_array_get(jv_copy(v), i)); } jv_free(v); } else { jv_free(t); jv_free(v); t = jv_invalid_with_msg(jv_string_fmt("A slice of an array can only be assigned another array")); } } else { jv_free(t); jv_free(v); t = e; } } else if (jv_get_kind(k) == JV_KIND_OBJECT && jv_get_kind(t) == JV_KIND_STRING) { jv_free(t); jv_free(k); jv_free(v); /* Well, why not? We should implement this... */ t = jv_invalid_with_msg(jv_string_fmt("Cannot update string slices")); } else { jv err = jv_invalid_with_msg(jv_string_fmt("Cannot update field at %s index of %s", jv_kind_name(jv_get_kind(k)), jv_kind_name(jv_get_kind(t)))); jv_free(t); jv_free(k); jv_free(v); t = err; } return t; } jv jv_has(jv t, jv k) { assert(jv_is_valid(t)); assert(jv_is_valid(k)); jv ret; if (jv_get_kind(t) == JV_KIND_NULL) { jv_free(t); jv_free(k); ret = jv_false(); } else if (jv_get_kind(t) == JV_KIND_OBJECT && jv_get_kind(k) == JV_KIND_STRING) { jv elem = jv_object_get(t, k); ret = jv_bool(jv_is_valid(elem)); jv_free(elem); } else if (jv_get_kind(t) == JV_KIND_ARRAY && jv_get_kind(k) == JV_KIND_NUMBER) { if (jvp_number_is_nan(k)) { jv_free(t); ret = jv_false(); } else { jv elem = jv_array_get(t, (int)jv_number_value(k)); ret = jv_bool(jv_is_valid(elem)); jv_free(elem); } jv_free(k); } else { ret = jv_invalid_with_msg(jv_string_fmt("Cannot check whether %s has a %s key", jv_kind_name(jv_get_kind(t)), jv_kind_name(jv_get_kind(k)))); jv_free(t); jv_free(k); } return ret; } // assumes keys is a sorted array static jv jv_dels(jv t, jv keys) { assert(jv_get_kind(keys) == JV_KIND_ARRAY); assert(jv_is_valid(t)); if (jv_get_kind(t) == JV_KIND_NULL || jv_array_length(jv_copy(keys)) == 0) { // no change } else if (jv_get_kind(t) == JV_KIND_ARRAY) { // extract slices, they must be handled differently jv neg_keys = jv_array(); jv nonneg_keys = jv_array(); jv new_array = jv_array(); jv starts = jv_array(), ends = jv_array(); jv_array_foreach(keys, i, key) { if (jv_get_kind(key) == JV_KIND_NUMBER) { if (jvp_number_is_nan(key)) { jv_free(key); } else if (jv_number_value(key) < 0) { neg_keys = jv_array_append(neg_keys, key); } else { nonneg_keys = jv_array_append(nonneg_keys, key); } } else if (jv_get_kind(key) == JV_KIND_OBJECT) { int start, end; jv e = parse_slice(jv_copy(t), key, &start, &end); if (jv_get_kind(e) == JV_KIND_TRUE) { starts = jv_array_append(starts, jv_number(start)); ends = jv_array_append(ends, jv_number(end)); } else { jv_free(new_array); new_array = e; goto arr_out; } } else { jv_free(new_array); new_array = jv_invalid_with_msg(jv_string_fmt("Cannot delete %s element of array", jv_kind_name(jv_get_kind(key)))); jv_free(key); goto arr_out; } } int neg_idx = 0; int nonneg_idx = 0; int len = jv_array_length(jv_copy(t)); for (int i = 0; i < len; ++i) { int del = 0; while (neg_idx < jv_array_length(jv_copy(neg_keys))) { int delidx = len + (int)jv_number_get_value_and_consume(jv_array_get(jv_copy(neg_keys), neg_idx)); if (i == delidx) { del = 1; } if (i < delidx) { break; } neg_idx++; } while (nonneg_idx < jv_array_length(jv_copy(nonneg_keys))) { int delidx = (int)jv_number_get_value_and_consume(jv_array_get(jv_copy(nonneg_keys), nonneg_idx)); if (i == delidx) { del = 1; } if (i < delidx) { break; } nonneg_idx++; } for (int sidx=0; !del && sidx MAX_PATH_DEPTH) { jv_free(value); jv_free(root); jv_free(path); return jv_invalid_with_msg(jv_string("Path too deep")); } if (!jv_is_valid(root)){ jv_free(value); jv_free(path); return root; } if (jv_array_length(jv_copy(path)) == 0) { jv_free(path); jv_free(root); return value; } jv pathcurr = jv_array_get(jv_copy(path), 0); jv pathrest = jv_array_slice(path, 1, jv_array_length(jv_copy(path))); /* * We need to be careful not to make extra copies since that leads to * quadratic behavior (e.g., when growing large data structures in a * reduction with `setpath/2`, i.e., with `|=`. */ if (jv_get_kind(pathcurr) == JV_KIND_OBJECT) { // Assignment to slice -- dunno yet how to avoid the extra copy return jv_set(root, pathcurr, jv_setpath(jv_get(jv_copy(root), jv_copy(pathcurr)), pathrest, value)); } jv subroot = jv_get(jv_copy(root), jv_copy(pathcurr)); if (!jv_is_valid(subroot)) { jv_free(root); jv_free(pathcurr); jv_free(pathrest); jv_free(value); return subroot; } // To avoid the extra copy we drop the reference from `root` by setting that // to null first. root = jv_set(root, jv_copy(pathcurr), jv_null()); if (!jv_is_valid(root)) { jv_free(subroot); jv_free(pathcurr); jv_free(pathrest); jv_free(value); return root; } return jv_set(root, pathcurr, jv_setpath(subroot, pathrest, value)); } jv jv_getpath(jv root, jv path) { if (jv_get_kind(path) != JV_KIND_ARRAY) { jv_free(root); jv_free(path); return jv_invalid_with_msg(jv_string("Path must be specified as an array")); } if (jv_array_length(jv_copy(path)) > MAX_PATH_DEPTH) { jv_free(root); jv_free(path); return jv_invalid_with_msg(jv_string("Path too deep")); } if (!jv_is_valid(root)) { jv_free(path); return root; } if (jv_array_length(jv_copy(path)) == 0) { jv_free(path); return root; } jv pathcurr = jv_array_get(jv_copy(path), 0); jv pathrest = jv_array_slice(path, 1, jv_array_length(jv_copy(path))); return jv_getpath(jv_get(root, pathcurr), pathrest); } // assumes paths is a sorted array of arrays static jv delpaths_sorted(jv object, jv paths, int start) { jv delkeys = jv_array(); for (int i=0; i start); int delkey = jv_array_length(jv_array_get(jv_copy(paths), i)) == start + 1; jv key = jv_array_get(jv_array_get(jv_copy(paths), i), start); int j = i; do j++; while (j < jv_array_length(jv_copy(paths)) && jv_equal(jv_copy(key), jv_array_get(jv_array_get(jv_copy(paths), j), start)) == 1); // if i <= entry < j, then entry starts with key if (delkey) { // deleting this entire key, we don't care about any more specific deletions delkeys = jv_array_append(delkeys, key); } else { // deleting certain sub-parts of this key jv subobject = jv_get(jv_copy(object), jv_copy(key)); if (!jv_is_valid(subobject)) { jv_free(key); jv_free(object); object = subobject; break; } else if (jv_get_kind(subobject) == JV_KIND_NULL) { jv_free(key); jv_free(subobject); } else { jv newsubobject = delpaths_sorted(subobject, jv_array_slice(jv_copy(paths), i, j), start+1); if (!jv_is_valid(newsubobject)) { jv_free(key); jv_free(object); object = newsubobject; break; } object = jv_set(object, key, newsubobject); } if (!jv_is_valid(object)) break; } i = j; } jv_free(paths); if (jv_is_valid(object)) object = jv_dels(object, delkeys); else jv_free(delkeys); return object; } jv jv_delpaths(jv object, jv paths) { if (jv_get_kind(paths) != JV_KIND_ARRAY) { jv_free(object); jv_free(paths); return jv_invalid_with_msg(jv_string("Paths must be specified as an array")); } paths = jv_sort(paths, jv_copy(paths)); jv_array_foreach(paths, i, elem) { if (jv_get_kind(elem) != JV_KIND_ARRAY) { jv_free(object); jv_free(paths); jv err = jv_invalid_with_msg(jv_string_fmt("Path must be specified as array, not %s", jv_kind_name(jv_get_kind(elem)))); jv_free(elem); return err; } if (jv_array_length(jv_copy(elem)) > MAX_PATH_DEPTH) { jv_free(object); jv_free(paths); jv_free(elem); return jv_invalid_with_msg(jv_string("Path too deep")); } jv_free(elem); } if (jv_array_length(jv_copy(paths)) == 0) { // nothing is being deleted jv_free(paths); return object; } if (jv_array_length(jv_array_get(jv_copy(paths), 0)) == 0) { // everything is being deleted jv_free(paths); jv_free(object); return jv_null(); } return delpaths_sorted(object, paths, 0); } static int string_cmp(const void* pa, const void* pb){ const jv* a = pa; const jv* b = pb; int lena = jv_string_length_bytes(jv_copy(*a)); int lenb = jv_string_length_bytes(jv_copy(*b)); int minlen = lena < lenb ? lena : lenb; int r = memcmp(jv_string_value(*a), jv_string_value(*b), minlen); if (r == 0) r = lena - lenb; return r; } jv jv_keys_unsorted(jv x) { if (jv_get_kind(x) != JV_KIND_OBJECT) return jv_keys(x); jv answer = jv_array_sized(jv_object_length(jv_copy(x))); jv_object_foreach(x, key, value) { answer = jv_array_append(answer, key); jv_free(value); } jv_free(x); return answer; } jv jv_keys(jv x) { if (jv_get_kind(x) == JV_KIND_OBJECT) { int nkeys = jv_object_length(jv_copy(x)); if (nkeys == 0) { jv_free(x); return jv_array(); } jv* keys = jv_mem_calloc(nkeys, sizeof(jv)); int kidx = 0; jv_object_foreach(x, key, value) { keys[kidx++] = key; jv_free(value); } qsort(keys, nkeys, sizeof(jv), string_cmp); jv answer = jv_array_sized(nkeys); for (int i = 0; i MAX_CMP_DEPTH) { jv_free(a); jv_free(b); return INT_MIN; } if (jv_get_kind(a) != jv_get_kind(b)) { int r = (int)jv_get_kind(a) - (int)jv_get_kind(b); jv_free(a); jv_free(b); return r; } int r = 0; switch (jv_get_kind(a)) { default: assert(0 && "invalid kind passed to jv_cmp"); case JV_KIND_NULL: case JV_KIND_FALSE: case JV_KIND_TRUE: // there's only one of each of these values break; case JV_KIND_NUMBER: { if (jvp_number_is_nan(a)) { r = jvp_cmp(jv_null(), jv_copy(b), depth); } else if (jvp_number_is_nan(b)) { r = jvp_cmp(jv_copy(a), jv_null(), depth); } else { r = jvp_number_cmp(a, b); } break; } case JV_KIND_STRING: { r = string_cmp(&a, &b); break; } case JV_KIND_ARRAY: { // Lexical ordering of arrays int i = 0; while (r == 0) { int a_done = i >= jv_array_length(jv_copy(a)); int b_done = i >= jv_array_length(jv_copy(b)); if (a_done || b_done) { r = b_done - a_done; //suddenly, logic break; } jv xa = jv_array_get(jv_copy(a), i); jv xb = jv_array_get(jv_copy(b), i); r = jvp_cmp(xa, xb, depth + 1); if (r == INT_MIN) break; i++; } break; } case JV_KIND_OBJECT: { jv keys_a = jv_keys(jv_copy(a)); jv keys_b = jv_keys(jv_copy(b)); r = jvp_cmp(jv_copy(keys_a), keys_b, depth + 1); if (r == 0) { jv_array_foreach(keys_a, i, key) { jv xa = jv_object_get(jv_copy(a), jv_copy(key)); jv xb = jv_object_get(jv_copy(b), key); r = jvp_cmp(xa, xb, depth + 1); if (r != 0) break; } } jv_free(keys_a); break; } } jv_free(a); jv_free(b); return r; } // Returns <0, 0, >0 if a is less than, equal to, or greater than b, or // INT_MIN if the comparison is too deep int jv_cmp(jv a, jv b) { return jvp_cmp(a, b, 0); } struct sort_entry { jv object; jv key; int index; }; static void sort_entry_array_free(struct sort_entry* entries, int start, int n) { for (int i = start; i < n; i++) { jv_free(entries[i].key); jv_free(entries[i].object); } jv_mem_free(entries); } static int sort_cmp(const void* pa, const void* pb) { const struct sort_entry* a = pa; const struct sort_entry* b = pb; int r = jv_cmp(jv_copy(a->key), jv_copy(b->key)); if (r == INT_MIN) { sort_cmp_state.too_deep = 1; return 0; } // comparing by index if r == 0 makes the sort stable return r ? r : (a->index - b->index); } static struct sort_entry* sort_items(jv objects, jv keys, int *too_deep) { assert(jv_get_kind(objects) == JV_KIND_ARRAY); assert(jv_get_kind(keys) == JV_KIND_ARRAY); assert(jv_array_length(jv_copy(objects)) == jv_array_length(jv_copy(keys))); int n = jv_array_length(jv_copy(objects)); *too_deep = 0; if (n == 0) { jv_free(objects); jv_free(keys); return NULL; } struct sort_entry* entries = jv_mem_calloc(n, sizeof(struct sort_entry)); for (int i=0; i 0) { jv curr_key = entries[0].key; jv group = jv_array_append(jv_array(), entries[0].object); for (int i = 1; i < n; i++) { int equal = jv_equal(jv_copy(curr_key), jv_copy(entries[i].key)); if (equal < 0) { jv_free(curr_key); jv_free(group); sort_entry_array_free(entries, i, n); jv_free(ret); return jv_invalid_with_msg(jv_string("Equality check too deep")); } if (equal) { jv_free(entries[i].key); } else { jv_free(curr_key); curr_key = entries[i].key; ret = jv_array_append(ret, group); group = jv_array(); } group = jv_array_append(group, entries[i].object); } jv_free(curr_key); ret = jv_array_append(ret, group); } jv_mem_free(entries); return ret; } jv jv_unique(jv objects, jv keys) { assert(jv_get_kind(objects) == JV_KIND_ARRAY); assert(jv_get_kind(keys) == JV_KIND_ARRAY); assert(jv_array_length(jv_copy(objects)) == jv_array_length(jv_copy(keys))); int n = jv_array_length(jv_copy(objects)); int too_deep = 0; struct sort_entry* entries = sort_items(objects, keys, &too_deep); if (too_deep) return jv_invalid_with_msg(jv_string("Comparison too deep")); jv ret = jv_array(); jv curr_key = jv_invalid(); for (int i = 0; i < n; i++) { int equal = jv_equal(jv_copy(curr_key), jv_copy(entries[i].key)); if (equal < 0) { jv_free(curr_key); sort_entry_array_free(entries, i, n); jv_free(ret); return jv_invalid_with_msg(jv_string("Equality check too deep")); } if (equal) { jv_free(entries[i].key); jv_free(entries[i].object); } else { jv_free(curr_key); curr_key = entries[i].key; ret = jv_array_append(ret, entries[i].object); } } jv_free(curr_key); jv_mem_free(entries); return ret; } jq-1.8.2/src/compile.h0000644000175100017510000000717715215513536010231 #ifndef COMPILE_H #define COMPILE_H #include #include "jv.h" #include "bytecode.h" #include "locfile.h" struct inst; typedef struct inst inst; typedef struct block { inst* first; inst* last; } block; block gen_location(location, struct locfile*, block); block gen_noop(void); int block_is_noop(block b); block gen_op_simple(opcode op); block gen_error(jv constant); block gen_const(jv constant); block gen_const_global(jv constant, const char *name); int block_is_const(block b); jv_kind block_const_kind(block b); jv block_const(block b); block gen_op_target(opcode op, block target); block gen_op_unbound(opcode op, const char* name); block gen_op_bound(opcode op, block binder); block gen_op_var_fresh(opcode op, const char* name); block gen_op_pushk_under(jv constant); block gen_module(block metadata); jv block_module_meta(block b); block gen_import(jv name, jv as, int is_data); block gen_import_meta(block import, block metadata); block gen_function(const char* name, block formals, block body); block gen_param_regular(const char* name); block gen_param(const char* name); block gen_lambda(block body); block gen_call(const char* name, block body); block gen_subexp(block a); block gen_both(block a, block b); block gen_const_object(block expr); block gen_collect(block expr); block gen_reduce(block source, block matcher, block init, block body); block gen_foreach(block source, block matcher, block init, block update, block extract); block gen_definedor(block a, block b); block gen_condbranch(block iftrue, block iffalse); block gen_and(block a, block b); block gen_or(block a, block b); block gen_dictpair(block k, block v); block gen_var_binding(block var, const char* name, block body); block gen_array_matcher(block left, block curr); block gen_object_matcher(block name, block curr); block gen_destructure(block var, block matcher, block body); block gen_destructure_alt(block matcher); block gen_cond(block cond, block iftrue, block iffalse); block gen_try(block exp, block handler); block gen_label(const char *label, block exp); block gen_cbinding(const struct cfunction* functions, int nfunctions, block b); void block_append(block* b, block b2); block block_join(block a, block b); int block_has_only_binders_and_imports(block, int bindflags); int block_has_only_binders(block, int bindflags); int block_has_main(block); int block_is_funcdef(block b); int block_is_single(block b); block block_bind_library(block binder, block body, int bindflags, const char* libname); block block_bind_referenced(block binder, block body, int bindflags); block block_bind_self(block binder, int bindflags); block block_drop_unreferenced(block body); jv block_take_imports(block* body); jv block_list_funcs(block body, int omit_underscores); int block_compile(block, struct bytecode**, struct locfile*, jv); void block_free(block); // Here's some horrible preprocessor gunk so that code // sequences can be constructed as BLOCK(block1, block2, block3) #define BLOCK_1(b1) (b1) #define BLOCK_2(b1,b2) (block_join((b1),(b2))) #define BLOCK_3(b1,b2,b3) (block_join(BLOCK_2(b1,b2),(b3))) #define BLOCK_4(b1,b2,b3,b4) (block_join(BLOCK_3(b1,b2,b3),(b4))) #define BLOCK_5(b1,b2,b3,b4,b5) (block_join(BLOCK_4(b1,b2,b3,b4),(b5))) #define BLOCK_6(b1,b2,b3,b4,b5,b6) (block_join(BLOCK_5(b1,b2,b3,b4,b5),(b6))) #define BLOCK_7(b1,b2,b3,b4,b5,b6,b7) (block_join(BLOCK_6(b1,b2,b3,b4,b5,b6),(b7))) #define BLOCK_8(b1,b2,b3,b4,b5,b6,b7,b8) (block_join(BLOCK_7(b1,b2,b3,b4,b5,b6,b7),(b8))) #define BLOCK_IDX(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME #define BLOCK(...) \ BLOCK_IDX(__VA_ARGS__, BLOCK_8, BLOCK_7, BLOCK_6, BLOCK_5, BLOCK_4, BLOCK_3, BLOCK_2, BLOCK_1)(__VA_ARGS__) #endif jq-1.8.2/src/jv.c0000644000175100017510000016057015215513536007210 /* * Portions Copyright (c) 2016 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 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. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "jv_alloc.h" #include "jv.h" #include "jv_unicode.h" #include "util.h" /* * Internal refcounting helpers */ typedef struct jv_refcnt { int count; } jv_refcnt; static const jv_refcnt JV_REFCNT_INIT = {1}; static void jvp_refcnt_inc(jv_refcnt* c) { c->count++; } static int jvp_refcnt_dec(jv_refcnt* c) { c->count--; return c->count == 0; } static int jvp_refcnt_unshared(jv_refcnt* c) { assert(c->count > 0); return c->count == 1; } #define KIND_MASK 0xF #define PFLAGS_MASK 0xF0 #define PTYPE_MASK 0x70 typedef enum { JVP_PAYLOAD_NONE = 0, JVP_PAYLOAD_ALLOCATED = 0x80, } payload_flags; #define JVP_MAKE_PFLAGS(ptype, allocated) ((((ptype) << 4) & PTYPE_MASK) | ((allocated) ? JVP_PAYLOAD_ALLOCATED : 0)) #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK)) #define JVP_FLAGS(j) ((j).kind_flags) #define JVP_KIND(j) (JVP_FLAGS(j) & KIND_MASK) #define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags) #define JVP_HAS_KIND(j, kind) (JVP_KIND(j) == kind) #define JVP_IS_ALLOCATED(j) (j.kind_flags & JVP_PAYLOAD_ALLOCATED) #define JVP_FLAGS_NULL JVP_MAKE_FLAGS(JV_KIND_NULL, JVP_PAYLOAD_NONE) #define JVP_FLAGS_INVALID JVP_MAKE_FLAGS(JV_KIND_INVALID, JVP_PAYLOAD_NONE) #define JVP_FLAGS_FALSE JVP_MAKE_FLAGS(JV_KIND_FALSE, JVP_PAYLOAD_NONE) #define JVP_FLAGS_TRUE JVP_MAKE_FLAGS(JV_KIND_TRUE, JVP_PAYLOAD_NONE) jv_kind jv_get_kind(jv x) { return JVP_KIND(x); } const char* jv_kind_name(jv_kind k) { switch (k) { case JV_KIND_INVALID: return ""; case JV_KIND_NULL: return "null"; case JV_KIND_FALSE: return "boolean"; case JV_KIND_TRUE: return "boolean"; case JV_KIND_NUMBER: return "number"; case JV_KIND_STRING: return "string"; case JV_KIND_ARRAY: return "array"; case JV_KIND_OBJECT: return "object"; } assert(0 && "invalid kind"); return ""; } const jv JV_NULL = {JVP_FLAGS_NULL, 0, 0, 0, {0}}; const jv JV_INVALID = {JVP_FLAGS_INVALID, 0, 0, 0, {0}}; const jv JV_FALSE = {JVP_FLAGS_FALSE, 0, 0, 0, {0}}; const jv JV_TRUE = {JVP_FLAGS_TRUE, 0, 0, 0, {0}}; jv jv_true(void) { return JV_TRUE; } jv jv_false(void) { return JV_FALSE; } jv jv_null(void) { return JV_NULL; } jv jv_bool(int x) { return x ? JV_TRUE : JV_FALSE; } /* * Invalid objects, with optional error messages */ #define JVP_FLAGS_INVALID_MSG JVP_MAKE_FLAGS(JV_KIND_INVALID, JVP_PAYLOAD_ALLOCATED) typedef struct { jv_refcnt refcnt; jv errmsg; } jvp_invalid; jv jv_invalid_with_msg(jv err) { jvp_invalid* i = jv_mem_alloc(sizeof(jvp_invalid)); i->refcnt = JV_REFCNT_INIT; i->errmsg = err; jv x = {JVP_FLAGS_INVALID_MSG, 0, 0, 0, {&i->refcnt}}; return x; } jv jv_invalid(void) { return JV_INVALID; } jv jv_invalid_get_msg(jv inv) { assert(JVP_HAS_KIND(inv, JV_KIND_INVALID)); jv x; if (JVP_HAS_FLAGS(inv, JVP_FLAGS_INVALID_MSG)) { x = jv_copy(((jvp_invalid*)inv.u.ptr)->errmsg); } else { x = jv_null(); } jv_free(inv); return x; } int jv_invalid_has_msg(jv inv) { assert(JVP_HAS_KIND(inv, JV_KIND_INVALID)); int r = JVP_HAS_FLAGS(inv, JVP_FLAGS_INVALID_MSG); jv_free(inv); return r; } /* * Numbers */ #ifdef USE_DECNUM #include "jv_dtoa.h" #include "jv_dtoa_tsd.h" // we will manage the space for the struct #define DECNUMDIGITS 1 #include "decNumber/decNumber.h" enum { JVP_NUMBER_NATIVE = 0, JVP_NUMBER_DECIMAL = 1 }; #define JVP_FLAGS_NUMBER_NATIVE JVP_MAKE_FLAGS(JV_KIND_NUMBER, JVP_MAKE_PFLAGS(JVP_NUMBER_NATIVE, 0)) #define JVP_FLAGS_NUMBER_LITERAL JVP_MAKE_FLAGS(JV_KIND_NUMBER, JVP_MAKE_PFLAGS(JVP_NUMBER_DECIMAL, 1)) // the decimal precision of binary double #define DEC_NUMBER_DOUBLE_PRECISION (17) #define DEC_NUMBER_STRING_GUARD (14) #define DEC_NUMBER_DOUBLE_EXTRA_UNITS ((DEC_NUMBER_DOUBLE_PRECISION - DECNUMDIGITS + DECDPUN - 1)/DECDPUN) #include "jv_thread.h" #ifdef WIN32 #ifndef __MINGW32__ /* Copied from Heimdal: thread-specific keys; see lib/base/dll.c in Heimdal */ /* * This is an implementation of thread-specific storage with * destructors. WIN32 doesn't quite have this. Instead it has * DllMain(), an entry point in every DLL that gets called to notify the * DLL of thread/process "attach"/"detach" events. * * We use __thread (or __declspec(thread)) for the thread-local itself * and DllMain() DLL_THREAD_DETACH events to drive destruction of * thread-local values. * * When building in maintainer mode on non-Windows pthread systems this * uses a single pthread key instead to implement multiple keys. This * keeps the code from rotting when modified by non-Windows developers. */ /* Logical array of keys that grows lock-lessly */ typedef struct tls_keys tls_keys; struct tls_keys { void (**keys_dtors)(void *); /* array of destructors */ size_t keys_start_idx; /* index of first destructor */ size_t keys_num; tls_keys *keys_next; }; /* * Well, not quite locklessly. We need synchronization primitives to do * this locklessly. An atomic CAS will do. */ static pthread_mutex_t tls_key_defs_lock = PTHREAD_MUTEX_INITIALIZER; static tls_keys *tls_key_defs; /* Logical array of values (per-thread; no locking needed here) */ struct tls_values { void **values; /* realloc()ed */ size_t values_num; }; #ifdef _MSC_VER static __declspec(thread) struct nomem_handler nomem_handler; #else static __thread struct tls_values values; #endif #define DEAD_KEY ((void *)8) static void w32_service_thread_detach(void *unused) { tls_keys *key_defs; void (*dtor)(void*); size_t i; pthread_mutex_lock(&tls_key_defs_lock); key_defs = tls_key_defs; pthread_mutex_unlock(&tls_key_defs_lock); if (key_defs == NULL) return; for (i = 0; i < values.values_num; i++) { assert(i >= key_defs->keys_start_idx); if (i >= key_defs->keys_start_idx + key_defs->keys_num) { pthread_mutex_lock(&tls_key_defs_lock); key_defs = key_defs->keys_next; pthread_mutex_unlock(&tls_key_defs_lock); assert(key_defs != NULL); assert(i >= key_defs->keys_start_idx); assert(i < key_defs->keys_start_idx + key_defs->keys_num); } dtor = key_defs->keys_dtors[i - key_defs->keys_start_idx]; if (values.values[i] != NULL && dtor != NULL && dtor != DEAD_KEY) dtor(values.values[i]); values.values[i] = NULL; } } extern void jv_tsd_dtoa_ctx_init(); extern void jv_tsd_dtoa_ctx_fini(); void jv_tsd_dec_ctx_fini(); void jv_tsd_dec_ctx_init(); BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: /*create_pt_key();*/ jv_tsd_dtoa_ctx_init(); jv_tsd_dec_ctx_init(); return TRUE; case DLL_PROCESS_DETACH: jv_tsd_dtoa_ctx_fini(); jv_tsd_dec_ctx_fini(); return TRUE; case DLL_THREAD_ATTACH: return 0; case DLL_THREAD_DETACH: w32_service_thread_detach(NULL); return TRUE; default: return TRUE; } } int pthread_key_create(pthread_key_t *key, void (*dtor)(void *)) { tls_keys *key_defs, *new_key_defs; size_t i, k; int ret = ENOMEM; pthread_mutex_lock(&tls_key_defs_lock); if (tls_key_defs == NULL) { /* First key */ new_key_defs = calloc(1, sizeof(*new_key_defs)); if (new_key_defs == NULL) { pthread_mutex_unlock(&tls_key_defs_lock); return ENOMEM; } new_key_defs->keys_num = 8; new_key_defs->keys_dtors = calloc(new_key_defs->keys_num, sizeof(*new_key_defs->keys_dtors)); if (new_key_defs->keys_dtors == NULL) { pthread_mutex_unlock(&tls_key_defs_lock); free(new_key_defs); return ENOMEM; } tls_key_defs = new_key_defs; new_key_defs->keys_dtors[0] = dtor; for (i = 1; i < new_key_defs->keys_num; i++) new_key_defs->keys_dtors[i] = NULL; pthread_mutex_unlock(&tls_key_defs_lock); return 0; } for (key_defs = tls_key_defs; key_defs != NULL; key_defs = key_defs->keys_next) { k = key_defs->keys_start_idx; for (i = 0; i < key_defs->keys_num; i++, k++) { if (key_defs->keys_dtors[i] == NULL) { /* Found free slot; use it */ key_defs->keys_dtors[i] = dtor; *key = k; pthread_mutex_unlock(&tls_key_defs_lock); return 0; } } if (key_defs->keys_next != NULL) continue; /* Grow the registration array */ /* XXX DRY */ new_key_defs = calloc(1, sizeof(*new_key_defs)); if (new_key_defs == NULL) break; new_key_defs->keys_dtors = calloc(key_defs->keys_num + key_defs->keys_num / 2, sizeof(*new_key_defs->keys_dtors)); if (new_key_defs->keys_dtors == NULL) { free(new_key_defs); break; } new_key_defs->keys_start_idx = key_defs->keys_start_idx + key_defs->keys_num; new_key_defs->keys_num = key_defs->keys_num + key_defs->keys_num / 2; new_key_defs->keys_dtors[i] = dtor; for (i = 1; i < new_key_defs->keys_num; i++) new_key_defs->keys_dtors[i] = NULL; key_defs->keys_next = new_key_defs; ret = 0; break; } pthread_mutex_unlock(&tls_key_defs_lock); return ret; } static void key_lookup(pthread_key_t key, tls_keys **kd, size_t *dtor_idx, void (**dtor)(void *)) { tls_keys *key_defs; if (kd != NULL) *kd = NULL; if (dtor_idx != NULL) *dtor_idx = 0; if (dtor != NULL) *dtor = NULL; pthread_mutex_lock(&tls_key_defs_lock); key_defs = tls_key_defs; pthread_mutex_unlock(&tls_key_defs_lock); while (key_defs != NULL) { if (key >= key_defs->keys_start_idx && key < key_defs->keys_start_idx + key_defs->keys_num) { if (kd != NULL) *kd = key_defs; if (dtor_idx != NULL) *dtor_idx = key - key_defs->keys_start_idx; if (dtor != NULL) *dtor = key_defs->keys_dtors[key - key_defs->keys_start_idx]; return; } pthread_mutex_lock(&tls_key_defs_lock); key_defs = key_defs->keys_next; pthread_mutex_unlock(&tls_key_defs_lock); assert(key_defs != NULL); assert(key >= key_defs->keys_start_idx); } } int pthread_setspecific(pthread_key_t key, void *value) { void **new_values; size_t new_num; void (*dtor)(void *); size_t i; key_lookup(key, NULL, NULL, &dtor); if (dtor == NULL) return EINVAL; if (key >= values.values_num) { if (values.values_num == 0) { values.values = NULL; new_num = 8; } else { new_num = (values.values_num + values.values_num / 2); } new_values = realloc(values.values, sizeof(void *) * new_num); if (new_values == NULL) return ENOMEM; for (i = values.values_num; i < new_num; i++) new_values[i] = NULL; values.values = new_values; values.values_num = new_num; } assert(key < values.values_num); if (values.values[key] != NULL && dtor != NULL && dtor != DEAD_KEY) dtor(values.values[key]); values.values[key] = value; return 0; } void * pthread_getspecific(pthread_key_t key) { if (key >= values.values_num) return NULL; return values.values[key]; } #else #include #endif #else #include #endif static pthread_key_t dec_ctx_key; static pthread_once_t dec_ctx_once = PTHREAD_ONCE_INIT; #define DEC_CONTEXT() tsd_dec_ctx_get(&dec_ctx_key) // atexit finalizer to clean up the tsd dec contexts if main() exits // without having called pthread_exit() void jv_tsd_dec_ctx_fini(void) { jv_mem_free(pthread_getspecific(dec_ctx_key)); pthread_setspecific(dec_ctx_key, NULL); } void jv_tsd_dec_ctx_init(void) { if (pthread_key_create(&dec_ctx_key, jv_mem_free) != 0) { fprintf(stderr, "error: cannot create thread specific key"); abort(); } atexit(jv_tsd_dec_ctx_fini); } static decContext* tsd_dec_ctx_get(pthread_key_t *key) { pthread_once(&dec_ctx_once, jv_tsd_dec_ctx_init); // cannot fail decContext *ctx = (decContext*)pthread_getspecific(*key); if (ctx) { return ctx; } ctx = malloc(sizeof(decContext)); if (ctx) { if (key == &dec_ctx_key) { decContextDefault(ctx, DEC_INIT_BASE); // make sure (Int)D2U(rhs->exponent-lhs->exponent) does not overflow ctx->digits = MIN(DEC_MAX_DIGITS, INT32_MAX - (DECDPUN - 1) - (ctx->emax - ctx->emin - 1)); ctx->traps = 0; /*no errors*/ } if (pthread_setspecific(*key, ctx) != 0) { fprintf(stderr, "error: cannot store thread specific data"); abort(); } } return ctx; } typedef struct { jv_refcnt refcnt; double num_double; char * literal_data; decNumber num_decimal; // must be the last field in the structure for memory management } jvp_literal_number; typedef struct { decNumber number; decNumberUnit units[DEC_NUMBER_DOUBLE_EXTRA_UNITS]; } decNumberDoublePrecision; static inline int jvp_number_is_literal(jv n) { assert(JVP_HAS_KIND(n, JV_KIND_NUMBER)); return JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL); } static jvp_literal_number* jvp_literal_number_ptr(jv j) { assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL)); return (jvp_literal_number*)j.u.ptr; } static decNumber* jvp_dec_number_ptr(jv j) { assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL)); return &(((jvp_literal_number*)j.u.ptr)->num_decimal); } static jvp_literal_number* jvp_literal_number_alloc(unsigned literal_length) { /* The number of units needed is ceil(DECNUMDIGITS/DECDPUN) */ int units = ((literal_length+DECDPUN-1)/DECDPUN); jvp_literal_number* n = jv_mem_alloc( sizeof(jvp_literal_number) + sizeof(decNumberUnit) * units ); n->refcnt = JV_REFCNT_INIT; n->num_double = NAN; n->literal_data = NULL; return n; } static jv jvp_literal_number_new(const char * literal) { size_t len = strlen(literal); if (len > DEC_MAX_DIGITS) return JV_INVALID; jvp_literal_number* n = jvp_literal_number_alloc(len); decContext *ctx = DEC_CONTEXT(); decContextClearStatus(ctx, DEC_Conversion_syntax); decNumberFromString(&n->num_decimal, literal, ctx); if (ctx->status & DEC_Conversion_syntax) { jv_mem_free(n); return JV_INVALID; } if (decNumberIsNaN(&n->num_decimal)) { // Reject NaN with payload. if (n->num_decimal.digits > 1 || *n->num_decimal.lsu != 0) { jv_mem_free(n); return JV_INVALID; } jv_mem_free(n); return jv_number(NAN); } jv r = {JVP_FLAGS_NUMBER_LITERAL, 0, 0, 0, {&n->refcnt}}; return r; } static double jvp_literal_number_to_double(jv j) { assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL)); decContext dblCtx; // init as decimal64 but change digits to allow conversion to binary64 (double) decContextDefault(&dblCtx, DEC_INIT_DECIMAL64); dblCtx.digits = DEC_NUMBER_DOUBLE_PRECISION; decNumber *p_dec_number = jvp_dec_number_ptr(j); decNumberDoublePrecision dec_double; char literal[DEC_NUMBER_DOUBLE_PRECISION + DEC_NUMBER_STRING_GUARD + 1]; // reduce the number to the shortest possible form // that fits into the 64 bit floating point representation decNumberReduce(&dec_double.number, p_dec_number, &dblCtx); decNumberToString(&dec_double.number, literal); char *end; return jvp_strtod(tsd_dtoa_context_get(), literal, &end); } static const char* jvp_literal_number_literal(jv n) { assert(JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL)); decNumber *pdec = jvp_dec_number_ptr(n); jvp_literal_number* plit = jvp_literal_number_ptr(n); if (decNumberIsNaN(pdec)) { return "null"; } if (decNumberIsInfinite(pdec)) { // We cannot preserve the literal data of numbers outside the limited // range of exponent. Since `decNumberToString` returns "Infinity" // (or "-Infinity"), and to reduce stack allocations as possible, we // normalize infinities in the callers instead of printing the maximum // (or minimum) double here. return NULL; } if (plit->literal_data == NULL) { int len = jvp_dec_number_ptr(n)->digits + 15 /* 14 + NUL */; plit->literal_data = jv_mem_alloc(len); // Preserve the actual precision as we have parsed it // don't do decNumberTrim(pdec); decNumberToString(pdec, plit->literal_data); } return plit->literal_data; } int jv_number_has_literal(jv n) { assert(JVP_HAS_KIND(n, JV_KIND_NUMBER)); return JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL); } const char* jv_number_get_literal(jv n) { assert(JVP_HAS_KIND(n, JV_KIND_NUMBER)); if (JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL)) { return jvp_literal_number_literal(n); } else { return NULL; } } jv jv_number_with_literal(const char * literal) { return jvp_literal_number_new(literal); } #endif /* USE_DECNUM */ jv jv_number(double x) { jv j = { #ifdef USE_DECNUM JVP_FLAGS_NUMBER_NATIVE, #else JV_KIND_NUMBER, #endif 0, 0, 0, {.number = x} }; return j; } static void jvp_number_free(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_NUMBER)); #ifdef USE_DECNUM if (JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL) && jvp_refcnt_dec(j.u.ptr)) { jvp_literal_number* n = jvp_literal_number_ptr(j); if (n->literal_data) { jv_mem_free(n->literal_data); } jv_mem_free(n); } #endif } double jv_number_value(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_NUMBER)); #ifdef USE_DECNUM if (JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL)) { jvp_literal_number* n = jvp_literal_number_ptr(j); if (isnan(n->num_double)) { n->num_double = jvp_literal_number_to_double(j); } return n->num_double; } #endif return j.u.number; } int jv_is_integer(jv j){ if (!JVP_HAS_KIND(j, JV_KIND_NUMBER)){ return 0; } double x = jv_number_value(j); double ipart; double fpart = modf(x, &ipart); return fabs(fpart) < DBL_EPSILON; } int jvp_number_is_nan(jv n) { assert(JVP_HAS_KIND(n, JV_KIND_NUMBER)); #ifdef USE_DECNUM if (JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL)) { decNumber *pdec = jvp_dec_number_ptr(n); return decNumberIsNaN(pdec); } #endif return isnan(n.u.number); } jv jv_number_abs(jv n) { assert(JVP_HAS_KIND(n, JV_KIND_NUMBER)); #ifdef USE_DECNUM if (JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL)) { jvp_literal_number* m = jvp_literal_number_alloc(jvp_dec_number_ptr(n)->digits); decNumberAbs(&m->num_decimal, jvp_dec_number_ptr(n), DEC_CONTEXT()); jv r = {JVP_FLAGS_NUMBER_LITERAL, 0, 0, 0, {&m->refcnt}}; return r; } #endif return jv_number(fabs(jv_number_value(n))); } jv jv_number_negate(jv n) { assert(JVP_HAS_KIND(n, JV_KIND_NUMBER)); #ifdef USE_DECNUM if (JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL)) { jvp_literal_number* m = jvp_literal_number_alloc(jvp_dec_number_ptr(n)->digits); decNumberMinus(&m->num_decimal, jvp_dec_number_ptr(n), DEC_CONTEXT()); jv r = {JVP_FLAGS_NUMBER_LITERAL, 0, 0, 0, {&m->refcnt}}; return r; } #endif return jv_number(-jv_number_value(n)); } int jvp_number_cmp(jv a, jv b) { assert(JVP_HAS_KIND(a, JV_KIND_NUMBER)); assert(JVP_HAS_KIND(b, JV_KIND_NUMBER)); #ifdef USE_DECNUM if (JVP_HAS_FLAGS(a, JVP_FLAGS_NUMBER_LITERAL) && JVP_HAS_FLAGS(b, JVP_FLAGS_NUMBER_LITERAL)) { struct { decNumber number; decNumberUnit units[1]; } res; decNumberCompare(&res.number, jvp_dec_number_ptr(a), jvp_dec_number_ptr(b), DEC_CONTEXT() ); if (decNumberIsZero(&res.number)) { return 0; } else if (decNumberIsNegative(&res.number)) { return -1; } else { return 1; } } #endif double da = jv_number_value(a), db = jv_number_value(b); if (da < db) { return -1; } else if (da == db) { return 0; } else { return 1; } } static int jvp_number_equal(jv a, jv b) { return jvp_number_cmp(a, b) == 0; } /* * Arrays (internal helpers) */ #define ARRAY_SIZE_ROUND_UP(n) (((n)*3)/2) #define JVP_FLAGS_ARRAY JVP_MAKE_FLAGS(JV_KIND_ARRAY, JVP_PAYLOAD_ALLOCATED) static int imax(int a, int b) { if (a>b) return a; else return b; } //FIXME signed vs unsigned typedef struct { jv_refcnt refcnt; int length, alloc_length; jv elements[]; } jvp_array; static jvp_array* jvp_array_ptr(jv a) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); return (jvp_array*)a.u.ptr; } static jvp_array* jvp_array_alloc(unsigned size) { jvp_array* a = jv_mem_alloc(sizeof(jvp_array) + sizeof(jv) * size); a->refcnt.count = 1; a->length = 0; a->alloc_length = size; return a; } static jv jvp_array_new(unsigned size) { jv r = {JVP_FLAGS_ARRAY, 0, 0, 0, {&jvp_array_alloc(size)->refcnt}}; return r; } static int jvp_array_length(jv a) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); return a.size; } static int jvp_array_offset(jv a) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); return a.offset; } static jv* jvp_array_read(jv a, int i) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); if (i >= 0 && i < jvp_array_length(a)) { jvp_array* array = jvp_array_ptr(a); assert(i + jvp_array_offset(a) < array->length); return &array->elements[i + jvp_array_offset(a)]; } else { return 0; } } static jv* jvp_array_write(jv* a, int i) { assert(i >= 0); jvp_array* array = jvp_array_ptr(*a); int pos = i + jvp_array_offset(*a); if (pos < array->alloc_length && jvp_refcnt_unshared(a->u.ptr)) { // use existing array space for (int j = array->length; j <= pos; j++) { array->elements[j] = JV_NULL; } array->length = imax(pos + 1, array->length); a->size = imax(i + 1, a->size); return &array->elements[pos]; } else { // allocate a new array int new_length = imax(i + 1, jvp_array_length(*a)); jvp_array* new_array = jvp_array_alloc(ARRAY_SIZE_ROUND_UP(new_length)); int j; for (j = 0; j < jvp_array_length(*a); j++) { new_array->elements[j] = jv_copy(array->elements[j + jvp_array_offset(*a)]); } for (; j < new_length; j++) { new_array->elements[j] = JV_NULL; } new_array->length = new_length; jv_free(*a); jv new_jv = {JVP_FLAGS_ARRAY, 0, 0, new_length, {&new_array->refcnt}}; *a = new_jv; return &new_array->elements[i]; } } static int jvp_equal(jv a, jv b, int depth); static int jvp_array_equal(jv a, jv b, int depth) { if (jvp_array_length(a) != jvp_array_length(b)) return 0; if (jvp_array_ptr(a) == jvp_array_ptr(b) && jvp_array_offset(a) == jvp_array_offset(b)) return 1; for (int i=0; i len) *pstart = len; if (*pend > len) *pend = len; if (*pend < *pstart) *pend = *pstart; } static int jvp_contains(jv a, jv b, int depth); static int jvp_array_contains(jv a, jv b, int depth) { int r = 1; jv_array_foreach(b, bi, belem) { int ri = 0; jv_array_foreach(a, ai, aelem) { ri = jvp_contains(aelem, jv_copy(belem), depth); if (ri) break; } jv_free(belem); if (ri <= 0) { r = ri; break; } } return r; } /* * Public */ static jv jvp_array_slice(jv a, int start, int end) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); int len = jvp_array_length(a); jvp_clamp_slice_params(len, &start, &end); assert(0 <= start && start <= end && end <= len); // FIXME: maybe slice should reallocate if the slice is small enough if (start == end) { jv_free(a); return jv_array(); } if (a.offset + start >= 1 << (sizeof(a.offset) * CHAR_BIT)) { jv r = jv_array_sized(end - start); for (int i = start; i < end; i++) r = jv_array_append(r, jv_array_get(jv_copy(a), i)); jv_free(a); return r; } else { a.offset += start; a.size = end - start; return a; } } /* * Arrays (public interface) */ jv jv_array_sized(int n) { return jvp_array_new(n); } jv jv_array(void) { return jv_array_sized(16); } int jv_array_length(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_ARRAY)); int len = jvp_array_length(j); jv_free(j); return len; } jv jv_array_get(jv j, int idx) { assert(JVP_HAS_KIND(j, JV_KIND_ARRAY)); jv* slot = jvp_array_read(j, idx); jv val; if (slot) { val = jv_copy(*slot); } else { val = jv_invalid(); } jv_free(j); return val; } jv jv_array_set(jv j, int idx, jv val) { assert(JVP_HAS_KIND(j, JV_KIND_ARRAY)); if (idx < 0) idx = jvp_array_length(j) + idx; if (idx < 0) { jv_free(j); jv_free(val); return jv_invalid_with_msg(jv_string("Out of bounds negative array index")); } if (idx > (INT_MAX >> 2) - jvp_array_offset(j)) { jv_free(j); jv_free(val); return jv_invalid_with_msg(jv_string("Array index too large")); } // copy/free of val,j coalesced jv* slot = jvp_array_write(&j, idx); jv_free(*slot); *slot = val; return j; } jv jv_array_append(jv j, jv val) { // copy/free of val,j coalesced return jv_array_set(j, jv_array_length(jv_copy(j)), val); } jv jv_array_concat(jv a, jv b) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); assert(JVP_HAS_KIND(b, JV_KIND_ARRAY)); // FIXME: could be faster jv_array_foreach(b, i, elem) { a = jv_array_append(a, elem); if (!jv_is_valid(a)) break; } jv_free(b); return a; } jv jv_array_slice(jv a, int start, int end) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); // copy/free of a coalesced return jvp_array_slice(a, start, end); } jv jv_array_indexes(jv a, jv b) { jv res = jv_array(); int idx = -1; int alen = jv_array_length(jv_copy(a)); for (int ai = 0; ai < alen; ++ai) { jv_array_foreach(b, bi, belem) { int equal = jv_equal(jv_array_get(jv_copy(a), ai + bi), belem); if (equal < 0) { jv_free(res); jv_free(a); jv_free(b); return jv_invalid_with_msg(jv_string("Equality check too deep")); } if (!equal) idx = -1; else if (bi == 0 && idx == -1) idx = ai; } if (idx > -1) res = jv_array_append(res, jv_number(idx)); idx = -1; } jv_free(a); jv_free(b); return res; } /* * Strings (internal helpers) */ #define JVP_FLAGS_STRING JVP_MAKE_FLAGS(JV_KIND_STRING, JVP_PAYLOAD_ALLOCATED) typedef struct { jv_refcnt refcnt; uint32_t hash; // high 31 bits are length, low bit is a flag // indicating whether hash has been computed. uint32_t length_hashed; uint32_t alloc_length; char data[]; } jvp_string; static jvp_string* jvp_string_ptr(jv a) { assert(JVP_HAS_KIND(a, JV_KIND_STRING)); return (jvp_string*)a.u.ptr; } static jvp_string* jvp_string_alloc(uint32_t size) { jvp_string* s = jv_mem_alloc(sizeof(jvp_string) + size + 1); s->refcnt.count = 1; s->alloc_length = size; return s; } /* Copy a UTF8 string, replacing all badly encoded points with U+FFFD */ static jv jvp_string_copy_replace_bad(const char* data, uint32_t length) { const char* end = data + length; const char* i = data; // worst case: all bad bytes, each becomes a 3-byte U+FFFD uint64_t maxlength = (uint64_t)length * 3 + 1; if (maxlength >= INT_MAX) { return jv_invalid_with_msg(jv_string("String too long")); } jvp_string* s = jvp_string_alloc(maxlength); char* out = s->data; int c = 0; while ((i = jvp_utf8_next(i, end, &c))) { if (c == -1) { c = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER } out += jvp_utf8_encode(c, out); assert(out < s->data + maxlength); } length = out - s->data; s->data[length] = 0; s->length_hashed = length << 1; jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&s->refcnt}}; return r; } /* Assumes valid UTF8 */ static jv jvp_string_new(const char* data, uint32_t length) { jvp_string* s = jvp_string_alloc(length); s->length_hashed = length << 1; if (data != NULL) memcpy(s->data, data, length); s->data[length] = 0; jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&s->refcnt}}; return r; } static jv jvp_string_empty_new(uint32_t length) { jvp_string* s = jvp_string_alloc(length); s->length_hashed = 0; memset(s->data, 0, length); s->data[length] = 0; jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&s->refcnt}}; return r; } static void jvp_string_free(jv js) { jvp_string* s = jvp_string_ptr(js); if (jvp_refcnt_dec(&s->refcnt)) { jv_mem_free(s); } } static uint32_t jvp_string_length(jvp_string* s) { return s->length_hashed >> 1; } static uint32_t jvp_string_remaining_space(jvp_string* s) { assert(s->alloc_length >= jvp_string_length(s)); uint32_t r = s->alloc_length - jvp_string_length(s); return r; } static jv jvp_string_append(jv string, const char* data, uint32_t len) { jvp_string* s = jvp_string_ptr(string); uint32_t currlen = jvp_string_length(s); if ((uint64_t)currlen + len >= INT_MAX - sizeof(jvp_string) / 2) { jv_free(string); return jv_invalid_with_msg(jv_string("String too long")); } if (jvp_refcnt_unshared(string.u.ptr) && jvp_string_remaining_space(s) >= len) { // the next string fits at the end of a memcpy(s->data + currlen, data, len); s->data[currlen + len] = 0; s->length_hashed = (currlen + len) << 1; return string; } else { // allocate a bigger buffer and copy uint32_t allocsz = (currlen + len) * 2; if (allocsz < 32) allocsz = 32; jvp_string* news = jvp_string_alloc(allocsz); news->length_hashed = (currlen + len) << 1; memcpy(news->data, s->data, currlen); memcpy(news->data + currlen, data, len); news->data[currlen + len] = 0; jvp_string_free(string); jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&news->refcnt}}; return r; } } static uint32_t hash_seed; static pthread_once_t hash_seed_once = PTHREAD_ONCE_INIT; static void jvp_hash_seed_init(void) { uint32_t seed; #if defined(HAVE_ARC4RANDOM) seed = arc4random(); #elif defined(HAVE_GETENTROPY) if (getentropy(&seed, sizeof(seed)) != 0) seed = (uint32_t)getpid() ^ (uint32_t)time(NULL); #else int fd = open("/dev/urandom", O_RDONLY); if (fd >= 0) { if (read(fd, &seed, sizeof(seed)) != 4) seed = (uint32_t)getpid() ^ (uint32_t)time(NULL); close(fd); } else { seed = (uint32_t)getpid() ^ (uint32_t)time(NULL); } #endif hash_seed = seed; } static uint32_t jvp_hash_seed(void) { pthread_once(&hash_seed_once, jvp_hash_seed_init); return hash_seed; } static uint32_t rotl32 (uint32_t x, int8_t r){ return (x << r) | (x >> (32 - r)); } static uint32_t jvp_string_hash(jv jstr) { jvp_string* str = jvp_string_ptr(jstr); if (str->length_hashed & 1) return str->hash; /* The following is based on MurmurHash3. MurmurHash3 was written by Austin Appleby, and is placed in the public domain. */ const uint8_t* data = (const uint8_t*)str->data; int len = (int)jvp_string_length(str); const int nblocks = len / 4; uint32_t h1 = jvp_hash_seed(); const uint32_t c1 = 0xcc9e2d51; const uint32_t c2 = 0x1b873593; const uint32_t* blocks = (const uint32_t *)(data + nblocks*4); for(int i = -nblocks; i; i++) { uint32_t k1 = blocks[i]; //FIXME: endianness/alignment k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1; h1 = rotl32(h1,13); h1 = h1*5+0xe6546b64; } const uint8_t* tail = (const uint8_t*)(data + nblocks*4); uint32_t k1 = 0; switch(len & 3) { case 3: k1 ^= tail[2] << 16; JQ_FALLTHROUGH; case 2: k1 ^= tail[1] << 8; JQ_FALLTHROUGH; case 1: k1 ^= tail[0]; k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1; } h1 ^= len; h1 ^= h1 >> 16; h1 *= 0x85ebca6b; h1 ^= h1 >> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >> 16; str->length_hashed |= 1; str->hash = h1; return h1; } static int jvp_string_equal(jv a, jv b) { assert(JVP_HAS_KIND(a, JV_KIND_STRING)); assert(JVP_HAS_KIND(b, JV_KIND_STRING)); jvp_string* stra = jvp_string_ptr(a); jvp_string* strb = jvp_string_ptr(b); if (jvp_string_length(stra) != jvp_string_length(strb)) return 0; return memcmp(stra->data, strb->data, jvp_string_length(stra)) == 0; } /* * Strings (public API) */ jv jv_string_sized(const char* str, int len) { return jvp_utf8_is_valid(str, str+len) ? jvp_string_new(str, len) : jvp_string_copy_replace_bad(str, len); } jv jv_string_empty(int len) { return jvp_string_empty_new(len); } jv jv_string(const char* str) { return jv_string_sized(str, strlen(str)); } int jv_string_length_bytes(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); int r = jvp_string_length(jvp_string_ptr(j)); jv_free(j); return r; } int jv_string_length_codepoints(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); const char* i = jv_string_value(j); const char* end = i + jv_string_length_bytes(jv_copy(j)); int c = 0, len = 0; while ((i = jvp_utf8_next(i, end, &c))) len++; jv_free(j); return len; } jv jv_string_indexes(jv j, jv k) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); assert(JVP_HAS_KIND(k, JV_KIND_STRING)); const char *jstr = jv_string_value(j); const char *idxstr = jv_string_value(k); const char *p, *lp; int jlen = jv_string_length_bytes(jv_copy(j)); int idxlen = jv_string_length_bytes(jv_copy(k)); jv a = jv_array(); if (idxlen != 0) { int n = 0; p = lp = jstr; while ((p = _jq_memmem(p, (jstr + jlen) - p, idxstr, idxlen)) != NULL) { while (lp < p) { lp += jvp_utf8_decode_length(*lp); n++; } a = jv_array_append(a, jv_number(n)); if (!jv_is_valid(a)) break; p++; } } jv_free(j); jv_free(k); return a; } jv jv_string_repeat(jv j, int n) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); if (n < 0) { jv_free(j); return jv_null(); } int len = jv_string_length_bytes(jv_copy(j)); int64_t res_len = (int64_t)len * n; if ((uint64_t)res_len >= INT_MAX - sizeof(jvp_string) / 2) { jv_free(j); return jv_invalid_with_msg(jv_string("Repeat string result too long")); } if (res_len == 0) { jv_free(j); return jv_string(""); } jv res = jv_string_empty(res_len); res = jvp_string_append(res, jv_string_value(j), len); for (int curr = len, grow; curr < res_len; curr += grow) { grow = MIN(res_len - curr, curr); res = jvp_string_append(res, jv_string_value(res), grow); } jv_free(j); return res; } jv jv_string_split(jv j, jv sep) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); assert(JVP_HAS_KIND(sep, JV_KIND_STRING)); const char *jstr = jv_string_value(j); const char *jend = jstr + jv_string_length_bytes(jv_copy(j)); const char *sepstr = jv_string_value(sep); const char *p, *s; int seplen = jv_string_length_bytes(jv_copy(sep)); jv a = jv_array(); assert(jv_get_refcnt(a) == 1); if (seplen == 0) { int c; while ((jstr = jvp_utf8_next(jstr, jend, &c))) { a = jv_array_append(a, jv_string_append_codepoint(jv_string(""), c)); if (!jv_is_valid(a)) break; } } else { for (p = jstr; p < jend; p = s + seplen) { s = _jq_memmem(p, jend - p, sepstr, seplen); if (s == NULL) s = jend; a = jv_array_append(a, jv_string_sized(p, s - p)); if (!jv_is_valid(a)) break; // Add an empty string to denote that j ends on a sep if (s + seplen == jend && seplen != 0) a = jv_array_append(a, jv_string("")); } } jv_free(j); jv_free(sep); return a; } jv jv_string_explode(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); const char* i = jv_string_value(j); int len = jv_string_length_bytes(jv_copy(j)); const char* end = i + len; jv a = jv_array_sized(len); int c; while ((i = jvp_utf8_next(i, end, &c))) { a = jv_array_append(a, jv_number(c)); if (!jv_is_valid(a)) break; } jv_free(j); return a; } jv jv_string_implode(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_ARRAY)); int len = jv_array_length(jv_copy(j)); jv s = jv_string_empty(len); int i; assert(len >= 0); for (i = 0; i < len; i++) { jv n = jv_array_get(jv_copy(j), i); assert(JVP_HAS_KIND(n, JV_KIND_NUMBER)); int nv = jv_number_value(n); jv_free(n); // outside codepoint range or in utf16 surrogate pair range if (nv < 0 || nv > 0x10FFFF || (nv >= 0xD800 && nv <= 0xDFFF)) nv = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER s = jv_string_append_codepoint(s, nv); if (!jv_is_valid(s)) break; } jv_free(j); return s; } unsigned long jv_string_hash(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); uint32_t hash = jvp_string_hash(j); jv_free(j); return hash; } const char* jv_string_value(jv j) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); return jvp_string_ptr(j)->data; } jv jv_string_slice(jv j, int start, int end) { assert(JVP_HAS_KIND(j, JV_KIND_STRING)); const char *s = jv_string_value(j); int len = jv_string_length_bytes(jv_copy(j)); int i; const char *p, *e; int c; jv res; jvp_clamp_slice_params(len, &start, &end); assert(0 <= start && start <= end && end <= len); /* Look for byte offset corresponding to start codepoints */ for (p = s, i = 0; i < start; i++) { p = jvp_utf8_next(p, s + len, &c); if (p == NULL) { jv_free(j); return jv_string_empty(16); } if (c == -1) { jv_free(j); return jv_invalid_with_msg(jv_string("Invalid UTF-8 string")); } } /* Look for byte offset corresponding to end codepoints */ for (e = p; e != NULL && i < end; i++) { e = jvp_utf8_next(e, s + len, &c); if (e == NULL) { e = s + len; break; } if (c == -1) { jv_free(j); return jv_invalid_with_msg(jv_string("Invalid UTF-8 string")); } } /* * NOTE: Ideally we should do here what jvp_array_slice() does instead * of allocating a new string as we do! However, we assume NUL- * terminated strings all over, and in the jv API, so for now we waste * memory like a drunken navy programmer. There's probably nothing we * can do about it. */ res = jv_string_sized(p, e - p); jv_free(j); return res; } jv jv_string_concat(jv a, jv b) { a = jvp_string_append(a, jv_string_value(b), jvp_string_length(jvp_string_ptr(b))); jv_free(b); return a; } jv jv_string_append_buf(jv a, const char* buf, int len) { if (jvp_utf8_is_valid(buf, buf+len)) { a = jvp_string_append(a, buf, len); } else { jv b = jvp_string_copy_replace_bad(buf, len); a = jv_string_concat(a, b); } return a; } jv jv_string_append_codepoint(jv a, uint32_t c) { char buf[5]; int len = jvp_utf8_encode(c, buf); a = jvp_string_append(a, buf, len); return a; } jv jv_string_append_str(jv a, const char* str) { return jv_string_append_buf(a, str, strlen(str)); } jv jv_string_vfmt(const char* fmt, va_list ap) { int size = 1024; while (1) { char* buf = jv_mem_alloc(size); va_list ap2; va_copy(ap2, ap); int n = vsnprintf(buf, size, fmt, ap2); va_end(ap2); /* * NOTE: here we support old vsnprintf()s that return -1 because the * buffer is too small. */ if (n >= 0 && n < size) { jv ret = jv_string_sized(buf, n); jv_mem_free(buf); return ret; } else { jv_mem_free(buf); size = (n > 0) ? /* standard */ (n * 2) : /* not standard */ (size * 2); } } } jv jv_string_fmt(const char* fmt, ...) { va_list args; va_start(args, fmt); jv res = jv_string_vfmt(fmt, args); va_end(args); return res; } /* * Objects (internal helpers) */ #define JVP_FLAGS_OBJECT JVP_MAKE_FLAGS(JV_KIND_OBJECT, JVP_PAYLOAD_ALLOCATED) struct object_slot { int next; /* next slot with same hash, for collisions */ uint32_t hash; jv string; jv value; }; typedef struct { jv_refcnt refcnt; int next_free; struct object_slot elements[]; } jvp_object; /* warning: nontrivial justification of alignment */ static jv jvp_object_new(int size) { // Allocates an object of (size) slots and (size*2) hash buckets. // size must be a power of two assert(size > 0 && (size & (size - 1)) == 0); jvp_object* obj = jv_mem_alloc(sizeof(jvp_object) + sizeof(struct object_slot) * size + sizeof(int) * (size * 2)); obj->refcnt.count = 1; for (int i=0; ielements[i].next = i - 1; obj->elements[i].string = JV_NULL; obj->elements[i].hash = 0; obj->elements[i].value = JV_NULL; } obj->next_free = 0; int* hashbuckets = (int*)(&obj->elements[size]); for (int i=0; irefcnt}}; return r; } static jvp_object* jvp_object_ptr(jv o) { assert(JVP_HAS_KIND(o, JV_KIND_OBJECT)); return (jvp_object*)o.u.ptr; } static uint32_t jvp_object_mask(jv o) { assert(JVP_HAS_KIND(o, JV_KIND_OBJECT)); return (o.size * 2) - 1; } static int jvp_object_size(jv o) { assert(JVP_HAS_KIND(o, JV_KIND_OBJECT)); return o.size; } static int* jvp_object_buckets(jv o) { return (int*)(&jvp_object_ptr(o)->elements[o.size]); } static int* jvp_object_find_bucket(jv object, jv key) { return jvp_object_buckets(object) + (jvp_object_mask(object) & jvp_string_hash(key)); } static struct object_slot* jvp_object_get_slot(jv object, int slot) { assert(slot == -1 || (slot >= 0 && slot < jvp_object_size(object))); if (slot == -1) return 0; else return &jvp_object_ptr(object)->elements[slot]; } static struct object_slot* jvp_object_next_slot(jv object, struct object_slot* slot) { return jvp_object_get_slot(object, slot->next); } static struct object_slot* jvp_object_find_slot(jv object, jv keystr, int* bucket) { uint32_t hash = jvp_string_hash(keystr); for (struct object_slot* curr = jvp_object_get_slot(object, *bucket); curr; curr = jvp_object_next_slot(object, curr)) { if (curr->hash == hash && jvp_string_equal(keystr, curr->string)) { return curr; } } return 0; } static struct object_slot* jvp_object_add_slot(jv object, jv key, int* bucket) { jvp_object* o = jvp_object_ptr(object); int newslot_idx = o->next_free; if (newslot_idx == jvp_object_size(object)) return 0; struct object_slot* newslot = jvp_object_get_slot(object, newslot_idx); o->next_free++; newslot->next = *bucket; *bucket = newslot_idx; newslot->hash = jvp_string_hash(key); newslot->string = key; return newslot; } static jv* jvp_object_read(jv object, jv key) { assert(JVP_HAS_KIND(key, JV_KIND_STRING)); int* bucket = jvp_object_find_bucket(object, key); struct object_slot* slot = jvp_object_find_slot(object, key, bucket); if (slot == 0) return 0; else return &slot->value; } static int jvp_object_rehash(jv *objectp) { jv object = *objectp; assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); assert(jvp_refcnt_unshared(object.u.ptr)); int size = jvp_object_size(object); if (size > INT_MAX >> 2) return 0; jv new_object = jvp_object_new(size * 2); for (int i=0; istring) == JV_KIND_NULL) continue; int* new_bucket = jvp_object_find_bucket(new_object, slot->string); assert(!jvp_object_find_slot(new_object, slot->string, new_bucket)); struct object_slot* new_slot = jvp_object_add_slot(new_object, slot->string, new_bucket); assert(new_slot); new_slot->value = slot->value; } // references are transported, just drop the old table jv_mem_free(jvp_object_ptr(object)); *objectp = new_object; return 1; } static jv jvp_object_unshare(jv object) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); if (jvp_refcnt_unshared(object.u.ptr)) return object; jv new_object = jvp_object_new(jvp_object_size(object)); jvp_object_ptr(new_object)->next_free = jvp_object_ptr(object)->next_free; for (int i=0; istring) != JV_KIND_NULL) { new_slot->string = jv_copy(old_slot->string); new_slot->value = jv_copy(old_slot->value); } } int* old_buckets = jvp_object_buckets(object); int* new_buckets = jvp_object_buckets(new_object); memcpy(new_buckets, old_buckets, sizeof(int) * jvp_object_size(new_object)*2); jv_free(object); assert(jvp_refcnt_unshared(new_object.u.ptr)); return new_object; } static int jvp_object_write(jv* object, jv key, jv **valpp) { *object = jvp_object_unshare(*object); int* bucket = jvp_object_find_bucket(*object, key); struct object_slot* slot = jvp_object_find_slot(*object, key, bucket); if (slot) { // already has the key jvp_string_free(key); *valpp = &slot->value; return 1; } slot = jvp_object_add_slot(*object, key, bucket); if (slot) { slot->value = jv_invalid(); } else { if (!jvp_object_rehash(object)) { jvp_string_free(key); *valpp = NULL; return 0; } bucket = jvp_object_find_bucket(*object, key); assert(!jvp_object_find_slot(*object, key, bucket)); slot = jvp_object_add_slot(*object, key, bucket); assert(slot); slot->value = jv_invalid(); } *valpp = &slot->value; return 1; } static int jvp_object_delete(jv* object, jv key) { assert(JVP_HAS_KIND(key, JV_KIND_STRING)); *object = jvp_object_unshare(*object); int* bucket = jvp_object_find_bucket(*object, key); int* prev_ptr = bucket; uint32_t hash = jvp_string_hash(key); for (struct object_slot* curr = jvp_object_get_slot(*object, *bucket); curr; curr = jvp_object_next_slot(*object, curr)) { if (hash == curr->hash && jvp_string_equal(key, curr->string)) { *prev_ptr = curr->next; jvp_string_free(curr->string); curr->string = JV_NULL; jv_free(curr->value); return 1; } prev_ptr = &curr->next; } return 0; } static int jvp_object_length(jv object) { int n = 0; for (int i=0; istring) != JV_KIND_NULL) n++; } return n; } static int jvp_object_equal(jv o1, jv o2, int depth) { int len2 = jvp_object_length(o2); int len1 = 0; for (int i=0; istring) == JV_KIND_NULL) continue; jv* slot2 = jvp_object_read(o2, slot->string); if (!slot2) return 0; // FIXME: do less refcounting here int r = jvp_equal(jv_copy(slot->value), jv_copy(*slot2), depth); if (r <= 0) return r; len1++; } return len1 == len2; } static int jvp_object_contains(jv a, jv b, int depth) { assert(JVP_HAS_KIND(a, JV_KIND_OBJECT)); assert(JVP_HAS_KIND(b, JV_KIND_OBJECT)); int r = 1; jv_object_foreach(b, key, b_val) { jv a_val = jv_object_get(jv_copy(a), key); r = jvp_contains(a_val, b_val, depth); if (r <= 0) break; } return r; } /* * Objects (public interface) */ #define DEFAULT_OBJECT_SIZE 8 jv jv_object(void) { return jvp_object_new(8); } jv jv_object_get(jv object, jv key) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); assert(JVP_HAS_KIND(key, JV_KIND_STRING)); jv* slot = jvp_object_read(object, key); jv val; if (slot) { val = jv_copy(*slot); } else { val = jv_invalid(); } jv_free(object); jv_free(key); return val; } int jv_object_has(jv object, jv key) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); assert(JVP_HAS_KIND(key, JV_KIND_STRING)); jv* slot = jvp_object_read(object, key); int res = slot ? 1 : 0; jv_free(object); jv_free(key); return res; } jv jv_object_set(jv object, jv key, jv value) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); assert(JVP_HAS_KIND(key, JV_KIND_STRING)); // copy/free of object, key, value coalesced jv* slot; if (!jvp_object_write(&object, key, &slot)) { jv_free(object); jv_free(value); return jv_invalid_with_msg(jv_string("Object too big")); } jv_free(*slot); *slot = value; return object; } jv jv_object_delete(jv object, jv key) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); assert(JVP_HAS_KIND(key, JV_KIND_STRING)); jvp_object_delete(&object, key); jv_free(key); return object; } int jv_object_length(jv object) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); int n = jvp_object_length(object); jv_free(object); return n; } jv jv_object_merge(jv a, jv b) { assert(JVP_HAS_KIND(a, JV_KIND_OBJECT)); jv_object_foreach(b, k, v) { a = jv_object_set(a, k, v); if (!jv_is_valid(a)) break; } jv_free(b); return a; } #ifndef MAX_OBJECT_MERGE_DEPTH #define MAX_OBJECT_MERGE_DEPTH (10000) #endif static jv jvp_object_merge_recursive(jv a, jv b, int depth) { assert(JVP_HAS_KIND(a, JV_KIND_OBJECT)); assert(JVP_HAS_KIND(b, JV_KIND_OBJECT)); if (depth > MAX_OBJECT_MERGE_DEPTH) { jv_free(a); jv_free(b); return jv_invalid_with_msg(jv_string("Object merge too deep")); } jv_object_foreach(b, k, v) { jv elem = jv_object_get(jv_copy(a), jv_copy(k)); if (jv_is_valid(elem) && JVP_HAS_KIND(elem, JV_KIND_OBJECT) && JVP_HAS_KIND(v, JV_KIND_OBJECT)) { jv merged = jvp_object_merge_recursive(elem, v, depth + 1); if (!jv_is_valid(merged)) { jv_free(k); jv_free(a); jv_free(b); return merged; } a = jv_object_set(a, k, merged); } else { jv_free(elem); a = jv_object_set(a, k, v); } if (!jv_is_valid(a)) break; } jv_free(b); return a; } jv jv_object_merge_recursive(jv a, jv b) { return jvp_object_merge_recursive(a, b, 0); } /* * Object iteration (internal helpers) */ enum { ITER_FINISHED = -2 }; int jv_object_iter_valid(jv object, int i) { return i != ITER_FINISHED; } int jv_object_iter(jv object) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); return jv_object_iter_next(object, -1); } int jv_object_iter_next(jv object, int iter) { assert(JVP_HAS_KIND(object, JV_KIND_OBJECT)); assert(iter != ITER_FINISHED); struct object_slot* slot; do { iter++; if (iter >= jvp_object_size(object)) return ITER_FINISHED; slot = jvp_object_get_slot(object, iter); } while (jv_get_kind(slot->string) == JV_KIND_NULL); assert(jv_get_kind(jvp_object_get_slot(object,iter)->string) == JV_KIND_STRING); return iter; } jv jv_object_iter_key(jv object, int iter) { jv s = jvp_object_get_slot(object, iter)->string; assert(JVP_HAS_KIND(s, JV_KIND_STRING)); return jv_copy(s); } jv jv_object_iter_value(jv object, int iter) { return jv_copy(jvp_object_get_slot(object, iter)->value); } /* * Memory management */ jv jv_copy(jv j) { if (JVP_IS_ALLOCATED(j)) { jvp_refcnt_inc(j.u.ptr); } return j; } /* * Free children iteratively via a heap-allocated buffer to avoid * recursion through jv_free, which would cause stack overflow on * deeply nested values. */ void jv_free(jv j) { jv* pending = NULL; size_t len = 0, cap = 0; while (1) { switch (JVP_KIND(j)) { case JV_KIND_ARRAY: if (jvp_refcnt_dec(j.u.ptr)) { jvp_array* arr = jvp_array_ptr(j); if (len + arr->length > cap) { cap = (len + arr->length) * 2; pending = jv_mem_realloc(pending, cap * sizeof(jv)); } for (int i = 0; i < arr->length; i++) pending[len++] = arr->elements[i]; jv_mem_free(arr); } break; case JV_KIND_OBJECT: if (jvp_refcnt_dec(j.u.ptr)) { int sz = jvp_object_size(j); if (len + sz > cap) { cap = (len + sz) * 2; pending = jv_mem_realloc(pending, cap * sizeof(jv)); } for (int i = 0; i < sz; i++) { struct object_slot* slot = jvp_object_get_slot(j, i); if (jv_get_kind(slot->string) != JV_KIND_NULL) { jvp_string_free(slot->string); pending[len++] = slot->value; } } jv_mem_free(jvp_object_ptr(j)); } break; case JV_KIND_INVALID: if (JVP_HAS_FLAGS(j, JVP_FLAGS_INVALID_MSG) && jvp_refcnt_dec(j.u.ptr)) { if (len + 1 > cap) { cap = (len + 1) * 2; pending = jv_mem_realloc(pending, cap * sizeof(jv)); } pending[len++] = ((jvp_invalid*)j.u.ptr)->errmsg; jv_mem_free(j.u.ptr); } break; case JV_KIND_STRING: jvp_string_free(j); break; case JV_KIND_NUMBER: jvp_number_free(j); break; } if (len == 0) break; j = pending[--len]; } jv_mem_free(pending); } int jv_get_refcnt(jv j) { if (JVP_IS_ALLOCATED(j)) { return j.u.ptr->count; } else { return 1; } } /* * Higher-level operations */ #ifndef MAX_EQUAL_DEPTH #define MAX_EQUAL_DEPTH (10000) #endif static int jvp_equal(jv a, jv b, int depth) { if (depth > MAX_EQUAL_DEPTH) { jv_free(a); jv_free(b); return -1; } int r; if (jv_get_kind(a) != jv_get_kind(b)) { r = 0; } else if (JVP_IS_ALLOCATED(a) && JVP_IS_ALLOCATED(b) && a.kind_flags == b.kind_flags && a.size == b.size && a.u.ptr == b.u.ptr) { r = 1; } else { switch (jv_get_kind(a)) { case JV_KIND_NUMBER: r = jvp_number_equal(a, b); break; case JV_KIND_ARRAY: r = jvp_array_equal(a, b, depth + 1); break; case JV_KIND_STRING: r = jvp_string_equal(a, b); break; case JV_KIND_OBJECT: r = jvp_object_equal(a, b, depth + 1); break; default: r = 1; break; } } jv_free(a); jv_free(b); return r; } // Returns 1 if equal, 0 if not equal, or -1 if the comparison is too deep int jv_equal(jv a, jv b) { return jvp_equal(a, b, 0); } int jv_identical(jv a, jv b) { int r; if (a.kind_flags != b.kind_flags || a.offset != b.offset || a.size != b.size) { r = 0; } else { if (JVP_IS_ALLOCATED(a) /* b has the same flags */) { r = a.u.ptr == b.u.ptr; } else { r = memcmp(&a.u.ptr, &b.u.ptr, sizeof(a.u)) == 0; } } jv_free(a); jv_free(b); return r; } #ifndef MAX_CONTAINS_DEPTH #define MAX_CONTAINS_DEPTH (10000) #endif static int jvp_contains(jv a, jv b, int depth) { if (depth > MAX_CONTAINS_DEPTH) { jv_free(a); jv_free(b); return -1; } int r = 1; if (jv_get_kind(a) != jv_get_kind(b)) { r = 0; } else if (JVP_HAS_KIND(a, JV_KIND_OBJECT)) { r = jvp_object_contains(a, b, depth + 1); } else if (JVP_HAS_KIND(a, JV_KIND_ARRAY)) { r = jvp_array_contains(a, b, depth + 1); } else if (JVP_HAS_KIND(a, JV_KIND_STRING)) { int b_len = jv_string_length_bytes(jv_copy(b)); if (b_len != 0) { r = _jq_memmem(jv_string_value(a), jv_string_length_bytes(jv_copy(a)), jv_string_value(b), b_len) != 0; } else { r = 1; } } else { r = jv_equal(jv_copy(a), jv_copy(b)); } jv_free(a); jv_free(b); return r; } // Returns 1 (contained), 0 (not contained), or -1 (too deep) int jv_contains(jv a, jv b) { return jvp_contains(a, b, 0); } jq-1.8.2/src/builtin.c0000644000175100017510000020113315215513536010226 #if __SIZEOF_POINTER__==4 # define _TIME_BITS 64 #endif #ifndef __sun__ # define _XOPEN_SOURCE # define _XOPEN_SOURCE_EXTENDED 1 #else # define _XPG6 # define __EXTENSIONS__ #endif #ifdef __OpenBSD__ # define _BSD_SOURCE #endif #include #include #include #include #include #include #include #ifdef HAVE_LIBONIG #include #endif #include #include #ifdef WIN32 #include #endif #include "builtin.h" #include "compile.h" #include "jq_parser.h" #include "bytecode.h" #include "linker.h" #include "locfile.h" #include "jv_unicode.h" #include "jv_alloc.h" #include "jv_dtoa.h" #include "jv_dtoa_tsd.h" #include "jv_private.h" #include "util.h" #define BINOP(name) \ static jv f_ ## name(jq_state *jq, jv input, jv a, jv b) { \ jv_free(input); \ return binop_ ## name(a, b); \ } BINOPS #undef BINOP static jv type_error(jv bad, const char* msg) { char errbuf[30]; const char *badkind = jv_kind_name(jv_get_kind(bad)); jv err = jv_invalid_with_msg(jv_string_fmt( "%s (%s) %s", badkind, jv_dump_string_trunc(bad, errbuf, sizeof(errbuf)), msg)); return err; } static jv type_error2(jv bad1, jv bad2, const char* msg) { char errbuf1[30], errbuf2[30]; const char *badkind1 = jv_kind_name(jv_get_kind(bad1)); const char *badkind2 = jv_kind_name(jv_get_kind(bad2)); jv err = jv_invalid_with_msg(jv_string_fmt( "%s (%s) and %s (%s) %s", badkind1, jv_dump_string_trunc(bad1, errbuf1, sizeof(errbuf1)), badkind2, jv_dump_string_trunc(bad2, errbuf2, sizeof(errbuf2)), msg)); return err; } static inline jv ret_error(jv bad, jv msg) { jv_free(bad); return jv_invalid_with_msg(msg); } static inline jv ret_error2(jv bad1, jv bad2, jv msg) { jv_free(bad1); jv_free(bad2); return jv_invalid_with_msg(msg); } jv binop_plus(jv a, jv b) { if (jv_get_kind(a) == JV_KIND_NULL) { jv_free(a); return b; } else if (jv_get_kind(b) == JV_KIND_NULL) { jv_free(b); return a; } else if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) { jv r = jv_number(jv_number_value(a) + jv_number_value(b)); jv_free(a); jv_free(b); return r; } else if (jv_get_kind(a) == JV_KIND_STRING && jv_get_kind(b) == JV_KIND_STRING) { return jv_string_concat(a, b); } else if (jv_get_kind(a) == JV_KIND_ARRAY && jv_get_kind(b) == JV_KIND_ARRAY) { return jv_array_concat(a, b); } else if (jv_get_kind(a) == JV_KIND_OBJECT && jv_get_kind(b) == JV_KIND_OBJECT) { return jv_object_merge(a, b); } else { return type_error2(a, b, "cannot be added"); } } #ifdef __APPLE__ // macOS has a bunch of libm deprecation warnings, so let's clean those up #ifdef HAVE_TGAMMA #define HAVE_GAMMA #define gamma tgamma #endif #ifdef HAVE___EXP10 #define HAVE_EXP10 #define exp10 __exp10 #endif #ifdef HAVE_REMAINDER #define HAVE_DREM #define drem remainder #endif // We replace significand with our own, since there's not a rename-replacement #ifdef HAVE_FREXP static double __jq_significand(double x) { int z; return 2*frexp(x, &z); } #define HAVE_SIGNIFICAND #define significand __jq_significand #elif defined(HAVE_SCALBN) && defined(HAVE_ILOGB) static double __jq_significand(double x) { return scalbn(x, -ilogb(x)); } #define HAVE_SIGNIFICAND #define significand __jq_significand #endif #endif // ifdef __APPLE__ #define LIBM_DD(name) \ static jv f_ ## name(jq_state *jq, jv input) { \ if (jv_get_kind(input) != JV_KIND_NUMBER) { \ return type_error(input, "number required"); \ } \ jv ret = jv_number(name(jv_number_value(input))); \ jv_free(input); \ return ret; \ } #define LIBM_DD_NO(name) \ static jv f_ ## name(jq_state *jq, jv input) { \ jv error = jv_string("Error: " #name "/0 not found at build time"); \ return ret_error(input, error); \ } #define LIBM_DDD(name) \ static jv f_ ## name(jq_state *jq, jv input, jv a, jv b) { \ jv_free(input); \ if (jv_get_kind(a) != JV_KIND_NUMBER) { \ jv_free(b); \ return type_error(a, "number required"); \ } \ if (jv_get_kind(b) != JV_KIND_NUMBER) { \ jv_free(a); \ return type_error(b, "number required"); \ } \ jv ret = jv_number(name(jv_number_value(a), jv_number_value(b))); \ jv_free(a); \ jv_free(b); \ return ret; \ } #define LIBM_DDD_NO(name) \ static jv f_ ## name(jq_state *jq, jv input, jv a, jv b) { \ jv_free(b); \ jv error = jv_string("Error: " #name "/2 not found at build time"); \ return ret_error2(input, a, error); \ } #define LIBM_DDDD(name) \ static jv f_ ## name(jq_state *jq, jv input, jv a, jv b, jv c) { \ jv_free(input); \ if (jv_get_kind(a) != JV_KIND_NUMBER) { \ jv_free(b); \ jv_free(c); \ return type_error(a, "number required"); \ } \ if (jv_get_kind(b) != JV_KIND_NUMBER) { \ jv_free(a); \ jv_free(c); \ return type_error(b, "number required"); \ } \ if (jv_get_kind(c) != JV_KIND_NUMBER) { \ jv_free(a); \ jv_free(b); \ return type_error(c, "number required"); \ } \ jv ret = jv_number(name(jv_number_value(a), jv_number_value(b), jv_number_value(c))); \ jv_free(a); \ jv_free(b); \ jv_free(c); \ return ret; \ } #define LIBM_DDDD_NO(name) \ static jv f_ ## name(jq_state *jq, jv input, jv a, jv b, jv c) { \ jv_free(c); \ jv_free(b); \ jv error = jv_string("Error: " #name "/3 not found at build time"); \ return ret_error2(input, a, error); \ } #define LIBM_DA(name, type) \ static jv f_ ## name(jq_state *jq, jv input) { \ if (jv_get_kind(input) != JV_KIND_NUMBER) { \ return type_error(input, "number required"); \ } \ type value; \ double d = name(jv_number_value(input), &value); \ jv ret = JV_ARRAY(jv_number(d), jv_number(value)); \ jv_free(input); \ return ret; \ } #define LIBM_DA_NO(name, type) \ static jv f_ ## name(jq_state *jq, jv input) { \ jv error = jv_string("Error: " #name "/0 not found at build time"); \ return ret_error(input, error); \ } #include "libm.h" #undef LIBM_DDDD_NO #undef LIBM_DDD_NO #undef LIBM_DD_NO #undef LIBM_DA_NO #undef LIBM_DDDD #undef LIBM_DDD #undef LIBM_DD #undef LIBM_DA #ifdef __APPLE__ #undef gamma #undef drem #undef significand #undef exp10 #endif static jv f_negate(jq_state *jq, jv input) { if (jv_get_kind(input) != JV_KIND_NUMBER) { return type_error(input, "cannot be negated"); } jv ret = jv_number_negate(input); jv_free(input); return ret; } static jv f_startswith(jq_state *jq, jv a, jv b) { if (jv_get_kind(a) != JV_KIND_STRING || jv_get_kind(b) != JV_KIND_STRING) return ret_error2(a, b, jv_string("startswith() requires string inputs")); int alen = jv_string_length_bytes(jv_copy(a)); int blen = jv_string_length_bytes(jv_copy(b)); jv ret; if (blen <= alen && memcmp(jv_string_value(a), jv_string_value(b), blen) == 0) ret = jv_true(); else ret = jv_false(); jv_free(a); jv_free(b); return ret; } static jv f_endswith(jq_state *jq, jv a, jv b) { if (jv_get_kind(a) != JV_KIND_STRING || jv_get_kind(b) != JV_KIND_STRING) return ret_error2(a, b, jv_string("endswith() requires string inputs")); const char *astr = jv_string_value(a); const char *bstr = jv_string_value(b); size_t alen = jv_string_length_bytes(jv_copy(a)); size_t blen = jv_string_length_bytes(jv_copy(b)); jv ret; if (alen < blen || memcmp(astr + (alen - blen), bstr, blen) != 0) ret = jv_false(); else ret = jv_true(); jv_free(a); jv_free(b); return ret; } jv binop_minus(jv a, jv b) { if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) { jv r = jv_number(jv_number_value(a) - jv_number_value(b)); jv_free(a); jv_free(b); return r; } else if (jv_get_kind(a) == JV_KIND_ARRAY && jv_get_kind(b) == JV_KIND_ARRAY) { jv out = jv_array(); jv_array_foreach(a, i, x) { int include = 1; jv_array_foreach(b, j, y) { int equal = jv_equal(jv_copy(x), y); if (equal < 0) { jv_free(out); jv_free(x); jv_free(a); jv_free(b); return jv_invalid_with_msg(jv_string("Equality check too deep")); } if (equal) { include = 0; break; } } if (include) out = jv_array_append(out, jv_copy(x)); jv_free(x); } jv_free(a); jv_free(b); return out; } else { return type_error2(a, b, "cannot be subtracted"); } } jv binop_multiply(jv a, jv b) { jv_kind ak = jv_get_kind(a); jv_kind bk = jv_get_kind(b); if (ak == JV_KIND_NUMBER && bk == JV_KIND_NUMBER) { jv r = jv_number(jv_number_value(a) * jv_number_value(b)); jv_free(a); jv_free(b); return r; } else if ((ak == JV_KIND_STRING && bk == JV_KIND_NUMBER) || (ak == JV_KIND_NUMBER && bk == JV_KIND_STRING)) { jv str = a; jv num = b; if (ak == JV_KIND_NUMBER) { str = b; num = a; } double d = jv_number_value(num); jv_free(num); return jv_string_repeat(str, d < 0 || isnan(d) ? -1 : d > INT_MAX ? INT_MAX : (int)d); } else if (ak == JV_KIND_OBJECT && bk == JV_KIND_OBJECT) { return jv_object_merge_recursive(a, b); } else { return type_error2(a, b, "cannot be multiplied"); } } jv binop_divide(jv a, jv b) { if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) { if (jv_number_value(b) == 0.0) return type_error2(a, b, "cannot be divided because the divisor is zero"); jv r = jv_number(jv_number_value(a) / jv_number_value(b)); jv_free(a); jv_free(b); return r; } else if (jv_get_kind(a) == JV_KIND_STRING && jv_get_kind(b) == JV_KIND_STRING) { return jv_string_split(a, b); } else { return type_error2(a, b, "cannot be divided"); } } #define dtoi(n) ((n) < INTMAX_MIN ? INTMAX_MIN : -(n) <= INTMAX_MIN ? INTMAX_MAX : (intmax_t)(n)) jv binop_mod(jv a, jv b) { if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) { double na = jv_number_value(a); double nb = jv_number_value(b); if (isnan(na) || isnan(nb)) { jv_free(a); jv_free(b); return jv_number(NAN); } intmax_t bi = dtoi(nb); if (bi == 0) return type_error2(a, b, "cannot be divided (remainder) because the divisor is zero"); // Check if the divisor is -1 to avoid overflow when the dividend is INTMAX_MIN. jv r = jv_number(bi == -1 ? 0 : dtoi(na) % bi); jv_free(a); jv_free(b); return r; } else { return type_error2(a, b, "cannot be divided (remainder)"); } } #undef dtoi jv binop_equal(jv a, jv b) { int r = jv_equal(a, b); if (r < 0) return jv_invalid_with_msg(jv_string("Equality check too deep")); return jv_bool(r); } jv binop_notequal(jv a, jv b) { int r = jv_equal(a, b); if (r < 0) return jv_invalid_with_msg(jv_string("Equality check too deep")); return jv_bool(!r); } enum cmp_op { CMP_OP_LESS, CMP_OP_GREATER, CMP_OP_LESSEQ, CMP_OP_GREATEREQ }; static jv order_cmp(jv a, jv b, enum cmp_op op) { int r = jv_cmp(a, b); if (r == INT_MIN) return jv_invalid_with_msg(jv_string("Comparison too deep")); return jv_bool((op == CMP_OP_LESS && r < 0) || (op == CMP_OP_LESSEQ && r <= 0) || (op == CMP_OP_GREATEREQ && r >= 0) || (op == CMP_OP_GREATER && r > 0)); } jv binop_less(jv a, jv b) { return order_cmp(a, b, CMP_OP_LESS); } jv binop_greater(jv a, jv b) { return order_cmp(a, b, CMP_OP_GREATER); } jv binop_lesseq(jv a, jv b) { return order_cmp(a, b, CMP_OP_LESSEQ); } jv binop_greatereq(jv a, jv b) { return order_cmp(a, b, CMP_OP_GREATEREQ); } static jv f_contains(jq_state *jq, jv a, jv b) { if (jv_get_kind(a) == jv_get_kind(b)) { int r = jv_contains(a, b); if (r < 0) return jv_invalid_with_msg(jv_string("Containment check too deep")); return jv_bool(r); } else { return type_error2(a, b, "cannot have their containment checked"); } } static jv f_dump(jq_state *jq, jv input) { return jv_dump_string(input, 0); } static jv f_json_parse(jq_state *jq, jv input) { if (jv_get_kind(input) != JV_KIND_STRING) return type_error(input, "only strings can be parsed"); jv res = jv_parse_sized(jv_string_value(input), jv_string_length_bytes(jv_copy(input))); jv_free(input); return res; } static jv f_tonumber(jq_state *jq, jv input) { if (jv_get_kind(input) == JV_KIND_NUMBER) { return input; } if (jv_get_kind(input) == JV_KIND_STRING) { const char* s = jv_string_value(input); int len = jv_string_length_bytes(jv_copy(input)); if ((size_t)len != strlen(s)) { return type_error(input, "cannot be parsed as a number"); } #ifdef USE_DECNUM jv number = jv_number_with_literal(s); if (jv_get_kind(number) == JV_KIND_INVALID) { return type_error(input, "cannot be parsed as a number"); } #else char *end = 0; double d = jvp_strtod(tsd_dtoa_context_get(), s, &end); if (end == 0 || *end != 0) { return type_error(input, "cannot be parsed as a number"); } jv number = jv_number(d); #endif jv_free(input); return number; } return type_error(input, "cannot be parsed as a number"); } static jv f_toboolean(jq_state *jq, jv input) { if (jv_get_kind(input) == JV_KIND_TRUE || jv_get_kind(input) == JV_KIND_FALSE) { return input; } if (jv_get_kind(input) == JV_KIND_STRING) { const char *s = jv_string_value(input); int len = jv_string_length_bytes(jv_copy(input)); if ((size_t)len != strlen(s)) { return type_error(input, "cannot be parsed as a boolean"); } if (strcmp(s, "true") == 0) { jv_free(input); return jv_true(); } else if (strcmp(s, "false") == 0) { jv_free(input); return jv_false(); } } return type_error(input, "cannot be parsed as a boolean"); } static jv f_length(jq_state *jq, jv input) { if (jv_get_kind(input) == JV_KIND_ARRAY) { return jv_number(jv_array_length(input)); } else if (jv_get_kind(input) == JV_KIND_OBJECT) { return jv_number(jv_object_length(input)); } else if (jv_get_kind(input) == JV_KIND_STRING) { return jv_number(jv_string_length_codepoints(input)); } else if (jv_get_kind(input) == JV_KIND_NUMBER) { jv r = jv_number_abs(input); jv_free(input); return r; } else if (jv_get_kind(input) == JV_KIND_NULL) { jv_free(input); return jv_number(0); } else { return type_error(input, "has no length"); } } static jv f_tostring(jq_state *jq, jv input) { if (jv_get_kind(input) == JV_KIND_STRING) { return input; } else { return jv_dump_string(input, 0); } } static jv f_utf8bytelength(jq_state *jq, jv input) { if (jv_get_kind(input) != JV_KIND_STRING) return type_error(input, "only strings have UTF-8 byte length"); return jv_number(jv_string_length_bytes(input)); } static const unsigned char URI_UNRESERVED[128] = { // 1 2 3 4 5 6 7 8 9 A B C D E F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, // 0x20: - . 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 0x30: 0-9 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40: A-O 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 0x50: P-Z _ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60: a-o 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, // 0x70: p-z ~ }; #define CHARS_ALPHANUM "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" static const unsigned char BASE64_ENCODE_TABLE[64 + 1] = CHARS_ALPHANUM "+/"; static const unsigned char BASE64_INVALID_ENTRY = 0xFF; static const unsigned char BASE64_DECODE_TABLE[256] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 62, // + 0xFF, 0xFF, 0xFF, 63, // / 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // 0-9 0xFF, 0xFF, 0xFF, 99, // = 0xFF, 0xFF, 0xFF, 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, // A-Z 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 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, // a-z 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; static jv escape_string(jv input, const char* escapings) { assert(jv_get_kind(input) == JV_KIND_STRING); const char* lookup[128] = {0}; const char* p = escapings; lookup[0] = "\\0"; while (*p) { lookup[(int)*p] = p+1; p++; p += strlen(p); p++; } jv ret = jv_string(""); const char* i = jv_string_value(input); const char* end = i + jv_string_length_bytes(jv_copy(input)); const char* cstart; int c = 0; while ((i = jvp_utf8_next((cstart = i), end, &c))) { if (c < 128 && lookup[c]) { ret = jv_string_append_str(ret, lookup[c]); } else { ret = jv_string_append_buf(ret, cstart, i - cstart); } } jv_free(input); return ret; } static jv f_format(jq_state *jq, jv input, jv fmt) { if (jv_get_kind(fmt) != JV_KIND_STRING) { jv_free(input); return type_error(fmt, "is not a valid format"); } const char* fmt_s = jv_string_value(fmt); if (!strcmp(fmt_s, "json")) { jv_free(fmt); return jv_dump_string(input, 0); } else if (!strcmp(fmt_s, "text")) { jv_free(fmt); return f_tostring(jq, input); } else if (!strcmp(fmt_s, "csv") || !strcmp(fmt_s, "tsv")) { const char *quotes, *sep, *escapings; const char *msg; if (!strcmp(fmt_s, "csv")) { msg = "cannot be csv-formatted, only array"; quotes = "\""; sep = ","; escapings = "\"\"\"\0"; } else { msg = "cannot be tsv-formatted, only array"; assert(!strcmp(fmt_s, "tsv")); quotes = ""; sep = "\t"; escapings = "\t\\t\0\r\\r\0\n\\n\0\\\\\\\0"; } jv_free(fmt); if (jv_get_kind(input) != JV_KIND_ARRAY) return type_error(input, msg); jv line = jv_string(""); jv_array_foreach(input, i, x) { if (i) line = jv_string_append_str(line, sep); switch (jv_get_kind(x)) { case JV_KIND_NULL: /* null rendered as empty string */ jv_free(x); break; case JV_KIND_TRUE: case JV_KIND_FALSE: line = jv_string_concat(line, jv_dump_string(x, 0)); break; case JV_KIND_NUMBER: if (jv_number_value(x) != jv_number_value(x)) { /* NaN, render as empty string */ jv_free(x); } else { line = jv_string_concat(line, jv_dump_string(x, 0)); } break; case JV_KIND_STRING: { line = jv_string_append_str(line, quotes); line = jv_string_concat(line, escape_string(x, escapings)); line = jv_string_append_str(line, quotes); break; } default: jv_free(input); jv_free(line); return type_error(x, "is not valid in a csv row"); } } jv_free(input); return line; } else if (!strcmp(fmt_s, "html")) { jv_free(fmt); return escape_string(f_tostring(jq, input), "&&\0<<\0>>\0''\0\""\0"); } else if (!strcmp(fmt_s, "uri")) { jv_free(fmt); input = f_tostring(jq, input); const char* s = jv_string_value(input); int len = jv_string_length_bytes(jv_copy(input)); char *result = jv_mem_alloc((size_t)len * 3 + 1); uint32_t ri = 0; for (int i = 0; i < len; i++) { unsigned c = (unsigned)(unsigned char)s[i]; if (c < 128 && URI_UNRESERVED[c]) { result[ri++] = (char)c; } else { result[ri++] = '%'; result[ri++] = "0123456789ABCDEF"[c >> 4]; result[ri++] = "0123456789ABCDEF"[c & 0x0F]; } } jv line = jv_string_sized(result, ri); free(result); jv_free(input); return line; } else if (!strcmp(fmt_s, "urid")) { jv_free(fmt); input = f_tostring(jq, input); const char *errmsg = "is not a valid uri encoding"; const char *s = jv_string_value(input); int len = jv_string_length_bytes(jv_copy(input)); char *result = jv_mem_alloc((size_t)len + 1); uint32_t ri = 0; for (int i = 0; i < len; i++) { char c = s[i]; if (c != '%') { result[ri++] = c; } else { int hi = 0, lo = 0; for (int j = 0; j < 2; j++) { if (++i >= len) { free(result); return type_error(input, errmsg); } int *d = j == 0 ? &hi : &lo; c = s[i]; if ('0' <= c && c <= '9') *d = c - '0'; else if ('a' <= c && c <= 'f') *d = c - 'a' + 10; else if ('A' <= c && c <= 'F') *d = c - 'A' + 10; else { free(result); return type_error(input, errmsg); } } result[ri++] = (hi << 4) | lo; } } if (!jvp_utf8_is_valid(result, result + ri)) { free(result); return type_error(input, errmsg); } jv line = jv_string_sized(result, ri); free(result); jv_free(input); return line; } else if (!strcmp(fmt_s, "sh")) { jv_free(fmt); if (jv_get_kind(input) != JV_KIND_ARRAY) input = jv_array_set(jv_array(), 0, input); jv line = jv_string(""); jv_array_foreach(input, i, x) { if (i) line = jv_string_append_str(line, " "); switch (jv_get_kind(x)) { case JV_KIND_NULL: case JV_KIND_TRUE: case JV_KIND_FALSE: case JV_KIND_NUMBER: line = jv_string_concat(line, jv_dump_string(x, 0)); break; case JV_KIND_STRING: { line = jv_string_append_str(line, "'"); line = jv_string_concat(line, escape_string(x, "''\\''\0")); line = jv_string_append_str(line, "'"); break; } default: jv_free(input); jv_free(line); return type_error(x, "can not be escaped for shell"); } } jv_free(input); return line; } else if (!strcmp(fmt_s, "base64")) { jv_free(fmt); input = f_tostring(jq, input); jv line = jv_string(""); const unsigned char* data = (const unsigned char*)jv_string_value(input); int len = jv_string_length_bytes(jv_copy(input)); for (int i=0; i= 3 ? 3 : len-i; for (int j=0; j<3; j++) { code <<= 8; code |= j < n ? (unsigned)data[i+j] : 0; } char buf[4]; for (int j=0; j<4; j++) { buf[j] = BASE64_ENCODE_TABLE[(code >> (18 - j*6)) & 0x3f]; } if (n < 3) buf[3] = '='; if (n < 2) buf[2] = '='; line = jv_string_append_buf(line, buf, sizeof(buf)); } jv_free(input); return line; } else if (!strcmp(fmt_s, "base64d")) { jv_free(fmt); input = f_tostring(jq, input); const unsigned char* data = (const unsigned char*)jv_string_value(input); int len = jv_string_length_bytes(jv_copy(input)); size_t decoded_len = MAX((3 * (size_t)len) / 4, (size_t)1); // 3 usable bytes for every 4 bytes of input char *result = jv_mem_calloc(decoded_len, sizeof(char)); uint32_t ri = 0; int input_bytes_read=0; uint32_t code = 0; for (int i=0; i> 16) & 0xFF; result[ri++] = (code >> 8) & 0xFF; result[ri++] = code & 0xFF; input_bytes_read = 0; code = 0; } } if (input_bytes_read == 3) { result[ri++] = (code >> 10) & 0xFF; result[ri++] = (code >> 2) & 0xFF; } else if (input_bytes_read == 2) { result[ri++] = (code >> 4) & 0xFF; } else if (input_bytes_read == 1) { free(result); return type_error(input, "trailing base64 byte found"); } jv line = jv_string_sized(result, ri); jv_free(input); free(result); return line; } else { jv_free(input); return jv_invalid_with_msg(jv_string_concat(fmt, jv_string(" is not a valid format"))); } } static jv f_keys(jq_state *jq, jv input) { if (jv_get_kind(input) == JV_KIND_OBJECT || jv_get_kind(input) == JV_KIND_ARRAY) { return jv_keys(input); } else { return type_error(input, "has no keys"); } } static jv f_keys_unsorted(jq_state *jq, jv input) { if (jv_get_kind(input) == JV_KIND_OBJECT || jv_get_kind(input) == JV_KIND_ARRAY) { return jv_keys_unsorted(input); } else { return type_error(input, "has no keys"); } } static jv f_sort(jq_state *jq, jv input){ if (jv_get_kind(input) == JV_KIND_ARRAY) { return jv_sort(input, jv_copy(input)); } else { return type_error(input, "cannot be sorted, as it is not an array"); } } static jv f_sort_by_impl(jq_state *jq, jv input, jv keys) { if (jv_get_kind(input) == JV_KIND_ARRAY && jv_get_kind(keys) == JV_KIND_ARRAY && jv_array_length(jv_copy(input)) == jv_array_length(jv_copy(keys))) { return jv_sort(input, keys); } else { return type_error2(input, keys, "cannot be sorted, as they are not both arrays"); } } /* * Assuming the input array is sorted, bsearch/1 returns * the index of the target if the target is in the input array; and otherwise * (-1 - ix), where ix is the insertion point that would leave the array sorted. * If the input is not sorted, bsearch will terminate but with irrelevant results. */ static jv f_bsearch(jq_state *jq, jv input, jv target) { if (jv_get_kind(input) != JV_KIND_ARRAY) { jv_free(target); return type_error(input, "cannot be searched from"); } int start = 0; int end = jv_array_length(jv_copy(input)); jv answer = jv_invalid(); while (start < end) { int mid = start + (end - start) / 2; int result = jv_cmp(jv_copy(target), jv_array_get(jv_copy(input), mid)); if (result == INT_MIN) { jv_free(answer); jv_free(input); jv_free(target); return jv_invalid_with_msg(jv_string("Comparison too deep")); } if (result == 0) { answer = jv_number(mid); break; } else if (result < 0) { end = mid; } else { start = mid + 1; } } if (!jv_is_valid(answer)) { answer = jv_number(-1 - start); } jv_free(input); jv_free(target); return answer; } static jv f_group_by_impl(jq_state *jq, jv input, jv keys) { if (jv_get_kind(input) == JV_KIND_ARRAY && jv_get_kind(keys) == JV_KIND_ARRAY && jv_array_length(jv_copy(input)) == jv_array_length(jv_copy(keys))) { return jv_group(input, keys); } else { return type_error2(input, keys, "cannot be sorted, as they are not both arrays"); } } static jv f_unique(jq_state *jq, jv input) { if (jv_get_kind(input) == JV_KIND_ARRAY) { return jv_unique(input, jv_copy(input)); } else { return type_error(input, "cannot be sorted, as it is not an array"); } } static jv f_unique_by_impl(jq_state *jq, jv input, jv keys) { if (jv_get_kind(input) == JV_KIND_ARRAY && jv_get_kind(keys) == JV_KIND_ARRAY && jv_array_length(jv_copy(input)) == jv_array_length(jv_copy(keys))) { return jv_unique(input, keys); } else { return type_error2(input, keys, "cannot be sorted, as they are not both arrays"); } } #ifdef HAVE_LIBONIG static int f_match_name_iter(const UChar* name, const UChar *name_end, int ngroups, int *groups, regex_t *reg, void *arg) { jv captures = *(jv*)arg; for (int i = 0; i < ngroups; ++i) { jv cap = jv_array_get(jv_copy(captures),groups[i]-1); if (jv_get_kind(cap) == JV_KIND_OBJECT) { cap = jv_object_set(cap, jv_string("name"), jv_string_sized((const char*)name, name_end-name)); captures = jv_array_set(captures,groups[i]-1,cap); } else { jv_free(cap); } } *(jv *)arg = captures; return 0; } static jv f_match(jq_state *jq, jv input, jv regex, jv modifiers, jv testmode) { int test = jv_equal(testmode, jv_true()); jv result; int onigret; int global = 0; regex_t *reg; OnigErrorInfo einfo; OnigRegion* region; if (jv_get_kind(input) != JV_KIND_STRING) { jv_free(regex); jv_free(modifiers); return type_error(input, "cannot be matched, as it is not a string"); } if (jv_get_kind(regex) != JV_KIND_STRING) { jv_free(input); jv_free(modifiers); return type_error(regex, "is not a string"); } OnigOptionType options = ONIG_OPTION_CAPTURE_GROUP; if (jv_get_kind(modifiers) == JV_KIND_STRING) { jv modarray = jv_string_explode(jv_copy(modifiers)); jv_array_foreach(modarray, i, mod) { switch ((int)jv_number_value(mod)) { case 'g': global = 1; break; case 'i': options |= ONIG_OPTION_IGNORECASE; break; case 'x': options |= ONIG_OPTION_EXTEND; break; case 'm': options |= ONIG_OPTION_MULTILINE; break; case 's': options |= ONIG_OPTION_SINGLELINE; break; case 'p': options |= ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE; break; case 'l': options |= ONIG_OPTION_FIND_LONGEST; break; case 'n': options |= ONIG_OPTION_FIND_NOT_EMPTY; break; default: jv_free(input); jv_free(regex); jv_free(modarray); return jv_invalid_with_msg(jv_string_concat(modifiers, jv_string(" is not a valid modifier string"))); } } jv_free(modarray); } else if (jv_get_kind(modifiers) != JV_KIND_NULL) { // If it isn't a string or null, then it is the wrong type... jv_free(input); jv_free(regex); return type_error(modifiers, "is not a string"); } jv_free(modifiers); onigret = onig_new(®, (const UChar*)jv_string_value(regex), (const UChar*)(jv_string_value(regex) + jv_string_length_bytes(jv_copy(regex))), options, ONIG_ENCODING_UTF8, ONIG_SYNTAX_PERL_NG, &einfo); if (onigret != ONIG_NORMAL) { UChar ebuf[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(ebuf, onigret, &einfo); jv_free(input); jv_free(regex); return jv_invalid_with_msg(jv_string_concat(jv_string("Regex failure: "), jv_string((char*)ebuf))); } result = test ? jv_false() : jv_array(); const char *input_string = jv_string_value(input); const UChar* start = (const UChar*)jv_string_value(input); const unsigned long length = jv_string_length_bytes(jv_copy(input)); const UChar* end = start + length; region = onig_region_new(); do { onigret = onig_search(reg, (const UChar*)jv_string_value(input), end, /* string boundaries */ start, end, /* search boundaries */ region, ONIG_OPTION_NONE); if (onigret >= 0) { if (test) { result = jv_true(); break; } // Zero-width match if (region->end[0] == region->beg[0]) { unsigned long idx; const char *fr = (const char*)input_string; for (idx = 0; fr < input_string+region->beg[0]; idx++) { fr += jvp_utf8_decode_length(*fr); } jv match = jv_object_set(jv_object(), jv_string("offset"), jv_number(idx)); match = jv_object_set(match, jv_string("length"), jv_number(0)); match = jv_object_set(match, jv_string("string"), jv_string("")); jv captures = jv_array(); for (int i = 1; i < region->num_regs; ++i) { jv cap = jv_object(); if (region->beg[i] == -1) { cap = jv_object_set(cap, jv_string("offset"), jv_number(-1)); cap = jv_object_set(cap, jv_string("string"), jv_null()); } else { cap = jv_object_set(cap, jv_string("offset"), jv_number(idx)); cap = jv_object_set(cap, jv_string("string"), jv_string("")); } cap = jv_object_set(cap, jv_string("length"), jv_number(0)); cap = jv_object_set(cap, jv_string("name"), jv_null()); captures = jv_array_append(captures, cap); } onig_foreach_name(reg, f_match_name_iter, &captures); match = jv_object_set(match, jv_string("captures"), captures); result = jv_array_append(result, match); // ensure '"qux" | match("(?=u)"; "g")' matches just once start = (const UChar*)(input_string+region->end[0]+1); continue; } unsigned long idx; unsigned long len; const char *fr = (const char*)input_string; for (idx = len = 0; fr < input_string+region->end[0]; len++) { if (fr == input_string+region->beg[0]) idx = len, len=0; fr += jvp_utf8_decode_length(*fr); } jv match = jv_object_set(jv_object(), jv_string("offset"), jv_number(idx)); unsigned long blen = region->end[0]-region->beg[0]; match = jv_object_set(match, jv_string("length"), jv_number(len)); match = jv_object_set(match, jv_string("string"), jv_string_sized(input_string+region->beg[0],blen)); jv captures = jv_array(); for (int i = 1; i < region->num_regs; ++i) { // Empty capture. if (region->beg[i] == region->end[i]) { // Didn't match. jv cap; if (region->beg[i] == -1) { cap = jv_object_set(jv_object(), jv_string("offset"), jv_number(-1)); cap = jv_object_set(cap, jv_string("string"), jv_null()); } else { fr = input_string; for (idx = 0; fr < input_string+region->beg[i]; idx++) { fr += jvp_utf8_decode_length(*fr); } cap = jv_object_set(jv_object(), jv_string("offset"), jv_number(idx)); cap = jv_object_set(cap, jv_string("string"), jv_string("")); } cap = jv_object_set(cap, jv_string("length"), jv_number(0)); cap = jv_object_set(cap, jv_string("name"), jv_null()); captures = jv_array_append(captures, cap); continue; } fr = input_string; for (idx = len = 0; fr < input_string+region->end[i]; len++) { if (fr == input_string+region->beg[i]) idx = len, len=0; fr += jvp_utf8_decode_length(*fr); } blen = region->end[i]-region->beg[i]; jv cap = jv_object_set(jv_object(), jv_string("offset"), jv_number(idx)); cap = jv_object_set(cap, jv_string("length"), jv_number(len)); cap = jv_object_set(cap, jv_string("string"), jv_string_sized(input_string+region->beg[i],blen)); cap = jv_object_set(cap, jv_string("name"), jv_null()); captures = jv_array_append(captures,cap); } onig_foreach_name(reg,f_match_name_iter,&captures); match = jv_object_set(match, jv_string("captures"), captures); result = jv_array_append(result, match); start = (const UChar*)(input_string+region->end[0]); onig_region_free(region,0); } else if (onigret == ONIG_MISMATCH) { break; } else { /* Error */ UChar ebuf[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str(ebuf, onigret, &einfo); jv_free(result); result = jv_invalid_with_msg(jv_string_concat(jv_string("Regex failure: "), jv_string((char*)ebuf))); break; } } while (global && start <= end); onig_region_free(region,1); region = NULL; onig_free(reg); jv_free(input); jv_free(regex); return result; } #else /* !HAVE_LIBONIG */ static jv f_match(jq_state *jq, jv input, jv regex, jv modifiers, jv testmode) { jv_free(input); jv_free(regex); jv_free(modifiers); jv_free(testmode); return jv_invalid_with_msg(jv_string("jq was compiled without ONIGURUMA regex library. match/test/sub and related functions are not available.")); } #endif /* HAVE_LIBONIG */ static jv minmax_by(jv values, jv keys, int is_min) { if (jv_get_kind(values) != JV_KIND_ARRAY) return type_error2(values, keys, "cannot be iterated over"); if (jv_get_kind(keys) != JV_KIND_ARRAY) return type_error2(values, keys, "cannot be iterated over"); if (jv_array_length(jv_copy(values)) != jv_array_length(jv_copy(keys))) return type_error2(values, keys, "have wrong length"); if (jv_array_length(jv_copy(values)) == 0) { jv_free(values); jv_free(keys); return jv_null(); } jv ret = jv_array_get(jv_copy(values), 0); jv retkey = jv_array_get(jv_copy(keys), 0); for (int i=1; i 0x10FFFF || (nv >= 0xD800 && nv <= 0xDFFF)) nv = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER s = jv_string_append_codepoint(s, nv); if (!jv_is_valid(s)) break; } jv_free(a); return s; } static jv f_setpath(jq_state *jq, jv a, jv b, jv c) { return jv_setpath(a, b, c); } extern jv _jq_path_append(jq_state *, jv, jv, jv); static jv f_getpath(jq_state *jq, jv a, jv b) { return _jq_path_append(jq, a, b, jv_getpath(jv_copy(a), jv_copy(b))); } static jv f_delpaths(jq_state *jq, jv a, jv b) { return jv_delpaths(a, b); } static jv f_has(jq_state *jq, jv a, jv b) { return jv_has(a, b); } static jv f_modulemeta(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_STRING) { return ret_error(a, jv_string("modulemeta input module name must be a string")); } return load_module_meta(jq, a); } static jv f_input(jq_state *jq, jv input) { jv_free(input); jq_input_cb cb; void *data; jq_get_input_cb(jq, &cb, &data); if (cb == NULL) return jv_invalid_with_msg(jv_string("break")); jv v = cb(jq, data); if (jv_is_valid(v) || jv_invalid_has_msg(jv_copy(v))) return v; return jv_invalid_with_msg(jv_string("break")); } static jv f_debug(jq_state *jq, jv input) { jq_msg_cb cb; void *data; jq_get_debug_cb(jq, &cb, &data); if (cb != NULL) cb(data, jv_copy(input)); return input; } static jv f_stderr(jq_state *jq, jv input) { jq_msg_cb cb; void *data; jq_get_stderr_cb(jq, &cb, &data); if (cb != NULL) cb(data, jv_copy(input)); return input; } static jv tm2jv(struct tm *tm, double fsecs) { return JV_ARRAY(jv_number(tm->tm_year + 1900), jv_number(tm->tm_mon), jv_number(tm->tm_mday), jv_number(tm->tm_hour), jv_number(tm->tm_min), jv_number(tm->tm_sec + (fsecs - floor(fsecs))), jv_number(tm->tm_wday), jv_number(tm->tm_yday)); } #if defined(WIN32) && !defined(HAVE_SETENV) static int setenv(const char *var, const char *val, int ovr) { BOOL b; char c[2]; if (!ovr) { DWORD d; d = GetEnvironmentVariableA (var, c, 2); if (0 != d && GetLastError () != ERROR_ENVVAR_NOT_FOUND) { return d; } } b = SetEnvironmentVariableA (var, val); if (b) { return 0; } return 1; } #endif /* * mktime() has side-effects and anyways, returns time in the local * timezone, not UTC. We want timegm(), which isn't standard. * * To make things worse, mktime() tells you what the timezone * adjustment is, but you have to #define _BSD_SOURCE to get this * field of struct tm on some systems. * * This is all to blame on POSIX, of course. * * Our wrapper tries to use timegm() if available, or mktime() and * correct for its side-effects if possible. * * Returns (time_t)-2 if mktime()'s side-effects cannot be corrected. */ static time_t my_mktime(struct tm *tm) { #ifdef HAVE_TIMEGM return timegm(tm); #elif HAVE_TM_TM_GMT_OFF time_t t = mktime(tm); if (t == (time_t)-1) return t; return t + tm->tm_gmtoff; #elif HAVE_TM___TM_GMT_OFF time_t t = mktime(tm); if (t == (time_t)-1) return t; return t + tm->__tm_gmtoff; #elif WIN32 return _mkgmtime(tm); #else char *tz; tz = (tz = getenv("TZ")) != NULL ? strdup(tz) : NULL; if (tz != NULL) setenv("TZ", "", 1); time_t t = mktime(tm); if (tz != NULL) { setenv("TZ", tz, 1); free(tz); } return t; #endif } /* Compute and set tm_wday */ static void set_tm_wday(struct tm *tm) { /* * https://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week#Gauss.27s_algorithm * https://cs.uwaterloo.ca/~alopez-o/math-faq/node73.html * * Tested with dates from 1900-01-01 through 2100-01-01. This * algorithm produces the wrong day-of-the-week number for dates in * the range 1900-01-01..1900-02-28, and for 2100-01-01..2100-02-28. * Since this is only needed on OS X and *BSD, we might just document * this. */ int century = (1900 + tm->tm_year) / 100; int year = (1900 + tm->tm_year) % 100; if (tm->tm_mon < 2) year--; /* * The month value in the wday computation below is shifted so that * March is 1, April is 2, .., January is 11, and February is 12. */ int mon = tm->tm_mon - 1; if (mon < 1) mon += 12; int wday = (tm->tm_mday + (int)floor((2.6 * mon - 0.2)) + year + (int)floor(year / 4.0) + (int)floor(century / 4.0) - 2 * century) % 7; if (wday < 0) wday += 7; #if 0 /* See commentary above */ assert(wday == tm->tm_wday || tm->tm_wday == 8); #endif tm->tm_wday = wday; } /* * Compute and set tm_yday. * */ static void set_tm_yday(struct tm *tm) { static const int d[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; int mon = tm->tm_mon; int year = 1900 + tm->tm_year; int leap_day = 0; if (tm->tm_mon > 1 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))) leap_day = 1; /* Bound check index into d[] */ if (mon < 0) mon = -mon; if (mon > 11) mon %= 12; int yday = d[mon] + leap_day + tm->tm_mday - 1; assert(yday == tm->tm_yday || tm->tm_yday == 367); tm->tm_yday = yday; } static jv f_strptime(jq_state *jq, jv a, jv b) { if (jv_get_kind(a) != JV_KIND_STRING || jv_get_kind(b) != JV_KIND_STRING) { return ret_error2(a, b, jv_string("strptime/1 requires string inputs and arguments")); } struct tm tm; memset(&tm, 0, sizeof(tm)); tm.tm_wday = 8; // sentinel tm.tm_yday = 367; // sentinel const char *input = jv_string_value(a); const char *fmt = jv_string_value(b); const char *end = strptime(input, fmt, &tm); if (end == NULL || (*end != '\0' && !isspace((unsigned char)*end))) { return ret_error2(a, b, jv_string_fmt("date \"%s\" does not match format \"%s\"", input, fmt)); } jv_free(b); /* * This is OS X or some *BSD whose strptime() is just not that * helpful! * * We don't know that the format string did involve parsing a * year, or a month (if tm->tm_mon == 0). But with our invalid * day-of-week and day-of-year sentinel checks above, the worst * this can do is produce garbage. */ #ifdef __APPLE__ /* * Apple has made it worse, and different versions of the OS have different * behaviors. Some versions just don't touch the fields, but others do, and * sometimes provide wrong answers, at that! We can't tell at compile-time * which behavior the target system will have, so instead we always use our * functions to set these on OS X, and document that %u and %j are * unsupported on OS X. */ set_tm_wday(&tm); set_tm_yday(&tm); #elif defined(WIN32) || !defined(HAVE_STRPTIME) set_tm_wday(&tm); #else if (tm.tm_wday == 8 && tm.tm_mday != 0 && tm.tm_mon >= 0 && tm.tm_mon <= 11) set_tm_wday(&tm); if (tm.tm_yday == 367 && tm.tm_mday != 0 && tm.tm_mon >= 0 && tm.tm_mon <= 11) set_tm_yday(&tm); #endif jv r = tm2jv(&tm, 0); if (*end != '\0') r = jv_array_append(r, jv_string(end)); jv_free(a); // must come after `*end` because `end` is a pointer into `a`'s string return r; } static int jv2tm(jv a, struct tm *tm, int localtime) { memset(tm, 0, sizeof(*tm)); static const size_t offsets[] = { offsetof(struct tm, tm_year), offsetof(struct tm, tm_mon), offsetof(struct tm, tm_mday), offsetof(struct tm, tm_hour), offsetof(struct tm, tm_min), offsetof(struct tm, tm_sec), offsetof(struct tm, tm_wday), offsetof(struct tm, tm_yday), }; for (size_t i = 0; i < (sizeof offsets / sizeof *offsets); ++i) { jv n = jv_array_get(jv_copy(a), i); if (!jv_is_valid(n)) break; if (jv_get_kind(n) != JV_KIND_NUMBER || jvp_number_is_nan(n)) { jv_free(a); jv_free(n); return 0; } double d = jv_number_value(n); if (i == 0) /* year */ d -= 1900; *(int *)((void *)tm + offsets[i]) = d < INT_MIN ? INT_MIN : d > INT_MAX ? INT_MAX : (int)d; jv_free(n); } if (localtime) { tm->tm_isdst = -1; mktime(tm); } else { #ifdef HAVE_TIMEGM timegm(tm); #elif HAVE_TM_TM_GMT_OFF // tm->tm_gmtoff = 0; tm->tm_zone = "GMT"; #elif HAVE_TM___TM_GMT_OFF // tm->__tm_gmtoff = 0; tm->__tm_zone = "GMT"; #endif // tm->tm_isdst = 0; // The standard permits the tm structure to contain additional members. We // hope it is okay to initialize them to zero, because the standard does not // provide an alternative. } jv_free(a); return 1; } #undef TO_TM_FIELD static jv f_mktime(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_ARRAY) return ret_error(a, jv_string("mktime requires array inputs")); struct tm tm; if (!jv2tm(a, &tm, 0)) return jv_invalid_with_msg(jv_string("mktime requires parsed datetime inputs")); time_t t = my_mktime(&tm); if (t == (time_t)-1) return jv_invalid_with_msg(jv_string("invalid gmtime representation")); if (t == (time_t)-2) return jv_invalid_with_msg(jv_string("mktime not supported on this platform")); return jv_number(t); } #ifdef HAVE_GMTIME_R static jv f_gmtime(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_NUMBER) return ret_error(a, jv_string("gmtime() requires numeric inputs")); struct tm tm, *tmp; memset(&tm, 0, sizeof(tm)); double fsecs = jv_number_value(a); time_t secs = fsecs; jv_free(a); tmp = gmtime_r(&secs, &tm); if (tmp == NULL) return jv_invalid_with_msg(jv_string("error converting number of seconds since epoch to datetime")); return tm2jv(tmp, fsecs); } #elif defined HAVE_GMTIME static jv f_gmtime(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_NUMBER) return ret_error(a, jv_string("gmtime requires numeric inputs")); struct tm tm, *tmp; memset(&tm, 0, sizeof(tm)); double fsecs = jv_number_value(a); time_t secs = fsecs; jv_free(a); tmp = gmtime(&secs); if (tmp == NULL) return jv_invalid_with_msg(jv_string("error converting number of seconds since epoch to datetime")); return tm2jv(tmp, fsecs); } #else static jv f_gmtime(jq_state *jq, jv a) { jv_free(a); return jv_invalid_with_msg(jv_string("gmtime not implemented on this platform")); } #endif #ifdef HAVE_LOCALTIME_R static jv f_localtime(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_NUMBER) return ret_error(a, jv_string("localtime() requires numeric inputs")); struct tm tm, *tmp; memset(&tm, 0, sizeof(tm)); double fsecs = jv_number_value(a); time_t secs = fsecs; jv_free(a); tmp = localtime_r(&secs, &tm); if (tmp == NULL) return jv_invalid_with_msg(jv_string("error converting number of seconds since epoch to datetime")); return tm2jv(tmp, fsecs); } #elif defined HAVE_GMTIME static jv f_localtime(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_NUMBER) return ret_error(a, jv_string("localtime requires numeric inputs")); struct tm tm, *tmp; memset(&tm, 0, sizeof(tm)); double fsecs = jv_number_value(a); time_t secs = fsecs; jv_free(a); tmp = localtime(&secs); if (tmp == NULL) return jv_invalid_with_msg(jv_string("error converting number of seconds since epoch to datetime")); return tm2jv(tmp, fsecs); } #else static jv f_localtime(jq_state *jq, jv a) { jv_free(a); return jv_invalid_with_msg(jv_string("localtime not implemented on this platform")); } #endif #ifdef HAVE_STRFTIME static jv f_strftime(jq_state *jq, jv a, jv b) { if (jv_get_kind(a) == JV_KIND_NUMBER) { a = f_gmtime(jq, a); if (!jv_is_valid(a)) { jv_free(b); return a; } } else if (jv_get_kind(a) != JV_KIND_ARRAY) { return ret_error2(a, b, jv_string("strftime/1 requires parsed datetime inputs")); } if (jv_get_kind(b) != JV_KIND_STRING) return ret_error2(a, b, jv_string("strftime/1 requires a string format")); struct tm tm; if (!jv2tm(a, &tm, 0)) return ret_error(b, jv_string("strftime/1 requires parsed datetime inputs")); const char *fmt = jv_string_value(b); int fmt_not_empty = *fmt != '\0'; size_t max_size = strlen(fmt) + 100; char *buf = jv_mem_alloc(max_size); #if defined(__APPLE__) || defined(__sun) /* Apple Libc (as of version 1669.40.2) contains a bug which causes it to * ignore the `tm.tm_gmtoff` in favor of the global timezone. To print the * proper timezone offset we temporarily switch the TZ to UTC. */ char *tz = (tz = getenv("TZ")) != NULL ? strdup(tz) : NULL; setenv("TZ", "UTC", 1); #endif #if defined(__sun) /* Solaris moreover needs call to tzset to take the changed environment into * account ... */ tzset(); #endif size_t n = strftime(buf, max_size, fmt, &tm); #if defined(__APPLE__) || defined(__sun) if (tz) { setenv("TZ", tz, 1); free(tz); } else { unsetenv("TZ"); } #endif #if defined(__sun) tzset(); #endif jv_free(b); /* POSIX doesn't provide errno values for strftime() failures; weird */ if ((n == 0 && fmt_not_empty) || n > max_size) { free(buf); return jv_invalid_with_msg(jv_string("strftime/1: unknown system failure")); } jv ret = jv_string_sized(buf, n); free(buf); return ret; } #else static jv f_strftime(jq_state *jq, jv a, jv b) { jv_free(a); jv_free(b); return jv_invalid_with_msg(jv_string("strftime/1 not implemented on this platform")); } #endif #ifdef HAVE_STRFTIME static jv f_strflocaltime(jq_state *jq, jv a, jv b) { if (jv_get_kind(a) == JV_KIND_NUMBER) { a = f_localtime(jq, a); if (!jv_is_valid(a)) { jv_free(b); return a; } } else if (jv_get_kind(a) != JV_KIND_ARRAY) { return ret_error2(a, b, jv_string("strflocaltime/1 requires parsed datetime inputs")); } if (jv_get_kind(b) != JV_KIND_STRING) return ret_error2(a, b, jv_string("strflocaltime/1 requires a string format")); struct tm tm; if (!jv2tm(a, &tm, 1)) return ret_error(b, jv_string("strflocaltime/1 requires parsed datetime inputs")); const char *fmt = jv_string_value(b); int fmt_not_empty = *fmt != '\0'; size_t max_size = strlen(fmt) + 100; char *buf = jv_mem_alloc(max_size); size_t n = strftime(buf, max_size, fmt, &tm); jv_free(b); /* POSIX doesn't provide errno values for strftime() failures; weird */ if ((n == 0 && fmt_not_empty) || n > max_size) { free(buf); return jv_invalid_with_msg(jv_string("strflocaltime/1: unknown system failure")); } jv ret = jv_string_sized(buf, n); free(buf); return ret; } #else static jv f_strflocaltime(jq_state *jq, jv a, jv b) { jv_free(a); jv_free(b); return jv_invalid_with_msg(jv_string("strflocaltime/1 not implemented on this platform")); } #endif #ifdef HAVE_GETTIMEOFDAY static jv f_now(jq_state *jq, jv a) { jv_free(a); struct timeval tv; if (gettimeofday(&tv, NULL) == -1) return jv_number(time(NULL)); return jv_number(tv.tv_sec + tv.tv_usec / 1000000.0); } #else static jv f_now(jq_state *jq, jv a) { jv_free(a); return jv_number(time(NULL)); } #endif static jv f_current_filename(jq_state *jq, jv a) { jv_free(a); jv r = jq_util_input_get_current_filename(jq); if (jv_is_valid(r)) return r; jv_free(r); return jv_null(); } static jv f_current_line(jq_state *jq, jv a) { jv_free(a); return jq_util_input_get_current_line(jq); } static jv f_have_decnum(jq_state *jq, jv a) { jv_free(a); #ifdef USE_DECNUM return jv_true(); #else return jv_false(); #endif } #define CFUNC(func, name, arity) \ {.fptr = { .a ## arity = func }, name, arity} #define LIBM_DD(name) \ CFUNC(f_ ## name, #name, 1), #define LIBM_DD_NO(name) LIBM_DD(name) #define LIBM_DA(name, type) LIBM_DD(name) #define LIBM_DA_NO(name, type) LIBM_DD(name) #define LIBM_DDD(name) \ CFUNC(f_ ## name, #name, 3), #define LIBM_DDD_NO(name) LIBM_DDD(name) #define LIBM_DDDD(name) \ CFUNC(f_ ## name, #name, 4), #define LIBM_DDDD_NO(name) LIBM_DDDD(name) static const struct cfunction function_list[] = { #include "libm.h" CFUNC(f_negate, "_negate", 1), #define BINOP(name) CFUNC(f_ ## name, "_" #name, 3), BINOPS #undef BINOP CFUNC(f_dump, "tojson", 1), CFUNC(f_json_parse, "fromjson", 1), CFUNC(f_tonumber, "tonumber", 1), CFUNC(f_toboolean, "toboolean", 1), CFUNC(f_tostring, "tostring", 1), CFUNC(f_keys, "keys", 1), CFUNC(f_keys_unsorted, "keys_unsorted", 1), CFUNC(f_startswith, "startswith", 2), CFUNC(f_endswith, "endswith", 2), CFUNC(f_string_split, "split", 2), CFUNC(f_string_explode, "explode", 1), CFUNC(f_string_implode, "implode", 1), CFUNC(f_string_indexes, "_strindices", 2), CFUNC(f_string_trim, "trim", 1), CFUNC(f_string_ltrim, "ltrim", 1), CFUNC(f_string_rtrim, "rtrim", 1), CFUNC(f_setpath, "setpath", 3), CFUNC(f_getpath, "getpath", 2), CFUNC(f_delpaths, "delpaths", 2), CFUNC(f_has, "has", 2), CFUNC(f_contains, "contains", 2), CFUNC(f_length, "length", 1), CFUNC(f_utf8bytelength, "utf8bytelength", 1), CFUNC(f_type, "type", 1), CFUNC(f_isinfinite, "isinfinite", 1), CFUNC(f_isnan, "isnan", 1), CFUNC(f_isnormal, "isnormal", 1), CFUNC(f_infinite, "infinite", 1), CFUNC(f_nan, "nan", 1), CFUNC(f_sort, "sort", 1), CFUNC(f_sort_by_impl, "_sort_by_impl", 2), CFUNC(f_group_by_impl, "_group_by_impl", 2), CFUNC(f_unique, "unique", 1), CFUNC(f_unique_by_impl, "_unique_by_impl", 2), CFUNC(f_bsearch, "bsearch", 2), CFUNC(f_min, "min", 1), CFUNC(f_max, "max", 1), CFUNC(f_min_by_impl, "_min_by_impl", 2), CFUNC(f_max_by_impl, "_max_by_impl", 2), CFUNC(f_error, "error", 1), CFUNC(f_format, "format", 2), CFUNC(f_env, "env", 1), CFUNC(f_halt, "halt", 1), CFUNC(f_halt_error, "halt_error", 2), CFUNC(f_get_search_list, "get_search_list", 1), CFUNC(f_get_prog_origin, "get_prog_origin", 1), CFUNC(f_get_jq_origin, "get_jq_origin", 1), CFUNC(f_match, "_match_impl", 4), CFUNC(f_modulemeta, "modulemeta", 1), CFUNC(f_input, "input", 1), CFUNC(f_debug, "debug", 1), CFUNC(f_stderr, "stderr", 1), CFUNC(f_strptime, "strptime", 2), CFUNC(f_strftime, "strftime", 2), CFUNC(f_strflocaltime, "strflocaltime", 2), CFUNC(f_mktime, "mktime", 1), CFUNC(f_gmtime, "gmtime", 1), CFUNC(f_localtime, "localtime", 1), CFUNC(f_now, "now", 1), CFUNC(f_current_filename, "input_filename", 1), CFUNC(f_current_line, "input_line_number", 1), CFUNC(f_have_decnum, "have_decnum", 1), CFUNC(f_have_decnum, "have_literal_numbers", 1), }; #undef LIBM_DDDD_NO #undef LIBM_DDD_NO #undef LIBM_DD_NO #undef LIBM_DA_NO #undef LIBM_DDDD #undef LIBM_DDD #undef LIBM_DD #undef LIBM_DA // This is a hack to make last(g) yield no output values, // if g yields no output values, without using boxing. static block gen_last_1(void) { block last_var = gen_op_var_fresh(STOREV, "last"); block is_empty_var = gen_op_var_fresh(STOREV, "is_empty"); block init = BLOCK(gen_op_simple(DUP), gen_const(jv_null()), last_var, gen_op_simple(DUP), gen_const(jv_true()), is_empty_var); block call_arg = BLOCK(gen_call("arg", gen_noop()), gen_op_simple(DUP), gen_op_bound(STOREV, last_var), gen_const(jv_false()), gen_op_bound(STOREV, is_empty_var), gen_op_simple(BACKTRACK)); block if_empty = gen_op_simple(BACKTRACK); return BLOCK(init, gen_op_target(FORK, call_arg), call_arg, BLOCK(gen_op_bound(LOADVN, is_empty_var), gen_op_target(JUMP_F, if_empty), if_empty, gen_op_bound(LOADVN, last_var))); } struct bytecoded_builtin { const char* name; block code; }; static block bind_bytecoded_builtins(block b) { block builtins = gen_noop(); { struct bytecoded_builtin builtin_defs[] = { {"empty", gen_op_simple(BACKTRACK)}, {"not", gen_condbranch(gen_const(jv_false()), gen_const(jv_true()))} }; for (unsigned i=0; i", jq_builtins, sizeof(jq_builtins)-1); int nerrors = jq_parse_library(src, &builtins); assert(!nerrors); locfile_free(src); builtins = bind_bytecoded_builtins(builtins); builtins = gen_cbinding(function_list, sizeof(function_list)/sizeof(function_list[0]), builtins); builtins = gen_builtin_list(builtins); *bb = block_bind_referenced(builtins, *bb, OP_IS_CALL_PSEUDO); return nerrors; } jq-1.8.2/src/jv_parse.c0000644000175100017510000006560715215513536010407 #include #include #include #include #include #include "jv.h" #include "jv_dtoa.h" #include "jv_unicode.h" #include "jv_alloc.h" #include "jv_dtoa.h" typedef const char* presult; #ifndef MAX_PARSING_DEPTH #define MAX_PARSING_DEPTH (10000) #endif #define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0) #ifdef __GNUC__ #define pfunc __attribute__((warn_unused_result)) presult #else #define pfunc presult #endif enum last_seen { JV_LAST_NONE = 0, JV_LAST_OPEN_ARRAY = '[', JV_LAST_OPEN_OBJECT = '{', JV_LAST_COLON = ':', JV_LAST_COMMA = ',', JV_LAST_VALUE = 'V', }; struct jv_parser { const char* curr_buf; int curr_buf_length; int curr_buf_pos; int curr_buf_is_partial; int eof; unsigned bom_strip_position; int flags; jv* stack; // parser int stackpos; // parser int stacklen; // both (optimization; it's really pathlen for streaming) jv path; // streamer enum last_seen last_seen; // streamer jv output; // streamer jv next; // both char* tokenbuf; int tokenpos; int tokenlen; int line, column; struct dtoa_context dtoa; enum { JV_PARSER_NORMAL, JV_PARSER_STRING, JV_PARSER_STRING_ESCAPE, JV_PARSER_WAITING_FOR_RS // parse error, waiting for RS } st; unsigned int last_ch_was_ws:1; }; static void parser_init(struct jv_parser* p, int flags) { p->flags = flags; if ((p->flags & JV_PARSE_STREAMING)) { p->path = jv_array(); } else { p->path = jv_invalid(); p->flags &= ~(JV_PARSE_STREAM_ERRORS); } p->stack = 0; p->stacklen = p->stackpos = 0; p->last_seen = JV_LAST_NONE; p->output = jv_invalid(); p->next = jv_invalid(); p->tokenlen = 256; p->tokenbuf = jv_mem_alloc(p->tokenlen); p->tokenpos = 0; if ((p->flags & JV_PARSE_SEQ)) p->st = JV_PARSER_WAITING_FOR_RS; else p->st = JV_PARSER_NORMAL; p->eof = 0; p->curr_buf = 0; p->curr_buf_length = p->curr_buf_pos = p->curr_buf_is_partial = 0; p->bom_strip_position = 0; p->last_ch_was_ws = 0; p->line = 1; p->column = 0; jvp_dtoa_context_init(&p->dtoa); } static void parser_reset(struct jv_parser* p) { if ((p->flags & JV_PARSE_STREAMING)) { jv_free(p->path); p->path = jv_array(); p->stacklen = 0; } p->last_seen = JV_LAST_NONE; jv_free(p->output); p->output = jv_invalid(); jv_free(p->next); p->next = jv_invalid(); for (int i=0; istackpos; i++) jv_free(p->stack[i]); p->stackpos = 0; p->tokenpos = 0; p->st = JV_PARSER_NORMAL; } static void parser_free(struct jv_parser* p) { parser_reset(p); jv_free(p->path); jv_free(p->output); jv_mem_free(p->stack); jv_mem_free(p->tokenbuf); jvp_dtoa_context_free(&p->dtoa); } static pfunc value(struct jv_parser* p, jv val) { if ((p->flags & JV_PARSE_STREAMING)) { if (jv_is_valid(p->next) || p->last_seen == JV_LAST_VALUE) { jv_free(val); return "Expected separator between values"; } if (p->stacklen > 0) p->last_seen = JV_LAST_VALUE; else p->last_seen = JV_LAST_NONE; } else { if (jv_is_valid(p->next)) { jv_free(val); return "Expected separator between values"; } } jv_free(p->next); p->next = val; return 0; } static void push(struct jv_parser* p, jv v) { assert(p->stackpos <= p->stacklen); if (p->stackpos == p->stacklen) { p->stacklen = p->stacklen * 2 + 10; p->stack = jv_mem_realloc(p->stack, p->stacklen * sizeof(jv)); } assert(p->stackpos < p->stacklen); p->stack[p->stackpos++] = v; } static pfunc parse_token(struct jv_parser* p, char ch) { switch (ch) { case '[': if (p->stackpos >= MAX_PARSING_DEPTH) return "Exceeds depth limit for parsing"; if (jv_is_valid(p->next)) return "Expected separator between values"; push(p, jv_array()); break; case '{': if (p->stackpos >= MAX_PARSING_DEPTH) return "Exceeds depth limit for parsing"; if (jv_is_valid(p->next)) return "Expected separator between values"; push(p, jv_object()); break; case ':': if (!jv_is_valid(p->next)) return "Expected string key before ':'"; if (p->stackpos == 0 || jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_OBJECT) return "':' not as part of an object"; if (jv_get_kind(p->next) != JV_KIND_STRING) return "Object keys must be strings"; push(p, p->next); p->next = jv_invalid(); break; case ',': if (!jv_is_valid(p->next)) return "Expected value before ','"; if (p->stackpos == 0) return "',' not as part of an object or array"; if (jv_get_kind(p->stack[p->stackpos-1]) == JV_KIND_ARRAY) { p->stack[p->stackpos-1] = jv_array_append(p->stack[p->stackpos-1], p->next); p->next = jv_invalid(); } else if (jv_get_kind(p->stack[p->stackpos-1]) == JV_KIND_STRING) { assert(p->stackpos > 1 && jv_get_kind(p->stack[p->stackpos-2]) == JV_KIND_OBJECT); p->stack[p->stackpos-2] = jv_object_set(p->stack[p->stackpos-2], p->stack[p->stackpos-1], p->next); p->stackpos--; p->next = jv_invalid(); } else { // this case hits on input like {"a", "b"} return "Objects must consist of key:value pairs"; } break; case ']': if (p->stackpos == 0 || jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_ARRAY) return "Unmatched ']'"; if (jv_is_valid(p->next)) { p->stack[p->stackpos-1] = jv_array_append(p->stack[p->stackpos-1], p->next); p->next = jv_invalid(); } else { if (jv_array_length(jv_copy(p->stack[p->stackpos-1])) != 0) { // this case hits on input like [1,2,3,] return "Expected another array element"; } } jv_free(p->next); p->next = p->stack[--p->stackpos]; break; case '}': if (p->stackpos == 0) return "Unmatched '}'"; if (jv_is_valid(p->next)) { if (jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_STRING) return "Objects must consist of key:value pairs"; assert(p->stackpos > 1 && jv_get_kind(p->stack[p->stackpos-2]) == JV_KIND_OBJECT); p->stack[p->stackpos-2] = jv_object_set(p->stack[p->stackpos-2], p->stack[p->stackpos-1], p->next); p->stackpos--; p->next = jv_invalid(); } else { if (jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_OBJECT) return "Unmatched '}'"; if (jv_object_length(jv_copy(p->stack[p->stackpos-1])) != 0) return "Expected another key-value pair"; } jv_free(p->next); p->next = p->stack[--p->stackpos]; break; } return 0; } static pfunc stream_token(struct jv_parser* p, char ch) { jv_kind k; jv last; switch (ch) { case '[': if (jv_is_valid(p->next)) return "Expected a separator between values"; if (p->last_seen == JV_LAST_OPEN_OBJECT) // Looks like {["foo"]} return "Expected string key after '{', not '['"; if (p->last_seen == JV_LAST_COMMA) { last = jv_array_get(jv_copy(p->path), p->stacklen - 1); k = jv_get_kind(last); jv_free(last); if (k != JV_KIND_NUMBER) // Looks like {"x":"y",["foo"]} return "Expected string key after ',' in object, not '['"; } p->path = jv_array_append(p->path, jv_number(0)); // push p->last_seen = JV_LAST_OPEN_ARRAY; p->stacklen++; break; case '{': if (p->last_seen == JV_LAST_VALUE) return "Expected a separator between values"; if (p->last_seen == JV_LAST_OPEN_OBJECT) // Looks like {{"foo":"bar"}} return "Expected string key after '{', not '{'"; if (p->last_seen == JV_LAST_COMMA) { last = jv_array_get(jv_copy(p->path), p->stacklen - 1); k = jv_get_kind(last); jv_free(last); if (k != JV_KIND_NUMBER) // Looks like {"x":"y",{"foo":"bar"}} return "Expected string key after ',' in object, not '{'"; } // Push object key: null, since we don't know it yet p->path = jv_array_append(p->path, jv_null()); // push p->last_seen = JV_LAST_OPEN_OBJECT; p->stacklen++; break; case ':': last = jv_invalid(); if (p->stacklen == 0 || jv_get_kind(last = jv_array_get(jv_copy(p->path), p->stacklen - 1)) == JV_KIND_NUMBER) { jv_free(last); return "':' not as part of an object"; } jv_free(last); if (!jv_is_valid(p->next) || p->last_seen == JV_LAST_NONE) return "Expected string key before ':'"; if (jv_get_kind(p->next) != JV_KIND_STRING) return "Object keys must be strings"; if (p->last_seen != JV_LAST_VALUE) return "':' should follow a key"; p->last_seen = JV_LAST_COLON; p->path = jv_array_set(p->path, p->stacklen - 1, p->next); p->next = jv_invalid(); break; case ',': if (p->last_seen != JV_LAST_VALUE) return "Expected value before ','"; if (p->stacklen == 0) return "',' not as part of an object or array"; last = jv_array_get(jv_copy(p->path), p->stacklen - 1); k = jv_get_kind(last); if (k == JV_KIND_NUMBER) { int idx = jv_number_value(last); if (jv_is_valid(p->next)) { p->output = JV_ARRAY(jv_copy(p->path), p->next); p->next = jv_invalid(); } p->path = jv_array_set(p->path, p->stacklen - 1, jv_number(idx + 1)); p->last_seen = JV_LAST_COMMA; } else if (k == JV_KIND_STRING) { if (jv_is_valid(p->next)) { p->output = JV_ARRAY(jv_copy(p->path), p->next); p->next = jv_invalid(); } p->path = jv_array_set(p->path, p->stacklen - 1, jv_null()); // ready for another key:value pair p->last_seen = JV_LAST_COMMA; } else { assert(k == JV_KIND_NULL); // this case hits on input like {,} // make sure to handle input like {"a", "b"} and {"a":, ...} jv_free(last); return "Objects must consist of key:value pairs"; } jv_free(last); break; case ']': if (p->stacklen == 0) return "Unmatched ']' at the top-level"; if (p->last_seen == JV_LAST_COMMA) return "Expected another array element"; if (p->last_seen == JV_LAST_OPEN_ARRAY) assert(!jv_is_valid(p->next)); last = jv_array_get(jv_copy(p->path), p->stacklen - 1); k = jv_get_kind(last); jv_free(last); if (k != JV_KIND_NUMBER) return "Unmatched ']' in the middle of an object"; if (jv_is_valid(p->next)) { p->output = JV_ARRAY(jv_copy(p->path), p->next, jv_true()); p->next = jv_invalid(); } else if (p->last_seen != JV_LAST_OPEN_ARRAY) { p->output = JV_ARRAY(jv_copy(p->path)); } p->path = jv_array_slice(p->path, 0, --(p->stacklen)); // pop //assert(!jv_is_valid(p->next)); jv_free(p->next); p->next = jv_invalid(); if (p->last_seen == JV_LAST_OPEN_ARRAY) p->output = JV_ARRAY(jv_copy(p->path), jv_array()); // Empty arrays are leaves if (p->stacklen == 0) p->last_seen = JV_LAST_NONE; else p->last_seen = JV_LAST_VALUE; break; case '}': if (p->stacklen == 0) return "Unmatched '}' at the top-level"; if (p->last_seen == JV_LAST_COMMA) return "Expected another key:value pair"; if (p->last_seen == JV_LAST_OPEN_OBJECT) assert(!jv_is_valid(p->next)); last = jv_array_get(jv_copy(p->path), p->stacklen - 1); k = jv_get_kind(last); jv_free(last); if (k == JV_KIND_NUMBER) return "Unmatched '}' in the middle of an array"; if (jv_is_valid(p->next)) { if (k != JV_KIND_STRING) return "Objects must consist of key:value pairs"; p->output = JV_ARRAY(jv_copy(p->path), p->next, jv_true()); p->next = jv_invalid(); } else { // Perhaps {"a":[]} if (p->last_seen == JV_LAST_COLON) // Looks like {"a":} return "Missing value in key:value pair"; if (p->last_seen == JV_LAST_COMMA) // Looks like {"a":0,} return "Expected another key-value pair"; if (p->last_seen == JV_LAST_OPEN_ARRAY) return "Unmatched '}' in the middle of an array"; if (p->last_seen != JV_LAST_VALUE && p->last_seen != JV_LAST_OPEN_OBJECT) return "Unmatched '}'"; if (p->last_seen != JV_LAST_OPEN_OBJECT) p->output = JV_ARRAY(jv_copy(p->path)); } p->path = jv_array_slice(p->path, 0, --(p->stacklen)); // pop jv_free(p->next); p->next = jv_invalid(); if (p->last_seen == JV_LAST_OPEN_OBJECT) p->output = JV_ARRAY(jv_copy(p->path), jv_object()); // Empty arrays are leaves if (p->stacklen == 0) p->last_seen = JV_LAST_NONE; else p->last_seen = JV_LAST_VALUE; break; } return 0; } static pfunc tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); if (p->tokenpos >= (p->tokenlen - 1)) { if (p->tokenlen > INT_MAX / 2) return "Token too long"; p->tokenlen *= 2; p->tokenbuf = jv_mem_realloc(p->tokenbuf, p->tokenlen); } assert(p->tokenpos < p->tokenlen); p->tokenbuf[p->tokenpos++] = c; return 0; } static int unhex4(char* hex) { int r = 0; for (int i=0; i<4; i++) { char c = *hex++; int n; if ('0' <= c && c <= '9') n = c - '0'; else if ('a' <= c && c <= 'f') n = c - 'a' + 10; else if ('A' <= c && c <= 'F') n = c - 'A' + 10; else return -1; r <<= 4; r |= n; } return r; } static pfunc found_string(struct jv_parser* p) { char* in = p->tokenbuf; char* out = p->tokenbuf; char* end = p->tokenbuf + p->tokenpos; while (in < end) { char c = *in++; if (c == '\\') { if (in >= end) return "Expected escape character at end of string"; c = *in++; switch (c) { case '\\': case '"': case '/': *out++ = c; break; case 'b': *out++ = '\b'; break; case 'f': *out++ = '\f'; break; case 't': *out++ = '\t'; break; case 'n': *out++ = '\n'; break; case 'r': *out++ = '\r'; break; case 'u': /* ahh, the complicated case */ if (in + 4 > end) return "Invalid \\uXXXX escape"; int hexvalue = unhex4(in); if (hexvalue < 0) return "Invalid characters in \\uXXXX escape"; unsigned long codepoint = (unsigned long)hexvalue; in += 4; if (0xD800 <= codepoint && codepoint <= 0xDBFF) { /* who thought UTF-16 surrogate pairs were a good idea? */ if (in + 6 > end || in[0] != '\\' || in[1] != 'u') return "Invalid \\uXXXX\\uXXXX surrogate pair escape"; unsigned long surrogate = unhex4(in+2); if (!(0xDC00 <= surrogate && surrogate <= 0xDFFF)) return "Invalid \\uXXXX\\uXXXX surrogate pair escape"; in += 6; codepoint = 0x10000 + (((codepoint - 0xD800) << 10) |(surrogate - 0xDC00)); } if (codepoint > 0x10FFFF) codepoint = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER out += jvp_utf8_encode(codepoint, out); break; default: return "Invalid escape"; } } else { if (!(c & ~0x1F)) return "Invalid string: control characters from U+0000 through U+001F must be escaped"; *out++ = c; } } TRY(value(p, jv_string_sized(p->tokenbuf, out - p->tokenbuf))); p->tokenpos = 0; return 0; } static pfunc check_literal(struct jv_parser* p) { if (p->tokenpos == 0) return 0; const char* pattern = 0; int plen; jv v; switch (p->tokenbuf[0]) { case 't': pattern = "true"; plen = 4; v = jv_true(); break; case 'f': pattern = "false"; plen = 5; v = jv_false(); break; case '\'': return "Invalid string literal; expected \", but got '"; case 'n': // if it starts with 'n', it could be a literal "nan" if (p->tokenpos > 1 && p->tokenbuf[1] == 'u') { pattern = "null"; plen = 4; v = jv_null(); } } if (pattern) { if (p->tokenpos != plen) return "Invalid literal"; for (int i=0; itokenbuf[i] != pattern[i]) return "Invalid literal"; TRY(value(p, v)); } else { // FIXME: better parser p->tokenbuf[p->tokenpos] = 0; #ifdef USE_DECNUM jv number = jv_number_with_literal(p->tokenbuf); if (jv_get_kind(number) == JV_KIND_INVALID) { return "Invalid numeric literal"; } TRY(value(p, number)); #else char *end = 0; double d = jvp_strtod(&p->dtoa, p->tokenbuf, &end); if (end == 0 || *end != 0) { return "Invalid numeric literal"; } TRY(value(p, jv_number(d))); #endif } p->tokenpos = 0; return 0; } typedef enum { LITERAL, WHITESPACE, STRUCTURE, QUOTE, INVALID } chclass; static chclass classify(char c) { switch (c) { case ' ': case '\t': case '\r': case '\n': return WHITESPACE; case '"': return QUOTE; case '[': case ',': case ']': case '{': case ':': case '}': return STRUCTURE; default: return LITERAL; } } static const presult OK = "output produced"; static int parse_check_done(struct jv_parser* p, jv* out) { if (p->stackpos == 0 && jv_is_valid(p->next)) { *out = p->next; p->next = jv_invalid(); return 1; } else { return 0; } } static int stream_check_done(struct jv_parser* p, jv* out) { if (p->stacklen == 0 && jv_is_valid(p->next)) { *out = JV_ARRAY(jv_copy(p->path),p->next); p->next = jv_invalid(); return 1; } else if (jv_is_valid(p->output)) { if (jv_array_length(jv_copy(p->output)) > 2) { // At end of an array or object, necessitating one more output by // which to indicate this *out = jv_array_slice(jv_copy(p->output), 0, 2); p->output = jv_array_slice(p->output, 0, 1); // arrange one more output } else { // No further processing needed *out = p->output; p->output = jv_invalid(); } return 1; } else { return 0; } } static int seq_check_truncation(struct jv_parser* p) { return (!p->last_ch_was_ws && (p->stackpos > 0 || p->tokenpos > 0 || jv_get_kind(p->next) == JV_KIND_NUMBER)); } static int stream_seq_check_truncation(struct jv_parser* p) { jv_kind k = jv_get_kind(p->next); return (p->stacklen > 0 || k == JV_KIND_NUMBER || k == JV_KIND_TRUE || k == JV_KIND_FALSE || k == JV_KIND_NULL); } static int parse_is_top_num(struct jv_parser* p) { return (p->stackpos == 0 && jv_get_kind(p->next) == JV_KIND_NUMBER); } static int stream_is_top_num(struct jv_parser* p) { return (p->stacklen == 0 && jv_get_kind(p->next) == JV_KIND_NUMBER); } #define check_done(p, o) \ (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o))) #define token(p, ch) \ (((p)->flags & JV_PARSE_STREAMING) ? stream_token((p), (ch)) : parse_token((p), (ch))) #define check_truncation(p) \ (((p)->flags & JV_PARSE_STREAMING) ? stream_seq_check_truncation((p)) : seq_check_truncation((p))) #define is_top_num(p) \ (((p)->flags & JV_PARSE_STREAMING) ? stream_is_top_num((p)) : parse_is_top_num((p))) static pfunc scan(struct jv_parser* p, char ch, jv* out) { p->column++; if (ch == '\n') { p->line++; p->column = 0; } if ((p->flags & JV_PARSE_SEQ) && ch == '\036' /* ASCII RS; see draft-ietf-json-sequence-07 */) { if (check_truncation(p)) { if (check_literal(p) == 0 && is_top_num(p)) return "Potentially truncated top-level numeric value"; return "Truncated value"; } TRY(check_literal(p)); if (p->st == JV_PARSER_NORMAL && check_done(p, out)) return OK; // shouldn't happen? assert(!jv_is_valid(*out)); parser_reset(p); jv_free(*out); *out = jv_invalid(); return OK; } presult answer = 0; p->last_ch_was_ws = 0; if (p->st == JV_PARSER_NORMAL) { chclass cls = classify(ch); if (cls == WHITESPACE) p->last_ch_was_ws = 1; if (cls != LITERAL) { TRY(check_literal(p)); if (check_done(p, out)) answer = OK; } switch (cls) { case LITERAL: TRY(tokenadd(p, ch)); break; case WHITESPACE: break; case QUOTE: p->st = JV_PARSER_STRING; break; case STRUCTURE: TRY(token(p, ch)); break; case INVALID: return "Invalid character"; } if (check_done(p, out)) answer = OK; } else { if (ch == '"' && p->st == JV_PARSER_STRING) { TRY(found_string(p)); p->st = JV_PARSER_NORMAL; if (check_done(p, out)) answer = OK; } else { TRY(tokenadd(p, ch)); if (ch == '\\' && p->st == JV_PARSER_STRING) { p->st = JV_PARSER_STRING_ESCAPE; } else { p->st = JV_PARSER_STRING; } } } return answer; } struct jv_parser* jv_parser_new(int flags) { struct jv_parser* p = jv_mem_alloc(sizeof(struct jv_parser)); parser_init(p, flags); p->flags = flags; return p; } void jv_parser_free(struct jv_parser* p) { parser_free(p); jv_mem_free(p); } static const unsigned char UTF8_BOM[] = {0xEF,0xBB,0xBF}; int jv_parser_remaining(struct jv_parser* p) { if (p->curr_buf == 0) return 0; return (p->curr_buf_length - p->curr_buf_pos); } void jv_parser_set_buf(struct jv_parser* p, const char* buf, int length, int is_partial) { assert((p->curr_buf == 0 || p->curr_buf_pos == p->curr_buf_length) && "previous buffer not exhausted"); while (length > 0 && p->bom_strip_position < sizeof(UTF8_BOM)) { if ((unsigned char)*buf == UTF8_BOM[p->bom_strip_position]) { // matched a BOM character buf++; length--; p->bom_strip_position++; } else { if (p->bom_strip_position == 0) { // no BOM in this document p->bom_strip_position = sizeof(UTF8_BOM); } else { // malformed BOM (prefix present, rest missing) p->bom_strip_position = 0xff; } } } p->curr_buf = buf; p->curr_buf_length = length; p->curr_buf_pos = 0; p->curr_buf_is_partial = is_partial; } static jv make_error(struct jv_parser*, const char *, ...) JV_PRINTF_LIKE(2, 3); static jv make_error(struct jv_parser* p, const char *fmt, ...) { va_list ap; va_start(ap, fmt); jv e = jv_string_vfmt(fmt, ap); va_end(ap); if ((p->flags & JV_PARSE_STREAM_ERRORS)) return JV_ARRAY(e, jv_copy(p->path)); return jv_invalid_with_msg(e); } jv jv_parser_next(struct jv_parser* p) { if (p->eof) return jv_invalid(); if (!p->curr_buf) return jv_invalid(); // Need a buffer if (p->bom_strip_position == 0xff) { if (!(p->flags & JV_PARSE_SEQ)) return jv_invalid_with_msg(jv_string("Malformed BOM")); p->st =JV_PARSER_WAITING_FOR_RS; parser_reset(p); } jv value = jv_invalid(); if ((p->flags & JV_PARSE_STREAMING) && stream_check_done(p, &value)) return value; char ch; presult msg = 0; while (!msg && p->curr_buf_pos < p->curr_buf_length) { ch = p->curr_buf[p->curr_buf_pos++]; if (p->st == JV_PARSER_WAITING_FOR_RS) { if (ch == '\n') { p->line++; p->column = 0; } else { p->column++; } if (ch == '\036') p->st = JV_PARSER_NORMAL; continue; // need to resync, wait for RS } msg = scan(p, ch, &value); } if (msg == OK) { return value; } else if (msg) { jv_free(value); if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) { // Skip to the next RS p->st = JV_PARSER_WAITING_FOR_RS; value = make_error(p, "%s at line %d, column %d (need RS to resync)", msg, p->line, p->column); parser_reset(p); return value; } value = make_error(p, "%s at line %d, column %d", msg, p->line, p->column); parser_reset(p); if (!(p->flags & JV_PARSE_SEQ)) { // We're not parsing a JSON text sequence; throw this buffer away. // XXX We should fail permanently here. p->curr_buf = 0; p->curr_buf_pos = 0; } // Else ch must be RS; don't clear buf so we can start parsing again after this ch return value; } else if (p->curr_buf_is_partial) { assert(p->curr_buf_pos == p->curr_buf_length); // need another buffer return jv_invalid(); } else { // at EOF p->eof = 1; assert(p->curr_buf_pos == p->curr_buf_length); jv_free(value); if (p->st == JV_PARSER_WAITING_FOR_RS) return make_error(p, "Unfinished abandoned text at EOF at line %d, column %d", p->line, p->column); if (p->st != JV_PARSER_NORMAL) { value = make_error(p, "Unfinished string at EOF at line %d, column %d", p->line, p->column); parser_reset(p); p->st = JV_PARSER_WAITING_FOR_RS; return value; } if ((msg = check_literal(p))) { value = make_error(p, "%s at EOF at line %d, column %d", msg, p->line, p->column); parser_reset(p); p->st = JV_PARSER_WAITING_FOR_RS; return value; } if (((p->flags & JV_PARSE_STREAMING) && p->stacklen != 0) || (!(p->flags & JV_PARSE_STREAMING) && p->stackpos != 0)) { value = make_error(p, "Unfinished JSON term at EOF at line %d, column %d", p->line, p->column); parser_reset(p); p->st = JV_PARSER_WAITING_FOR_RS; return value; } // p->next is either invalid (nothing here, but no syntax error) // or valid (this is the value). either way it's the thing to return if ((p->flags & JV_PARSE_STREAMING) && jv_is_valid(p->next)) { value = JV_ARRAY(jv_copy(p->path), p->next); // except in streaming mode we've got to make it [path,value] } else { value = p->next; } p->next = jv_invalid(); if ((p->flags & JV_PARSE_SEQ) && !p->last_ch_was_ws && jv_get_kind(value) == JV_KIND_NUMBER) { jv_free(value); return make_error(p, "Potentially truncated top-level numeric value at EOF at line %d, column %d", p->line, p->column); } return value; } } jv jv_parse_sized_custom_flags(const char* string, int length, int flags) { struct jv_parser parser; parser_init(&parser, flags); jv_parser_set_buf(&parser, string, length, 0); jv value = jv_parser_next(&parser); if (jv_is_valid(value)) { jv next = jv_parser_next(&parser); if (jv_is_valid(next)) { // multiple JSON values, we only wanted one jv_free(value); jv_free(next); value = jv_invalid_with_msg(jv_string("Unexpected extra JSON values")); } else if (jv_invalid_has_msg(jv_copy(next))) { // parser error after the first JSON value jv_free(value); value = next; } else { // a single valid JSON value jv_free(next); } } else if (jv_invalid_has_msg(jv_copy(value))) { // parse error, we'll return it } else { // no value at all jv_free(value); value = jv_invalid_with_msg(jv_string("Expected JSON value")); } parser_free(&parser); if (!jv_is_valid(value) && jv_invalid_has_msg(jv_copy(value))) { jv msg = jv_invalid_get_msg(value); value = jv_invalid_with_msg(jv_string_fmt("%s (while parsing '%.*s')", jv_string_value(msg), length, string)); jv_free(msg); } return value; } jv jv_parse_sized(const char* string, int length) { return jv_parse_sized_custom_flags(string, length, 0); } jv jv_parse(const char* string) { return jv_parse_sized(string, strlen(string)); } jv jv_parse_custom_flags(const char* string, int flags) { return jv_parse_sized_custom_flags(string, strlen(string), flags); } jq-1.8.2/src/jv_alloc.c0000644000175100017510000001056715215513536010362 #include #include #include #include #include "jv.h" struct nomem_handler { jv_nomem_handler_f handler; void *data; }; #if !defined(HAVE_PTHREAD_KEY_CREATE) || \ !defined(HAVE_PTHREAD_ONCE) || \ !defined(HAVE_ATEXIT) /* Try thread-local storage? */ #ifdef _MSC_VER /* Visual C++: yes */ static __declspec(thread) struct nomem_handler nomem_handler; #define USE_TLS #else #ifdef HAVE___THREAD /* GCC and friends: yes */ static __thread struct nomem_handler nomem_handler; #define USE_TLS #endif /* HAVE___THREAD */ #endif /* _MSC_VER */ #endif /* !HAVE_PTHREAD_KEY_CREATE */ #ifdef USE_TLS void jv_nomem_handler(jv_nomem_handler_f handler, void *data) { nomem_handler.handler = handler; } static void memory_exhausted(void) { if (nomem_handler.handler) nomem_handler.handler(nomem_handler.data); // Maybe handler() will longjmp() to safety // Or not fprintf(stderr, "jq: error: cannot allocate memory\n"); abort(); } #else /* USE_TLS */ #ifdef HAVE_PTHREAD_KEY_CREATE #include static pthread_key_t nomem_handler_key; static pthread_once_t mem_once = PTHREAD_ONCE_INIT; /* tsd_fini is called on application exit */ /* it clears the nomem_handler allocated in the main thread */ static void tsd_fini(void) { struct nomem_handler *nomem_handler; nomem_handler = pthread_getspecific(nomem_handler_key); if (nomem_handler) { (void) pthread_setspecific(nomem_handler_key, NULL); free(nomem_handler); } } /* The tsd_fini_thread is a destructor set by calling */ /* pthread_key_create(&nomem_handler_key, tsd_fini_thread) */ /* It is called when thread ends */ static void tsd_fini_thread(void *nomem_handler) { free(nomem_handler); } static void tsd_init(void) { if (pthread_key_create(&nomem_handler_key, tsd_fini_thread) != 0) { fprintf(stderr, "jq: error: cannot create thread specific key"); abort(); } if (atexit(tsd_fini) != 0) { fprintf(stderr, "jq: error: cannot set an exit handler"); abort(); } } static void tsd_init_nomem_handler(void) { if (pthread_getspecific(nomem_handler_key) == NULL) { struct nomem_handler *nomem_handler = calloc(1, sizeof(struct nomem_handler)); if (pthread_setspecific(nomem_handler_key, nomem_handler) != 0) { fprintf(stderr, "jq: error: cannot set thread specific data"); abort(); } } } void jv_nomem_handler(jv_nomem_handler_f handler, void *data) { pthread_once(&mem_once, tsd_init); // cannot fail tsd_init_nomem_handler(); struct nomem_handler *nomem_handler; nomem_handler = pthread_getspecific(nomem_handler_key); if (nomem_handler == NULL) { handler(data); fprintf(stderr, "jq: error: cannot allocate memory\n"); abort(); } nomem_handler->handler = handler; nomem_handler->data = data; } static void memory_exhausted(void) { struct nomem_handler *nomem_handler; pthread_once(&mem_once, tsd_init); tsd_init_nomem_handler(); nomem_handler = pthread_getspecific(nomem_handler_key); if (nomem_handler && nomem_handler->handler) nomem_handler->handler(nomem_handler->data); // Maybe handler() will longjmp() to safety // Or not fprintf(stderr, "jq: error: cannot allocate memory\n"); abort(); } #else /* No thread-local storage of any kind that we know how to handle */ static struct nomem_handler nomem_handler; void jv_nomem_handler(jv_nomem_handler_f handler, void *data) { nomem_handler.handler = handler; nomem_handler.data = data; } static void memory_exhausted(void) { fprintf(stderr, "jq: error: cannot allocate memory\n"); abort(); } #endif /* HAVE_PTHREAD_KEY_CREATE */ #endif /* USE_TLS */ void* jv_mem_alloc(size_t sz) { void* p = malloc(sz); if (!p) { memory_exhausted(); } return p; } void* jv_mem_alloc_unguarded(size_t sz) { return malloc(sz); } void* jv_mem_calloc(size_t nemb, size_t sz) { assert(nemb > 0 && sz > 0); void* p = calloc(nemb, sz); if (!p) { memory_exhausted(); } return p; } void* jv_mem_calloc_unguarded(size_t nemb, size_t sz) { assert(nemb > 0 && sz > 0); return calloc(nemb, sz); } char* jv_mem_strdup(const char *s) { char *p = strdup(s); if (!p) { memory_exhausted(); } return p; } char* jv_mem_strdup_unguarded(const char *s) { return strdup(s); } void jv_mem_free(void* p) { free(p); } void* jv_mem_realloc(void* p, size_t sz) { p = realloc(p, sz); if (!p) { memory_exhausted(); } return p; } jq-1.8.2/src/builtin.jq0000644000175100017510000002263715215513536010430 def halt_error: halt_error(5); def error(msg): msg|error; def map(f): [.[] | f]; def select(f): if f then . else empty end; def sort_by(f): _sort_by_impl(map([f])); def group_by(f): _group_by_impl(map([f])); def unique_by(f): _unique_by_impl(map([f])); def max_by(f): _max_by_impl(map([f])); def min_by(f): _min_by_impl(map([f])); def add(f): reduce f as $x (null; . + $x); def add: add(.[]); def del(f): delpaths([path(f)]); def abs: if . < 0 then - . else . end; def _assign(paths; $value): reduce path(paths) as $p (.; setpath($p; $value)); def _modify(paths; update): reduce path(paths) as $p ([., []]; . as $dot | null | label $out | ($dot[0] | getpath($p)) as $v | ( ( $$$$v | update | (., break $out) as $v | $$$$dot | setpath([0] + $p; $v) ), ( $$$$dot | setpath([1, (.[1] | length)]; $p) ) ) ) | . as $dot | $dot[0] | delpaths($dot[1]); def map_values(f): .[] |= f; # recurse def recurse(f): def r: ., (f | r); r; def recurse(f; cond): def r: ., (f | select(cond) | r); r; def recurse: recurse(.[]?); def to_entries: [keys_unsorted[] as $k | {key: $k, value: .[$k]}]; def from_entries: map({ (.key // .Key // .name // .Name): if has("value") then .value else .Value end }) | add // {}; def with_entries(f): to_entries | map(f) | from_entries; def reverse: [.[length - 1 - range(0;length)]]; def indices($i): if type == "array" and ($i|type) == "array" then .[$i] elif type == "array" then .[[$i]] elif type == "string" and ($i|type) == "string" then _strindices($i) else .[$i] end; def index($i): indices($i) | .[0]; # TODO: optimize def rindex($i): indices($i) | .[-1:][0]; # TODO: optimize def paths: path(recurse)|select(length > 0); def paths(node_filter): path(recurse|select(node_filter))|select(length > 0); def isfinite: type == "number" and (isinfinite | not); def arrays: select(type == "array"); def objects: select(type == "object"); def iterables: select(type|. == "array" or . == "object"); def booleans: select(type == "boolean"); def numbers: select(type == "number"); def normals: select(isnormal); def finites: select(isfinite); def strings: select(type == "string"); def nulls: select(. == null); def values: select(. != null); def scalars: select(type|. != "array" and . != "object"); def join($x): reduce .[] as $i (null; (if .==null then "" else .+$x end) + ($i | if type=="boolean" or type=="number" then tostring else .//"" end) ) // ""; def _flatten($x): reduce .[] as $i ([]; if $i | type == "array" and $x != 0 then . + ($i | _flatten($x-1)) else . + [$i] end); def flatten($x): if $x < 0 then error("flatten depth must not be negative") else _flatten($x) end; def flatten: _flatten(-1); def range($x): range(0;$x); def fromdateiso8601: strptime("%Y-%m-%dT%H:%M:%SZ")|mktime; def todateiso8601: strftime("%Y-%m-%dT%H:%M:%SZ"); def fromdate: fromdateiso8601; def todate: todateiso8601; def ltrimstr($left): if startswith($left) then .[$left | length:] end; def rtrimstr($right): if endswith($right) then .[:length - ($right | length)] end; def trimstr($val): ltrimstr($val) | rtrimstr($val); def match(re; mode): _match_impl(re; mode; false)|.[]; def match($val): ($val|type) as $vt | if $vt == "string" then match($val; null) elif $vt == "array" and ($val | length) > 1 then match($val[0]; $val[1]) elif $vt == "array" and ($val | length) > 0 then match($val[0]; null) else error( $vt + " not a string or array") end; def test(re; mode): _match_impl(re; mode; true); def test($val): ($val|type) as $vt | if $vt == "string" then test($val; null) elif $vt == "array" and ($val | length) > 1 then test($val[0]; $val[1]) elif $vt == "array" and ($val | length) > 0 then test($val[0]; null) else error( $vt + " not a string or array") end; def capture(re; mods): match(re; mods) | reduce ( .captures | .[] | select(.name != null) | { (.name) : .string } ) as $pair ({}; . + $pair); def capture($val): ($val|type) as $vt | if $vt == "string" then capture($val; null) elif $vt == "array" and ($val | length) > 1 then capture($val[0]; $val[1]) elif $vt == "array" and ($val | length) > 0 then capture($val[0]; null) else error( $vt + " not a string or array") end; def scan($re; $flags): match($re; "g" + $flags) | if (.captures|length > 0) then [ .captures | .[] | .string ] else .string end; def scan($re): scan($re; null); # splits/1 produces a stream; split/1 is retained for backward compatibility. def splits($re; $flags): .[foreach (match($re; $flags+"g"), null) as {$offset, $length} (null; {start: .next, end: $offset, next: ($offset+$length)})]; def splits($re): splits($re; null); # split emits an array for backward compatibility def split($re; $flags): [ splits($re; $flags) ]; # If s contains capture variables, then create a capture object and pipe it to s, bearing # in mind that s could be a stream def sub($re; s; $flags): . as $in | (reduce match($re; $flags) as $edit ({result: [], previous: 0}; $in[ .previous: ($edit | .offset) ] as $gap # create the "capture" objects (one per item in s) | [reduce ( $edit | .captures | .[] | select(.name != null) | { (.name) : .string } ) as $pair ({}; . + $pair) | s ] as $inserts | reduce range(0; $inserts|length) as $ix (.; .result[$ix] += $gap + $inserts[$ix]) | .previous = ($edit | .offset + .length ) ) | .result[] + $in[.previous:] ) // $in; def sub($re; s): sub($re; s; ""); def gsub($re; s; flags): sub($re; s; flags + "g"); def gsub($re; s): sub($re; s; "g"); ######################################################################## # generic iterator/generator def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; def until(cond; next): def _until: if cond then . else (next|_until) end; _until; def limit($n; expr): if $n > 0 then label $out | foreach expr as $item ($n; . - 1; $item, if . <= 0 then break $out else empty end) elif $n == 0 then empty else error("limit doesn't support negative count") end; def skip($n; expr): if $n > 0 then foreach expr as $item ($n; . - 1; if . < 0 then $item else empty end) elif $n == 0 then expr else error("skip doesn't support negative count") end; # range/3, with a `by` expression argument def range($init; $upto; $by): if $by > 0 then $init|while(. < $upto; . + $by) elif $by < 0 then $init|while(. > $upto; . + $by) else empty end; def first(g): label $out | g | ., break $out; def isempty(g): first((g|false), true); def all(generator; condition): isempty(generator|condition and empty); def any(generator; condition): isempty(generator|condition or empty)|not; def all(condition): all(.[]; condition); def any(condition): any(.[]; condition); def all: all(.[]; .); def any: any(.[]; .); def nth($n; g): if $n < 0 then error("nth doesn't support negative indices") else first(skip($n; g)) end; def first: .[0]; def last: .[-1]; def nth($n): .[$n]; def combinations: if length == 0 then [] else .[0][] as $x | (.[1:] | combinations) as $y | [$x] + $y end; def combinations(n): . as $dot | [range(n) | $dot] | combinations; # transpose a possibly jagged matrix, quickly; # rows are padded with nulls so the result is always rectangular. def transpose: [range(0; map(length)|max // 0) as $i | [.[][$i]]]; def in(xs): . as $x | xs | has($x); def inside(xs): . as $x | xs | contains($x); def repeat(exp): def _repeat: exp, _repeat; _repeat; def inputs: try repeat(input) catch if .=="break" then empty else error end; # like ruby's downcase - only characters A to Z are affected def ascii_downcase: explode | map( if 65 <= . and . <= 90 then . + 32 else . end) | implode; # like ruby's upcase - only characters a to z are affected def ascii_upcase: explode | map( if 97 <= . and . <= 122 then . - 32 else . end) | implode; # Streaming utilities def truncate_stream(stream): . as $n | null | stream | . as $input | if (.[0]|length) > $n then setpath([0];$input[0][$n:]) else empty end; def fromstream(i): {x: null, e: false} as $init | # .x = object being built; .e = emit and reset state foreach i as $i ($init ; if .e then $init else . end | if $i|length == 2 then setpath(["e"]; $i[0]|length==0) | setpath(["x"]+$i[0]; $i[1]) else setpath(["e"]; $i[0]|length==1) end ; if .e then .x else empty end); def tostream: path(def r: (.[]?|r), .; r) as $p | getpath($p) | reduce path(.[]?) as $q ([$p, .]; [$p+$q]); # Apply f to composite entities recursively, and to atoms def walk(f): def w: if type == "object" then map_values(w) elif type == "array" then map(w) else . end | f; w; # pathexps could be a stream of dot-paths def pick(pathexps): . as $in | reduce path(pathexps) as $a (null; setpath($a; $in|getpath($a)) ); # ensure the output of debug(m1,m2) is kept together: def debug(msgs): (msgs | debug | empty), .; # SQL-ish operators here: def INDEX(stream; idx_expr): reduce stream as $row ({}; .[$row|idx_expr|tostring] = $row); def INDEX(idx_expr): INDEX(.[]; idx_expr); def JOIN($idx; idx_expr): [.[] | [., $idx[idx_expr]]]; def JOIN($idx; stream; idx_expr): stream | [., $idx[idx_expr]]; def JOIN($idx; stream; idx_expr; join_expr): stream | [., $idx[idx_expr]] | join_expr; def IN(s): any(s == .; .); def IN(src; s): any(src == s; .); jq-1.8.2/src/jv_dtoa_tsd.c0000644000175100017510000000243115215513536011060 #include #include #include "jv_thread.h" #include "jv_dtoa_tsd.h" #include "jv_dtoa.h" #include "jv_alloc.h" static pthread_once_t dtoa_ctx_once = PTHREAD_ONCE_INIT; static pthread_key_t dtoa_ctx_key; static void tsd_dtoa_ctx_dtor(void *ctx) { if (ctx) { jvp_dtoa_context_free((struct dtoa_context *)ctx); jv_mem_free(ctx); } } #ifndef WIN32 static #endif void jv_tsd_dtoa_ctx_fini(void) { struct dtoa_context *ctx = pthread_getspecific(dtoa_ctx_key); tsd_dtoa_ctx_dtor(ctx); pthread_setspecific(dtoa_ctx_key, NULL); } #ifndef WIN32 static #endif void jv_tsd_dtoa_ctx_init(void) { if (pthread_key_create(&dtoa_ctx_key, tsd_dtoa_ctx_dtor) != 0) { fprintf(stderr, "error: cannot create thread specific key"); abort(); } atexit(jv_tsd_dtoa_ctx_fini); } inline struct dtoa_context *tsd_dtoa_context_get(void) { pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key); if (!ctx) { ctx = jv_mem_alloc(sizeof(struct dtoa_context)); jvp_dtoa_context_init(ctx); if (pthread_setspecific(dtoa_ctx_key, ctx) != 0) { jv_mem_free(ctx); fprintf(stderr, "error: cannot set thread specific data"); abort(); } } return ctx; } jq-1.8.2/src/lexer.c0000644000175100017510000022014115215513567007703 #line 2 "src/lexer.c" #line 4 "src/lexer.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif #ifdef yy_create_buffer #define jq_yy_create_buffer_ALREADY_DEFINED #else #define yy_create_buffer jq_yy_create_buffer #endif #ifdef yy_delete_buffer #define jq_yy_delete_buffer_ALREADY_DEFINED #else #define yy_delete_buffer jq_yy_delete_buffer #endif #ifdef yy_scan_buffer #define jq_yy_scan_buffer_ALREADY_DEFINED #else #define yy_scan_buffer jq_yy_scan_buffer #endif #ifdef yy_scan_string #define jq_yy_scan_string_ALREADY_DEFINED #else #define yy_scan_string jq_yy_scan_string #endif #ifdef yy_scan_bytes #define jq_yy_scan_bytes_ALREADY_DEFINED #else #define yy_scan_bytes jq_yy_scan_bytes #endif #ifdef yy_init_buffer #define jq_yy_init_buffer_ALREADY_DEFINED #else #define yy_init_buffer jq_yy_init_buffer #endif #ifdef yy_flush_buffer #define jq_yy_flush_buffer_ALREADY_DEFINED #else #define yy_flush_buffer jq_yy_flush_buffer #endif #ifdef yy_load_buffer_state #define jq_yy_load_buffer_state_ALREADY_DEFINED #else #define yy_load_buffer_state jq_yy_load_buffer_state #endif #ifdef yy_switch_to_buffer #define jq_yy_switch_to_buffer_ALREADY_DEFINED #else #define yy_switch_to_buffer jq_yy_switch_to_buffer #endif #ifdef yypush_buffer_state #define jq_yypush_buffer_state_ALREADY_DEFINED #else #define yypush_buffer_state jq_yypush_buffer_state #endif #ifdef yypop_buffer_state #define jq_yypop_buffer_state_ALREADY_DEFINED #else #define yypop_buffer_state jq_yypop_buffer_state #endif #ifdef yyensure_buffer_stack #define jq_yyensure_buffer_stack_ALREADY_DEFINED #else #define yyensure_buffer_stack jq_yyensure_buffer_stack #endif #ifdef yylex #define jq_yylex_ALREADY_DEFINED #else #define yylex jq_yylex #endif #ifdef yyrestart #define jq_yyrestart_ALREADY_DEFINED #else #define yyrestart jq_yyrestart #endif #ifdef yylex_init #define jq_yylex_init_ALREADY_DEFINED #else #define yylex_init jq_yylex_init #endif #ifdef yylex_init_extra #define jq_yylex_init_extra_ALREADY_DEFINED #else #define yylex_init_extra jq_yylex_init_extra #endif #ifdef yylex_destroy #define jq_yylex_destroy_ALREADY_DEFINED #else #define yylex_destroy jq_yylex_destroy #endif #ifdef yyget_debug #define jq_yyget_debug_ALREADY_DEFINED #else #define yyget_debug jq_yyget_debug #endif #ifdef yyset_debug #define jq_yyset_debug_ALREADY_DEFINED #else #define yyset_debug jq_yyset_debug #endif #ifdef yyget_extra #define jq_yyget_extra_ALREADY_DEFINED #else #define yyget_extra jq_yyget_extra #endif #ifdef yyset_extra #define jq_yyset_extra_ALREADY_DEFINED #else #define yyset_extra jq_yyset_extra #endif #ifdef yyget_in #define jq_yyget_in_ALREADY_DEFINED #else #define yyget_in jq_yyget_in #endif #ifdef yyset_in #define jq_yyset_in_ALREADY_DEFINED #else #define yyset_in jq_yyset_in #endif #ifdef yyget_out #define jq_yyget_out_ALREADY_DEFINED #else #define yyget_out jq_yyget_out #endif #ifdef yyset_out #define jq_yyset_out_ALREADY_DEFINED #else #define yyset_out jq_yyset_out #endif #ifdef yyget_leng #define jq_yyget_leng_ALREADY_DEFINED #else #define yyget_leng jq_yyget_leng #endif #ifdef yyget_text #define jq_yyget_text_ALREADY_DEFINED #else #define yyget_text jq_yyget_text #endif #ifdef yyget_lineno #define jq_yyget_lineno_ALREADY_DEFINED #else #define yyget_lineno jq_yyget_lineno #endif #ifdef yyset_lineno #define jq_yyset_lineno_ALREADY_DEFINED #else #define yyset_lineno jq_yyset_lineno #endif #ifdef yyget_column #define jq_yyget_column_ALREADY_DEFINED #else #define yyget_column jq_yyget_column #endif #ifdef yyset_column #define jq_yyset_column_ALREADY_DEFINED #else #define yyset_column jq_yyset_column #endif #ifdef yywrap #define jq_yywrap_ALREADY_DEFINED #else #define yywrap jq_yywrap #endif #ifdef yyget_lval #define jq_yyget_lval_ALREADY_DEFINED #else #define yyget_lval jq_yyget_lval #endif #ifdef yyset_lval #define jq_yyset_lval_ALREADY_DEFINED #else #define yyset_lval jq_yyset_lval #endif #ifdef yyget_lloc #define jq_yyget_lloc_ALREADY_DEFINED #else #define yyget_lloc jq_yyget_lloc #endif #ifdef yyset_lloc #define jq_yyset_lloc_ALREADY_DEFINED #else #define yyset_lloc jq_yyset_lloc #endif #ifdef yyalloc #define jq_yyalloc_ALREADY_DEFINED #else #define yyalloc jq_yyalloc #endif #ifdef yyrealloc #define jq_yyrealloc_ALREADY_DEFINED #else #define yyrealloc jq_yyrealloc #endif #ifdef yyfree #define jq_yyfree_ALREADY_DEFINED #else #define yyfree jq_yyfree #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX #define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ /* begin standard C++ headers. */ /* TODO: this is always defined, so inline it */ #define yyconst const #if defined(__GNUC__) && __GNUC__ >= 3 #define yynoreturn __attribute__((__noreturn__)) #else #define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an * integer in range [0..255] for use as an array index. */ #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; #endif /* For convenience, these vars (plus the bison vars far below) are macros in the reentrant scanner. */ #define yyin yyg->yyin_r #define yyout yyg->yyout_r #define yyextra yyg->yyextra_r #define yyleng yyg->yyleng_r #define yytext yyg->yytext_r #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yyg->yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yyg->yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin , yyscanner ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = yyg->yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] void yyrestart ( FILE *input_file , yyscan_t yyscanner ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); void yypop_buffer_state ( yyscan_t yyscanner ); static void yyensure_buffer_stack ( yyscan_t yyscanner ); static void yy_load_buffer_state ( yyscan_t yyscanner ); static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); void *yyalloc ( yy_size_t , yyscan_t yyscanner ); void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); void yyfree ( void * , yyscan_t yyscanner ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define jq_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef flex_uint8_t YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); static int yy_get_next_buffer ( yyscan_t yyscanner ); static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; #define YY_NUM_RULES 53 #define YY_END_OF_BUFFER 54 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static const flex_int16_t yy_accept[171] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 52, 51, 51, 52, 42, 1, 37, 37, 38, 39, 37, 37, 37, 37, 37, 37, 41, 37, 37, 37, 37, 52, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 37, 46, 46, 44, 47, 2, 3, 2, 2, 51, 4, 50, 50, 31, 29, 27, 28, 35, 41, 49, 20, 30, 41, 41, 0, 33, 5, 34, 0, 40, 48, 0, 48, 6, 48, 48, 48, 48, 48, 48, 11, 48, 48, 48, 48, 16, 48, 48, 48, 26, 46, 45, 43, 45, 3, 2, 0, 50, 0, 50, 49, 32, 41, 0, 41, 36, 0, 15, 48, 48, 10, 48, 48, 17, 48, 48, 48, 48, 48, 48, 48, 21, 0, 45, 0, 50, 48, 48, 48, 14, 13, 48, 48, 48, 48, 48, 48, 12, 45, 50, 24, 22, 48, 48, 48, 23, 48, 48, 45, 50, 48, 7, 48, 9, 18, 50, 19, 8, 25, 0 } ; static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 6, 7, 8, 9, 1, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 26, 26, 27, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 28, 29, 30, 1, 31, 1, 32, 33, 34, 35, 36, 37, 26, 38, 39, 26, 40, 41, 42, 43, 44, 45, 26, 46, 47, 48, 49, 26, 26, 26, 50, 26, 51, 52, 53, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static const YY_CHAR yy_meta[54] = { 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 6, 6, 1, 7, 1, 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1 } ; static const flex_int16_t yy_base[186] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 52, 56, 58, 340, 341, 61, 64, 317, 341, 341, 307, 315, 341, 341, 314, 313, 341, 312, 53, 53, 56, 311, 310, 309, 313, 0, 310, 54, 57, 58, 59, 63, 65, 70, 67, 72, 69, 60, 79, 306, 0, 0, 341, 83, 341, 341, 324, 107, 116, 341, 307, 83, 341, 341, 341, 341, 341, 103, 0, 303, 341, 104, 108, 128, 341, 341, 341, 307, 0, 304, 301, 110, 297, 114, 75, 115, 108, 118, 119, 293, 109, 123, 129, 132, 290, 137, 130, 139, 341, 0, 276, 341, 273, 341, 341, 297, 278, 265, 140, 0, 341, 142, 261, 258, 341, 0, 252, 142, 145, 250, 149, 144, 247, 151, 152, 154, 156, 157, 158, 165, 245, 172, 231, 0, 166, 222, 164, 171, 221, 220, 169, 172, 174, 175, 178, 179, 218, 206, 180, 215, 214, 181, 183, 192, 213, 184, 186, 201, 193, 198, 210, 206, 209, 89, 207, 86, 81, 37, 341, 242, 250, 253, 259, 264, 269, 277, 285, 290, 295, 300, 302, 307, 311, 315 } ; static const flex_int16_t yy_def[186] = { 0, 170, 1, 1, 1, 1, 1, 1, 1, 1, 1, 171, 171, 172, 172, 170, 170, 170, 170, 170, 170, 170, 173, 170, 170, 170, 170, 170, 170, 170, 174, 170, 170, 170, 170, 170, 170, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 170, 177, 177, 170, 178, 170, 170, 170, 170, 170, 170, 179, 179, 170, 170, 170, 170, 170, 170, 180, 170, 170, 170, 170, 170, 170, 170, 170, 170, 175, 176, 170, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 170, 177, 170, 170, 181, 170, 170, 170, 179, 170, 179, 180, 170, 170, 170, 170, 170, 182, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 178, 183, 173, 179, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 184, 179, 176, 176, 176, 176, 176, 176, 176, 176, 185, 179, 176, 176, 176, 176, 176, 179, 176, 176, 179, 0, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170 } ; static const flex_int16_t yy_nxt[395] = { 0, 16, 17, 18, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 28, 28, 33, 34, 35, 36, 37, 38, 38, 24, 16, 25, 38, 39, 40, 41, 42, 43, 44, 38, 45, 38, 46, 47, 38, 48, 38, 49, 38, 50, 38, 38, 24, 51, 25, 53, 53, 109, 54, 54, 57, 58, 57, 58, 60, 60, 60, 60, 60, 60, 68, 71, 69, 73, 82, 74, 72, 82, 82, 82, 82, 55, 55, 82, 75, 82, 59, 82, 59, 82, 82, 86, 82, 75, 103, 82, 87, 97, 83, 82, 94, 82, 84, 109, 85, 88, 82, 89, 91, 82, 90, 106, 107, 92, 93, 110, 96, 95, 98, 60, 60, 60, 69, 113, 120, 73, 99, 74, 82, 82, 82, 75, 75, 104, 82, 82, 75, 106, 82, 82, 75, 75, 114, 82, 114, 75, 118, 115, 122, 82, 82, 119, 82, 121, 124, 126, 123, 82, 127, 82, 109, 113, 82, 128, 82, 82, 125, 131, 129, 82, 75, 82, 82, 130, 82, 138, 82, 82, 82, 75, 139, 141, 136, 170, 82, 82, 109, 140, 142, 82, 132, 82, 82, 145, 82, 82, 144, 143, 82, 82, 109, 82, 153, 82, 82, 151, 82, 146, 147, 148, 152, 150, 82, 109, 158, 160, 161, 156, 82, 154, 157, 164, 104, 165, 155, 166, 82, 109, 163, 82, 82, 133, 162, 82, 82, 82, 133, 167, 82, 169, 82, 82, 82, 168, 52, 52, 52, 52, 52, 52, 52, 52, 56, 56, 56, 56, 56, 56, 56, 56, 62, 133, 62, 70, 70, 82, 70, 82, 70, 80, 82, 80, 82, 80, 81, 81, 81, 115, 81, 101, 115, 101, 101, 101, 101, 135, 101, 102, 102, 102, 102, 102, 102, 102, 102, 108, 108, 108, 109, 108, 111, 106, 111, 133, 111, 134, 133, 134, 134, 137, 82, 137, 149, 82, 149, 149, 159, 82, 159, 159, 102, 117, 102, 102, 82, 116, 112, 109, 105, 100, 82, 79, 78, 77, 76, 67, 66, 65, 64, 63, 61, 170, 15, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170 } ; static const flex_int16_t yy_chk[395] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 12, 169, 11, 12, 13, 13, 14, 14, 17, 17, 17, 18, 18, 18, 30, 31, 30, 32, 39, 32, 31, 40, 41, 42, 49, 11, 12, 43, 32, 44, 13, 46, 14, 48, 45, 41, 47, 32, 55, 86, 42, 49, 39, 50, 46, 168, 39, 63, 40, 43, 167, 43, 45, 165, 44, 59, 59, 45, 45, 63, 48, 47, 50, 60, 60, 60, 69, 73, 86, 74, 50, 74, 88, 92, 83, 69, 73, 55, 85, 87, 74, 59, 89, 90, 69, 73, 75, 93, 75, 74, 83, 75, 88, 94, 98, 85, 95, 87, 89, 92, 88, 97, 93, 99, 110, 113, 119, 94, 123, 120, 90, 98, 95, 122, 113, 125, 126, 97, 127, 119, 128, 129, 130, 113, 120, 123, 110, 133, 138, 131, 136, 122, 125, 142, 99, 139, 143, 128, 144, 145, 127, 126, 146, 147, 150, 153, 142, 154, 157, 138, 158, 129, 130, 131, 139, 136, 155, 160, 147, 150, 153, 145, 161, 143, 146, 157, 133, 158, 144, 160, 163, 166, 155, 164, 162, 159, 154, 156, 152, 151, 149, 161, 148, 166, 141, 140, 137, 163, 171, 171, 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, 172, 173, 134, 173, 174, 174, 132, 174, 124, 174, 175, 121, 175, 118, 175, 176, 176, 176, 115, 176, 177, 114, 177, 177, 177, 177, 109, 177, 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 108, 179, 180, 107, 180, 104, 180, 181, 102, 181, 181, 182, 96, 182, 183, 91, 183, 183, 184, 84, 184, 184, 185, 82, 185, 185, 81, 79, 71, 62, 58, 51, 38, 36, 35, 34, 33, 29, 27, 26, 23, 22, 19, 15, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170 } ; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET #line 1 "src/lexer.l" #line 2 "src/lexer.l" #include #include "jv_alloc.h" #include "compile.h" struct lexer_param; #include "parser.h" /* Generated by bison. */ #define YY_USER_ACTION \ do { \ yylloc->start = yyget_extra(yyscanner); \ yylloc->end = yylloc->start + yyleng; \ yyset_extra(yylloc->end, yyscanner); \ } while (0); #line 818 "src/lexer.c" #line 26 "src/lexer.l" static int enter(int opening, int state, yyscan_t yyscanner); static int try_exit(int closing, int state, yyscan_t yyscanner); #line 823 "src/lexer.c" #define YY_NO_INPUT 1 #line 825 "src/lexer.c" #define INITIAL 0 #define IN_PAREN 1 #define IN_BRACKET 2 #define IN_BRACE 3 #define IN_QQINTERP 4 #define IN_QQSTRING 5 #define IN_COMMENT 6 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #define YY_EXTRA_TYPE int /* Holds the entire state of the reentrant scanner. */ struct yyguts_t { /* User-defined. Not touched by flex. */ YY_EXTRA_TYPE yyextra_r; /* The rest are the same as the globals declared in the non-reentrant scanner. */ FILE *yyin_r, *yyout_r; size_t yy_buffer_stack_top; /**< index of top of stack. */ size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; int yy_n_chars; int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; int yy_did_buffer_switch_on_eof; int yy_start_stack_ptr; int yy_start_stack_depth; int *yy_start_stack; yy_state_type yy_last_accepting_state; char* yy_last_accepting_cpos; int yylineno_r; int yy_flex_debug_r; char *yytext_r; int yy_more_flag; int yy_more_len; YYSTYPE * yylval_r; YYLTYPE * yylloc_r; }; /* end struct yyguts_t */ static int yy_init_globals ( yyscan_t yyscanner ); /* This must go here because YYSTYPE and YYLTYPE are included * from bison output in section 1.*/ # define yylval yyg->yylval_r # define yylloc yyg->yylloc_r int yylex_init (yyscan_t* scanner); int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy ( yyscan_t yyscanner ); int yyget_debug ( yyscan_t yyscanner ); void yyset_debug ( int debug_flag , yyscan_t yyscanner ); YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); FILE *yyget_in ( yyscan_t yyscanner ); void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); FILE *yyget_out ( yyscan_t yyscanner ); void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); int yyget_leng ( yyscan_t yyscanner ); char *yyget_text ( yyscan_t yyscanner ); int yyget_lineno ( yyscan_t yyscanner ); void yyset_lineno ( int _line_number , yyscan_t yyscanner ); int yyget_column ( yyscan_t yyscanner ); void yyset_column ( int _column_no , yyscan_t yyscanner ); YYSTYPE * yyget_lval ( yyscan_t yyscanner ); void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap ( yyscan_t yyscanner ); #else extern int yywrap ( yyscan_t yyscanner ); #endif #endif #ifndef YY_NO_UNPUT #endif #ifndef yytext_ptr static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput ( yyscan_t yyscanner ); #else static int input ( yyscan_t yyscanner ); #endif #endif static void yy_push_state ( int _new_state , yyscan_t yyscanner); static void yy_pop_state ( yyscan_t yyscanner ); static int yy_top_state ( yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); #define YY_DECL int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; yylloc = yylloc_param; if ( !yyg->yy_init ) { yyg->yy_init = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yyg->yy_start ) yyg->yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } yy_load_buffer_state( yyscanner ); } { #line 39 "src/lexer.l" #line 1120 "src/lexer.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; /* Support of yytext. */ *yy_cp = yyg->yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yyg->yy_start; yy_match: do { YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 171 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 341 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yyg->yy_hold_char; yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 41 "src/lexer.l" { yy_push_state(IN_COMMENT, yyscanner); } YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP #line 43 "src/lexer.l" { } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP #line 44 "src/lexer.l" { yy_pop_state(yyscanner); } YY_BREAK case YY_STATE_EOF(IN_COMMENT): #line 46 "src/lexer.l" { yy_pop_state(yyscanner); } YY_BREAK case 4: YY_RULE_SETUP #line 48 "src/lexer.l" { return NEQ; } YY_BREAK case 5: YY_RULE_SETUP #line 49 "src/lexer.l" { return EQ; } YY_BREAK case 6: YY_RULE_SETUP #line 50 "src/lexer.l" { return AS; } YY_BREAK case 7: YY_RULE_SETUP #line 51 "src/lexer.l" { return IMPORT; } YY_BREAK case 8: YY_RULE_SETUP #line 52 "src/lexer.l" { return INCLUDE; } YY_BREAK case 9: YY_RULE_SETUP #line 53 "src/lexer.l" { return MODULE; } YY_BREAK case 10: YY_RULE_SETUP #line 54 "src/lexer.l" { return DEF; } YY_BREAK case 11: YY_RULE_SETUP #line 55 "src/lexer.l" { return IF; } YY_BREAK case 12: YY_RULE_SETUP #line 56 "src/lexer.l" { return THEN; } YY_BREAK case 13: YY_RULE_SETUP #line 57 "src/lexer.l" { return ELSE; } YY_BREAK case 14: YY_RULE_SETUP #line 58 "src/lexer.l" { return ELSE_IF; } YY_BREAK case 15: YY_RULE_SETUP #line 59 "src/lexer.l" { return AND; } YY_BREAK case 16: YY_RULE_SETUP #line 60 "src/lexer.l" { return OR; } YY_BREAK case 17: YY_RULE_SETUP #line 61 "src/lexer.l" { return END; } YY_BREAK case 18: YY_RULE_SETUP #line 62 "src/lexer.l" { return REDUCE; } YY_BREAK case 19: YY_RULE_SETUP #line 63 "src/lexer.l" { return FOREACH; } YY_BREAK case 20: YY_RULE_SETUP #line 64 "src/lexer.l" { return DEFINEDOR; } YY_BREAK case 21: YY_RULE_SETUP #line 65 "src/lexer.l" { return TRY; } YY_BREAK case 22: YY_RULE_SETUP #line 66 "src/lexer.l" { return CATCH; } YY_BREAK case 23: YY_RULE_SETUP #line 67 "src/lexer.l" { return LABEL; } YY_BREAK case 24: YY_RULE_SETUP #line 68 "src/lexer.l" { return BREAK; } YY_BREAK case 25: YY_RULE_SETUP #line 69 "src/lexer.l" { return LOC; } YY_BREAK case 26: YY_RULE_SETUP #line 70 "src/lexer.l" { return SETPIPE; } YY_BREAK case 27: YY_RULE_SETUP #line 71 "src/lexer.l" { return SETPLUS; } YY_BREAK case 28: YY_RULE_SETUP #line 72 "src/lexer.l" { return SETMINUS; } YY_BREAK case 29: YY_RULE_SETUP #line 73 "src/lexer.l" { return SETMULT; } YY_BREAK case 30: YY_RULE_SETUP #line 74 "src/lexer.l" { return SETDIV; } YY_BREAK case 31: YY_RULE_SETUP #line 75 "src/lexer.l" { return SETMOD; } YY_BREAK case 32: YY_RULE_SETUP #line 76 "src/lexer.l" { return SETDEFINEDOR; } YY_BREAK case 33: YY_RULE_SETUP #line 77 "src/lexer.l" { return LESSEQ; } YY_BREAK case 34: YY_RULE_SETUP #line 78 "src/lexer.l" { return GREATEREQ; } YY_BREAK case 35: YY_RULE_SETUP #line 79 "src/lexer.l" { return REC; } YY_BREAK case 36: YY_RULE_SETUP #line 80 "src/lexer.l" { return ALTERNATION; } YY_BREAK case 37: YY_RULE_SETUP #line 81 "src/lexer.l" { return yytext[0];} YY_BREAK case 38: YY_RULE_SETUP #line 83 "src/lexer.l" { return enter(yytext[0], YY_START, yyscanner); } YY_BREAK case 39: YY_RULE_SETUP #line 87 "src/lexer.l" { return try_exit(yytext[0], YY_START, yyscanner); } YY_BREAK case 40: YY_RULE_SETUP #line 91 "src/lexer.l" { yylval->literal = jv_string_sized(yytext + 1, yyleng - 1); return FORMAT; } YY_BREAK case 41: YY_RULE_SETUP #line 95 "src/lexer.l" { yylval->literal = jv_parse_sized(yytext, yyleng); return LITERAL; } YY_BREAK case 42: YY_RULE_SETUP #line 99 "src/lexer.l" { yy_push_state(IN_QQSTRING, yyscanner); return QQSTRING_START; } YY_BREAK case 43: YY_RULE_SETUP #line 105 "src/lexer.l" { return enter(QQSTRING_INTERP_START, YY_START, yyscanner); } YY_BREAK case 44: YY_RULE_SETUP #line 108 "src/lexer.l" { yy_pop_state(yyscanner); return QQSTRING_END; } YY_BREAK case 45: /* rule 45 can match eol */ YY_RULE_SETUP #line 112 "src/lexer.l" { /* pass escapes to the json parser */ jv escapes = jv_string_fmt("\"%.*s\"", (int)yyleng, yytext); yylval->literal = jv_parse_sized(jv_string_value(escapes), jv_string_length_bytes(jv_copy(escapes))); jv_free(escapes); return QQSTRING_TEXT; } YY_BREAK case 46: /* rule 46 can match eol */ YY_RULE_SETUP #line 119 "src/lexer.l" { yylval->literal = jv_string_sized(yytext, yyleng); return QQSTRING_TEXT; } YY_BREAK case 47: YY_RULE_SETUP #line 123 "src/lexer.l" { return INVALID_CHARACTER; } YY_BREAK case 48: YY_RULE_SETUP #line 129 "src/lexer.l" { yylval->literal = jv_string(yytext); return IDENT;} YY_BREAK case 49: YY_RULE_SETUP #line 130 "src/lexer.l" { yylval->literal = jv_string(yytext+1); return FIELD;} YY_BREAK case 50: YY_RULE_SETUP #line 131 "src/lexer.l" { yylval->literal = jv_string(yytext+1); return BINDING;} YY_BREAK case 51: /* rule 51 can match eol */ YY_RULE_SETUP #line 133 "src/lexer.l" {} YY_BREAK case 52: YY_RULE_SETUP #line 135 "src/lexer.l" { return INVALID_CHARACTER; } YY_BREAK case 53: YY_RULE_SETUP #line 137 "src/lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 1482 "src/lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(IN_PAREN): case YY_STATE_EOF(IN_BRACKET): case YY_STATE_EOF(IN_BRACE): case YY_STATE_EOF(IN_QQINTERP): case YY_STATE_EOF(IN_QQSTRING): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yyg->yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( yyscanner ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yyg->yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yyg->yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer( yyscanner ) ) { case EOB_ACT_END_OF_FILE: { yyg->yy_did_buffer_switch_on_eof = 0; if ( yywrap( yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( yyscanner ); yy_cp = yyg->yy_c_buf_p; yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yyg->yy_c_buf_p = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; yy_current_state = yy_get_previous_state( yyscanner ); yy_cp = yyg->yy_c_buf_p; yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = yyg->yytext_ptr; int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc( (void *) b->yy_ch_buf, (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } if ( yyg->yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin , yyscanner); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); /* "- 2" to take care of EOB's */ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { yy_state_type yy_current_state; char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 171 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ char *yy_cp = yyg->yy_c_buf_p; YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 171 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 170); (void)yyg; return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) #else static int input (yyscan_t yyscanner) #endif { int c; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; *yyg->yy_c_buf_p = yyg->yy_hold_char; if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) /* This was really a NUL. */ *yyg->yy_c_buf_p = '\0'; else { /* need more input */ int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin , yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( yyscanner ) ) return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(yyscanner); #else return input(yyscanner); #endif } case EOB_ACT_CONTINUE_SCAN: yyg->yy_c_buf_p = yyg->yytext_ptr + offset; break; } } } c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ yyg->yy_hold_char = *++yyg->yy_c_buf_p; return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); yy_load_buffer_state( yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *yyg->yy_c_buf_p = yyg->yy_hold_char; YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( yyscanner ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } static void yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; yyg->yy_hold_char = *yyg->yy_c_buf_p; } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * @param yyscanner The scanner object. * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file , yyscanner); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * @param yyscanner The scanner object. */ void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree( (void *) b->yy_ch_buf , yyscanner ); yyfree( (void *) b , yyscanner ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_flush_buffer( b , yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( yyscanner ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * @param yyscanner The scanner object. */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; yyensure_buffer_stack(yyscanner); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *yyg->yy_c_buf_p = yyg->yy_hold_char; YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * @param yyscanner The scanner object. */ void yypop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER) { yy_load_buffer_state( yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (yyscan_t yyscanner) { yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; } if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return NULL; b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b , yyscanner ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) { return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc( n , yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n , yyscanner); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } static void yy_push_state (int _new_state , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) { yy_size_t new_size; yyg->yy_start_stack_depth += YY_START_STACK_INCR; new_size = (yy_size_t) yyg->yy_start_stack_depth * sizeof( int ); if ( ! yyg->yy_start_stack ) yyg->yy_start_stack = (int *) yyalloc( new_size , yyscanner ); else yyg->yy_start_stack = (int *) yyrealloc( (void *) yyg->yy_start_stack, new_size , yyscanner ); if ( ! yyg->yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; BEGIN(_new_state); } static void yy_pop_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( --yyg->yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); } static int yy_top_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = yyg->yy_hold_char; \ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ yyg->yy_hold_char = *yyg->yy_c_buf_p; \ *yyg->yy_c_buf_p = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; } /** Get the current line number. * @param yyscanner The scanner object. */ int yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (! YY_CURRENT_BUFFER) return 0; return yylineno; } /** Get the current column number. * @param yyscanner The scanner object. */ int yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (! YY_CURRENT_BUFFER) return 0; return yycolumn; } /** Get the input stream. * @param yyscanner The scanner object. */ FILE *yyget_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; } /** Get the output stream. * @param yyscanner The scanner object. */ FILE *yyget_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; } /** Get the length of the current token. * @param yyscanner The scanner object. */ int yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; } /** Get the current token. * @param yyscanner The scanner object. */ char *yyget_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; } /** Set the user-defined data. This data is never touched by the scanner. * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; } /** Set the current line number. * @param _line_number line number * @param yyscanner The scanner object. */ void yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); yylineno = _line_number; } /** Set the current column. * @param _column_no column number * @param yyscanner The scanner object. */ void yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "yyset_column called with no buffer" ); yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see yy_switch_to_buffer */ void yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyin = _in_str ; } void yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyout = _out_str ; } int yyget_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } void yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ YYSTYPE * yyget_lval (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylval; } void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; } YYLTYPE *yyget_lloc (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylloc; } void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylloc = yylloc_param; } /* User-visible API */ /* yylex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ int yylex_init(yyscan_t* ptr_yy_globals) { if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); return yy_init_globals ( *ptr_yy_globals ); } /* yylex_init_extra has the same functionality as yylex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). * The user defined value in the first argument will be available to yyalloc in * the yyextra field. */ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) { struct yyguts_t dummy_yyguts; yyset_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); yyset_extra (yy_user_defined, *ptr_yy_globals); return yy_init_globals ( *ptr_yy_globals ); } static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; yyg->yy_start_stack_ptr = 0; yyg->yy_start_stack_depth = 0; yyg->yy_start_stack = NULL; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = NULL; yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(yyscanner); } /* Destroy the stack itself. */ yyfree(yyg->yy_buffer_stack , yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ yyfree( yyg->yy_start_stack , yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ yyfree ( yyscanner , yyscanner ); yyscanner = NULL; return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (const char * s , yyscan_t yyscanner) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #define YYTABLES_NAME "yytables" #line 137 "src/lexer.l" /* perhaps these should be calls... */ /* "true" { return TRUE; } "false" { return FALSE; } "null" { return NULL; } */ static int try_exit(int c, int state, yyscan_t yyscanner) { char match = 0; int ret; switch (state) { case IN_PAREN: match = ret = ')'; break; case IN_BRACKET: match = ret = ']'; break; case IN_BRACE: match = ret = '}'; break; case IN_QQINTERP: match = ')'; ret = QQSTRING_INTERP_END; break; default: // may not be the best error to give return INVALID_CHARACTER; } assert(match); if (match == c) { yy_pop_state(yyscanner); return ret; } else { // FIXME: should we pop? Give a better error at least return INVALID_CHARACTER; } } static int enter(int c, int currstate, yyscan_t yyscanner) { int state = 0; switch (c) { case '(': state = IN_PAREN; break; case '[': state = IN_BRACKET; break; case '{': state = IN_BRACE; break; case QQSTRING_INTERP_START: state = IN_QQINTERP; break; } assert(state); yy_push_state(state, yyscanner); return c; } void* yyalloc(size_t sz, void* extra) { return jv_mem_alloc(sz); } void* yyrealloc(void* p, size_t sz, void* extra) { return jv_mem_realloc(p, sz); } void yyfree(void* p, void* extra) { jv_mem_free(p); } jq-1.8.2/jq.10000644000175100017510000036253615215513567006344 . .TH "JQ" "1" "May 2025" "" "" . .SH "NAME" \fBjq\fR \- Command\-line JSON processor . .SH "SYNOPSIS" \fBjq\fR [\fIoptions\fR\.\.\.] \fIfilter\fR [\fIfiles\fR\.\.\.] . .P \fBjq\fR can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents\. For instance, running the command \fBjq \'map(\.price) | add\'\fR will take an array of JSON objects as input and return the sum of their "price" fields\. . .P \fBjq\fR can accept text input as well, but by default, \fBjq\fR reads a stream of JSON entities (including numbers and other literals) from \fBstdin\fR\. Whitespace is only needed to separate entities such as 1 and 2, and true and false\. One or more \fIfiles\fR may be specified, in which case \fBjq\fR will read input from those instead\. . .P The \fIoptions\fR are described in the [INVOKING JQ] section; they mostly concern input and output formatting\. The \fIfilter\fR is written in the jq language and specifies how to transform the input file or document\. . .SH "FILTERS" A jq program is a "filter": it takes an input, and produces an output\. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks\. . .P Filters can be combined in various ways \- you can pipe the output of one filter into another filter, or collect the output of a filter into an array\. . .P Some filters produce multiple results, for instance there\'s one that produces all the elements of its input array\. Piping that filter into a second runs the second filter for each element of the array\. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq\. . .P It\'s important to remember that every filter has an input and an output\. Even literals like "hello" or 42 are filters \- they take an input but always produce the same literal as output\. Operations that combine two filters, like addition, generally feed the same input to both and combine the results\. So, you can implement an averaging filter as \fBadd / length\fR \- feeding the input array both to the \fBadd\fR filter and the \fBlength\fR filter and then performing the division\. . .P But that\'s getting ahead of ourselves\. :) Let\'s start with something simpler: . .SH "INVOKING JQ" jq filters run on a stream of JSON data\. The input to jq is parsed as a sequence of whitespace\-separated JSON values which are passed through the provided filter one at a time\. The output(s) of the filter are written to standard output, as a sequence of newline\-separated JSON data\. . .P The simplest and most common filter (or jq program) is \fB\.\fR, which is the identity operator, copying the inputs of the jq processor to the output stream\. Because the default behavior of the jq processor is to read JSON texts from the input stream, and to pretty\-print outputs, the \fB\.\fR program\'s main use is to validate and pretty\-print the inputs\. The jq programming language is quite rich and allows for much more than just validation and pretty\-printing\. . .P Note: it is important to mind the shell\'s quoting rules\. As a general rule it\'s best to always quote (with single\-quote characters on Unix shells) the jq program, as too many characters with special meaning to jq are also shell meta\-characters\. For example, \fBjq "foo"\fR will fail on most Unix shells because that will be the same as \fBjq foo\fR, which will generally fail because \fBfoo is not defined\fR\. When using the Windows command shell (cmd\.exe) it\'s best to use double quotes around your jq program when given on the command\-line (instead of the \fB\-f program\-file\fR option), but then double\-quotes in the jq program need backslash escaping\. When using the Powershell (\fBpowershell\.exe\fR) or the Powershell Core (\fBpwsh\fR/\fBpwsh\.exe\fR), use single\-quote characters around the jq program and backslash\-escaped double\-quotes (\fB\e"\fR) inside the jq program\. . .IP "\(bu" 4 Unix shells: \fBjq \'\.["foo"]\'\fR . .IP "\(bu" 4 Powershell: \fBjq \'\.[\e"foo\e"]\'\fR . .IP "\(bu" 4 Windows command shell: \fBjq "\.[\e"foo\e"]"\fR . .IP "" 0 . .P Note: jq allows user\-defined functions, but every jq program must have a top\-level expression\. . .P You can affect how jq reads and writes its input and output using some command\-line options: . .TP \fB\-\-null\-input\fR / \fB\-n\fR: . .IP Don\'t read any input at all\. Instead, the filter is run once using \fBnull\fR as the input\. This is useful when using jq as a simple calculator or to construct JSON data from scratch\. . .TP \fB\-\-raw\-input\fR / \fB\-R\fR: . .IP Don\'t parse the input as JSON\. Instead, each line of text is passed to the filter as a string\. If combined with \fB\-\-slurp\fR, then the entire input is passed to the filter as a single long string\. . .TP \fB\-\-slurp\fR / \fB\-s\fR: . .IP Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once\. . .TP \fB\-\-compact\-output\fR / \fB\-c\fR: . .IP By default, jq pretty\-prints JSON output\. Using this option will result in more compact output by instead putting each JSON object on a single line\. . .TP \fB\-\-raw\-output\fR / \fB\-r\fR: . .IP With this option, if the filter\'s result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes\. This can be useful for making jq filters talk to non\-JSON\-based systems\. . .TP \fB\-\-raw\-output0\fR: . .IP Like \fB\-r\fR but jq will print NUL instead of newline after each output\. This can be useful when the values being output can contain newlines\. When the output value contains NUL, jq exits with non\-zero code\. . .TP \fB\-\-join\-output\fR / \fB\-j\fR: . .IP Like \fB\-r\fR but jq won\'t print a newline after each output\. . .TP \fB\-\-ascii\-output\fR / \fB\-a\fR: . .IP jq usually outputs non\-ASCII Unicode codepoints as UTF\-8, even if the input specified them as escape sequences (like "\eu03bc")\. Using this option, you can force jq to produce pure ASCII output with every non\-ASCII character replaced with the equivalent escape sequence\. . .TP \fB\-\-sort\-keys\fR / \fB\-S\fR: . .IP Output the fields of each object with the keys in sorted order\. . .TP \fB\-\-color\-output\fR / \fB\-C\fR and \fB\-\-monochrome\-output\fR / \fB\-M\fR: . .IP By default, jq outputs colored JSON if writing to a terminal\. You can force it to produce color even if writing to a pipe or a file using \fB\-C\fR, and disable color with \fB\-M\fR\. When the \fBNO_COLOR\fR environment variable is not empty, jq disables colored output by default, but you can enable it by \fB\-C\fR\. . .IP Colors can be configured with the \fBJQ_COLORS\fR environment variable (see below)\. . .TP \fB\-\-tab\fR: . .IP Use a tab for each indentation level instead of two spaces\. . .TP \fB\-\-indent n\fR: . .IP Use the given number of spaces (no more than 7) for indentation\. . .TP \fB\-\-unbuffered\fR: . .IP Flush the output after each JSON object is printed (useful if you\'re piping a slow data source into jq and piping jq\'s output elsewhere)\. . .TP \fB\-\-stream\fR: . .IP Parse the input in streaming fashion, outputting arrays of path and leaf values (scalars and empty arrays or empty objects)\. For example, \fB"a"\fR becomes \fB[[],"a"]\fR, and \fB[[],"a",["b"]]\fR becomes \fB[[0],[]]\fR, \fB[[1],"a"]\fR, and \fB[[2,0],"b"]\fR\. . .IP This is useful for processing very large inputs\. Use this in conjunction with filtering and the \fBreduce\fR and \fBforeach\fR syntax to reduce large inputs incrementally\. . .TP \fB\-\-stream\-errors\fR: . .IP Like \fB\-\-stream\fR, but invalid JSON inputs yield array values where the first element is the error and the second is a path\. For example, \fB["a",n]\fR produces \fB["Invalid literal at line 1, column 7",[1]]\fR\. . .IP Implies \fB\-\-stream\fR\. Invalid JSON inputs produce no error values when \fB\-\-stream\fR without \fB\-\-stream\-errors\fR\. . .TP \fB\-\-seq\fR: . .IP Use the \fBapplication/json\-seq\fR MIME type scheme for separating JSON texts in jq\'s input and output\. This means that an ASCII RS (record separator) character is printed before each value on output and an ASCII LF (line feed) is printed after every output\. Input JSON texts that fail to parse are ignored (but warned about), discarding all subsequent input until the next RS\. This mode also parses the output of jq without the \fB\-\-seq\fR option\. . .TP \fB\-f\fR / \fB\-\-from\-file\fR: . .IP Read the filter from a file rather than from a command line, like awk\'s \-f option\. This changes the filter argument to be interpreted as a filename, instead of the source of a program\. . .TP \fB\-L directory\fR / \fB\-\-library\-path directory\fR: . .IP Prepend \fBdirectory\fR to the search list for modules\. If this option is used then no builtin search list is used\. See the section on modules below\. . .TP \fB\-\-arg name value\fR: . .IP This option passes a value to the jq program as a predefined variable\. If you run jq with \fB\-\-arg foo bar\fR, then \fB$foo\fR is available in the program and has the value \fB"bar"\fR\. Note that \fBvalue\fR will be treated as a string, so \fB\-\-arg foo 123\fR will bind \fB$foo\fR to \fB"123"\fR\. . .IP Named arguments are also available to the jq program as \fB$ARGS\.named\fR\. When the name is not a valid identifier, this is the only way to access it\. . .TP \fB\-\-argjson name JSON\-text\fR: . .IP This option passes a JSON\-encoded value to the jq program as a predefined variable\. If you run jq with \fB\-\-argjson foo 123\fR, then \fB$foo\fR is available in the program and has the value \fB123\fR\. . .TP \fB\-\-slurpfile variable\-name filename\fR: . .IP This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable\. If you run jq with \fB\-\-slurpfile foo bar\fR, then \fB$foo\fR is available in the program and has an array whose elements correspond to the texts in the file named \fBbar\fR\. . .TP \fB\-\-rawfile variable\-name filename\fR: . .IP This option reads in the named file and binds its content to the given global variable\. If you run jq with \fB\-\-rawfile foo bar\fR, then \fB$foo\fR is available in the program and has a string whose content is set to the text in the file named \fBbar\fR\. . .TP \fB\-\-args\fR: . .IP Remaining arguments are positional string arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\. . .TP \fB\-\-jsonargs\fR: . .IP Remaining arguments are positional JSON text arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\. . .TP \fB\-\-exit\-status\fR / \fB\-e\fR: . .IP Sets the exit status of jq to 0 if the last output value was neither \fBfalse\fR nor \fBnull\fR, 1 if the last output value was either \fBfalse\fR or \fBnull\fR, or 4 if no valid result was ever produced\. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran\. . .IP Another way to set the exit status is with the \fBhalt_error\fR builtin function\. . .TP \fB\-\-binary\fR / \fB\-b\fR: . .IP Windows users using WSL, MSYS2, or Cygwin, should use this option when using a native jq\.exe, otherwise jq will turn newlines (LFs) into carriage\-return\-then\-newline (CRLF)\. . .TP \fB\-\-version\fR / \fB\-V\fR: . .IP Output the jq version and exit with zero\. . .TP \fB\-\-build\-configuration\fR: . .IP Output the build configuration of jq and exit with zero\. This output has no supported format or structure and may change without notice in future releases\. . .TP \fB\-\-help\fR / \fB\-h\fR: . .IP Output the jq help and exit with zero\. . .TP \fB\-\-\fR: . .IP Terminates argument processing\. Remaining arguments are not interpreted as options\. . .TP \fB\-\-run\-tests [filename]\fR: . .IP Runs the tests in the given file or standard input\. This must be the last option given and does not honor all preceding options\. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line\. Compilation failure tests start with a line containing only \fB%%FAIL\fR, then a line containing the program to compile, then a line containing an error message to compare to the actual\. . .IP Be warned that this option can change backwards\-incompatibly\. . .SH "BASIC FILTERS" . .SS "Identity: \." The absolute simplest filter is \fB\.\fR \. This filter takes its input and produces the same value as output\. That is, this is the identity operator\. . .P Since jq by default pretty\-prints all output, a trivial program consisting of nothing but \fB\.\fR can be used to format JSON output from, say, \fBcurl\fR\. . .P Although the identity filter never modifies the value of its input, jq processing can sometimes make it appear as though it does\. For example, using the current implementation of jq, we would see that the expression: . .IP "" 4 . .nf 1E1234567890 | \. . .fi . .IP "" 0 . .P produces \fB1\.7976931348623157e+308\fR on at least one platform\. This is because, in the process of parsing the number, this particular version of jq has converted it to an IEEE754 double\-precision representation, losing precision\. . .P The way in which jq handles numbers has changed over time and further changes are likely within the parameters set by the relevant JSON standards\. Moreover, build configuration options can alter how jq processes numbers\. . .P The following remarks are therefore offered with the understanding that they are intended to be descriptive of the current version of jq and should not be interpreted as being prescriptive: . .P (1) Any arithmetic operation on a number that has not already been converted to an IEEE754 double precision representation will trigger a conversion to the IEEE754 representation\. . .P (2) jq will attempt to maintain the original decimal precision of number literals (if the \fB\-\-disable\-decnum\fR build configuration option was not used), but in expressions such \fB1E1234567890\fR, precision will be lost if the exponent is too large\. . .P (3) Comparisons are carried out using the untruncated big decimal representation of numbers if available, as illustrated in one of the following examples\. . .P The examples below use the builtin function \fBhave_decnum\fR in order to demonstrate the expected effects of using / not using the \fB\-\-disable\-decnum\fR build configuration option, and also to allow automated tests derived from these examples to pass regardless of whether that option is used\. . .IP "" 4 . .nf jq \'\.\' "Hello, world!" => "Hello, world!" jq \'\.\' 0\.12345678901234567890123456789 => 0\.12345678901234567890123456789 jq \'[\., tojson] == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end\' 12345678909876543212345 => true jq \'[1234567890987654321,\-1234567890987654321 | tojson] == if have_decnum then ["1234567890987654321","\-1234567890987654321"] else ["1234567890987654400","\-1234567890987654400"] end\' null => true jq \'\. < 0\.12345678901234567890123456788\' 0\.12345678901234567890123456789 => false jq \'map([\., \. == 1]) | tojson == if have_decnum then "[[1,true],[1\.000,true],[1\.0,true],[1\.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end\' [1, 1\.000, 1\.0, 100e\-2] => true jq \'\. as $big | [$big, $big + 1] | map(\. > 10000000000000000000000000000000) | \. == if have_decnum then [true, false] else [false, false] end\' 10000000000000000000000000000001 => true . .fi . .IP "" 0 . .SS "Object Identifier\-Index: \.foo, \.foo\.bar" The simplest \fIuseful\fR filter has the form \fB\.foo\fR\. When given a JSON object (aka dictionary or hash) as input, \fB\.foo\fR produces the value at the key "foo" if the key is present, or null otherwise\. . .P A filter of the form \fB\.foo\.bar\fR is equivalent to \fB\.foo | \.bar\fR\. . .P The \fB\.foo\fR syntax only works for simple, identifier\-like keys, that is, keys that are all made of alphanumeric characters and underscore, and which do not start with a digit\. . .P If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: \fB\."foo$"\fR, or else \fB\.["foo$"]\fR\. . .P For example \fB\.["foo::bar"]\fR and \fB\.["foo\.bar"]\fR work while \fB\.foo::bar\fR does not\. . .IP "" 4 . .nf jq \'\.foo\' {"foo": 42, "bar": "less interesting data"} => 42 jq \'\.foo\' {"notfoo": true, "alsonotfoo": false} => null jq \'\.["foo"]\' {"foo": 42} => 42 . .fi . .IP "" 0 . .SS "Optional Object Identifier\-Index: \.foo?" Just like \fB\.foo\fR, but does not output an error when \fB\.\fR is not an object\. . .IP "" 4 . .nf jq \'\.foo?\' {"foo": 42, "bar": "less interesting data"} => 42 jq \'\.foo?\' {"notfoo": true, "alsonotfoo": false} => null jq \'\.["foo"]?\' {"foo": 42} => 42 jq \'[\.foo?]\' [1,2] => [] . .fi . .IP "" 0 . .SS "Object Index: \.[]" You can also look up fields of an object using syntax like \fB\.["foo"]\fR (\fB\.foo\fR above is a shorthand version of this, but only for identifier\-like strings)\. . .SS "Array Index: \.[]" When the index value is an integer, \fB\.[]\fR can index arrays\. Arrays are zero\-based, so \fB\.[2]\fR returns the third element\. . .P Negative indices are allowed, with \-1 referring to the last element, \-2 referring to the next to last element, and so on\. . .IP "" 4 . .nf jq \'\.[0]\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => {"name":"JSON", "good":true} jq \'\.[2]\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => null jq \'\.[\-2]\' [1,2,3] => 2 . .fi . .IP "" 0 . .SS "Array/String Slice: \.[:]" The \fB\.[:]\fR syntax can be used to return a subarray of an array or substring of a string\. The array returned by \fB\.[10:15]\fR will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive)\. Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array)\. Indices are zero\-based\. . .IP "" 4 . .nf jq \'\.[2:4]\' ["a","b","c","d","e"] => ["c", "d"] jq \'\.[2:4]\' "abcdefghi" => "cd" jq \'\.[:3]\' ["a","b","c","d","e"] => ["a", "b", "c"] jq \'\.[\-2:]\' ["a","b","c","d","e"] => ["d", "e"] . .fi . .IP "" 0 . .SS "Array/Object Value Iterator: \.[]" If you use the \fB\.[index]\fR syntax, but omit the index entirely, it will return \fIall\fR of the elements of an array\. Running \fB\.[]\fR with the input \fB[1,2,3]\fR will produce the numbers as three separate results, rather than as a single array\. A filter of the form \fB\.foo[]\fR is equivalent to \fB\.foo | \.[]\fR\. . .P You can also use this on an object, and it will return all the values of the object\. . .P Note that the iterator operator is a generator of values\. . .IP "" 4 . .nf jq \'\.[]\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => {"name":"JSON", "good":true}, {"name":"XML", "good":false} jq \'\.[]\' [] => jq \'\.foo[]\' {"foo":[1,2,3]} => 1, 2, 3 jq \'\.[]\' {"a": 1, "b": 1} => 1, 1 . .fi . .IP "" 0 . .SS "\.[]?" Like \fB\.[]\fR, but no errors will be output if \. is not an array or object\. A filter of the form \fB\.foo[]?\fR is equivalent to \fB\.foo | \.[]?\fR\. . .SS "Comma: ," If two filters are separated by a comma, then the same input will be fed into both and the two filters\' output value streams will be concatenated in order: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right\. For instance, filter \fB\.foo, \.bar\fR, produces both the "foo" fields and "bar" fields as separate outputs\. . .P The \fB,\fR operator is one way to construct generators\. . .IP "" 4 . .nf jq \'\.foo, \.bar\' {"foo": 42, "bar": "something else", "baz": true} => 42, "something else" jq \'\.user, \.projects[]\' {"user":"stedolan", "projects": ["jq", "wikiflow"]} => "stedolan", "jq", "wikiflow" jq \'\.[4,2]\' ["a","b","c","d","e"] => "e", "c" . .fi . .IP "" 0 . .SS "Pipe: |" The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right\. It\'s similar to the Unix shell\'s pipe, if you\'re used to that\. . .P If the one on the left produces multiple results, the one on the right will be run for each of those results\. So, the expression \fB\.[] | \.foo\fR retrieves the "foo" field of each element of the input array\. This is a cartesian product, which can be surprising\. . .P Note that \fB\.a\.b\.c\fR is the same as \fB\.a | \.b | \.c\fR\. . .P Note too that \fB\.\fR is the input value at the particular stage in a "pipeline", specifically: where the \fB\.\fR expression appears\. Thus \fB\.a | \. | \.b\fR is the same as \fB\.a\.b\fR, as the \fB\.\fR in the middle refers to whatever value \fB\.a\fR produced\. . .IP "" 4 . .nf jq \'\.[] | \.name\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => "JSON", "XML" . .fi . .IP "" 0 . .SS "Parenthesis" Parenthesis work as a grouping operator just as in any typical programming language\. . .IP "" 4 . .nf jq \'(\. + 2) * 5\' 1 => 15 . .fi . .IP "" 0 . .SH "TYPES AND VALUES" jq supports the same set of datatypes as JSON \- numbers, strings, booleans, arrays, objects (which in JSON\-speak are hashes with only string keys), and "null"\. . .P Booleans, null, strings and numbers are written the same way as in JSON\. Just like everything else in jq, these simple values take an input and produce an output \- \fB42\fR is a valid jq expression that takes an input, ignores it, and returns 42 instead\. . .P Numbers in jq are internally represented by their IEEE754 double precision approximation\. Any arithmetic operation with numbers, whether they are literals or results of previous filters, will produce a double precision floating point result\. . .P However, when parsing a literal jq will store the original literal string\. If no mutation is applied to this value then it will make to the output in its original form, even if conversion to double would result in a loss\. . .SS "Array construction: []" As in JSON, \fB[]\fR is used to construct arrays, as in \fB[1,2,3]\fR\. The elements of the arrays can be any jq expression, including a pipeline\. All of the results produced by all of the expressions are collected into one big array\. You can use it to construct an array out of a known quantity of values (as in \fB[\.foo, \.bar, \.baz]\fR) or to "collect" all the results of a filter into an array (as in \fB[\.items[]\.name]\fR) . .P Once you understand the "," operator, you can look at jq\'s array syntax in a different light: the expression \fB[1,2,3]\fR is not using a built\-in syntax for comma\-separated arrays, but is instead applying the \fB[]\fR operator (collect results) to the expression 1,2,3 (which produces three different results)\. . .P If you have a filter \fBX\fR that produces four results, then the expression \fB[X]\fR will produce a single result, an array of four elements\. . .IP "" 4 . .nf jq \'[\.user, \.projects[]]\' {"user":"stedolan", "projects": ["jq", "wikiflow"]} => ["stedolan", "jq", "wikiflow"] jq \'[ \.[] | \. * 2]\' [1, 2, 3] => [2, 4, 6] . .fi . .IP "" 0 . .SS "Object Construction: {}" Like JSON, \fB{}\fR is for constructing objects (aka dictionaries or hashes), as in: \fB{"a": 42, "b": 17}\fR\. . .P If the keys are "identifier\-like", then the quotes can be left off, as in \fB{a:42, b:17}\fR\. Variable references as key expressions use the value of the variable as the key\. Key expressions other than constant literals, identifiers, or variable references, need to be parenthesized, e\.g\., \fB{("a"+"b"):59}\fR\. . .P The value can be any expression (although you may need to wrap it in parentheses if, for example, it contains colons), which gets applied to the {} expression\'s input (remember, all filters have an input and an output)\. . .IP "" 4 . .nf {foo: \.bar} . .fi . .IP "" 0 . .P will produce the JSON object \fB{"foo": 42}\fR if given the JSON object \fB{"bar":42, "baz":43}\fR as its input\. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write . .IP "" 4 . .nf {user: \.user, title: \.title} . .fi . .IP "" 0 . .P Because that is so common, there\'s a shortcut syntax for it: \fB{user, title}\fR\. . .P If one of the expressions produces multiple results, multiple dictionaries will be produced\. If the input\'s . .IP "" 4 . .nf {"user":"stedolan","titles":["JQ Primer", "More JQ"]} . .fi . .IP "" 0 . .P then the expression . .IP "" 4 . .nf {user, title: \.titles[]} . .fi . .IP "" 0 . .P will produce two outputs: . .IP "" 4 . .nf {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} . .fi . .IP "" 0 . .P Putting parentheses around the key means it will be evaluated as an expression\. With the same input as above, . .IP "" 4 . .nf {(\.user): \.titles} . .fi . .IP "" 0 . .P produces . .IP "" 4 . .nf {"stedolan": ["JQ Primer", "More JQ"]} . .fi . .IP "" 0 . .P Variable references as keys use the value of the variable as the key\. Without a value then the variable\'s name becomes the key and its value becomes the value, . .IP "" 4 . .nf "f o o" as $foo | "b a r" as $bar | {$foo, $bar:$foo} . .fi . .IP "" 0 . .P produces . .IP "" 4 . .nf {"foo":"f o o","b a r":"f o o"} jq \'{user, title: \.titles[]}\' {"user":"stedolan","titles":["JQ Primer", "More JQ"]} => {"user":"stedolan", "title": "JQ Primer"}, {"user":"stedolan", "title": "More JQ"} jq \'{(\.user): \.titles}\' {"user":"stedolan","titles":["JQ Primer", "More JQ"]} => {"stedolan": ["JQ Primer", "More JQ"]} . .fi . .IP "" 0 . .SS "Recursive Descent: \.\." Recursively descends \fB\.\fR, producing every value\. This is the same as the zero\-argument \fBrecurse\fR builtin (see below)\. This is intended to resemble the XPath \fB//\fR operator\. Note that \fB\.\.a\fR does not work; use \fB\.\. | \.a\fR instead\. In the example below we use \fB\.\. | \.a?\fR to find all the values of object keys "a" in any object found "below" \fB\.\fR\. . .P This is particularly useful in conjunction with \fBpath(EXP)\fR (also see below) and the \fB?\fR operator\. . .IP "" 4 . .nf jq \'\.\. | \.a?\' [[{"a":1}]] => 1 . .fi . .IP "" 0 . .SH "BUILTIN OPERATORS AND FUNCTIONS" Some jq operators (for instance, \fB+\fR) do different things depending on the type of their arguments (arrays, numbers, etc\.)\. However, jq never does implicit type conversions\. If you try to add a string to an object you\'ll get an error message and no result\. . .P Please note that all numbers are converted to IEEE754 double precision floating point representation\. Arithmetic and logical operators are working with these converted doubles\. Results of all such operations are also limited to the double precision\. . .P The only exception to this behaviour of number is a snapshot of original number literal\. When a number which originally was provided as a literal is never mutated until the end of the program then it is printed to the output in its original literal form\. This also includes cases when the original literal would be truncated when converted to the IEEE754 double precision floating point number\. . .SS "Addition: +" The operator \fB+\fR takes two filters, applies them both to the same input, and adds the results together\. What "adding" means depends on the types involved: . .IP "\(bu" 4 \fBNumbers\fR are added by normal arithmetic\. . .IP "\(bu" 4 \fBArrays\fR are added by being concatenated into a larger array\. . .IP "\(bu" 4 \fBStrings\fR are added by being joined into a larger string\. . .IP "\(bu" 4 \fBObjects\fR are added by merging, that is, inserting all the key\-value pairs from both objects into a single combined object\. If both objects contain a value for the same key, the object on the right of the \fB+\fR wins\. (For recursive merge use the \fB*\fR operator\.) . .IP "" 0 . .P \fBnull\fR can be added to any value, and returns the other value unchanged\. . .IP "" 4 . .nf jq \'\.a + 1\' {"a": 7} => 8 jq \'\.a + \.b\' {"a": [1,2], "b": [3,4]} => [1,2,3,4] jq \'\.a + null\' {"a": 1} => 1 jq \'\.a + 1\' {} => 1 jq \'{a: 1} + {b: 2} + {c: 3} + {a: 42}\' null => {"a": 42, "b": 2, "c": 3} . .fi . .IP "" 0 . .SS "Subtraction: \-" As well as normal arithmetic subtraction on numbers, the \fB\-\fR operator can be used on arrays to remove all occurrences of the second array\'s elements from the first array\. . .IP "" 4 . .nf jq \'4 \- \.a\' {"a":3} => 1 jq \'\. \- ["xml", "yaml"]\' ["xml", "yaml", "json"] => ["json"] . .fi . .IP "" 0 . .SS "Multiplication, division, modulo: *, /, %" These infix operators behave as expected when given two numbers\. Division by zero raises an error\. \fBx % y\fR computes x modulo y\. . .P Multiplying a string by a number produces the concatenation of that string that many times\. \fB"x" * 0\fR produces \fB""\fR\. . .P Dividing a string by another splits the first using the second as separators\. . .P Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy\. . .IP "" 4 . .nf jq \'10 / \. * 3\' 5 => 6 jq \'\. / ", "\' "a, b,c,d, e" => ["a","b,c,d","e"] jq \'{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}\' null => {"k": {"a": 0, "b": 2, "c": 3}} jq \'\.[] | (1 / \.)?\' [1,0,\-1] => 1, \-1 . .fi . .IP "" 0 . .SS "abs" The builtin function \fBabs\fR is defined naively as: \fBif \. < 0 then \- \. else \. end\fR\. . .P For numeric input, this is the absolute value\. See the section on the identity filter for the implications of this definition for numeric input\. . .P To compute the absolute value of a number as a floating point number, you may wish use \fBfabs\fR\. . .IP "" 4 . .nf jq \'map(abs)\' [\-10, \-1\.1, \-1e\-1] => [10,1\.1,1e\-1] . .fi . .IP "" 0 . .SS "length" The builtin function \fBlength\fR gets the length of various different types of value: . .IP "\(bu" 4 The length of a \fBstring\fR is the number of Unicode codepoints it contains (which will be the same as its JSON\-encoded length in bytes if it\'s pure ASCII)\. . .IP "\(bu" 4 The length of a \fBnumber\fR is its absolute value\. . .IP "\(bu" 4 The length of an \fBarray\fR is the number of elements\. . .IP "\(bu" 4 The length of an \fBobject\fR is the number of key\-value pairs\. . .IP "\(bu" 4 The length of \fBnull\fR is zero\. . .IP "\(bu" 4 It is an error to use \fBlength\fR on a \fBboolean\fR\. . .IP "" 4 . .nf jq \'\.[] | length\' [[1,2], "string", {"a":2}, null, \-5] => 2, 6, 1, 0, 5 . .fi . .IP "" 0 . .SS "utf8bytelength" The builtin function \fButf8bytelength\fR outputs the number of bytes used to encode a string in UTF\-8\. . .IP "" 4 . .nf jq \'utf8bytelength\' "\eu03bc" => 2 . .fi . .IP "" 0 . .SS "keys, keys_unsorted" The builtin function \fBkeys\fR, when given an object, returns its keys in an array\. . .P The keys are sorted "alphabetically", by unicode codepoint order\. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings\. . .P When \fBkeys\fR is given an array, it returns the valid indices for that array: the integers from 0 to length\-1\. . .P The \fBkeys_unsorted\fR function is just like \fBkeys\fR, but if the input is an object then the keys will not be sorted, instead the keys will roughly be in insertion order\. . .IP "" 4 . .nf jq \'keys\' {"abc": 1, "abcd": 2, "Foo": 3} => ["Foo", "abc", "abcd"] jq \'keys\' [42,3,35] => [0,1,2] . .fi . .IP "" 0 . .SS "has(key)" The builtin function \fBhas\fR returns whether the input object has the given key, or the input array has an element at the given index\. . .P \fBhas($key)\fR has the same effect as checking whether \fB$key\fR is a member of the array returned by \fBkeys\fR, although \fBhas\fR will be faster\. . .IP "" 4 . .nf jq \'map(has("foo"))\' [{"foo": 42}, {}] => [true, false] jq \'map(has(2))\' [[0,1], ["a","b","c"]] => [false, true] . .fi . .IP "" 0 . .SS "in" The builtin function \fBin\fR returns whether or not the input key is in the given object, or the input index corresponds to an element in the given array\. It is, essentially, an inversed version of \fBhas\fR\. . .IP "" 4 . .nf jq \'\.[] | in({"foo": 42})\' ["foo", "bar"] => true, false jq \'map(in([0,1]))\' [2, 0] => [false, true] . .fi . .IP "" 0 . .SS "map(f), map_values(f)" For any filter \fBf\fR, \fBmap(f)\fR and \fBmap_values(f)\fR apply \fBf\fR to each of the values in the input array or object, that is, to the values of \fB\.[]\fR\. . .P In the absence of errors, \fBmap(f)\fR always outputs an array whereas \fBmap_values(f)\fR outputs an array if given an array, or an object if given an object\. . .P When the input to \fBmap_values(f)\fR is an object, the output object has the same keys as the input object except for those keys whose values when piped to \fBf\fR produce no values at all\. . .P The key difference between \fBmap(f)\fR and \fBmap_values(f)\fR is that the former simply forms an array from all the values of \fB($x|f)\fR for each value, \fB$x\fR, in the input array or object, but \fBmap_values(f)\fR only uses \fBfirst($x|f)\fR\. . .P Specifically, for object inputs, \fBmap_values(f)\fR constructs the output object by examining in turn the value of \fBfirst(\.[$k]|f)\fR for each key, \fB$k\fR, of the input\. If this expression produces no values, then the corresponding key will be dropped; otherwise, the output object will have that value at the key, \fB$k\fR\. . .P Here are some examples to clarify the behavior of \fBmap\fR and \fBmap_values\fR when applied to arrays\. These examples assume the input is \fB[1]\fR in all cases: . .IP "" 4 . .nf map(\.+1) #=> [2] map(\., \.) #=> [1,1] map(empty) #=> [] map_values(\.+1) #=> [2] map_values(\., \.) #=> [1] map_values(empty) #=> [] . .fi . .IP "" 0 . .P \fBmap(f)\fR is equivalent to \fB[\.[] | f]\fR and \fBmap_values(f)\fR is equivalent to \fB\.[] |= f\fR\. . .P In fact, these are their implementations\. . .IP "" 4 . .nf jq \'map(\.+1)\' [1,2,3] => [2,3,4] jq \'map_values(\.+1)\' {"a": 1, "b": 2, "c": 3} => {"a": 2, "b": 3, "c": 4} jq \'map(\., \.)\' [1,2] => [1,1,2,2] jq \'map_values(\. // empty)\' {"a": null, "b": true, "c": false} => {"b":true} . .fi . .IP "" 0 . .SS "pick(pathexps)" Emit the projection of the input object or array defined by the specified sequence of path expressions, such that if \fBp\fR is any one of these specifications, then \fB(\. | p)\fR will evaluate to the same value as \fB(\. | pick(pathexps) | p)\fR\. For arrays, negative indices and \fB\.[m:n]\fR specifications should not be used\. . .IP "" 4 . .nf jq \'pick(\.a, \.b\.c, \.x)\' {"a": 1, "b": {"c": 2, "d": 3}, "e": 4} => {"a":1,"b":{"c":2},"x":null} jq \'pick(\.[2], \.[0], \.[0])\' [1,2,3,4] => [1,null,3] . .fi . .IP "" 0 . .SS "path(path_expression)" Outputs array representations of the given path expression in \fB\.\fR\. The outputs are arrays of strings (object keys) and/or numbers (array indices)\. . .P Path expressions are jq expressions like \fB\.a\fR, but also \fB\.[]\fR\. There are two types of path expressions: ones that can match exactly, and ones that cannot\. For example, \fB\.a\.b\.c\fR is an exact match path expression, while \fB\.a[]\.b\fR is not\. . .P \fBpath(exact_path_expression)\fR will produce the array representation of the path expression even if it does not exist in \fB\.\fR, if \fB\.\fR is \fBnull\fR or an array or an object\. . .P \fBpath(pattern)\fR will produce array representations of the paths matching \fBpattern\fR if the paths exist in \fB\.\fR\. . .P Note that the path expressions are not different from normal expressions\. The expression \fBpath(\.\.|select(type=="boolean"))\fR outputs all the paths to boolean values in \fB\.\fR, and only those paths\. . .IP "" 4 . .nf jq \'path(\.a[0]\.b)\' null => ["a",0,"b"] jq \'[path(\.\.)]\' {"a":[{"b":1}]} => [[],["a"],["a",0],["a",0,"b"]] . .fi . .IP "" 0 . .SS "del(path_expression)" The builtin function \fBdel\fR removes a key and its corresponding value from an object\. . .IP "" 4 . .nf jq \'del(\.foo)\' {"foo": 42, "bar": 9001, "baz": 42} => {"bar": 9001, "baz": 42} jq \'del(\.[1, 2])\' ["foo", "bar", "baz"] => ["foo"] . .fi . .IP "" 0 . .SS "getpath(PATHS)" The builtin function \fBgetpath\fR outputs the values in \fB\.\fR found at each path in \fBPATHS\fR\. . .IP "" 4 . .nf jq \'getpath(["a","b"])\' null => null jq \'[getpath(["a","b"], ["a","c"])]\' {"a":{"b":0, "c":1}} => [0, 1] . .fi . .IP "" 0 . .SS "setpath(PATHS; VALUE)" The builtin function \fBsetpath\fR sets the \fBPATHS\fR in \fB\.\fR to \fBVALUE\fR\. . .IP "" 4 . .nf jq \'setpath(["a","b"]; 1)\' null => {"a": {"b": 1}} jq \'setpath(["a","b"]; 1)\' {"a":{"b":0}} => {"a": {"b": 1}} jq \'setpath([0,"a"]; 1)\' null => [{"a":1}] . .fi . .IP "" 0 . .SS "delpaths(PATHS)" The builtin function \fBdelpaths\fR deletes the \fBPATHS\fR in \fB\.\fR\. \fBPATHS\fR must be an array of paths, where each path is an array of strings and numbers\. . .IP "" 4 . .nf jq \'delpaths([["a","b"]])\' {"a":{"b":1},"x":{"y":2}} => {"a":{},"x":{"y":2}} . .fi . .IP "" 0 . .SS "to_entries, from_entries, with_entries(f)" These functions convert between an object and an array of key\-value pairs\. If \fBto_entries\fR is passed an object, then for each \fBk: v\fR entry in the input, the output array includes \fB{"key": k, "value": v}\fR\. . .P \fBfrom_entries\fR does the opposite conversion, and \fBwith_entries(f)\fR is a shorthand for \fBto_entries | map(f) | from_entries\fR, useful for doing some operation to all keys and values of an object\. \fBfrom_entries\fR accepts \fB"key"\fR, \fB"Key"\fR, \fB"name"\fR, \fB"Name"\fR, \fB"value"\fR, and \fB"Value"\fR as keys\. . .IP "" 4 . .nf jq \'to_entries\' {"a": 1, "b": 2} => [{"key":"a", "value":1}, {"key":"b", "value":2}] jq \'from_entries\' [{"key":"a", "value":1}, {"key":"b", "value":2}] => {"a": 1, "b": 2} jq \'with_entries(\.key |= "KEY_" + \.)\' {"a": 1, "b": 2} => {"KEY_a": 1, "KEY_b": 2} . .fi . .IP "" 0 . .SS "select(boolean_expression)" The function \fBselect(f)\fR produces its input unchanged if \fBf\fR returns true for that input, and produces no output otherwise\. . .P It\'s useful for filtering lists: \fB[1,2,3] | map(select(\. >= 2))\fR will give you \fB[2,3]\fR\. . .IP "" 4 . .nf jq \'map(select(\. >= 2))\' [1,5,3,0,7] => [5,3,7] jq \'\.[] | select(\.id == "second")\' [{"id": "first", "val": 1}, {"id": "second", "val": 2}] => {"id": "second", "val": 2} . .fi . .IP "" 0 . .SS "arrays, objects, iterables, booleans, numbers, normals, finites, strings, nulls, values, scalars" These built\-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, normal numbers, finite numbers, strings, null, non\-null values, and non\-iterables, respectively\. . .IP "" 4 . .nf jq \'\.[]|numbers\' [[],{},1,"foo",null,true,false] => 1 . .fi . .IP "" 0 . .SS "empty" \fBempty\fR returns no results\. None at all\. Not even \fBnull\fR\. . .P It\'s useful on occasion\. You\'ll know if you need it :) . .IP "" 4 . .nf jq \'1, empty, 2\' null => 1, 2 jq \'[1,2,empty,3]\' null => [1,2,3] . .fi . .IP "" 0 . .SS "error, error(message)" Produces an error with the input value, or with the message given as the argument\. Errors can be caught with try/catch; see below\. . .IP "" 4 . .nf jq \'try error catch \.\' "error message" => "error message" jq \'try error("invalid value: \e(\.)") catch \.\' 42 => "invalid value: 42" . .fi . .IP "" 0 . .SS "halt" Stops the jq program with no further outputs\. jq will exit with exit status \fB0\fR\. . .SS "halt_error, halt_error(exit_code)" Stops the jq program with no further outputs\. The input will be printed on \fBstderr\fR as raw output (i\.e\., strings will not have double quotes) with no decoration, not even a newline\. . .P The given \fBexit_code\fR (defaulting to \fB5\fR) will be jq\'s exit status\. . .P For example, \fB"Error: something went wrong\en"|halt_error(1)\fR\. . .SS "$__loc__" Produces an object with a "file" key and a "line" key, with the filename and line number where \fB$__loc__\fR occurs, as values\. . .IP "" 4 . .nf jq \'try error("\e($__loc__)") catch \.\' null => "{\e"file\e":\e"\e",\e"line\e":1}" . .fi . .IP "" 0 . .SS "paths, paths(node_filter)" \fBpaths\fR outputs the paths to all the elements in its input (except it does not output the empty list, representing \. itself)\. . .P \fBpaths(f)\fR outputs the paths to any values for which \fBf\fR is \fBtrue\fR\. That is, \fBpaths(type == "number")\fR outputs the paths to all numeric values\. . .IP "" 4 . .nf jq \'[paths]\' [1,[[],{"a":2}]] => [[0],[1],[1,0],[1,1],[1,1,"a"]] jq \'[paths(type == "number")]\' [1,[[],{"a":2}]] => [[0],[1,1,"a"]] . .fi . .IP "" 0 . .SS "add, add(generator)" The filter \fBadd\fR takes as input an array, and produces as output the elements of the array added together\. This might mean summed, concatenated or merged depending on the types of the elements of the input array \- the rules are the same as those for the \fB+\fR operator (described above)\. . .P If the input is an empty array, \fBadd\fR returns \fBnull\fR\. . .P \fBadd(generator)\fR operates on the given generator rather than the input\. . .IP "" 4 . .nf jq \'add\' ["a","b","c"] => "abc" jq \'add\' [1, 2, 3] => 6 jq \'add\' [] => null jq \'add(\.[]\.a)\' [{"a":3}, {"a":5}, {"b":6}] => 8 . .fi . .IP "" 0 . .SS "any, any(condition), any(generator; condition)" The filter \fBany\fR takes as input an array of boolean values, and produces \fBtrue\fR as output if any of the elements of the array are \fBtrue\fR\. . .P If the input is an empty array, \fBany\fR returns \fBfalse\fR\. . .P The \fBany(condition)\fR form applies the given condition to the elements of the input array\. . .P The \fBany(generator; condition)\fR form applies the given condition to all the outputs of the given generator\. . .IP "" 4 . .nf jq \'any\' [true, false] => true jq \'any\' [false, false] => false jq \'any\' [] => false . .fi . .IP "" 0 . .SS "all, all(condition), all(generator; condition)" The filter \fBall\fR takes as input an array of boolean values, and produces \fBtrue\fR as output if all of the elements of the array are \fBtrue\fR\. . .P The \fBall(condition)\fR form applies the given condition to the elements of the input array\. . .P The \fBall(generator; condition)\fR form applies the given condition to all the outputs of the given generator\. . .P If the input is an empty array, \fBall\fR returns \fBtrue\fR\. . .IP "" 4 . .nf jq \'all\' [true, false] => false jq \'all\' [true, true] => true jq \'all\' [] => true . .fi . .IP "" 0 . .SS "flatten, flatten(depth)" The filter \fBflatten\fR takes as input an array of nested arrays, and produces a flat array in which all arrays inside the original array have been recursively replaced by their values\. You can pass an argument to it to specify how many levels of nesting to flatten\. . .P \fBflatten(2)\fR is like \fBflatten\fR, but going only up to two levels deep\. . .IP "" 4 . .nf jq \'flatten\' [1, [2], [[3]]] => [1, 2, 3] jq \'flatten(1)\' [1, [2], [[3]]] => [1, 2, [3]] jq \'flatten\' [[]] => [] jq \'flatten\' [{"foo": "bar"}, [{"foo": "baz"}]] => [{"foo": "bar"}, {"foo": "baz"}] . .fi . .IP "" 0 . .SS "range(upto), range(from; upto), range(from; upto; by)" The \fBrange\fR function produces a range of numbers\. \fBrange(4; 10)\fR produces 6 numbers, from 4 (inclusive) to 10 (exclusive)\. The numbers are produced as separate outputs\. Use \fB[range(4; 10)]\fR to get a range as an array\. . .P The one argument form generates numbers from 0 to the given number, with an increment of 1\. . .P The two argument form generates numbers from \fBfrom\fR to \fBupto\fR with an increment of 1\. . .P The three argument form generates numbers \fBfrom\fR to \fBupto\fR with an increment of \fBby\fR\. . .IP "" 4 . .nf jq \'range(2; 4)\' null => 2, 3 jq \'[range(2; 4)]\' null => [2,3] jq \'[range(4)]\' null => [0,1,2,3] jq \'[range(0; 10; 3)]\' null => [0,3,6,9] jq \'[range(0; 10; \-1)]\' null => [] jq \'[range(0; \-5; \-1)]\' null => [0,\-1,\-2,\-3,\-4] . .fi . .IP "" 0 . .SS "floor" The \fBfloor\fR function returns the floor of its numeric input\. . .IP "" 4 . .nf jq \'floor\' 3\.14159 => 3 . .fi . .IP "" 0 . .SS "sqrt" The \fBsqrt\fR function returns the square root of its numeric input\. . .IP "" 4 . .nf jq \'sqrt\' 9 => 3 . .fi . .IP "" 0 . .SS "tonumber" The \fBtonumber\fR function parses its input as a number\. It will convert correctly\-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input\. . .IP "" 4 . .nf jq \'\.[] | tonumber\' [1, "1"] => 1, 1 . .fi . .IP "" 0 . .SS "toboolean" The \fBtoboolean\fR function parses its input as a boolean\. It will convert correctly\-formatted strings to their boolean equivalent, leave booleans alone, and give an error on all other input\. . .IP "" 4 . .nf jq \'\.[] | toboolean\' ["true", "false", true, false] => true, false, true, false . .fi . .IP "" 0 . .SS "tostring" The \fBtostring\fR function prints its input as a string\. Strings are left unchanged, and all other values are JSON\-encoded\. . .IP "" 4 . .nf jq \'\.[] | tostring\' [1, "1", [1]] => "1", "1", "[1]" . .fi . .IP "" 0 . .SS "type" The \fBtype\fR function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object\. . .IP "" 4 . .nf jq \'map(type)\' [0, false, [], {}, null, "hello"] => ["number", "boolean", "array", "object", "null", "string"] . .fi . .IP "" 0 . .SS "infinite, nan, isinfinite, isnan, isfinite, isnormal" Some arithmetic operations can yield infinities and "not a number" (NaN) values\. The \fBisinfinite\fR builtin returns \fBtrue\fR if its input is infinite\. The \fBisnan\fR builtin returns \fBtrue\fR if its input is a NaN\. The \fBinfinite\fR builtin returns a positive infinite value\. The \fBnan\fR builtin returns a NaN\. The \fBisnormal\fR builtin returns true if its input is a normal number\. . .P Note that division by zero raises an error\. . .P Currently most arithmetic operations operating on infinities, NaNs, and sub\-normals do not raise errors\. . .IP "" 4 . .nf jq \'\.[] | (infinite * \.) < 0\' [\-1, 1] => true, false jq \'infinite, nan | type\' null => "number", "number" . .fi . .IP "" 0 . .SS "sort, sort_by(path_expression)" The \fBsort\fR functions sorts its input, which must be an array\. Values are sorted in the following order: . .IP "\(bu" 4 \fBnull\fR . .IP "\(bu" 4 \fBfalse\fR . .IP "\(bu" 4 \fBtrue\fR . .IP "\(bu" 4 numbers . .IP "\(bu" 4 strings, in alphabetical order (by unicode codepoint value) . .IP "\(bu" 4 arrays, in lexical order . .IP "\(bu" 4 objects . .IP "" 0 . .P The ordering for objects is a little complex: first they\'re compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key\. . .P \fBsort_by\fR may be used to sort by a particular field of an object, or by applying any jq filter\. \fBsort_by(f)\fR compares two elements by comparing the result of \fBf\fR on each element\. When \fBf\fR produces multiple values, it firstly compares the first values, and the second values if the first values are equal, and so on\. . .IP "" 4 . .nf jq \'sort\' [8,3,null,6] => [null,3,6,8] jq \'sort_by(\.foo)\' [{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}] => [{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}] jq \'sort_by(\.foo, \.bar)\' [{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}] => [{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}] . .fi . .IP "" 0 . .SS "group_by(path_expression)" \fBgroup_by(\.foo)\fR takes as input an array, groups the elements having the same \fB\.foo\fR field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the \fB\.foo\fR field\. . .P Any jq expression, not just a field access, may be used in place of \fB\.foo\fR\. The sorting order is the same as described in the \fBsort\fR function above\. . .IP "" 4 . .nf jq \'group_by(\.foo)\' [{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}] => [[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]] . .fi . .IP "" 0 . .SS "min, max, min_by(path_exp), max_by(path_exp)" Find the minimum or maximum element of the input array\. . .P The \fBmin_by(path_exp)\fR and \fBmax_by(path_exp)\fR functions allow you to specify a particular field or property to examine, e\.g\. \fBmin_by(\.foo)\fR finds the object with the smallest \fBfoo\fR field\. . .IP "" 4 . .nf jq \'min\' [5,4,2,7] => 2 jq \'max_by(\.foo)\' [{"foo":1, "bar":14}, {"foo":2, "bar":3}] => {"foo":2, "bar":3} . .fi . .IP "" 0 . .SS "unique, unique_by(path_exp)" The \fBunique\fR function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed\. . .P The \fBunique_by(path_exp)\fR function will keep only one element for each value obtained by applying the argument\. Think of it as making an array by taking one element out of every group produced by \fBgroup\fR\. . .IP "" 4 . .nf jq \'unique\' [1,2,5,3,5,3,1,3] => [1,2,3,5] jq \'unique_by(\.foo)\' [{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}] => [{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}] jq \'unique_by(length)\' ["chunky", "bacon", "kitten", "cicada", "asparagus"] => ["bacon", "chunky", "asparagus"] . .fi . .IP "" 0 . .SS "reverse" This function reverses an array\. . .IP "" 4 . .nf jq \'reverse\' [1,2,3,4] => [4,3,2,1] . .fi . .IP "" 0 . .SS "contains(element)" The filter \fBcontains(b)\fR will produce true if b is completely contained within the input\. A string B is contained in a string A if B is a substring of A\. An array B is contained in an array A if all elements in B are contained in any element in A\. An object B is contained in object A if all of the values in B are contained in the value in A with the same key\. All other types are assumed to be contained in each other if they are equal\. . .IP "" 4 . .nf jq \'contains("bar")\' "foobar" => true jq \'contains(["baz", "bar"])\' ["foobar", "foobaz", "blarp"] => true jq \'contains(["bazzzzz", "bar"])\' ["foobar", "foobaz", "blarp"] => false jq \'contains({foo: 12, bar: [{barp: 12}]})\' {"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]} => true jq \'contains({foo: 12, bar: [{barp: 15}]})\' {"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]} => false . .fi . .IP "" 0 . .SS "indices(s)" Outputs an array containing the indices in \fB\.\fR where \fBs\fR occurs\. The input may be an array, in which case if \fBs\fR is an array then the indices output will be those where all elements in \fB\.\fR match those of \fBs\fR\. . .IP "" 4 . .nf jq \'indices(", ")\' "a,b, cd, efg, hijk" => [3,7,12] jq \'indices(1)\' [0,1,2,1,3,1,4] => [1,3,5] jq \'indices([1,2])\' [0,1,2,3,1,4,2,5,1,2,6,7] => [1,8] . .fi . .IP "" 0 . .SS "index(s), rindex(s)" Outputs the index of the first (\fBindex\fR) or last (\fBrindex\fR) occurrence of \fBs\fR in the input\. . .IP "" 4 . .nf jq \'index(", ")\' "a,b, cd, efg, hijk" => 3 jq \'index(1)\' [0,1,2,1,3,1,4] => 1 jq \'index([1,2])\' [0,1,2,3,1,4,2,5,1,2,6,7] => 1 jq \'rindex(", ")\' "a,b, cd, efg, hijk" => 12 jq \'rindex(1)\' [0,1,2,1,3,1,4] => 5 jq \'rindex([1,2])\' [0,1,2,3,1,4,2,5,1,2,6,7] => 8 . .fi . .IP "" 0 . .SS "inside" The filter \fBinside(b)\fR will produce true if the input is completely contained within b\. It is, essentially, an inversed version of \fBcontains\fR\. . .IP "" 4 . .nf jq \'inside("foobar")\' "bar" => true jq \'inside(["foobar", "foobaz", "blarp"])\' ["baz", "bar"] => true jq \'inside(["foobar", "foobaz", "blarp"])\' ["bazzzzz", "bar"] => false jq \'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})\' {"foo": 12, "bar": [{"barp": 12}]} => true jq \'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})\' {"foo": 12, "bar": [{"barp": 15}]} => false . .fi . .IP "" 0 . .SS "startswith(str)" Outputs \fBtrue\fR if \. starts with the given string argument\. . .IP "" 4 . .nf jq \'[\.[]|startswith("foo")]\' ["fo", "foo", "barfoo", "foobar", "barfoob"] => [false, true, false, true, false] . .fi . .IP "" 0 . .SS "endswith(str)" Outputs \fBtrue\fR if \. ends with the given string argument\. . .IP "" 4 . .nf jq \'[\.[]|endswith("foo")]\' ["foobar", "barfoo"] => [false, true] . .fi . .IP "" 0 . .SS "combinations, combinations(n)" Outputs all combinations of the elements of the arrays in the input array\. If given an argument \fBn\fR, it outputs all combinations of \fBn\fR repetitions of the input array\. . .IP "" 4 . .nf jq \'combinations\' [[1,2], [3, 4]] => [1, 3], [1, 4], [2, 3], [2, 4] jq \'combinations(2)\' [0, 1] => [0, 0], [0, 1], [1, 0], [1, 1] . .fi . .IP "" 0 . .SS "ltrimstr(str)" Outputs its input with the given prefix string removed, if it starts with it\. . .IP "" 4 . .nf jq \'[\.[]|ltrimstr("foo")]\' ["fo", "foo", "barfoo", "foobar", "afoo"] => ["fo","","barfoo","bar","afoo"] . .fi . .IP "" 0 . .SS "rtrimstr(str)" Outputs its input with the given suffix string removed, if it ends with it\. . .IP "" 4 . .nf jq \'[\.[]|rtrimstr("foo")]\' ["fo", "foo", "barfoo", "foobar", "foob"] => ["fo","","bar","foobar","foob"] . .fi . .IP "" 0 . .SS "trimstr(str)" Outputs its input with the given string removed at both ends, if it starts or ends with it\. . .IP "" 4 . .nf jq \'[\.[]|trimstr("foo")]\' ["fo", "foo", "barfoo", "foobarfoo", "foob"] => ["fo","","bar","bar","b"] . .fi . .IP "" 0 . .SS "trim, ltrim, rtrim" \fBtrim\fR trims both leading and trailing whitespace\. . .P \fBltrim\fR trims only leading (left side) whitespace\. . .P \fBrtrim\fR trims only trailing (right side) whitespace\. . .P Whitespace characters are the usual \fB" "\fR, \fB"\en"\fR \fB"\et"\fR, \fB"\er"\fR and also all characters in the Unicode character database with the whitespace property\. Note that what considers whitespace might change in the future\. . .IP "" 4 . .nf jq \'trim, ltrim, rtrim\' " abc " => "abc", "abc ", " abc" . .fi . .IP "" 0 . .SS "explode" Converts an input string into an array of the string\'s codepoint numbers\. . .IP "" 4 . .nf jq \'explode\' "foobar" => [102,111,111,98,97,114] . .fi . .IP "" 0 . .SS "implode" The inverse of explode\. . .IP "" 4 . .nf jq \'implode\' [65, 66, 67] => "ABC" . .fi . .IP "" 0 . .SS "split(str)" Splits an input string on the separator argument\. . .P \fBsplit\fR can also split on regex matches when called with two arguments (see the regular expressions section below)\. . .IP "" 4 . .nf jq \'split(", ")\' "a, b,c,d, e, " => ["a","b,c,d","e",""] . .fi . .IP "" 0 . .SS "join(str)" Joins the array of elements given as input, using the argument as separator\. It is the inverse of \fBsplit\fR: that is, running \fBsplit("foo") | join("foo")\fR over any input string returns said input string\. . .P Numbers and booleans in the input are converted to strings\. Null values are treated as empty strings\. Arrays and objects in the input are not supported\. . .IP "" 4 . .nf jq \'join(", ")\' ["a","b,c,d","e"] => "a, b,c,d, e" jq \'join(" ")\' ["a",1,2\.3,true,null,false] => "a 1 2\.3 true false" . .fi . .IP "" 0 . .SS "ascii_downcase, ascii_upcase" Emit a copy of the input string with its alphabetic characters (a\-z and A\-Z) converted to the specified case\. . .IP "" 4 . .nf jq \'ascii_upcase\' "useful but not for é" => "USEFUL BUT NOT FOR é" . .fi . .IP "" 0 . .SS "while(cond; update)" The \fBwhile(cond; update)\fR function allows you to repeatedly apply an update to \fB\.\fR until \fBcond\fR is false\. . .P Note that \fBwhile(cond; update)\fR is internally defined as a recursive jq function\. Recursive calls within \fBwhile\fR will not consume additional memory if \fBupdate\fR produces at most one output for each input\. See advanced topics below\. . .IP "" 4 . .nf jq \'[while(\.<100; \.*2)]\' 1 => [1,2,4,8,16,32,64] . .fi . .IP "" 0 . .SS "repeat(exp)" The \fBrepeat(exp)\fR function allows you to repeatedly apply expression \fBexp\fR to \fB\.\fR until an error is raised\. . .P Note that \fBrepeat(exp)\fR is internally defined as a recursive jq function\. Recursive calls within \fBrepeat\fR will not consume additional memory if \fBexp\fR produces at most one output for each input\. See advanced topics below\. . .IP "" 4 . .nf jq \'[repeat(\.*2, error)?]\' 1 => [2] . .fi . .IP "" 0 . .SS "until(cond; next)" The \fBuntil(cond; next)\fR function allows you to repeatedly apply the expression \fBnext\fR, initially to \fB\.\fR then to its own output, until \fBcond\fR is true\. For example, this can be used to implement a factorial function (see below)\. . .P Note that \fBuntil(cond; next)\fR is internally defined as a recursive jq function\. Recursive calls within \fBuntil()\fR will not consume additional memory if \fBnext\fR produces at most one output for each input\. See advanced topics below\. . .IP "" 4 . .nf jq \'[\.,1]|until(\.[0] < 1; [\.[0] \- 1, \.[1] * \.[0]])|\.[1]\' 4 => 24 . .fi . .IP "" 0 . .SS "recurse(f), recurse, recurse(f; condition)" The \fBrecurse(f)\fR function allows you to search through a recursive structure, and extract interesting data from all levels\. Suppose your input represents a filesystem: . .IP "" 4 . .nf {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} . .fi . .IP "" 0 . .P Now suppose you want to extract all of the filenames present\. You need to retrieve \fB\.name\fR, \fB\.children[]\.name\fR, \fB\.children[]\.children[]\.name\fR, and so on\. You can do this with: . .IP "" 4 . .nf recurse(\.children[]) | \.name . .fi . .IP "" 0 . .P When called without an argument, \fBrecurse\fR is equivalent to \fBrecurse(\.[]?)\fR\. . .P \fBrecurse(f)\fR is identical to \fBrecurse(f; true)\fR and can be used without concerns about recursion depth\. . .P \fBrecurse(f; condition)\fR is a generator which begins by emitting \. and then emits in turn \.|f, \.|f|f, \.|f|f|f, \.\.\. so long as the computed value satisfies the condition\. For example, to generate all the integers, at least in principle, one could write \fBrecurse(\.+1; true)\fR\. . .P The recursive calls in \fBrecurse\fR will not consume additional memory whenever \fBf\fR produces at most a single output for each input\. . .IP "" 4 . .nf jq \'recurse(\.foo[])\' {"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]} => {"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}, {"foo":[]}, {"foo":[{"foo":[]}]}, {"foo":[]} jq \'recurse\' {"a":0,"b":[1]} => {"a":0,"b":[1]}, 0, [1], 1 jq \'recurse(\. * \.; \. < 20)\' 2 => 2, 4, 16 . .fi . .IP "" 0 . .SS "walk(f)" The \fBwalk(f)\fR function applies f recursively to every component of the input entity\. When an array is encountered, f is first applied to its elements and then to the array itself; when an object is encountered, f is first applied to all the values and then to the object\. In practice, f will usually test the type of its input, as illustrated in the following examples\. The first example highlights the usefulness of processing the elements of an array of arrays before processing the array itself\. The second example shows how all the keys of all the objects within the input can be considered for alteration\. . .IP "" 4 . .nf jq \'walk(if type == "array" then sort else \. end)\' [[4, 1, 7], [8, 5, 2], [3, 6, 9]] => [[1,4,7],[2,5,8],[3,6,9]] jq \'walk( if type == "object" then with_entries( \.key |= sub( "^_+"; "") ) else \. end )\' [ { "_a": { "__b": 2 } } ] => [{"a":{"b":2}}] . .fi . .IP "" 0 . .SS "have_literal_numbers" This builtin returns true if jq\'s build configuration includes support for preservation of input number literals\. . .SS "have_decnum" This builtin returns true if jq was built with "decnum", which is the current literal number preserving numeric backend implementation for jq\. . .SS "$JQ_BUILD_CONFIGURATION" This builtin binding shows the jq executable\'s build configuration\. Its value has no particular format, but it can be expected to be at least the \fB\./configure\fR command\-line arguments, and may be enriched in the future to include the version strings for the build tooling used\. . .P Note that this can be overridden in the command\-line with \fB\-\-arg\fR and related options\. . .SS "$ENV, env" \fB$ENV\fR is an object representing the environment variables as set when the jq program started\. . .P \fBenv\fR outputs an object representing jq\'s current environment\. . .P At the moment there is no builtin for setting environment variables\. . .IP "" 4 . .nf jq \'$ENV\.PAGER\' null => "less" jq \'env\.PAGER\' null => "less" . .fi . .IP "" 0 . .SS "transpose" Transpose a possibly jagged matrix (an array of arrays)\. Rows are padded with nulls so the result is always rectangular\. . .IP "" 4 . .nf jq \'transpose\' [[1], [2,3]] => [[1,2],[null,3]] . .fi . .IP "" 0 . .SS "bsearch(x)" \fBbsearch(x)\fR conducts a binary search for x in the input array\. If the input is sorted and contains x, then \fBbsearch(x)\fR will return its index in the array; otherwise, if the array is sorted, it will return (\-1 \- ix) where ix is an insertion point such that the array would still be sorted after the insertion of x at ix\. If the array is not sorted, \fBbsearch(x)\fR will return an integer that is probably of no interest\. . .IP "" 4 . .nf jq \'bsearch(0)\' [0,1] => 0 jq \'bsearch(0)\' [1,2,3] => \-1 jq \'bsearch(4) as $ix | if $ix < 0 then \.[\-(1+$ix)] = 4 else \. end\' [1,2,3] => [1,2,3,4] . .fi . .IP "" 0 . .SS "String interpolation: \e(exp)" Inside a string, you can put an expression inside parens after a backslash\. Whatever the expression returns will be interpolated into the string\. . .IP "" 4 . .nf jq \'"The input was \e(\.), which is one less than \e(\.+1)"\' 42 => "The input was 42, which is one less than 43" . .fi . .IP "" 0 . .SS "Convert to/from JSON" The \fBtojson\fR and \fBfromjson\fR builtins dump values as JSON texts or parse JSON texts into values, respectively\. The \fBtojson\fR builtin differs from \fBtostring\fR in that \fBtostring\fR returns strings unmodified, while \fBtojson\fR encodes strings as JSON strings\. . .IP "" 4 . .nf jq \'[\.[]|tostring]\' [1, "foo", ["foo"]] => ["1","foo","[\e"foo\e"]"] jq \'[\.[]|tojson]\' [1, "foo", ["foo"]] => ["1","\e"foo\e"","[\e"foo\e"]"] jq \'[\.[]|tojson|fromjson]\' [1, "foo", ["foo"]] => [1,"foo",["foo"]] . .fi . .IP "" 0 . .SS "Format strings and escaping" The \fB@foo\fR syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth\. \fB@foo\fR can be used as a filter on its own, the possible escapings are: . .TP \fB@text\fR: . .IP Calls \fBtostring\fR, see that function for details\. . .TP \fB@json\fR: . .IP Serializes the input as JSON\. . .TP \fB@html\fR: . .IP Applies HTML/XML escaping, by mapping the characters \fB<>&\'"\fR to their entity equivalents \fB<\fR, \fB>\fR, \fB&\fR, \fB'\fR, \fB"\fR\. . .TP \fB@uri\fR: . .IP Applies percent\-encoding, by mapping all reserved URI characters to a \fB%XX\fR sequence\. . .TP \fB@urid\fR: . .IP The inverse of \fB@uri\fR, applies percent\-decoding, by mapping all \fB%XX\fR sequences to their corresponding URI characters\. . .TP \fB@csv\fR: . .IP The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition\. . .TP \fB@tsv\fR: . .IP The input must be an array, and it is rendered as TSV (tab\-separated values)\. Each input array will be printed as a single line\. Fields are separated by a single tab (ascii \fB0x09\fR)\. Input characters line\-feed (ascii \fB0x0a\fR), carriage\-return (ascii \fB0x0d\fR), tab (ascii \fB0x09\fR) and backslash (ascii \fB0x5c\fR) will be output as escape sequences \fB\en\fR, \fB\er\fR, \fB\et\fR, \fB\e\e\fR respectively\. . .TP \fB@sh\fR: . .IP The input is escaped suitable for use in a command\-line for a POSIX shell\. If the input is an array, the output will be a series of space\-separated strings\. . .TP \fB@base64\fR: . .IP The input is converted to base64 as specified by RFC 4648\. . .TP \fB@base64d\fR: . .IP The inverse of \fB@base64\fR, input is decoded as specified by RFC 4648\. Note\e: If the decoded string is not UTF\-8, the results are undefined\. . .P This syntax can be combined with string interpolation in a useful way\. You can follow a \fB@foo\fR token with a string literal\. The contents of the string literal will \fInot\fR be escaped\. However, all interpolations made inside that string literal will be escaped\. For instance, . .IP "" 4 . .nf @uri "https://www\.google\.com/search?q=\e(\.search)" . .fi . .IP "" 0 . .P will produce the following output for the input \fB{"search":"what is jq?"}\fR: . .IP "" 4 . .nf "https://www\.google\.com/search?q=what%20is%20jq%3F" . .fi . .IP "" 0 . .P Note that the slashes, question mark, etc\. in the URL are not escaped, as they were part of the string literal\. . .IP "" 4 . .nf jq \'@html\' "This works if x < y" => "This works if x < y" jq \'@sh "echo \e(\.)"\' "O\'Hara\'s Ale" => "echo \'O\'\e\e\'\'Hara\'\e\e\'\'s Ale\'" jq \'@base64\' "This is a message" => "VGhpcyBpcyBhIG1lc3NhZ2U=" jq \'@base64d\' "VGhpcyBpcyBhIG1lc3NhZ2U=" => "This is a message" . .fi . .IP "" 0 . .SS "Dates" jq provides some basic date handling functionality, with some high\-level and low\-level builtins\. In all cases these builtins deal exclusively with time in UTC\. . .P The \fBfromdateiso8601\fR builtin parses datetimes in the ISO 8601 format to a number of seconds since the Unix epoch (1970\-01\-01T00:00:00Z)\. The \fBtodateiso8601\fR builtin does the inverse\. . .P The \fBfromdate\fR builtin parses datetime strings\. Currently \fBfromdate\fR only supports ISO 8601 datetime strings, but in the future it will attempt to parse datetime strings in more formats\. . .P The \fBtodate\fR builtin is an alias for \fBtodateiso8601\fR\. . .P The \fBnow\fR builtin outputs the current time, in seconds since the Unix epoch\. . .P Low\-level jq interfaces to the C\-library time functions are also provided: \fBstrptime\fR, \fBstrftime\fR, \fBstrflocaltime\fR, \fBmktime\fR, \fBgmtime\fR, and \fBlocaltime\fR\. Refer to your host operating system\'s documentation for the format strings used by \fBstrptime\fR and \fBstrftime\fR\. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality\. . .P The \fBgmtime\fR builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of Greenwich Mean Time as an array of numbers representing (in this order): the year, the month (zero\-based), the day of the month (one\-based), the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year \-\- all one\-based unless otherwise stated\. The day of the week number may be wrong on some systems for dates before March 1st 1900, or after December 31 2099\. . .P The \fBlocaltime\fR builtin works like the \fBgmtime\fR builtin, but using the local timezone setting\. . .P The \fBmktime\fR builtin consumes "broken down time" representations of time output by \fBgmtime\fR and \fBstrptime\fR\. . .P The \fBstrptime(fmt)\fR builtin parses input strings matching the \fBfmt\fR argument\. The output is in the "broken down time" representation consumed by \fBmktime\fR and output by \fBgmtime\fR\. . .P The \fBstrftime(fmt)\fR builtin formats a time (GMT) with the given format\. The \fBstrflocaltime\fR does the same, but using the local timezone setting\. . .P The format strings for \fBstrptime\fR and \fBstrftime\fR are described in typical C library documentation\. The format string for ISO 8601 datetime is \fB"%Y\-%m\-%dT%H:%M:%SZ"\fR\. . .P jq may not support some or all of this date functionality on some systems\. In particular, the \fB%u\fR and \fB%j\fR specifiers for \fBstrptime(fmt)\fR are not supported on macOS\. . .IP "" 4 . .nf jq \'fromdate\' "2015\-03\-05T23:51:47Z" => 1425599507 jq \'strptime("%Y\-%m\-%dT%H:%M:%SZ")\' "2015\-03\-05T23:51:47Z" => [2015,2,5,23,51,47,4,63] jq \'strptime("%Y\-%m\-%dT%H:%M:%SZ")|mktime\' "2015\-03\-05T23:51:47Z" => 1425599507 . .fi . .IP "" 0 . .SS "SQL\-Style Operators" jq provides a few SQL\-style operators\. . .TP \fBINDEX(stream; index_expression)\fR: . .IP This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream\. . .TP \fBJOIN($idx; stream; idx_expr; join_expr)\fR: . .IP This builtin joins the values from the given stream to the given index\. The index\'s keys are computed by applying the given index expression to each value from the given stream\. An array of the value in the stream and the corresponding value from the index is fed to the given join expression to produce each result\. . .TP \fBJOIN($idx; stream; idx_expr)\fR: . .IP Same as \fBJOIN($idx; stream; idx_expr; \.)\fR\. . .TP \fBJOIN($idx; idx_expr)\fR: . .IP This builtin joins the input \fB\.\fR to the given index, applying the given index expression to \fB\.\fR to compute the index key\. The join operation is as described above\. . .TP \fBIN(s)\fR: . .IP This builtin outputs \fBtrue\fR if \fB\.\fR appears in the given stream, otherwise it outputs \fBfalse\fR\. . .TP \fBIN(source; s)\fR: . .IP This builtin outputs \fBtrue\fR if any value in the source stream appears in the second stream, otherwise it outputs \fBfalse\fR\. . .SS "builtins" Returns a list of all builtin functions in the format \fBname/arity\fR\. Since functions with the same name but different arities are considered separate functions, \fBall/0\fR, \fBall/1\fR, and \fBall/2\fR would all be present in the list\. . .SH "CONDITIONALS AND COMPARISONS" . .SS "==, !=" The expression \'a == b\' will produce \'true\' if the results of evaluating a and b are equal (that is, if they represent equivalent JSON values) and \'false\' otherwise\. In particular, strings are never considered equal to numbers\. In checking for the equality of JSON objects, the ordering of keys is irrelevant\. If you\'re coming from JavaScript, please note that jq\'s \fB==\fR is like JavaScript\'s \fB===\fR, the "strict equality" operator\. . .P != is "not equal", and \'a != b\' returns the opposite value of \'a == b\' . .IP "" 4 . .nf jq \'\. == false\' null => false jq \'\. == {"b": {"d": (4 + 1e\-20), "c": 3}, "a":1}\' {"a":1, "b": {"c": 3, "d": 4}} => true jq \'\.[] == 1\' [1, 1\.0, "1", "banana"] => true, true, false, false . .fi . .IP "" 0 . .SS "if\-then\-else\-end" \fBif A then B else C end\fR will act the same as \fBB\fR if \fBA\fR produces a value other than false or null, but act the same as \fBC\fR otherwise\. . .P \fBif A then B end\fR is the same as \fBif A then B else \. end\fR\. That is, the \fBelse\fR branch is optional, and if absent is the same as \fB\.\fR\. This also applies to \fBelif\fR with absent ending \fBelse\fR branch\. . .P Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you\'ll sometimes have to be more explicit about the condition you want\. You can\'t test whether, e\.g\. a string is empty using \fBif \.name then A else B end\fR; you\'ll need something like \fBif \.name == "" then A else B end\fR instead\. . .P If the condition \fBA\fR produces multiple results, then \fBB\fR is evaluated once for each result that is not false or null, and \fBC\fR is evaluated once for each false or null\. . .P More cases can be added to an if using \fBelif A then B\fR syntax\. . .IP "" 4 . .nf jq \'if \. == 0 then "zero" elif \. == 1 then "one" else "many" end\' 2 => "many" . .fi . .IP "" 0 . .SS ">, >=, <=, <" The comparison operators \fB>\fR, \fB>=\fR, \fB<=\fR, \fB<\fR return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively)\. . .P The ordering is the same as that described for \fBsort\fR, above\. . .IP "" 4 . .nf jq \'\. < 5\' 2 => true . .fi . .IP "" 0 . .SS "and, or, not" jq supports the normal Boolean operators \fBand\fR, \fBor\fR, \fBnot\fR\. They have the same standard of truth as if expressions \- \fBfalse\fR and \fBnull\fR are considered "false values", and anything else is a "true value"\. . .P If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input\. . .P \fBnot\fR is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in \fB\.foo and \.bar | not\fR\. . .P These three only produce the values \fBtrue\fR and \fBfalse\fR, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default"\. If you want to use this form of "or", picking between two values rather than evaluating a condition, see the \fB//\fR operator below\. . .IP "" 4 . .nf jq \'42 and "a string"\' null => true jq \'(true, false) or false\' null => true, false jq \'(true, true) and (true, false)\' null => true, false, true, false jq \'[true, false | not]\' null => [false, true] . .fi . .IP "" 0 . .SS "Alternative operator: //" The \fB//\fR operator produces all the values of its left\-hand side that are neither \fBfalse\fR nor \fBnull\fR\. If the left\-hand side produces no values other than \fBfalse\fR or \fBnull\fR, then \fB//\fR produces all the values of its right\-hand side\. . .P A filter of the form \fBa // b\fR produces all the results of \fBa\fR that are not \fBfalse\fR or \fBnull\fR\. If \fBa\fR produces no results, or no results other than \fBfalse\fR or \fBnull\fR, then \fBa // b\fR produces the results of \fBb\fR\. . .P This is useful for providing defaults: \fB\.foo // 1\fR will evaluate to \fB1\fR if there\'s no \fB\.foo\fR element in the input\. It\'s similar to how \fBor\fR is sometimes used in Python (jq\'s \fBor\fR operator is reserved for strictly Boolean operations)\. . .P Note: \fBsome_generator // defaults_here\fR is not the same as \fBsome_generator | \. // defaults_here\fR\. The latter will produce default values for all non\-\fBfalse\fR, non\-\fBnull\fR values of the left\-hand side, while the former will not\. Precedence rules can make this confusing\. For example, in \fBfalse, 1 // 2\fR the left\-hand side of \fB//\fR is \fB1\fR, not \fBfalse, 1\fR \-\- \fBfalse, 1 // 2\fR parses the same way as \fBfalse, (1 // 2)\fR\. In \fB(false, null, 1) | \. // 42\fR the left\-hand side of \fB//\fR is \fB\.\fR, which always produces just one value, while in \fB(false, null, 1) // 42\fR the left\-hand side is a generator of three values, and since it produces a value other \fBfalse\fR and \fBnull\fR, the default \fB42\fR is not produced\. . .IP "" 4 . .nf jq \'empty // 42\' null => 42 jq \'\.foo // 42\' {"foo": 19} => 19 jq \'\.foo // 42\' {} => 42 jq \'(false, null, 1) // 42\' null => 1 jq \'(false, null, 1) | \. // 42\' null => 42, 42, 1 . .fi . .IP "" 0 . .SS "try\-catch" Errors can be caught by using \fBtry EXP catch EXP\fR\. The first expression is executed, and if it fails then the second is executed with the error message\. The output of the handler, if any, is output as if it had been the output of the expression to try\. . .P The \fBtry EXP\fR form uses \fBempty\fR as the exception handler\. . .IP "" 4 . .nf jq \'try \.a catch "\. is not an object"\' true => "\. is not an object" jq \'[\.[]|try \.a]\' [{}, true, {"a":1}] => [null, 1] jq \'try error("some exception") catch \.\' true => "some exception" . .fi . .IP "" 0 . .SS "Breaking out of control structures" A convenient use of try/catch is to break out of control structures like \fBreduce\fR, \fBforeach\fR, \fBwhile\fR, and so on\. . .P For example: . .IP "" 4 . .nf # Repeat an expression until it raises "break" as an # error, then stop repeating without re\-raising the error\. # But if the error caught is not "break" then re\-raise it\. try repeat(exp) catch if \.=="break" then empty else error . .fi . .IP "" 0 . .P jq has a syntax for named lexical labels to "break" or "go (back) to": . .IP "" 4 . .nf label $out | \.\.\. break $out \.\.\. . .fi . .IP "" 0 . .P The \fBbreak $label_name\fR expression will cause the program to act as though the nearest (to the left) \fBlabel $label_name\fR produced \fBempty\fR\. . .P The relationship between the \fBbreak\fR and corresponding \fBlabel\fR is lexical: the label has to be "visible" from the break\. . .P To break out of a \fBreduce\fR, for example: . .IP "" 4 . .nf label $out | reduce \.[] as $item (null; if \.==false then break $out else \.\.\. end) . .fi . .IP "" 0 . .P The following jq program produces a syntax error: . .IP "" 4 . .nf break $out . .fi . .IP "" 0 . .P because no label \fB$out\fR is visible\. . .SS "Error Suppression / Optional Operator: ?" The \fB?\fR operator, used as \fBEXP?\fR, is shorthand for \fBtry EXP\fR\. . .IP "" 4 . .nf jq \'[\.[] | \.a?]\' [{}, true, {"a":1}] => [null, 1] jq \'[\.[] | tonumber?]\' ["1", "invalid", "3", 4] => [1, 3, 4] . .fi . .IP "" 0 . .SH "REGULAR EXPRESSIONS" jq uses the Oniguruma regular expression library, as do PHP, TextMate, Sublime Text, etc, so the description here will focus on jq specifics\. . .P Oniguruma supports several flavors of regular expression, so it is important to know that jq uses the "Perl NG" (Perl with named groups) flavor\. . .P The jq regex filters are defined so that they can be used using one of these patterns: . .IP "" 4 . .nf STRING | FILTER(REGEX) STRING | FILTER(REGEX; FLAGS) STRING | FILTER([REGEX]) STRING | FILTER([REGEX, FLAGS]) . .fi . .IP "" 0 . .P where: . .IP "\(bu" 4 STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation; . .IP "\(bu" 4 REGEX, after string interpolation, should be a valid regular expression; . .IP "\(bu" 4 FILTER is one of \fBtest\fR, \fBmatch\fR, or \fBcapture\fR, as described below\. . .IP "" 0 . .P Since REGEX must evaluate to a JSON string, some characters that are needed to form a regular expression must be escaped\. For example, the regular expression \fB\es\fR signifying a whitespace character would be written as \fB"\e\es"\fR\. . .P FLAGS is a string consisting of one of more of the supported flags: . .IP "\(bu" 4 \fBg\fR \- Global search (find all matches, not just the first) . .IP "\(bu" 4 \fBi\fR \- Case insensitive search . .IP "\(bu" 4 \fBm\fR \- Multi line mode (\fB\.\fR will match newlines) . .IP "\(bu" 4 \fBn\fR \- Ignore empty matches . .IP "\(bu" 4 \fBp\fR \- Both s and m modes are enabled . .IP "\(bu" 4 \fBs\fR \- Single line mode (\fB^\fR \-> \fB\eA\fR, \fB$\fR \-> \fB\eZ\fR) . .IP "\(bu" 4 \fBl\fR \- Find longest possible matches . .IP "\(bu" 4 \fBx\fR \- Extended regex format (ignore whitespace and comments) . .IP "" 0 . .P To match a whitespace with the \fBx\fR flag, use \fB\es\fR, e\.g\. . .IP "" 4 . .nf jq \-n \'"a b" | test("a\e\esb"; "x")\' . .fi . .IP "" 0 . .P Note that certain flags may also be specified within REGEX, e\.g\. . .IP "" 4 . .nf jq \-n \'("test", "TEst", "teST", "TEST") | test("(?i)te(?\-i)st")\' . .fi . .IP "" 0 . .P evaluates to: \fBtrue\fR, \fBtrue\fR, \fBfalse\fR, \fBfalse\fR\. . .SS "test(val), test(regex; flags)" Like \fBmatch\fR, but does not return match objects, only \fBtrue\fR or \fBfalse\fR for whether or not the regex matches the input\. . .IP "" 4 . .nf jq \'test("foo")\' "foo" => true jq \'\.[] | test("a b c # spaces are ignored"; "ix")\' ["xabcd", "ABC"] => true, true . .fi . .IP "" 0 . .SS "match(val), match(regex; flags)" \fBmatch\fR outputs an object for each match it finds\. Matches have the following fields: . .IP "\(bu" 4 \fBoffset\fR \- offset in UTF\-8 codepoints from the beginning of the input . .IP "\(bu" 4 \fBlength\fR \- length in UTF\-8 codepoints of the match . .IP "\(bu" 4 \fBstring\fR \- the string that it matched . .IP "\(bu" 4 \fBcaptures\fR \- an array of objects representing capturing groups\. . .IP "" 0 . .P Capturing group objects have the following fields: . .IP "\(bu" 4 \fBoffset\fR \- offset in UTF\-8 codepoints from the beginning of the input . .IP "\(bu" 4 \fBlength\fR \- length in UTF\-8 codepoints of this capturing group . .IP "\(bu" 4 \fBstring\fR \- the string that was captured . .IP "\(bu" 4 \fBname\fR \- the name of the capturing group (or \fBnull\fR if it was unnamed) . .IP "" 0 . .P Capturing groups that did not match anything return an offset of \-1 . .IP "" 4 . .nf jq \'match("(abc)+"; "g")\' "abc abc" => {"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]}, {"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]} jq \'match("foo")\' "foo bar foo" => {"offset": 0, "length": 3, "string": "foo", "captures": []} jq \'match(["foo", "ig"])\' "foo bar FOO" => {"offset": 0, "length": 3, "string": "foo", "captures": []}, {"offset": 8, "length": 3, "string": "FOO", "captures": []} jq \'match("foo (?bar)? foo"; "ig")\' "foo bar foo foo foo" => {"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]}, {"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": \-1, "length": 0, "string": null, "name": "bar123"}]} jq \'[ match("\."; "g")] | length\' "abc" => 3 . .fi . .IP "" 0 . .SS "capture(val), capture(regex; flags)" Collects the named captures in a JSON object, with the name of each capture as the key, and the matched string as the corresponding value\. . .IP "" 4 . .nf jq \'capture("(?[a\-z]+)\-(?[0\-9]+)")\' "xyzzy\-14" => { "a": "xyzzy", "n": "14" } . .fi . .IP "" 0 . .SS "scan(regex), scan(regex; flags)" Emit a stream of the non\-overlapping substrings of the input that match the regex in accordance with the flags, if any have been specified\. If there is no match, the stream is empty\. To capture all the matches for each input string, use the idiom \fB[ expr ]\fR, e\.g\. \fB[ scan(regex) ]\fR\. If the regex contains capturing groups, the filter emits a stream of arrays, each of which contains the captured strings\. . .IP "" 4 . .nf jq \'scan("c")\' "abcdefabc" => "c", "c" jq \'scan("(a+)(b+)")\' "abaabbaaabbb" => ["a","b"], ["aa","bb"], ["aaa","bbb"] . .fi . .IP "" 0 . .SS "split(regex; flags)" Splits an input string on each regex match\. . .P For backwards compatibility, when called with a single argument, \fBsplit\fR splits on a string, not a regex\. . .IP "" 4 . .nf jq \'split(", *"; null)\' "ab,cd, ef" => ["ab","cd","ef"] . .fi . .IP "" 0 . .SS "splits(regex), splits(regex; flags)" These provide the same results as their \fBsplit\fR counterparts, but as a stream instead of an array\. . .IP "" 4 . .nf jq \'splits(", *")\' "ab,cd, ef, gh" => "ab", "cd", "ef", "gh" jq \'splits(",? *"; "n")\' "ab,cd ef, gh" => "ab", "cd", "ef", "gh" . .fi . .IP "" 0 . .SS "sub(regex; tostring), sub(regex; tostring; flags)" Emit the string obtained by replacing the first match of regex in the input string with \fBtostring\fR, after interpolation\. \fBtostring\fR should be a jq string or a stream of such strings, each of which may contain references to named captures\. The named captures are, in effect, presented as a JSON object (as constructed by \fBcapture\fR) to \fBtostring\fR, so a reference to a captured variable named "x" would take the form: \fB"\e(\.x)"\fR\. . .IP "" 4 . .nf jq \'sub("[^a\-z]*(?[a\-z]+)"; "Z\e(\.x)"; "g")\' "123abc456def" => "ZabcZdef" jq \'[sub("(?\.)"; "\e(\.a|ascii_upcase)", "\e(\.a|ascii_downcase)")]\' "aB" => ["AB","aB"] . .fi . .IP "" 0 . .SS "gsub(regex; tostring), gsub(regex; tostring; flags)" \fBgsub\fR is like \fBsub\fR but all the non\-overlapping occurrences of the regex are replaced by \fBtostring\fR, after interpolation\. If the second argument is a stream of jq strings, then \fBgsub\fR will produce a corresponding stream of JSON strings\. . .IP "" 4 . .nf jq \'gsub("(?\.)[^a]*"; "+\e(\.x)\-")\' "Abcabc" => "+A\-+a\-" jq \'[gsub("p"; "a", "b")]\' "p" => ["a","b"] . .fi . .IP "" 0 . .SH "ADVANCED FEATURES" Variables are an absolute necessity in most programming languages, but they\'re relegated to an "advanced feature" in jq\. . .P In most languages, variables are the only means of passing around data\. If you calculate a value, and you want to use it more than once, you\'ll need to store it in a variable\. To pass a value to another part of the program, you\'ll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data\. . .P It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq\'s standard library (many jq functions such as \fBmap\fR and \fBselect\fR are in fact written in jq)\. . .P jq has reduction operators, which are very powerful but a bit tricky\. Again, these are mostly used internally, to define some useful bits of jq\'s standard library\. . .P It may not be obvious at first, but jq is all about generators (yes, as often found in other languages)\. Some utilities are provided to help deal with generators\. . .P Some minimal I/O support (besides reading JSON from standard input, and writing JSON to standard output) is available\. . .P Finally, there is a module/library system\. . .SS "Variable / Symbolic Binding Operator: \.\.\. as $identifier | \.\.\." In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next\. Many expressions, for instance \fBa + b\fR, pass their input to two distinct subexpressions (here \fBa\fR and \fBb\fR are both passed the same input), so variables aren\'t usually necessary in order to use a value twice\. . .P For instance, calculating the average value of an array of numbers requires a few variables in most languages \- at least one to hold the array, perhaps one for each element or for a loop counter\. In jq, it\'s simply \fBadd / length\fR \- the \fBadd\fR expression is given the array and produces its sum, and the \fBlength\fR expression is given the array and produces its length\. . .P So, there\'s generally a cleaner way to solve most problems in jq than defining variables\. Still, sometimes they do make things easier, so jq lets you define variables using \fBexpression as $variable\fR\. All variable names start with \fB$\fR\. Here\'s a slightly uglier version of the array\-averaging example: . .IP "" 4 . .nf length as $array_length | add / $array_length . .fi . .IP "" 0 . .P We\'ll need a more complicated problem to find a situation where using variables actually makes our lives easier\. . .P Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names\. Our input looks like: . .IP "" 4 . .nf {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well\-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} . .fi . .IP "" 0 . .P We want to produce the posts with the author field containing a real name, as in: . .IP "" 4 . .nf {"title": "First post", "author": "Anonymous Coward"} {"title": "A well\-written article", "author": "Person McPherson"} . .fi . .IP "" 0 . .P We use a variable, \fB$names\fR, to store the realnames object, so that we can refer to it later when looking up author usernames: . .IP "" 4 . .nf \&.realnames as $names | \.posts[] | {title, author: $names[\.author]} . .fi . .IP "" 0 . .P The expression \fBexp as $x | \.\.\.\fR means: for each value of expression \fBexp\fR, run the rest of the pipeline with the entire original input, and with \fB$x\fR set to that value\. Thus \fBas\fR functions as something of a foreach loop\. . .P Just as \fB{foo}\fR is a handy way of writing \fB{foo: \.foo}\fR, so \fB{$foo}\fR is a handy way of writing \fB{foo: $foo}\fR\. . .P Multiple variables may be declared using a single \fBas\fR expression by providing a pattern that matches the structure of the input (this is known as "destructuring"): . .IP "" 4 . .nf \&. as {realnames: $names, posts: [$first, $second]} | \.\.\. . .fi . .IP "" 0 . .P The variable declarations in array patterns (e\.g\., \fB\. as [$first, $second]\fR) bind to the elements of the array in from the element at index zero on up, in order\. When there is no value at the index for an array pattern element, \fBnull\fR is bound to that variable\. . .P Variables are scoped over the rest of the expression that defines them, so . .IP "" 4 . .nf \&.realnames as $names | (\.posts[] | {title, author: $names[\.author]}) . .fi . .IP "" 0 . .P will work, but . .IP "" 4 . .nf (\.realnames as $names | \.posts[]) | {title, author: $names[\.author]} . .fi . .IP "" 0 . .P won\'t\. . .P For programming language theorists, it\'s more accurate to say that jq variables are lexically\-scoped bindings\. In particular there\'s no way to change the value of a binding; one can only setup a new binding with the same name, but which will not be visible where the old one was\. . .IP "" 4 . .nf jq \'\.bar as $x | \.foo | \. + $x\' {"foo":10, "bar":200} => 210 jq \'\. as $i|[(\.*2|\. as $i| $i), $i]\' 5 => [10,5] jq \'\. as [$a, $b, {c: $c}] | $a + $b + $c\' [2, 3, {"c": 4, "d": 5}] => 9 jq \'\.[] as [$a, $b] | {a: $a, b: $b}\' [[0], [0, 1], [2, 1, 0]] => {"a":0,"b":null}, {"a":0,"b":1}, {"a":2,"b":1} . .fi . .IP "" 0 . .SS "Destructuring Alternative Operator: ?//" The destructuring alternative operator provides a concise mechanism for destructuring an input that can take one of several forms\. . .P Suppose we have an API that returns a list of resources and events associated with them, and we want to get the user_id and timestamp of the first event for each resource\. The API (having been clumsily converted from XML) will only wrap the events in an array if the resource has multiple events: . .IP "" 4 . .nf {"resources": [{"id": 1, "kind": "widget", "events": {"action": "create", "user_id": 1, "ts": 13}}, {"id": 2, "kind": "widget", "events": [{"action": "create", "user_id": 1, "ts": 14}, {"action": "destroy", "user_id": 1, "ts": 15}]}]} . .fi . .IP "" 0 . .P We can use the destructuring alternative operator to handle this structural change simply: . .IP "" 4 . .nf \&.resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$user_id, $ts}]} | {$user_id, $kind, $id, $ts} . .fi . .IP "" 0 . .P Or, if we aren\'t sure if the input is an array of values or an object: . .IP "" 4 . .nf \&.[] as [$id, $kind, $user_id, $ts] ?// {$id, $kind, $user_id, $ts} | \.\.\. . .fi . .IP "" 0 . .P Each alternative need not define all of the same variables, but all named variables will be available to the subsequent expression\. Variables not matched in the alternative that succeeded will be \fBnull\fR: . .IP "" 4 . .nf \&.resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$first_user_id, $first_ts}]} | {$user_id, $first_user_id, $kind, $id, $ts, $first_ts} . .fi . .IP "" 0 . .P Additionally, if the subsequent expression returns an error, the alternative operator will attempt to try the next binding\. Errors that occur during the final alternative are passed through\. . .IP "" 4 . .nf [[3]] | \.[] as [$a] ?// [$b] | if $a != null then error("err: \e($a)") else {$a,$b} end jq \'\.[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, $d, $e}\' [{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}] => {"a":1,"b":2,"d":3,"e":4}, {"a":1,"b":2,"d":3,"e":4} jq \'\.[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e}\' [{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}] => {"a":1,"b":2,"d":3,"e":null}, {"a":1,"b":2,"d":null,"e":4} jq \'\.[] as [$a] ?// [$b] | if $a != null then error("err: \e($a)") else {$a,$b} end\' [[3]] => {"a":null,"b":3} . .fi . .IP "" 0 . .SS "Defining Functions" You can give a filter a name using "def" syntax: . .IP "" 4 . .nf def increment: \. + 1; . .fi . .IP "" 0 . .P From then on, \fBincrement\fR is usable as a filter just like a builtin function (in fact, this is how many of the builtins are defined)\. A function may take arguments: . .IP "" 4 . .nf def map(f): [\.[] | f]; . .fi . .IP "" 0 . .P Arguments are passed as \fIfilters\fR (functions with no arguments), \fInot\fR as values\. The same argument may be referenced multiple times with different inputs (here \fBf\fR is run for each element of the input array)\. Arguments to a function work more like callbacks than like value arguments\. This is important to understand\. Consider: . .IP "" 4 . .nf def foo(f): f|f; 5|foo(\.*2) . .fi . .IP "" 0 . .P The result will be 20 because \fBf\fR is \fB\.*2\fR, and during the first invocation of \fBf\fR \fB\.\fR will be 5, and the second time it will be 10 (5 * 2), so the result will be 20\. Function arguments are filters, and filters expect an input when invoked\. . .P If you want the value\-argument behaviour for defining simple functions, you can just use a variable: . .IP "" 4 . .nf def addvalue(f): f as $f | map(\. + $f); . .fi . .IP "" 0 . .P Or use the short\-hand: . .IP "" 4 . .nf def addvalue($f): \.\.\.; . .fi . .IP "" 0 . .P With either definition, \fBaddvalue(\.foo)\fR will add the current input\'s \fB\.foo\fR field to each element of the array\. Do note that calling \fBaddvalue(\.[])\fR will cause the \fBmap(\. + $f)\fR part to be evaluated once per value in the value of \fB\.\fR at the call site\. . .P Multiple definitions using the same function name are allowed\. Each re\-definition replaces the previous one for the same number of function arguments, but only for references from functions (or main program) subsequent to the re\-definition\. See also the section below on scoping\. . .IP "" 4 . .nf jq \'def addvalue(f): \. + [f]; map(addvalue(\.[0]))\' [[1,2],[10,20]] => [[1,2,1], [10,20,10]] jq \'def addvalue(f): f as $x | map(\. + $x); addvalue(\.[0])\' [[1,2],[10,20]] => [[1,2,1,2], [10,20,1,2]] . .fi . .IP "" 0 . .SS "Scoping" There are two types of symbols in jq: value bindings (a\.k\.a\., "variables"), and functions\. Both are scoped lexically, with expressions being able to refer only to symbols that have been defined "to the left" of them\. The only exception to this rule is that functions can refer to themselves so as to be able to create recursive functions\. . .P For example, in the following expression there is a binding which is visible "to the right" of it, \fB\.\.\. | \.*3 as $times_three | [\. + $times_three] | \.\.\.\fR, but not "to the left"\. Consider this expression now, \fB\.\.\. | (\.*3 as $times_three | [\. + $times_three]) | \.\.\.\fR: here the binding \fB$times_three\fR is \fInot\fR visible past the closing parenthesis\. . .SS "isempty(exp)" Returns true if \fBexp\fR produces no outputs, false otherwise\. . .IP "" 4 . .nf jq \'isempty(empty)\' null => true jq \'isempty(\.[])\' [] => true jq \'isempty(\.[])\' [1,2,3] => false . .fi . .IP "" 0 . .SS "limit(n; expr)" The \fBlimit\fR function extracts up to \fBn\fR outputs from \fBexpr\fR\. . .IP "" 4 . .nf jq \'[limit(3; \.[])]\' [0,1,2,3,4,5,6,7,8,9] => [0,1,2] . .fi . .IP "" 0 . .SS "skip(n; expr)" The \fBskip\fR function skips the first \fBn\fR outputs from \fBexpr\fR\. . .IP "" 4 . .nf jq \'[skip(3; \.[])]\' [0,1,2,3,4,5,6,7,8,9] => [3,4,5,6,7,8,9] . .fi . .IP "" 0 . .SS "first(expr), last(expr), nth(n; expr)" The \fBfirst(expr)\fR and \fBlast(expr)\fR functions extract the first and last values from \fBexpr\fR, respectively\. . .P The \fBnth(n; expr)\fR function extracts the nth value output by \fBexpr\fR\. Note that \fBnth(n; expr)\fR doesn\'t support negative values of \fBn\fR\. . .IP "" 4 . .nf jq \'[first(range(\.)), last(range(\.)), nth(5; range(\.))]\' 10 => [0,9,5] jq \'[first(empty), last(empty), nth(5; empty)]\' null => [] . .fi . .IP "" 0 . .SS "first, last, nth(n)" The \fBfirst\fR and \fBlast\fR functions extract the first and last values from any array at \fB\.\fR\. . .P The \fBnth(n)\fR function extracts the nth value of any array at \fB\.\fR\. . .IP "" 4 . .nf jq \'[range(\.)]|[first, last, nth(5)]\' 10 => [0,9,5] . .fi . .IP "" 0 . .SS "reduce" The \fBreduce\fR syntax allows you to combine all of the results of an expression by accumulating them into a single answer\. The form is \fBreduce EXP as $var (INIT; UPDATE)\fR\. As an example, we\'ll pass \fB[1,2,3]\fR to this expression: . .IP "" 4 . .nf reduce \.[] as $item (0; \. + $item) . .fi . .IP "" 0 . .P For each result that \fB\.[]\fR produces, \fB\. + $item\fR is run to accumulate a running total, starting from 0 as the input value\. In this example, \fB\.[]\fR produces the results \fB1\fR, \fB2\fR, and \fB3\fR, so the effect is similar to running something like this: . .IP "" 4 . .nf 0 | 1 as $item | \. + $item | 2 as $item | \. + $item | 3 as $item | \. + $item jq \'reduce \.[] as $item (0; \. + $item)\' [1,2,3,4,5] => 15 jq \'reduce \.[] as [$i,$j] (0; \. + $i * $j)\' [[1,2],[3,4],[5,6]] => 44 jq \'reduce \.[] as {$x,$y} (null; \.x += $x | \.y += [$y])\' [{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}] => {"x":"abc","y":[1,2,3]} . .fi . .IP "" 0 . .SS "foreach" The \fBforeach\fR syntax is similar to \fBreduce\fR, but intended to allow the construction of \fBlimit\fR and reducers that produce intermediate results\. . .P The form is \fBforeach EXP as $var (INIT; UPDATE; EXTRACT)\fR\. As an example, we\'ll pass \fB[1,2,3]\fR to this expression: . .IP "" 4 . .nf foreach \.[] as $item (0; \. + $item; [$item, \. * 2]) . .fi . .IP "" 0 . .P Like the \fBreduce\fR syntax, \fB\. + $item\fR is run for each result that \fB\.[]\fR produces, but \fB[$item, \. * 2]\fR is run for each intermediate values\. In this example, since the intermediate values are \fB1\fR, \fB3\fR, and \fB6\fR, the \fBforeach\fR expression produces \fB[1,2]\fR, \fB[2,6]\fR, and \fB[3,12]\fR\. So the effect is similar to running something like this: . .IP "" 4 . .nf 0 | 1 as $item | \. + $item | [$item, \. * 2], 2 as $item | \. + $item | [$item, \. * 2], 3 as $item | \. + $item | [$item, \. * 2] . .fi . .IP "" 0 . .P When \fBEXTRACT\fR is omitted, the identity filter is used\. That is, it outputs the intermediate values as they are\. . .IP "" 4 . .nf jq \'foreach \.[] as $item (0; \. + $item)\' [1,2,3,4,5] => 1, 3, 6, 10, 15 jq \'foreach \.[] as $item (0; \. + $item; [$item, \. * 2])\' [1,2,3,4,5] => [1,2], [2,6], [3,12], [4,20], [5,30] jq \'foreach \.[] as $item (0; \. + 1; {index: \., $item})\' ["foo", "bar", "baz"] => {"index":1,"item":"foo"}, {"index":2,"item":"bar"}, {"index":3,"item":"baz"} . .fi . .IP "" 0 . .SS "Recursion" As described above, \fBrecurse\fR uses recursion, and any jq function can be recursive\. The \fBwhile\fR builtin is also implemented in terms of recursion\. . .P Tail calls are optimized whenever the expression to the left of the recursive call outputs its last value\. In practice this means that the expression to the left of the recursive call should not produce more than one output for each input\. . .P For example: . .IP "" 4 . .nf def recurse(f): def r: \., (f | select(\. != null) | r); r; def while(cond; update): def _while: if cond then \., (update | _while) else empty end; _while; def repeat(exp): def _repeat: exp, _repeat; _repeat; . .fi . .IP "" 0 . .SS "Generators and iterators" Some jq operators and functions are actually generators in that they can produce zero, one, or more values for each input, just as one might expect in other programming languages that have generators\. For example, \fB\.[]\fR generates all the values in its input (which must be an array or an object), \fBrange(0; 10)\fR generates the integers between 0 and 10, and so on\. . .P Even the comma operator is a generator, generating first the values generated by the expression to the left of the comma, then the values generated by the expression on the right of the comma\. . .P The \fBempty\fR builtin is the generator that produces zero outputs\. The \fBempty\fR builtin backtracks to the preceding generator expression\. . .P All jq functions can be generators just by using builtin generators\. It is also possible to construct new generators using only recursion and the comma operator\. If recursive calls are "in tail position" then the generator will be efficient\. In the example below the recursive call by \fB_range\fR to itself is in tail position\. The example shows off three advanced topics: tail recursion, generator construction, and sub\-functions\. . .IP "" 4 . .nf jq \'def range(init; upto; by): def _range: if (by > 0 and \. < upto) or (by < 0 and \. > upto) then \., ((\.+by)|_range) else empty end; if init == upto then empty elif by == 0 then init else init|_range end; range(0; 10; 3)\' null => 0, 3, 6, 9 jq \'def while(cond; update): def _while: if cond then \., (update | _while) else empty end; _while; [while(\.<100; \.*2)]\' 1 => [1,2,4,8,16,32,64] . .fi . .IP "" 0 . .SH "MATH" jq currently only has IEEE754 double\-precision (64\-bit) floating point number support\. . .P Besides simple arithmetic operators such as \fB+\fR, jq also has most standard math functions from the C math library\. C math functions that take a single input argument (e\.g\., \fBsin()\fR) are available as zero\-argument jq functions\. C math functions that take two input arguments (e\.g\., \fBpow()\fR) are available as two\-argument jq functions that ignore \fB\.\fR\. C math functions that take three input arguments are available as three\-argument jq functions that ignore \fB\.\fR\. . .P Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library\. Unavailable math functions will be defined but will raise an error\. . .P One\-input C math functions: \fBacos\fR \fBacosh\fR \fBasin\fR \fBasinh\fR \fBatan\fR \fBatanh\fR \fBcbrt\fR \fBceil\fR \fBcos\fR \fBcosh\fR \fBerf\fR \fBerfc\fR \fBexp\fR \fBexp10\fR \fBexp2\fR \fBexpm1\fR \fBfabs\fR \fBfloor\fR \fBgamma\fR \fBj0\fR \fBj1\fR \fBlgamma\fR \fBlog\fR \fBlog10\fR \fBlog1p\fR \fBlog2\fR \fBlogb\fR \fBnearbyint\fR \fBrint\fR \fBround\fR \fBsignificand\fR \fBsin\fR \fBsinh\fR \fBsqrt\fR \fBtan\fR \fBtanh\fR \fBtgamma\fR \fBtrunc\fR \fBy0\fR \fBy1\fR\. . .P Two\-input C math functions: \fBatan2\fR \fBcopysign\fR \fBdrem\fR \fBfdim\fR \fBfmax\fR \fBfmin\fR \fBfmod\fR \fBfrexp\fR \fBhypot\fR \fBjn\fR \fBldexp\fR \fBmodf\fR \fBnextafter\fR \fBnexttoward\fR \fBpow\fR \fBremainder\fR \fBscalb\fR \fBscalbln\fR \fByn\fR\. . .P Three\-input C math functions: \fBfma\fR\. . .P See your system\'s manual for more information on each of these\. . .SH "I/O" At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read\. Two builtins functions are provided for this, \fBinput\fR and \fBinputs\fR, that read from the same sources (e\.g\., \fBstdin\fR, files named on the command\-line) as jq itself\. These two builtins, and jq\'s own reading actions, can be interleaved with each other\. They are commonly used in combination with the null input option \fB\-n\fR to prevent one input from being read implicitly\. . .P Two builtins provide minimal output capabilities, \fBdebug\fR, and \fBstderr\fR\. (Recall that a jq program\'s output values are always output as JSON texts on \fBstdout\fR\.) The \fBdebug\fR builtin can have application\-specific behavior, such as for executables that use the libjq C API but aren\'t the jq executable itself\. The \fBstderr\fR builtin outputs its input in raw mode to stderr with no additional decoration, not even a newline\. . .P Most jq builtins are referentially transparent, and yield constant and repeatable value streams when applied to constant inputs\. This is not true of I/O builtins\. . .SS "input" Outputs one new input\. . .P Note that when using \fBinput\fR it is generally necessary to invoke jq with the \fB\-n\fR command\-line option, otherwise the first entity will be lost\. . .IP "" 4 . .nf echo 1 2 3 4 | jq \'[\., input]\' # [1,2] [3,4] . .fi . .IP "" 0 . .SS "inputs" Outputs all remaining inputs, one by one\. . .P This is primarily useful for reductions over a program\'s inputs\. Note that when using \fBinputs\fR it is generally necessary to invoke jq with the \fB\-n\fR command\-line option, otherwise the first entity will be lost\. . .IP "" 4 . .nf echo 1 2 3 | jq \-n \'reduce inputs as $i (0; \. + $i)\' # 6 . .fi . .IP "" 0 . .SS "debug, debug(msgs)" These two filters are like \fB\.\fR but have as a side\-effect the production of one or more messages on stderr\. . .P The message produced by the \fBdebug\fR filter has the form . .IP "" 4 . .nf ["DEBUG:",] . .fi . .IP "" 0 . .P where \fB\fR is a compact rendition of the input value\. This format may change in the future\. . .P The \fBdebug(msgs)\fR filter is defined as \fB(msgs | debug | empty), \.\fR thus allowing great flexibility in the content of the message, while also allowing multi\-line debugging statements to be created\. . .P For example, the expression: . .IP "" 4 . .nf 1 as $x | 2 | debug("Entering function foo with $x == \e($x)", \.) | (\.+1) . .fi . .IP "" 0 . .P would produce the value 3 but with the following two lines being written to stderr: . .IP "" 4 . .nf ["DEBUG:","Entering function foo with $x == 1"] ["DEBUG:",2] . .fi . .IP "" 0 . .SS "stderr" Prints its input in raw and compact mode to stderr with no additional decoration, not even a newline\. . .SS "input_filename" Returns the name of the file whose input is currently being filtered\. Note that this will not work well unless jq is running in a UTF\-8 locale\. . .SS "input_line_number" Returns the line number of the input currently being filtered\. . .SH "STREAMING" With the \fB\-\-stream\fR option jq can parse input texts in a streaming fashion, allowing jq programs to start processing large JSON texts immediately rather than after the parse completes\. If you have a single JSON text that is 1GB in size, streaming it will allow you to process it much more quickly\. . .P However, streaming isn\'t easy to deal with as the jq program will have \fB[, ]\fR (and a few other forms) as inputs\. . .P Several builtins are provided to make handling streams easier\. . .P The examples below use the streamed form of \fB["a",["b"]]\fR, which is \fB[[0],"a"],[[1,0],"b"],[[1,0]],[[1]]\fR\. . .P Streaming forms include \fB[, ]\fR (to indicate any scalar value, empty array, or empty object), and \fB[]\fR (to indicate the end of an array or object)\. Future versions of jq run with \fB\-\-stream\fR and \fB\-\-seq\fR may output additional forms such as \fB["error message"]\fR when an input text fails to parse\. . .SS "truncate_stream(stream_expression)" Consumes a number as input and truncates the corresponding number of path elements from the left of the outputs of the given streaming expression\. . .IP "" 4 . .nf jq \'truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]])\' 1 => [[0],"b"], [[0]] . .fi . .IP "" 0 . .SS "fromstream(stream_expression)" Outputs values corresponding to the stream expression\'s outputs\. . .IP "" 4 . .nf jq \'fromstream(1|truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]]))\' null => ["b"] . .fi . .IP "" 0 . .SS "tostream" The \fBtostream\fR builtin outputs the streamed form of its input\. . .IP "" 4 . .nf jq \'\. as $dot|fromstream($dot|tostream)|\.==$dot\' [0,[1,{"a":1},{"b":2}]] => true . .fi . .IP "" 0 . .SH "ASSIGNMENT" Assignment works a little differently in jq than in most programming languages\. jq doesn\'t distinguish between references to and copies of something \- two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object"\. . .P If an object has two fields which are arrays, \fB\.foo\fR and \fB\.bar\fR, and you append something to \fB\.foo\fR, then \fB\.bar\fR will not get bigger, even if you\'ve previously set \fB\.bar = \.foo\fR\. If you\'re used to programming in languages like Python, Java, Ruby, JavaScript, etc\. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance it doesn\'t actually do that, but that\'s the general idea)\. . .P This means that it\'s impossible to build circular values in jq (such as an array whose first element is itself)\. This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON\. . .P All the assignment operators in jq have path expressions on the left\-hand side (LHS)\. The right\-hand side (RHS) provides values to set to the paths named by the LHS path expressions\. . .P Values in jq are always immutable\. Internally, assignment works by using a reduction to compute new, replacement values for \fB\.\fR that have had all the desired assignments applied to \fB\.\fR, then outputting the modified value\. This might be made clear by this example: \fB{a:{b:{c:1}}} | (\.a\.b|=3), \.\fR\. This will output \fB{"a":{"b":3}}\fR and \fB{"a":{"b":{"c":1}}}\fR because the last sub\-expression, \fB\.\fR, sees the original value, not the modified value\. . .P Most users will want to use modification assignment operators, such as \fB|=\fR or \fB+=\fR, rather than \fB=\fR\. . .P Note that the LHS of assignment operators refers to a value in \fB\.\fR\. Thus \fB$var\.foo = 1\fR won\'t work as expected (\fB$var\.foo\fR is not a valid or useful path expression in \fB\.\fR); use \fB$var | \.foo = 1\fR instead\. . .P Note too that \fB\.a,\.b=0\fR does not set \fB\.a\fR and \fB\.b\fR, but \fB(\.a,\.b)=0\fR sets both\. . .SS "Update\-assignment: |=" This is the "update" operator \fB|=\fR\. It takes a filter on the right\-hand side and works out the new value for the property of \fB\.\fR being assigned to by running the old value through this expression\. For instance, \fB(\.foo, \.bar) |= \.+1\fR will build an object with the \fBfoo\fR field set to the input\'s \fBfoo\fR plus 1, and the \fBbar\fR field set to the input\'s \fBbar\fR plus 1\. . .P The left\-hand side can be any general path expression; see \fBpath()\fR\. . .P Note that the left\-hand side of \fB|=\fR refers to a value in \fB\.\fR\. Thus \fB$var\.foo |= \. + 1\fR won\'t work as expected (\fB$var\.foo\fR is not a valid or useful path expression in \fB\.\fR); use \fB$var | \.foo |= \. + 1\fR instead\. . .P If the right\-hand side outputs no values (i\.e\., \fBempty\fR), then the left\-hand side path will be deleted, as with \fBdel(path)\fR\. . .P If the right\-hand side outputs multiple values, only the first one will be used (COMPATIBILITY NOTE: in jq 1\.5 and earlier releases, it used to be that only the last one was used)\. . .IP "" 4 . .nf jq \'(\.\.|select(type=="boolean")) |= if \. then 1 else 0 end\' [true,false,[5,true,[true,[false]],false]] => [1,0,[5,1,[1,[0]],0]] . .fi . .IP "" 0 . .SS "Arithmetic update\-assignment: +=, \-=, *=, /=, %=, //=" jq has a few operators of the form \fBa op= b\fR, which are all equivalent to \fBa |= \. op b\fR\. So, \fB+= 1\fR can be used to increment values, being the same as \fB|= \. + 1\fR\. . .IP "" 4 . .nf jq \'\.foo += 1\' {"foo": 42} => {"foo": 43} . .fi . .IP "" 0 . .SS "Plain assignment: =" This is the plain assignment operator\. Unlike the others, the input to the right\-hand side (RHS) is the same as the input to the left\-hand side (LHS) rather than the value at the LHS path, and all values output by the RHS will be used (as shown below)\. . .P If the RHS of \fB=\fR produces multiple values, then for each such value jq will set the paths on the left\-hand side to the value and then it will output the modified \fB\.\fR\. For example, \fB(\.a,\.b) = range(2)\fR outputs \fB{"a":0,"b":0}\fR, then \fB{"a":1,"b":1}\fR\. The "update" assignment forms (see above) do not do this\. . .P This example should show the difference between \fB=\fR and \fB|=\fR: . .P Provide input \fB{"a": {"b": 10}, "b": 20}\fR to the programs . .IP "" 4 . .nf \&.a = \.b . .fi . .IP "" 0 . .P and . .IP "" 4 . .nf \&.a |= \.b . .fi . .IP "" 0 . .P The former will set the \fBa\fR field of the input to the \fBb\fR field of the input, and produce the output \fB{"a": 20, "b": 20}\fR\. The latter will set the \fBa\fR field of the input to the \fBa\fR field\'s \fBb\fR field, producing \fB{"a": 10, "b": 20}\fR\. . .IP "" 4 . .nf jq \'\.a = \.b\' {"a": {"b": 10}, "b": 20} => {"a":20,"b":20} jq \'\.a |= \.b\' {"a": {"b": 10}, "b": 20} => {"a":10,"b":20} jq \'(\.a, \.b) = range(3)\' null => {"a":0,"b":0}, {"a":1,"b":1}, {"a":2,"b":2} jq \'(\.a, \.b) |= range(3)\' null => {"a":0,"b":0} . .fi . .IP "" 0 . .SS "Complex assignments" Lots more things are allowed on the left\-hand side of a jq assignment than in most languages\. We\'ve already seen simple field accesses on the left hand side, and it\'s no surprise that array accesses work just as well: . .IP "" 4 . .nf \&.posts[0]\.title = "JQ Manual" . .fi . .IP "" 0 . .P What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: . .IP "" 4 . .nf \&.posts[]\.comments |= \. + ["this is great"] . .fi . .IP "" 0 . .P That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts)\. . .P When jq encounters an assignment like \'a = b\', it records the "path" taken to select a part of the input document while executing a\. This path is then used to find which part of the input to change while executing the assignment\. Any filter may be used on the left\-hand side of an equals \- whichever paths it selects from the input will be where the assignment is performed\. . .P This is a very powerful operation\. Suppose we wanted to add a comment to blog posts, using the same "blog" input above\. This time, we only want to comment on the posts written by "stedolan"\. We can find those posts using the "select" function described earlier: . .IP "" 4 . .nf \&.posts[] | select(\.author == "stedolan") . .fi . .IP "" 0 . .P The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: . .IP "" 4 . .nf (\.posts[] | select(\.author == "stedolan") | \.comments) |= \. + ["terrible\."] . .fi . .IP "" 0 . .SH "COMMENTS" You can write comments in your jq filters using \fB#\fR\. . .P A \fB#\fR character (not part of a string) starts a comment\. All characters from \fB#\fR to the end of the line are ignored\. . .P If the end of the line is preceded by an odd number of backslash characters, the following line is also considered part of the comment and is ignored\. . .P For example, the following code outputs \fB[1,3,4,7]\fR . .IP "" 4 . .nf [ 1, # foo \e 2, # bar \e\e 3, 4, # baz \e\e\e 5, \e 6, 7 # comment \e comment \e comment ] . .fi . .IP "" 0 . .P Backslash continuing the comment on the next line can be useful when writing the "shebang" for a jq script: . .IP "" 4 . .nf #!/bin/sh \-\- # total \- Output the sum of the given arguments (or stdin) # usage: total [numbers\.\.\.] # \e exec jq \-\-args \-MRnf \-\- "$0" "$@" $ARGS\.positional | reduce ( if \. == [] then inputs else \.[] end | \. as $dot | try tonumber catch false | if not or isnan then @json "total: Invalid number \e($dot)\.\en" | halt_error(1) end ) as $n (0; \. + $n) . .fi . .IP "" 0 . .P The \fBexec\fR line is considered a comment by jq, so it is ignored\. But it is not ignored by \fBsh\fR, since in \fBsh\fR a backslash at the end of the line does not continue the comment\. With this trick, when the script is invoked as \fBtotal 1 2\fR, \fB/bin/sh \-\- /path/to/total 1 2\fR will be run, and \fBsh\fR will then run \fBexec jq \-\-args \-MRnf \-\- /path/to/total 1 2\fR replacing itself with a \fBjq\fR interpreter invoked with the specified options (\fB\-M\fR, \fB\-R\fR, \fB\-n\fR, \fB\-\-args\fR), that evaluates the current file (\fB$0\fR), with the arguments (\fB$@\fR) that were passed to \fBsh\fR\. . .SH "MODULES" jq has a library/module system\. Modules are files whose names end in \fB\.jq\fR\. . .P Modules imported by a program are searched for in a default search path (see below)\. The \fBimport\fR and \fBinclude\fR directives allow the importer to alter this path\. . .P Paths in the search path are subject to various substitutions\. . .P For paths starting with \fB~/\fR, the user\'s home directory is substituted for \fB~\fR\. . .P For paths starting with \fB$ORIGIN/\fR, the directory where the jq executable is located is substituted for \fB$ORIGIN\fR\. . .P For paths starting with \fB\./\fR or paths that are \fB\.\fR, the path of the including file is substituted for \fB\.\fR\. For top\-level programs given on the command\-line, the current directory is used\. . .P Import directives can optionally specify a search path to which the default is appended\. . .P The default search path is the search path given to the \fB\-L\fR command\-line option, else \fB["~/\.jq", "$ORIGIN/\.\./lib/jq", "$ORIGIN/\.\./lib"]\fR\. . .P Null and empty string path elements terminate search path processing\. . .P A dependency with relative path \fBfoo/bar\fR would be searched for in \fBfoo/bar\.jq\fR and \fBfoo/bar/bar\.jq\fR in the given search path\. This is intended to allow modules to be placed in a directory along with, for example, version control files, README files, and so on, but also to allow for single\-file modules\. . .P Consecutive components with the same name are not allowed to avoid ambiguities (e\.g\., \fBfoo/foo\fR)\. . .P For example, with \fB\-L$HOME/\.jq\fR a module \fBfoo\fR can be found in \fB$HOME/\.jq/foo\.jq\fR and \fB$HOME/\.jq/foo/foo\.jq\fR\. . .P If \fB\.jq\fR exists in the user\'s home directory, and is a file (not a directory), it is automatically sourced into the main program\. . .SS "import RelativePathString as NAME [];" Imports a module found at the given path relative to a directory in a search path\. A \fB\.jq\fR suffix will be added to the relative path string\. The module\'s symbols are prefixed with \fBNAME::\fR\. . .P The optional metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR and so on\. At this time jq only uses the \fBsearch\fR key/value of the metadata\. The metadata is also made available to users via the \fBmodulemeta\fR builtin\. . .P The \fBsearch\fR key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top\-level search path\. . .SS "include RelativePathString [];" Imports a module found at the given path relative to a directory in a search path as if it were included in place\. A \fB\.jq\fR suffix will be added to the relative path string\. The module\'s symbols are imported into the caller\'s namespace as if the module\'s content had been included directly\. . .P The optional metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR and so on\. At this time jq only uses the \fBsearch\fR key/value of the metadata\. The metadata is also made available to users via the \fBmodulemeta\fR builtin\. . .SS "import RelativePathString as $NAME [];" Imports a JSON file found at the given path relative to a directory in a search path\. A \fB\.json\fR suffix will be added to the relative path string\. The file\'s data will be available as \fB$NAME::NAME\fR\. . .P The optional metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR and so on\. At this time jq only uses the \fBsearch\fR key/value of the metadata\. The metadata is also made available to users via the \fBmodulemeta\fR builtin\. . .P The \fBsearch\fR key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top\-level search path\. . .SS "module ;" This directive is entirely optional\. It\'s not required for proper operation\. It serves only the purpose of providing metadata that can be read with the \fBmodulemeta\fR builtin\. . .P The metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR\. At this time jq doesn\'t use this metadata, but it is made available to users via the \fBmodulemeta\fR builtin\. . .SS "modulemeta" Takes a module name as input and outputs the module\'s metadata as an object, with the module\'s imports (including metadata) as an array value for the \fBdeps\fR key and the module\'s defined functions as an array value for the \fBdefs\fR key\. . .P Programs can use this to query a module\'s metadata, which they could then use to, for example, search for, download, and install missing dependencies\. . .SH "COLORS" To configure alternative colors just set the \fBJQ_COLORS\fR environment variable to colon\-delimited list of partial terminal escape sequences like \fB"1;31"\fR, in this order: . .IP "\(bu" 4 color for \fBnull\fR . .IP "\(bu" 4 color for \fBfalse\fR . .IP "\(bu" 4 color for \fBtrue\fR . .IP "\(bu" 4 color for numbers . .IP "\(bu" 4 color for strings . .IP "\(bu" 4 color for arrays . .IP "\(bu" 4 color for objects . .IP "\(bu" 4 color for object keys . .IP "" 0 . .P The default color scheme is the same as setting \fBJQ_COLORS="0;90:0;39:0;39:0;39:0;32:1;39:1;39:1;34"\fR\. . .P This is not a manual for VT100/ANSI escapes\. However, each of these color specifications should consist of two numbers separated by a semi\-colon, where the first number is one of these: . .IP "\(bu" 4 1 (bright) . .IP "\(bu" 4 2 (dim) . .IP "\(bu" 4 4 (underscore) . .IP "\(bu" 4 5 (blink) . .IP "\(bu" 4 7 (reverse) . .IP "\(bu" 4 8 (hidden) . .IP "" 0 . .P and the second is one of these: . .IP "\(bu" 4 30 (black) . .IP "\(bu" 4 31 (red) . .IP "\(bu" 4 32 (green) . .IP "\(bu" 4 33 (yellow) . .IP "\(bu" 4 34 (blue) . .IP "\(bu" 4 35 (magenta) . .IP "\(bu" 4 36 (cyan) . .IP "\(bu" 4 37 (white) . .IP "" 0 . .SH "BUGS" Presumably\. Report them or discuss them at: . .IP "" 4 . .nf https://github\.com/jqlang/jq/issues . .fi . .IP "" 0 . .SH "AUTHOR" Stephen Dolan \fB\fR jq-1.8.2/libjq.pc.in0000644000175100017510000000036615215513536007664 prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libjq URL: https://jqlang.org/ Description: Library to process JSON using a query language Version: @VERSION@ Libs: -L${libdir} -ljq Cflags: -I${includedir} jq-1.8.2/configure0000755000175100017510000243525515215513555007555 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for jq 1.8.2. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; 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 # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (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 \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: https://github.com/jqlang/jq/issues about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='jq' PACKAGE_TARNAME='jq' PACKAGE_VERSION='1.8.2' PACKAGE_STRING='jq 1.8.2' PACKAGE_BUGREPORT='https://github.com/jqlang/jq/issues' PACKAGE_URL='https://jqlang.org' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= enable_option_checking=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS WITH_ONIGURUMA_FALSE WITH_ONIGURUMA_TRUE BUILD_ONIGURUMA_FALSE BUILD_ONIGURUMA_TRUE onig_LDFLAGS onig_CFLAGS subdirs LIB_atexit LIB_pthread_once LIB_pthread_key_create LIB_getentropy LIB_arc4random LIB_setlocale LIB_gettimeofday LIB_localtime LIB_localtime_r LIB_gmtime LIB_gmtime_r LIB_timegm LIB_setenv LIB_strftime LIB_strptime LIB__isatty LIB_isatty ALLOCA PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CXX PTHREAD_CC ax_pthread_config ENABLE_ALL_STATIC_FALSE ENABLE_ALL_STATIC_TRUE ENABLE_ERROR_INJECTION_FALSE ENABLE_ERROR_INJECTION_TRUE ENABLE_DOCS_FALSE ENABLE_DOCS_TRUE ENABLE_GCOV_FALSE ENABLE_GCOV_TRUE ENABLE_UBSAN_FALSE ENABLE_UBSAN_TRUE ENABLE_ASAN_FALSE ENABLE_ASAN_TRUE ENABLE_VALGRIND_FALSE ENABLE_VALGRIND_TRUE PIPENV WIN32_FALSE WIN32_TRUE LEX BISON_VERSION LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB FILECMD LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL OBJDUMP DLLTOOL AS YFLAGS YACC CPP MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE ac_ct_AR AR AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_silent_rules enable_maintainer_mode enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_largefile enable_valgrind enable_asan enable_ubsan enable_gcov enable_docs enable_error_injection enable_all_static enable_decnum with_oniguruma ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP YACC YFLAGS LT_SYS_LIBRARY_PATH PIPENV' ac_subdirs_all='vendor/oniguruma' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures jq 1.8.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/jq] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of jq 1.8.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-largefile omit support for large files --enable-valgrind enable Valgrind during testing --enable-asan enable address sanitizer --enable-ubsan enable undefined behavior sanitizer --enable-gcov enable gcov code coverage tool --disable-docs do not build docs --enable-error-injection build and test with error injection --enable-all-static link jq with static libraries only --disable-decnum disable decnum support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-oniguruma=prefix try this for a non-standard install prefix of the oniguruma library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. LT_SYS_LIBRARY_PATH User-defined run-time library search path. PIPENV pipenv command Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . jq home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF jq configure 1.8.2 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. */ #include #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 printf %s "checking for $2.$3... " >&6; } if eval test \${$4+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else $as_nop eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by jq $as_me 1.8.2, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" # Auxiliary files required by this configure script. ac_aux_files="config.guess config.sub ltmain.sh ar-lib missing install-sh compile" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}/config" # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test ${ac_cv_safe_to_define___extensions__+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_safe_to_define___extensions__=yes else $as_nop ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } if test ${ac_cv_should_define__xopen_source+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_should_define__xopen_source=no if test $ac_cv_header_wchar_h = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include mbstate_t x; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE 500 #include mbstate_t x; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_should_define__xopen_source=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h if test $ac_cv_header_minix_config_h = yes then : MINIX=yes printf "%s\n" "#define _MINIX 1" >>confdefs.h printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h else $as_nop MINIX= fi if test $ac_cv_safe_to_define___extensions__ = yes then : printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h fi if test $ac_cv_should_define__xopen_source = yes then : printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h fi if test -z "$MAKE" then : case "`uname -s`" in #( SunOS) : MAKE=/usr/gnu/bin/make ;; #( *) : ;; esac fi am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` 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= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='jq' VERSION='1.8.2' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar lib "link -lib" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 printf %s "checking the archiver ($AR) interface... " >&6; } if test ${am_cv_ar_interface+y} then : printf %s "(cached) " >&6 else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am_cv_ar_interface=ar cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int some_variable = 0; _ACEOF if ac_fn_c_try_compile "$LINENO" then : am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 printf "%s\n" "$am_cv_ar_interface" >&6; } case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # 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__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) as_fn_error $? "could not determine $AR interface" "$LINENO" 5 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test ${enable_maintainer_mode+y} then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else $as_nop USE_MAINTAINER_MODE=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_c_preproc_warn_flag=yes for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_YACC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 printf "%s\n" "$YACC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" case `pwd` in *\ * | *\ *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.7' macro_revision='2.4.7' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 printf "%s\n" "printf" >&6; } ;; print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 printf "%s\n" "print -r" >&6; } ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 printf "%s\n" "cat" >&6; } ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in sed gsed do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 printf %s "checking for fgrep... " >&6; } if test ${ac_cv_path_FGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in fgrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test ${lt_cv_path_NM+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 printf "%s\n" "$DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 printf %s "checking the name lister ($NM) interface... " >&6; } if test ${lt_cv_nm_interface+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 printf "%s\n" "$lt_cv_nm_interface" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 printf "%s\n" "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 printf %s "checking the maximum length of command line arguments... " >&6; } if test ${lt_cv_sys_max_cmd_len+y} then : printf %s "(cached) " >&6 else $as_nop i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 printf %s "checking how to convert $build file names to $host format... " >&6; } if test ${lt_cv_to_host_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 printf %s "checking how to convert $build file names to toolchain format... " >&6; } if test ${lt_cv_to_tool_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 printf %s "checking for $LD option to reload object files... " >&6; } if test ${lt_cv_ld_reload_flag+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_reload_flag='-r' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. set dummy ${ac_tool_prefix}file; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_FILECMD+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$FILECMD"; then ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_FILECMD="${ac_tool_prefix}file" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi FILECMD=$ac_cv_prog_FILECMD if test -n "$FILECMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 printf "%s\n" "$FILECMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_FILECMD"; then ac_ct_FILECMD=$FILECMD # Extract the first word of "file", so it can be a program name with args. set dummy file; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_FILECMD+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_FILECMD"; then ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_FILECMD="file" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD if test -n "$ac_ct_FILECMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 printf "%s\n" "$ac_ct_FILECMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_FILECMD" = x; then FILECMD=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac FILECMD=$ac_ct_FILECMD fi else FILECMD="$ac_cv_prog_FILECMD" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 printf "%s\n" "$OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 printf %s "checking how to recognize dependent libraries... " >&6; } if test ${lt_cv_deplibs_check_method+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='$FILECMD -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly* | midnightbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=$FILECMD case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 printf "%s\n" "$DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 printf %s "checking how to associate runtime and link libraries... " >&6; } if test ${lt_cv_sharedlib_from_linklib_cmd+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} # Use ARFLAGS variable as AR's operation code to sync the variable naming with # Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have # higher priority because thats what people were doing historically (setting # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS # variable obsoleted/removed. test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} lt_ar_flags=$AR_FLAGS # Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override # by AR_FLAGS because that was never working and AR_FLAGS is about to die. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 printf %s "checking for archiver @FILE support... " >&6; } if test ${lt_cv_ar_at_file+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 printf %s "checking command to parse $NM output from $compiler object... " >&6; } if test ${lt_cv_sys_global_symbol_pipe+y} then : printf %s "(cached) " >&6 else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 printf "%s\n" "failed" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 printf "%s\n" "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test ${with_sysroot+y} then : withval=$with_sysroot; else $as_nop with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 printf "%s\n" "${lt_sysroot:-no}" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 printf %s "checking for a working dd... " >&6; } if test ${ac_cv_path_lt_DD+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in dd do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 printf "%s\n" "$ac_cv_path_lt_DD" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 printf %s "checking how to truncate binary pipes... " >&6; } if test ${lt_cv_truncate_bin+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 printf "%s\n" "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test ${enable_libtool_lock+y} then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `$FILECMD conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `$FILECMD conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `$FILECMD conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 printf %s "checking whether the C compiler needs -belf... " >&6; } if test ${lt_cv_cc_needs_belf+y} then : printf %s "(cached) " >&6 else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_cc_needs_belf=yes else $as_nop lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 printf "%s\n" "$MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if test ${lt_cv_path_mainfest_tool+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 printf "%s\n" "$DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 printf "%s\n" "$NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 printf "%s\n" "$ac_ct_NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 printf "%s\n" "$LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 printf "%s\n" "$ac_ct_LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 printf "%s\n" "$OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 printf "%s\n" "$ac_ct_OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 printf "%s\n" "$OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 printf "%s\n" "$ac_ct_OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 printf %s "checking for -single_module linker flag... " >&6; } if test ${lt_cv_apple_cc_single_mod+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 printf %s "checking for -exported_symbols_list linker flag... " >&6; } if test ${lt_cv_ld_exported_symbols_list+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_ld_exported_symbols_list=yes else $as_nop lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 printf %s "checking for -force_load linker flag... " >&6; } if test ${lt_cv_ld_force_load+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 $AR $AR_FLAGS libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) case $MACOSX_DEPLOYMENT_TARGET,$host in 10.[012],*|,*powerpc*-darwin[5-8]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes then : printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi # Set options # Check whether --enable-shared was given. if test ${enable_shared+y} then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_shared=yes fi # Check whether --enable-static was given. if test ${enable_static+y} then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_static=yes fi enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AS+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 printf "%s\n" "$AS" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AS+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 printf "%s\n" "$ac_ct_AS" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 printf "%s\n" "$DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 printf "%s\n" "$OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump enable_dlopen=no # Check whether --with-pic was given. if test ${with_pic+y} then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop pic_mode=default fi # Check whether --enable-fast-install was given. if test ${enable_fast_install+y} then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test ${with_aix_soname+y} then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else $as_nop if test ${lt_cv_with_aix_soname+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 printf %s "checking for objdir... " >&6; } if test ${lt_cv_objdir+y} then : printf %s "(cached) " >&6 else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC and # ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 printf %s "checking for ${ac_tool_prefix}file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 printf %s "checking for file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test ${lt_cv_prog_compiler_rtti_exceptions+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test ${lt_cv_prog_compiler_pic_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl* | icl*) # Native MSVC or ICC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC and ICC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly* | midnightbsd*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 printf %s "checking if $CC understands -b... " >&6; } if test ${lt_cv_prog_compiler__b+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if test ${lt_cv_irix_exported_symbol+y} then : printf %s "(cached) " >&6 else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_irix_exported_symbol=yes else $as_nop lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl* | *,icl*) # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes then : lt_cv_dlopen=shl_load else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char shl_load (); int main (void) { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes else $as_nop ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes then : lt_cv_dlopen=dlopen else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 printf %s "checking for dlopen in -lsvld... " >&6; } if test ${ac_cv_lib_svld_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_svld_dlopen=yes else $as_nop ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 printf %s "checking for dld_link in -ldld... " >&6; } if test ${ac_cv_lib_dld_dld_link+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dld_link (); int main (void) { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_dld_link=yes else $as_nop ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 printf %s "checking whether a program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 printf %s "checking whether a statically linked program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self_static+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 printf %s "checking whether stripping libraries is possible... " >&6; } if test -z "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } else if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else case $host_os in darwin*) # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; freebsd*) if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac fi fi # Report what library types will actually be built { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 printf %s "checking if libtool supports shared libraries... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 printf "%s\n" "$can_build_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 printf "%s\n" "$enable_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 printf "%s\n" "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: # Check whether --enable-largefile was given. if test ${enable_largefile+y} then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 printf %s "checking for special C compiler options needed for large files... " >&6; } if test ${ac_cv_sys_largefile_CC+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : break fi rm -f core conftest.err conftest.$ac_objext conftest.beam CC="$CC -n32" if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if test ${ac_cv_sys_file_offset_bits+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } if test ${ac_cv_sys_large_files+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 printf "%s\n" "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h ;; esac rm -rf conftest* fi fi # issue 2167 if test "$USE_MAINTAINER_MODE" = yes; then if test "$YACC" != "bison -y"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking bison version" >&5 printf %s "checking bison version... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not bison" >&5 printf "%s\n" "not bison" >&6; } else if test -n "$YACC" then : ax_bison_version="3" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bison version" >&5 printf %s "checking for bison version... " >&6; } bison_version=`$YACC --version 2>&1 \ | $GREP bison \ | $SED -e 's/^[^0-9]*//' -e 's/[^0-9]*$//'` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bison_version" >&5 printf "%s\n" "$bison_version" >&6; } BISON_VERSION=$bison_version # Used to indicate true or false condition ax_compare_version=false # Convert the two version strings to be compared into a format that # allows a simple string comparison. The end result is that a version # string of the form 1.12.5-r617 will be converted to the form # 0001001200050617. In other words, each number is zero padded to four # digits, and non digits are removed. ax_compare_version_A=`echo "$ax_bison_version" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/[^0-9]//g'` ax_compare_version_B=`echo "$bison_version" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/[^0-9]//g'` ax_compare_version=`echo "x$ax_compare_version_A x$ax_compare_version_B" | sed 's/^ *//' | sort | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` if test "$ax_compare_version" = "true" ; then : else : as_fn_error $? "You need bison version 3.0 or greater" "$LINENO" 5 fi else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: could not find bison" >&5 printf "%s\n" "$as_me: WARNING: could not find bison" >&2;} as_fn_error $? "You need bison version 3.0 or greater" "$LINENO" 5 fi fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LEX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 printf "%s\n" "$LEX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$LEX" && break done fi ac_fn_c_check_func "$LINENO" "memmem" "ac_cv_func_memmem" if test "x$ac_cv_func_memmem" = xyes then : printf "%s\n" "#define HAVE_MEMMEM 1" >>confdefs.h fi as_ac_Header=`printf "%s\n" "ac_cv_header_"sys/cygwin.h"" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" ""sys/cygwin.h"" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes" then : have_cygwin=1; fi as_ac_Header=`printf "%s\n" "ac_cv_header_"shlwapi.h"" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" ""shlwapi.h"" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes" then : have_shlwapi=1; fi if test "x$have_shlwapi" = x1 && test ! "x$have_cygwin" = x1; then WIN32_TRUE= WIN32_FALSE='#' else WIN32_TRUE='#' WIN32_FALSE= fi # Check whether --enable-valgrind was given. if test ${enable_valgrind+y} then : enableval=$enable_valgrind; fi # Check whether --enable-asan was given. if test ${enable_asan+y} then : enableval=$enable_asan; fi # Check whether --enable-ubsan was given. if test ${enable_ubsan+y} then : enableval=$enable_ubsan; fi # Check whether --enable-gcov was given. if test ${enable_gcov+y} then : enableval=$enable_gcov; fi # Check whether --enable-docs was given. if test ${enable_docs+y} then : enableval=$enable_docs; else $as_nop enable_docs=yes fi # Check whether --enable-error-injection was given. if test ${enable_error_injection+y} then : enableval=$enable_error_injection; fi # Check whether --enable-all-static was given. if test ${enable_all_static+y} then : enableval=$enable_all_static; fi for ac_prog in pipenv do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_PIPENV+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$PIPENV"; then ac_cv_prog_PIPENV="$PIPENV" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_PIPENV="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PIPENV=$ac_cv_prog_PIPENV if test -n "$PIPENV"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PIPENV" >&5 printf "%s\n" "$PIPENV" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$PIPENV" && break done if test "x$enable_docs" != "xno" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Python dependencies" >&5 printf %s "checking for Python dependencies... " >&6; } if test ${jq_cv_python_deps+y} then : printf %s "(cached) " >&6 else $as_nop jq_cv_python_deps=yes if test "x$PIPENV" = "x" || \ ! bmsg="`cd ${srcdir}/docs; LC_ALL=$LANG "$PIPENV" --venv`" then : jq_cv_python_deps=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $jq_cv_python_deps" >&5 printf "%s\n" "$jq_cv_python_deps" >&6; } if test "x$jq_cv_python_deps" != "xyes" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Error checking python dependencies: $bmsg ***************************************************************** * Python dependencies for building jq documentation not found. * * You can still build, install and hack on jq, but the manpage * * will not be rebuilt and new manpage tests will not be run. * * See docs/README.md for how to install the docs dependencies. * *****************************************************************" >&5 printf "%s\n" "$as_me: WARNING: Error checking python dependencies: $bmsg ***************************************************************** * Python dependencies for building jq documentation not found. * * You can still build, install and hack on jq, but the manpage * * will not be rebuilt and new manpage tests will not be run. * * See docs/README.md for how to install the docs dependencies. * *****************************************************************" >&2;} enable_docs=no fi fi # Check whether --enable-decnum was given. if test ${enable_decnum+y} then : enableval=$enable_decnum; fi if test "x$enable_decnum" != "xno" then : printf "%s\n" "#define USE_DECNUM 1" >>confdefs.h fi if test "x$enable_valgrind" = xyes; then ENABLE_VALGRIND_TRUE= ENABLE_VALGRIND_FALSE='#' else ENABLE_VALGRIND_TRUE='#' ENABLE_VALGRIND_FALSE= fi if test "x$enable_asan" = xyes; then ENABLE_ASAN_TRUE= ENABLE_ASAN_FALSE='#' else ENABLE_ASAN_TRUE='#' ENABLE_ASAN_FALSE= fi if test "x$enable_ubsan" = xyes; then ENABLE_UBSAN_TRUE= ENABLE_UBSAN_FALSE='#' else ENABLE_UBSAN_TRUE='#' ENABLE_UBSAN_FALSE= fi if test "x$enable_gcov" = xyes; then ENABLE_GCOV_TRUE= ENABLE_GCOV_FALSE='#' else ENABLE_GCOV_TRUE='#' ENABLE_GCOV_FALSE= fi if test "x$enable_docs" != xno; then ENABLE_DOCS_TRUE= ENABLE_DOCS_FALSE='#' else ENABLE_DOCS_TRUE='#' ENABLE_DOCS_FALSE= fi if test "x$enable_error_injection" = xyes; then ENABLE_ERROR_INJECTION_TRUE= ENABLE_ERROR_INJECTION_FALSE='#' else ENABLE_ERROR_INJECTION_TRUE='#' ENABLE_ERROR_INJECTION_FALSE= fi if test "x$enable_all_static" = xyes; then ENABLE_ALL_STATIC_TRUE= ENABLE_ALL_STATIC_FALSE='#' else ENABLE_ALL_STATIC_TRUE='#' ENABLE_ALL_STATIC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on Tru64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then ax_pthread_save_CC="$CC" ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" if test "x$PTHREAD_CC" != "x" then : CC="$PTHREAD_CC" fi if test "x$PTHREAD_CXX" != "x" then : CXX="$PTHREAD_CXX" fi CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 printf %s "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pthread_join (); int main (void) { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 printf "%s\n" "$ax_pthread_ok" >&6; } if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi CC="$ax_pthread_save_CC" CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items with a "," contain both # C compiler flags (before ",") and linker flags (after ","). Other items # starting with a "-" are C compiler flags, and remaining items are # library names, except for "none" which indicates that we try without # any flags at all, and "pthread-config" which is a program returning # the flags for the Pth emulation library. ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 # (Note: HP C rejects this with "bad form for `-t' option") # -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads and # -D_REENTRANT too), HP C (must be checked before -lpthread, which # is present but should not be used directly; and before -mthreads, # because the compiler interprets this as "-mt" + "-hreads") # -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case $host_os in freebsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) ax_pthread_flags="-kthread lthread $ax_pthread_flags" ;; hpux*) # From the cc(1) man page: "[-mt] Sets various -D flags to enable # multi-threading and also sets -lpthread." ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" ;; openedition*) # IBM z/OS requires a feature-test macro to be defined in order to # enable POSIX threads at all, so give the user a hint if this is # not set. (We don't define these ourselves, as they can affect # other portions of the system API in unpredictable ways.) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) AX_PTHREAD_ZOS_MISSING # endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1 then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 printf "%s\n" "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} fi rm -rf conftest* ;; solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (N.B.: The stubs are missing # pthread_cleanup_push, or rather a function called by this macro, # so we could check for that, but who knows whether they'll stub # that too in a future libc.) So we'll check first for the # standard Solaris way of linking pthreads (-mt -lpthread). ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" ;; esac # Are we compiling with Clang? { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 printf %s "checking whether $CC is Clang... " >&6; } if test ${ax_cv_PTHREAD_CLANG+y} then : printf %s "(cached) " >&6 else $as_nop ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Note: Clang 2.7 lacks __clang_[a-z]+__ */ # if defined(__clang__) && defined(__llvm__) AX_PTHREAD_CC_IS_CLANG # endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1 then : ax_cv_PTHREAD_CLANG=yes fi rm -rf conftest* fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 printf "%s\n" "$ax_cv_PTHREAD_CLANG" >&6; } ax_pthread_clang="$ax_cv_PTHREAD_CLANG" # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) # Note that for GCC and Clang -pthread generally implies -lpthread, # except when -nostdlib is passed. # This is problematic using libtool to build C++ shared libraries with pthread: # [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 # [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 # [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 # To solve this, first try -pthread together with -lpthread for GCC if test "x$GCC" = "xyes" then : ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags" fi # Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first if test "x$ax_pthread_clang" = "xyes" then : ax_pthread_flags="-pthread,-lpthread -pthread" fi # The presence of a feature test macro requesting re-entrant function # definitions is, on some systems, a strong hint that pthreads support is # correctly enabled case $host_os in darwin* | hpux* | linux* | osf* | solaris*) ax_pthread_check_macro="_REENTRANT" ;; aix*) ax_pthread_check_macro="_THREAD_SAFE" ;; *) ax_pthread_check_macro="--" ;; esac if test "x$ax_pthread_check_macro" = "x--" then : ax_pthread_check_cond=0 else $as_nop ax_pthread_check_cond="!defined($ax_pthread_check_macro)" fi if test "x$ax_pthread_ok" = "xno"; then for ax_pthread_try_flag in $ax_pthread_flags; do case $ax_pthread_try_flag in none) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 printf %s "checking whether pthreads work without any flags... " >&6; } ;; *,*) PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"" >&5 printf %s "checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"... " >&6; } ;; -*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 printf %s "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ax_pthread_config+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ax_pthread_config"; then ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ax_pthread_config="yes" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" fi fi ax_pthread_config=$ac_cv_prog_ax_pthread_config if test -n "$ax_pthread_config"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 printf "%s\n" "$ax_pthread_config" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ax_pthread_config" = "xno" then : continue fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 printf %s "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include # if $ax_pthread_check_cond # error "$ax_pthread_check_macro must be defined" # endif static void *some_global = NULL; static void routine(void *a) { /* To avoid any unused-parameter or unused-but-set-parameter warning. */ some_global = a; } static void *start_routine(void *a) { return a; } int main (void) { pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 printf "%s\n" "$ax_pthread_ok" >&6; } if test "x$ax_pthread_ok" = "xyes" then : break fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Clang needs special handling, because older versions handle the -pthread # option in a rather... idiosyncratic way if test "x$ax_pthread_clang" = "xyes"; then # Clang takes -pthread; it has never supported any other flag # (Note 1: This will need to be revisited if a system that Clang # supports has POSIX threads in a separate library. This tends not # to be the way of modern systems, but it's conceivable.) # (Note 2: On some systems, notably Darwin, -pthread is not needed # to get POSIX threads support; the API is always present and # active. We could reasonably leave PTHREAD_CFLAGS empty. But # -pthread does define _REENTRANT, and while the Darwin headers # ignore this macro, third-party headers might not.) # However, older versions of Clang make a point of warning the user # that, in an invocation where only linking and no compilation is # taking place, the -pthread option has no effect ("argument unused # during compilation"). They expect -pthread to be passed in only # when source code is being compiled. # # Problem is, this is at odds with the way Automake and most other # C build frameworks function, which is that the same flags used in # compilation (CFLAGS) are also used in linking. Many systems # supported by AX_PTHREAD require exactly this for POSIX threads # support, and in fact it is often not straightforward to specify a # flag that is used only in the compilation phase and not in # linking. Such a scenario is extremely rare in practice. # # Even though use of the -pthread flag in linking would only print # a warning, this can be a nuisance for well-run software projects # that build with -Werror. So if the active version of Clang has # this misfeature, we search for an option to squash it. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 printf %s "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } if test ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+y} then : printf %s "(cached) " >&6 else $as_nop ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second # step ax_pthread_save_ac_link="$ac_link" ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' ax_pthread_link_step=`printf "%s\n" "$ac_link" | sed "$ax_pthread_sed"` ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ax_pthread_save_CFLAGS="$CFLAGS" for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do if test "x$ax_pthread_try" = "xunknown" then : break fi CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" ac_link="$ax_pthread_save_ac_link" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main(void){return 0;} _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_link="$ax_pthread_2step_ac_link" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main(void){return 0;} _ACEOF if ac_fn_c_try_link "$LINENO" then : break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done ac_link="$ax_pthread_save_ac_link" CFLAGS="$ax_pthread_save_CFLAGS" if test "x$ax_pthread_try" = "x" then : ax_pthread_try=no fi ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 printf "%s\n" "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in no | unknown) ;; *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; esac fi # $ax_pthread_clang = yes # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 printf %s "checking for joinable pthread attribute... " >&6; } if test ${ax_cv_PTHREAD_JOINABLE_ATTR+y} then : printf %s "(cached) " >&6 else $as_nop ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { int attr = $ax_pthread_attr; return attr /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 printf "%s\n" "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ test "x$ax_pthread_joinable_attr_defined" != "xyes" then : printf "%s\n" "#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR" >>confdefs.h ax_pthread_joinable_attr_defined=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 printf %s "checking whether more special flags are required for pthreads... " >&6; } if test ${ax_cv_PTHREAD_SPECIAL_FLAGS+y} then : printf %s "(cached) " >&6 else $as_nop ax_cv_PTHREAD_SPECIAL_FLAGS=no case $host_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 printf "%s\n" "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ test "x$ax_pthread_special_flags_added" != "xyes" then : PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" ax_pthread_special_flags_added=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 printf %s "checking for PTHREAD_PRIO_INHERIT... " >&6; } if test ${ax_cv_PTHREAD_PRIO_INHERIT+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { int i = PTHREAD_PRIO_INHERIT; return i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ax_cv_PTHREAD_PRIO_INHERIT=yes else $as_nop ax_cv_PTHREAD_PRIO_INHERIT=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 printf "%s\n" "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ test "x$ax_pthread_prio_inherit_defined" != "xyes" then : printf "%s\n" "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h ax_pthread_prio_inherit_defined=yes fi CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant if test "x$GCC" != "xyes"; then case $host_os in aix*) case "x/$CC" in #( x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : #handle absolute path differently from PATH based program lookup case "x$CC" in #( x/*) : if as_fn_executable_p ${CC}_r then : PTHREAD_CC="${CC}_r" fi if test "x${CXX}" != "x" then : if as_fn_executable_p ${CXX}_r then : PTHREAD_CXX="${CXX}_r" fi fi ;; #( *) : for ac_prog in ${CC}_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_PTHREAD_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 printf "%s\n" "$PTHREAD_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" if test "x${CXX}" != "x" then : for ac_prog in ${CXX}_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_PTHREAD_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$PTHREAD_CXX"; then ac_cv_prog_PTHREAD_CXX="$PTHREAD_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CXX="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CXX=$ac_cv_prog_PTHREAD_CXX if test -n "$PTHREAD_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CXX" >&5 printf "%s\n" "$PTHREAD_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$PTHREAD_CXX" && break done test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" fi ;; esac ;; #( *) : ;; esac ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then printf "%s\n" "#define HAVE_PTHREAD 1" >>confdefs.h LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" : else ax_pthread_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 printf %s "checking for working alloca.h... " >&6; } if test ${ac_cv_working_alloca_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_working_alloca_h=yes else $as_nop ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 printf "%s\n" "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 printf %s "checking for alloca... " >&6; } if test ${ac_cv_func_alloca_works+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_working_alloca_h = yes; then ac_cv_func_alloca_works=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef alloca # ifdef __GNUC__ # define alloca __builtin_alloca # elif defined _MSC_VER # include # define alloca _alloca # else # ifdef __cplusplus extern "C" # endif void *alloca (size_t); # endif #endif int main (void) { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_func_alloca_works=yes else $as_nop ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 printf "%s\n" "$ac_cv_func_alloca_works" >&6; } fi if test $ac_cv_func_alloca_works = yes; then printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 printf %s "checking stack direction for C alloca... " >&6; } if test ${ac_cv_c_stack_direction+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_c_stack_direction=0 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_stack_direction=1 else $as_nop ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 printf "%s\n" "$ac_cv_c_stack_direction" >&6; } printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for isatty" >&5 printf %s "checking for isatty... " >&6; } if test ${ac_cv_funclib_isatty+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_isatty\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { isatty(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_isatty=$ac_lib; else ac_cv_funclib_isatty=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_isatty=\${ac_cv_funclib_isatty-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_isatty" if false; then ac_fn_c_check_func "$LINENO" "isatty" "ac_cv_func_isatty" if test "x$ac_cv_func_isatty" = xyes then : printf "%s\n" "#define HAVE_ISATTY 1" >>confdefs.h fi fi # isatty eval "ac_tr_func=HAVE_`echo isatty | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_isatty=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_isatty=yes" eval "LIB_isatty=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_isatty=no" eval "LIB_isatty=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_isatty=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_isatty"; then LIBS="$LIB_isatty $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _isatty" >&5 printf %s "checking for _isatty... " >&6; } if test ${ac_cv_funclib__isatty+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func__isatty\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { _isatty(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib__isatty=$ac_lib; else ac_cv_funclib__isatty=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib__isatty=\${ac_cv_funclib__isatty-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib__isatty" if false; then ac_fn_c_check_func "$LINENO" "_isatty" "ac_cv_func__isatty" if test "x$ac_cv_func__isatty" = xyes then : printf "%s\n" "#define HAVE__ISATTY 1" >>confdefs.h fi fi # _isatty eval "ac_tr_func=HAVE_`echo _isatty | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB__isatty=$ac_res" case "$ac_res" in yes) eval "ac_cv_func__isatty=yes" eval "LIB__isatty=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func__isatty=no" eval "LIB__isatty=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func__isatty=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB__isatty"; then LIBS="$LIB__isatty $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strptime" >&5 printf %s "checking for strptime... " >&6; } if test ${ac_cv_funclib_strptime+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_strptime\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { strptime(0, 0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_strptime=$ac_lib; else ac_cv_funclib_strptime=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_strptime=\${ac_cv_funclib_strptime-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_strptime" if false; then ac_fn_c_check_func "$LINENO" "strptime" "ac_cv_func_strptime" if test "x$ac_cv_func_strptime" = xyes then : printf "%s\n" "#define HAVE_STRPTIME 1" >>confdefs.h fi fi # strptime eval "ac_tr_func=HAVE_`echo strptime | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_strptime=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_strptime=yes" eval "LIB_strptime=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_strptime=no" eval "LIB_strptime=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_strptime=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_strptime"; then LIBS="$LIB_strptime $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strftime" >&5 printf %s "checking for strftime... " >&6; } if test ${ac_cv_funclib_strftime+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_strftime\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { strftime(0, 0, 0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_strftime=$ac_lib; else ac_cv_funclib_strftime=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_strftime=\${ac_cv_funclib_strftime-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_strftime" if false; then ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes then : printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h fi fi # strftime eval "ac_tr_func=HAVE_`echo strftime | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_strftime=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_strftime=yes" eval "LIB_strftime=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_strftime=no" eval "LIB_strftime=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_strftime=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_strftime"; then LIBS="$LIB_strftime $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for setenv" >&5 printf %s "checking for setenv... " >&6; } if test ${ac_cv_funclib_setenv+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_setenv\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { setenv(0, 0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_setenv=$ac_lib; else ac_cv_funclib_setenv=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_setenv=\${ac_cv_funclib_setenv-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_setenv" if false; then ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv" if test "x$ac_cv_func_setenv" = xyes then : printf "%s\n" "#define HAVE_SETENV 1" >>confdefs.h fi fi # setenv eval "ac_tr_func=HAVE_`echo setenv | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_setenv=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_setenv=yes" eval "LIB_setenv=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_setenv=no" eval "LIB_setenv=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_setenv=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_setenv"; then LIBS="$LIB_setenv $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for timegm" >&5 printf %s "checking for timegm... " >&6; } if test ${ac_cv_funclib_timegm+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_timegm\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { timegm(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_timegm=$ac_lib; else ac_cv_funclib_timegm=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_timegm=\${ac_cv_funclib_timegm-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_timegm" if false; then ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" if test "x$ac_cv_func_timegm" = xyes then : printf "%s\n" "#define HAVE_TIMEGM 1" >>confdefs.h fi fi # timegm eval "ac_tr_func=HAVE_`echo timegm | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_timegm=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_timegm=yes" eval "LIB_timegm=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_timegm=no" eval "LIB_timegm=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_timegm=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_timegm"; then LIBS="$LIB_timegm $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gmtime_r" >&5 printf %s "checking for gmtime_r... " >&6; } if test ${ac_cv_funclib_gmtime_r+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_gmtime_r\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { gmtime_r(0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_gmtime_r=$ac_lib; else ac_cv_funclib_gmtime_r=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_gmtime_r=\${ac_cv_funclib_gmtime_r-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_gmtime_r" if false; then ac_fn_c_check_func "$LINENO" "gmtime_r" "ac_cv_func_gmtime_r" if test "x$ac_cv_func_gmtime_r" = xyes then : printf "%s\n" "#define HAVE_GMTIME_R 1" >>confdefs.h fi fi # gmtime_r eval "ac_tr_func=HAVE_`echo gmtime_r | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_gmtime_r=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_gmtime_r=yes" eval "LIB_gmtime_r=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_gmtime_r=no" eval "LIB_gmtime_r=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_gmtime_r=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_gmtime_r"; then LIBS="$LIB_gmtime_r $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gmtime" >&5 printf %s "checking for gmtime... " >&6; } if test ${ac_cv_funclib_gmtime+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_gmtime\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { gmtime(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_gmtime=$ac_lib; else ac_cv_funclib_gmtime=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_gmtime=\${ac_cv_funclib_gmtime-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_gmtime" if false; then ac_fn_c_check_func "$LINENO" "gmtime" "ac_cv_func_gmtime" if test "x$ac_cv_func_gmtime" = xyes then : printf "%s\n" "#define HAVE_GMTIME 1" >>confdefs.h fi fi # gmtime eval "ac_tr_func=HAVE_`echo gmtime | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_gmtime=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_gmtime=yes" eval "LIB_gmtime=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_gmtime=no" eval "LIB_gmtime=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_gmtime=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_gmtime"; then LIBS="$LIB_gmtime $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for localtime_r" >&5 printf %s "checking for localtime_r... " >&6; } if test ${ac_cv_funclib_localtime_r+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_localtime_r\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { localtime_r(0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_localtime_r=$ac_lib; else ac_cv_funclib_localtime_r=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_localtime_r=\${ac_cv_funclib_localtime_r-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_localtime_r" if false; then ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r" if test "x$ac_cv_func_localtime_r" = xyes then : printf "%s\n" "#define HAVE_LOCALTIME_R 1" >>confdefs.h fi fi # localtime_r eval "ac_tr_func=HAVE_`echo localtime_r | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_localtime_r=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_localtime_r=yes" eval "LIB_localtime_r=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_localtime_r=no" eval "LIB_localtime_r=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_localtime_r=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_localtime_r"; then LIBS="$LIB_localtime_r $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for localtime" >&5 printf %s "checking for localtime... " >&6; } if test ${ac_cv_funclib_localtime+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_localtime\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { localtime(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_localtime=$ac_lib; else ac_cv_funclib_localtime=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_localtime=\${ac_cv_funclib_localtime-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_localtime" if false; then ac_fn_c_check_func "$LINENO" "localtime" "ac_cv_func_localtime" if test "x$ac_cv_func_localtime" = xyes then : printf "%s\n" "#define HAVE_LOCALTIME 1" >>confdefs.h fi fi # localtime eval "ac_tr_func=HAVE_`echo localtime | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_localtime=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_localtime=yes" eval "LIB_localtime=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_localtime=no" eval "LIB_localtime=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_localtime=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_localtime"; then LIBS="$LIB_localtime $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gettimeofday" >&5 printf %s "checking for gettimeofday... " >&6; } if test ${ac_cv_funclib_gettimeofday+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_gettimeofday\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { gettimeofday(0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_gettimeofday=$ac_lib; else ac_cv_funclib_gettimeofday=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_gettimeofday=\${ac_cv_funclib_gettimeofday-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_gettimeofday" if false; then ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" if test "x$ac_cv_func_gettimeofday" = xyes then : printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h fi fi # gettimeofday eval "ac_tr_func=HAVE_`echo gettimeofday | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_gettimeofday=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_gettimeofday=yes" eval "LIB_gettimeofday=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_gettimeofday=no" eval "LIB_gettimeofday=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_gettimeofday=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_gettimeofday"; then LIBS="$LIB_gettimeofday $LIBS" fi ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include " if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes then : printf "%s\n" "#define HAVE_TM_TM_GMT_OFF 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tm" "__tm_gmtoff" "ac_cv_member_struct_tm___tm_gmtoff" "#include " if test "x$ac_cv_member_struct_tm___tm_gmtoff" = xyes then : printf "%s\n" "#define HAVE_TM___TM_GMT_OFF 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for setlocale" >&5 printf %s "checking for setlocale... " >&6; } if test ${ac_cv_funclib_setlocale+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_setlocale\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { setlocale(0,0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_setlocale=$ac_lib; else ac_cv_funclib_setlocale=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_setlocale=\${ac_cv_funclib_setlocale-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_setlocale" if false; then ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" if test "x$ac_cv_func_setlocale" = xyes then : printf "%s\n" "#define HAVE_SETLOCALE 1" >>confdefs.h fi fi # setlocale eval "ac_tr_func=HAVE_`echo setlocale | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_setlocale=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_setlocale=yes" eval "LIB_setlocale=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_setlocale=no" eval "LIB_setlocale=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_setlocale=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_setlocale"; then LIBS="$LIB_setlocale $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for arc4random" >&5 printf %s "checking for arc4random... " >&6; } if test ${ac_cv_funclib_arc4random+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_arc4random\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { arc4random() ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_arc4random=$ac_lib; else ac_cv_funclib_arc4random=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_arc4random=\${ac_cv_funclib_arc4random-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_arc4random" if false; then ac_fn_c_check_func "$LINENO" "arc4random" "ac_cv_func_arc4random" if test "x$ac_cv_func_arc4random" = xyes then : printf "%s\n" "#define HAVE_ARC4RANDOM 1" >>confdefs.h fi fi # arc4random eval "ac_tr_func=HAVE_`echo arc4random | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_arc4random=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_arc4random=yes" eval "LIB_arc4random=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_arc4random=no" eval "LIB_arc4random=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_arc4random=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_arc4random"; then LIBS="$LIB_arc4random $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for getentropy" >&5 printf %s "checking for getentropy... " >&6; } if test ${ac_cv_funclib_getentropy+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_getentropy\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" c; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { getentropy(0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_getentropy=$ac_lib; else ac_cv_funclib_getentropy=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_getentropy=\${ac_cv_funclib_getentropy-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_getentropy" if false; then ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy" if test "x$ac_cv_func_getentropy" = xyes then : printf "%s\n" "#define HAVE_GETENTROPY 1" >>confdefs.h fi fi # getentropy eval "ac_tr_func=HAVE_`echo getentropy | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_getentropy=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_getentropy=yes" eval "LIB_getentropy=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_getentropy=no" eval "LIB_getentropy=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_getentropy=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac if test -n "$LIB_getentropy"; then LIBS="$LIB_getentropy $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_key_create" >&5 printf %s "checking for pthread_key_create... " >&6; } if test ${ac_cv_funclib_pthread_key_create+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_pthread_key_create\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" ; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { pthread_key_create(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_pthread_key_create=$ac_lib; else ac_cv_funclib_pthread_key_create=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_pthread_key_create=\${ac_cv_funclib_pthread_key_create-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_pthread_key_create" if false; then ac_fn_c_check_func "$LINENO" "pthread_key_create" "ac_cv_func_pthread_key_create" if test "x$ac_cv_func_pthread_key_create" = xyes then : printf "%s\n" "#define HAVE_PTHREAD_KEY_CREATE 1" >>confdefs.h fi fi # pthread_key_create eval "ac_tr_func=HAVE_`echo pthread_key_create | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_pthread_key_create=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_pthread_key_create=yes" eval "LIB_pthread_key_create=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_pthread_key_create=no" eval "LIB_pthread_key_create=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_pthread_key_create=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_once" >&5 printf %s "checking for pthread_once... " >&6; } if test ${ac_cv_funclib_pthread_once+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_pthread_once\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" ; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { pthread_once(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_pthread_once=$ac_lib; else ac_cv_funclib_pthread_once=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_pthread_once=\${ac_cv_funclib_pthread_once-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_pthread_once" if false; then ac_fn_c_check_func "$LINENO" "pthread_once" "ac_cv_func_pthread_once" if test "x$ac_cv_func_pthread_once" = xyes then : printf "%s\n" "#define HAVE_PTHREAD_ONCE 1" >>confdefs.h fi fi # pthread_once eval "ac_tr_func=HAVE_`echo pthread_once | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_pthread_once=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_pthread_once=yes" eval "LIB_pthread_once=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_pthread_once=no" eval "LIB_pthread_once=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_pthread_once=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atexit" >&5 printf %s "checking for atexit... " >&6; } if test ${ac_cv_funclib_atexit+y} then : printf %s "(cached) " >&6 else $as_nop if eval "test \"\$ac_cv_func_atexit\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in "" ; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS=" $ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { atexit(NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "if test -n \"$ac_lib\";then ac_cv_funclib_atexit=$ac_lib; else ac_cv_funclib_atexit=yes; fi";break fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done eval "ac_cv_funclib_atexit=\${ac_cv_funclib_atexit-no}" LIBS="$ac_save_LIBS" fi fi eval "ac_res=\$ac_cv_funclib_atexit" if false; then ac_fn_c_check_func "$LINENO" "atexit" "ac_cv_func_atexit" if test "x$ac_cv_func_atexit" = xyes then : printf "%s\n" "#define HAVE_ATEXIT 1" >>confdefs.h fi fi # atexit eval "ac_tr_func=HAVE_`echo atexit | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`" eval "LIB_atexit=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_atexit=yes" eval "LIB_atexit=" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; no) eval "ac_cv_func_atexit=no" eval "LIB_atexit=" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; *) eval "ac_cv_func_atexit=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" printf "%s\n" "#define $ac_tr_func 1" >>confdefs.h printf "%s\n" "#define $ac_tr_lib 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes, in $ac_res" >&5 printf "%s\n" "yes, in $ac_res" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for acos in -lm" >&5 printf %s "checking for acos in -lm... " >&6; } if test ${ac_cv_lib_m_acos+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char acos (); int main (void) { return acos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_acos=yes else $as_nop ac_cv_lib_m_acos=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_acos" >&5 printf "%s\n" "$ac_cv_lib_m_acos" >&6; } if test "x$ac_cv_lib_m_acos" = xyes then : printf "%s\n" "#define HAVE_ACOS 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for acosh in -lm" >&5 printf %s "checking for acosh in -lm... " >&6; } if test ${ac_cv_lib_m_acosh+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char acosh (); int main (void) { return acosh (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_acosh=yes else $as_nop ac_cv_lib_m_acosh=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_acosh" >&5 printf "%s\n" "$ac_cv_lib_m_acosh" >&6; } if test "x$ac_cv_lib_m_acosh" = xyes then : printf "%s\n" "#define HAVE_ACOSH 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for asin in -lm" >&5 printf %s "checking for asin in -lm... " >&6; } if test ${ac_cv_lib_m_asin+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char asin (); int main (void) { return asin (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_asin=yes else $as_nop ac_cv_lib_m_asin=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_asin" >&5 printf "%s\n" "$ac_cv_lib_m_asin" >&6; } if test "x$ac_cv_lib_m_asin" = xyes then : printf "%s\n" "#define HAVE_ASIN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for asinh in -lm" >&5 printf %s "checking for asinh in -lm... " >&6; } if test ${ac_cv_lib_m_asinh+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char asinh (); int main (void) { return asinh (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_asinh=yes else $as_nop ac_cv_lib_m_asinh=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_asinh" >&5 printf "%s\n" "$ac_cv_lib_m_asinh" >&6; } if test "x$ac_cv_lib_m_asinh" = xyes then : printf "%s\n" "#define HAVE_ASINH 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atan2 in -lm" >&5 printf %s "checking for atan2 in -lm... " >&6; } if test ${ac_cv_lib_m_atan2+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char atan2 (); int main (void) { return atan2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_atan2=yes else $as_nop ac_cv_lib_m_atan2=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_atan2" >&5 printf "%s\n" "$ac_cv_lib_m_atan2" >&6; } if test "x$ac_cv_lib_m_atan2" = xyes then : printf "%s\n" "#define HAVE_ATAN2 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atan in -lm" >&5 printf %s "checking for atan in -lm... " >&6; } if test ${ac_cv_lib_m_atan+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char atan (); int main (void) { return atan (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_atan=yes else $as_nop ac_cv_lib_m_atan=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_atan" >&5 printf "%s\n" "$ac_cv_lib_m_atan" >&6; } if test "x$ac_cv_lib_m_atan" = xyes then : printf "%s\n" "#define HAVE_ATAN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atanh in -lm" >&5 printf %s "checking for atanh in -lm... " >&6; } if test ${ac_cv_lib_m_atanh+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char atanh (); int main (void) { return atanh (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_atanh=yes else $as_nop ac_cv_lib_m_atanh=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_atanh" >&5 printf "%s\n" "$ac_cv_lib_m_atanh" >&6; } if test "x$ac_cv_lib_m_atanh" = xyes then : printf "%s\n" "#define HAVE_ATANH 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cbrt in -lm" >&5 printf %s "checking for cbrt in -lm... " >&6; } if test ${ac_cv_lib_m_cbrt+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char cbrt (); int main (void) { return cbrt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_cbrt=yes else $as_nop ac_cv_lib_m_cbrt=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cbrt" >&5 printf "%s\n" "$ac_cv_lib_m_cbrt" >&6; } if test "x$ac_cv_lib_m_cbrt" = xyes then : printf "%s\n" "#define HAVE_CBRT 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ceil in -lm" >&5 printf %s "checking for ceil in -lm... " >&6; } if test ${ac_cv_lib_m_ceil+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char ceil (); int main (void) { return ceil (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_ceil=yes else $as_nop ac_cv_lib_m_ceil=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_ceil" >&5 printf "%s\n" "$ac_cv_lib_m_ceil" >&6; } if test "x$ac_cv_lib_m_ceil" = xyes then : printf "%s\n" "#define HAVE_CEIL 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for copysign in -lm" >&5 printf %s "checking for copysign in -lm... " >&6; } if test ${ac_cv_lib_m_copysign+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char copysign (); int main (void) { return copysign (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_copysign=yes else $as_nop ac_cv_lib_m_copysign=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_copysign" >&5 printf "%s\n" "$ac_cv_lib_m_copysign" >&6; } if test "x$ac_cv_lib_m_copysign" = xyes then : printf "%s\n" "#define HAVE_COPYSIGN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 printf %s "checking for cos in -lm... " >&6; } if test ${ac_cv_lib_m_cos+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char cos (); int main (void) { return cos (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_cos=yes else $as_nop ac_cv_lib_m_cos=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 printf "%s\n" "$ac_cv_lib_m_cos" >&6; } if test "x$ac_cv_lib_m_cos" = xyes then : printf "%s\n" "#define HAVE_COS 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cosh in -lm" >&5 printf %s "checking for cosh in -lm... " >&6; } if test ${ac_cv_lib_m_cosh+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char cosh (); int main (void) { return cosh (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_cosh=yes else $as_nop ac_cv_lib_m_cosh=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cosh" >&5 printf "%s\n" "$ac_cv_lib_m_cosh" >&6; } if test "x$ac_cv_lib_m_cosh" = xyes then : printf "%s\n" "#define HAVE_COSH 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for drem in -lm" >&5 printf %s "checking for drem in -lm... " >&6; } if test ${ac_cv_lib_m_drem+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char drem (); int main (void) { return drem (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_drem=yes else $as_nop ac_cv_lib_m_drem=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_drem" >&5 printf "%s\n" "$ac_cv_lib_m_drem" >&6; } if test "x$ac_cv_lib_m_drem" = xyes then : printf "%s\n" "#define HAVE_DREM 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for erf in -lm" >&5 printf %s "checking for erf in -lm... " >&6; } if test ${ac_cv_lib_m_erf+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char erf (); int main (void) { return erf (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_erf=yes else $as_nop ac_cv_lib_m_erf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_erf" >&5 printf "%s\n" "$ac_cv_lib_m_erf" >&6; } if test "x$ac_cv_lib_m_erf" = xyes then : printf "%s\n" "#define HAVE_ERF 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for erfc in -lm" >&5 printf %s "checking for erfc in -lm... " >&6; } if test ${ac_cv_lib_m_erfc+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char erfc (); int main (void) { return erfc (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_erfc=yes else $as_nop ac_cv_lib_m_erfc=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_erfc" >&5 printf "%s\n" "$ac_cv_lib_m_erfc" >&6; } if test "x$ac_cv_lib_m_erfc" = xyes then : printf "%s\n" "#define HAVE_ERFC 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for exp10 in -lm" >&5 printf %s "checking for exp10 in -lm... " >&6; } if test ${ac_cv_lib_m_exp10+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char exp10 (); int main (void) { return exp10 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_exp10=yes else $as_nop ac_cv_lib_m_exp10=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_exp10" >&5 printf "%s\n" "$ac_cv_lib_m_exp10" >&6; } if test "x$ac_cv_lib_m_exp10" = xyes then : printf "%s\n" "#define HAVE_EXP10 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __exp10 in -lm" >&5 printf %s "checking for __exp10 in -lm... " >&6; } if test ${ac_cv_lib_m___exp10+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char __exp10 (); int main (void) { return __exp10 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m___exp10=yes else $as_nop ac_cv_lib_m___exp10=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m___exp10" >&5 printf "%s\n" "$ac_cv_lib_m___exp10" >&6; } if test "x$ac_cv_lib_m___exp10" = xyes then : printf "%s\n" "#define HAVE___EXP10 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for exp2 in -lm" >&5 printf %s "checking for exp2 in -lm... " >&6; } if test ${ac_cv_lib_m_exp2+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char exp2 (); int main (void) { return exp2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_exp2=yes else $as_nop ac_cv_lib_m_exp2=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_exp2" >&5 printf "%s\n" "$ac_cv_lib_m_exp2" >&6; } if test "x$ac_cv_lib_m_exp2" = xyes then : printf "%s\n" "#define HAVE_EXP2 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for exp in -lm" >&5 printf %s "checking for exp in -lm... " >&6; } if test ${ac_cv_lib_m_exp+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char exp (); int main (void) { return exp (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_exp=yes else $as_nop ac_cv_lib_m_exp=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_exp" >&5 printf "%s\n" "$ac_cv_lib_m_exp" >&6; } if test "x$ac_cv_lib_m_exp" = xyes then : printf "%s\n" "#define HAVE_EXP 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for expm1 in -lm" >&5 printf %s "checking for expm1 in -lm... " >&6; } if test ${ac_cv_lib_m_expm1+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char expm1 (); int main (void) { return expm1 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_expm1=yes else $as_nop ac_cv_lib_m_expm1=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_expm1" >&5 printf "%s\n" "$ac_cv_lib_m_expm1" >&6; } if test "x$ac_cv_lib_m_expm1" = xyes then : printf "%s\n" "#define HAVE_EXPM1 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fabs in -lm" >&5 printf %s "checking for fabs in -lm... " >&6; } if test ${ac_cv_lib_m_fabs+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char fabs (); int main (void) { return fabs (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_fabs=yes else $as_nop ac_cv_lib_m_fabs=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fabs" >&5 printf "%s\n" "$ac_cv_lib_m_fabs" >&6; } if test "x$ac_cv_lib_m_fabs" = xyes then : printf "%s\n" "#define HAVE_FABS 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fdim in -lm" >&5 printf %s "checking for fdim in -lm... " >&6; } if test ${ac_cv_lib_m_fdim+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char fdim (); int main (void) { return fdim (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_fdim=yes else $as_nop ac_cv_lib_m_fdim=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fdim" >&5 printf "%s\n" "$ac_cv_lib_m_fdim" >&6; } if test "x$ac_cv_lib_m_fdim" = xyes then : printf "%s\n" "#define HAVE_FDIM 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for floor in -lm" >&5 printf %s "checking for floor in -lm... " >&6; } if test ${ac_cv_lib_m_floor+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char floor (); int main (void) { return floor (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_floor=yes else $as_nop ac_cv_lib_m_floor=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_floor" >&5 printf "%s\n" "$ac_cv_lib_m_floor" >&6; } if test "x$ac_cv_lib_m_floor" = xyes then : printf "%s\n" "#define HAVE_FLOOR 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fma in -lm" >&5 printf %s "checking for fma in -lm... " >&6; } if test ${ac_cv_lib_m_fma+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char fma (); int main (void) { return fma (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_fma=yes else $as_nop ac_cv_lib_m_fma=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fma" >&5 printf "%s\n" "$ac_cv_lib_m_fma" >&6; } if test "x$ac_cv_lib_m_fma" = xyes then : printf "%s\n" "#define HAVE_FMA 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fmax in -lm" >&5 printf %s "checking for fmax in -lm... " >&6; } if test ${ac_cv_lib_m_fmax+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char fmax (); int main (void) { return fmax (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_fmax=yes else $as_nop ac_cv_lib_m_fmax=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fmax" >&5 printf "%s\n" "$ac_cv_lib_m_fmax" >&6; } if test "x$ac_cv_lib_m_fmax" = xyes then : printf "%s\n" "#define HAVE_FMAX 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fmin in -lm" >&5 printf %s "checking for fmin in -lm... " >&6; } if test ${ac_cv_lib_m_fmin+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char fmin (); int main (void) { return fmin (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_fmin=yes else $as_nop ac_cv_lib_m_fmin=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fmin" >&5 printf "%s\n" "$ac_cv_lib_m_fmin" >&6; } if test "x$ac_cv_lib_m_fmin" = xyes then : printf "%s\n" "#define HAVE_FMIN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fmod in -lm" >&5 printf %s "checking for fmod in -lm... " >&6; } if test ${ac_cv_lib_m_fmod+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char fmod (); int main (void) { return fmod (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_fmod=yes else $as_nop ac_cv_lib_m_fmod=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_fmod" >&5 printf "%s\n" "$ac_cv_lib_m_fmod" >&6; } if test "x$ac_cv_lib_m_fmod" = xyes then : printf "%s\n" "#define HAVE_FMOD 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for frexp in -lm" >&5 printf %s "checking for frexp in -lm... " >&6; } if test ${ac_cv_lib_m_frexp+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char frexp (); int main (void) { return frexp (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_frexp=yes else $as_nop ac_cv_lib_m_frexp=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_frexp" >&5 printf "%s\n" "$ac_cv_lib_m_frexp" >&6; } if test "x$ac_cv_lib_m_frexp" = xyes then : printf "%s\n" "#define HAVE_FREXP 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gamma in -lm" >&5 printf %s "checking for gamma in -lm... " >&6; } if test ${ac_cv_lib_m_gamma+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char gamma (); int main (void) { return gamma (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_gamma=yes else $as_nop ac_cv_lib_m_gamma=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_gamma" >&5 printf "%s\n" "$ac_cv_lib_m_gamma" >&6; } if test "x$ac_cv_lib_m_gamma" = xyes then : printf "%s\n" "#define HAVE_GAMMA 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hypot in -lm" >&5 printf %s "checking for hypot in -lm... " >&6; } if test ${ac_cv_lib_m_hypot+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char hypot (); int main (void) { return hypot (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_hypot=yes else $as_nop ac_cv_lib_m_hypot=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_hypot" >&5 printf "%s\n" "$ac_cv_lib_m_hypot" >&6; } if test "x$ac_cv_lib_m_hypot" = xyes then : printf "%s\n" "#define HAVE_HYPOT 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for j0 in -lm" >&5 printf %s "checking for j0 in -lm... " >&6; } if test ${ac_cv_lib_m_j0+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char j0 (); int main (void) { return j0 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_j0=yes else $as_nop ac_cv_lib_m_j0=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_j0" >&5 printf "%s\n" "$ac_cv_lib_m_j0" >&6; } if test "x$ac_cv_lib_m_j0" = xyes then : printf "%s\n" "#define HAVE_J0 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for j1 in -lm" >&5 printf %s "checking for j1 in -lm... " >&6; } if test ${ac_cv_lib_m_j1+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char j1 (); int main (void) { return j1 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_j1=yes else $as_nop ac_cv_lib_m_j1=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_j1" >&5 printf "%s\n" "$ac_cv_lib_m_j1" >&6; } if test "x$ac_cv_lib_m_j1" = xyes then : printf "%s\n" "#define HAVE_J1 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jn in -lm" >&5 printf %s "checking for jn in -lm... " >&6; } if test ${ac_cv_lib_m_jn+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char jn (); int main (void) { return jn (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_jn=yes else $as_nop ac_cv_lib_m_jn=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_jn" >&5 printf "%s\n" "$ac_cv_lib_m_jn" >&6; } if test "x$ac_cv_lib_m_jn" = xyes then : printf "%s\n" "#define HAVE_JN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ldexp in -lm" >&5 printf %s "checking for ldexp in -lm... " >&6; } if test ${ac_cv_lib_m_ldexp+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char ldexp (); int main (void) { return ldexp (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_ldexp=yes else $as_nop ac_cv_lib_m_ldexp=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_ldexp" >&5 printf "%s\n" "$ac_cv_lib_m_ldexp" >&6; } if test "x$ac_cv_lib_m_ldexp" = xyes then : printf "%s\n" "#define HAVE_LDEXP 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lgamma in -lm" >&5 printf %s "checking for lgamma in -lm... " >&6; } if test ${ac_cv_lib_m_lgamma+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char lgamma (); int main (void) { return lgamma (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_lgamma=yes else $as_nop ac_cv_lib_m_lgamma=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_lgamma" >&5 printf "%s\n" "$ac_cv_lib_m_lgamma" >&6; } if test "x$ac_cv_lib_m_lgamma" = xyes then : printf "%s\n" "#define HAVE_LGAMMA 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log10 in -lm" >&5 printf %s "checking for log10 in -lm... " >&6; } if test ${ac_cv_lib_m_log10+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char log10 (); int main (void) { return log10 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_log10=yes else $as_nop ac_cv_lib_m_log10=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log10" >&5 printf "%s\n" "$ac_cv_lib_m_log10" >&6; } if test "x$ac_cv_lib_m_log10" = xyes then : printf "%s\n" "#define HAVE_LOG10 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log1p in -lm" >&5 printf %s "checking for log1p in -lm... " >&6; } if test ${ac_cv_lib_m_log1p+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char log1p (); int main (void) { return log1p (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_log1p=yes else $as_nop ac_cv_lib_m_log1p=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log1p" >&5 printf "%s\n" "$ac_cv_lib_m_log1p" >&6; } if test "x$ac_cv_lib_m_log1p" = xyes then : printf "%s\n" "#define HAVE_LOG1P 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5 printf %s "checking for log2 in -lm... " >&6; } if test ${ac_cv_lib_m_log2+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char log2 (); int main (void) { return log2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_log2=yes else $as_nop ac_cv_lib_m_log2=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5 printf "%s\n" "$ac_cv_lib_m_log2" >&6; } if test "x$ac_cv_lib_m_log2" = xyes then : printf "%s\n" "#define HAVE_LOG2 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for log in -lm" >&5 printf %s "checking for log in -lm... " >&6; } if test ${ac_cv_lib_m_log+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char log (); int main (void) { return log (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_log=yes else $as_nop ac_cv_lib_m_log=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log" >&5 printf "%s\n" "$ac_cv_lib_m_log" >&6; } if test "x$ac_cv_lib_m_log" = xyes then : printf "%s\n" "#define HAVE_LOG 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for logb in -lm" >&5 printf %s "checking for logb in -lm... " >&6; } if test ${ac_cv_lib_m_logb+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char logb (); int main (void) { return logb (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_logb=yes else $as_nop ac_cv_lib_m_logb=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_logb" >&5 printf "%s\n" "$ac_cv_lib_m_logb" >&6; } if test "x$ac_cv_lib_m_logb" = xyes then : printf "%s\n" "#define HAVE_LOGB 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for modf in -lm" >&5 printf %s "checking for modf in -lm... " >&6; } if test ${ac_cv_lib_m_modf+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char modf (); int main (void) { return modf (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_modf=yes else $as_nop ac_cv_lib_m_modf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_modf" >&5 printf "%s\n" "$ac_cv_lib_m_modf" >&6; } if test "x$ac_cv_lib_m_modf" = xyes then : printf "%s\n" "#define HAVE_MODF 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lgamma_r in -lm" >&5 printf %s "checking for lgamma_r in -lm... " >&6; } if test ${ac_cv_lib_m_lgamma_r+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char lgamma_r (); int main (void) { return lgamma_r (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_lgamma_r=yes else $as_nop ac_cv_lib_m_lgamma_r=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_lgamma_r" >&5 printf "%s\n" "$ac_cv_lib_m_lgamma_r" >&6; } if test "x$ac_cv_lib_m_lgamma_r" = xyes then : printf "%s\n" "#define HAVE_LGAMMA_R 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nearbyint in -lm" >&5 printf %s "checking for nearbyint in -lm... " >&6; } if test ${ac_cv_lib_m_nearbyint+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char nearbyint (); int main (void) { return nearbyint (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_nearbyint=yes else $as_nop ac_cv_lib_m_nearbyint=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_nearbyint" >&5 printf "%s\n" "$ac_cv_lib_m_nearbyint" >&6; } if test "x$ac_cv_lib_m_nearbyint" = xyes then : printf "%s\n" "#define HAVE_NEARBYINT 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nextafter in -lm" >&5 printf %s "checking for nextafter in -lm... " >&6; } if test ${ac_cv_lib_m_nextafter+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char nextafter (); int main (void) { return nextafter (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_nextafter=yes else $as_nop ac_cv_lib_m_nextafter=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_nextafter" >&5 printf "%s\n" "$ac_cv_lib_m_nextafter" >&6; } if test "x$ac_cv_lib_m_nextafter" = xyes then : printf "%s\n" "#define HAVE_NEXTAFTER 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nexttoward in -lm" >&5 printf %s "checking for nexttoward in -lm... " >&6; } if test ${ac_cv_lib_m_nexttoward+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char nexttoward (); int main (void) { return nexttoward (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_nexttoward=yes else $as_nop ac_cv_lib_m_nexttoward=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_nexttoward" >&5 printf "%s\n" "$ac_cv_lib_m_nexttoward" >&6; } if test "x$ac_cv_lib_m_nexttoward" = xyes then : printf "%s\n" "#define HAVE_NEXTTOWARD 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 printf %s "checking for pow in -lm... " >&6; } if test ${ac_cv_lib_m_pow+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char pow (); int main (void) { return pow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_pow=yes else $as_nop ac_cv_lib_m_pow=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 printf "%s\n" "$ac_cv_lib_m_pow" >&6; } if test "x$ac_cv_lib_m_pow" = xyes then : printf "%s\n" "#define HAVE_POW 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for remainder in -lm" >&5 printf %s "checking for remainder in -lm... " >&6; } if test ${ac_cv_lib_m_remainder+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char remainder (); int main (void) { return remainder (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_remainder=yes else $as_nop ac_cv_lib_m_remainder=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_remainder" >&5 printf "%s\n" "$ac_cv_lib_m_remainder" >&6; } if test "x$ac_cv_lib_m_remainder" = xyes then : printf "%s\n" "#define HAVE_REMAINDER 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for rint in -lm" >&5 printf %s "checking for rint in -lm... " >&6; } if test ${ac_cv_lib_m_rint+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char rint (); int main (void) { return rint (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_rint=yes else $as_nop ac_cv_lib_m_rint=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_rint" >&5 printf "%s\n" "$ac_cv_lib_m_rint" >&6; } if test "x$ac_cv_lib_m_rint" = xyes then : printf "%s\n" "#define HAVE_RINT 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for round in -lm" >&5 printf %s "checking for round in -lm... " >&6; } if test ${ac_cv_lib_m_round+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char round (); int main (void) { return round (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_round=yes else $as_nop ac_cv_lib_m_round=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_round" >&5 printf "%s\n" "$ac_cv_lib_m_round" >&6; } if test "x$ac_cv_lib_m_round" = xyes then : printf "%s\n" "#define HAVE_ROUND 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for scalb in -lm" >&5 printf %s "checking for scalb in -lm... " >&6; } if test ${ac_cv_lib_m_scalb+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char scalb (); int main (void) { return scalb (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_scalb=yes else $as_nop ac_cv_lib_m_scalb=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_scalb" >&5 printf "%s\n" "$ac_cv_lib_m_scalb" >&6; } if test "x$ac_cv_lib_m_scalb" = xyes then : printf "%s\n" "#define HAVE_SCALB 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for scalbln in -lm" >&5 printf %s "checking for scalbln in -lm... " >&6; } if test ${ac_cv_lib_m_scalbln+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char scalbln (); int main (void) { return scalbln (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_scalbln=yes else $as_nop ac_cv_lib_m_scalbln=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_scalbln" >&5 printf "%s\n" "$ac_cv_lib_m_scalbln" >&6; } if test "x$ac_cv_lib_m_scalbln" = xyes then : printf "%s\n" "#define HAVE_SCALBLN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for significand in -lm" >&5 printf %s "checking for significand in -lm... " >&6; } if test ${ac_cv_lib_m_significand+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char significand (); int main (void) { return significand (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_significand=yes else $as_nop ac_cv_lib_m_significand=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_significand" >&5 printf "%s\n" "$ac_cv_lib_m_significand" >&6; } if test "x$ac_cv_lib_m_significand" = xyes then : printf "%s\n" "#define HAVE_SIGNIFICAND 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for scalbn in -lm" >&5 printf %s "checking for scalbn in -lm... " >&6; } if test ${ac_cv_lib_m_scalbn+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char scalbn (); int main (void) { return scalbn (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_scalbn=yes else $as_nop ac_cv_lib_m_scalbn=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_scalbn" >&5 printf "%s\n" "$ac_cv_lib_m_scalbn" >&6; } if test "x$ac_cv_lib_m_scalbn" = xyes then : printf "%s\n" "#define HAVE_SCALBN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ilogb in -lm" >&5 printf %s "checking for ilogb in -lm... " >&6; } if test ${ac_cv_lib_m_ilogb+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char ilogb (); int main (void) { return ilogb (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_ilogb=yes else $as_nop ac_cv_lib_m_ilogb=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_ilogb" >&5 printf "%s\n" "$ac_cv_lib_m_ilogb" >&6; } if test "x$ac_cv_lib_m_ilogb" = xyes then : printf "%s\n" "#define HAVE_ILOGB 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sin in -lm" >&5 printf %s "checking for sin in -lm... " >&6; } if test ${ac_cv_lib_m_sin+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sin (); int main (void) { return sin (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_sin=yes else $as_nop ac_cv_lib_m_sin=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sin" >&5 printf "%s\n" "$ac_cv_lib_m_sin" >&6; } if test "x$ac_cv_lib_m_sin" = xyes then : printf "%s\n" "#define HAVE_SIN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sinh in -lm" >&5 printf %s "checking for sinh in -lm... " >&6; } if test ${ac_cv_lib_m_sinh+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sinh (); int main (void) { return sinh (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_sinh=yes else $as_nop ac_cv_lib_m_sinh=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sinh" >&5 printf "%s\n" "$ac_cv_lib_m_sinh" >&6; } if test "x$ac_cv_lib_m_sinh" = xyes then : printf "%s\n" "#define HAVE_SINH 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5 printf %s "checking for sqrt in -lm... " >&6; } if test ${ac_cv_lib_m_sqrt+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char sqrt (); int main (void) { return sqrt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_sqrt=yes else $as_nop ac_cv_lib_m_sqrt=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5 printf "%s\n" "$ac_cv_lib_m_sqrt" >&6; } if test "x$ac_cv_lib_m_sqrt" = xyes then : printf "%s\n" "#define HAVE_SQRT 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tan in -lm" >&5 printf %s "checking for tan in -lm... " >&6; } if test ${ac_cv_lib_m_tan+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char tan (); int main (void) { return tan (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_tan=yes else $as_nop ac_cv_lib_m_tan=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_tan" >&5 printf "%s\n" "$ac_cv_lib_m_tan" >&6; } if test "x$ac_cv_lib_m_tan" = xyes then : printf "%s\n" "#define HAVE_TAN 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tanh in -lm" >&5 printf %s "checking for tanh in -lm... " >&6; } if test ${ac_cv_lib_m_tanh+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char tanh (); int main (void) { return tanh (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_tanh=yes else $as_nop ac_cv_lib_m_tanh=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_tanh" >&5 printf "%s\n" "$ac_cv_lib_m_tanh" >&6; } if test "x$ac_cv_lib_m_tanh" = xyes then : printf "%s\n" "#define HAVE_TANH 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgamma in -lm" >&5 printf %s "checking for tgamma in -lm... " >&6; } if test ${ac_cv_lib_m_tgamma+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char tgamma (); int main (void) { return tgamma (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_tgamma=yes else $as_nop ac_cv_lib_m_tgamma=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_tgamma" >&5 printf "%s\n" "$ac_cv_lib_m_tgamma" >&6; } if test "x$ac_cv_lib_m_tgamma" = xyes then : printf "%s\n" "#define HAVE_TGAMMA 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for trunc in -lm" >&5 printf %s "checking for trunc in -lm... " >&6; } if test ${ac_cv_lib_m_trunc+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char trunc (); int main (void) { return trunc (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_trunc=yes else $as_nop ac_cv_lib_m_trunc=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_trunc" >&5 printf "%s\n" "$ac_cv_lib_m_trunc" >&6; } if test "x$ac_cv_lib_m_trunc" = xyes then : printf "%s\n" "#define HAVE_TRUNC 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for y0 in -lm" >&5 printf %s "checking for y0 in -lm... " >&6; } if test ${ac_cv_lib_m_y0+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char y0 (); int main (void) { return y0 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_y0=yes else $as_nop ac_cv_lib_m_y0=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_y0" >&5 printf "%s\n" "$ac_cv_lib_m_y0" >&6; } if test "x$ac_cv_lib_m_y0" = xyes then : printf "%s\n" "#define HAVE_Y0 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for y1 in -lm" >&5 printf %s "checking for y1 in -lm... " >&6; } if test ${ac_cv_lib_m_y1+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char y1 (); int main (void) { return y1 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_y1=yes else $as_nop ac_cv_lib_m_y1=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_y1" >&5 printf "%s\n" "$ac_cv_lib_m_y1" >&6; } if test "x$ac_cv_lib_m_y1" = xyes then : printf "%s\n" "#define HAVE_Y1 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yn in -lm" >&5 printf %s "checking for yn in -lm... " >&6; } if test ${ac_cv_lib_m_yn+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char yn (); int main (void) { return yn (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_yn=yes else $as_nop ac_cv_lib_m_yn=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_yn" >&5 printf "%s\n" "$ac_cv_lib_m_yn" >&6; } if test "x$ac_cv_lib_m_yn" = xyes then : printf "%s\n" "#define HAVE_YN 1" >>confdefs.h fi have___thread=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for thread-local storage" >&5 printf %s "checking for thread-local storage... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ static __thread int x ; int main () { x = 123; return x; } _ACEOF if ac_fn_c_try_link "$LINENO" then : have___thread=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test $have___thread = yes; then printf "%s\n" "#define HAVE___THREAD 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have___thread" >&5 printf "%s\n" "$have___thread" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 printf %s "checking whether byte ordering is bigendian... " >&6; } if test ${ac_cv_c_bigendian+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO" then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_bigendian=yes else $as_nop ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_bigendian=no else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) printf "%s\n" "#define IEEE_MC68k 1" >>confdefs.h ;; #( no) printf "%s\n" "#define IEEE_8087 1" >>confdefs.h ;; #( universal) as_fn_error $? "universal endianness not supported" "$LINENO" 5 ;; #( *) as_fn_error $? "unknown endianness" "$LINENO" 5 ;; esac # Check whether --with-oniguruma was given. if test ${with_oniguruma+y} then : withval=$with_oniguruma; else $as_nop with_oniguruma=yes fi onig_CFLAGS= onig_LDFLAGS= build_oniguruma=no if test "x$with_oniguruma" != xno then : save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" if test "x$with_oniguruma" != xyes then : if test "x$with_oniguruma" = xbuiltin then : build_oniguruma=yes else $as_nop onig_CFLAGS="-I${with_oniguruma}/include" onig_LDFLAGS="-L${with_oniguruma}/lib" fi fi if test "x$build_oniguruma" = xno then : # check for ONIGURUMA library, either in /usr or where requested CFLAGS="$CFLAGS $onig_CFLAGS" LDFLAGS="$LDFLAGS $onig_LDFLAGS" as_ac_Header=`printf "%s\n" "ac_cv_header_"oniguruma.h"" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" ""oniguruma.h"" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for onig_version in -lonig" >&5 printf %s "checking for onig_version in -lonig... " >&6; } if test ${ac_cv_lib_onig_onig_version+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lonig $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char onig_version (); int main (void) { return onig_version (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_onig_onig_version=yes else $as_nop ac_cv_lib_onig_onig_version=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_onig_onig_version" >&5 printf "%s\n" "$ac_cv_lib_onig_onig_version" >&6; } if test "x$ac_cv_lib_onig_onig_version" = xyes then : printf "%s\n" "#define HAVE_LIBONIG 1" >>confdefs.h LIBS="-lonig $LIBS" fi fi # handle check results if test "x$ac_cv_lib_onig_onig_version" != "xyes" then : build_oniguruma=yes { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Oniguruma was not found. Will use the packaged oniguruma." >&5 printf "%s\n" "$as_me: Oniguruma was not found. Will use the packaged oniguruma." >&6;} fi fi if test "x$build_oniguruma" = xyes && test -f "${srcdir}/vendor/oniguruma/configure.ac" then : onig_CFLAGS="-I${srcdir}/vendor/oniguruma/src" onig_LDFLAGS="-L${srcdir}/vendor/oniguruma/src -Wl,-rpath,${libdir}" subdirs="$subdirs vendor/oniguruma" printf "%s\n" "#define HAVE_LIBONIG 1" >>confdefs.h fi CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS" fi if test "x$build_oniguruma" = xyes; then BUILD_ONIGURUMA_TRUE= BUILD_ONIGURUMA_FALSE='#' else BUILD_ONIGURUMA_TRUE='#' BUILD_ONIGURUMA_FALSE= fi if test "x$with_oniguruma" != xno; then WITH_ONIGURUMA_TRUE= WITH_ONIGURUMA_FALSE='#' else WITH_ONIGURUMA_TRUE='#' WITH_ONIGURUMA_FALSE= fi if test "x`uname -s 2>/dev/null`" = "xSunOS" then : CPPFLAGS="$CPPFLAGS -D_STRPTIME_DONTZERO" fi ac_config_files="$ac_config_files Makefile libjq.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WIN32_TRUE}" && test -z "${WIN32_FALSE}"; then as_fn_error $? "conditional \"WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_VALGRIND_TRUE}" && test -z "${ENABLE_VALGRIND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_VALGRIND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_ASAN_TRUE}" && test -z "${ENABLE_ASAN_FALSE}"; then as_fn_error $? "conditional \"ENABLE_ASAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_UBSAN_TRUE}" && test -z "${ENABLE_UBSAN_FALSE}"; then as_fn_error $? "conditional \"ENABLE_UBSAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_GCOV_TRUE}" && test -z "${ENABLE_GCOV_FALSE}"; then as_fn_error $? "conditional \"ENABLE_GCOV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DOCS_TRUE}" && test -z "${ENABLE_DOCS_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DOCS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_ERROR_INJECTION_TRUE}" && test -z "${ENABLE_ERROR_INJECTION_FALSE}"; then as_fn_error $? "conditional \"ENABLE_ERROR_INJECTION\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_ALL_STATIC_TRUE}" && test -z "${ENABLE_ALL_STATIC_FALSE}"; then as_fn_error $? "conditional \"ENABLE_ALL_STATIC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_ONIGURUMA_TRUE}" && test -z "${BUILD_ONIGURUMA_FALSE}"; then as_fn_error $? "conditional \"BUILD_ONIGURUMA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_ONIGURUMA_TRUE}" && test -z "${WITH_ONIGURUMA_FALSE}"; then as_fn_error $? "conditional \"WITH_ONIGURUMA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; 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 # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by jq $as_me 1.8.2, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to . jq home page: ." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ jq config.status 1.8.2 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ FILECMD \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "libjq.pc") CONFIG_FILES="$CONFIG_FILES libjq.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # A file(cmd) program that detects file types. FILECMD=$lt_FILECMD # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive (by configure). lt_ar_flags=$lt_ar_flags # Flags to create an archive. AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? $SED '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 printf "%s\n" "$ac_msg" >&6 as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 printf "%s\n" "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi jq-1.8.2/config/0000755000175100017510000000000015215513665007155 5jq-1.8.2/config/m4/0000755000175100017510000000000015215513665007475 5jq-1.8.2/config/m4/lt~obsolete.m40000755000175100017510000001400715215513553012232 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free # Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) jq-1.8.2/config/m4/ltversion.m40000755000175100017510000000131215215513553011700 # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, # Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4245 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.7]) m4_define([LT_PACKAGE_REVISION], [2.4.7]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.7' macro_revision='2.4.7' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) jq-1.8.2/config/m4/find-func-no-libs2.m40000644000175100017510000000276515215513536013162 dnl Shamelessly stolen from Heimdal dnl dnl Look for function in any of the specified libraries dnl dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args) AC_DEFUN([AC_FIND_FUNC_NO_LIBS2], [ AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(ac_cv_funclib_$1, [ if eval "test \"\$ac_cv_func_$1\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in $2; do case "$ac_lib" in "") ;; yes) ac_lib="" ;; no) continue ;; -l*) ;; *) ac_lib="-l$ac_lib" ;; esac LIBS="$6 $ac_lib $5 $ac_save_LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$1($4)]])],[eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break]) done eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}" LIBS="$ac_save_LIBS" fi ]) eval "ac_res=\$ac_cv_funclib_$1" if false; then AC_CHECK_FUNCS($1) dnl AC_CHECK_LIBS($2, foo) fi # $1 eval "ac_tr_func=HAVE_[]upcase($1)" eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')" eval "LIB_$1=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_$1=yes" eval "LIB_$1=" AC_DEFINE_UNQUOTED($ac_tr_func, 1, [Define if the $1 function is available.]) AC_MSG_RESULT([yes]) ;; no) eval "ac_cv_func_$1=no" eval "LIB_$1=" AC_MSG_RESULT([no]) ;; *) eval "ac_cv_func_$1=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" AC_DEFINE_UNQUOTED($ac_tr_func, 1, [Define if you have the $1 function.]) AC_DEFINE_UNQUOTED($ac_tr_lib, 1, [Define if you have the $2 library.]) AC_MSG_RESULT([yes, in $ac_res]) ;; esac AC_SUBST(LIB_$1) ]) jq-1.8.2/config/m4/ltsugar.m40000755000175100017510000001045315215513553011342 # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) jq-1.8.2/config/m4/find-func-no-libs.m40000644000175100017510000000043615215513536013071 dnl Shamelessly stolen from Heimdal dnl dnl Look for function in any of the specified libraries dnl dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args) AC_DEFUN([AC_FIND_FUNC_NO_LIBS], [ AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])]) jq-1.8.2/config/m4/find-func.m40000644000175100017510000000033615215513536011527 dnl Shamelessly stolen from Heimdal dnl dnl AC_FIND_FUNC(func, libraries, includes, arguments) AC_DEFUN([AC_FIND_FUNC], [ AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4]) if test -n "$LIB_$1"; then LIBS="$LIB_$1 $LIBS" fi ]) jq-1.8.2/config/m4/check-math-func.m40000644000175100017510000000035715215513536012616 dnl AC_CHECK_MATH_FUNC(func) AC_DEFUN([AC_CHECK_MATH_FUNC], [ AC_LANG(C) AC_CHECK_LIB([m],[$1],[ m4_define([ac_tr_func], [HAVE_]m4_toupper($1)) AC_DEFINE(ac_tr_func, 1, [Define if you have the $1 math function.]) ],[ ]) ]) jq-1.8.2/config/m4/misc.m40000644000175100017510000000020215215513536010601 dnl Shamelessly stolen from Heimdal AC_DEFUN([upcase],[`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`])dnl jq-1.8.2/config/m4/libtool.m40000755000175100017510000113165215215513553011333 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 59 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_DECL_FILECMD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC and # ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? $SED '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) case $MACOSX_DEPLOYMENT_TARGET,$host in 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `$FILECMD conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `$FILECMD conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `$FILECMD conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `$FILECMD conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `$FILECMD conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `$FILECMD conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} _LT_DECL([], [AR], [1], [The archiver]) # Use ARFLAGS variable as AR's operation code to sync the variable naming with # Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have # higher priority because thats what people were doing historically (setting # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS # variable obsoleted/removed. test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} lt_ar_flags=$AR_FLAGS _LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)]) # Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override # by AR_FLAGS because that was never working and AR_FLAGS is about to die. _LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -z "$STRIP"; then AC_MSG_RESULT([no]) else if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else case $host_os in darwin*) # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) ;; freebsd*) if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl* | *,icl*) # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='$FILECMD -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly* | midnightbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=$FILECMD case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly* | midnightbsd*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl* | icl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([[^)]]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl* | icl*) # Native MSVC or ICC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC and ICC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly* | midnightbsd*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi _LT_TAGVAR(link_all_deplibs, $1)=no else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl* | ,icl* | no,icl*) # Native MSVC or ICC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly* | midnightbsd*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_FILECMD # ---------------- # Check for a file(cmd) program that can be used to detect file type and magic m4_defun([_LT_DECL_FILECMD], [AC_CHECK_TOOL([FILECMD], [file], [:]) _LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types]) ])# _LD_DECL_FILECMD # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS jq-1.8.2/config/m4/ltoptions.m40000755000175100017510000003427515215513553011724 # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free # Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) jq-1.8.2/config/install-sh0000755000175100017510000003577615215513556011122 #!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/config/depcomp0000755000175100017510000005602015215513556010454 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/config/ar-lib0000755000175100017510000001336315215513556010176 #! /bin/sh # Wrapper for Microsoft lib.exe me=ar-lib scriptversion=2019-07-04.01; # UTC # Copyright (C) 2010-2021 Free Software Foundation, Inc. # Written by Peter Rosin . # # 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 # . # func_error message func_error () { echo "$me: $1" 1>&2 exit 1 } file_conv= # func_file_conv build_file # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv in mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin | msys) file=`cygpath -m "$file" || echo "$file"` ;; wine) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_at_file at_file operation archive # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE # for each of them. # When interpreting the content of the @FILE, do NOT use func_file_conv, # since the user would need to supply preconverted file names to # binutils ar, at least for MinGW. func_at_file () { operation=$2 archive=$3 at_file_contents=`cat "$1"` eval set x "$at_file_contents" shift for member do $AR -NOLOGO $operation:"$member" "$archive" || exit $? done } case $1 in '') func_error "no command. Try '$0 --help' for more information." ;; -h | --h*) cat <. # # 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-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #include #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 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=`/usr/bin/uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32: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 LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI=${LIBC}x32 fi fi GUESS=$UNAME_MACHINE-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 ;; x86_64:Haiku:*:*) GUESS=x86_64-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: jq-1.8.2/config/test-driver0000755000175100017510000001141715215513556011276 #! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # 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" "$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/config/ltmain.sh0000755000175100017510000121237515215513553010727 #! /usr/bin/env sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2019-02-19.15 # libtool (GNU libtool) 2.4.7 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2019, 2021-2022 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.7 Debian-2.4.7-7build1" package_revision=2.4.7 ## ------ ## ## 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=2019-02-19.15; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2004-2019, 2021 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # ## ------ ## ## 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 # These NLS vars are set unconditionally (bootstrap issue #24). Unset those # in case the environment reset is needed later and the $save_* variant is not # defined (see the code above). LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL # 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 # func_unset VAR # -------------- # Portably unset VAR. # In some shells, an 'unset VAR' statement leaves a non-zero return # status if VAR is already unset, which might be problematic if the # statement is used at the end of a function (thus poisoning its return # value) or when 'set -e' is active (causing even a spurious abort of # the script in this case). func_unset () { { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } } # Make sure CDPATH doesn't cause `cd` commands to output the target dir. func_unset CDPATH # Make sure ${,E,F}GREP behave sanely. func_unset GREP_OPTIONS ## ------------------------- ## ## 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" # require_check_ifs_backslash # --------------------------- # Check if we can use backslash as IFS='\' separator, and set # $check_ifs_backshlash_broken to ':' or 'false'. require_check_ifs_backslash=func_require_check_ifs_backslash func_require_check_ifs_backslash () { _G_save_IFS=$IFS IFS='\' _G_check_ifs_backshlash='a\\b' for _G_i in $_G_check_ifs_backshlash do case $_G_i in a) check_ifs_backshlash_broken=false ;; '') break ;; *) check_ifs_backshlash_broken=: break ;; esac done IFS=$_G_save_IFS require_check_ifs_backslash=: } ## ----------------- ## ## 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='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. # _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. if test -z "$_G_HAVE_PLUSEQ_OP" && \ __PLUSEQ_TEST="a" && \ __PLUSEQ_TEST+=" b" 2>/dev/null && \ test "a b" = "$__PLUSEQ_TEST"; then _G_HAVE_PLUSEQ_OP=yes fi 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_arg pretty "$2" eval "$1+=\\ \$func_quote_arg_result" }' else func_append_quoted () { $debug_cmd func_quote_arg pretty "$2" eval "$1=\$$1\\ \$func_quote_arg_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_portable EVAL ARG # ---------------------------- # Internal function to portably implement func_quote_arg. Note that we still # keep attention to performance here so we as much as possible try to avoid # calling sed binary (so far O(N) complexity as long as func_append is O(1)). func_quote_portable () { $debug_cmd $require_check_ifs_backslash func_quote_portable_result=$2 # one-time-loop (easy break) while true do if $1; then func_quote_portable_result=`$ECHO "$2" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` break fi # Quote for eval. case $func_quote_portable_result in *[\\\`\"\$]*) # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string # contains the shell wildcard characters. case $check_ifs_backshlash_broken$func_quote_portable_result in :*|*[\[\*\?]*) func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ | $SED "$sed_quote_subst"` break ;; esac func_quote_portable_old_IFS=$IFS for _G_char in '\' '`' '"' '$' do # STATE($1) PREV($2) SEPARATOR($3) set start "" "" func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy IFS=$_G_char for _G_part in $func_quote_portable_result do case $1 in quote) func_append func_quote_portable_result "$3$2" set quote "$_G_part" "\\$_G_char" ;; start) set first "" "" func_quote_portable_result= ;; first) set quote "$_G_part" "" ;; esac done done IFS=$func_quote_portable_old_IFS ;; *) ;; esac break done func_quote_portable_unquoted_result=$func_quote_portable_result case $func_quote_portable_result 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. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_portable_result=\"$func_quote_portable_result\" ;; esac } # func_quotefast_eval ARG # ----------------------- # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', # but optimized for speed. Result is stored in $func_quotefast_eval. if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then printf -v _GL_test_printf_tilde %q '~' if test '\~' = "$_GL_test_printf_tilde"; then func_quotefast_eval () { printf -v func_quotefast_eval_result %q "$1" } else # Broken older Bash implementations. Make those faster too if possible. func_quotefast_eval () { case $1 in '~'*) func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result ;; *) printf -v func_quotefast_eval_result %q "$1" ;; esac } fi else func_quotefast_eval () { func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result } fi # func_quote_arg MODEs ARG # ------------------------ # Quote one ARG to be evaled later. MODEs argument may contain zero or more # specifiers listed below separated by ',' character. This function returns two # values: # i) func_quote_arg_result # double-quoted (when needed), suitable for a subsequent eval # ii) func_quote_arg_unquoted_result # has all characters that are still active within double # quotes backslashified. Available only if 'unquoted' is specified. # # Available modes: # ---------------- # 'eval' (default) # - escape shell special characters # 'expand' # - the same as 'eval'; but do not quote variable references # 'pretty' # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might # be used later in func_quote to get output like: 'echo "a b"' instead # of 'echo a\ b'. This is slower than default on some shells. # 'unquoted' # - produce also $func_quote_arg_unquoted_result which does not contain # wrapping double-quotes. # # Examples for 'func_quote_arg pretty,unquoted string': # # string | *_result | *_unquoted_result # ------------+-----------------------+------------------- # " | \" | \" # a b | "a b" | a b # "a b" | "\"a b\"" | \"a b\" # * | "*" | * # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" # # Examples for 'func_quote_arg pretty,unquoted,expand string': # # string | *_result | *_unquoted_result # --------------+---------------------+-------------------- # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" func_quote_arg () { _G_quote_expand=false case ,$1, in *,expand,*) _G_quote_expand=: ;; esac case ,$1, in *,pretty,*|*,expand,*|*,unquoted,*) func_quote_portable $_G_quote_expand "$2" func_quote_arg_result=$func_quote_portable_result func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result ;; *) # Faster quote-for-eval for some shells. func_quotefast_eval "$2" func_quote_arg_result=$func_quotefast_eval_result ;; esac } # func_quote MODEs ARGs... # ------------------------ # Quote all ARGs to be evaled later and join them into single command. See # func_quote_arg's description for more info. func_quote () { $debug_cmd _G_func_quote_mode=$1 ; shift func_quote_result= while test 0 -lt $#; do func_quote_arg "$_G_func_quote_mode" "$1" if test -n "$func_quote_result"; then func_append func_quote_result " $func_quote_arg_result" else func_append func_quote_result "$func_quote_arg_result" fi shift done } # 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_arg pretty,expand "$_G_cmd" eval "func_notquiet $func_quote_arg_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_arg expand,pretty "$_G_cmd" eval "func_echo $func_quote_arg_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 # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2010-2019, 2021 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # # Set a version string for this script. scriptversion=2019-02-19.15; # UTC ## ------ ## ## 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 '# Copyright'. # # 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 in 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 # in the main code. A hook is just a list of function names 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 hook functions to be called by # FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_propagate_result FUNC_NAME_A FUNC_NAME_B # --------------------------------------------- # If the *_result variable of FUNC_NAME_A _is set_, assign its value to # *_result variable of FUNC_NAME_B. func_propagate_result () { $debug_cmd func_propagate_result_result=: if eval "test \"\${${1}_result+set}\" = set" then eval "${2}_result=\$${1}_result" else func_propagate_result_result=false fi } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It's 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 _G_rc_run_hooks=false case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook functions." ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do func_unset "${_G_hook}_result" eval $_G_hook '${1+"$@"}' func_propagate_result $_G_hook func_run_hooks if $func_propagate_result_result; then eval set dummy "$func_run_hooks_result"; shift fi done } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list from your hook function. You may remove # or edit any options that you action, and then pass back the remaining # unprocessed options in '_result', escaped # suitably for 'eval'. # # The '_result' variable is automatically unset # before your hook gets called; for best performance, only set the # *_result variable when necessary (i.e. don't call the 'func_quote' # function unnecessarily because it can be an expensive operation on some # machines). # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). Leave # # my_options_prep_result variable intact. # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # 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=: # args_changed=: # ;; # # 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 # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@" in case we need it later, # # if $args_changed was set to 'true'. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # # Only call 'func_quote' here if we processed at least one argument. # if $args_changed; then # func_quote eval ${1+"$@"} # my_silent_option_result=$func_quote_result # fi # } # 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_add_hook func_validate_options my_option_validation # # You'll also 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_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd func_run_hooks func_options ${1+"$@"} func_propagate_result func_run_hooks func_options_finish } # 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 _G_options_quoted=false for my_func in options_prep parse_options validate_options options_finish do func_unset func_${my_func}_result func_unset func_run_hooks_result eval func_$my_func '${1+"$@"}' func_propagate_result func_$my_func func_options if $func_propagate_result_result; then eval set dummy "$func_options_result"; shift _G_options_quoted=: fi done $_G_options_quoted || { # As we (func_options) are top-level options-parser function and # nobody quoted "$@" for us yet, we need to do it explicitly for # caller. func_quote eval ${1+"$@"} func_options_result=$func_quote_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 propagate 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+"$@"} func_propagate_result func_run_hooks func_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd _G_parse_options_requote=false # 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+"$@"} func_propagate_result func_run_hooks func_parse_options if $func_propagate_result_result; then eval set dummy "$func_parse_options_result"; shift # Even though we may have changed "$@", we passed the "$@" array # down into the hook and it quoted it for us (because we are in # this if-branch). No need to quote it again. _G_parse_options_requote=false fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break # We expect that one of the options parsed in this function matches # and thus we remove _G_opt from "$@" and need to re-quote. _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" >&2 $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_parse_options_requote=: break fi 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 ;; --) _G_parse_options_requote=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac if $_G_match_parse_options; then _G_parse_options_requote=: fi done if $_G_parse_options_requote; then # save modified positional parameters for caller func_quote eval ${1+"$@"} func_parse_options_result=$func_quote_result fi } # 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+"$@"} func_propagate_result func_run_hooks func_validate_options # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE } ## ----------------- ## ## 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#*=} if test "x$func_split_equals_lhs" = "x$1"; then func_split_equals_rhs= fi }' 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. # The version message is extracted from the calling file's header # comments, with leading '# ' stripped: # 1. First display the progname and version # 2. Followed by the header comment line matching /^# Written by / # 3. Then a blank line followed by the first following line matching # /^# Copyright / # 4. Immediately followed by any lines between the previous matches, # except lines preceding the intervening completely blank line. # For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /^# Written by /!b s|^# ||; p; n :fwd2blnk /./ { n b fwd2blnk } p; n :holdwrnt s|^# || s|^# *$|| /^Copyright /!{ /./H n b holdwrnt } s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| G s|\(\n\)\n*|\1|g p; q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.7' # 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 $scriptversion Debian-2.4.7-7build1 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= _G_rc_lt_options_prep=: _G_rc_lt_options_prep=: # 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 ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote eval ${1+"$@"} libtool_options_prep_result=$func_quote_result fi } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _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 _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote eval ${1+"$@"} libtool_parse_options_result=$func_quote_result fi } 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 eval ${1+"$@"} libtool_validate_options_result=$func_quote_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_arg pretty "$libobj" test "X$libobj" != "X$func_quote_arg_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_arg pretty "$srcfile" qsrcfile=$func_quote_arg_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 -Xcompiler 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 -Wa,FLAG -Xassembler FLAG pass linker-specific FLAG directly to the assembler -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_arg pretty "$nonopt" install_prog="$func_quote_arg_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_arg pretty "$arg" func_append install_prog "$func_quote_arg_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_arg pretty "$arg" func_append install_prog " $func_quote_arg_result" if test -n "$arg2"; then func_quote_arg pretty "$arg2" fi func_append install_shared_prog " $func_quote_arg_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_arg pretty "$install_override_mode" func_append install_shared_prog " -m $func_quote_arg_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_arg expand,pretty "$relink_command" eval "func_echo $func_quote_arg_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\"" func_quote_arg pretty "$ECHO" qECHO=$func_quote_arg_result $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_arg pretty,unquoted "$arg" qarg=$func_quote_arg_unquoted_result func_append libtool_args " $func_quote_arg_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 ;; xassembler) func_append compiler_flags " -Xassembler $qarg" prev= func_append compile_command " -Xassembler $qarg" func_append finalize_command " -Xassembler $qarg" 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* | *-*-midnightbsd*) # 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* | *-*-midnightbsd*) # 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 ;; # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. -pthread) case $host in *solaris2*) ;; *) case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac ;; esac continue ;; -mt|-mthreads|-kthread|-Kthread|-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_arg pretty "$flag" func_append arg " $func_quote_arg_result" func_append compiler_flags " $func_quote_arg_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_arg pretty "$flag" func_append arg " $wl$func_quote_arg_result" func_append compiler_flags " $wl$func_quote_arg_result" func_append linker_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xassembler) prev=xassembler continue ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_arg pretty "$arg" arg=$func_quote_arg_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 # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC # -static-* direct GCC to link specific libraries statically # -fcilkplus Cilk Plus language extension features for C/C++ # -Wa,* Pass flags directly to the assembler -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=*| \ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Wa,*) func_quote_arg pretty "$arg" arg=$func_quote_arg_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_arg pretty "$arg" arg=$func_quote_arg_result fi ;; # Some other compiler flag. -* | +*) func_quote_arg pretty "$arg" arg=$func_quote_arg_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_arg pretty "$arg" arg=$func_quote_arg_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%" test "X$link_all_deplibs" != Xno && libs="$libs $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" 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 elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi 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|midnightbsd-elf|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 ;; *) func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; 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 | midnightbsd-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* | *-*-midnightbsd*) # 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_arg expand,pretty "$cmd" eval "func_echo $func_quote_arg_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_arg expand,pretty "$cmd" eval "func_echo $func_quote_arg_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_arg pretty "$var_value" relink_command="$var=$func_quote_arg_result; export $var; $relink_command" fi done func_quote eval cd "`pwd`" func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" relink_command=$func_quote_arg_unquoted_result 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_arg pretty,unquoted "$var_value" relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" fi done # Quote the link command for shipping. func_quote eval cd "`pwd`" relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" func_quote_arg pretty,unquoted "$relink_command" relink_command=$func_quote_arg_unquoted_result 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: jq-1.8.2/config/compile0000755000175100017510000001635015215513556010457 #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/config/config.sub0000755000175100017510000010511615215513556011063 #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2022-01-03' # 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-2022 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*) 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. 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 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ | linux-musl* | linux-relibc* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) # 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 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: jq-1.8.2/config/ylwrap0000755000175100017510000001531415215513556010344 #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2021 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 # . get_dirname () { case $1 in */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';; # Otherwise, we want the empty string (not "."). esac } # guard FILE # ---------- # The CPP macro used to guard inclusion of FILE. guard () { printf '%s\n' "$1" \ | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \ -e 's/__*/_/g' } # quote_for_sed [STRING] # ---------------------- # Return STRING (or stdin) quoted to be used as a sed pattern. quote_for_sed () { case $# in 0) cat;; 1) printf '%s\n' "$1";; esac \ | sed -e 's|[][\\.*]|\\&|g' } 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 # We'll later need for a correct munging of "#line" directives. input_sub_rx=`get_dirname "$input" | quote_for_sed` case $input in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input=`pwd`/$input ;; esac input_rx=`get_dirname "$input" | quote_for_sed` # 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=false if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot=true fi # The parser itself, the first file, is the destination of the .y.c # rule in the Makefile. parser=$1 # A sed program to s/FROM/TO/g for all the FROM/TO so that, for # instance, we rename #include "y.tab.h" into #include "parse.h" # during the conversion from y.tab.c to parse.c. sed_fix_filenames= # Also rename header guards, as Bison 2.7 for instance uses its header # guard in its implementation file. sed_fix_header_guards= while test $# -ne 0; do if test x"$1" = x"--"; then shift break fi from=$1 # Handle y_tab.c and y_tab.h output by DOS if $y_tab_nodot; then case $from in "y.tab.c") from=y_tab.c;; "y.tab.h") from=y_tab.h;; esac fi shift to=$1 shift sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;" sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;" done # The program to run. prog=$1 shift # Make any relative path in $prog absolute. case $prog in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog=`pwd`/$prog ;; esac 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 for from in * do to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"` if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend '../'. case $to in [\\/]* | ?:[\\/]*) target=$to;; *) target=../$to;; esac # Do not overwrite unchanged header files to avoid useless # recompilations. Always update the parser itself: 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 $from != $parser; then realtarget=$target target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'` fi # Munge "#line" or "#" directives. Don't let the resulting # debug information point at an absolute srcdir. Use the real # output file name, not yy.lex.c for instance. Adjust the # include guards too. sed -e "/^#/!b" \ -e "s|$input_rx|$input_sub_rx|" \ -e "$sed_fix_filenames" \ -e "$sed_fix_header_guards" \ "$from" >"$target" || ret=$? # Check whether files must be updated. if test "$from" != "$parser"; then if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then echo "$to is unchanged" rm -f "$target" else echo "updating $to" mv -f "$target" "$realtarget" fi fi else # A missing file is only an error for the parser. This is a # blatant hack to let us support using "yacc -d". If -d is not # specified, don't fail when the header file is "missing". if test "$from" = "$parser"; then ret=1 fi fi done fi # Remove the directory. cd .. rm -rf $dirname exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/config/missing0000755000175100017510000001533615215513556010503 #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 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=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/vendor/0000755000175100017510000000000015215513665007205 5jq-1.8.2/vendor/oniguruma/0000755000175100017510000000000015215513666011214 5jq-1.8.2/vendor/oniguruma/make_win.bat0000644000175100017510000000023615215513537013414 SET ONIG_DIR=%~dp0\src set THIS_DIR=%~dp0 set BUILD_DIR=%cd% copy %ONIG_DIR%\config.h.windows.in %BUILD_DIR%\config.h nmake -f %ONIG_DIR%\Makefile.windows %1 jq-1.8.2/vendor/oniguruma/oniguruma.pc.cmake.in0000644000175100017510000000046315215513537015152 prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=@onig_pkgconfig_libdir@ includedir=${prefix}/include datarootdir=${prefix}/share datadir=${prefix}/share Name: oniguruma Description: Regular expression library Version: @PACKAGE_VERSION@ Requires: Libs: -L${libdir} -lonig Cflags: -I${includedir} jq-1.8.2/vendor/oniguruma/README.md0000644000175100017510000002541315215513537012415 [![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/oniguruma.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#oniguruma) Oniguruma ========= ## **The only open source software attacked on Google search in Japan.** [(Issue #234)](https://github.com/kkos/oniguruma/issues/234) https://github.com/kkos/oniguruma Oniguruma is a modern and flexible regular expressions library. It encompasses features from different regular expression implementations that traditionally exist in different languages. Character encoding can be specified per regular expression object. Supported character encodings: ASCII, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, EUC-JP, EUC-TW, EUC-KR, EUC-CN, Shift_JIS, Big5, GB18030, KOI8-R, CP1251, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16 * GB18030: contributed by KUBO Takehiro * CP1251: contributed by Byte * doc/SYNTAX.md: contributed by seanofw Notice (from 6.9.6) ------------------- When using configure script, if you have the POSIX API enabled in an earlier version (disabled by default in 6.9.5) and you need application binary compatibility with the POSIX API, specify "--enable-binary-compatible-posix-api=yes" instead of "--enable-posix-api=yes". Starting in 6.9.6, "--enable-posix-api=yes" only supports source-level compatibility for 6.9.5 and earlier about POSIX API. (Issue #210) Version 6.9.10 -------------- * Update Unicode version 16.0 * Add new operator (*SKIP) * Fixed: ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS not working for ^* pattern (Issue #292) Version 6.9.9 ------------- * Update Unicode version 15.1.0 * NEW API: ONIG_OPTION_MATCH_WHOLE_STRING * Fixed: (?I) option was not enabled for character classes (Issue #264). * Changed specification to check for incorrect POSIX bracket (Issue #253). * Changed [[:punct:]] in Unicode encodings to be compatible with POSIX definition. (Issue #268) * Fixed: ONIG_OPTION_FIND_LONGEST behavior Version 6.9.8 ------------- * Update Unicode version 14.0.0 * Whole options * (?C) : ONIG_OPTION_DONT_CAPTURE_GROUP * (?I) : ONIG_OPTION_IGNORECASE_IS_ASCII * (?L) : ONIG_OPTION_FIND_LONGEST * Fixed some problems found by OSS-Fuzz Version 6.9.7 ------------- * NEW API: ONIG_OPTION_CALLBACK_EACH_MATCH * NEW API: ONIG_OPTION_IGNORECASE_IS_ASCII * NEW API: ONIG_SYNTAX_PYTHON * Fixed some problems found by OSS-Fuzz Version 6.9.6 ------------- * NEW: configure option --enable-binary-compatible-posix-api=[yes/no] * NEW API: Limiting the maximum number of calls of subexp-call * NEW API: ONIG_OPTION_NOT_BEGIN_STRING / NOT_END_STRING / NOT_BEGIN_POSITION * Fixed behavior of ONIG_OPTION_NOTBOL / NOTEOL * Fixed many problems found by OSS-Fuzz * Fixed many problems found by Coverity * Fixed CVE-2020-26159 (This turned out not to be a problem later. #221) * Under cygwin and mingw, generate and install the libonig.def file (Issue #220) License ------- BSD license. Install ------- ### Case 1: Linux distribution packages * Fedora: `dnf install oniguruma-devel` * RHEL/CentOS: `yum install oniguruma` * Debian/Ubuntu: `apt install libonig5` * Arch: `pacman -S oniguruma` * openSUSE: `zypper install oniguruma` ### Case 2: Manual compilation on Linux, Unix, and Cygwin platform 1. autoreconf -vfi (* case: configure script is not found.) 2. ./configure 3. make 4. make install * uninstall make uninstall * configuration check onig-config --cflags onig-config --libs onig-config --prefix onig-config --exec-prefix ### Case 3: Windows 64/32bit platform (Visual Studio) * build library .\make_win.bat onig_s.lib: static link library onig.dll: dynamic link library * make test programs .\make_win.bat all-test Alternatively, you can build and install oniguruma using [vcpkg](https://github.com/microsoft/vcpkg/) dependency manager: 1. git clone https://github.com/Microsoft/vcpkg.git 2. cd vcpkg 3. ./bootstrap-vcpkg.bat 4. ./vcpkg integrate install 5. ./vcpkg install oniguruma The oniguruma port in vcpkg is kept up to date by microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. Regular Expressions ------------------- See [doc/RE](doc/RE) or [doc/RE.ja](doc/RE.ja) for Japanese. Usage ----- Include oniguruma.h in your program. (Oniguruma API) See doc/API for Oniguruma API. If you want to disable UChar type (== unsigned char) definition in oniguruma.h, define ONIG_ESCAPE_UCHAR_COLLISION and then include oniguruma.h. If you want to disable regex_t type definition in oniguruma.h, define ONIG_ESCAPE_REGEX_T_COLLISION and then include oniguruma.h. Example of the compiling/linking command line in Unix or Cygwin, (prefix == /usr/local case) cc sample.c -L/usr/local/lib -lonig If you want to use static link library(onig_s.lib) in Win32, add option -DONIG_EXTERN=extern to C compiler. Sample Programs --------------- |File |Description | |:---------------------|:-----------------------------------------| |sample/callout.c |example of callouts | |sample/count.c |example of built-in callout *COUNT | |sample/echo.c |example of user defined callouts of name | |sample/encode.c |example of some encodings | |sample/listcap.c |example of the capture history | |sample/names.c |example of the named group callback | |sample/posix.c |POSIX API sample | |sample/regset.c |example of using RegSet API | |sample/scan.c |example of using onig_scan() | |sample/simple.c |example of the minimum (Oniguruma API) | |sample/sql.c |example of the variable meta characters | |sample/user_property.c|example of user defined Unicode property | Test Programs |File |Description | |:------------------|:--------------------------------------| |sample/syntax.c |Perl, Java and ASIS syntax test. | |sample/crnl.c |--enable-crnl-as-line-terminator test | Source Files ------------ |File |Description | |:------------------|:-------------------------------------------------------| |oniguruma.h |Oniguruma API header file (public) | |onig-config.in |configuration check program template | |regenc.h |character encodings framework header file | |regint.h |internal definitions | |regparse.h |internal definitions for regparse.c and regcomp.c | |regcomp.c |compiling and optimization functions | |regenc.c |character encodings framework | |regerror.c |error message function | |regext.c |extended API functions (deluxe version API) | |regexec.c |search and match functions | |regparse.c |parsing functions. | |regsyntax.c |pattern syntax functions and built-in syntax definitions| |regtrav.c |capture history tree data traverse functions | |regversion.c |version info function | |st.h |hash table functions header file | |st.c |hash table functions | |oniggnu.h |GNU regex API header file (public) | |reggnu.c |GNU regex API functions | |onigposix.h |POSIX API header file (public) | |regposerr.c |POSIX error message function | |regposix.c |POSIX API functions | |mktable.c |character type table generator | |ascii.c |ASCII encoding | |euc_jp.c |EUC-JP encoding | |euc_tw.c |EUC-TW encoding | |euc_kr.c |EUC-KR, EUC-CN encoding | |sjis.c |Shift_JIS encoding | |big5.c |Big5 encoding | |gb18030.c |GB18030 encoding | |koi8.c |KOI8 encoding | |koi8_r.c |KOI8-R encoding | |cp1251.c |CP1251 encoding | |iso8859_1.c |ISO-8859-1 (Latin-1) | |iso8859_2.c |ISO-8859-2 (Latin-2) | |iso8859_3.c |ISO-8859-3 (Latin-3) | |iso8859_4.c |ISO-8859-4 (Latin-4) | |iso8859_5.c |ISO-8859-5 (Cyrillic) | |iso8859_6.c |ISO-8859-6 (Arabic) | |iso8859_7.c |ISO-8859-7 (Greek) | |iso8859_8.c |ISO-8859-8 (Hebrew) | |iso8859_9.c |ISO-8859-9 (Latin-5 or Turkish) | |iso8859_10.c |ISO-8859-10 (Latin-6 or Nordic) | |iso8859_11.c |ISO-8859-11 (Thai) | |iso8859_13.c |ISO-8859-13 (Latin-7 or Baltic Rim) | |iso8859_14.c |ISO-8859-14 (Latin-8 or Celtic) | |iso8859_15.c |ISO-8859-15 (Latin-9 or West European with Euro) | |iso8859_16.c |ISO-8859-16 (Latin-10) | |utf8.c |UTF-8 encoding | |utf16_be.c |UTF-16BE encoding | |utf16_le.c |UTF-16LE encoding | |utf32_be.c |UTF-32BE encoding | |utf32_le.c |UTF-32LE encoding | |unicode.c |common codes of Unicode encoding | |unicode_fold_data.c|Unicode folding data | |windows/testc.c |Test program for Windows (VC++) | jq-1.8.2/vendor/oniguruma/index_ja.html0000644000175100017510000002077015215513537013606 鬼車

鬼車

(c) K.Kosako, 最終更新: 2019/08/05

更新情報
  • 2019/08/06: Version 6.9.3 リリース
  • 2019/05/07: Version 6.9.2 リリース
  • 2018/12/11: Version 6.9.1 リリース
  • 2018/09/03: Version 6.9.0 リリース
  • 2018/04/17: Version 6.8.2 リリース
  • 2018/03/19: Version 6.8.1 リリース
  • 2018/03/16: Version 6.8.0 リリース
  • 2018/01/26: Version 6.7.1 リリース
  • 2017/12/11: Version 6.7.0 リリース
  • 2017/08/30: Version 6.6.1 リリース
  • 2017/08/28: Version 6.6.0 リリース
  • 2017/08/03: Version 6.5.0 リリース
  • 2017/07/03: Version 6.4.0 リリース
  • 2017/05/29: Version 6.3.0 リリース
  • 2017/04/08: Version 6.2.0 リリース
  • 2016/12/11: Version 6.1.3 リリース

鬼車は正規表現ライブラリである。
このライブラリの特徴は、それぞれの正規表現オブジェクトごとに異なる文字エンコーディングを 指定できること。
(API: GNU regex, POSIX and Oniguruma native)

対応している文字エンコーディング:
ASCII, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE,
EUC-JP, EUC-TW, EUC-KR, EUC-CN,
Shift_JIS, Big5, GB18030, KOI8-R, CP1251,
ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5,
ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10,
ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16
(GB18030は、KUBO Takehiro氏提供)
(CP1251は、Byte氏提供)


ライセンス:BSDライセンス
プラットフォーム:
  • Unix (Mac OS Xを含む)
  • Cygwin
  • Win32

2.xの保守担当は、Hannes Wyss <hwyss AT ywesee.com>に交替しました。
2.xについては、彼に連絡してください。
* 5.xはUnicode Property/Scriptを提供
* 2.xはRuby1.6/1.8組込みライブラリとして動作する。 (2006年末で保守を終了)

ドキュメント: (version 6.1.0)
サンプルプログラム:
サイト:
リンク:
参考資料:

and I'm thankful to Akinori MUSHA.


他のライブラリ:

ホームにもどる jq-1.8.2/vendor/oniguruma/cmake/0000755000175100017510000000000015215513665012273 5jq-1.8.2/vendor/oniguruma/cmake/Config.cmake.in0000644000175100017510000000017515215513537015030 @PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") check_required_components("@PROJECT_NAME@") jq-1.8.2/vendor/oniguruma/src/0000755000175100017510000000000015215513666012003 5jq-1.8.2/vendor/oniguruma/src/sjis_prop.c0000644000175100017510000001231315215513537014074 /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -pt -T -L ANSI-C -N onigenc_sjis_lookup_property_name --output-file gperf2.tmp sjis_prop.gperf */ /* Computed positions: -k'1,3' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 1 "sjis_prop.gperf" #include "regint.h" #define TOTAL_KEYWORDS 16 #define MIN_WORD_LENGTH 4 #define MAX_WORD_LENGTH 8 #define MIN_HASH_VALUE 4 #define MAX_HASH_VALUE 55 /* maximum key range = 52, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (register const char *str, register size_t len) { static unsigned char asso_values[] = { 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 0, 3, 10, 25, 56, 56, 30, 0, 56, 56, 0, 20, 56, 56, 56, 15, 56, 56, 20, 56, 30, 56, 0, 0, 56, 56, 56, 56, 56, 56, 56, 56, 15, 56, 56, 56, 56, 56, 25, 56, 10, 56, 56, 56, 56, 5, 56, 0, 56, 0, 56, 5, 56, 56, 20, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56 }; return (unsigned int )len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]]; } struct PropertyNameCtype * onigenc_sjis_lookup_property_name (register const char *str, register size_t len) { static struct PropertyNameCtype wordlist[] = { {""}, {""}, {""}, {""}, #line 22 "sjis_prop.gperf" {"Word", 12}, #line 11 "sjis_prop.gperf" {"Alpha", 1}, {""}, {""}, #line 25 "sjis_prop.gperf" {"Hiragana", 15}, {""}, #line 23 "sjis_prop.gperf" {"Alnum", 13}, {""}, {""}, #line 26 "sjis_prop.gperf" {"Katakana", 16}, {""}, #line 24 "sjis_prop.gperf" {"ASCII", 14}, #line 21 "sjis_prop.gperf" {"XDigit", 11}, {""}, {""}, {""}, #line 13 "sjis_prop.gperf" {"Cntrl", 3}, {""}, {""}, #line 12 "sjis_prop.gperf" {"Blank", 2}, {""}, #line 18 "sjis_prop.gperf" {"Punct", 8}, {""}, {""}, {""}, {""}, #line 17 "sjis_prop.gperf" {"Print", 7}, {""}, {""}, {""}, {""}, #line 20 "sjis_prop.gperf" {"Upper", 10}, {""}, {""}, {""}, {""}, #line 19 "sjis_prop.gperf" {"Space", 9}, {""}, {""}, {""}, {""}, #line 16 "sjis_prop.gperf" {"Lower", 6}, {""}, {""}, {""}, {""}, #line 15 "sjis_prop.gperf" {"Graph", 5}, {""}, {""}, {""}, {""}, #line 14 "sjis_prop.gperf" {"Digit", 4} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash (str, len); if (key <= MAX_HASH_VALUE) { register const char *s = wordlist[key].name; if (*str == *s && !strcmp (str + 1, s + 1)) return &wordlist[key]; } } return 0; } jq-1.8.2/vendor/oniguruma/src/reggnu.c0000644000175100017510000001001015215513537013343 /********************************************************************** reggnu.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #include "oniggnu.h" extern void re_free_registers(OnigRegion* r) { /* 0: don't free self */ onig_region_free(r, 0); } extern int re_adjust_startpos(regex_t* reg, const char* string, int size, int startpos, int range) { if (startpos > 0 && ONIGENC_MBC_MAXLEN(reg->enc) != 1 && startpos < size) { UChar *p; UChar *s = (UChar* )string + startpos; if (range > 0) { p = onigenc_get_right_adjust_char_head(reg->enc, (UChar* )string, s); } else { p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, (UChar* )string, s); } return (int )(p - (UChar* )string); } return startpos; } extern int re_match(regex_t* reg, const char* str, int size, int pos, struct re_registers* regs) { return onig_match(reg, (UChar* )str, (UChar* )(str + size), (UChar* )(str + pos), regs, ONIG_OPTION_NONE); } extern int re_search(regex_t* bufp, const char* string, int size, int startpos, int range, struct re_registers* regs) { return onig_search(bufp, (UChar* )string, (UChar* )(string + size), (UChar* )(string + startpos), (UChar* )(string + startpos + range), regs, ONIG_OPTION_NONE); } extern int re_compile_pattern(const char* pattern, int size, regex_t* reg, char* ebuf) { int r; OnigErrorInfo einfo; r = onig_compile(reg, (UChar* )pattern, (UChar* )(pattern + size), &einfo); if (r != ONIG_NORMAL) { if (IS_NOT_NULL(ebuf)) (void )onig_error_code_to_str((UChar* )ebuf, r, &einfo); } return r; } extern void re_free_pattern(regex_t* reg) { onig_free(reg); } extern int re_alloc_pattern(regex_t** reg) { *reg = (regex_t* )xmalloc(sizeof(regex_t)); if (IS_NULL(*reg)) return ONIGERR_MEMORY; return onig_reg_init(*reg, ONIG_OPTION_DEFAULT, ONIGENC_CASE_FOLD_DEFAULT, OnigEncDefaultCharEncoding, OnigDefaultSyntax); } extern void re_set_casetable(const char* table) { onigenc_set_default_caseconv_table((UChar* )table); } extern void re_mbcinit(int mb_code) { OnigEncoding enc; switch (mb_code) { case RE_MBCTYPE_ASCII: enc = ONIG_ENCODING_ASCII; break; case RE_MBCTYPE_EUC: enc = ONIG_ENCODING_EUC_JP; break; case RE_MBCTYPE_SJIS: enc = ONIG_ENCODING_SJIS; break; case RE_MBCTYPE_UTF8: enc = ONIG_ENCODING_UTF8; break; default: return ; break; } onig_initialize(&enc, 1); onigenc_set_default_encoding(enc); } jq-1.8.2/vendor/oniguruma/src/config.h.win320000644000175100017510000000243015215513537014276 #if defined(__MINGW32__) || _MSC_VER >= 1600 #define HAVE_STDINT_H 1 #endif #if defined(__MINGW32__) || _MSC_VER >= 1800 #define HAVE_INTTYPES_H 1 #endif #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_MEMORY_H 1 #define HAVE_OFF_T 1 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 #define SIZEOF_LONG_LONG 8 #define SIZEOF___INT64 8 #define SIZEOF_OFF_T 4 #define SIZEOF_VOIDP 4 #define SIZEOF_FLOAT 4 #define SIZEOF_DOUBLE 8 #define SIZEOF_SIZE_T 4 #define TOKEN_PASTE(x,y) x##y #ifndef NORETURN #if _MSC_VER > 1100 #define NORETURN(x) __declspec(noreturn) x #else #define NORETURN(x) x #endif #endif #define HAVE_DECL_SYS_NERR 1 #define HAVE_FCNTL_H 1 #define HAVE_SYS_UTIME_H 1 #define HAVE_MEMORY_H 1 #define uid_t int #define gid_t int #define GETGROUPS_T int #define HAVE_ALLOCA 1 #define HAVE_DUP2 1 #define HAVE_MKDIR 1 #define HAVE_FLOCK 1 #define HAVE_FINITE 1 #define HAVE_HYPOT 1 #define HAVE_WAITPID 1 #define HAVE_CHSIZE 1 #define HAVE_TIMES 1 #define HAVE_TELLDIR 1 #define HAVE_SEEKDIR 1 #define HAVE_EXECVE 1 #define HAVE_DAYLIGHT 1 #define SETPGRP_VOID 1 #define inline __inline #define NEED_IO_SEEK_BETWEEN_RW 1 #define RSHIFT(x,y) ((x)>>(int)y) #define FILE_COUNT _cnt #define FILE_READPTR _ptr #define DEFAULT_KCODE KCODE_NONE #define DLEXT ".so" #define DLEXT2 ".dll" jq-1.8.2/vendor/oniguruma/src/st.h0000644000175100017510000000326515215513537012525 /* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */ /* @(#) st.h 5.1 89/12/14 */ #ifndef ST_INCLUDED #define ST_INCLUDED #if SIZEOF_VOIDP == SIZEOF_LONG typedef unsigned long st_data_t; #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG typedef unsigned long long st_data_t; #endif #define ST_DATA_T_DEFINED typedef struct st_table st_table; struct st_hash_type { int (*compare)(st_data_t, st_data_t); int (*hash)(st_data_t); }; struct st_table { struct st_hash_type *type; int num_bins; int num_entries; struct st_table_entry **bins; }; #define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0) enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK}; #ifndef _ # define _(args) args #endif st_table *st_init_table _((struct st_hash_type *)); st_table *st_init_table_with_size _((struct st_hash_type *, int)); st_table *st_init_numtable _((void)); st_table *st_init_numtable_with_size _((int)); st_table *st_init_strtable _((void)); st_table *st_init_strtable_with_size _((int)); int st_delete _((st_table *, st_data_t *, st_data_t *)); int st_delete_safe _((st_table *, st_data_t *, st_data_t *, st_data_t)); int st_insert _((st_table *, st_data_t, st_data_t)); int st_lookup _((st_table *, st_data_t, st_data_t *)); int st_foreach _((st_table *, int (*)(st_data_t, st_data_t, st_data_t), st_data_t)); void st_add_direct _((st_table *, st_data_t, st_data_t)); void st_free_table _((st_table *)); void st_cleanup_safe _((st_table *, st_data_t)); st_table *st_copy _((st_table *)); #define ST_NUMCMP ((int (*)()) 0) #define ST_NUMHASH ((int (*)()) -2) #define st_numcmp ST_NUMCMP #define st_numhash ST_NUMHASH #endif /* ST_INCLUDED */ jq-1.8.2/vendor/oniguruma/src/iso8859_6.c0000644000175100017510000001131315215513537013440 /********************************************************************** iso8859_6.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_IS_ISO_8859_6_CTYPE(code,ctype) \ ((EncISO_8859_6_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const unsigned short EncISO_8859_6_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x0000, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01a0, 0x01a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01a0, 0x0000, 0x0000, 0x0000, 0x01a0, 0x0000, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_6_CTYPE(code, ctype); else return FALSE; } OnigEncodingType OnigEncodingISO_8859_6 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-6", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, onigenc_ascii_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/regtrav.c0000644000175100017510000000544315215513537013544 /********************************************************************** regtrav.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #ifdef USE_CAPTURE_HISTORY static int capture_tree_traverse(OnigCaptureTreeNode* node, int at, int(*callback_func)(int,int,int,int,int,void*), int level, void* arg) { int r, i; if (node == (OnigCaptureTreeNode* )0) return 0; if ((at & ONIG_TRAVERSE_CALLBACK_AT_FIRST) != 0) { r = (*callback_func)(node->group, node->beg, node->end, level, ONIG_TRAVERSE_CALLBACK_AT_FIRST, arg); if (r != 0) return r; } for (i = 0; i < node->num_childs; i++) { r = capture_tree_traverse(node->childs[i], at, callback_func, level + 1, arg); if (r != 0) return r; } if ((at & ONIG_TRAVERSE_CALLBACK_AT_LAST) != 0) { r = (*callback_func)(node->group, node->beg, node->end, level, ONIG_TRAVERSE_CALLBACK_AT_LAST, arg); if (r != 0) return r; } return 0; } #endif /* USE_CAPTURE_HISTORY */ extern int onig_capture_tree_traverse(OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg) { #ifdef USE_CAPTURE_HISTORY return capture_tree_traverse(region->history_root, at, callback_func, 0, arg); #else return ONIG_NO_SUPPORT_CONFIG; #endif } jq-1.8.2/vendor/oniguruma/src/regexec.c0000644000175100017510000051247115215513537013520 /********************************************************************** regexec.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #ifndef ONIG_NO_PRINT #ifndef NEED_TO_INCLUDE_STDIO #define NEED_TO_INCLUDE_STDIO #endif #endif #include "regint.h" #define IS_MBC_WORD_ASCII_MODE(enc,s,end,mode) \ ((mode) == 0 ? ONIGENC_IS_MBC_WORD(enc,s,end) : ONIGENC_IS_MBC_WORD_ASCII(enc,s,end)) #ifdef USE_CRNL_AS_LINE_TERMINATOR #define ONIGENC_IS_MBC_CRNL(enc,p,end) \ (ONIGENC_MBC_TO_CODE(enc,p,end) == 13 && \ ONIGENC_IS_MBC_NEWLINE(enc,(p+enclen(enc,p)),end)) #endif #define CHECK_INTERRUPT_IN_MATCH #define STACK_MEM_START(reg, idx) \ (MEM_STATUS_AT((reg)->push_mem_start, (idx)) != 0 ? \ STACK_AT(mem_start_stk[idx].i)->u.mem.pstr : mem_start_stk[idx].s) #define STACK_MEM_END(reg, idx) \ (MEM_STATUS_AT((reg)->push_mem_end, (idx)) != 0 ? \ STACK_AT(mem_end_stk[idx].i)->u.mem.pstr : mem_end_stk[idx].s) #ifdef _MSC_VER #define DIST_CAST(d) (size_t )(d) #else #define DIST_CAST(d) (d) #endif static int forward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* start, UChar* range, UChar** low, UChar** high); static int search_in_range(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, /* match range */ const UChar* data_range, /* subject string range */ OnigRegion* region, OnigOptionType option, OnigMatchParam* mp); #ifdef USE_CALLOUT typedef struct { int last_match_at_call_counter; struct { OnigType type; OnigValue val; } slot[ONIG_CALLOUT_DATA_SLOT_NUM]; } CalloutData; #endif struct OnigMatchParamStruct { unsigned int match_stack_limit; #ifdef USE_RETRY_LIMIT unsigned long retry_limit_in_match; unsigned long retry_limit_in_search; #endif void* callout_user_data; /* used in callback each match */ #ifdef USE_CALLOUT OnigCalloutFunc progress_callout_of_contents; OnigCalloutFunc retraction_callout_of_contents; int match_at_call_counter; CalloutData* callout_data; int callout_data_alloc_num; #endif }; extern int onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* param, unsigned int limit) { param->match_stack_limit = limit; return ONIG_NORMAL; } extern int onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* param, unsigned long limit) { #ifdef USE_RETRY_LIMIT param->retry_limit_in_match = limit; return ONIG_NORMAL; #else return ONIG_NO_SUPPORT_CONFIG; #endif } extern int onig_set_retry_limit_in_search_of_match_param(OnigMatchParam* param, unsigned long limit) { #ifdef USE_RETRY_LIMIT param->retry_limit_in_search = limit; return ONIG_NORMAL; #else return ONIG_NO_SUPPORT_CONFIG; #endif } extern int onig_set_progress_callout_of_match_param(OnigMatchParam* param, OnigCalloutFunc f) { #ifdef USE_CALLOUT param->progress_callout_of_contents = f; return ONIG_NORMAL; #else return ONIG_NO_SUPPORT_CONFIG; #endif } extern int onig_set_retraction_callout_of_match_param(OnigMatchParam* param, OnigCalloutFunc f) { #ifdef USE_CALLOUT param->retraction_callout_of_contents = f; return ONIG_NORMAL; #else return ONIG_NO_SUPPORT_CONFIG; #endif } extern int onig_set_callout_user_data_of_match_param(OnigMatchParam* param, void* user_data) { param->callout_user_data = user_data; return ONIG_NORMAL; } typedef struct { void* stack_p; int stack_n; OnigOptionType options; OnigRegion* region; int ptr_num; const UChar* start; /* search start position (for \G: BEGIN_POSITION) */ unsigned int match_stack_limit; #ifdef USE_RETRY_LIMIT unsigned long retry_limit_in_match; unsigned long retry_limit_in_search; unsigned long retry_limit_in_search_counter; #endif OnigMatchParam* mp; #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE int best_len; /* for ONIG_OPTION_FIND_LONGEST */ UChar* best_s; #endif #ifdef USE_CALL unsigned long subexp_call_in_search_counter; #endif #ifdef USE_SKIP_SEARCH UChar* skip_search; #endif } MatchArg; #if defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) || defined(ONIG_DEBUG_STATISTICS) typedef struct { short int opcode; char* name; } OpInfoType; static OpInfoType OpInfo[] = { { OP_FINISH, "finish"}, { OP_END, "end"}, { OP_STR_1, "str_1"}, { OP_STR_2, "str_2"}, { OP_STR_3, "str_3"}, { OP_STR_4, "str_4"}, { OP_STR_5, "str_5"}, { OP_STR_N, "str_n"}, { OP_STR_MB2N1, "str_mb2-n1"}, { OP_STR_MB2N2, "str_mb2-n2"}, { OP_STR_MB2N3, "str_mb2-n3"}, { OP_STR_MB2N, "str_mb2-n"}, { OP_STR_MB3N, "str_mb3n"}, { OP_STR_MBN, "str_mbn"}, { OP_CCLASS, "cclass"}, { OP_CCLASS_MB, "cclass-mb"}, { OP_CCLASS_MIX, "cclass-mix"}, { OP_CCLASS_NOT, "cclass-not"}, { OP_CCLASS_MB_NOT, "cclass-mb-not"}, { OP_CCLASS_MIX_NOT, "cclass-mix-not"}, { OP_ANYCHAR, "anychar"}, { OP_ANYCHAR_ML, "anychar-ml"}, { OP_ANYCHAR_STAR, "anychar*"}, { OP_ANYCHAR_ML_STAR, "anychar-ml*"}, { OP_ANYCHAR_STAR_PEEK_NEXT, "anychar*-peek-next"}, { OP_ANYCHAR_ML_STAR_PEEK_NEXT, "anychar-ml*-peek-next"}, { OP_WORD, "word"}, { OP_WORD_ASCII, "word-ascii"}, { OP_NO_WORD, "not-word"}, { OP_NO_WORD_ASCII, "not-word-ascii"}, { OP_WORD_BOUNDARY, "word-boundary"}, { OP_NO_WORD_BOUNDARY, "not-word-boundary"}, { OP_WORD_BEGIN, "word-begin"}, { OP_WORD_END, "word-end"}, { OP_TEXT_SEGMENT_BOUNDARY, "text-segment-boundary"}, { OP_BEGIN_BUF, "begin-buf"}, { OP_END_BUF, "end-buf"}, { OP_BEGIN_LINE, "begin-line"}, { OP_END_LINE, "end-line"}, { OP_SEMI_END_BUF, "semi-end-buf"}, { OP_CHECK_POSITION, "check-position"}, { OP_BACKREF1, "backref1"}, { OP_BACKREF2, "backref2"}, { OP_BACKREF_N, "backref-n"}, { OP_BACKREF_N_IC, "backref-n-ic"}, { OP_BACKREF_MULTI, "backref_multi"}, { OP_BACKREF_MULTI_IC, "backref_multi-ic"}, { OP_BACKREF_WITH_LEVEL, "backref_with_level"}, { OP_BACKREF_WITH_LEVEL_IC, "backref_with_level-c"}, { OP_BACKREF_CHECK, "backref_check"}, { OP_BACKREF_CHECK_WITH_LEVEL, "backref_check_with_level"}, { OP_MEM_START_PUSH, "mem-start-push"}, { OP_MEM_START, "mem-start"}, { OP_MEM_END_PUSH, "mem-end-push"}, #ifdef USE_CALL { OP_MEM_END_PUSH_REC, "mem-end-push-rec"}, #endif { OP_MEM_END, "mem-end"}, #ifdef USE_CALL { OP_MEM_END_REC, "mem-end-rec"}, #endif { OP_FAIL, "fail"}, { OP_JUMP, "jump"}, { OP_PUSH, "push"}, { OP_PUSH_SUPER, "push-super"}, { OP_POP, "pop"}, { OP_POP_TO_MARK, "pop-to-mark"}, #ifdef USE_OP_PUSH_OR_JUMP_EXACT { OP_PUSH_OR_JUMP_EXACT1, "push-or-jump-e1"}, #endif { OP_PUSH_IF_PEEK_NEXT, "push-if-peek-next"}, { OP_REPEAT, "repeat"}, { OP_REPEAT_NG, "repeat-ng"}, { OP_REPEAT_INC, "repeat-inc"}, { OP_REPEAT_INC_NG, "repeat-inc-ng"}, { OP_EMPTY_CHECK_START, "empty-check-start"}, { OP_EMPTY_CHECK_END, "empty-check-end"}, { OP_EMPTY_CHECK_END_MEMST, "empty-check-end-memst"}, #ifdef USE_CALL { OP_EMPTY_CHECK_END_MEMST_PUSH,"empty-check-end-memst-push"}, #endif { OP_MOVE, "move"}, { OP_STEP_BACK_START, "step-back-start"}, { OP_STEP_BACK_NEXT, "step-back-next"}, { OP_CUT_TO_MARK, "cut-to-mark"}, { OP_MARK, "mark"}, { OP_SAVE_VAL, "save-val"}, { OP_UPDATE_VAR, "update-var"}, #ifdef USE_CALL { OP_CALL, "call"}, { OP_RETURN, "return"}, #endif #ifdef USE_CALLOUT { OP_CALLOUT_CONTENTS, "callout-contents"}, { OP_CALLOUT_NAME, "callout-name"}, #endif { -1, ""} }; #endif #if defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) /* arguments type */ typedef enum { ARG_SPECIAL = -1, ARG_NON = 0, ARG_RELADDR = 1, ARG_ABSADDR = 2, ARG_LENGTH = 3, ARG_MEMNUM = 4, ARG_OPTION = 5, ARG_MODE = 6 } OpArgType; static char* op2name(int opcode) { int i; for (i = 0; OpInfo[i].opcode >= 0; i++) { if (opcode == OpInfo[i].opcode) return OpInfo[i].name; } return ""; } static void p_after_op(FILE* f) { fputs(" ", f); } static void p_string(FILE* f, int len, UChar* s) { while (len-- > 0) { fputc(*s++, f); } } static void p_len_string(FILE* f, LengthType len, int mb_len, UChar* s) { int x = len * mb_len; fprintf(f, "len:%d ", len); while (x-- > 0) { fputc(*s++, f); } } static void p_rel_addr(FILE* f, RelAddrType rel_addr, Operation* p, Operation* start) { char* flag; char* space1; char* space2; RelAddrType curr; AbsAddrType abs_addr; curr = (RelAddrType )(p - start); abs_addr = curr + rel_addr; flag = rel_addr < 0 ? "" : "+"; space1 = rel_addr < 10 ? " " : ""; space2 = abs_addr < 10 ? " " : ""; fprintf(f, "%s%s%d => %s%d", space1, flag, rel_addr, space2, abs_addr); } static int bitset_on_num(BitSetRef bs) { int i, n; n = 0; for (i = 0; i < SINGLE_BYTE_SIZE; i++) { if (BITSET_AT(bs, i)) n++; } return n; } #ifdef USE_DIRECT_THREADED_CODE #define GET_OPCODE(reg,index) (reg)->ocs[index] #else #define GET_OPCODE(reg,index) (reg)->ops[index].opcode #endif static void print_compiled_byte_code(FILE* f, regex_t* reg, int index, Operation* start, OnigEncoding enc) { static char* SaveTypeNames[] = { "KEEP", "S", "RIGHT_RANGE" }; static char* UpdateVarTypeNames[] = { "KEEP_FROM_STACK_LAST", "S_FROM_STACK", "RIGHT_RANGE_FROM_STACK", "RIGHT_RANGE_FROM_S_STACK", "RIGHT_RANGE_TO_S", "RIGHT_RANGE_INIT" }; int i, n; RelAddrType addr; LengthType len; MemNumType mem; OnigCodePoint code; ModeType mode; UChar *q; Operation* p; enum OpCode opcode; p = reg->ops + index; opcode = GET_OPCODE(reg, index); fprintf(f, "%s", op2name(opcode)); p_after_op(f); switch (opcode) { case OP_STR_1: p_string(f, 1, p->exact.s); break; case OP_STR_2: p_string(f, 2, p->exact.s); break; case OP_STR_3: p_string(f, 3, p->exact.s); break; case OP_STR_4: p_string(f, 4, p->exact.s); break; case OP_STR_5: p_string(f, 5, p->exact.s); break; case OP_STR_N: len = p->exact_n.n; p_string(f, len, p->exact_n.s); break; case OP_STR_MB2N1: p_string(f, 2, p->exact.s); break; case OP_STR_MB2N2: p_string(f, 4, p->exact.s); break; case OP_STR_MB2N3: p_string(f, 3, p->exact.s); break; case OP_STR_MB2N: len = p->exact_n.n; p_len_string(f, len, 2, p->exact_n.s); break; case OP_STR_MB3N: len = p->exact_n.n; p_len_string(f, len, 3, p->exact_n.s); break; case OP_STR_MBN: { int mb_len; mb_len = p->exact_len_n.len; len = p->exact_len_n.n; q = p->exact_len_n.s; fprintf(f, "mblen:%d len:%d ", mb_len, len); n = len * mb_len; while (n-- > 0) { fputc(*q++, f); } } break; case OP_CCLASS: case OP_CCLASS_NOT: n = bitset_on_num(p->cclass.bsp); fprintf(f, "n:%d", n); break; case OP_CCLASS_MB: case OP_CCLASS_MB_NOT: { OnigCodePoint ncode; OnigCodePoint* codes; codes = (OnigCodePoint* )p->cclass_mb.mb; GET_CODE_POINT(ncode, codes); codes++; GET_CODE_POINT(code, codes); fprintf(f, "n:%d code:0x%x", ncode, code); } break; case OP_CCLASS_MIX: case OP_CCLASS_MIX_NOT: { OnigCodePoint ncode; OnigCodePoint* codes; codes = (OnigCodePoint* )p->cclass_mix.mb; n = bitset_on_num(p->cclass_mix.bsp); GET_CODE_POINT(ncode, codes); codes++; GET_CODE_POINT(code, codes); fprintf(f, "nsg:%d code:%u nmb:%u", n, code, ncode); } break; case OP_ANYCHAR_STAR_PEEK_NEXT: case OP_ANYCHAR_ML_STAR_PEEK_NEXT: p_string(f, 1, &(p->anychar_star_peek_next.c)); break; case OP_WORD_BOUNDARY: case OP_NO_WORD_BOUNDARY: case OP_WORD_BEGIN: case OP_WORD_END: mode = p->word_boundary.mode; fprintf(f, "mode:%d", mode); break; case OP_BACKREF_N: case OP_BACKREF_N_IC: mem = p->backref_n.n1; fprintf(f, "n:%d", mem); break; case OP_BACKREF_MULTI_IC: case OP_BACKREF_MULTI: case OP_BACKREF_CHECK: n = p->backref_general.num; fprintf(f, "n:%d ", n); for (i = 0; i < n; i++) { mem = (n == 1) ? p->backref_general.n1 : p->backref_general.ns[i]; if (i > 0) fputs(", ", f); fprintf(f, "%d", mem); } break; case OP_BACKREF_WITH_LEVEL: case OP_BACKREF_WITH_LEVEL_IC: case OP_BACKREF_CHECK_WITH_LEVEL: { LengthType level; level = p->backref_general.nest_level; fprintf(f, "level:%d ", level); n = p->backref_general.num; for (i = 0; i < n; i++) { mem = (n == 1) ? p->backref_general.n1 : p->backref_general.ns[i]; if (i > 0) fputs(", ", f); fprintf(f, "%d", mem); } } break; case OP_MEM_START: case OP_MEM_START_PUSH: mem = p->memory_start.num; fprintf(f, "mem:%d", mem); break; case OP_MEM_END: case OP_MEM_END_PUSH: #ifdef USE_CALL case OP_MEM_END_REC: case OP_MEM_END_PUSH_REC: #endif mem = p->memory_end.num; fprintf(f, "mem:%d", mem); break; case OP_JUMP: addr = p->jump.addr; p_rel_addr(f, addr, p, start); break; case OP_PUSH: case OP_PUSH_SUPER: addr = p->push.addr; p_rel_addr(f, addr, p, start); break; #ifdef USE_OP_PUSH_OR_JUMP_EXACT case OP_PUSH_OR_JUMP_EXACT1: addr = p->push_or_jump_exact1.addr; p_rel_addr(f, addr, p, start); fprintf(f, " c:"); p_string(f, 1, &(p->push_or_jump_exact1.c)); break; #endif case OP_PUSH_IF_PEEK_NEXT: addr = p->push_if_peek_next.addr; p_rel_addr(f, addr, p, start); fprintf(f, " c:"); p_string(f, 1, &(p->push_if_peek_next.c)); break; case OP_REPEAT: case OP_REPEAT_NG: mem = p->repeat.id; addr = p->repeat.addr; fprintf(f, "id:%d ", mem); p_rel_addr(f, addr, p, start); break; case OP_REPEAT_INC: case OP_REPEAT_INC_NG: mem = p->repeat.id; fprintf(f, "id:%d", mem); break; case OP_EMPTY_CHECK_START: mem = p->empty_check_start.mem; fprintf(f, "id:%d", mem); break; case OP_EMPTY_CHECK_END: case OP_EMPTY_CHECK_END_MEMST: #ifdef USE_CALL case OP_EMPTY_CHECK_END_MEMST_PUSH: #endif mem = p->empty_check_end.mem; fprintf(f, "id:%d", mem); break; #ifdef USE_CALL case OP_CALL: addr = p->call.addr; fprintf(f, "=> %d", addr); break; #endif case OP_MOVE: fprintf(f, "n:%d", p->move.n); break; case OP_STEP_BACK_START: addr = p->step_back_start.addr; fprintf(f, "init:%d rem:%d ", p->step_back_start.initial, p->step_back_start.remaining); p_rel_addr(f, addr, p, start); break; case OP_POP_TO_MARK: mem = p->pop_to_mark.id; fprintf(f, "id:%d", mem); break; case OP_CUT_TO_MARK: { int restore; mem = p->cut_to_mark.id; restore = p->cut_to_mark.restore_pos; fprintf(f, "id:%d restore:%d", mem, restore); } break; case OP_MARK: { int save; mem = p->mark.id; save = p->mark.save_pos; fprintf(f, "id:%d save:%d", mem, save); } break; case OP_SAVE_VAL: { SaveType type; type = p->save_val.type; mem = p->save_val.id; fprintf(f, "%s id:%d", SaveTypeNames[type], mem); } break; case OP_UPDATE_VAR: { UpdateVarType type; int clear; type = p->update_var.type; mem = p->update_var.id; clear = p->update_var.clear; fprintf(f, "%s id:%d", UpdateVarTypeNames[type], mem); if (type == UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK || type == UPDATE_VAR_RIGHT_RANGE_FROM_STACK) fprintf(f, " clear:%d", clear); } break; #ifdef USE_CALLOUT case OP_CALLOUT_CONTENTS: mem = p->callout_contents.num; fprintf(f, "num:%d", mem); break; case OP_CALLOUT_NAME: { int id; id = p->callout_name.id; mem = p->callout_name.num; fprintf(f, "id:%d num:%d", id, mem); } break; #endif case OP_TEXT_SEGMENT_BOUNDARY: if (p->text_segment_boundary.not != 0) fprintf(f, " not"); break; case OP_CHECK_POSITION: switch (p->check_position.type) { case CHECK_POSITION_SEARCH_START: fprintf(f, "search-start"); break; case CHECK_POSITION_CURRENT_RIGHT_RANGE: fprintf(f, "current-right-range"); break; default: break; }; break; case OP_FINISH: case OP_END: case OP_ANYCHAR: case OP_ANYCHAR_ML: case OP_ANYCHAR_STAR: case OP_ANYCHAR_ML_STAR: case OP_WORD: case OP_WORD_ASCII: case OP_NO_WORD: case OP_NO_WORD_ASCII: case OP_BEGIN_BUF: case OP_END_BUF: case OP_BEGIN_LINE: case OP_END_LINE: case OP_SEMI_END_BUF: case OP_BACKREF1: case OP_BACKREF2: case OP_FAIL: case OP_POP: case OP_STEP_BACK_NEXT: #ifdef USE_CALL case OP_RETURN: #endif break; default: fprintf(DBGFP, "print_compiled_byte_code: undefined code %d\n", opcode); break; } } #endif /* defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) */ #ifdef ONIG_DEBUG_COMPILE extern void onig_print_compiled_byte_code_list(FILE* f, regex_t* reg) { Operation* bp; Operation* start = reg->ops; Operation* end = reg->ops + reg->ops_used; fprintf(f, "push_mem_start: 0x%x, push_mem_end: 0x%x\n", reg->push_mem_start, reg->push_mem_end); fprintf(f, "code-length: %d\n", reg->ops_used); bp = start; while (bp < end) { int pos = bp - start; fprintf(f, "%4d: ", pos); print_compiled_byte_code(f, reg, pos, start, reg->enc); fprintf(f, "\n"); bp++; } fprintf(f, "\n"); } #endif #ifdef USE_CAPTURE_HISTORY static void history_tree_free(OnigCaptureTreeNode* node); static void history_tree_clear(OnigCaptureTreeNode* node) { int i; if (IS_NULL(node)) return ; for (i = 0; i < node->num_childs; i++) { if (IS_NOT_NULL(node->childs[i])) { history_tree_free(node->childs[i]); } } for (i = 0; i < node->allocated; i++) { node->childs[i] = (OnigCaptureTreeNode* )0; } node->num_childs = 0; node->beg = ONIG_REGION_NOTPOS; node->end = ONIG_REGION_NOTPOS; node->group = -1; } static void history_tree_free(OnigCaptureTreeNode* node) { history_tree_clear(node); if (IS_NOT_NULL(node->childs)) xfree(node->childs); xfree(node); } static void history_root_free(OnigRegion* r) { if (IS_NULL(r->history_root)) return ; history_tree_free(r->history_root); r->history_root = (OnigCaptureTreeNode* )0; } static OnigCaptureTreeNode* history_node_new(void) { OnigCaptureTreeNode* node; node = (OnigCaptureTreeNode* )xmalloc(sizeof(OnigCaptureTreeNode)); CHECK_NULL_RETURN(node); node->childs = (OnigCaptureTreeNode** )0; node->allocated = 0; node->num_childs = 0; node->group = -1; node->beg = ONIG_REGION_NOTPOS; node->end = ONIG_REGION_NOTPOS; return node; } static int history_tree_add_child(OnigCaptureTreeNode* parent, OnigCaptureTreeNode* child) { #define HISTORY_TREE_INIT_ALLOC_SIZE 8 if (parent->num_childs >= parent->allocated) { int n, i; if (IS_NULL(parent->childs)) { n = HISTORY_TREE_INIT_ALLOC_SIZE; parent->childs = (OnigCaptureTreeNode** )xmalloc(sizeof(parent->childs[0]) * n); } else { n = parent->allocated * 2; parent->childs = (OnigCaptureTreeNode** )xrealloc(parent->childs, sizeof(parent->childs[0]) * n); } CHECK_NULL_RETURN_MEMERR(parent->childs); for (i = parent->allocated; i < n; i++) { parent->childs[i] = (OnigCaptureTreeNode* )0; } parent->allocated = n; } parent->childs[parent->num_childs] = child; parent->num_childs++; return 0; } static OnigCaptureTreeNode* history_tree_clone(OnigCaptureTreeNode* node) { int i; OnigCaptureTreeNode *clone, *child; clone = history_node_new(); CHECK_NULL_RETURN(clone); clone->beg = node->beg; clone->end = node->end; for (i = 0; i < node->num_childs; i++) { child = history_tree_clone(node->childs[i]); if (IS_NULL(child)) { history_tree_free(clone); return (OnigCaptureTreeNode* )0; } history_tree_add_child(clone, child); } return clone; } extern OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region) { return region->history_root; } #endif /* USE_CAPTURE_HISTORY */ static OnigCallbackEachMatchFunc CallbackEachMatch; extern OnigCallbackEachMatchFunc onig_get_callback_each_match(void) { return CallbackEachMatch; } extern int onig_set_callback_each_match(OnigCallbackEachMatchFunc f) { CallbackEachMatch = f; return ONIG_NORMAL; } extern void onig_region_clear(OnigRegion* region) { int i; for (i = 0; i < region->num_regs; i++) { region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS; } #ifdef USE_CAPTURE_HISTORY history_root_free(region); #endif } extern int onig_region_resize(OnigRegion* region, int n) { region->num_regs = n; if (n < ONIG_NREGION) n = ONIG_NREGION; if (region->allocated == 0) { region->beg = (int* )xmalloc(n * sizeof(int)); region->end = (int* )xmalloc(n * sizeof(int)); if (region->beg == 0 || region->end == 0) return ONIGERR_MEMORY; region->allocated = n; } else if (region->allocated < n) { region->beg = (int* )xrealloc(region->beg, n * sizeof(int)); region->end = (int* )xrealloc(region->end, n * sizeof(int)); if (region->beg == 0 || region->end == 0) return ONIGERR_MEMORY; region->allocated = n; } return 0; } static int onig_region_resize_clear(OnigRegion* region, int n) { int r; r = onig_region_resize(region, n); if (r != 0) return r; onig_region_clear(region); return 0; } extern int onig_region_set(OnigRegion* region, int at, int beg, int end) { if (at < 0) return ONIGERR_INVALID_ARGUMENT; if (at >= region->allocated) { int r = onig_region_resize(region, at + 1); if (r < 0) return r; } region->beg[at] = beg; region->end[at] = end; return 0; } extern void onig_region_init(OnigRegion* region) { region->num_regs = 0; region->allocated = 0; region->beg = (int* )0; region->end = (int* )0; region->history_root = (OnigCaptureTreeNode* )0; } extern OnigRegion* onig_region_new(void) { OnigRegion* r; r = (OnigRegion* )xmalloc(sizeof(OnigRegion)); CHECK_NULL_RETURN(r); onig_region_init(r); return r; } extern void onig_region_free(OnigRegion* r, int free_self) { if (r != 0) { if (r->allocated > 0) { if (r->beg) xfree(r->beg); if (r->end) xfree(r->end); r->allocated = 0; } #ifdef USE_CAPTURE_HISTORY history_root_free(r); #endif if (free_self) xfree(r); } } extern void onig_region_copy(OnigRegion* to, OnigRegion* from) { #define RREGC_SIZE (sizeof(int) * from->num_regs) int i; if (to == from) return; if (to->allocated == 0) { if (from->num_regs > 0) { to->beg = (int* )xmalloc(RREGC_SIZE); if (IS_NULL(to->beg)) return; to->end = (int* )xmalloc(RREGC_SIZE); if (IS_NULL(to->end)) return; to->allocated = from->num_regs; } } else if (to->allocated < from->num_regs) { to->beg = (int* )xrealloc(to->beg, RREGC_SIZE); if (IS_NULL(to->beg)) return; to->end = (int* )xrealloc(to->end, RREGC_SIZE); if (IS_NULL(to->end)) return; to->allocated = from->num_regs; } for (i = 0; i < from->num_regs; i++) { to->beg[i] = from->beg[i]; to->end[i] = from->end[i]; } to->num_regs = from->num_regs; #ifdef USE_CAPTURE_HISTORY history_root_free(to); if (IS_NOT_NULL(from->history_root)) { to->history_root = history_tree_clone(from->history_root); } #endif } #ifdef USE_CALLOUT #define CALLOUT_BODY(func, ain, aname_id, anum, user, args, result) do { \ args.in = (ain);\ args.name_id = (aname_id);\ args.num = anum;\ args.regex = reg;\ args.string = str;\ args.string_end = end;\ args.start = sstart;\ args.right_range = right_range;\ args.current = s;\ args.retry_in_match_counter = retry_in_match_counter;\ args.msa = msa;\ args.stk_base = stk_base;\ args.stk = stk;\ args.mem_start_stk = mem_start_stk;\ args.mem_end_stk = mem_end_stk;\ result = (func)(&args, user);\ } while (0) #define RETRACTION_CALLOUT(func, aname_id, anum, user) do {\ int result;\ OnigCalloutArgs args;\ CALLOUT_BODY(func, ONIG_CALLOUT_IN_RETRACTION, aname_id, anum, user, args, result);\ switch (result) {\ case ONIG_CALLOUT_FAIL:\ case ONIG_CALLOUT_SUCCESS:\ break;\ default:\ if (result > 0) {\ result = ONIGERR_INVALID_ARGUMENT;\ }\ best_len = result;\ goto match_at_end;\ break;\ }\ } while(0) #endif /** stack **/ #define STK_ALT_FLAG 0x0001 /* stack type */ /* used by normal-POP */ #define STK_SUPER_ALT STK_ALT_FLAG #define STK_ALT (0x0002 | STK_ALT_FLAG) /* handled by normal-POP */ #define STK_MEM_START 0x0010 #define STK_MEM_END 0x8030 #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR #define STK_REPEAT_INC (0x0040 | STK_MASK_POP_HANDLED) #else #define STK_REPEAT_INC 0x0040 #endif #ifdef USE_CALLOUT #define STK_CALLOUT 0x0070 #endif /* avoided by normal-POP */ #define STK_VOID 0x0000 /* for fill a blank */ #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR #define STK_EMPTY_CHECK_START (0x3000 | STK_MASK_POP_HANDLED) #else #define STK_EMPTY_CHECK_START 0x3000 #endif #define STK_EMPTY_CHECK_END 0x5000 /* for recursive call */ #define STK_MEM_END_MARK 0x8100 #define STK_CALL_FRAME (0x0400 | STK_MASK_POP_HANDLED) #define STK_RETURN (0x0500 | STK_MASK_POP_HANDLED) #define STK_SAVE_VAL 0x0600 #define STK_MARK 0x0704 /* stack type check mask */ #define STK_MASK_POP_USED STK_ALT_FLAG #define STK_MASK_POP_HANDLED 0x0010 #define STK_MASK_POP_HANDLED_TIL (STK_MASK_POP_HANDLED | 0x0004) #define STK_MASK_TO_VOID_TARGET 0x100e #define STK_MASK_MEM_END_OR_MARK 0x8000 /* MEM_END or MEM_END_MARK */ typedef ptrdiff_t StackIndex; #define INVALID_STACK_INDEX ((StackIndex )-1) typedef union { StackIndex i; UChar* s; } StkPtrType; typedef struct _StackType { unsigned int type; int zid; union { struct { Operation* pcode; /* byte code position */ UChar* pstr; /* string position */ } state; struct { int count; #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR StackIndex prev_index; /* index of stack */ #endif } repeat_inc; struct { UChar *pstr; /* start/end position */ /* Following information is set, if this stack type is MEM-START */ StkPtrType prev_start; /* prev. info (for backtrack "(...)*" ) */ StkPtrType prev_end; /* prev. info (for backtrack "(...)*" ) */ } mem; struct { UChar *pstr; /* start position */ #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR StackIndex prev_index; /* index of stack */ #endif } empty_check; #ifdef USE_CALL struct { Operation *ret_addr; /* byte code position */ UChar *pstr; /* string position */ } call_frame; #endif struct { enum SaveType type; UChar* v; UChar* v2; } val; #ifdef USE_CALLOUT struct { int num; OnigCalloutFunc func; } callout; #endif } u; } StackType; #ifdef USE_CALLOUT struct OnigCalloutArgsStruct { OnigCalloutIn in; int name_id; /* name id or ONIG_NON_NAME_ID */ int num; OnigRegex regex; const OnigUChar* string; const OnigUChar* string_end; const OnigUChar* start; const OnigUChar* right_range; const OnigUChar* current; /* current matching position */ unsigned long retry_in_match_counter; /* invisible to users */ MatchArg* msa; StackType* stk_base; StackType* stk; StkPtrType* mem_start_stk; StkPtrType* mem_end_stk; }; #endif #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR #define PTR_NUM_SIZE(reg) ((reg)->num_repeat + (reg)->num_empty_check + ((reg)->num_mem + 1) * 2) #define UPDATE_FOR_STACK_REALLOC do{\ repeat_stk = (StackIndex* )alloc_base;\ empty_check_stk = (StackIndex* )(repeat_stk + reg->num_repeat);\ mem_start_stk = (StkPtrType* )(empty_check_stk + reg->num_empty_check);\ mem_end_stk = mem_start_stk + num_mem + 1;\ } while(0) #define SAVE_REPEAT_STK_VAR(sid) stk->u.repeat_inc.prev_index = repeat_stk[sid] #define LOAD_TO_REPEAT_STK_VAR(sid) repeat_stk[sid] = GET_STACK_INDEX(stk) #define POP_REPEAT_INC else if (stk->type == STK_REPEAT_INC) {repeat_stk[stk->zid] = stk->u.repeat_inc.prev_index;} #define SAVE_EMPTY_CHECK_STK_VAR(sid) stk->u.empty_check.prev_index = empty_check_stk[sid] #define LOAD_TO_EMPTY_CHECK_STK_VAR(sid) empty_check_stk[sid] = GET_STACK_INDEX(stk) #define POP_EMPTY_CHECK_START else if (stk->type == STK_EMPTY_CHECK_START) {empty_check_stk[stk->zid] = stk->u.empty_check.prev_index;} #else #define PTR_NUM_SIZE(reg) (((reg)->num_mem + 1) * 2) #define UPDATE_FOR_STACK_REALLOC do{\ mem_start_stk = (StkPtrType* )alloc_base;\ mem_end_stk = mem_start_stk + num_mem + 1;\ } while(0) #define SAVE_REPEAT_STK_VAR(sid) #define LOAD_TO_REPEAT_STK_VAR(sid) #define POP_REPEAT_INC #define SAVE_EMPTY_CHECK_STK_VAR(sid) #define LOAD_TO_EMPTY_CHECK_STK_VAR(sid) #define POP_EMPTY_CHECK_START #endif /* USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR */ #ifdef USE_RETRY_LIMIT #define RETRY_IN_MATCH_ARG_INIT(msa,mpv) \ (msa).retry_limit_in_match = (mpv)->retry_limit_in_match;\ (msa).retry_limit_in_search = (mpv)->retry_limit_in_search;\ (msa).retry_limit_in_search_counter = 0; #else #define RETRY_IN_MATCH_ARG_INIT(msa,mpv) #endif #if defined(USE_CALL) #define SUBEXP_CALL_IN_MATCH_ARG_INIT(msa,mpv) \ (msa).subexp_call_in_search_counter = 0; #define POP_CALL else if (stk->type == STK_RETURN) {subexp_call_nest_counter++;} else if (stk->type == STK_CALL_FRAME) {subexp_call_nest_counter--;} #else #define SUBEXP_CALL_IN_MATCH_ARG_INIT(msa,mpv) #define POP_CALL #endif #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE #ifdef USE_SKIP_SEARCH #define MATCH_ARG_INIT(msa, reg, arg_option, arg_region, arg_start, mpv) do { \ (msa).stack_p = (void* )0;\ (msa).options = (arg_option)|(reg)->options;\ (msa).region = (arg_region);\ (msa).start = (arg_start);\ (msa).match_stack_limit = (mpv)->match_stack_limit;\ RETRY_IN_MATCH_ARG_INIT(msa,mpv)\ SUBEXP_CALL_IN_MATCH_ARG_INIT(msa,mpv)\ (msa).mp = mpv;\ (msa).best_len = ONIG_MISMATCH;\ (msa).ptr_num = PTR_NUM_SIZE(reg);\ (msa).skip_search = (UChar* )(arg_start);\ } while(0) #else #define MATCH_ARG_INIT(msa, reg, arg_option, arg_region, arg_start, mpv) do { \ (msa).stack_p = (void* )0;\ (msa).options = (arg_option)|(reg)->options;\ (msa).region = (arg_region);\ (msa).start = (arg_start);\ (msa).match_stack_limit = (mpv)->match_stack_limit;\ RETRY_IN_MATCH_ARG_INIT(msa,mpv)\ SUBEXP_CALL_IN_MATCH_ARG_INIT(msa,mpv)\ (msa).mp = mpv;\ (msa).best_len = ONIG_MISMATCH;\ (msa).ptr_num = PTR_NUM_SIZE(reg);\ } while(0) #endif #else #ifdef USE_SKIP_SEARCH #define MATCH_ARG_INIT(msa, reg, arg_option, arg_region, arg_start, mpv) do { \ (msa).stack_p = (void* )0;\ (msa).options = (arg_option)|(reg)->options;\ (msa).region = (arg_region);\ (msa).start = (arg_start);\ (msa).match_stack_limit = (mpv)->match_stack_limit;\ RETRY_IN_MATCH_ARG_INIT(msa,mpv)\ SUBEXP_CALL_IN_MATCH_ARG_INIT(msa,mpv)\ (msa).mp = mpv;\ (msa).ptr_num = PTR_NUM_SIZE(reg);\ (msa).skip_search = (UChar* )(arg_start);\ } while(0) #else #define MATCH_ARG_INIT(msa, reg, arg_option, arg_region, arg_start, mpv) do { \ (msa).stack_p = (void* )0;\ (msa).options = (arg_option)|(reg)->options;\ (msa).region = (arg_region);\ (msa).start = (arg_start);\ (msa).match_stack_limit = (mpv)->match_stack_limit;\ RETRY_IN_MATCH_ARG_INIT(msa,mpv)\ SUBEXP_CALL_IN_MATCH_ARG_INIT(msa,mpv)\ (msa).mp = mpv;\ (msa).ptr_num = PTR_NUM_SIZE(reg);\ } while(0) #endif #endif #define MATCH_ARG_FREE(msa) if ((msa).stack_p) xfree((msa).stack_p) #define ALLOCA_PTR_NUM_LIMIT 50 #define STACK_INIT(stack_num) do {\ if (msa->stack_p) {\ is_alloca = 0;\ alloc_base = msa->stack_p;\ stk_base = (StackType* )(alloc_base\ + (sizeof(StkPtrType) * msa->ptr_num));\ stk = stk_base;\ stk_end = stk_base + msa->stack_n;\ }\ else if (msa->ptr_num > ALLOCA_PTR_NUM_LIMIT) {\ is_alloca = 0;\ alloc_base = (char* )xmalloc(sizeof(StkPtrType) * msa->ptr_num\ + sizeof(StackType) * (stack_num));\ CHECK_NULL_RETURN_MEMERR(alloc_base);\ stk_base = (StackType* )(alloc_base\ + (sizeof(StkPtrType) * msa->ptr_num));\ stk = stk_base;\ stk_end = stk_base + (stack_num);\ }\ else {\ is_alloca = 1;\ alloc_base = (char* )xalloca(sizeof(StkPtrType) * msa->ptr_num\ + sizeof(StackType) * (stack_num));\ CHECK_NULL_RETURN_MEMERR(alloc_base);\ stk_base = (StackType* )(alloc_base\ + (sizeof(StkPtrType) * msa->ptr_num));\ stk = stk_base;\ stk_end = stk_base + (stack_num);\ }\ } while(0); #define STACK_SAVE(msa,is_alloca,alloc_base) do{\ (msa)->stack_n = (int )(stk_end - stk_base);\ if ((is_alloca) != 0) {\ size_t size = sizeof(StkPtrType) * (msa)->ptr_num\ + sizeof(StackType) * (msa)->stack_n;\ (msa)->stack_p = xmalloc(size);\ CHECK_NULL_RETURN_MEMERR((msa)->stack_p);\ xmemcpy((msa)->stack_p, (alloc_base), size);\ }\ else {\ (msa)->stack_p = (alloc_base);\ };\ } while(0) static unsigned int MatchStackLimit = DEFAULT_MATCH_STACK_LIMIT_SIZE; extern unsigned int onig_get_match_stack_limit_size(void) { return MatchStackLimit; } extern int onig_set_match_stack_limit_size(unsigned int size) { MatchStackLimit = size; return 0; } #ifdef USE_RETRY_LIMIT static unsigned long RetryLimitInMatch = DEFAULT_RETRY_LIMIT_IN_MATCH; static unsigned long RetryLimitInSearch = DEFAULT_RETRY_LIMIT_IN_SEARCH; #define CHECK_RETRY_LIMIT_IN_MATCH do {\ if (++retry_in_match_counter >= retry_limit_in_match && \ retry_limit_in_match != 0) {\ MATCH_AT_ERROR_RETURN((retry_in_match_counter >= msa->retry_limit_in_match && msa->retry_limit_in_match != 0) ? ONIGERR_RETRY_LIMIT_IN_MATCH_OVER : ONIGERR_RETRY_LIMIT_IN_SEARCH_OVER); \ }\ } while (0) #else #define CHECK_RETRY_LIMIT_IN_MATCH #endif /* USE_RETRY_LIMIT */ extern unsigned long onig_get_retry_limit_in_match(void) { #ifdef USE_RETRY_LIMIT return RetryLimitInMatch; #else return 0; #endif } extern int onig_set_retry_limit_in_match(unsigned long n) { #ifdef USE_RETRY_LIMIT RetryLimitInMatch = n; return 0; #else return ONIG_NO_SUPPORT_CONFIG; #endif } extern unsigned long onig_get_retry_limit_in_search(void) { #ifdef USE_RETRY_LIMIT return RetryLimitInSearch; #else return 0; #endif } extern int onig_set_retry_limit_in_search(unsigned long n) { #ifdef USE_RETRY_LIMIT RetryLimitInSearch = n; return 0; #else return ONIG_NO_SUPPORT_CONFIG; #endif } #ifdef USE_CALL static unsigned long SubexpCallLimitInSearch = DEFAULT_SUBEXP_CALL_LIMIT_IN_SEARCH; extern unsigned long onig_get_subexp_call_limit_in_search(void) { return SubexpCallLimitInSearch; } extern int onig_set_subexp_call_limit_in_search(unsigned long n) { SubexpCallLimitInSearch = n; return 0; } #endif #ifdef USE_CALLOUT static OnigCalloutFunc DefaultProgressCallout; static OnigCalloutFunc DefaultRetractionCallout; #endif extern OnigMatchParam* onig_new_match_param(void) { OnigMatchParam* p; p = (OnigMatchParam* )xmalloc(sizeof(*p)); if (IS_NOT_NULL(p)) { onig_initialize_match_param(p); } return p; } extern void onig_free_match_param_content(OnigMatchParam* p) { #ifdef USE_CALLOUT if (IS_NOT_NULL(p->callout_data)) { xfree(p->callout_data); p->callout_data = 0; } #endif } extern void onig_free_match_param(OnigMatchParam* p) { if (IS_NOT_NULL(p)) { onig_free_match_param_content(p); xfree(p); } } extern int onig_initialize_match_param(OnigMatchParam* mp) { mp->match_stack_limit = MatchStackLimit; #ifdef USE_RETRY_LIMIT mp->retry_limit_in_match = RetryLimitInMatch; mp->retry_limit_in_search = RetryLimitInSearch; #endif mp->callout_user_data = 0; #ifdef USE_CALLOUT mp->progress_callout_of_contents = DefaultProgressCallout; mp->retraction_callout_of_contents = DefaultRetractionCallout; mp->match_at_call_counter = 0; mp->callout_data = 0; mp->callout_data_alloc_num = 0; #endif return ONIG_NORMAL; } #ifdef USE_CALLOUT static int adjust_match_param(regex_t* reg, OnigMatchParam* mp) { RegexExt* ext = reg->extp; mp->match_at_call_counter = 0; if (IS_NULL(ext) || ext->callout_num == 0) return ONIG_NORMAL; if (ext->callout_num > mp->callout_data_alloc_num) { CalloutData* d; size_t n = ext->callout_num * sizeof(*d); if (IS_NOT_NULL(mp->callout_data)) d = (CalloutData* )xrealloc(mp->callout_data, n); else d = (CalloutData* )xmalloc(n); CHECK_NULL_RETURN_MEMERR(d); mp->callout_data = d; mp->callout_data_alloc_num = ext->callout_num; } xmemset(mp->callout_data, 0, mp->callout_data_alloc_num * sizeof(CalloutData)); return ONIG_NORMAL; } #define ADJUST_MATCH_PARAM(reg, mp) \ r = adjust_match_param(reg, mp);\ if (r != ONIG_NORMAL) return r; #define CALLOUT_DATA_AT_NUM(mp, num) ((mp)->callout_data + ((num) - 1)) extern int onig_check_callout_data_and_clear_old_values(OnigCalloutArgs* args) { OnigMatchParam* mp; int num; CalloutData* d; mp = args->msa->mp; num = args->num; d = CALLOUT_DATA_AT_NUM(mp, num); if (d->last_match_at_call_counter != mp->match_at_call_counter) { xmemset(d, 0, sizeof(*d)); d->last_match_at_call_counter = mp->match_at_call_counter; return d->last_match_at_call_counter; } return 0; } extern int onig_get_callout_data_dont_clear_old(regex_t* reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) { OnigType t; CalloutData* d; if (callout_num <= 0) return ONIGERR_INVALID_ARGUMENT; d = CALLOUT_DATA_AT_NUM(mp, callout_num); t = d->slot[slot].type; if (IS_NOT_NULL(type)) *type = t; if (IS_NOT_NULL(val)) *val = d->slot[slot].val; return (t == ONIG_TYPE_VOID ? ONIG_VALUE_IS_NOT_SET : ONIG_NORMAL); } extern int onig_get_callout_data_by_tag_dont_clear_old(regex_t* reg, OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot, OnigType* type, OnigValue* val) { int num; num = onig_get_callout_num_by_tag(reg, tag, tag_end); if (num < 0) return num; if (num == 0) return ONIGERR_INVALID_CALLOUT_TAG_NAME; return onig_get_callout_data_dont_clear_old(reg, mp, num, slot, type, val); } extern int onig_get_callout_data_by_callout_args_self_dont_clear_old( OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) { return onig_get_callout_data_dont_clear_old(args->regex, args->msa->mp, args->num, slot, type, val); } extern int onig_get_callout_data(regex_t* reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) { OnigType t; CalloutData* d; if (callout_num <= 0) return ONIGERR_INVALID_ARGUMENT; d = CALLOUT_DATA_AT_NUM(mp, callout_num); if (d->last_match_at_call_counter != mp->match_at_call_counter) { xmemset(d, 0, sizeof(*d)); d->last_match_at_call_counter = mp->match_at_call_counter; } t = d->slot[slot].type; if (IS_NOT_NULL(type)) *type = t; if (IS_NOT_NULL(val)) *val = d->slot[slot].val; return (t == ONIG_TYPE_VOID ? ONIG_VALUE_IS_NOT_SET : ONIG_NORMAL); } extern int onig_get_callout_data_by_tag(regex_t* reg, OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot, OnigType* type, OnigValue* val) { int num; num = onig_get_callout_num_by_tag(reg, tag, tag_end); if (num < 0) return num; if (num == 0) return ONIGERR_INVALID_CALLOUT_TAG_NAME; return onig_get_callout_data(reg, mp, num, slot, type, val); } extern int onig_get_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType* type, OnigValue* val) { return onig_get_callout_data(args->regex, args->msa->mp, callout_num, slot, type, val); } extern int onig_get_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) { return onig_get_callout_data(args->regex, args->msa->mp, args->num, slot, type, val); } extern int onig_set_callout_data(regex_t* reg, OnigMatchParam* mp, int callout_num, int slot, OnigType type, OnigValue* val) { CalloutData* d; if (callout_num <= 0) return ONIGERR_INVALID_ARGUMENT; d = CALLOUT_DATA_AT_NUM(mp, callout_num); d->slot[slot].type = type; d->slot[slot].val = *val; d->last_match_at_call_counter = mp->match_at_call_counter; return ONIG_NORMAL; } extern int onig_set_callout_data_by_tag(regex_t* reg, OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot, OnigType type, OnigValue* val) { int num; num = onig_get_callout_num_by_tag(reg, tag, tag_end); if (num < 0) return num; if (num == 0) return ONIGERR_INVALID_CALLOUT_TAG_NAME; return onig_set_callout_data(reg, mp, num, slot, type, val); } extern int onig_set_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType type, OnigValue* val) { return onig_set_callout_data(args->regex, args->msa->mp, callout_num, slot, type, val); } extern int onig_set_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType type, OnigValue* val) { return onig_set_callout_data(args->regex, args->msa->mp, args->num, slot, type, val); } #else #define ADJUST_MATCH_PARAM(reg, mp) #endif /* USE_CALLOUT */ static int stack_double(int* is_alloca, char** arg_alloc_base, StackType** arg_stk_base, StackType** arg_stk_end, StackType** arg_stk, MatchArg* msa) { unsigned int n; int used; size_t size; size_t new_size; char* alloc_base; char* new_alloc_base; StackType *stk_base, *stk_end, *stk; alloc_base = *arg_alloc_base; stk_base = *arg_stk_base; stk_end = *arg_stk_end; stk = *arg_stk; n = (unsigned int )(stk_end - stk_base); size = sizeof(StkPtrType) * msa->ptr_num + sizeof(StackType) * n; n *= 2; new_size = sizeof(StkPtrType) * msa->ptr_num + sizeof(StackType) * n; if (*is_alloca != 0) { new_alloc_base = (char* )xmalloc(new_size); if (IS_NULL(new_alloc_base)) { STACK_SAVE(msa, *is_alloca, alloc_base); return ONIGERR_MEMORY; } xmemcpy(new_alloc_base, alloc_base, size); *is_alloca = 0; } else { if (msa->match_stack_limit != 0 && n > msa->match_stack_limit) { if ((unsigned int )(stk_end - stk_base) == msa->match_stack_limit) { STACK_SAVE(msa, *is_alloca, alloc_base); return ONIGERR_MATCH_STACK_LIMIT_OVER; } else n = msa->match_stack_limit; } new_alloc_base = (char* )xrealloc(alloc_base, new_size); if (IS_NULL(new_alloc_base)) { STACK_SAVE(msa, *is_alloca, alloc_base); return ONIGERR_MEMORY; } } alloc_base = new_alloc_base; used = (int )(stk - stk_base); *arg_alloc_base = alloc_base; *arg_stk_base = (StackType* )(alloc_base + (sizeof(StkPtrType) * msa->ptr_num)); *arg_stk = *arg_stk_base + used; *arg_stk_end = *arg_stk_base + n; return 0; } #define STACK_ENSURE(n) do {\ if ((int )(stk_end - stk) < (n)) {\ int r = stack_double(&is_alloca, &alloc_base, &stk_base, &stk_end, &stk, msa);\ if (r != 0) return r;\ UPDATE_FOR_STACK_REALLOC;\ }\ } while(0) #define STACK_AT(index) (stk_base + (index)) #define GET_STACK_INDEX(stk) ((stk) - stk_base) #define STACK_PUSH_TYPE(stack_type) do {\ STACK_ENSURE(1);\ stk->type = (stack_type);\ STACK_INC;\ } while(0) #define IS_TO_VOID_TARGET(stk) (((stk)->type & STK_MASK_TO_VOID_TARGET) != 0) #define STACK_PUSH(stack_type,pat,s) do {\ STACK_ENSURE(1);\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ stk->u.state.pstr = (s);\ STACK_INC;\ } while(0) #define STACK_PUSH_WITH_ZID(stack_type,pat,s,id) do {\ STACK_ENSURE(1);\ stk->type = (stack_type);\ stk->zid = (int )(id);\ stk->u.state.pcode = (pat);\ stk->u.state.pstr = (s);\ STACK_INC;\ } while(0) #define STACK_PUSH_ENSURED(stack_type,pat) do {\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ STACK_INC;\ } while(0) #ifdef ONIG_DEBUG_MATCH #define STACK_PUSH_BOTTOM(stack_type,pat) do {\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ stk->u.state.pstr = s;\ STACK_INC;\ } while (0) #else #define STACK_PUSH_BOTTOM(stack_type,pat) do {\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ STACK_INC;\ } while (0) #endif #define STACK_PUSH_ALT(pat,s) STACK_PUSH(STK_ALT,pat,s) #define STACK_PUSH_SUPER_ALT(pat,s) STACK_PUSH(STK_SUPER_ALT,pat,s) #define STACK_PUSH_ALT_WITH_ZID(pat,s,id) STACK_PUSH_WITH_ZID(STK_ALT,pat,s,id) #if 0 #define STACK_PUSH_REPEAT(sid, pat) do {\ STACK_ENSURE(1);\ stk->type = STK_REPEAT;\ stk->zid = (sid);\ stk->u.repeat.pcode = (pat);\ STACK_INC;\ } while(0) #endif #define STACK_PUSH_REPEAT_INC(sid, ct) do {\ STACK_ENSURE(1);\ stk->type = STK_REPEAT_INC;\ stk->zid = (sid);\ stk->u.repeat_inc.count = (ct);\ SAVE_REPEAT_STK_VAR(sid);\ LOAD_TO_REPEAT_STK_VAR(sid);\ STACK_INC;\ } while(0) #define STACK_PUSH_MEM_START(mnum, s) do {\ STACK_ENSURE(1);\ stk->type = STK_MEM_START;\ stk->zid = (mnum);\ stk->u.mem.pstr = (s);\ stk->u.mem.prev_start = mem_start_stk[mnum];\ stk->u.mem.prev_end = mem_end_stk[mnum];\ mem_start_stk[mnum].i = GET_STACK_INDEX(stk);\ mem_end_stk[mnum].i = INVALID_STACK_INDEX;\ STACK_INC;\ } while(0) #define STACK_PUSH_MEM_END(mnum, s) do {\ STACK_ENSURE(1);\ stk->type = STK_MEM_END;\ stk->zid = (mnum);\ stk->u.mem.pstr = (s);\ stk->u.mem.prev_start = mem_start_stk[mnum];\ stk->u.mem.prev_end = mem_end_stk[mnum];\ mem_end_stk[mnum].i = GET_STACK_INDEX(stk);\ STACK_INC;\ } while(0) #define STACK_PUSH_MEM_END_MARK(mnum) do {\ STACK_ENSURE(1);\ stk->type = STK_MEM_END_MARK;\ stk->zid = (mnum);\ STACK_INC;\ } while(0) #define STACK_GET_MEM_START(mnum, k) do {\ int level = 0;\ k = stk;\ while (k > stk_base) {\ k--;\ if ((k->type & STK_MASK_MEM_END_OR_MARK) != 0 \ && k->zid == (mnum)) {\ level++;\ }\ else if (k->type == STK_MEM_START && k->zid == (mnum)) {\ if (level == 0) break;\ level--;\ }\ }\ } while(0) #define STACK_GET_MEM_RANGE(k, mnum, start, end) do {\ int level = 0;\ while (k < stk) {\ if (k->type == STK_MEM_START && k->u.mem.num == (mnum)) {\ if (level == 0) (start) = k->u.mem.pstr;\ level++;\ }\ else if (k->type == STK_MEM_END && k->u.mem.num == (mnum)) {\ level--;\ if (level == 0) {\ (end) = k->u.mem.pstr;\ break;\ }\ }\ k++;\ }\ } while(0) #define STACK_PUSH_EMPTY_CHECK_START(cnum, s) do {\ STACK_ENSURE(1);\ stk->type = STK_EMPTY_CHECK_START;\ stk->zid = (cnum);\ stk->u.empty_check.pstr = (s);\ SAVE_EMPTY_CHECK_STK_VAR(cnum);\ LOAD_TO_EMPTY_CHECK_STK_VAR(cnum);\ STACK_INC;\ } while(0) #define STACK_PUSH_EMPTY_CHECK_END(cnum) do {\ STACK_ENSURE(1);\ stk->type = STK_EMPTY_CHECK_END;\ stk->zid = (cnum);\ STACK_INC;\ } while(0) #define STACK_PUSH_CALL_FRAME(pat) do {\ STACK_ENSURE(1);\ stk->type = STK_CALL_FRAME;\ stk->u.call_frame.ret_addr = (pat);\ STACK_INC;\ } while(0) #define STACK_PUSH_RETURN do {\ STACK_ENSURE(1);\ stk->type = STK_RETURN;\ STACK_INC;\ } while(0) #define STACK_PUSH_MARK(sid) do {\ STACK_ENSURE(1);\ stk->type = STK_MARK;\ stk->zid = (sid);\ STACK_INC;\ } while(0) #define STACK_PUSH_MARK_WITH_POS(sid, s) do {\ STACK_ENSURE(1);\ stk->type = STK_MARK;\ stk->zid = (sid);\ stk->u.val.v = (UChar* )(s);\ STACK_INC;\ } while(0) #define STACK_PUSH_SAVE_VAL(sid, stype, sval) do {\ STACK_ENSURE(1);\ stk->type = STK_SAVE_VAL;\ stk->zid = (sid);\ stk->u.val.type = (stype);\ stk->u.val.v = (UChar* )(sval);\ STACK_INC;\ } while(0) #define STACK_PUSH_SAVE_VAL_WITH_SPREV(sid, stype, sval) do {\ STACK_ENSURE(1);\ stk->type = STK_SAVE_VAL;\ stk->zid = (sid);\ stk->u.val.type = (stype);\ stk->u.val.v = (UChar* )(sval);\ STACK_INC;\ } while(0) #define STACK_GET_SAVE_VAL_TYPE_LAST(stype, sval) do {\ StackType *k = stk;\ while (k > stk_base) {\ k--;\ STACK_BASE_CHECK(k, "STACK_GET_SAVE_VAL_TYPE_LAST"); \ if (k->type == STK_SAVE_VAL && k->u.val.type == (stype)) {\ (sval) = k->u.val.v;\ break;\ }\ }\ } while (0) #define STACK_GET_SAVE_VAL_TYPE_LAST_ID(stype, sid, sval, clear) do {\ int level = 0;\ StackType *k = stk;\ while (k > stk_base) {\ k--;\ STACK_BASE_CHECK(k, "STACK_GET_SAVE_VAL_TYPE_LAST_ID"); \ if (k->type == STK_SAVE_VAL && k->u.val.type == (stype)\ && k->zid == (sid)) {\ if (level == 0) {\ (sval) = k->u.val.v;\ if (clear != 0) k->type = STK_VOID;\ break;\ }\ }\ else if (k->type == STK_CALL_FRAME)\ level--;\ else if (k->type == STK_RETURN)\ level++;\ }\ } while (0) #define STACK_GET_SAVE_VAL_TYPE_LAST_ID_WITH_SPREV(stype, sid, sval) do { \ int level = 0;\ StackType *k = stk;\ while (k > stk_base) {\ k--;\ STACK_BASE_CHECK(k, "STACK_GET_SAVE_VAL_TYPE_LAST_ID"); \ if (k->type == STK_SAVE_VAL && k->u.val.type == (stype)\ && k->zid == (sid)) {\ if (level == 0) {\ (sval) = k->u.val.v;\ break;\ }\ }\ else if (k->type == STK_CALL_FRAME)\ level--;\ else if (k->type == STK_RETURN)\ level++;\ }\ } while (0) #define STACK_PUSH_CALLOUT_CONTENTS(anum, func) do {\ STACK_ENSURE(1);\ stk->type = STK_CALLOUT;\ stk->zid = ONIG_NON_NAME_ID;\ stk->u.callout.num = (anum);\ stk->u.callout.func = (func);\ STACK_INC;\ } while(0) #define STACK_PUSH_CALLOUT_NAME(aid, anum, func) do {\ STACK_ENSURE(1);\ stk->type = STK_CALLOUT;\ stk->zid = (aid);\ stk->u.callout.num = (anum);\ stk->u.callout.func = (func);\ STACK_INC;\ } while(0) #ifdef ONIG_DEBUG #define STACK_BASE_CHECK(p, at) \ if ((p) < stk_base) {\ fprintf(DBGFP, "at %s\n", at);\ MATCH_AT_ERROR_RETURN(ONIGERR_STACK_BUG);\ } #else #define STACK_BASE_CHECK(p, at) #endif #define STACK_POP_ONE do {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP_ONE"); \ } while(0) #ifdef USE_CALLOUT #define POP_CALLOUT_CASE \ else if (stk->type == STK_CALLOUT) {\ RETRACTION_CALLOUT(stk->u.callout.func, stk->zid, stk->u.callout.num, msa->mp->callout_user_data);\ } #else #define POP_CALLOUT_CASE #endif #define STACK_POP do {\ switch (pop_level) {\ case STACK_POP_LEVEL_FREE:\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP"); \ if ((stk->type & STK_MASK_POP_USED) != 0) break;\ }\ break;\ case STACK_POP_LEVEL_MEM_START:\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP 2"); \ if ((stk->type & STK_MASK_POP_USED) != 0) break;\ else if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->zid] = stk->u.mem.prev_start;\ mem_end_stk[stk->zid] = stk->u.mem.prev_end;\ }\ }\ break;\ default:\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP 3"); \ if ((stk->type & STK_MASK_POP_USED) != 0) break;\ else if ((stk->type & STK_MASK_POP_HANDLED) != 0) {\ if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->zid] = stk->u.mem.prev_start;\ mem_end_stk[stk->zid] = stk->u.mem.prev_end;\ }\ else if (stk->type == STK_MEM_END) {\ mem_start_stk[stk->zid] = stk->u.mem.prev_start;\ mem_end_stk[stk->zid] = stk->u.mem.prev_end;\ }\ POP_REPEAT_INC \ POP_EMPTY_CHECK_START \ POP_CALL \ POP_CALLOUT_CASE\ }\ }\ break;\ }\ } while(0) #define STACK_POP_TO_MARK(sid) do {\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP_TO_MARK");\ if ((stk->type & STK_MASK_POP_HANDLED_TIL) != 0) {\ if (stk->type == STK_MARK) {\ if (stk->zid == (sid)) break;\ }\ else {\ if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->zid] = stk->u.mem.prev_start;\ mem_end_stk[stk->zid] = stk->u.mem.prev_end;\ }\ else if (stk->type == STK_MEM_END) {\ mem_start_stk[stk->zid] = stk->u.mem.prev_start;\ mem_end_stk[stk->zid] = stk->u.mem.prev_end;\ }\ POP_REPEAT_INC \ POP_EMPTY_CHECK_START \ POP_CALL \ /* Don't call callout here because negation of total success by (?!..) (?type & STK_MASK_POP_HANDLED_TIL) != 0) {\ if (stk->type == (til_type)) break;\ else {\ if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->zid] = stk->u.mem.prev_start;\ mem_end_stk[stk->zid] = stk->u.mem.prev_end;\ }\ else if (stk->type == STK_MEM_END) {\ mem_start_stk[stk->zid] = stk->u.mem.prev_start;\ mem_end_stk[stk->zid] = stk->u.mem.prev_end;\ }\ POP_REPEAT_INC \ POP_EMPTY_CHECK_START \ POP_CALL \ /* Don't call callout here because negation of total success by (?!..) (?type == STK_MARK) {\ if (k->zid == (sid)) {\ k->type = STK_VOID;\ break;\ } /* don't void different id mark */ \ }\ else\ k->type = STK_VOID;\ }\ }\ } while(0) #define EMPTY_CHECK_START_SEARCH(sid, k) do {\ k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "EMPTY_CHECK_START_SEARCH"); \ if (k->type == STK_EMPTY_CHECK_START) {\ if (k->zid == (sid)) break;\ }\ }\ } while(0) #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR #define GET_EMPTY_CHECK_START(sid, k) do {\ if (reg->num_call == 0) {\ k = STACK_AT(empty_check_stk[sid]);\ }\ else {\ EMPTY_CHECK_START_SEARCH(sid, k);\ }\ } while(0) #else #define GET_EMPTY_CHECK_START(sid, k) EMPTY_CHECK_START_SEARCH(sid, k) #endif #define STACK_EMPTY_CHECK(isnull, sid, s) do {\ StackType* k;\ GET_EMPTY_CHECK_START(sid, k);\ (isnull) = (k->u.empty_check.pstr == (s));\ } while(0) #define STACK_MEM_START_GET_PREV_END_ADDR(k /* STK_MEM_START*/, reg, addr) do {\ if (k->u.mem.prev_end.i == INVALID_STACK_INDEX) {\ (addr) = 0;\ }\ else {\ if (MEM_STATUS_AT((reg)->push_mem_end, k->zid))\ (addr) = STACK_AT(k->u.mem.prev_end.i)->u.mem.pstr;\ else\ (addr) = k->u.mem.prev_end.s;\ }\ } while (0) #ifdef USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT #define STACK_EMPTY_CHECK_MEM(isnull, sid, empty_status_mem, s, reg) do {\ StackType* klow;\ GET_EMPTY_CHECK_START(sid, klow);\ if (klow->u.empty_check.pstr != (s)) {\ stack_empty_check_mem_not_empty:\ (isnull) = 0;\ }\ else {\ StackType *k, *kk;\ MemStatusType ms = (empty_status_mem);\ (isnull) = 1;\ k = stk;\ while (k > klow) {\ k--;\ if (k->type == STK_MEM_END && MEM_STATUS_LIMIT_AT(ms, k->zid)) {\ kk = klow;\ while (kk < k) {\ if (kk->type == STK_MEM_START && kk->zid == k->zid) {\ if (kk->u.mem.prev_end.i == INVALID_STACK_INDEX || \ ((STACK_AT(kk->u.mem.prev_end.i)->u.mem.pstr != k->u.mem.pstr || STACK_AT(kk->u.mem.prev_start.i)->u.mem.pstr != STACK_AT(k->u.mem.prev_start.i)->u.mem.pstr) && (STACK_AT(k->u.mem.prev_start.i)->u.mem.pstr != k->u.mem.pstr || STACK_AT(kk->u.mem.prev_start.i)->u.mem.pstr != STACK_AT(kk->u.mem.prev_end.i)->u.mem.pstr))) {\ goto stack_empty_check_mem_not_empty;\ }\ else {\ ms &= ~((MemStatusType )1 << k->zid);\ break;\ }\ }\ kk++;\ }\ if (ms == 0) break;\ }\ }\ }\ } while(0) #define STACK_EMPTY_CHECK_MEM_REC(isnull,sid,empty_status_mem,s,reg) do {\ int level = 0;\ StackType* klow = stk;\ while (1) {\ klow--;\ STACK_BASE_CHECK(klow, "STACK_EMPTY_CHECK_MEM_REC");\ if (klow->type == STK_EMPTY_CHECK_START) {\ if (klow->zid == (sid)) {\ if (level == 0) {\ if (klow->u.empty_check.pstr != (s)) {\ stack_empty_check_mem_rec_not_empty:\ (isnull) = 0;\ break;\ }\ else {\ StackType *k, *kk;\ MemStatusType ms;\ (isnull) = 1;\ if ((empty_status_mem) == 0) break;\ ms = (empty_status_mem);\ k = stk;\ while (k > klow) {\ k--;\ if (k->type == STK_MEM_END) {\ if (level == 0 && MEM_STATUS_LIMIT_AT(ms, k->zid)) {\ kk = klow;\ kk++;\ while (kk < k) {\ if (kk->type == STK_MEM_START && kk->zid == k->zid) {\ if (kk->u.mem.prev_end.i == INVALID_STACK_INDEX || \ ((STACK_AT(kk->u.mem.prev_end.i)->u.mem.pstr != k->u.mem.pstr || STACK_AT(kk->u.mem.prev_start.i)->u.mem.pstr != STACK_AT(k->u.mem.prev_start.i)->u.mem.pstr) && (STACK_AT(k->u.mem.prev_start.i)->u.mem.pstr != k->u.mem.pstr || STACK_AT(kk->u.mem.prev_start.i)->u.mem.pstr != STACK_AT(kk->u.mem.prev_end.i)->u.mem.pstr))) {\ goto stack_empty_check_mem_rec_not_empty;\ }\ else {\ ms &= ~((MemStatusType )1 << k->zid);\ break;\ }\ }\ else if (kk->type == STK_EMPTY_CHECK_START) {\ if (kk->zid == (sid)) level++;\ }\ else if (kk->type == STK_EMPTY_CHECK_END) {\ if (kk->zid == (sid)) level--;\ }\ kk++;\ }\ level = 0;\ if (ms == 0) break;\ }\ }\ else if (k->type == STK_EMPTY_CHECK_START) {\ if (k->zid == (sid)) level++;\ }\ else if (k->type == STK_EMPTY_CHECK_END) {\ if (k->zid == (sid)) level--;\ }\ }\ break;\ }\ }\ else {\ level--;\ }\ }\ }\ else if (klow->type == STK_EMPTY_CHECK_END) {\ if (klow->zid == (sid)) level++;\ }\ }\ } while(0) #else #define STACK_EMPTY_CHECK_REC(isnull,id,s) do {\ int level = 0;\ StackType* k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_EMPTY_CHECK_REC"); \ if (k->type == STK_EMPTY_CHECK_START) {\ if (k->u.empty_check.num == (id)) {\ if (level == 0) {\ (isnull) = (k->u.empty_check.pstr == (s));\ break;\ }\ }\ level--;\ }\ else if (k->type == STK_EMPTY_CHECK_END) {\ level++;\ }\ }\ } while(0) #endif /* USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT */ #define STACK_GET_REPEAT_COUNT_SEARCH(sid, c) do {\ StackType* k = stk;\ while (1) {\ (k)--;\ STACK_BASE_CHECK(k, "STACK_GET_REPEAT_COUNT_SEARCH");\ if ((k)->type == STK_REPEAT_INC) {\ if ((k)->zid == (sid)) {\ (c) = (k)->u.repeat_inc.count;\ break;\ }\ }\ else if ((k)->type == STK_RETURN) {\ int level = -1;\ while (1) {\ (k)--;\ if ((k)->type == STK_CALL_FRAME) {\ level++;\ if (level == 0) break;\ }\ else if ((k)->type == STK_RETURN) level--;\ }\ }\ }\ } while(0) #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR #define STACK_GET_REPEAT_COUNT(sid, c) do {\ if (reg->num_call == 0) {\ (c) = (STACK_AT(repeat_stk[sid]))->u.repeat_inc.count;\ }\ else {\ STACK_GET_REPEAT_COUNT_SEARCH(sid, c);\ }\ } while(0) #else #define STACK_GET_REPEAT_COUNT(sid, c) STACK_GET_REPEAT_COUNT_SEARCH(sid, c) #endif #ifdef USE_CALL #define STACK_RETURN(addr) do {\ int level = 0;\ StackType* k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_RETURN"); \ if (k->type == STK_CALL_FRAME) {\ if (level == 0) {\ (addr) = k->u.call_frame.ret_addr;\ break;\ }\ else level--;\ }\ else if (k->type == STK_RETURN)\ level++;\ }\ } while(0) #define GET_STACK_RETURN_CALL(k,addr) do {\ int level = 0;\ k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "GET_STACK_RETURN_CALL");\ if (k->type == STK_CALL_FRAME) {\ if (level == 0) {\ (addr) = k->u.call_frame.ret_addr;\ break;\ }\ else level--;\ }\ else if (k->type == STK_RETURN)\ level++;\ }\ } while(0) #endif #define STRING_CMP(s1,s2,len) do {\ while (len-- > 0) {\ if (*s1++ != *s2++) goto fail;\ }\ } while(0) #define STRING_CMP_IC(case_fold_flag,s1,ps2,len) do {\ if (string_cmp_ic(encode, case_fold_flag, s1, ps2, len) == 0) \ goto fail; \ } while(0) static int string_cmp_ic(OnigEncoding enc, int case_fold_flag, UChar* s1, UChar** ps2, int mblen) { UChar buf1[ONIGENC_MBC_CASE_FOLD_MAXLEN]; UChar buf2[ONIGENC_MBC_CASE_FOLD_MAXLEN]; UChar *p1, *p2, *end1, *s2, *end2; int len1, len2; s2 = *ps2; end1 = s1 + mblen; end2 = s2 + mblen; while (s1 < end1) { len1 = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &s1, end1, buf1); len2 = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &s2, end2, buf2); if (len1 != len2) return 0; p1 = buf1; p2 = buf2; while (len1-- > 0) { if (*p1 != *p2) return 0; p1++; p2++; } if (s2 >= end2) { if (s1 < end1) return 0; else break; } } *ps2 = s2; return 1; } #define STRING_CMP_VALUE(s1,s2,len,is_fail) do {\ is_fail = 0;\ while (len-- > 0) {\ if (*s1++ != *s2++) {\ is_fail = 1; break;\ }\ }\ } while(0) #define STRING_CMP_VALUE_IC(case_fold_flag,s1,ps2,len,is_fail) do {\ if (string_cmp_ic(encode, case_fold_flag, s1, ps2, len) == 0) \ is_fail = 1; \ else \ is_fail = 0; \ } while(0) #define IS_EMPTY_STR (str == end) #define ON_STR_BEGIN(s) ((s) == str) #define ON_STR_END(s) ((s) == end) #define DATA_ENSURE_CHECK1 (s < right_range) #define DATA_ENSURE_CHECK(n) ((n) <= right_range - s) #define DATA_ENSURE(n) if (right_range - s < (n)) goto fail #define INIT_RIGHT_RANGE right_range = (UChar* )in_right_range #ifdef USE_CAPTURE_HISTORY static int make_capture_history_tree(OnigCaptureTreeNode* node, StackType** kp, StackType* stk_top, UChar* str, regex_t* reg) { int n, r; OnigCaptureTreeNode* child; StackType* k = *kp; while (k < stk_top) { if (k->type == STK_MEM_START) { n = k->zid; if (n <= ONIG_MAX_CAPTURE_HISTORY_GROUP && MEM_STATUS_AT(reg->capture_history, n) != 0) { child = history_node_new(); CHECK_NULL_RETURN_MEMERR(child); child->group = n; child->beg = (int )(k->u.mem.pstr - str); r = history_tree_add_child(node, child); if (r != 0) return r; *kp = (k + 1); r = make_capture_history_tree(child, kp, stk_top, str, reg); if (r != 0) return r; k = *kp; child->end = (int )(k->u.mem.pstr - str); } } else if (k->type == STK_MEM_END) { if (k->zid == node->group) { node->end = (int )(k->u.mem.pstr - str); *kp = k; return 0; } } k++; } return 1; /* 1: root node ending. */ } #endif #ifdef USE_BACKREF_WITH_LEVEL static int mem_is_in_memp(int mem, int num, MemNumType* memp) { int i; for (i = 0; i < num; i++) { if (mem == (int )memp[i]) return 1; } return 0; } static int backref_match_at_nested_level(regex_t* reg, StackType* top, StackType* stk_base, int ignore_case, int case_fold_flag, int nest, int mem_num, MemNumType* memp, UChar** s, const UChar* send) { UChar *ss, *p, *pstart, *pend = NULL_UCHARP; int level; StackType* k; level = 0; k = top; k--; while (k >= stk_base) { if (k->type == STK_CALL_FRAME) { level--; } else if (k->type == STK_RETURN) { level++; } else if (level == nest) { if (k->type == STK_MEM_START) { if (mem_is_in_memp(k->zid, mem_num, memp)) { pstart = k->u.mem.pstr; if (IS_NOT_NULL(pend)) { if (pend - pstart > send - *s) return 0; /* or goto next_mem; */ p = pstart; ss = *s; if (ignore_case != 0) { if (string_cmp_ic(reg->enc, case_fold_flag, pstart, &ss, (int )(pend - pstart)) == 0) return 0; /* or goto next_mem; */ } else { while (p < pend) { if (*p++ != *ss++) return 0; /* or goto next_mem; */ } } *s = ss; return 1; } } } else if (k->type == STK_MEM_END) { if (mem_is_in_memp(k->zid, mem_num, memp)) { pend = k->u.mem.pstr; } } } k--; } return 0; } static int backref_check_at_nested_level(regex_t* reg, StackType* top, StackType* stk_base, int nest, int mem_num, MemNumType* memp) { int level; StackType* k; level = 0; k = top; k--; while (k >= stk_base) { if (k->type == STK_CALL_FRAME) { level--; } else if (k->type == STK_RETURN) { level++; } else if (level == nest) { if (k->type == STK_MEM_END) { if (mem_is_in_memp(k->zid, mem_num, memp)) { return 1; } } } k--; } return 0; } #endif /* USE_BACKREF_WITH_LEVEL */ static int SubexpCallMaxNestLevel = DEFAULT_SUBEXP_CALL_MAX_NEST_LEVEL; #ifdef ONIG_DEBUG_STATISTICS #ifdef USE_TIMEOFDAY static struct timeval ts, te; #define GETTIME(t) gettimeofday(&(t), (struct timezone* )0) #define TIMEDIFF(te,ts) (((te).tv_usec - (ts).tv_usec) + \ (((te).tv_sec - (ts).tv_sec)*1000000)) #else static struct tms ts, te; #define GETTIME(t) times(&(t)) #define TIMEDIFF(te,ts) ((te).tms_utime - (ts).tms_utime) #endif /* USE_TIMEOFDAY */ static int OpCounter[256]; static int OpPrevCounter[256]; static unsigned long OpTime[256]; static int OpCurr = OP_FINISH; static int OpPrevTarget = OP_FAIL; static int MaxStackDepth = 0; #define SOP_IN(opcode) do {\ if (opcode == OpPrevTarget) OpPrevCounter[OpCurr]++;\ OpCurr = opcode;\ OpCounter[opcode]++;\ GETTIME(ts);\ } while(0) #define SOP_OUT do {\ GETTIME(te);\ OpTime[OpCurr] += TIMEDIFF(te, ts);\ } while(0) extern void onig_statistics_init(void) { int i; for (i = 0; i < 256; i++) { OpCounter[i] = OpPrevCounter[i] = 0; OpTime[i] = 0; } MaxStackDepth = 0; } extern int onig_print_statistics(FILE* f) { int r; int i; r = fprintf(f, " count prev time\n"); if (r < 0) return -1; for (i = 0; OpInfo[i].opcode >= 0; i++) { r = fprintf(f, "%8d: %8d: %10ld: %s\n", OpCounter[i], OpPrevCounter[i], OpTime[i], OpInfo[i].name); if (r < 0) return -1; } r = fprintf(f, "\nmax stack depth: %d\n", MaxStackDepth); if (r < 0) return -1; return 0; } #define STACK_INC do {\ stk++;\ if (stk - stk_base > MaxStackDepth) \ MaxStackDepth = stk - stk_base;\ } while(0) #else #define STACK_INC stk++ #define SOP_IN(opcode) #define SOP_OUT #endif /* matching region of POSIX API */ typedef int regoff_t; typedef struct { regoff_t rm_so; regoff_t rm_eo; } posix_regmatch_t; #ifdef USE_THREADED_CODE #define BYTECODE_INTERPRETER_START GOTO_OP; #define BYTECODE_INTERPRETER_END #define CASE_OP(x) L_##x: SOP_IN(OP_##x); MATCH_DEBUG_OUT(0) #define DEFAULT_OP /* L_DEFAULT: */ #define NEXT_OP JUMP_OP #define JUMP_OP GOTO_OP #ifdef USE_DIRECT_THREADED_CODE #define GOTO_OP goto *(p->opaddr) #else #define GOTO_OP goto *opcode_to_label[p->opcode] #endif #define BREAK_OP /* Nothing */ #else #define BYTECODE_INTERPRETER_START \ while (1) {\ MATCH_DEBUG_OUT(0)\ switch (p->opcode) { #define BYTECODE_INTERPRETER_END } } #define CASE_OP(x) case OP_##x: SOP_IN(OP_##x); #define DEFAULT_OP default: #define NEXT_OP break #define JUMP_OP GOTO_OP #define GOTO_OP continue; break #define BREAK_OP break #endif /* USE_THREADED_CODE */ #define INC_OP p++ #define JUMP_OUT_WITH_SPREV_SET SOP_OUT; NEXT_OP #define JUMP_OUT SOP_OUT; JUMP_OP #define BREAK_OUT SOP_OUT; BREAK_OP #define CHECK_INTERRUPT_JUMP_OUT SOP_OUT; CHECK_INTERRUPT_IN_MATCH; JUMP_OP #ifdef ONIG_DEBUG_MATCH #define MATCH_DEBUG_OUT(offset) do {\ Operation *xp;\ UChar *q, *bp, buf[50];\ int len, spos;\ spos = IS_NOT_NULL(s) ? (int )(s - str) : -1;\ xp = p - (offset);\ fprintf(DBGFP, "%7u: %7ld: %4d> \"",\ counter, GET_STACK_INDEX(stk), spos);\ counter++;\ bp = buf;\ if (IS_NOT_NULL(s)) {\ for (i = 0, q = s; i < 7 && q < end; i++) {\ len = enclen(encode, q);\ while (len-- > 0) *bp++ = *q++;\ }\ if (q < end) { xmemcpy(bp, "...\"", 4); bp += 4; }\ else { xmemcpy(bp, "\"", 1); bp += 1; }\ }\ else {\ xmemcpy(bp, "\"", 1); bp += 1;\ }\ *bp = 0;\ fputs((char* )buf, DBGFP);\ for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', DBGFP);\ if (xp == FinishCode)\ fprintf(DBGFP, "----: finish");\ else {\ int index;\ enum OpCode zopcode;\ Operation* addr;\ index = (int )(xp - reg->ops);\ fprintf(DBGFP, "%4d: ", index);\ print_compiled_byte_code(DBGFP, reg, index, reg->ops, encode); \ zopcode = GET_OPCODE(reg, index);\ if (zopcode == OP_RETURN) {\ GET_STACK_RETURN_CALL(stkp, addr);\ fprintf(DBGFP, " f:%ld -> %d", \ GET_STACK_INDEX(stkp), (int )(addr - reg->ops));\ }\ }\ fprintf(DBGFP, "\n");\ } while(0); #else #define MATCH_DEBUG_OUT(offset) #endif #define MATCH_AT_ERROR_RETURN(err_code) do {\ best_len = err_code; goto match_at_end;\ } while(0) #define MATCH_COUNTER_OUT(title) do {\ int i;\ fprintf(DBGFP, "%s (%ld): retry limit: %8lu/%8lu, subexp_call: %8lu\n", (title), (sstart - str), retry_in_match_counter, retry_limit_in_match, msa->subexp_call_in_search_counter); \ fprintf(DBGFP, " ");\ for (i = 0; i < MAX_SUBEXP_CALL_COUNTERS; i++) {\ fprintf(DBGFP, " %6lu", subexp_call_counters[i]);\ }\ fprintf(DBGFP, "\n");\ fflush(DBGFP);\ } while (0) /* match data(str - end) from position (sstart). */ static int match_at(regex_t* reg, const UChar* str, const UChar* end, const UChar* in_right_range, const UChar* sstart, MatchArg* msa) { #if defined(USE_DIRECT_THREADED_CODE) static Operation FinishCode[] = { { .opaddr=&&L_FINISH } }; #else static Operation FinishCode[] = { { OP_FINISH } }; #endif #ifdef USE_THREADED_CODE static const void *opcode_to_label[] = { &&L_FINISH, &&L_END, &&L_STR_1, &&L_STR_2, &&L_STR_3, &&L_STR_4, &&L_STR_5, &&L_STR_N, &&L_STR_MB2N1, &&L_STR_MB2N2, &&L_STR_MB2N3, &&L_STR_MB2N, &&L_STR_MB3N, &&L_STR_MBN, &&L_CCLASS, &&L_CCLASS_MB, &&L_CCLASS_MIX, &&L_CCLASS_NOT, &&L_CCLASS_MB_NOT, &&L_CCLASS_MIX_NOT, &&L_ANYCHAR, &&L_ANYCHAR_ML, &&L_ANYCHAR_STAR, &&L_ANYCHAR_ML_STAR, &&L_ANYCHAR_STAR_PEEK_NEXT, &&L_ANYCHAR_ML_STAR_PEEK_NEXT, &&L_WORD, &&L_WORD_ASCII, &&L_NO_WORD, &&L_NO_WORD_ASCII, &&L_WORD_BOUNDARY, &&L_NO_WORD_BOUNDARY, &&L_WORD_BEGIN, &&L_WORD_END, &&L_TEXT_SEGMENT_BOUNDARY, &&L_BEGIN_BUF, &&L_END_BUF, &&L_BEGIN_LINE, &&L_END_LINE, &&L_SEMI_END_BUF, &&L_CHECK_POSITION, &&L_BACKREF1, &&L_BACKREF2, &&L_BACKREF_N, &&L_BACKREF_N_IC, &&L_BACKREF_MULTI, &&L_BACKREF_MULTI_IC, #ifdef USE_BACKREF_WITH_LEVEL &&L_BACKREF_WITH_LEVEL, &&L_BACKREF_WITH_LEVEL_IC, #endif &&L_BACKREF_CHECK, #ifdef USE_BACKREF_WITH_LEVEL &&L_BACKREF_CHECK_WITH_LEVEL, #endif &&L_MEM_START, &&L_MEM_START_PUSH, &&L_MEM_END_PUSH, #ifdef USE_CALL &&L_MEM_END_PUSH_REC, #endif &&L_MEM_END, #ifdef USE_CALL &&L_MEM_END_REC, #endif &&L_FAIL, &&L_JUMP, &&L_PUSH, &&L_PUSH_SUPER, &&L_POP, &&L_POP_TO_MARK, #ifdef USE_OP_PUSH_OR_JUMP_EXACT &&L_PUSH_OR_JUMP_EXACT1, #endif &&L_PUSH_IF_PEEK_NEXT, &&L_REPEAT, &&L_REPEAT_NG, &&L_REPEAT_INC, &&L_REPEAT_INC_NG, &&L_EMPTY_CHECK_START, &&L_EMPTY_CHECK_END, &&L_EMPTY_CHECK_END_MEMST, #ifdef USE_CALL &&L_EMPTY_CHECK_END_MEMST_PUSH, #endif &&L_MOVE, &&L_STEP_BACK_START, &&L_STEP_BACK_NEXT, &&L_CUT_TO_MARK, &&L_MARK, &&L_SAVE_VAL, &&L_UPDATE_VAR, #ifdef USE_CALL &&L_CALL, &&L_RETURN, #endif #ifdef USE_CALLOUT &&L_CALLOUT_CONTENTS, &&L_CALLOUT_NAME, #endif }; #endif int i, n, num_mem, best_len, pop_level; LengthType tlen, tlen2; MemNumType mem; RelAddrType addr; UChar *s, *ps; UChar *right_range; int is_alloca; char *alloc_base; StackType *stk_base, *stk, *stk_end; StackType *stkp; /* used as any purpose. */ StkPtrType *mem_start_stk, *mem_end_stk; UChar* keep; OnigRegion* region; #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR StackIndex *repeat_stk; StackIndex *empty_check_stk; #endif #ifdef USE_RETRY_LIMIT unsigned long retry_limit_in_match; unsigned long retry_in_match_counter; #endif #ifdef USE_CALLOUT int of; #endif #ifdef ONIG_DEBUG_MATCH_COUNTER #define MAX_SUBEXP_CALL_COUNTERS 9 unsigned long subexp_call_counters[MAX_SUBEXP_CALL_COUNTERS]; #endif OnigOptionType options; Operation* p = reg->ops; OnigEncoding encode = reg->enc; OnigCaseFoldType case_fold_flag = reg->case_fold_flag; #ifdef USE_CALL unsigned long subexp_call_nest_counter = 0; #endif #ifdef ONIG_DEBUG_MATCH static unsigned int counter = 1; #endif #ifdef ONIG_DEBUG_MATCH_COUNTER for (i = 0; i < MAX_SUBEXP_CALL_COUNTERS; i++) { subexp_call_counters[i] = 0; } #endif #ifdef USE_DIRECT_THREADED_CODE if (IS_NULL(msa)) { for (i = 0; i < reg->ops_used; i++) { const void* addr; addr = opcode_to_label[reg->ocs[i]]; p->opaddr = addr; p++; } return ONIG_NORMAL; } #endif options = msa->options; #ifdef USE_CALLOUT msa->mp->match_at_call_counter++; #endif #ifdef USE_RETRY_LIMIT retry_limit_in_match = msa->retry_limit_in_match; if (msa->retry_limit_in_search != 0) { unsigned long rem = msa->retry_limit_in_search - msa->retry_limit_in_search_counter; if (rem < retry_limit_in_match || retry_limit_in_match == 0) retry_limit_in_match = rem; } #endif pop_level = reg->stack_pop_level; num_mem = reg->num_mem; STACK_INIT(INIT_MATCH_STACK_SIZE); UPDATE_FOR_STACK_REALLOC; for (i = 1; i <= num_mem; i++) { mem_start_stk[i].i = mem_end_stk[i].i = INVALID_STACK_INDEX; } #ifdef ONIG_DEBUG_MATCH fprintf(DBGFP, "match_at: str: %p, end: %p, start: %p\n", str, end, sstart); fprintf(DBGFP, "size: %d, start offset: %d\n", (int )(end - str), (int )(sstart - str)); #endif best_len = ONIG_MISMATCH; keep = s = (UChar* )sstart; STACK_PUSH_BOTTOM(STK_ALT, FinishCode); /* bottom stack */ INIT_RIGHT_RANGE; #ifdef USE_RETRY_LIMIT retry_in_match_counter = 0; #endif BYTECODE_INTERPRETER_START { CASE_OP(END) if (OPTON_MATCH_WHOLE_STRING(options)) { if (! ON_STR_END(s)) goto fail; } n = (int )(s - sstart); if (n == 0 && OPTON_FIND_NOT_EMPTY(options)) { best_len = ONIG_MISMATCH; goto fail; /* for retry */ } #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (OPTON_FIND_LONGEST(options)) { if (n > best_len) { if (n > msa->best_len) { best_len = n; msa->best_len = n; msa->best_s = (UChar* )sstart; } else { if (s >= in_right_range && msa->best_s == sstart) { goto op_end_out; } else { goto fail; /* for retry */ } } } else { goto fail; /* for retry */ } } else { best_len = n; } #else best_len = n; #endif /* set region */ region = msa->region; if (region) { if (keep > s) keep = s; #ifdef USE_POSIX_API if (OPTON_POSIX_REGION(options)) { posix_regmatch_t* rmt = (posix_regmatch_t* )region; rmt[0].rm_so = (regoff_t )(keep - str); rmt[0].rm_eo = (regoff_t )(s - str); for (i = 1; i <= num_mem; i++) { if (mem_end_stk[i].i != INVALID_STACK_INDEX) { rmt[i].rm_so = (regoff_t )(STACK_MEM_START(reg, i) - str); rmt[i].rm_eo = (regoff_t )(STACK_MEM_END(reg, i) - str); } else { rmt[i].rm_so = rmt[i].rm_eo = ONIG_REGION_NOTPOS; } } } else { #endif /* USE_POSIX_API */ region->beg[0] = (int )(keep - str); region->end[0] = (int )(s - str); for (i = 1; i <= num_mem; i++) { if (mem_end_stk[i].i != INVALID_STACK_INDEX) { region->beg[i] = (int )(STACK_MEM_START(reg, i) - str); region->end[i] = (int )(STACK_MEM_END(reg, i) - str); } else { region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS; } } #ifdef USE_CAPTURE_HISTORY if (reg->capture_history != 0) { OnigCaptureTreeNode* node; if (IS_NULL(region->history_root)) { region->history_root = node = history_node_new(); CHECK_NULL_RETURN_MEMERR(node); } else { node = region->history_root; history_tree_clear(node); } node->group = 0; node->beg = (int )(keep - str); node->end = (int )(s - str); stkp = stk_base; i = make_capture_history_tree(region->history_root, &stkp, stk, (UChar* )str, reg); if (i < 0) MATCH_AT_ERROR_RETURN(i); } #endif /* USE_CAPTURE_HISTORY */ #ifdef USE_POSIX_API } /* else OPTON_POSIX_REGION() */ #endif } /* if (region) */ if (OPTON_CALLBACK_EACH_MATCH(options) && IS_NOT_NULL(CallbackEachMatch)) { i = CallbackEachMatch(str, end, sstart, region, msa->mp->callout_user_data); if (i < 0) { SOP_OUT; MATCH_AT_ERROR_RETURN(i); } #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (! OPTON_FIND_LONGEST(options)) #endif best_len = ONIG_MISMATCH; goto fail; } #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (OPTON_FIND_LONGEST(options)) goto fail; #endif op_end_out: /* default behavior: return first-matching result. */ SOP_OUT; goto match_at_end; CASE_OP(STR_1) DATA_ENSURE(1); ps = p->exact.s; if (*ps != *s) goto fail; s++; INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(STR_2) DATA_ENSURE(2); ps = p->exact.s; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; s++; INC_OP; JUMP_OUT; CASE_OP(STR_3) DATA_ENSURE(3); ps = p->exact.s; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; s++; INC_OP; JUMP_OUT; CASE_OP(STR_4) DATA_ENSURE(4); ps = p->exact.s; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; s++; INC_OP; JUMP_OUT; CASE_OP(STR_5) DATA_ENSURE(5); ps = p->exact.s; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; s++; INC_OP; JUMP_OUT; CASE_OP(STR_N) tlen = p->exact_n.n; DATA_ENSURE(tlen); ps = p->exact_n.s; while (tlen-- > 0) { if (*ps++ != *s++) goto fail; } INC_OP; JUMP_OUT; CASE_OP(STR_MB2N1) DATA_ENSURE(2); ps = p->exact.s; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; s++; INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(STR_MB2N2) DATA_ENSURE(4); ps = p->exact.s; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; s++; INC_OP; JUMP_OUT; CASE_OP(STR_MB2N3) DATA_ENSURE(6); ps = p->exact.s; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; INC_OP; JUMP_OUT; CASE_OP(STR_MB2N) tlen = p->exact_n.n; DATA_ENSURE(tlen * 2); ps = p->exact_n.s; while (tlen-- > 0) { if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; } INC_OP; JUMP_OUT; CASE_OP(STR_MB3N) tlen = p->exact_n.n; DATA_ENSURE(tlen * 3); ps = p->exact_n.s; while (tlen-- > 0) { if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; if (*ps != *s) goto fail; ps++; s++; } INC_OP; JUMP_OUT; CASE_OP(STR_MBN) tlen = p->exact_len_n.len; /* mb byte len */ tlen2 = p->exact_len_n.n; /* number of chars */ tlen2 *= tlen; DATA_ENSURE(tlen2); ps = p->exact_len_n.s; while (tlen2-- > 0) { if (*ps != *s) goto fail; ps++; s++; } INC_OP; JUMP_OUT; CASE_OP(CCLASS) DATA_ENSURE(1); if (BITSET_AT(p->cclass.bsp, *s) == 0) goto fail; if (ONIGENC_IS_MBC_HEAD(encode, s)) goto fail; s++; INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(CCLASS_MB) DATA_ENSURE(1); if (! ONIGENC_IS_MBC_HEAD(encode, s)) goto fail; cclass_mb: { OnigCodePoint code; UChar *ss; int mb_len; mb_len = enclen(encode, s); DATA_ENSURE(mb_len); ss = s; s += mb_len; code = ONIGENC_MBC_TO_CODE(encode, ss, s); if (! onig_is_in_code_range(p->cclass_mb.mb, code)) goto fail; } INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(CCLASS_MIX) DATA_ENSURE(1); if (ONIGENC_IS_MBC_HEAD(encode, s)) { goto cclass_mb; } else { if (BITSET_AT(p->cclass_mix.bsp, *s) == 0) goto fail; s++; } INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(CCLASS_NOT) DATA_ENSURE(1); if (BITSET_AT(p->cclass.bsp, *s) != 0) goto fail; s += enclen(encode, s); INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(CCLASS_MB_NOT) DATA_ENSURE(1); if (! ONIGENC_IS_MBC_HEAD(encode, s)) { s++; goto cc_mb_not_success; } cclass_mb_not: { OnigCodePoint code; UChar *ss; int mb_len = enclen(encode, s); if (! DATA_ENSURE_CHECK(mb_len)) { DATA_ENSURE(1); s = (UChar* )end; goto cc_mb_not_success; } ss = s; s += mb_len; code = ONIGENC_MBC_TO_CODE(encode, ss, s); if (onig_is_in_code_range(p->cclass_mb.mb, code)) goto fail; } cc_mb_not_success: INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(CCLASS_MIX_NOT) DATA_ENSURE(1); if (ONIGENC_IS_MBC_HEAD(encode, s)) { goto cclass_mb_not; } else { if (BITSET_AT(p->cclass_mix.bsp, *s) != 0) goto fail; s++; } INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(ANYCHAR) DATA_ENSURE(1); n = enclen(encode, s); DATA_ENSURE(n); if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail; s += n; INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(ANYCHAR_ML) DATA_ENSURE(1); n = enclen(encode, s); DATA_ENSURE(n); s += n; INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(ANYCHAR_STAR) INC_OP; while (DATA_ENSURE_CHECK1) { STACK_PUSH_ALT(p, s); n = enclen(encode, s); DATA_ENSURE(n); if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail; s += n; } JUMP_OUT; CASE_OP(ANYCHAR_ML_STAR) INC_OP; while (DATA_ENSURE_CHECK1) { STACK_PUSH_ALT(p, s); n = enclen(encode, s); if (n > 1) { DATA_ENSURE(n); s += n; } else { s++; } } JUMP_OUT; CASE_OP(ANYCHAR_STAR_PEEK_NEXT) { UChar c; c = p->anychar_star_peek_next.c; INC_OP; while (DATA_ENSURE_CHECK1) { if (c == *s) { STACK_PUSH_ALT(p, s); } n = enclen(encode, s); DATA_ENSURE(n); if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) goto fail; s += n; } } JUMP_OUT; CASE_OP(ANYCHAR_ML_STAR_PEEK_NEXT) { UChar c; c = p->anychar_star_peek_next.c; INC_OP; while (DATA_ENSURE_CHECK1) { if (c == *s) { STACK_PUSH_ALT(p, s); } n = enclen(encode, s); if (n > 1) { DATA_ENSURE(n); s += n; } else { s++; } } } JUMP_OUT; CASE_OP(WORD) DATA_ENSURE(1); if (! ONIGENC_IS_MBC_WORD(encode, s, end)) goto fail; s += enclen(encode, s); INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(WORD_ASCII) DATA_ENSURE(1); if (! ONIGENC_IS_MBC_WORD_ASCII(encode, s, end)) goto fail; s += enclen(encode, s); INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(NO_WORD) DATA_ENSURE(1); if (ONIGENC_IS_MBC_WORD(encode, s, end)) goto fail; s += enclen(encode, s); INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(NO_WORD_ASCII) DATA_ENSURE(1); if (ONIGENC_IS_MBC_WORD_ASCII(encode, s, end)) goto fail; s += enclen(encode, s); INC_OP; JUMP_OUT_WITH_SPREV_SET; CASE_OP(WORD_BOUNDARY) { ModeType mode; mode = p->word_boundary.mode; if (ON_STR_BEGIN(s)) { DATA_ENSURE(1); if (! IS_MBC_WORD_ASCII_MODE(encode, s, end, mode)) goto fail; } else { UChar* sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); if (ON_STR_END(s)) { if (! IS_MBC_WORD_ASCII_MODE(encode, sprev, end, mode)) goto fail; } else { if (IS_MBC_WORD_ASCII_MODE(encode, s, end, mode) == IS_MBC_WORD_ASCII_MODE(encode, sprev, end, mode)) goto fail; } } } INC_OP; JUMP_OUT; CASE_OP(NO_WORD_BOUNDARY) { ModeType mode; mode = p->word_boundary.mode; if (ON_STR_BEGIN(s)) { if (DATA_ENSURE_CHECK1 && IS_MBC_WORD_ASCII_MODE(encode, s, end, mode)) goto fail; } else { UChar* sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); if (ON_STR_END(s)) { if (IS_MBC_WORD_ASCII_MODE(encode, sprev, end, mode)) goto fail; } else { if (IS_MBC_WORD_ASCII_MODE(encode, s, end, mode) != IS_MBC_WORD_ASCII_MODE(encode, sprev, end, mode)) goto fail; } } } INC_OP; JUMP_OUT; #ifdef USE_WORD_BEGIN_END CASE_OP(WORD_BEGIN) { ModeType mode; mode = p->word_boundary.mode; if (DATA_ENSURE_CHECK1 && IS_MBC_WORD_ASCII_MODE(encode, s, end, mode)) { UChar* sprev; if (ON_STR_BEGIN(s)) { INC_OP; JUMP_OUT; } sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); if (! IS_MBC_WORD_ASCII_MODE(encode, sprev, end, mode)) { INC_OP; JUMP_OUT; } } } goto fail; CASE_OP(WORD_END) { ModeType mode; mode = p->word_boundary.mode; if (! ON_STR_BEGIN(s)) { UChar* sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); if (IS_MBC_WORD_ASCII_MODE(encode, sprev, end, mode)) { if (ON_STR_END(s) || ! IS_MBC_WORD_ASCII_MODE(encode, s, end, mode)) { INC_OP; JUMP_OUT; } } } } goto fail; #endif CASE_OP(TEXT_SEGMENT_BOUNDARY) { int is_break; UChar* sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); switch (p->text_segment_boundary.type) { case EXTENDED_GRAPHEME_CLUSTER_BOUNDARY: is_break = onigenc_egcb_is_break_position(encode, s, sprev, str, end); break; #ifdef USE_UNICODE_WORD_BREAK case WORD_BOUNDARY: is_break = onigenc_wb_is_break_position(encode, s, sprev, str, end); break; #endif default: MATCH_AT_ERROR_RETURN(ONIGERR_UNDEFINED_BYTECODE); break; } if (p->text_segment_boundary.not != 0) is_break = ! is_break; if (is_break != 0) { INC_OP; JUMP_OUT; } else { goto fail; } } CASE_OP(BEGIN_BUF) if (! ON_STR_BEGIN(s)) goto fail; if (OPTON_NOTBOL(options)) goto fail; if (OPTON_NOT_BEGIN_STRING(options)) goto fail; INC_OP; JUMP_OUT; CASE_OP(END_BUF) if (! ON_STR_END(s)) goto fail; if (OPTON_NOTEOL(options)) goto fail; if (OPTON_NOT_END_STRING(options)) goto fail; INC_OP; JUMP_OUT; CASE_OP(BEGIN_LINE) if (ON_STR_BEGIN(s)) { if (OPTON_NOTBOL(options)) goto fail; INC_OP; JUMP_OUT; } else if (! ON_STR_END(s)) { UChar* sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) { INC_OP; JUMP_OUT; } } goto fail; CASE_OP(END_LINE) if (ON_STR_END(s)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE UChar* sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) { #endif if (OPTON_NOTEOL(options)) goto fail; INC_OP; JUMP_OUT; #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE } #endif } else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end)) { INC_OP; JUMP_OUT; } #ifdef USE_CRNL_AS_LINE_TERMINATOR else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) { INC_OP; JUMP_OUT; } #endif goto fail; CASE_OP(SEMI_END_BUF) if (ON_STR_END(s)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE UChar* sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s); if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE(encode, sprev, end)) { #endif if (OPTON_NOTEOL(options)) goto fail; if (OPTON_NOT_END_STRING(options)) goto fail; INC_OP; JUMP_OUT; #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE } #endif } else if (ONIGENC_IS_MBC_NEWLINE(encode, s, end) && ON_STR_END(s + enclen(encode, s))) { if (OPTON_NOTEOL(options)) goto fail; if (OPTON_NOT_END_STRING(options)) goto fail; INC_OP; JUMP_OUT; } #ifdef USE_CRNL_AS_LINE_TERMINATOR else if (ONIGENC_IS_MBC_CRNL(encode, s, end)) { UChar* ss = s + enclen(encode, s); ss += enclen(encode, ss); if (ON_STR_END(ss)) { if (OPTON_NOTEOL(options)) goto fail; if (OPTON_NOT_END_STRING(options)) goto fail; INC_OP; JUMP_OUT; } } #endif goto fail; CASE_OP(CHECK_POSITION) switch (p->check_position.type) { case CHECK_POSITION_SEARCH_START: if (s != msa->start) goto fail; if (OPTON_NOT_BEGIN_POSITION(options)) goto fail; break; case CHECK_POSITION_CURRENT_RIGHT_RANGE: if (s != right_range) goto fail; break; default: break; } INC_OP; JUMP_OUT; CASE_OP(MEM_START_PUSH) mem = p->memory_start.num; STACK_PUSH_MEM_START(mem, s); INC_OP; JUMP_OUT; CASE_OP(MEM_START) mem = p->memory_start.num; mem_start_stk[mem].s = s; INC_OP; JUMP_OUT; CASE_OP(MEM_END_PUSH) mem = p->memory_end.num; STACK_PUSH_MEM_END(mem, s); INC_OP; JUMP_OUT; CASE_OP(MEM_END) mem = p->memory_end.num; mem_end_stk[mem].s = s; INC_OP; JUMP_OUT; #ifdef USE_CALL CASE_OP(MEM_END_PUSH_REC) { StackIndex si; mem = p->memory_end.num; STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */ si = GET_STACK_INDEX(stkp); STACK_PUSH_MEM_END(mem, s); mem_start_stk[mem].i = si; INC_OP; JUMP_OUT; } CASE_OP(MEM_END_REC) mem = p->memory_end.num; mem_end_stk[mem].s = s; STACK_GET_MEM_START(mem, stkp); if (MEM_STATUS_AT(reg->push_mem_start, mem)) mem_start_stk[mem].i = GET_STACK_INDEX(stkp); else mem_start_stk[mem].s = stkp->u.mem.pstr; STACK_PUSH_MEM_END_MARK(mem); INC_OP; JUMP_OUT; #endif CASE_OP(BACKREF1) mem = 1; goto backref; CASE_OP(BACKREF2) mem = 2; goto backref; CASE_OP(BACKREF_N) mem = p->backref_n.n1; backref: { UChar *pstart, *pend; if (mem_end_stk[mem].i == INVALID_STACK_INDEX) goto fail; if (mem_start_stk[mem].i == INVALID_STACK_INDEX) goto fail; pstart = STACK_MEM_START(reg, mem); pend = STACK_MEM_END(reg, mem); n = (int )(pend - pstart); if (n != 0) { DATA_ENSURE(n); STRING_CMP(s, pstart, n); } } INC_OP; JUMP_OUT; CASE_OP(BACKREF_N_IC) mem = p->backref_n.n1; { UChar *pstart, *pend; if (mem_end_stk[mem].i == INVALID_STACK_INDEX) goto fail; if (mem_start_stk[mem].i == INVALID_STACK_INDEX) goto fail; pstart = STACK_MEM_START(reg, mem); pend = STACK_MEM_END(reg, mem); n = (int )(pend - pstart); if (n != 0) { DATA_ENSURE(n); STRING_CMP_IC(case_fold_flag, pstart, &s, n); } } INC_OP; JUMP_OUT; CASE_OP(BACKREF_MULTI) { int is_fail; UChar *pstart, *pend, *swork; tlen = p->backref_general.num; for (i = 0; i < tlen; i++) { mem = tlen == 1 ? p->backref_general.n1 : p->backref_general.ns[i]; if (mem_end_stk[mem].i == INVALID_STACK_INDEX) continue; if (mem_start_stk[mem].i == INVALID_STACK_INDEX) continue; pstart = STACK_MEM_START(reg, mem); pend = STACK_MEM_END(reg, mem); n = (int )(pend - pstart); if (n != 0) { if (! DATA_ENSURE_CHECK(n)) continue; swork = s; STRING_CMP_VALUE(swork, pstart, n, is_fail); if (is_fail) continue; s = swork; } break; /* success */ } if (i == tlen) goto fail; } INC_OP; JUMP_OUT; CASE_OP(BACKREF_MULTI_IC) { int is_fail; UChar *pstart, *pend, *swork; tlen = p->backref_general.num; for (i = 0; i < tlen; i++) { mem = tlen == 1 ? p->backref_general.n1 : p->backref_general.ns[i]; if (mem_end_stk[mem].i == INVALID_STACK_INDEX) continue; if (mem_start_stk[mem].i == INVALID_STACK_INDEX) continue; pstart = STACK_MEM_START(reg, mem); pend = STACK_MEM_END(reg, mem); n = (int )(pend - pstart); if (n != 0) { if (! DATA_ENSURE_CHECK(n)) continue; swork = s; STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, is_fail); if (is_fail) continue; s = swork; } break; /* success */ } if (i == tlen) goto fail; } INC_OP; JUMP_OUT; #ifdef USE_BACKREF_WITH_LEVEL CASE_OP(BACKREF_WITH_LEVEL_IC) n = 1; /* ignore case */ goto backref_with_level; CASE_OP(BACKREF_WITH_LEVEL) { int level; MemNumType* mems; n = 0; backref_with_level: level = p->backref_general.nest_level; tlen = p->backref_general.num; mems = tlen == 1 ? &(p->backref_general.n1) : p->backref_general.ns; if (! backref_match_at_nested_level(reg, stk, stk_base, n, case_fold_flag, level, (int )tlen, mems, &s, end)) { goto fail; } } INC_OP; JUMP_OUT; #endif CASE_OP(BACKREF_CHECK) { MemNumType* mems; tlen = p->backref_general.num; mems = tlen == 1 ? &(p->backref_general.n1) : p->backref_general.ns; for (i = 0; i < tlen; i++) { mem = mems[i]; if (mem_end_stk[mem].i == INVALID_STACK_INDEX) continue; if (mem_start_stk[mem].i == INVALID_STACK_INDEX) continue; break; /* success */ } if (i == tlen) goto fail; } INC_OP; JUMP_OUT; #ifdef USE_BACKREF_WITH_LEVEL CASE_OP(BACKREF_CHECK_WITH_LEVEL) { LengthType level; MemNumType* mems; level = p->backref_general.nest_level; tlen = p->backref_general.num; mems = tlen == 1 ? &(p->backref_general.n1) : p->backref_general.ns; if (backref_check_at_nested_level(reg, stk, stk_base, (int )level, (int )tlen, mems) == 0) goto fail; } INC_OP; JUMP_OUT; #endif CASE_OP(EMPTY_CHECK_START) mem = p->empty_check_start.mem; /* mem: null check id */ STACK_PUSH_EMPTY_CHECK_START(mem, s); INC_OP; JUMP_OUT; CASE_OP(EMPTY_CHECK_END) { int is_empty; mem = p->empty_check_end.mem; /* mem: null check id */ STACK_EMPTY_CHECK(is_empty, mem, s); INC_OP; if (is_empty) { #ifdef ONIG_DEBUG_MATCH fprintf(DBGFP, "EMPTY_CHECK_END: skip id:%d, s:%p\n", (int )mem, s); #endif empty_check_found: /* empty loop founded, skip next instruction */ #if defined(ONIG_DEBUG) && !defined(USE_DIRECT_THREADED_CODE) switch (p->opcode) { case OP_JUMP: case OP_PUSH: case OP_REPEAT_INC: case OP_REPEAT_INC_NG: INC_OP; break; default: MATCH_AT_ERROR_RETURN(ONIGERR_UNEXPECTED_BYTECODE); break; } #else INC_OP; #endif } } JUMP_OUT; #ifdef USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT CASE_OP(EMPTY_CHECK_END_MEMST) { int is_empty; mem = p->empty_check_end.mem; /* mem: null check id */ STACK_EMPTY_CHECK_MEM(is_empty, mem, p->empty_check_end.empty_status_mem, s, reg); INC_OP; if (is_empty) { #ifdef ONIG_DEBUG_MATCH fprintf(DBGFP, "EMPTY_CHECK_END_MEM: skip id:%d, s:%p\n", (int)mem, s); #endif if (is_empty == -1) goto fail; goto empty_check_found; } } JUMP_OUT; #endif #ifdef USE_CALL CASE_OP(EMPTY_CHECK_END_MEMST_PUSH) { int is_empty; mem = p->empty_check_end.mem; /* mem: null check id */ #ifdef USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT STACK_EMPTY_CHECK_MEM_REC(is_empty, mem, p->empty_check_end.empty_status_mem, s, reg); #else STACK_EMPTY_CHECK_REC(is_empty, mem, s); #endif INC_OP; if (is_empty) { #ifdef ONIG_DEBUG_MATCH fprintf(DBGFP, "EMPTY_CHECK_END_MEM_PUSH: skip id:%d, s:%p\n", (int )mem, s); #endif if (is_empty == -1) goto fail; goto empty_check_found; } else { STACK_PUSH_EMPTY_CHECK_END(mem); } } JUMP_OUT; #endif CASE_OP(JUMP) addr = p->jump.addr; p += addr; CHECK_INTERRUPT_JUMP_OUT; CASE_OP(PUSH) addr = p->push.addr; STACK_PUSH_ALT(p + addr, s); INC_OP; JUMP_OUT; CASE_OP(PUSH_SUPER) addr = p->push.addr; STACK_PUSH_SUPER_ALT(p + addr, s); INC_OP; JUMP_OUT; CASE_OP(POP) STACK_POP_ONE; INC_OP; JUMP_OUT; CASE_OP(POP_TO_MARK) STACK_POP_TO_MARK(p->pop_to_mark.id); INC_OP; JUMP_OUT; #ifdef USE_OP_PUSH_OR_JUMP_EXACT CASE_OP(PUSH_OR_JUMP_EXACT1) { UChar c; addr = p->push_or_jump_exact1.addr; c = p->push_or_jump_exact1.c; if (DATA_ENSURE_CHECK1 && c == *s) { STACK_PUSH_ALT(p + addr, s); INC_OP; JUMP_OUT; } } p += addr; JUMP_OUT; #endif CASE_OP(PUSH_IF_PEEK_NEXT) { UChar c; addr = p->push_if_peek_next.addr; c = p->push_if_peek_next.c; if (DATA_ENSURE_CHECK1 && c == *s) { STACK_PUSH_ALT(p + addr, s); } } INC_OP; JUMP_OUT; CASE_OP(REPEAT) mem = p->repeat.id; /* mem: OP_REPEAT ID */ addr = p->repeat.addr; STACK_PUSH_REPEAT_INC(mem, 0); if (reg->repeat_range[mem].lower == 0) { STACK_PUSH_ALT(p + addr, s); } INC_OP; JUMP_OUT; CASE_OP(REPEAT_NG) mem = p->repeat.id; /* mem: OP_REPEAT ID */ addr = p->repeat.addr; STACK_PUSH_REPEAT_INC(mem, 0); if (reg->repeat_range[mem].lower == 0) { STACK_PUSH_ALT(p + 1, s); p += addr; } else INC_OP; JUMP_OUT; CASE_OP(REPEAT_INC) mem = p->repeat_inc.id; /* mem: OP_REPEAT ID */ STACK_GET_REPEAT_COUNT(mem, n); n++; if (n >= reg->repeat_range[mem].upper) { /* end of repeat. Nothing to do. */ INC_OP; } else if (n >= reg->repeat_range[mem].lower) { INC_OP; STACK_PUSH_ALT(p, s); p = reg->repeat_range[mem].u.pcode; } else { p = reg->repeat_range[mem].u.pcode; } STACK_PUSH_REPEAT_INC(mem, n); CHECK_INTERRUPT_JUMP_OUT; CASE_OP(REPEAT_INC_NG) mem = p->repeat_inc.id; /* mem: OP_REPEAT ID */ STACK_GET_REPEAT_COUNT(mem, n); n++; STACK_PUSH_REPEAT_INC(mem, n); if (n == reg->repeat_range[mem].upper) { INC_OP; } else { if (n >= reg->repeat_range[mem].lower) { STACK_PUSH_ALT(reg->repeat_range[mem].u.pcode, s); INC_OP; } else { p = reg->repeat_range[mem].u.pcode; } } CHECK_INTERRUPT_JUMP_OUT; #ifdef USE_CALL CASE_OP(CALL) if (subexp_call_nest_counter == SubexpCallMaxNestLevel) goto fail; subexp_call_nest_counter++; if (SubexpCallLimitInSearch != 0) { msa->subexp_call_in_search_counter++; #ifdef ONIG_DEBUG_MATCH_COUNTER if (p->call.called_mem < MAX_SUBEXP_CALL_COUNTERS) subexp_call_counters[p->call.called_mem]++; if (msa->subexp_call_in_search_counter % 1000 == 0) MATCH_COUNTER_OUT("CALL"); #endif if (msa->subexp_call_in_search_counter > SubexpCallLimitInSearch) { MATCH_AT_ERROR_RETURN(ONIGERR_SUBEXP_CALL_LIMIT_IN_SEARCH_OVER); } } #ifdef ONIG_DEBUG_CALL fprintf(DBGFP, "CALL: id:%d, at:%ld, level:%lu\n", p->call.called_mem, s - str, subexp_call_nest_counter); #endif addr = p->call.addr; INC_OP; STACK_PUSH_CALL_FRAME(p); p = reg->ops + addr; JUMP_OUT; CASE_OP(RETURN) STACK_RETURN(p); STACK_PUSH_RETURN; subexp_call_nest_counter--; JUMP_OUT; #endif CASE_OP(MOVE) if (p->move.n < 0) { s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, -p->move.n); if (IS_NULL(s)) goto fail; } else { int len; for (tlen = p->move.n; tlen > 0; tlen--) { len = enclen(encode, s); s += len; if (s > end) goto fail; if (s == end) { if (tlen != 1) goto fail; else break; } } } INC_OP; JUMP_OUT; CASE_OP(STEP_BACK_START) tlen = p->step_back_start.initial; if (tlen != 0) { s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, (int )tlen); if (IS_NULL(s)) goto fail; } if (p->step_back_start.remaining != 0) { STACK_PUSH_ALT_WITH_ZID(p + 1, s, p->step_back_start.remaining); p += p->step_back_start.addr; } else INC_OP; JUMP_OUT; CASE_OP(STEP_BACK_NEXT) tlen = (LengthType )stk->zid; /* remaining count */ if (tlen != INFINITE_LEN) tlen--; s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, 1); if (IS_NULL(s)) goto fail; if (tlen != 0) { STACK_PUSH_ALT_WITH_ZID(p, s, (int )tlen); } INC_OP; JUMP_OUT; CASE_OP(CUT_TO_MARK) mem = p->cut_to_mark.id; /* mem: mark id */ STACK_TO_VOID_TO_MARK(stkp, mem); if (p->cut_to_mark.restore_pos != 0) { s = stkp->u.val.v; } INC_OP; JUMP_OUT; CASE_OP(MARK) mem = p->mark.id; /* mem: mark id */ if (p->mark.save_pos != 0) STACK_PUSH_MARK_WITH_POS(mem, s); else STACK_PUSH_MARK(mem); INC_OP; JUMP_OUT; CASE_OP(SAVE_VAL) { SaveType type; type = p->save_val.type; mem = p->save_val.id; /* mem: save id */ switch ((enum SaveType )type) { case SAVE_KEEP: STACK_PUSH_SAVE_VAL(mem, type, s); break; case SAVE_S: STACK_PUSH_SAVE_VAL_WITH_SPREV(mem, type, s); break; case SAVE_RIGHT_RANGE: STACK_PUSH_SAVE_VAL(mem, SAVE_RIGHT_RANGE, right_range); break; } } INC_OP; JUMP_OUT; CASE_OP(UPDATE_VAR) { UpdateVarType type; enum SaveType save_type; type = p->update_var.type; switch ((enum UpdateVarType )type) { case UPDATE_VAR_KEEP_FROM_STACK_LAST: STACK_GET_SAVE_VAL_TYPE_LAST(SAVE_KEEP, keep); break; case UPDATE_VAR_S_FROM_STACK: mem = p->update_var.id; /* mem: save id */ STACK_GET_SAVE_VAL_TYPE_LAST_ID_WITH_SPREV(SAVE_S, mem, s); break; case UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK: save_type = SAVE_S; goto get_save_val_type_last_id; break; case UPDATE_VAR_RIGHT_RANGE_FROM_STACK: save_type = SAVE_RIGHT_RANGE; get_save_val_type_last_id: mem = p->update_var.id; /* mem: save id */ STACK_GET_SAVE_VAL_TYPE_LAST_ID(save_type, mem, right_range, p->update_var.clear); break; case UPDATE_VAR_RIGHT_RANGE_TO_S: right_range = s; break; case UPDATE_VAR_RIGHT_RANGE_INIT: INIT_RIGHT_RANGE; break; } } INC_OP; JUMP_OUT; #ifdef USE_CALLOUT CASE_OP(CALLOUT_CONTENTS) of = ONIG_CALLOUT_OF_CONTENTS; mem = p->callout_contents.num; goto callout_common_entry; BREAK_OUT; CASE_OP(CALLOUT_NAME) { int call_result; int name_id; int in; CalloutListEntry* e; OnigCalloutFunc func; OnigCalloutArgs args; of = ONIG_CALLOUT_OF_NAME; mem = p->callout_name.num; callout_common_entry: e = onig_reg_callout_list_at(reg, mem); in = e->in; if (of == ONIG_CALLOUT_OF_NAME) { name_id = p->callout_name.id; func = onig_get_callout_start_func(reg, mem); } else { name_id = ONIG_NON_NAME_ID; func = msa->mp->progress_callout_of_contents; } if (IS_NOT_NULL(func) && (in & ONIG_CALLOUT_IN_PROGRESS) != 0) { CALLOUT_BODY(func, ONIG_CALLOUT_IN_PROGRESS, name_id, (int )mem, msa->mp->callout_user_data, args, call_result); switch (call_result) { case ONIG_CALLOUT_FAIL: goto fail; break; case ONIG_CALLOUT_SUCCESS: goto retraction_callout2; break; default: /* error code */ if (call_result > 0) { call_result = ONIGERR_INVALID_ARGUMENT; } best_len = call_result; goto match_at_end; break; } } else { retraction_callout2: if ((in & ONIG_CALLOUT_IN_RETRACTION) != 0) { if (of == ONIG_CALLOUT_OF_NAME) { if (IS_NOT_NULL(func)) { STACK_PUSH_CALLOUT_NAME(name_id, mem, func); } } else { func = msa->mp->retraction_callout_of_contents; if (IS_NOT_NULL(func)) { STACK_PUSH_CALLOUT_CONTENTS(mem, func); } } } } } INC_OP; JUMP_OUT; #endif CASE_OP(FINISH) #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (OPTON_FIND_LONGEST(options)) { best_len = ONIG_MISMATCH; } #endif goto match_at_end; #ifdef ONIG_DEBUG_STATISTICS fail: SOP_OUT; goto fail2; #endif CASE_OP(FAIL) #ifdef ONIG_DEBUG_STATISTICS fail2: #else fail: #endif STACK_POP; p = stk->u.state.pcode; s = stk->u.state.pstr; CHECK_RETRY_LIMIT_IN_MATCH; JUMP_OUT; DEFAULT_OP MATCH_AT_ERROR_RETURN(ONIGERR_UNDEFINED_BYTECODE); } BYTECODE_INTERPRETER_END; match_at_end: if (msa->retry_limit_in_search != 0) { #ifdef ONIG_DEBUG if (retry_in_match_counter > ULONG_MAX - msa->retry_limit_in_search_counter) { fprintf(DBGFP, "retry limit counter overflow: %8lu/%8lu\n", retry_in_match_counter, msa->retry_limit_in_search_counter); } #endif msa->retry_limit_in_search_counter += retry_in_match_counter; } #ifdef ONIG_DEBUG_MATCH_COUNTER MATCH_COUNTER_OUT("END"); #endif STACK_SAVE(msa, is_alloca, alloc_base); return best_len; } #ifdef USE_REGSET typedef struct { regex_t* reg; OnigRegion* region; } RR; struct OnigRegSetStruct { RR* rs; int n; int alloc; OnigEncoding enc; int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */ OnigLen anc_dmin; /* (SEMI_)END_BUF anchor distance */ OnigLen anc_dmax; /* (SEMI_)END_BUF anchor distance */ int all_low_high; int anychar_inf; }; enum SearchRangeStatus { SRS_DEAD = 0, SRS_LOW_HIGH = 1, SRS_ALL_RANGE = 2 }; typedef struct { int state; /* value of enum SearchRangeStatus */ UChar* low; UChar* high; UChar* sch_range; } SearchRange; #define REGSET_MATCH_AND_RETURN_CHECK(upper_range) \ r = match_at(reg, str, end, (upper_range), s, msas + i); \ if (r != ONIG_MISMATCH) {\ if (r >= 0) {\ goto match;\ }\ else goto finish; /* error */ \ } static inline int regset_search_body_position_lead(OnigRegSet* set, const UChar* str, const UChar* end, const UChar* start, const UChar* range, /* match start range */ const UChar* orig_range, /* data range */ OnigOptionType option, MatchArg* msas, int* rmatch_pos) { int r, n, i; UChar *s; UChar *low, *high; UChar* sch_range; regex_t* reg; OnigEncoding enc; SearchRange* sr; n = set->n; enc = set->enc; s = (UChar* )start; sr = (SearchRange* )xmalloc(sizeof(*sr) * n); CHECK_NULL_RETURN_MEMERR(sr); for (i = 0; i < n; i++) { reg = set->rs[i].reg; sr[i].state = SRS_DEAD; if (reg->optimize != OPTIMIZE_NONE) { if (reg->dist_max != INFINITE_LEN) { if (DIST_CAST(end - range) > reg->dist_max) sch_range = (UChar* )range + reg->dist_max; else sch_range = (UChar* )end; if (forward_search(reg, str, end, s, sch_range, &low, &high)) { sr[i].state = SRS_LOW_HIGH; sr[i].low = low; sr[i].high = high; sr[i].sch_range = sch_range; } } else { sch_range = (UChar* )end; if (forward_search(reg, str, end, s, sch_range, &low, &high)) { goto total_active; } } } else { total_active: sr[i].state = SRS_ALL_RANGE; sr[i].low = s; sr[i].high = (UChar* )range; } } #define ACTIVATE_ALL_LOW_HIGH_SEARCH_THRESHOLD_LEN 500 if (set->all_low_high != 0 && range - start > ACTIVATE_ALL_LOW_HIGH_SEARCH_THRESHOLD_LEN) { do { int try_count = 0; for (i = 0; i < n; i++) { if (sr[i].state == SRS_DEAD) continue; if (s < sr[i].low) continue; if (s >= sr[i].high) { if (forward_search(set->rs[i].reg, str, end, s, sr[i].sch_range, &low, &high) != 0) { sr[i].low = low; sr[i].high = high; if (s < low) continue; } else { sr[i].state = SRS_DEAD; continue; } } reg = set->rs[i].reg; REGSET_MATCH_AND_RETURN_CHECK(orig_range); try_count++; } /* for (i) */ if (s >= range) break; if (try_count == 0) { low = (UChar* )range; for (i = 0; i < n; i++) { if (sr[i].state == SRS_LOW_HIGH && low > sr[i].low) { low = sr[i].low; } } if (low == range) break; s = low; } else { s += enclen(enc, s); } } while (1); } else { int prev_is_newline = 1; do { for (i = 0; i < n; i++) { if (sr[i].state == SRS_DEAD) continue; if (sr[i].state == SRS_LOW_HIGH) { if (s < sr[i].low) continue; if (s >= sr[i].high) { if (forward_search(set->rs[i].reg, str, end, s, sr[i].sch_range, &low, &high) != 0) { sr[i].low = low; sr[i].high = high; if (s < low) continue; } else { sr[i].state = SRS_DEAD; continue; } } } reg = set->rs[i].reg; if ((reg->anchor & ANCR_ANYCHAR_INF) == 0 || prev_is_newline != 0) { REGSET_MATCH_AND_RETURN_CHECK(orig_range); } } if (s >= range) break; if (set->anychar_inf != 0) prev_is_newline = ONIGENC_IS_MBC_NEWLINE(set->enc, s, end); s += enclen(enc, s); } while (1); } xfree(sr); return ONIG_MISMATCH; finish: xfree(sr); return r; match: xfree(sr); *rmatch_pos = (int )(s - str); return i; } static inline int regset_search_body_regex_lead(OnigRegSet* set, const UChar* str, const UChar* end, const UChar* start, const UChar* orig_range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos) { int r; int i; int n; int match_index; const UChar* ep; regex_t* reg; OnigRegion* region; n = set->n; match_index = ONIG_MISMATCH; ep = orig_range; for (i = 0; i < n; i++) { reg = set->rs[i].reg; region = set->rs[i].region; r = search_in_range(reg, str, end, start, ep, orig_range, region, option, mps[i]); if (r > 0) { if (str + r < ep) { match_index = i; *rmatch_pos = r; if (lead == ONIG_REGSET_PRIORITY_TO_REGEX_ORDER) break; ep = str + r; } } else if (r == 0) { match_index = i; *rmatch_pos = r; break; } } return match_index; } extern int onig_regset_search_with_param(OnigRegSet* set, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos) { int r; int i; UChar *s; regex_t* reg; OnigEncoding enc; OnigRegion* region; MatchArg* msas; const UChar *orig_start = start; const UChar *orig_range = range; if (set->n == 0) return ONIG_MISMATCH; if (OPTON_POSIX_REGION(option) || OPTON_CALLBACK_EACH_MATCH(option)) return ONIGERR_INVALID_ARGUMENT; r = 0; enc = set->enc; msas = (MatchArg* )NULL; for (i = 0; i < set->n; i++) { reg = set->rs[i].reg; region = set->rs[i].region; ADJUST_MATCH_PARAM(reg, mps[i]); if (IS_NOT_NULL(region)) { r = onig_region_resize_clear(region, reg->num_mem + 1); if (r != 0) goto finish_no_msa; } } if (start > end || start < str) goto mismatch_no_msa; if (str < end) { /* forward search only */ if (range < start) return ONIGERR_INVALID_ARGUMENT; } if (OPTON_CHECK_VALIDITY_OF_STRING(option)) { if (! ONIGENC_IS_VALID_MBC_STRING(enc, str, end)) { r = ONIGERR_INVALID_WIDE_CHAR_VALUE; goto finish_no_msa; } } if (set->anchor != OPTIMIZE_NONE && str < end) { UChar *min_semi_end, *max_semi_end; if ((set->anchor & ANCR_BEGIN_POSITION) != 0) { /* search start-position only */ begin_position: range = start + 1; } else if ((set->anchor & ANCR_BEGIN_BUF) != 0) { /* search str-position only */ if (start != str) goto mismatch_no_msa; range = str + 1; } else if ((set->anchor & ANCR_END_BUF) != 0) { min_semi_end = max_semi_end = (UChar* )end; end_buf: if ((OnigLen )(max_semi_end - str) < set->anc_dmin) goto mismatch_no_msa; if ((OnigLen )(min_semi_end - start) > set->anc_dmax) { start = min_semi_end - set->anc_dmax; if (start < end) start = onigenc_get_right_adjust_char_head(enc, str, start); } if ((OnigLen )(max_semi_end - (range - 1)) < set->anc_dmin) { range = max_semi_end - set->anc_dmin + 1; } if (start > range) goto mismatch_no_msa; } else if ((set->anchor & ANCR_SEMI_END_BUF) != 0) { UChar* pre_end = ONIGENC_STEP_BACK(enc, str, end, 1); max_semi_end = (UChar* )end; if (ONIGENC_IS_MBC_NEWLINE(enc, pre_end, end)) { min_semi_end = pre_end; #ifdef USE_CRNL_AS_LINE_TERMINATOR pre_end = ONIGENC_STEP_BACK(enc, str, pre_end, 1); if (IS_NOT_NULL(pre_end) && ONIGENC_IS_MBC_CRNL(enc, pre_end, end)) { min_semi_end = pre_end; } #endif if (min_semi_end > str && start <= min_semi_end) { goto end_buf; } } else { min_semi_end = (UChar* )end; goto end_buf; } } else if ((set->anchor & ANCR_ANYCHAR_INF_ML) != 0) { goto begin_position; } } else if (str == end) { /* empty string */ start = end = str; s = (UChar* )start; msas = (MatchArg* )xmalloc(sizeof(*msas) * set->n); CHECK_NULL_RETURN_MEMERR(msas); for (i = 0; i < set->n; i++) { reg = set->rs[i].reg; MATCH_ARG_INIT(msas[i], reg, option, set->rs[i].region, start, mps[i]); } for (i = 0; i < set->n; i++) { reg = set->rs[i].reg; if (reg->threshold_len == 0) { /* REGSET_MATCH_AND_RETURN_CHECK(end); */ /* Can't use REGSET_MATCH_AND_RETURN_CHECK() because r must be set regex index (i) */ r = match_at(reg, str, end, end, s, msas + i); if (r != ONIG_MISMATCH) { if (r >= 0) { r = i; goto match; } else goto finish; /* error */ } } } goto mismatch; } if (lead == ONIG_REGSET_POSITION_LEAD) { msas = (MatchArg* )xmalloc(sizeof(*msas) * set->n); CHECK_NULL_RETURN_MEMERR(msas); for (i = 0; i < set->n; i++) { MATCH_ARG_INIT(msas[i], set->rs[i].reg, option, set->rs[i].region, orig_start, mps[i]); } r = regset_search_body_position_lead(set, str, end, start, range, orig_range, option, msas, rmatch_pos); } else { r = regset_search_body_regex_lead(set, str, end, start, orig_range, lead, option, mps, rmatch_pos); } if (r < 0) goto finish; else goto match2; mismatch: r = ONIG_MISMATCH; finish: for (i = 0; i < set->n; i++) { if (IS_NOT_NULL(msas)) MATCH_ARG_FREE(msas[i]); if (OPTON_FIND_NOT_EMPTY(set->rs[i].reg->options) && IS_NOT_NULL(set->rs[i].region)) { onig_region_clear(set->rs[i].region); } } if (IS_NOT_NULL(msas)) xfree(msas); return r; mismatch_no_msa: r = ONIG_MISMATCH; finish_no_msa: return r; match: *rmatch_pos = (int )(s - str); match2: for (i = 0; i < set->n; i++) { if (IS_NOT_NULL(msas)) MATCH_ARG_FREE(msas[i]); if (OPTON_FIND_NOT_EMPTY(set->rs[i].reg->options) && IS_NOT_NULL(set->rs[i].region)) { onig_region_clear(set->rs[i].region); } } if (IS_NOT_NULL(msas)) xfree(msas); return r; /* regex index */ } extern int onig_regset_search(OnigRegSet* set, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos) { int r; int i; OnigMatchParam* mp; OnigMatchParam** mps; mps = (OnigMatchParam** )xmalloc((sizeof(OnigMatchParam*) + sizeof(OnigMatchParam)) * set->n); CHECK_NULL_RETURN_MEMERR(mps); mp = (OnigMatchParam* )(mps + set->n); for (i = 0; i < set->n; i++) { onig_initialize_match_param(mp + i); mps[i] = mp + i; } r = onig_regset_search_with_param(set, str, end, start, range, lead, option, mps, rmatch_pos); for (i = 0; i < set->n; i++) onig_free_match_param_content(mp + i); xfree(mps); return r; } #endif /* USE_REGSET */ static UChar* slow_search(OnigEncoding enc, UChar* target, UChar* target_end, const UChar* text, const UChar* text_end, UChar* text_range) { UChar *t, *p, *s, *end; end = (UChar* )text_end; end -= target_end - target - 1; if (end > text_range) end = text_range; s = (UChar* )text; while (s < end) { if (*s == *target) { p = s + 1; t = target + 1; while (t < target_end) { if (*t != *p++) break; t++; } if (t == target_end) return s; } s += enclen(enc, s); } return (UChar* )NULL; } static UChar* slow_search_backward(OnigEncoding enc, UChar* target, UChar* target_end, const UChar* text, const UChar* adjust_text, const UChar* text_end, const UChar* text_start) { UChar *t, *p, *s; s = (UChar* )text_end; s -= (target_end - target); if (s > text_start) s = (UChar* )text_start; else s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, adjust_text, s); while (PTR_GE(s, text)) { if (*s == *target) { p = s + 1; t = target + 1; while (t < target_end) { if (*t != *p++) break; t++; } if (t == target_end) return s; } s = (UChar* )onigenc_get_prev_char_head(enc, adjust_text, s); } return (UChar* )NULL; } static UChar* sunday_quick_search_step_forward(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *se, *t, *p, *end; const UChar *tail, *next; int skip, tlen1; int map_offset; OnigEncoding enc; #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "sunday_quick_search_step_forward: text: %p, text_end: %p, text_range: %p\n", text, text_end, text_range); #endif enc = reg->enc; tail = target_end - 1; tlen1 = (int )(tail - target); end = text_range; if (tlen1 > text_end - end) end = text_end - tlen1; map_offset = reg->map_offset; s = text; while (s < end) { p = se = s + tlen1; t = tail; while (*p == *t) { if (t == target) return (UChar* )s; p--; t--; } if (se + map_offset >= text_end) break; skip = reg->map[*(se + map_offset)]; #if 0 t = s; do { s += enclen(enc, s); } while ((s - t) < skip && s < end); #else next = s + skip; if (next < end) s = onigenc_get_right_adjust_char_head(enc, s, next); else break; #endif } return (UChar* )NULL; } static UChar* sunday_quick_search(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *t, *p, *end; const UChar *tail; int map_offset; ptrdiff_t target_len; map_offset = reg->map_offset; tail = target_end - 1; target_len = target_end - target; if (target_len > text_end - text_range) { end = text_end; if (target_len > text_end - text) return (UChar* )NULL; } else { end = text_range + target_len; } s = text + target_len - 1; #ifdef USE_STRICT_POINTER_ADDRESS if (s < end) { while (TRUE) { p = s; t = tail; while (*p == *t) { if (t == target) return (UChar* )p; p--; t--; } if (text_end - s <= map_offset) break; if (reg->map[*(s + map_offset)] >= end - s) break; s += reg->map[*(s + map_offset)]; } } #else while (s < end) { p = s; t = tail; while (*p == *t) { if (t == target) return (UChar* )p; p--; t--; } if (text_end - s <= map_offset) break; s += reg->map[*(s + map_offset)]; } #endif return (UChar* )NULL; } static UChar* map_search(OnigEncoding enc, UChar map[], const UChar* text, const UChar* text_range) { const UChar *s = text; while (s < text_range) { if (map[*s]) return (UChar* )s; s += enclen(enc, s); } return (UChar* )NULL; } static UChar* map_search_backward(OnigEncoding enc, UChar map[], const UChar* text, const UChar* adjust_text, const UChar* text_start) { const UChar *s = text_start; while (PTR_GE(s, text)) { if (map[*s]) return (UChar* )s; s = onigenc_get_prev_char_head(enc, adjust_text, s); } return (UChar* )NULL; } extern int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option) { int r; OnigMatchParam mp; onig_initialize_match_param(&mp); r = onig_match_with_param(reg, str, end, at, region, option, &mp); onig_free_match_param_content(&mp); return r; } extern int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp) { int r; MatchArg msa; #ifndef USE_POSIX_API if (OPTON_POSIX_REGION(option)) return ONIGERR_INVALID_ARGUMENT; #endif ADJUST_MATCH_PARAM(reg, mp); MATCH_ARG_INIT(msa, reg, option, region, at, mp); if (region #ifdef USE_POSIX_API && !OPTON_POSIX_REGION(option) #endif ) { r = onig_region_resize_clear(region, reg->num_mem + 1); } else r = 0; if (r == 0) { if (OPTON_CHECK_VALIDITY_OF_STRING(option)) { if (! ONIGENC_IS_VALID_MBC_STRING(reg->enc, str, end)) { r = ONIGERR_INVALID_WIDE_CHAR_VALUE; goto end; } } r = match_at(reg, str, end, end, at, &msa); #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (OPTON_FIND_LONGEST(option) && r == ONIG_MISMATCH) { if (msa.best_len >= 0) { r = msa.best_len; } } #endif } end: MATCH_ARG_FREE(msa); return r; } static int forward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* start, UChar* range, UChar** low, UChar** high) { UChar *p, *pprev = (UChar* )NULL; #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "forward_search: str: %p, end: %p, start: %p, range: %p\n", str, end, start, range); #endif p = start; if (reg->dist_min != 0) { if (DIST_CAST(end - p) <= reg->dist_min) return 0; /* fail */ if (ONIGENC_IS_SINGLEBYTE(reg->enc)) { p += reg->dist_min; } else { UChar *q = p + reg->dist_min; while (p < q) p += enclen(reg->enc, p); } } retry: switch (reg->optimize) { case OPTIMIZE_STR: p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range); break; case OPTIMIZE_STR_FAST: p = sunday_quick_search(reg, reg->exact, reg->exact_end, p, end, range); break; case OPTIMIZE_STR_FAST_STEP_FORWARD: p = sunday_quick_search_step_forward(reg, reg->exact, reg->exact_end, p, end, range); break; case OPTIMIZE_MAP: p = map_search(reg->enc, reg->map, p, range); break; } if (p && p < range) { if (DIST_CAST(p - start) < reg->dist_min) { retry_gate: pprev = p; p += enclen(reg->enc, p); goto retry; } if (reg->sub_anchor) { UChar* prev; switch (reg->sub_anchor) { case ANCR_BEGIN_LINE: if (!ON_STR_BEGIN(p)) { prev = onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : str), p); if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) goto retry_gate; } break; case ANCR_END_LINE: if (ON_STR_END(p)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE prev = (UChar* )onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : str), p); if (prev && ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) goto retry_gate; #endif } else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end) #ifdef USE_CRNL_AS_LINE_TERMINATOR && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end) #endif ) goto retry_gate; break; } } if (reg->dist_max == 0) { *low = p; *high = p; } else { if (reg->dist_max != INFINITE_LEN) { if (DIST_CAST(p - str) < reg->dist_max) { *low = (UChar* )str; } else { *low = p - reg->dist_max; if (*low > start) { *low = onigenc_get_right_adjust_char_head(reg->enc, start, *low); } } } /* no needs to adjust *high, *high is used as range check only */ if (DIST_CAST(p - str) < reg->dist_min) *high = (UChar* )str; else *high = p - reg->dist_min; } #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "forward_search success: low: %d, high: %d, dmin: %u, dmax: %u\n", (int )(*low - str), (int )(*high - str), reg->dist_min, reg->dist_max); #endif return 1; /* success */ } return 0; /* fail */ } static int backward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* s, const UChar* range, UChar* adjrange, UChar** low, UChar** high) { UChar *p; p = s; retry: switch (reg->optimize) { case OPTIMIZE_STR: exact_method: p = slow_search_backward(reg->enc, reg->exact, reg->exact_end, range, adjrange, end, p); break; case OPTIMIZE_STR_FAST: case OPTIMIZE_STR_FAST_STEP_FORWARD: goto exact_method; break; case OPTIMIZE_MAP: p = map_search_backward(reg->enc, reg->map, range, adjrange, p); break; } if (p) { if (reg->sub_anchor) { UChar* prev; switch (reg->sub_anchor) { case ANCR_BEGIN_LINE: if (!ON_STR_BEGIN(p)) { prev = onigenc_get_prev_char_head(reg->enc, str, p); if (IS_NOT_NULL(prev) && !ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) { p = prev; goto retry; } } break; case ANCR_END_LINE: if (ON_STR_END(p)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE prev = onigenc_get_prev_char_head(reg->enc, adjrange, p); if (IS_NULL(prev)) goto fail; if (ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) { p = prev; goto retry; } #endif } else if (! ONIGENC_IS_MBC_NEWLINE(reg->enc, p, end) #ifdef USE_CRNL_AS_LINE_TERMINATOR && ! ONIGENC_IS_MBC_CRNL(reg->enc, p, end) #endif ) { p = onigenc_get_prev_char_head(reg->enc, adjrange, p); if (IS_NULL(p)) goto fail; goto retry; } break; } } if (reg->dist_max != INFINITE_LEN) { if (DIST_CAST(p - str) < reg->dist_max) *low = (UChar* )str; else *low = p - reg->dist_max; if (reg->dist_min != 0) { if (DIST_CAST(p - str) < reg->dist_min) *high = (UChar* )str; else *high = p - reg->dist_min; } else { *high = p; } *high = onigenc_get_right_adjust_char_head(reg->enc, adjrange, *high); } #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "backward_search: low: %d, high: %d\n", (int )(*low - str), (int )(*high - str)); #endif return 1; /* success */ } fail: #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "backward_search: fail.\n"); #endif return 0; /* fail */ } extern int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option) { int r; OnigMatchParam mp; const UChar* data_range; onig_initialize_match_param(&mp); /* The following is an expanded code of onig_search_with_param() */ if (range > start) data_range = range; else data_range = end; r = search_in_range(reg, str, end, start, range, data_range, region, option, &mp); onig_free_match_param_content(&mp); return r; } static int search_in_range(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, /* match start range */ const UChar* data_range, /* subject string range */ OnigRegion* region, OnigOptionType option, OnigMatchParam* mp) { int r; int forward; UChar *s; MatchArg msa; const UChar *orig_start = start; #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "onig_search (entry point): str: %p, end: %d, start: %d, range: %d\n", str, (int )(end - str), (int )(start - str), (int )(range - str)); #endif ADJUST_MATCH_PARAM(reg, mp); #ifndef USE_POSIX_API if (OPTON_POSIX_REGION(option)) { r = ONIGERR_INVALID_ARGUMENT; goto finish_no_msa; } #endif if (region #ifdef USE_POSIX_API && ! OPTON_POSIX_REGION(option) #endif ) { r = onig_region_resize_clear(region, reg->num_mem + 1); if (r != 0) goto finish_no_msa; } if (start > end || start < str) goto mismatch_no_msa; if (OPTON_CHECK_VALIDITY_OF_STRING(option)) { if (! ONIGENC_IS_VALID_MBC_STRING(reg->enc, str, end)) { r = ONIGERR_INVALID_WIDE_CHAR_VALUE; goto finish_no_msa; } } #define MATCH_AND_RETURN_CHECK(upper_range) \ r = match_at(reg, str, end, (upper_range), s, &msa);\ if (r != ONIG_MISMATCH) {\ if (r >= 0) {\ goto match;\ }\ else goto finish; /* error */ \ } forward = (range > start); /* anchor optimize: resume search range */ if (reg->anchor != 0 && str < end) { UChar *min_semi_end, *max_semi_end; if (reg->anchor & ANCR_BEGIN_POSITION) { /* search start-position only */ begin_position: if (range > start) range = start + 1; else range = start; } else if (reg->anchor & ANCR_BEGIN_BUF) { /* search str-position only */ if (range > start) { if (start != str) goto mismatch_no_msa; range = str + 1; } else { if (range <= str) { start = str; range = str; } else goto mismatch_no_msa; } } else if (reg->anchor & ANCR_END_BUF) { min_semi_end = max_semi_end = (UChar* )end; end_buf: if ((OnigLen )(max_semi_end - str) < reg->anc_dist_min) goto mismatch_no_msa; if (range > start) { if (reg->anc_dist_max != INFINITE_LEN && DIST_CAST(min_semi_end - start) > reg->anc_dist_max) { start = min_semi_end - reg->anc_dist_max; if (start < end) start = onigenc_get_right_adjust_char_head(reg->enc, str, start); } if (DIST_CAST(max_semi_end - (range - 1)) < reg->anc_dist_min) { if (DIST_CAST(max_semi_end - str + 1) < reg->anc_dist_min) goto mismatch_no_msa; else range = max_semi_end - reg->anc_dist_min + 1; } if (start > range) goto mismatch_no_msa; /* If start == range, match with empty at end. Backward search is used. */ } else { if (reg->anc_dist_max != INFINITE_LEN && DIST_CAST(min_semi_end - range) > reg->anc_dist_max) { range = min_semi_end - reg->anc_dist_max; } if (DIST_CAST(max_semi_end - start) < reg->anc_dist_min) { if (DIST_CAST(max_semi_end - str) < reg->anc_dist_min) goto mismatch_no_msa; else { start = max_semi_end - reg->anc_dist_min; start = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, str, start); } } if (range > start) goto mismatch_no_msa; } } else if (reg->anchor & ANCR_SEMI_END_BUF) { UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, 1); max_semi_end = (UChar* )end; if (ONIGENC_IS_MBC_NEWLINE(reg->enc, pre_end, end)) { min_semi_end = pre_end; #ifdef USE_CRNL_AS_LINE_TERMINATOR pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, 1); if (IS_NOT_NULL(pre_end) && ONIGENC_IS_MBC_CRNL(reg->enc, pre_end, end)) { min_semi_end = pre_end; } #endif if (min_semi_end > str && start <= min_semi_end) { goto end_buf; } } else { min_semi_end = (UChar* )end; goto end_buf; } } else if ((reg->anchor & ANCR_ANYCHAR_INF_ML) && range > start) { goto begin_position; } } else if (str == end) { /* empty string */ static const UChar* address_for_empty_string = (UChar* )""; #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "onig_search: empty string.\n"); #endif if (reg->threshold_len == 0) { start = end = str = address_for_empty_string; s = (UChar* )start; MATCH_ARG_INIT(msa, reg, option, region, start, mp); MATCH_AND_RETURN_CHECK(end); goto mismatch; } goto mismatch_no_msa; } #ifdef ONIG_DEBUG_SEARCH fprintf(DBGFP, "onig_search(apply anchor): end: %d, start: %d, range: %d\n", (int )(end - str), (int )(start - str), (int )(range - str)); #endif MATCH_ARG_INIT(msa, reg, option, region, orig_start, mp); s = (UChar* )start; if (forward != 0) { /* forward search */ if (reg->optimize != OPTIMIZE_NONE) { UChar *sch_range, *low, *high; if (reg->dist_max != 0) { if (reg->dist_max == INFINITE_LEN) sch_range = (UChar* )end; else { if (DIST_CAST(end - range) < reg->dist_max) sch_range = (UChar* )end; else { sch_range = (UChar* )range + reg->dist_max; } } } else sch_range = (UChar* )range; if ((end - start) < reg->threshold_len) goto mismatch; if (reg->dist_max != INFINITE_LEN) { do { if (! forward_search(reg, str, end, s, sch_range, &low, &high)) goto mismatch; if (s < low) { s = low; } while (s <= high) { MATCH_AND_RETURN_CHECK(data_range); s += enclen(reg->enc, s); #ifdef USE_SKIP_SEARCH if (s < msa.skip_search) s = msa.skip_search; #endif } } while (s < range); goto mismatch; } else { /* check only. */ if (! forward_search(reg, str, end, s, sch_range, &low, &high)) goto mismatch; if ((reg->anchor & ANCR_ANYCHAR_INF) != 0 && (reg->anchor & (ANCR_LOOK_BEHIND | ANCR_PREC_READ_NOT)) == 0) { while (s < range) { UChar* prev; MATCH_AND_RETURN_CHECK(data_range); prev = s; s += enclen(reg->enc, s); #ifdef USE_SKIP_SEARCH if (s < msa.skip_search) s = msa.skip_search; else { #endif while (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end) && s < range) { prev = s; s += enclen(reg->enc, s); } #ifdef USE_SKIP_SEARCH } #endif } goto mismatch; } } } while (1 == 1) { MATCH_AND_RETURN_CHECK(data_range); if (s >= range) break; s += enclen(reg->enc, s); #ifdef USE_SKIP_SEARCH if (s < msa.skip_search) { s = msa.skip_search; if (s > range) break; } #endif } } else { /* backward search */ if (range < str) goto mismatch; if (orig_start < end) orig_start += enclen(reg->enc, orig_start); /* is upper range */ if (reg->optimize != OPTIMIZE_NONE) { UChar *low, *high, *adjrange, *sch_start; const UChar *min_range; if ((end - range) < reg->threshold_len) goto mismatch; if (range < end) adjrange = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, str, range); else adjrange = (UChar* )end; if (DIST_CAST(end - range) > reg->dist_min) min_range = range + reg->dist_min; else min_range = end; if (reg->dist_max != INFINITE_LEN) { do { if (DIST_CAST(end - s) > reg->dist_max) sch_start = s + reg->dist_max; else { sch_start = onigenc_get_prev_char_head(reg->enc, str, end); } if (backward_search(reg, str, end, sch_start, min_range, adjrange, &low, &high) <= 0) goto mismatch; if (s > high) s = high; while (PTR_GE(s, low)) { MATCH_AND_RETURN_CHECK(orig_start); s = onigenc_get_prev_char_head(reg->enc, str, s); } } while (PTR_GE(s, range)); goto mismatch; } else { /* check only. */ sch_start = onigenc_get_prev_char_head(reg->enc, str, end); if (backward_search(reg, str, end, sch_start, min_range, adjrange, &low, &high) <= 0) goto mismatch; } } do { MATCH_AND_RETURN_CHECK(orig_start); s = onigenc_get_prev_char_head(reg->enc, str, s); } while (PTR_GE(s, range)); } mismatch: #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (OPTON_FIND_LONGEST(reg->options)) { if (msa.best_len >= 0) { s = msa.best_s; goto match; } } #endif r = ONIG_MISMATCH; finish: MATCH_ARG_FREE(msa); /* If result is mismatch and no FIND_NOT_EMPTY option, then the region is not set in match_at(). */ if (OPTON_FIND_NOT_EMPTY(reg->options) && region #ifdef USE_POSIX_API && !OPTON_POSIX_REGION(option) #endif ) { onig_region_clear(region); } #ifdef ONIG_DEBUG if (r != ONIG_MISMATCH) fprintf(DBGFP, "onig_search: error %d\n", r); #endif return r; mismatch_no_msa: r = ONIG_MISMATCH; finish_no_msa: #ifdef ONIG_DEBUG if (r != ONIG_MISMATCH) fprintf(DBGFP, "onig_search: error %d\n", r); #endif return r; match: MATCH_ARG_FREE(msa); return (int )(s - str); } extern int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp) { const UChar* data_range; if (range > start) data_range = range; else data_range = end; return search_in_range(reg, str, end, start, range, data_range, region, option, mp); } extern int onig_scan(regex_t* reg, const UChar* str, const UChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), void* callback_arg) { int r; int n; int rs; const UChar* start; if (OPTON_CHECK_VALIDITY_OF_STRING(option)) { if (! ONIGENC_IS_VALID_MBC_STRING(reg->enc, str, end)) return ONIGERR_INVALID_WIDE_CHAR_VALUE; ONIG_OPTION_OFF(option, ONIG_OPTION_CHECK_VALIDITY_OF_STRING); } n = 0; start = str; while (1) { r = onig_search(reg, str, end, start, end, region, option); if (r >= 0) { rs = scan_callback(n, r, region, callback_arg); n++; if (rs != 0) return rs; if (region->end[0] == start - str) { if (start >= end) break; start += enclen(reg->enc, start); } else start = str + region->end[0]; if (start > end) break; } else if (r == ONIG_MISMATCH) { break; } else { /* error */ return r; } } return n; } extern int onig_get_subexp_call_max_nest_level(void) { return SubexpCallMaxNestLevel; } extern int onig_set_subexp_call_max_nest_level(int level) { SubexpCallMaxNestLevel = level; return 0; } extern OnigEncoding onig_get_encoding(regex_t* reg) { return reg->enc; } extern OnigOptionType onig_get_options(regex_t* reg) { return reg->options; } extern OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg) { return reg->case_fold_flag; } extern OnigSyntaxType* onig_get_syntax(regex_t* reg) { return reg->syntax; } extern int onig_number_of_captures(regex_t* reg) { return reg->num_mem; } extern int onig_number_of_capture_histories(regex_t* reg) { #ifdef USE_CAPTURE_HISTORY int i, n; n = 0; for (i = 0; i <= ONIG_MAX_CAPTURE_HISTORY_GROUP; i++) { if (MEM_STATUS_AT(reg->capture_history, i) != 0) n++; } return n; #else return 0; #endif } extern void onig_copy_encoding(OnigEncoding to, OnigEncoding from) { *to = *from; } #ifdef USE_REGSET extern int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[]) { #define REGSET_INITIAL_ALLOC_SIZE 10 int i; int r; int alloc; OnigRegSet* set; RR* rs; *rset = 0; set = (OnigRegSet* )xmalloc(sizeof(*set)); CHECK_NULL_RETURN_MEMERR(set); alloc = n > REGSET_INITIAL_ALLOC_SIZE ? n : REGSET_INITIAL_ALLOC_SIZE; rs = (RR* )xmalloc(sizeof(set->rs[0]) * alloc); if (IS_NULL(rs)) { xfree(set); return ONIGERR_MEMORY; } set->rs = rs; set->n = 0; set->alloc = alloc; for (i = 0; i < n; i++) { regex_t* reg = regs[i]; r = onig_regset_add(set, reg); if (r != 0) { for (i = 0; i < set->n; i++) { OnigRegion* region = set->rs[i].region; if (IS_NOT_NULL(region)) onig_region_free(region, 1); } xfree(set->rs); xfree(set); return r; } } *rset = set; return 0; } static void update_regset_by_reg(OnigRegSet* set, regex_t* reg) { if (set->n == 1) { set->enc = reg->enc; set->anchor = reg->anchor; set->anc_dmin = reg->anc_dist_min; set->anc_dmax = reg->anc_dist_max; set->all_low_high = (reg->optimize == OPTIMIZE_NONE || reg->dist_max == INFINITE_LEN) ? 0 : 1; set->anychar_inf = (reg->anchor & ANCR_ANYCHAR_INF) != 0 ? 1 : 0; } else { int anchor; anchor = set->anchor & reg->anchor; if (anchor != 0) { OnigLen anc_dmin; OnigLen anc_dmax; anc_dmin = set->anc_dmin; anc_dmax = set->anc_dmax; if (anc_dmin > reg->anc_dist_min) anc_dmin = reg->anc_dist_min; if (anc_dmax < reg->anc_dist_max) anc_dmax = reg->anc_dist_max; set->anc_dmin = anc_dmin; set->anc_dmax = anc_dmax; } set->anchor = anchor; if (reg->optimize == OPTIMIZE_NONE || reg->dist_max == INFINITE_LEN) set->all_low_high = 0; if ((reg->anchor & ANCR_ANYCHAR_INF) != 0) set->anychar_inf = 1; } } extern int onig_regset_add(OnigRegSet* set, regex_t* reg) { OnigRegion* region; #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (OPTON_FIND_LONGEST(reg->options)) return ONIGERR_INVALID_ARGUMENT; #endif if (set->n != 0 && reg->enc != set->enc) return ONIGERR_INVALID_ARGUMENT; if (set->n >= set->alloc) { RR* nrs; int new_alloc; new_alloc = set->alloc * 2; nrs = (RR* )xrealloc(set->rs, sizeof(set->rs[0]) * new_alloc); CHECK_NULL_RETURN_MEMERR(nrs); set->rs = nrs; set->alloc = new_alloc; } region = onig_region_new(); CHECK_NULL_RETURN_MEMERR(region); set->rs[set->n].reg = reg; set->rs[set->n].region = region; set->n++; update_regset_by_reg(set, reg); return 0; } extern int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg) { int i; if (at < 0 || at >= set->n) return ONIGERR_INVALID_ARGUMENT; if (IS_NULL(reg)) { onig_region_free(set->rs[at].region, 1); for (i = at; i < set->n - 1; i++) { set->rs[i].reg = set->rs[i+1].reg; set->rs[i].region = set->rs[i+1].region; } set->n--; } else { #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (OPTON_FIND_LONGEST(reg->options)) return ONIGERR_INVALID_ARGUMENT; #endif if (set->n > 1 && reg->enc != set->enc) return ONIGERR_INVALID_ARGUMENT; set->rs[at].reg = reg; } for (i = 0; i < set->n; i++) update_regset_by_reg(set, set->rs[i].reg); return 0; } extern void onig_regset_free(OnigRegSet* set) { int i; for (i = 0; i < set->n; i++) { regex_t* reg; OnigRegion* region; reg = set->rs[i].reg; region = set->rs[i].region; onig_free(reg); if (IS_NOT_NULL(region)) onig_region_free(region, 1); } xfree(set->rs); xfree(set); } extern int onig_regset_number_of_regex(OnigRegSet* set) { return set->n; } extern regex_t* onig_regset_get_regex(OnigRegSet* set, int at) { if (at < 0 || at >= set->n) return (regex_t* )0; return set->rs[at].reg; } extern OnigRegion* onig_regset_get_region(OnigRegSet* set, int at) { if (at < 0 || at >= set->n) return (OnigRegion* )0; return set->rs[at].region; } #endif /* USE_REGSET */ #ifdef USE_DIRECT_THREADED_CODE extern int onig_init_for_match_at(regex_t* reg) { return match_at(reg, (const UChar* )NULL, (const UChar* )NULL, (const UChar* )NULL, (const UChar* )NULL, (MatchArg* )NULL); } #endif /* for callout functions */ #ifdef USE_CALLOUT extern OnigCalloutFunc onig_get_progress_callout(void) { return DefaultProgressCallout; } extern int onig_set_progress_callout(OnigCalloutFunc f) { DefaultProgressCallout = f; return ONIG_NORMAL; } extern OnigCalloutFunc onig_get_retraction_callout(void) { return DefaultRetractionCallout; } extern int onig_set_retraction_callout(OnigCalloutFunc f) { DefaultRetractionCallout = f; return ONIG_NORMAL; } extern int onig_get_callout_num_by_callout_args(OnigCalloutArgs* args) { return args->num; } extern OnigCalloutIn onig_get_callout_in_by_callout_args(OnigCalloutArgs* args) { return args->in; } extern int onig_get_name_id_by_callout_args(OnigCalloutArgs* args) { return args->name_id; } extern const UChar* onig_get_contents_by_callout_args(OnigCalloutArgs* args) { int num; CalloutListEntry* e; num = args->num; e = onig_reg_callout_list_at(args->regex, num); if (IS_NULL(e)) return 0; if (e->of == ONIG_CALLOUT_OF_CONTENTS) { return e->u.content.start; } return 0; } extern const UChar* onig_get_contents_end_by_callout_args(OnigCalloutArgs* args) { int num; CalloutListEntry* e; num = args->num; e = onig_reg_callout_list_at(args->regex, num); if (IS_NULL(e)) return 0; if (e->of == ONIG_CALLOUT_OF_CONTENTS) { return e->u.content.end; } return 0; } extern int onig_get_args_num_by_callout_args(OnigCalloutArgs* args) { int num; CalloutListEntry* e; num = args->num; e = onig_reg_callout_list_at(args->regex, num); if (IS_NULL(e)) return ONIGERR_INVALID_ARGUMENT; if (e->of == ONIG_CALLOUT_OF_NAME) { return e->u.arg.num; } return ONIGERR_INVALID_ARGUMENT; } extern int onig_get_passed_args_num_by_callout_args(OnigCalloutArgs* args) { int num; CalloutListEntry* e; num = args->num; e = onig_reg_callout_list_at(args->regex, num); if (IS_NULL(e)) return ONIGERR_INVALID_ARGUMENT; if (e->of == ONIG_CALLOUT_OF_NAME) { return e->u.arg.passed_num; } return ONIGERR_INVALID_ARGUMENT; } extern int onig_get_arg_by_callout_args(OnigCalloutArgs* args, int index, OnigType* type, OnigValue* val) { int num; CalloutListEntry* e; num = args->num; e = onig_reg_callout_list_at(args->regex, num); if (IS_NULL(e)) return ONIGERR_INVALID_ARGUMENT; if (e->of == ONIG_CALLOUT_OF_NAME) { if (IS_NOT_NULL(type)) *type = e->u.arg.types[index]; if (IS_NOT_NULL(val)) *val = e->u.arg.vals[index]; return ONIG_NORMAL; } return ONIGERR_INVALID_ARGUMENT; } extern const UChar* onig_get_string_by_callout_args(OnigCalloutArgs* args) { return args->string; } extern const UChar* onig_get_string_end_by_callout_args(OnigCalloutArgs* args) { return args->string_end; } extern const UChar* onig_get_start_by_callout_args(OnigCalloutArgs* args) { return args->start; } extern const UChar* onig_get_right_range_by_callout_args(OnigCalloutArgs* args) { return args->right_range; } extern const UChar* onig_get_current_by_callout_args(OnigCalloutArgs* args) { return args->current; } extern OnigRegex onig_get_regex_by_callout_args(OnigCalloutArgs* args) { return args->regex; } extern unsigned long onig_get_retry_counter_by_callout_args(OnigCalloutArgs* args) { return args->retry_in_match_counter; } extern int onig_get_capture_range_in_callout(OnigCalloutArgs* a, int mem_num, int* begin, int* end) { OnigRegex reg; const UChar* str; StackType* stk_base; int i; StkPtrType* mem_start_stk; StkPtrType* mem_end_stk; i = mem_num; reg = a->regex; str = a->string; stk_base = a->stk_base; mem_start_stk = a->mem_start_stk; mem_end_stk = a->mem_end_stk; if (i > 0) { if (a->mem_end_stk[i].i != INVALID_STACK_INDEX) { *begin = (int )(STACK_MEM_START(reg, i) - str); *end = (int )(STACK_MEM_END(reg, i) - str); } else { *begin = *end = ONIG_REGION_NOTPOS; } } else return ONIGERR_INVALID_ARGUMENT; return ONIG_NORMAL; } extern int onig_get_used_stack_size_in_callout(OnigCalloutArgs* a, int* used_num, int* used_bytes) { int n; n = (int )(a->stk - a->stk_base); if (used_num != 0) *used_num = n; if (used_bytes != 0) *used_bytes = n * sizeof(StackType); return ONIG_NORMAL; } /* builtin callout functions */ extern int onig_builtin_fail(OnigCalloutArgs* args ARG_UNUSED, void* user_data ARG_UNUSED) { return ONIG_CALLOUT_FAIL; } extern int onig_builtin_mismatch(OnigCalloutArgs* args ARG_UNUSED, void* user_data ARG_UNUSED) { return ONIG_MISMATCH; } extern int onig_builtin_error(OnigCalloutArgs* args, void* user_data ARG_UNUSED) { int r; int n; OnigValue val; r = onig_get_arg_by_callout_args(args, 0, 0, &val); if (r != ONIG_NORMAL) return r; n = (int )val.l; if (n >= 0) { n = ONIGERR_INVALID_CALLOUT_BODY; } else if (onig_is_error_code_needs_param(n)) { n = ONIGERR_INVALID_CALLOUT_BODY; } return n; } #ifdef USE_SKIP_SEARCH extern int onig_builtin_skip(OnigCalloutArgs* args, void* user_data ARG_UNUSED) { if (args->current > args->msa->skip_search) args->msa->skip_search = (UChar* )args->current; return ONIG_NORMAL; } #endif extern int onig_builtin_count(OnigCalloutArgs* args, void* user_data) { (void )onig_check_callout_data_and_clear_old_values(args); return onig_builtin_total_count(args, user_data); } extern int onig_builtin_total_count(OnigCalloutArgs* args, void* user_data ARG_UNUSED) { int r; int slot; OnigType type; OnigValue val; OnigValue aval; OnigCodePoint count_type; r = onig_get_arg_by_callout_args(args, 0, &type, &aval); if (r != ONIG_NORMAL) return r; count_type = aval.c; if (count_type != '>' && count_type != 'X' && count_type != '<') return ONIGERR_INVALID_CALLOUT_ARG; r = onig_get_callout_data_by_callout_args_self_dont_clear_old(args, 0, &type, &val); if (r < ONIG_NORMAL) return r; else if (r > ONIG_NORMAL) { /* type == void: initial state */ val.l = 0; } if (args->in == ONIG_CALLOUT_IN_RETRACTION) { slot = 2; if (count_type == '<') val.l++; else if (count_type == 'X') val.l--; } else { slot = 1; if (count_type != '<') val.l++; } r = onig_set_callout_data_by_callout_args_self(args, 0, ONIG_TYPE_LONG, &val); if (r != ONIG_NORMAL) return r; /* slot 1: in progress counter, slot 2: in retraction counter */ r = onig_get_callout_data_by_callout_args_self_dont_clear_old(args, slot, &type, &val); if (r < ONIG_NORMAL) return r; else if (r > ONIG_NORMAL) { val.l = 0; } val.l++; r = onig_set_callout_data_by_callout_args_self(args, slot, ONIG_TYPE_LONG, &val); if (r != ONIG_NORMAL) return r; return ONIG_CALLOUT_SUCCESS; } extern int onig_builtin_max(OnigCalloutArgs* args, void* user_data ARG_UNUSED) { int r; int slot; long max_val; OnigCodePoint count_type; OnigType type; OnigValue val; OnigValue aval; (void )onig_check_callout_data_and_clear_old_values(args); slot = 0; r = onig_get_callout_data_by_callout_args_self(args, slot, &type, &val); if (r < ONIG_NORMAL) return r; else if (r > ONIG_NORMAL) { /* type == void: initial state */ type = ONIG_TYPE_LONG; val.l = 0; } r = onig_get_arg_by_callout_args(args, 0, &type, &aval); if (r != ONIG_NORMAL) return r; if (type == ONIG_TYPE_TAG) { r = onig_get_callout_data_by_callout_args(args, aval.tag, 0, &type, &aval); if (r < ONIG_NORMAL) return r; else if (r > ONIG_NORMAL) max_val = 0L; else max_val = aval.l; } else { /* LONG */ max_val = aval.l; } r = onig_get_arg_by_callout_args(args, 1, &type, &aval); if (r != ONIG_NORMAL) return r; count_type = aval.c; if (count_type != '>' && count_type != 'X' && count_type != '<') return ONIGERR_INVALID_CALLOUT_ARG; if (args->in == ONIG_CALLOUT_IN_RETRACTION) { if (count_type == '<') { if (val.l >= max_val) return ONIG_CALLOUT_FAIL; val.l++; } else if (count_type == 'X') val.l--; } else { if (count_type != '<') { if (val.l >= max_val) return ONIG_CALLOUT_FAIL; val.l++; } } r = onig_set_callout_data_by_callout_args_self(args, slot, ONIG_TYPE_LONG, &val); if (r != ONIG_NORMAL) return r; return ONIG_CALLOUT_SUCCESS; } enum OP_CMP { OP_EQ, OP_NE, OP_LT, OP_GT, OP_LE, OP_GE }; extern int onig_builtin_cmp(OnigCalloutArgs* args, void* user_data ARG_UNUSED) { int r; int slot; long lv; long rv; OnigType type; OnigValue val; regex_t* reg; enum OP_CMP op; reg = args->regex; r = onig_get_arg_by_callout_args(args, 0, &type, &val); if (r != ONIG_NORMAL) return r; if (type == ONIG_TYPE_TAG) { r = onig_get_callout_data_by_callout_args(args, val.tag, 0, &type, &val); if (r < ONIG_NORMAL) return r; else if (r > ONIG_NORMAL) lv = 0L; else lv = val.l; } else { /* ONIG_TYPE_LONG */ lv = val.l; } r = onig_get_arg_by_callout_args(args, 2, &type, &val); if (r != ONIG_NORMAL) return r; if (type == ONIG_TYPE_TAG) { r = onig_get_callout_data_by_callout_args(args, val.tag, 0, &type, &val); if (r < ONIG_NORMAL) return r; else if (r > ONIG_NORMAL) rv = 0L; else rv = val.l; } else { /* ONIG_TYPE_LONG */ rv = val.l; } slot = 0; r = onig_get_callout_data_by_callout_args_self(args, slot, &type, &val); if (r < ONIG_NORMAL) return r; else if (r > ONIG_NORMAL) { /* type == void: initial state */ OnigCodePoint c1, c2; UChar* p; r = onig_get_arg_by_callout_args(args, 1, &type, &val); if (r != ONIG_NORMAL) return r; p = val.s.start; c1 = ONIGENC_MBC_TO_CODE(reg->enc, p, val.s.end); p += ONIGENC_MBC_ENC_LEN(reg->enc, p); if (p < val.s.end) { c2 = ONIGENC_MBC_TO_CODE(reg->enc, p, val.s.end); p += ONIGENC_MBC_ENC_LEN(reg->enc, p); if (p != val.s.end) return ONIGERR_INVALID_CALLOUT_ARG; } else c2 = 0; switch (c1) { case '=': if (c2 != '=') return ONIGERR_INVALID_CALLOUT_ARG; op = OP_EQ; break; case '!': if (c2 != '=') return ONIGERR_INVALID_CALLOUT_ARG; op = OP_NE; break; case '<': if (c2 == '=') op = OP_LE; else if (c2 == 0) op = OP_LT; else return ONIGERR_INVALID_CALLOUT_ARG; break; case '>': if (c2 == '=') op = OP_GE; else if (c2 == 0) op = OP_GT; else return ONIGERR_INVALID_CALLOUT_ARG; break; default: return ONIGERR_INVALID_CALLOUT_ARG; break; } val.l = (long )op; r = onig_set_callout_data_by_callout_args_self(args, slot, ONIG_TYPE_LONG, &val); if (r != ONIG_NORMAL) return r; } else { op = (enum OP_CMP )val.l; } switch (op) { case OP_EQ: r = (lv == rv); break; case OP_NE: r = (lv != rv); break; case OP_LT: r = (lv < rv); break; case OP_GT: r = (lv > rv); break; case OP_LE: r = (lv <= rv); break; case OP_GE: r = (lv >= rv); break; } return r == 0 ? ONIG_CALLOUT_FAIL : ONIG_CALLOUT_SUCCESS; } #ifndef ONIG_NO_PRINT static FILE* OutFp; /* name start with "onig_" for macros. */ static int onig_builtin_monitor(OnigCalloutArgs* args, void* user_data) { int r; int num; size_t tag_len; const UChar* start; const UChar* right; const UChar* current; const UChar* string; const UChar* strend; const UChar* tag_start; const UChar* tag_end; regex_t* reg; OnigCalloutIn in; OnigType type; OnigValue val; char buf[20]; FILE* fp; fp = OutFp; r = onig_get_arg_by_callout_args(args, 0, &type, &val); if (r != ONIG_NORMAL) return r; in = onig_get_callout_in_by_callout_args(args); if (in == ONIG_CALLOUT_IN_PROGRESS) { if (val.c == '<') return ONIG_CALLOUT_SUCCESS; } else { if (val.c != 'X' && val.c != '<') return ONIG_CALLOUT_SUCCESS; } num = onig_get_callout_num_by_callout_args(args); start = onig_get_start_by_callout_args(args); right = onig_get_right_range_by_callout_args(args); current = onig_get_current_by_callout_args(args); string = onig_get_string_by_callout_args(args); strend = onig_get_string_end_by_callout_args(args); reg = onig_get_regex_by_callout_args(args); tag_start = onig_get_callout_tag_start(reg, num); tag_end = onig_get_callout_tag_end(reg, num); if (tag_start == 0) xsnprintf(buf, sizeof(buf), "#%d", num); else { /* CAUTION: tag string is not terminated with NULL. */ int i; tag_len = tag_end - tag_start; if (tag_len >= sizeof(buf)) tag_len = sizeof(buf) - 1; for (i = 0; i < (int )tag_len; i++) buf[i] = tag_start[i]; buf[tag_len] = '\0'; } fprintf(fp, "ONIG-MONITOR: %-4s %s at: %d [%d - %d] len: %d\n", buf, in == ONIG_CALLOUT_IN_PROGRESS ? "=>" : "<=", (int )(current - string), (int )(start - string), (int )(right - string), (int )(strend - string)); fflush(fp); return ONIG_CALLOUT_SUCCESS; } extern int onig_setup_builtin_monitors_by_ascii_encoded_name(void* fp /* FILE* */) { int id; char* name; OnigEncoding enc; unsigned int ts[4]; OnigValue opts[4]; if (IS_NOT_NULL(fp)) OutFp = (FILE* )fp; else OutFp = stdout; enc = ONIG_ENCODING_ASCII; name = "MON"; ts[0] = ONIG_TYPE_CHAR; opts[0].c = '>'; BC_B_O(name, monitor, 1, ts, 1, opts); return ONIG_NORMAL; } #endif /* ONIG_NO_PRINT */ #endif /* USE_CALLOUT */ jq-1.8.2/vendor/oniguruma/src/iso8859_13.c0000644000175100017510000002071315215513537013522 /********************************************************************** iso8859_13.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_13_TO_LOWER_CASE(c) EncISO_8859_13_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_13_CTYPE(code,ctype) \ ((EncISO_8859_13_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_13_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\270', '\251', '\272', '\253', '\254', '\255', '\256', '\277', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_13_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x34a2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x34a2, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x01a0, 0x30e2, 0x00a0, 0x01a0, 0x30e2, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_13_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_13_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_13 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-13", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/regsyntax.c0000644000175100017510000003352315215513537014116 /********************************************************************** regsyntax.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" OnigSyntaxType OnigSyntaxASIS = { 0 , ONIG_SYN_OP2_INEFFECTIVE_ESCAPE , 0 , ONIG_OPTION_NONE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxPosixBasic = { ( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ONIG_SYN_OP_ESC_BRACE_INTERVAL ) , 0 , ( ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP ) , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE ) , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxPosixExtended = { ( SYN_POSIX_COMMON_OP | ONIG_SYN_OP_LPAREN_SUBEXP | ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT ) , 0 , ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP | ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC ) , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE ) , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxEmacs = { ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_ESC_BRACE_INTERVAL | ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ONIG_SYN_OP_ESC_VBAR_ALT | ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_DECIMAL_BACKREF | ONIG_SYN_OP_LINE_ANCHOR | ONIG_SYN_OP_ESC_CONTROL_CHARS ) , ( ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR | ONIG_SYN_OP2_QMARK_GROUP_EFFECT ) , ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC , ONIG_OPTION_NONE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxGrep = { ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_POSIX_BRACKET | ONIG_SYN_OP_ESC_BRACE_INTERVAL | ONIG_SYN_OP_ESC_LPAREN_SUBEXP | ONIG_SYN_OP_ESC_VBAR_ALT | ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_ESC_PLUS_ONE_INF | ONIG_SYN_OP_ESC_QMARK_ZERO_ONE | ONIG_SYN_OP_LINE_ANCHOR | ONIG_SYN_OP_ESC_W_WORD | ONIG_SYN_OP_ESC_B_WORD_BOUND | ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | ONIG_SYN_OP_DECIMAL_BACKREF ) , 0 , ( ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC | ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC | ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP ) , ONIG_OPTION_NONE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxGnuRegex = { SYN_GNU_REGEX_OP , 0 , SYN_GNU_REGEX_BV , ONIG_OPTION_NONE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxJava = { (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL | ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 ) & ~(ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | ONIG_SYN_OP_POSIX_BRACKET) ) , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE | ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL | ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT | ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL | ONIG_SYN_OP2_CCLASS_SET_OP | ONIG_SYN_OP2_ESC_V_VTAB | ONIG_SYN_OP2_ESC_U_HEX4 | ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY ) , ( SYN_GNU_REGEX_BV | ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH | ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND | ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND | ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC ) , ONIG_OPTION_SINGLELINE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxPerl = { (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 | ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_O_BRACE_OCTAL | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL ) & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END ) , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE | ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL | ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT | ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL | ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE | ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP | ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS | ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME | ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT | ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY | ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT | ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP | ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE | ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT ) , (SYN_GNU_REGEX_BV | ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH | ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC ) , ONIG_OPTION_SINGLELINE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; /* Perl + named group */ OnigSyntaxType OnigSyntaxPerl_NG = { (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 | ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_O_BRACE_OCTAL | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL ) & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END ) , ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE | ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL | ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT | ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL | ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE | ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP | ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS | ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME | ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT | ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY | ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT | ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP | ONIG_SYN_OP2_ESC_K_NAMED_BACKREF | ONIG_SYN_OP2_ESC_G_SUBEXP_CALL | ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP | ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE | ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT | ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL ) , ( SYN_GNU_REGEX_BV | ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH | ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP | ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME | ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC ) , ONIG_OPTION_SINGLELINE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; /* Python 3.9 */ OnigSyntaxType OnigSyntaxPython = { (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL ) & ~(ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | ONIG_SYN_OP_POSIX_BRACKET) ) , ( ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL | ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE | ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME | ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY | ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT | ONIG_SYN_OP2_QMARK_CAPITAL_P_NAME | ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP | ONIG_SYN_OP2_ESC_V_VTAB | ONIG_SYN_OP2_ESC_U_HEX4 ) , ( SYN_GNU_REGEX_BV | ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH | ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV | ONIG_SYN_PYTHON ) , ONIG_OPTION_SINGLELINE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; extern int onig_set_default_syntax(OnigSyntaxType* syntax) { if (IS_NULL(syntax)) syntax = ONIG_SYNTAX_ONIGURUMA; OnigDefaultSyntax = syntax; return 0; } extern void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from) { *to = *from; } extern void onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op) { syntax->op = op; } extern void onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2) { syntax->op2 = op2; } extern void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior) { syntax->behavior = behavior; } extern void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options) { syntax->options = options; } extern unsigned int onig_get_syntax_op(OnigSyntaxType* syntax) { return syntax->op; } extern unsigned int onig_get_syntax_op2(OnigSyntaxType* syntax) { return syntax->op2; } extern unsigned int onig_get_syntax_behavior(OnigSyntaxType* syntax) { return syntax->behavior; } extern OnigOptionType onig_get_syntax_options(OnigSyntaxType* syntax) { return syntax->options; } #ifdef USE_VARIABLE_META_CHARS extern int onig_set_meta_char(OnigSyntaxType* enc, unsigned int what, OnigCodePoint code) { switch (what) { case ONIG_META_CHAR_ESCAPE: enc->meta_char_table.esc = code; break; case ONIG_META_CHAR_ANYCHAR: enc->meta_char_table.anychar = code; break; case ONIG_META_CHAR_ANYTIME: enc->meta_char_table.anytime = code; break; case ONIG_META_CHAR_ZERO_OR_ONE_TIME: enc->meta_char_table.zero_or_one_time = code; break; case ONIG_META_CHAR_ONE_OR_MORE_TIME: enc->meta_char_table.one_or_more_time = code; break; case ONIG_META_CHAR_ANYCHAR_ANYTIME: enc->meta_char_table.anychar_anytime = code; break; default: return ONIGERR_INVALID_ARGUMENT; break; } return 0; } #endif /* USE_VARIABLE_META_CHARS */ jq-1.8.2/vendor/oniguruma/src/iso8859_5.c0000644000175100017510000002116115215513537013441 /********************************************************************** iso8859_5.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_5_TO_LOWER_CASE(c) EncISO_8859_5_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_5_CTYPE(code,ctype) \ ((EncISO_8859_5_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_5_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\255', '\376', '\377', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_5_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_5_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_5_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa1, 0xf1 }, { 0xa2, 0xf2 }, { 0xa3, 0xf3 }, { 0xa4, 0xf4 }, { 0xa5, 0xf5 }, { 0xa6, 0xf6 }, { 0xa7, 0xf7 }, { 0xa8, 0xf8 }, { 0xa9, 0xf9 }, { 0xaa, 0xfa }, { 0xab, 0xfb }, { 0xac, 0xfc }, { 0xae, 0xfe }, { 0xaf, 0xff }, { 0xb0, 0xd0 }, { 0xb1, 0xd1 }, { 0xb2, 0xd2 }, { 0xb3, 0xd3 }, { 0xb4, 0xd4 }, { 0xb5, 0xd5 }, { 0xb6, 0xd6 }, { 0xb7, 0xd7 }, { 0xb8, 0xd8 }, { 0xb9, 0xd9 }, { 0xba, 0xda }, { 0xbb, 0xdb }, { 0xbc, 0xdc }, { 0xbd, 0xdd }, { 0xbe, 0xde }, { 0xbf, 0xdf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_5 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-5", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/oniggnu.h0000644000175100017510000000644115215513537013544 #ifndef ONIGGNU_H #define ONIGGNU_H /********************************************************************** oniggnu.h - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "oniguruma.h" #ifdef __cplusplus extern "C" { #endif enum { RE_MBCTYPE_ASCII = 0, RE_MBCTYPE_EUC = 1, RE_MBCTYPE_SJIS = 2, RE_MBCTYPE_UTF8 = 3 }; /* GNU regex options */ #ifndef RE_NREGS #define RE_NREGS ONIG_NREGION #endif #define RE_OPTION_IGNORECASE ONIG_OPTION_IGNORECASE #define RE_OPTION_EXTENDED ONIG_OPTION_EXTEND #define RE_OPTION_MULTILINE ONIG_OPTION_MULTILINE #define RE_OPTION_SINGLELINE ONIG_OPTION_SINGLELINE #define RE_OPTION_LONGEST ONIG_OPTION_FIND_LONGEST #define RE_OPTION_POSIXLINE (RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE) #define RE_OPTION_FIND_NOT_EMPTY ONIG_OPTION_FIND_NOT_EMPTY #define RE_OPTION_NEGATE_SINGLELINE ONIG_OPTION_NEGATE_SINGLELINE #define RE_OPTION_DONT_CAPTURE_GROUP ONIG_OPTION_DONT_CAPTURE_GROUP #define RE_OPTION_CAPTURE_GROUP ONIG_OPTION_CAPTURE_GROUP ONIG_EXTERN void re_mbcinit P_((int)); ONIG_EXTERN int re_compile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf)); ONIG_EXTERN int re_recompile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf)); ONIG_EXTERN void re_free_pattern P_((struct re_pattern_buffer*)); ONIG_EXTERN int re_adjust_startpos P_((struct re_pattern_buffer*, const char*, int, int, int)); ONIG_EXTERN int re_search P_((struct re_pattern_buffer*, const char*, int, int, int, struct re_registers*)); ONIG_EXTERN int re_match P_((struct re_pattern_buffer*, const char *, int, int, struct re_registers*)); ONIG_EXTERN void re_set_casetable P_((const char*)); ONIG_EXTERN void re_free_registers P_((struct re_registers*)); ONIG_EXTERN int re_alloc_pattern P_((struct re_pattern_buffer**)); /* added */ #ifdef __cplusplus } #endif #endif /* ONIGGNU_H */ jq-1.8.2/vendor/oniguruma/src/regenc.h0000644000175100017510000003044315215513537013340 #ifndef REGENC_H #define REGENC_H /********************************************************************** regenc.h - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #ifndef ONIGURUMA_EXPORT #define ONIGURUMA_EXPORT #endif #include "config.h" #ifndef ONIG_NO_STANDARD_C_HEADERS #include #endif #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION #endif #include "oniguruma.h" typedef struct { OnigCodePoint from; OnigCodePoint to; } OnigPairCaseFoldCodes; #ifndef NULL #define NULL ((void* )0) #endif #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifndef ARG_UNUSED #if defined(__GNUC__) # define ARG_UNUSED __attribute__ ((unused)) #else # define ARG_UNUSED #endif #endif #define ONIG_IS_NULL(p) (((void*)(p)) == (void*)0) #define ONIG_IS_NOT_NULL(p) (((void*)(p)) != (void*)0) #define ONIG_CHECK_NULL_RETURN(p) if (ONIG_IS_NULL(p)) return NULL #define ONIG_CHECK_NULL_RETURN_VAL(p,val) if (ONIG_IS_NULL(p)) return (val) #define MAX_CODE_POINT (~((OnigCodePoint )0)) #define ASCII_LIMIT 127 #define NEWLINE_CODE 0x0a #define enclen(enc,p) ONIGENC_MBC_ENC_LEN(enc,p) /* character types bit flag */ #define BIT_CTYPE_NEWLINE (1<< ONIGENC_CTYPE_NEWLINE) #define BIT_CTYPE_ALPHA (1<< ONIGENC_CTYPE_ALPHA) #define BIT_CTYPE_BLANK (1<< ONIGENC_CTYPE_BLANK) #define BIT_CTYPE_CNTRL (1<< ONIGENC_CTYPE_CNTRL) #define BIT_CTYPE_DIGIT (1<< ONIGENC_CTYPE_DIGIT) #define BIT_CTYPE_GRAPH (1<< ONIGENC_CTYPE_GRAPH) #define BIT_CTYPE_LOWER (1<< ONIGENC_CTYPE_LOWER) #define BIT_CTYPE_PRINT (1<< ONIGENC_CTYPE_PRINT) #define BIT_CTYPE_PUNCT (1<< ONIGENC_CTYPE_PUNCT) #define BIT_CTYPE_SPACE (1<< ONIGENC_CTYPE_SPACE) #define BIT_CTYPE_UPPER (1<< ONIGENC_CTYPE_UPPER) #define BIT_CTYPE_XDIGIT (1<< ONIGENC_CTYPE_XDIGIT) #define BIT_CTYPE_WORD (1<< ONIGENC_CTYPE_WORD) #define BIT_CTYPE_ALNUM (1<< ONIGENC_CTYPE_ALNUM) #define BIT_CTYPE_ASCII (1<< ONIGENC_CTYPE_ASCII) #define CTYPE_TO_BIT(ctype) (1<<(ctype)) #define CTYPE_IS_WORD_GRAPH_PRINT(ctype) \ ((ctype) == ONIGENC_CTYPE_WORD || (ctype) == ONIGENC_CTYPE_GRAPH ||\ (ctype) == ONIGENC_CTYPE_PRINT) typedef struct { UChar *name; int ctype; short int len; } PosixBracketEntryType; struct PropertyNameCtype { char *name; int ctype; }; /* #define USE_CRNL_AS_LINE_TERMINATOR */ #define USE_UNICODE_PROPERTIES #define USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER #define USE_UNICODE_WORD_BREAK /* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */ /* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTS #18 */ #define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII #define ENC_SKIP_OFFSET_1_OR_0 7 #define ENC_FLAG_ASCII_COMPATIBLE (1<<0) #define ENC_FLAG_UNICODE (1<<1) #define ENC_FLAG_SKIP_OFFSET_MASK (7<<2) #define ENC_FLAG_SKIP_OFFSET_0 0 #define ENC_FLAG_SKIP_OFFSET_1 (1<<2) #define ENC_FLAG_SKIP_OFFSET_2 (2<<2) #define ENC_FLAG_SKIP_OFFSET_3 (3<<2) #define ENC_FLAG_SKIP_OFFSET_4 (4<<2) #define ENC_FLAG_SKIP_OFFSET_1_OR_0 (ENC_SKIP_OFFSET_1_OR_0<<2) #define ENC_GET_SKIP_OFFSET(enc) \ (((enc)->flag & ENC_FLAG_SKIP_OFFSET_MASK)>>2) #define CASE_FOLD_IS_ASCII_ONLY(flag) \ (((flag) & ONIGENC_CASE_FOLD_ASCII_ONLY) != 0) #define CASE_FOLD_IS_NOT_ASCII_ONLY(flag) \ (((flag) & ONIGENC_CASE_FOLD_ASCII_ONLY) == 0) /* for encoding system implementation (internal) */ extern int onigenc_end(void); extern int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg)); extern int onigenc_ascii_get_case_fold_codes_by_str P_((OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])); extern int onigenc_apply_all_case_fold_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg)); extern int onigenc_get_case_fold_codes_by_str_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])); extern int onigenc_not_support_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[])); extern int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end)); /* methods for single byte encoding */ extern int onigenc_ascii_mbc_case_fold P_((OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower)); extern int onigenc_single_byte_mbc_enc_len P_((const UChar* p)); extern OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end)); extern int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code)); extern int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf)); extern UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s)); extern int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end)); extern int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end)); extern int onigenc_always_true_is_valid_mbc_string P_((const UChar* s, const UChar* end)); extern int onigenc_length_check_is_valid_mbc_string P_((OnigEncoding enc, const UChar* s, const UChar* end)); /* methods for multi byte encoding */ extern OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end)); extern int onigenc_mbn_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower)); extern int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf)); extern int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end)); extern int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end)); extern int onigenc_is_mbc_word_ascii P_((OnigEncoding enc, UChar* s, const UChar* end)); extern int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype)); extern int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf)); extern int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype)); extern struct PropertyNameCtype* onigenc_euc_jp_lookup_property_name P_((register const char *str, register size_t len)); extern struct PropertyNameCtype* onigenc_sjis_lookup_property_name P_((register const char *str, register size_t len)); /* in unicode.c */ extern int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype)); extern int onigenc_utf16_32_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[])); extern int onigenc_unicode_ctype_code_range P_((OnigCtype ctype, const OnigCodePoint* ranges[])); extern int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])); extern int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold)); extern int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg)); extern int onigenc_egcb_is_break_position P_((OnigEncoding enc, UChar* p, UChar* prev, const UChar* start, const UChar* end)); #ifdef USE_UNICODE_WORD_BREAK extern int onigenc_wb_is_break_position P_((OnigEncoding enc, UChar* p, UChar* prev, const UChar* start, const UChar* end)); #endif #define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8) #define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc) /* from unicode generated codes */ #define FOLDS1_FOLD(i) (OnigUnicodeFolds1 + (i)) #define FOLDS2_FOLD(i) (OnigUnicodeFolds2 + (i)) #define FOLDS3_FOLD(i) (OnigUnicodeFolds3 + (i)) #define FOLDS1_UNFOLDS_NUM(i) (OnigUnicodeFolds1[(i)+1]) #define FOLDS2_UNFOLDS_NUM(i) (OnigUnicodeFolds2[(i)+2]) #define FOLDS3_UNFOLDS_NUM(i) (OnigUnicodeFolds3[(i)+3]) #define FOLDS1_UNFOLDS(i) (FOLDS1_FOLD(i) + 2) #define FOLDS2_UNFOLDS(i) (FOLDS2_FOLD(i) + 3) #define FOLDS3_UNFOLDS(i) (FOLDS3_FOLD(i) + 4) #define FOLDS1_NEXT_INDEX(i) ((i) + 2 + FOLDS1_UNFOLDS_NUM(i)) #define FOLDS2_NEXT_INDEX(i) ((i) + 3 + FOLDS2_UNFOLDS_NUM(i)) #define FOLDS3_NEXT_INDEX(i) ((i) + 4 + FOLDS3_UNFOLDS_NUM(i)) #define FOLDS_FOLD_ADDR_BUK(buk, addr) do {\ if ((buk)->fold_len == 1)\ addr = OnigUnicodeFolds1 + (buk)->index;\ else if ((buk)->fold_len == 2)\ addr = OnigUnicodeFolds2 + (buk)->index;\ else if ((buk)->fold_len == 3)\ addr = OnigUnicodeFolds3 + (buk)->index;\ else\ return ONIGERR_INVALID_CODE_POINT_VALUE;\ } while (0) extern OnigCodePoint OnigUnicodeFolds1[]; extern OnigCodePoint OnigUnicodeFolds2[]; extern OnigCodePoint OnigUnicodeFolds3[]; struct ByUnfoldKey { OnigCodePoint code; short int index; short int fold_len; }; extern const struct ByUnfoldKey* onigenc_unicode_unfold_key(OnigCodePoint code); extern int onigenc_unicode_fold1_key(OnigCodePoint code[]); extern int onigenc_unicode_fold2_key(OnigCodePoint code[]); extern int onigenc_unicode_fold3_key(OnigCodePoint code[]); extern int onig_codes_cmp(OnigCodePoint a[], OnigCodePoint b[], int n); extern int onig_codes_byte_at(OnigCodePoint code[], int at); #define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \ OnigEncISO_8859_1_ToLowerCaseTable[c] #define ONIGENC_ISO_8859_1_TO_UPPER_CASE(c) \ OnigEncISO_8859_1_ToUpperCaseTable[c] extern const UChar OnigEncISO_8859_1_ToLowerCaseTable[]; extern const UChar OnigEncISO_8859_1_ToUpperCaseTable[]; extern int onigenc_with_ascii_strncmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n)); extern UChar* onigenc_step P_((OnigEncoding enc, const UChar* p, const UChar* end, int n)); /* defined in regexec.c, but used in enc/xxx.c */ extern int onig_is_in_code_range P_((const UChar* p, OnigCodePoint code)); extern OnigEncoding OnigEncDefaultCharEncoding; extern const UChar OnigEncAsciiToLowerCaseTable[]; extern const UChar OnigEncAsciiToUpperCaseTable[]; extern const unsigned short OnigEncAsciiCtypeTable[]; #define ONIGENC_IS_ASCII_CODE(code) ((code) < 0x80) #define ONIGENC_ASCII_CODE_TO_LOWER_CASE(c) OnigEncAsciiToLowerCaseTable[c] #define ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) OnigEncAsciiToUpperCaseTable[c] #define ONIGENC_IS_ASCII_CODE_CTYPE(code,ctype) \ ((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) #define ONIGENC_IS_ASCII_CODE_WORD(code) \ ((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ONIGENC_CTYPE_WORD)) != 0) #define ONIGENC_IS_ASCII_CODE_CASE_AMBIG(code) \ (ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\ ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER)) #define ONIGENC_IS_UNICODE_ENCODING(enc) \ (((enc)->flag & ENC_FLAG_UNICODE) != 0) #define ONIGENC_IS_ASCII_COMPATIBLE_ENCODING(enc) \ (((enc)->flag & ENC_FLAG_ASCII_COMPATIBLE) != 0) #endif /* REGENC_H */ jq-1.8.2/vendor/oniguruma/src/Makefile.windows0000644000175100017510000002545215215513537015061 # Oniguruma Makefile for Windows product_name = oniguruma TEST_DIR = $(ONIG_DIR)/../test SAMPLE_DIR = $(ONIG_DIR)/../sample WIN_DIR = $(ONIG_DIR)/../windows CPPFLAGS = CFLAGS = -O2 -nologo /W3 LDFLAGS = LOADLIBES = ARLIB = lib ARLIB_FLAGS = -nologo ARDLL = cl ARDLL_FLAGS = -nologo -LD $(LINKFLAGS) -dll LINKFLAGS = -link -incremental:no -pdb:none SAMPLE_CFLAGS = $(CFLAGS) /I$(ONIG_DIR) INSTALL = install -c CP = copy CC = cl DEFS = -DHAVE_CONFIG_H -DUSE_POSIX_API -DUSE_BINARY_COMPATIBLE_POSIX_API subdirs = libbase = onig libname = $(libbase)_s.lib dllname = $(libbase).dll dlllib = $(libbase).lib !IF defined(ENABLE_POSIX_API) && "$(ENABLE_POSIX_API)" == "NO" posixobjs = !ELSE posixobjs = $(BUILD_DIR)/regposix.obj $(BUILD_DIR)/regposerr.obj !ENDIF onigheaders = $(ONIG_DIR)/oniguruma.h $(ONIG_DIR)/regint.h $(ONIG_DIR)/regparse.h $(ONIG_DIR)/regenc.h $(ONIG_DIR)/st.h posixheaders = $(ONIG_DIR)/onigposix.h headers = $(posixheaders) $(onigheaders) onigobjs = $(BUILD_DIR)/reggnu.obj $(BUILD_DIR)/regerror.obj $(BUILD_DIR)/regparse.obj $(BUILD_DIR)/regext.obj $(BUILD_DIR)/regcomp.obj \ $(BUILD_DIR)/regexec.obj $(BUILD_DIR)/regenc.obj $(BUILD_DIR)/regsyntax.obj $(BUILD_DIR)/regtrav.obj \ $(BUILD_DIR)/regversion.obj $(BUILD_DIR)/st.obj $(BUILD_DIR)/onig_init.obj libobjs = $(onigobjs) $(posixobjs) jp_objs = $(BUILD_DIR)/euc_jp.obj $(BUILD_DIR)/sjis.obj iso8859_objs = $(BUILD_DIR)/iso8859_1.obj $(BUILD_DIR)/iso8859_2.obj \ $(BUILD_DIR)/iso8859_3.obj $(BUILD_DIR)/iso8859_4.obj \ $(BUILD_DIR)/iso8859_5.obj $(BUILD_DIR)/iso8859_6.obj \ $(BUILD_DIR)/iso8859_7.obj $(BUILD_DIR)/iso8859_8.obj \ $(BUILD_DIR)/iso8859_9.obj $(BUILD_DIR)/iso8859_10.obj \ $(BUILD_DIR)/iso8859_11.obj $(BUILD_DIR)/iso8859_13.obj \ $(BUILD_DIR)/iso8859_14.obj $(BUILD_DIR)/iso8859_15.obj \ $(BUILD_DIR)/iso8859_16.obj encobjs = $(BUILD_DIR)/ascii.obj $(BUILD_DIR)/utf8.obj \ $(BUILD_DIR)/unicode.obj \ $(BUILD_DIR)/utf16_be.obj $(BUILD_DIR)/utf16_le.obj \ $(BUILD_DIR)/utf32_be.obj $(BUILD_DIR)/utf32_le.obj \ $(jp_objs) $(iso8859_objs) \ $(BUILD_DIR)/euc_tw.obj $(BUILD_DIR)/euc_kr.obj $(BUILD_DIR)/big5.obj \ $(BUILD_DIR)/gb18030.obj \ $(BUILD_DIR)/koi8_r.obj \ $(BUILD_DIR)/cp1251.obj \ $(BUILD_DIR)/euc_jp_prop.obj $(BUILD_DIR)/sjis_prop.obj \ $(BUILD_DIR)/unicode_unfold_key.obj $(BUILD_DIR)/unicode_fold1_key.obj \ $(BUILD_DIR)/unicode_fold2_key.obj $(BUILD_DIR)/unicode_fold3_key.obj # $(BUILD_DIR)/koi8.obj onigsources = $(ONIG_DIR)/regerror.c $(ONIG_DIR)/regparse.c $(ONIG_DIR)/regext.c $(ONIG_DIR)/regcomp.c $(ONIG_DIR)/regexec.c $(ONIG_DIR)/regenc.c \ $(ONIG_DIR)/regsyntax.c $(ONIG_DIR)/regtrav.c $(ONIG_DIR)/regversion.c $(ONIG_DIR)/reggnu.c $(ONIG_DIR)/st.c posixsources = $(ONIG_DIR)/regposix.c $(ONIG_DIR)/regposerr.c libsources = $(posixsources) $(onigsources) patchfiles = re.c.168.patch re.c.181.patch distfiles = README COPYING HISTORY \ Makefile.in configure.in config.h.in configure \ $(headers) $(libsources) $(patchfiles) \ test.rb testconv.rb testc = testc testp = testp makeargs = $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' CFLAGS='$(CFLAGS)' CC='$(CC)' .SUFFIXES: .SUFFIXES: .obj .c .h .ps .dvi .info .texinfo {$(ONIG_DIR)}.c{$(BUILD_DIR)}.obj: $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) /I. /I.. /Fo$@ /c $< # targets default: all all: $(libname) $(dllname) $(libname): $(libobjs) $(encobjs) $(ARLIB) $(ARLIB_FLAGS) -out:$@ $(libobjs) $(encobjs) $(dllname): $(libobjs) $(encobjs) $(ARDLL) $(libobjs) $(encobjs) -Fe$@ $(ARDLL_FLAGS) $(BUILD_DIR)/regparse.obj: $(ONIG_DIR)/regparse.c $(onigheaders) $(BUILD_DIR)/config.h $(BUILD_DIR)/regext.obj: $(ONIG_DIR)/regext.c $(onigheaders) $(BUILD_DIR)/config.h $(BUILD_DIR)/regtrav.obj: $(ONIG_DIR)/regtrav.c $(onigheaders) $(BUILD_DIR)/config.h $(BUILD_DIR)/regcomp.obj: $(ONIG_DIR)/regcomp.c $(onigheaders) $(BUILD_DIR)/config.h $(BUILD_DIR)/regexec.obj: $(ONIG_DIR)/regexec.c $(ONIG_DIR)/regint.h $(ONIG_DIR)/regenc.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(BUILD_DIR)/reggnu.obj: $(ONIG_DIR)/reggnu.c $(ONIG_DIR)/regint.h $(ONIG_DIR)/regenc.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(ONIG_DIR)/oniggnu.h $(BUILD_DIR)/regerror.obj: $(ONIG_DIR)/regerror.c $(ONIG_DIR)/regint.h $(ONIG_DIR)/regenc.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(BUILD_DIR)/regenc.obj: $(ONIG_DIR)/regenc.c $(ONIG_DIR)/regenc.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(BUILD_DIR)/regsyntax.obj: $(ONIG_DIR)/regsyntax.c $(ONIG_DIR)/regint.h $(ONIG_DIR)/regenc.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(BUILD_DIR)/regversion.obj: $(ONIG_DIR)/regversion.c $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(BUILD_DIR)/regposix.obj: $(ONIG_DIR)/regposix.c $(posixheaders) $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(BUILD_DIR)/regposerr.obj: $(ONIG_DIR)/regposerr.c $(posixheaders) $(BUILD_DIR)/config.h $(BUILD_DIR)/st.obj: $(ONIG_DIR)/st.c $(ONIG_DIR)/regint.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(ONIG_DIR)/st.h $(BUILD_DIR)/onig_init.obj: $(ONIG_DIR)/onig_init.c $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/ascii.obj: $(ONIG_DIR)/ascii.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/unicode.obj: $(ONIG_DIR)/unicode.c $(ONIG_DIR)/unicode_fold_data.c $(ONIG_DIR)/unicode_property_data.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/utf8.obj: $(ONIG_DIR)/utf8.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/utf16_be.obj: $(ONIG_DIR)/utf16_be.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/utf16_le.obj: $(ONIG_DIR)/utf16_le.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/utf32_be.obj: $(ONIG_DIR)/utf32_be.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/utf32_le.obj: $(ONIG_DIR)/utf32_le.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/euc_jp.obj: $(ONIG_DIR)/euc_jp.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/euc_tw.obj: $(ONIG_DIR)/euc_tw.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/euc_kr.obj: $(ONIG_DIR)/euc_kr.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/sjis.obj: $(ONIG_DIR)/sjis.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_1.obj: $(ONIG_DIR)/iso8859_1.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_2.obj: $(ONIG_DIR)/iso8859_2.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_3.obj: $(ONIG_DIR)/iso8859_3.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_4.obj: $(ONIG_DIR)/iso8859_4.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_5.obj: $(ONIG_DIR)/iso8859_5.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_6.obj: $(ONIG_DIR)/iso8859_6.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_7.obj: $(ONIG_DIR)/iso8859_7.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_8.obj: $(ONIG_DIR)/iso8859_8.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_9.obj: $(ONIG_DIR)/iso8859_9.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_10.obj: $(ONIG_DIR)/iso8859_10.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_11.obj: $(ONIG_DIR)/iso8859_11.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_13.obj: $(ONIG_DIR)/iso8859_13.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_14.obj: $(ONIG_DIR)/iso8859_14.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_15.obj: $(ONIG_DIR)/iso8859_15.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/iso8859_16.obj: $(ONIG_DIR)/iso8859_16.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/koi8.obj: $(ONIG_DIR)/koi8.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/koi8_r.obj: $(ONIG_DIR)/koi8_r.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/cp1251.obj: $(ONIG_DIR)/cp1251.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/big5.obj: $(ONIG_DIR)/big5.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/gb18030.obj: $(ONIG_DIR)/gb18030.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/euc_jp_prop.obj: $(ONIG_DIR)/euc_jp_prop.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/sjis_prop.obj: $(ONIG_DIR)/sjis_prop.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/unicode_unfold_key.obj: $(ONIG_DIR)/unicode_unfold_key.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/unicode_fold1_key.obj: $(ONIG_DIR)/unicode_fold1_key.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/unicode_fold2_key.obj: $(ONIG_DIR)/unicode_fold2_key.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h $(BUILD_DIR)/unicode_fold3_key.obj: $(ONIG_DIR)/unicode_fold3_key.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h all-test: test_syntax test_regset test_utf8 test_options test_back testc testp testu test_syntax: $(TEST_DIR)/test_syntax.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_syntax.c $(libname) test_regset: $(TEST_DIR)/test_regset.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_regset.c $(libname) test_utf8: $(TEST_DIR)/test_utf8.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_utf8.c $(libname) test_options: $(TEST_DIR)/test_options.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_options.c $(libname) test_back: $(TEST_DIR)/test_back.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_back.c $(libname) testc: $(WIN_DIR)/testc.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern $(WIN_DIR)/testc.c $(libname) testp: $(WIN_DIR)/testc.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /DPOSIX_TEST $(WIN_DIR)/testc.c $(libname) testu: $(TEST_DIR)/testu.c $(libname) $(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern $(TEST_DIR)/testu.c $(libname) clean: del $(BUILD_DIR)\*.obj $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.exp $(BUILD_DIR)\*.dll $(BUILD_DIR)\test_regset.exe $(BUILD_DIR)\test_syntax.exe $(BUILD_DIR)\test_utf8.exe $(BUILD_DIR)\test_options.exe $(BUILD_DIR)\test_back.exe $(BUILD_DIR)\testp.exe $(BUILD_DIR)\testc.exe $(BUILD_DIR)\testu.exe samples: all $(CC) $(SAMPLE_CFLAGS) /Fe:simple $(SAMPLE_DIR)\simple.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:posix $(SAMPLE_DIR)\posix.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:names $(SAMPLE_DIR)\names.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:listcap $(SAMPLE_DIR)\listcap.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:sql $(SAMPLE_DIR)\sql.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:encode $(SAMPLE_DIR)\encode.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:syntax $(SAMPLE_DIR)\syntax.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:count $(SAMPLE_DIR)\count.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:regset $(SAMPLE_DIR)\regset.c $(dlllib) $(CC) $(SAMPLE_CFLAGS) /Fe:callback_each_match $(SAMPLE_DIR)\callback_each_match.c $(dlllib) jq-1.8.2/vendor/oniguruma/src/iso8859_8.c0000644000175100017510000001131315215513537013442 /********************************************************************** iso8859_8.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_IS_ISO_8859_8_CTYPE(code,ctype) \ ((EncISO_8859_8_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const unsigned short EncISO_8859_8_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x0000, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0, 0x00a0, 0x10a0, 0x00a0, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01a0, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_8_CTYPE(code, ctype); else return FALSE; } OnigEncodingType OnigEncodingISO_8859_8 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-8", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, onigenc_ascii_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/unicode_fold_data.c0000644000175100017510000033361215215513537015517 /* This file was generated by make_unicode_fold_data.py. */ /*- * Copyright (c) 2017-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define UNICODE_CASEFOLD_VERSION 160000 OnigCodePoint OnigUnicodeFolds1[] = { /* 0*/ 0x0061, 1, 0x0041, /* LATIN CAPITAL LETTER A */ /* 3*/ 0x0062, 1, 0x0042, /* LATIN CAPITAL LETTER B */ /* 6*/ 0x0063, 1, 0x0043, /* LATIN CAPITAL LETTER C */ /* 9*/ 0x0064, 1, 0x0044, /* LATIN CAPITAL LETTER D */ /* 12*/ 0x0065, 1, 0x0045, /* LATIN CAPITAL LETTER E */ /* 15*/ 0x0066, 1, 0x0046, /* LATIN CAPITAL LETTER F */ /* 18*/ 0x0067, 1, 0x0047, /* LATIN CAPITAL LETTER G */ /* 21*/ 0x0068, 1, 0x0048, /* LATIN CAPITAL LETTER H */ /* 24*/ 0x006a, 1, 0x004a, /* LATIN CAPITAL LETTER J */ /* 27*/ 0x006b, 2, 0x004b, 0x212a, /* LATIN CAPITAL LETTER K */ /* 31*/ 0x006c, 1, 0x004c, /* LATIN CAPITAL LETTER L */ /* 34*/ 0x006d, 1, 0x004d, /* LATIN CAPITAL LETTER M */ /* 37*/ 0x006e, 1, 0x004e, /* LATIN CAPITAL LETTER N */ /* 40*/ 0x006f, 1, 0x004f, /* LATIN CAPITAL LETTER O */ /* 43*/ 0x0070, 1, 0x0050, /* LATIN CAPITAL LETTER P */ /* 46*/ 0x0071, 1, 0x0051, /* LATIN CAPITAL LETTER Q */ /* 49*/ 0x0072, 1, 0x0052, /* LATIN CAPITAL LETTER R */ /* 52*/ 0x0073, 2, 0x0053, 0x017f, /* LATIN CAPITAL LETTER S */ /* 56*/ 0x0074, 1, 0x0054, /* LATIN CAPITAL LETTER T */ /* 59*/ 0x0075, 1, 0x0055, /* LATIN CAPITAL LETTER U */ /* 62*/ 0x0076, 1, 0x0056, /* LATIN CAPITAL LETTER V */ /* 65*/ 0x0077, 1, 0x0057, /* LATIN CAPITAL LETTER W */ /* 68*/ 0x0078, 1, 0x0058, /* LATIN CAPITAL LETTER X */ /* 71*/ 0x0079, 1, 0x0059, /* LATIN CAPITAL LETTER Y */ /* 74*/ 0x007a, 1, 0x005a, /* LATIN CAPITAL LETTER Z */ /* 77*/ 0x00e0, 1, 0x00c0, /* LATIN CAPITAL LETTER A WITH GRAVE */ /* 80*/ 0x00e1, 1, 0x00c1, /* LATIN CAPITAL LETTER A WITH ACUTE */ /* 83*/ 0x00e2, 1, 0x00c2, /* LATIN CAPITAL LETTER A WITH CIRCU.. */ /* 86*/ 0x00e3, 1, 0x00c3, /* LATIN CAPITAL LETTER A WITH TILDE */ /* 89*/ 0x00e4, 1, 0x00c4, /* LATIN CAPITAL LETTER A WITH DIAER.. */ /* 92*/ 0x00e5, 2, 0x00c5, 0x212b, /* LATIN CAPITAL LETTER A WITH RING .. */ /* 96*/ 0x00e6, 1, 0x00c6, /* LATIN CAPITAL LETTER AE */ /* 99*/ 0x00e7, 1, 0x00c7, /* LATIN CAPITAL LETTER C WITH CEDIL.. */ /* 102*/ 0x00e8, 1, 0x00c8, /* LATIN CAPITAL LETTER E WITH GRAVE */ /* 105*/ 0x00e9, 1, 0x00c9, /* LATIN CAPITAL LETTER E WITH ACUTE */ /* 108*/ 0x00ea, 1, 0x00ca, /* LATIN CAPITAL LETTER E WITH CIRCU.. */ /* 111*/ 0x00eb, 1, 0x00cb, /* LATIN CAPITAL LETTER E WITH DIAER.. */ /* 114*/ 0x00ec, 1, 0x00cc, /* LATIN CAPITAL LETTER I WITH GRAVE */ /* 117*/ 0x00ed, 1, 0x00cd, /* LATIN CAPITAL LETTER I WITH ACUTE */ /* 120*/ 0x00ee, 1, 0x00ce, /* LATIN CAPITAL LETTER I WITH CIRCU.. */ /* 123*/ 0x00ef, 1, 0x00cf, /* LATIN CAPITAL LETTER I WITH DIAER.. */ /* 126*/ 0x00f0, 1, 0x00d0, /* LATIN CAPITAL LETTER ETH */ /* 129*/ 0x00f1, 1, 0x00d1, /* LATIN CAPITAL LETTER N WITH TILDE */ /* 132*/ 0x00f2, 1, 0x00d2, /* LATIN CAPITAL LETTER O WITH GRAVE */ /* 135*/ 0x00f3, 1, 0x00d3, /* LATIN CAPITAL LETTER O WITH ACUTE */ /* 138*/ 0x00f4, 1, 0x00d4, /* LATIN CAPITAL LETTER O WITH CIRCU.. */ /* 141*/ 0x00f5, 1, 0x00d5, /* LATIN CAPITAL LETTER O WITH TILDE */ /* 144*/ 0x00f6, 1, 0x00d6, /* LATIN CAPITAL LETTER O WITH DIAER.. */ /* 147*/ 0x00f8, 1, 0x00d8, /* LATIN CAPITAL LETTER O WITH STROKE */ /* 150*/ 0x00f9, 1, 0x00d9, /* LATIN CAPITAL LETTER U WITH GRAVE */ /* 153*/ 0x00fa, 1, 0x00da, /* LATIN CAPITAL LETTER U WITH ACUTE */ /* 156*/ 0x00fb, 1, 0x00db, /* LATIN CAPITAL LETTER U WITH CIRCU.. */ /* 159*/ 0x00fc, 1, 0x00dc, /* LATIN CAPITAL LETTER U WITH DIAER.. */ /* 162*/ 0x00fd, 1, 0x00dd, /* LATIN CAPITAL LETTER Y WITH ACUTE */ /* 165*/ 0x00fe, 1, 0x00de, /* LATIN CAPITAL LETTER THORN */ /* 168*/ 0x00ff, 1, 0x0178, /* LATIN CAPITAL LETTER Y WITH DIAER.. */ /* 171*/ 0x0101, 1, 0x0100, /* LATIN CAPITAL LETTER A WITH MACRON */ /* 174*/ 0x0103, 1, 0x0102, /* LATIN CAPITAL LETTER A WITH BREVE */ /* 177*/ 0x0105, 1, 0x0104, /* LATIN CAPITAL LETTER A WITH OGONEK */ /* 180*/ 0x0107, 1, 0x0106, /* LATIN CAPITAL LETTER C WITH ACUTE */ /* 183*/ 0x0109, 1, 0x0108, /* LATIN CAPITAL LETTER C WITH CIRCU.. */ /* 186*/ 0x010b, 1, 0x010a, /* LATIN CAPITAL LETTER C WITH DOT A.. */ /* 189*/ 0x010d, 1, 0x010c, /* LATIN CAPITAL LETTER C WITH CARON */ /* 192*/ 0x010f, 1, 0x010e, /* LATIN CAPITAL LETTER D WITH CARON */ /* 195*/ 0x0111, 1, 0x0110, /* LATIN CAPITAL LETTER D WITH STROKE */ /* 198*/ 0x0113, 1, 0x0112, /* LATIN CAPITAL LETTER E WITH MACRON */ /* 201*/ 0x0115, 1, 0x0114, /* LATIN CAPITAL LETTER E WITH BREVE */ /* 204*/ 0x0117, 1, 0x0116, /* LATIN CAPITAL LETTER E WITH DOT A.. */ /* 207*/ 0x0119, 1, 0x0118, /* LATIN CAPITAL LETTER E WITH OGONEK */ /* 210*/ 0x011b, 1, 0x011a, /* LATIN CAPITAL LETTER E WITH CARON */ /* 213*/ 0x011d, 1, 0x011c, /* LATIN CAPITAL LETTER G WITH CIRCU.. */ /* 216*/ 0x011f, 1, 0x011e, /* LATIN CAPITAL LETTER G WITH BREVE */ /* 219*/ 0x0121, 1, 0x0120, /* LATIN CAPITAL LETTER G WITH DOT A.. */ /* 222*/ 0x0123, 1, 0x0122, /* LATIN CAPITAL LETTER G WITH CEDIL.. */ /* 225*/ 0x0125, 1, 0x0124, /* LATIN CAPITAL LETTER H WITH CIRCU.. */ /* 228*/ 0x0127, 1, 0x0126, /* LATIN CAPITAL LETTER H WITH STROKE */ /* 231*/ 0x0129, 1, 0x0128, /* LATIN CAPITAL LETTER I WITH TILDE */ /* 234*/ 0x012b, 1, 0x012a, /* LATIN CAPITAL LETTER I WITH MACRON */ /* 237*/ 0x012d, 1, 0x012c, /* LATIN CAPITAL LETTER I WITH BREVE */ /* 240*/ 0x012f, 1, 0x012e, /* LATIN CAPITAL LETTER I WITH OGONEK */ /* 243*/ 0x0133, 1, 0x0132, /* LATIN CAPITAL LIGATURE IJ */ /* 246*/ 0x0135, 1, 0x0134, /* LATIN CAPITAL LETTER J WITH CIRCU.. */ /* 249*/ 0x0137, 1, 0x0136, /* LATIN CAPITAL LETTER K WITH CEDIL.. */ /* 252*/ 0x013a, 1, 0x0139, /* LATIN CAPITAL LETTER L WITH ACUTE */ /* 255*/ 0x013c, 1, 0x013b, /* LATIN CAPITAL LETTER L WITH CEDIL.. */ /* 258*/ 0x013e, 1, 0x013d, /* LATIN CAPITAL LETTER L WITH CARON */ /* 261*/ 0x0140, 1, 0x013f, /* LATIN CAPITAL LETTER L WITH MIDDL.. */ /* 264*/ 0x0142, 1, 0x0141, /* LATIN CAPITAL LETTER L WITH STROKE */ /* 267*/ 0x0144, 1, 0x0143, /* LATIN CAPITAL LETTER N WITH ACUTE */ /* 270*/ 0x0146, 1, 0x0145, /* LATIN CAPITAL LETTER N WITH CEDIL.. */ /* 273*/ 0x0148, 1, 0x0147, /* LATIN CAPITAL LETTER N WITH CARON */ /* 276*/ 0x014b, 1, 0x014a, /* LATIN CAPITAL LETTER ENG */ /* 279*/ 0x014d, 1, 0x014c, /* LATIN CAPITAL LETTER O WITH MACRON */ /* 282*/ 0x014f, 1, 0x014e, /* LATIN CAPITAL LETTER O WITH BREVE */ /* 285*/ 0x0151, 1, 0x0150, /* LATIN CAPITAL LETTER O WITH DOUBL.. */ /* 288*/ 0x0153, 1, 0x0152, /* LATIN CAPITAL LIGATURE OE */ /* 291*/ 0x0155, 1, 0x0154, /* LATIN CAPITAL LETTER R WITH ACUTE */ /* 294*/ 0x0157, 1, 0x0156, /* LATIN CAPITAL LETTER R WITH CEDIL.. */ /* 297*/ 0x0159, 1, 0x0158, /* LATIN CAPITAL LETTER R WITH CARON */ /* 300*/ 0x015b, 1, 0x015a, /* LATIN CAPITAL LETTER S WITH ACUTE */ /* 303*/ 0x015d, 1, 0x015c, /* LATIN CAPITAL LETTER S WITH CIRCU.. */ /* 306*/ 0x015f, 1, 0x015e, /* LATIN CAPITAL LETTER S WITH CEDIL.. */ /* 309*/ 0x0161, 1, 0x0160, /* LATIN CAPITAL LETTER S WITH CARON */ /* 312*/ 0x0163, 1, 0x0162, /* LATIN CAPITAL LETTER T WITH CEDIL.. */ /* 315*/ 0x0165, 1, 0x0164, /* LATIN CAPITAL LETTER T WITH CARON */ /* 318*/ 0x0167, 1, 0x0166, /* LATIN CAPITAL LETTER T WITH STROKE */ /* 321*/ 0x0169, 1, 0x0168, /* LATIN CAPITAL LETTER U WITH TILDE */ /* 324*/ 0x016b, 1, 0x016a, /* LATIN CAPITAL LETTER U WITH MACRON */ /* 327*/ 0x016d, 1, 0x016c, /* LATIN CAPITAL LETTER U WITH BREVE */ /* 330*/ 0x016f, 1, 0x016e, /* LATIN CAPITAL LETTER U WITH RING .. */ /* 333*/ 0x0171, 1, 0x0170, /* LATIN CAPITAL LETTER U WITH DOUBL.. */ /* 336*/ 0x0173, 1, 0x0172, /* LATIN CAPITAL LETTER U WITH OGONEK */ /* 339*/ 0x0175, 1, 0x0174, /* LATIN CAPITAL LETTER W WITH CIRCU.. */ /* 342*/ 0x0177, 1, 0x0176, /* LATIN CAPITAL LETTER Y WITH CIRCU.. */ /* 345*/ 0x017a, 1, 0x0179, /* LATIN CAPITAL LETTER Z WITH ACUTE */ /* 348*/ 0x017c, 1, 0x017b, /* LATIN CAPITAL LETTER Z WITH DOT A.. */ /* 351*/ 0x017e, 1, 0x017d, /* LATIN CAPITAL LETTER Z WITH CARON */ /* 354*/ 0x0180, 1, 0x0243, /* LATIN CAPITAL LETTER B WITH STROKE */ /* 357*/ 0x0183, 1, 0x0182, /* LATIN CAPITAL LETTER B WITH TOPBAR */ /* 360*/ 0x0185, 1, 0x0184, /* LATIN CAPITAL LETTER TONE SIX */ /* 363*/ 0x0188, 1, 0x0187, /* LATIN CAPITAL LETTER C WITH HOOK */ /* 366*/ 0x018c, 1, 0x018b, /* LATIN CAPITAL LETTER D WITH TOPBAR */ /* 369*/ 0x0192, 1, 0x0191, /* LATIN CAPITAL LETTER F WITH HOOK */ /* 372*/ 0x0195, 1, 0x01f6, /* LATIN CAPITAL LETTER HWAIR */ /* 375*/ 0x0199, 1, 0x0198, /* LATIN CAPITAL LETTER K WITH HOOK */ /* 378*/ 0x019a, 1, 0x023d, /* LATIN CAPITAL LETTER L WITH BAR */ /* 381*/ 0x019b, 1, 0xa7dc, /* LATIN CAPITAL LETTER LAMBDA WITH .. */ /* 384*/ 0x019e, 1, 0x0220, /* LATIN CAPITAL LETTER N WITH LONG .. */ /* 387*/ 0x01a1, 1, 0x01a0, /* LATIN CAPITAL LETTER O WITH HORN */ /* 390*/ 0x01a3, 1, 0x01a2, /* LATIN CAPITAL LETTER OI */ /* 393*/ 0x01a5, 1, 0x01a4, /* LATIN CAPITAL LETTER P WITH HOOK */ /* 396*/ 0x01a8, 1, 0x01a7, /* LATIN CAPITAL LETTER TONE TWO */ /* 399*/ 0x01ad, 1, 0x01ac, /* LATIN CAPITAL LETTER T WITH HOOK */ /* 402*/ 0x01b0, 1, 0x01af, /* LATIN CAPITAL LETTER U WITH HORN */ /* 405*/ 0x01b4, 1, 0x01b3, /* LATIN CAPITAL LETTER Y WITH HOOK */ /* 408*/ 0x01b6, 1, 0x01b5, /* LATIN CAPITAL LETTER Z WITH STROKE */ /* 411*/ 0x01b9, 1, 0x01b8, /* LATIN CAPITAL LETTER EZH REVERSED */ /* 414*/ 0x01bd, 1, 0x01bc, /* LATIN CAPITAL LETTER TONE FIVE */ /* 417*/ 0x01bf, 1, 0x01f7, /* LATIN CAPITAL LETTER WYNN */ /* 420*/ 0x01c6, 2, 0x01c4, 0x01c5, /* LATIN CAPITAL LETTER DZ WITH CARON */ /* 424*/ 0x01c9, 2, 0x01c7, 0x01c8, /* LATIN CAPITAL LETTER LJ */ /* 428*/ 0x01cc, 2, 0x01ca, 0x01cb, /* LATIN CAPITAL LETTER NJ */ /* 432*/ 0x01ce, 1, 0x01cd, /* LATIN CAPITAL LETTER A WITH CARON */ /* 435*/ 0x01d0, 1, 0x01cf, /* LATIN CAPITAL LETTER I WITH CARON */ /* 438*/ 0x01d2, 1, 0x01d1, /* LATIN CAPITAL LETTER O WITH CARON */ /* 441*/ 0x01d4, 1, 0x01d3, /* LATIN CAPITAL LETTER U WITH CARON */ /* 444*/ 0x01d6, 1, 0x01d5, /* LATIN CAPITAL LETTER U WITH DIAER.. */ /* 447*/ 0x01d8, 1, 0x01d7, /* LATIN CAPITAL LETTER U WITH DIAER.. */ /* 450*/ 0x01da, 1, 0x01d9, /* LATIN CAPITAL LETTER U WITH DIAER.. */ /* 453*/ 0x01dc, 1, 0x01db, /* LATIN CAPITAL LETTER U WITH DIAER.. */ /* 456*/ 0x01dd, 1, 0x018e, /* LATIN CAPITAL LETTER REVERSED E */ /* 459*/ 0x01df, 1, 0x01de, /* LATIN CAPITAL LETTER A WITH DIAER.. */ /* 462*/ 0x01e1, 1, 0x01e0, /* LATIN CAPITAL LETTER A WITH DOT A.. */ /* 465*/ 0x01e3, 1, 0x01e2, /* LATIN CAPITAL LETTER AE WITH MACR.. */ /* 468*/ 0x01e5, 1, 0x01e4, /* LATIN CAPITAL LETTER G WITH STROKE */ /* 471*/ 0x01e7, 1, 0x01e6, /* LATIN CAPITAL LETTER G WITH CARON */ /* 474*/ 0x01e9, 1, 0x01e8, /* LATIN CAPITAL LETTER K WITH CARON */ /* 477*/ 0x01eb, 1, 0x01ea, /* LATIN CAPITAL LETTER O WITH OGONEK */ /* 480*/ 0x01ed, 1, 0x01ec, /* LATIN CAPITAL LETTER O WITH OGONE.. */ /* 483*/ 0x01ef, 1, 0x01ee, /* LATIN CAPITAL LETTER EZH WITH CAR.. */ /* 486*/ 0x01f3, 2, 0x01f1, 0x01f2, /* LATIN CAPITAL LETTER DZ */ /* 490*/ 0x01f5, 1, 0x01f4, /* LATIN CAPITAL LETTER G WITH ACUTE */ /* 493*/ 0x01f9, 1, 0x01f8, /* LATIN CAPITAL LETTER N WITH GRAVE */ /* 496*/ 0x01fb, 1, 0x01fa, /* LATIN CAPITAL LETTER A WITH RING .. */ /* 499*/ 0x01fd, 1, 0x01fc, /* LATIN CAPITAL LETTER AE WITH ACUTE */ /* 502*/ 0x01ff, 1, 0x01fe, /* LATIN CAPITAL LETTER O WITH STROK.. */ /* 505*/ 0x0201, 1, 0x0200, /* LATIN CAPITAL LETTER A WITH DOUBL.. */ /* 508*/ 0x0203, 1, 0x0202, /* LATIN CAPITAL LETTER A WITH INVER.. */ /* 511*/ 0x0205, 1, 0x0204, /* LATIN CAPITAL LETTER E WITH DOUBL.. */ /* 514*/ 0x0207, 1, 0x0206, /* LATIN CAPITAL LETTER E WITH INVER.. */ /* 517*/ 0x0209, 1, 0x0208, /* LATIN CAPITAL LETTER I WITH DOUBL.. */ /* 520*/ 0x020b, 1, 0x020a, /* LATIN CAPITAL LETTER I WITH INVER.. */ /* 523*/ 0x020d, 1, 0x020c, /* LATIN CAPITAL LETTER O WITH DOUBL.. */ /* 526*/ 0x020f, 1, 0x020e, /* LATIN CAPITAL LETTER O WITH INVER.. */ /* 529*/ 0x0211, 1, 0x0210, /* LATIN CAPITAL LETTER R WITH DOUBL.. */ /* 532*/ 0x0213, 1, 0x0212, /* LATIN CAPITAL LETTER R WITH INVER.. */ /* 535*/ 0x0215, 1, 0x0214, /* LATIN CAPITAL LETTER U WITH DOUBL.. */ /* 538*/ 0x0217, 1, 0x0216, /* LATIN CAPITAL LETTER U WITH INVER.. */ /* 541*/ 0x0219, 1, 0x0218, /* LATIN CAPITAL LETTER S WITH COMMA.. */ /* 544*/ 0x021b, 1, 0x021a, /* LATIN CAPITAL LETTER T WITH COMMA.. */ /* 547*/ 0x021d, 1, 0x021c, /* LATIN CAPITAL LETTER YOGH */ /* 550*/ 0x021f, 1, 0x021e, /* LATIN CAPITAL LETTER H WITH CARON */ /* 553*/ 0x0223, 1, 0x0222, /* LATIN CAPITAL LETTER OU */ /* 556*/ 0x0225, 1, 0x0224, /* LATIN CAPITAL LETTER Z WITH HOOK */ /* 559*/ 0x0227, 1, 0x0226, /* LATIN CAPITAL LETTER A WITH DOT A.. */ /* 562*/ 0x0229, 1, 0x0228, /* LATIN CAPITAL LETTER E WITH CEDIL.. */ /* 565*/ 0x022b, 1, 0x022a, /* LATIN CAPITAL LETTER O WITH DIAER.. */ /* 568*/ 0x022d, 1, 0x022c, /* LATIN CAPITAL LETTER O WITH TILDE.. */ /* 571*/ 0x022f, 1, 0x022e, /* LATIN CAPITAL LETTER O WITH DOT A.. */ /* 574*/ 0x0231, 1, 0x0230, /* LATIN CAPITAL LETTER O WITH DOT A.. */ /* 577*/ 0x0233, 1, 0x0232, /* LATIN CAPITAL LETTER Y WITH MACRON */ /* 580*/ 0x023c, 1, 0x023b, /* LATIN CAPITAL LETTER C WITH STROKE */ /* 583*/ 0x023f, 1, 0x2c7e, /* LATIN CAPITAL LETTER S WITH SWASH.. */ /* 586*/ 0x0240, 1, 0x2c7f, /* LATIN CAPITAL LETTER Z WITH SWASH.. */ /* 589*/ 0x0242, 1, 0x0241, /* LATIN CAPITAL LETTER GLOTTAL STOP */ /* 592*/ 0x0247, 1, 0x0246, /* LATIN CAPITAL LETTER E WITH STROKE */ /* 595*/ 0x0249, 1, 0x0248, /* LATIN CAPITAL LETTER J WITH STROKE */ /* 598*/ 0x024b, 1, 0x024a, /* LATIN CAPITAL LETTER SMALL Q WITH.. */ /* 601*/ 0x024d, 1, 0x024c, /* LATIN CAPITAL LETTER R WITH STROKE */ /* 604*/ 0x024f, 1, 0x024e, /* LATIN CAPITAL LETTER Y WITH STROKE */ /* 607*/ 0x0250, 1, 0x2c6f, /* LATIN CAPITAL LETTER TURNED A */ /* 610*/ 0x0251, 1, 0x2c6d, /* LATIN CAPITAL LETTER ALPHA */ /* 613*/ 0x0252, 1, 0x2c70, /* LATIN CAPITAL LETTER TURNED ALPHA */ /* 616*/ 0x0253, 1, 0x0181, /* LATIN CAPITAL LETTER B WITH HOOK */ /* 619*/ 0x0254, 1, 0x0186, /* LATIN CAPITAL LETTER OPEN O */ /* 622*/ 0x0256, 1, 0x0189, /* LATIN CAPITAL LETTER AFRICAN D */ /* 625*/ 0x0257, 1, 0x018a, /* LATIN CAPITAL LETTER D WITH HOOK */ /* 628*/ 0x0259, 1, 0x018f, /* LATIN CAPITAL LETTER SCHWA */ /* 631*/ 0x025b, 1, 0x0190, /* LATIN CAPITAL LETTER OPEN E */ /* 634*/ 0x025c, 1, 0xa7ab, /* LATIN CAPITAL LETTER REVERSED OPE.. */ /* 637*/ 0x0260, 1, 0x0193, /* LATIN CAPITAL LETTER G WITH HOOK */ /* 640*/ 0x0261, 1, 0xa7ac, /* LATIN CAPITAL LETTER SCRIPT G */ /* 643*/ 0x0263, 1, 0x0194, /* LATIN CAPITAL LETTER GAMMA */ /* 646*/ 0x0264, 1, 0xa7cb, /* LATIN CAPITAL LETTER RAMS HORN */ /* 649*/ 0x0265, 1, 0xa78d, /* LATIN CAPITAL LETTER TURNED H */ /* 652*/ 0x0266, 1, 0xa7aa, /* LATIN CAPITAL LETTER H WITH HOOK */ /* 655*/ 0x0268, 1, 0x0197, /* LATIN CAPITAL LETTER I WITH STROKE */ /* 658*/ 0x0269, 1, 0x0196, /* LATIN CAPITAL LETTER IOTA */ /* 661*/ 0x026a, 1, 0xa7ae, /* LATIN CAPITAL LETTER SMALL CAPITA.. */ /* 664*/ 0x026b, 1, 0x2c62, /* LATIN CAPITAL LETTER L WITH MIDDL.. */ /* 667*/ 0x026c, 1, 0xa7ad, /* LATIN CAPITAL LETTER L WITH BELT */ /* 670*/ 0x026f, 1, 0x019c, /* LATIN CAPITAL LETTER TURNED M */ /* 673*/ 0x0271, 1, 0x2c6e, /* LATIN CAPITAL LETTER M WITH HOOK */ /* 676*/ 0x0272, 1, 0x019d, /* LATIN CAPITAL LETTER N WITH LEFT .. */ /* 679*/ 0x0275, 1, 0x019f, /* LATIN CAPITAL LETTER O WITH MIDDL.. */ /* 682*/ 0x027d, 1, 0x2c64, /* LATIN CAPITAL LETTER R WITH TAIL */ /* 685*/ 0x0280, 1, 0x01a6, /* LATIN LETTER YR */ /* 688*/ 0x0282, 1, 0xa7c5, /* LATIN CAPITAL LETTER S WITH HOOK */ /* 691*/ 0x0283, 1, 0x01a9, /* LATIN CAPITAL LETTER ESH */ /* 694*/ 0x0287, 1, 0xa7b1, /* LATIN CAPITAL LETTER TURNED T */ /* 697*/ 0x0288, 1, 0x01ae, /* LATIN CAPITAL LETTER T WITH RETRO.. */ /* 700*/ 0x0289, 1, 0x0244, /* LATIN CAPITAL LETTER U BAR */ /* 703*/ 0x028a, 1, 0x01b1, /* LATIN CAPITAL LETTER UPSILON */ /* 706*/ 0x028b, 1, 0x01b2, /* LATIN CAPITAL LETTER V WITH HOOK */ /* 709*/ 0x028c, 1, 0x0245, /* LATIN CAPITAL LETTER TURNED V */ /* 712*/ 0x0292, 1, 0x01b7, /* LATIN CAPITAL LETTER EZH */ /* 715*/ 0x029d, 1, 0xa7b2, /* LATIN CAPITAL LETTER J WITH CROSS.. */ /* 718*/ 0x029e, 1, 0xa7b0, /* LATIN CAPITAL LETTER TURNED K */ /* 721*/ 0x0371, 1, 0x0370, /* GREEK CAPITAL LETTER HETA */ /* 724*/ 0x0373, 1, 0x0372, /* GREEK CAPITAL LETTER ARCHAIC SAMPI */ /* 727*/ 0x0377, 1, 0x0376, /* GREEK CAPITAL LETTER PAMPHYLIAN D.. */ /* 730*/ 0x037b, 1, 0x03fd, /* GREEK CAPITAL REVERSED LUNATE SIG.. */ /* 733*/ 0x037c, 1, 0x03fe, /* GREEK CAPITAL DOTTED LUNATE SIGMA.. */ /* 736*/ 0x037d, 1, 0x03ff, /* GREEK CAPITAL REVERSED DOTTED LUN.. */ /* 739*/ 0x03ac, 1, 0x0386, /* GREEK CAPITAL LETTER ALPHA WITH T.. */ /* 742*/ 0x03ad, 1, 0x0388, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /* 745*/ 0x03ae, 1, 0x0389, /* GREEK CAPITAL LETTER ETA WITH TON.. */ /* 748*/ 0x03af, 1, 0x038a, /* GREEK CAPITAL LETTER IOTA WITH TO.. */ /* 751*/ 0x03b1, 1, 0x0391, /* GREEK CAPITAL LETTER ALPHA */ /* 754*/ 0x03b2, 2, 0x0392, 0x03d0, /* GREEK CAPITAL LETTER BETA */ /* 758*/ 0x03b3, 1, 0x0393, /* GREEK CAPITAL LETTER GAMMA */ /* 761*/ 0x03b4, 1, 0x0394, /* GREEK CAPITAL LETTER DELTA */ /* 764*/ 0x03b5, 2, 0x0395, 0x03f5, /* GREEK CAPITAL LETTER EPSILON */ /* 768*/ 0x03b6, 1, 0x0396, /* GREEK CAPITAL LETTER ZETA */ /* 771*/ 0x03b7, 1, 0x0397, /* GREEK CAPITAL LETTER ETA */ /* 774*/ 0x03b8, 3, 0x0398, 0x03d1, 0x03f4, /* GREEK CAPITAL LETTER THETA */ /* 779*/ 0x03b9, 3, 0x0345, 0x0399, 0x1fbe, /* COMBINING GREEK YPOGEGRAMMENI */ /* 784*/ 0x03ba, 2, 0x039a, 0x03f0, /* GREEK CAPITAL LETTER KAPPA */ /* 788*/ 0x03bb, 1, 0x039b, /* GREEK CAPITAL LETTER LAMDA */ /* 791*/ 0x03bc, 2, 0x00b5, 0x039c, /* MICRO SIGN */ /* 795*/ 0x03bd, 1, 0x039d, /* GREEK CAPITAL LETTER NU */ /* 798*/ 0x03be, 1, 0x039e, /* GREEK CAPITAL LETTER XI */ /* 801*/ 0x03bf, 1, 0x039f, /* GREEK CAPITAL LETTER OMICRON */ /* 804*/ 0x03c0, 2, 0x03a0, 0x03d6, /* GREEK CAPITAL LETTER PI */ /* 808*/ 0x03c1, 2, 0x03a1, 0x03f1, /* GREEK CAPITAL LETTER RHO */ /* 812*/ 0x03c3, 2, 0x03a3, 0x03c2, /* GREEK CAPITAL LETTER SIGMA */ /* 816*/ 0x03c4, 1, 0x03a4, /* GREEK CAPITAL LETTER TAU */ /* 819*/ 0x03c5, 1, 0x03a5, /* GREEK CAPITAL LETTER UPSILON */ /* 822*/ 0x03c6, 2, 0x03a6, 0x03d5, /* GREEK CAPITAL LETTER PHI */ /* 826*/ 0x03c7, 1, 0x03a7, /* GREEK CAPITAL LETTER CHI */ /* 829*/ 0x03c8, 1, 0x03a8, /* GREEK CAPITAL LETTER PSI */ /* 832*/ 0x03c9, 2, 0x03a9, 0x2126, /* GREEK CAPITAL LETTER OMEGA */ /* 836*/ 0x03ca, 1, 0x03aa, /* GREEK CAPITAL LETTER IOTA WITH DI.. */ /* 839*/ 0x03cb, 1, 0x03ab, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /* 842*/ 0x03cc, 1, 0x038c, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /* 845*/ 0x03cd, 1, 0x038e, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /* 848*/ 0x03ce, 1, 0x038f, /* GREEK CAPITAL LETTER OMEGA WITH T.. */ /* 851*/ 0x03d7, 1, 0x03cf, /* GREEK CAPITAL KAI SYMBOL */ /* 854*/ 0x03d9, 1, 0x03d8, /* GREEK LETTER ARCHAIC KOPPA */ /* 857*/ 0x03db, 1, 0x03da, /* GREEK LETTER STIGMA */ /* 860*/ 0x03dd, 1, 0x03dc, /* GREEK LETTER DIGAMMA */ /* 863*/ 0x03df, 1, 0x03de, /* GREEK LETTER KOPPA */ /* 866*/ 0x03e1, 1, 0x03e0, /* GREEK LETTER SAMPI */ /* 869*/ 0x03e3, 1, 0x03e2, /* COPTIC CAPITAL LETTER SHEI */ /* 872*/ 0x03e5, 1, 0x03e4, /* COPTIC CAPITAL LETTER FEI */ /* 875*/ 0x03e7, 1, 0x03e6, /* COPTIC CAPITAL LETTER KHEI */ /* 878*/ 0x03e9, 1, 0x03e8, /* COPTIC CAPITAL LETTER HORI */ /* 881*/ 0x03eb, 1, 0x03ea, /* COPTIC CAPITAL LETTER GANGIA */ /* 884*/ 0x03ed, 1, 0x03ec, /* COPTIC CAPITAL LETTER SHIMA */ /* 887*/ 0x03ef, 1, 0x03ee, /* COPTIC CAPITAL LETTER DEI */ /* 890*/ 0x03f2, 1, 0x03f9, /* GREEK CAPITAL LUNATE SIGMA SYMBOL */ /* 893*/ 0x03f3, 1, 0x037f, /* GREEK CAPITAL LETTER YOT */ /* 896*/ 0x03f8, 1, 0x03f7, /* GREEK CAPITAL LETTER SHO */ /* 899*/ 0x03fb, 1, 0x03fa, /* GREEK CAPITAL LETTER SAN */ /* 902*/ 0x0430, 1, 0x0410, /* CYRILLIC CAPITAL LETTER A */ /* 905*/ 0x0431, 1, 0x0411, /* CYRILLIC CAPITAL LETTER BE */ /* 908*/ 0x0432, 2, 0x0412, 0x1c80, /* CYRILLIC CAPITAL LETTER VE */ /* 912*/ 0x0433, 1, 0x0413, /* CYRILLIC CAPITAL LETTER GHE */ /* 915*/ 0x0434, 2, 0x0414, 0x1c81, /* CYRILLIC CAPITAL LETTER DE */ /* 919*/ 0x0435, 1, 0x0415, /* CYRILLIC CAPITAL LETTER IE */ /* 922*/ 0x0436, 1, 0x0416, /* CYRILLIC CAPITAL LETTER ZHE */ /* 925*/ 0x0437, 1, 0x0417, /* CYRILLIC CAPITAL LETTER ZE */ /* 928*/ 0x0438, 1, 0x0418, /* CYRILLIC CAPITAL LETTER I */ /* 931*/ 0x0439, 1, 0x0419, /* CYRILLIC CAPITAL LETTER SHORT I */ /* 934*/ 0x043a, 1, 0x041a, /* CYRILLIC CAPITAL LETTER KA */ /* 937*/ 0x043b, 1, 0x041b, /* CYRILLIC CAPITAL LETTER EL */ /* 940*/ 0x043c, 1, 0x041c, /* CYRILLIC CAPITAL LETTER EM */ /* 943*/ 0x043d, 1, 0x041d, /* CYRILLIC CAPITAL LETTER EN */ /* 946*/ 0x043e, 2, 0x041e, 0x1c82, /* CYRILLIC CAPITAL LETTER O */ /* 950*/ 0x043f, 1, 0x041f, /* CYRILLIC CAPITAL LETTER PE */ /* 953*/ 0x0440, 1, 0x0420, /* CYRILLIC CAPITAL LETTER ER */ /* 956*/ 0x0441, 2, 0x0421, 0x1c83, /* CYRILLIC CAPITAL LETTER ES */ /* 960*/ 0x0442, 3, 0x0422, 0x1c84, 0x1c85, /* CYRILLIC CAPITAL LETTER TE */ /* 965*/ 0x0443, 1, 0x0423, /* CYRILLIC CAPITAL LETTER U */ /* 968*/ 0x0444, 1, 0x0424, /* CYRILLIC CAPITAL LETTER EF */ /* 971*/ 0x0445, 1, 0x0425, /* CYRILLIC CAPITAL LETTER HA */ /* 974*/ 0x0446, 1, 0x0426, /* CYRILLIC CAPITAL LETTER TSE */ /* 977*/ 0x0447, 1, 0x0427, /* CYRILLIC CAPITAL LETTER CHE */ /* 980*/ 0x0448, 1, 0x0428, /* CYRILLIC CAPITAL LETTER SHA */ /* 983*/ 0x0449, 1, 0x0429, /* CYRILLIC CAPITAL LETTER SHCHA */ /* 986*/ 0x044a, 2, 0x042a, 0x1c86, /* CYRILLIC CAPITAL LETTER HARD SIGN */ /* 990*/ 0x044b, 1, 0x042b, /* CYRILLIC CAPITAL LETTER YERU */ /* 993*/ 0x044c, 1, 0x042c, /* CYRILLIC CAPITAL LETTER SOFT SIGN */ /* 996*/ 0x044d, 1, 0x042d, /* CYRILLIC CAPITAL LETTER E */ /* 999*/ 0x044e, 1, 0x042e, /* CYRILLIC CAPITAL LETTER YU */ /*1002*/ 0x044f, 1, 0x042f, /* CYRILLIC CAPITAL LETTER YA */ /*1005*/ 0x0450, 1, 0x0400, /* CYRILLIC CAPITAL LETTER IE WITH G.. */ /*1008*/ 0x0451, 1, 0x0401, /* CYRILLIC CAPITAL LETTER IO */ /*1011*/ 0x0452, 1, 0x0402, /* CYRILLIC CAPITAL LETTER DJE */ /*1014*/ 0x0453, 1, 0x0403, /* CYRILLIC CAPITAL LETTER GJE */ /*1017*/ 0x0454, 1, 0x0404, /* CYRILLIC CAPITAL LETTER UKRAINIAN.. */ /*1020*/ 0x0455, 1, 0x0405, /* CYRILLIC CAPITAL LETTER DZE */ /*1023*/ 0x0456, 1, 0x0406, /* CYRILLIC CAPITAL LETTER BYELORUSS.. */ /*1026*/ 0x0457, 1, 0x0407, /* CYRILLIC CAPITAL LETTER YI */ /*1029*/ 0x0458, 1, 0x0408, /* CYRILLIC CAPITAL LETTER JE */ /*1032*/ 0x0459, 1, 0x0409, /* CYRILLIC CAPITAL LETTER LJE */ /*1035*/ 0x045a, 1, 0x040a, /* CYRILLIC CAPITAL LETTER NJE */ /*1038*/ 0x045b, 1, 0x040b, /* CYRILLIC CAPITAL LETTER TSHE */ /*1041*/ 0x045c, 1, 0x040c, /* CYRILLIC CAPITAL LETTER KJE */ /*1044*/ 0x045d, 1, 0x040d, /* CYRILLIC CAPITAL LETTER I WITH GR.. */ /*1047*/ 0x045e, 1, 0x040e, /* CYRILLIC CAPITAL LETTER SHORT U */ /*1050*/ 0x045f, 1, 0x040f, /* CYRILLIC CAPITAL LETTER DZHE */ /*1053*/ 0x0461, 1, 0x0460, /* CYRILLIC CAPITAL LETTER OMEGA */ /*1056*/ 0x0463, 2, 0x0462, 0x1c87, /* CYRILLIC CAPITAL LETTER YAT */ /*1060*/ 0x0465, 1, 0x0464, /* CYRILLIC CAPITAL LETTER IOTIFIED E */ /*1063*/ 0x0467, 1, 0x0466, /* CYRILLIC CAPITAL LETTER LITTLE YUS */ /*1066*/ 0x0469, 1, 0x0468, /* CYRILLIC CAPITAL LETTER IOTIFIED .. */ /*1069*/ 0x046b, 1, 0x046a, /* CYRILLIC CAPITAL LETTER BIG YUS */ /*1072*/ 0x046d, 1, 0x046c, /* CYRILLIC CAPITAL LETTER IOTIFIED .. */ /*1075*/ 0x046f, 1, 0x046e, /* CYRILLIC CAPITAL LETTER KSI */ /*1078*/ 0x0471, 1, 0x0470, /* CYRILLIC CAPITAL LETTER PSI */ /*1081*/ 0x0473, 1, 0x0472, /* CYRILLIC CAPITAL LETTER FITA */ /*1084*/ 0x0475, 1, 0x0474, /* CYRILLIC CAPITAL LETTER IZHITSA */ /*1087*/ 0x0477, 1, 0x0476, /* CYRILLIC CAPITAL LETTER IZHITSA W.. */ /*1090*/ 0x0479, 1, 0x0478, /* CYRILLIC CAPITAL LETTER UK */ /*1093*/ 0x047b, 1, 0x047a, /* CYRILLIC CAPITAL LETTER ROUND OME.. */ /*1096*/ 0x047d, 1, 0x047c, /* CYRILLIC CAPITAL LETTER OMEGA WIT.. */ /*1099*/ 0x047f, 1, 0x047e, /* CYRILLIC CAPITAL LETTER OT */ /*1102*/ 0x0481, 1, 0x0480, /* CYRILLIC CAPITAL LETTER KOPPA */ /*1105*/ 0x048b, 1, 0x048a, /* CYRILLIC CAPITAL LETTER SHORT I W.. */ /*1108*/ 0x048d, 1, 0x048c, /* CYRILLIC CAPITAL LETTER SEMISOFT .. */ /*1111*/ 0x048f, 1, 0x048e, /* CYRILLIC CAPITAL LETTER ER WITH T.. */ /*1114*/ 0x0491, 1, 0x0490, /* CYRILLIC CAPITAL LETTER GHE WITH .. */ /*1117*/ 0x0493, 1, 0x0492, /* CYRILLIC CAPITAL LETTER GHE WITH .. */ /*1120*/ 0x0495, 1, 0x0494, /* CYRILLIC CAPITAL LETTER GHE WITH .. */ /*1123*/ 0x0497, 1, 0x0496, /* CYRILLIC CAPITAL LETTER ZHE WITH .. */ /*1126*/ 0x0499, 1, 0x0498, /* CYRILLIC CAPITAL LETTER ZE WITH D.. */ /*1129*/ 0x049b, 1, 0x049a, /* CYRILLIC CAPITAL LETTER KA WITH D.. */ /*1132*/ 0x049d, 1, 0x049c, /* CYRILLIC CAPITAL LETTER KA WITH V.. */ /*1135*/ 0x049f, 1, 0x049e, /* CYRILLIC CAPITAL LETTER KA WITH S.. */ /*1138*/ 0x04a1, 1, 0x04a0, /* CYRILLIC CAPITAL LETTER BASHKIR KA */ /*1141*/ 0x04a3, 1, 0x04a2, /* CYRILLIC CAPITAL LETTER EN WITH D.. */ /*1144*/ 0x04a5, 1, 0x04a4, /* CYRILLIC CAPITAL LIGATURE EN GHE */ /*1147*/ 0x04a7, 1, 0x04a6, /* CYRILLIC CAPITAL LETTER PE WITH M.. */ /*1150*/ 0x04a9, 1, 0x04a8, /* CYRILLIC CAPITAL LETTER ABKHASIAN.. */ /*1153*/ 0x04ab, 1, 0x04aa, /* CYRILLIC CAPITAL LETTER ES WITH D.. */ /*1156*/ 0x04ad, 1, 0x04ac, /* CYRILLIC CAPITAL LETTER TE WITH D.. */ /*1159*/ 0x04af, 1, 0x04ae, /* CYRILLIC CAPITAL LETTER STRAIGHT U */ /*1162*/ 0x04b1, 1, 0x04b0, /* CYRILLIC CAPITAL LETTER STRAIGHT .. */ /*1165*/ 0x04b3, 1, 0x04b2, /* CYRILLIC CAPITAL LETTER HA WITH D.. */ /*1168*/ 0x04b5, 1, 0x04b4, /* CYRILLIC CAPITAL LIGATURE TE TSE */ /*1171*/ 0x04b7, 1, 0x04b6, /* CYRILLIC CAPITAL LETTER CHE WITH .. */ /*1174*/ 0x04b9, 1, 0x04b8, /* CYRILLIC CAPITAL LETTER CHE WITH .. */ /*1177*/ 0x04bb, 1, 0x04ba, /* CYRILLIC CAPITAL LETTER SHHA */ /*1180*/ 0x04bd, 1, 0x04bc, /* CYRILLIC CAPITAL LETTER ABKHASIAN.. */ /*1183*/ 0x04bf, 1, 0x04be, /* CYRILLIC CAPITAL LETTER ABKHASIAN.. */ /*1186*/ 0x04c2, 1, 0x04c1, /* CYRILLIC CAPITAL LETTER ZHE WITH .. */ /*1189*/ 0x04c4, 1, 0x04c3, /* CYRILLIC CAPITAL LETTER KA WITH H.. */ /*1192*/ 0x04c6, 1, 0x04c5, /* CYRILLIC CAPITAL LETTER EL WITH T.. */ /*1195*/ 0x04c8, 1, 0x04c7, /* CYRILLIC CAPITAL LETTER EN WITH H.. */ /*1198*/ 0x04ca, 1, 0x04c9, /* CYRILLIC CAPITAL LETTER EN WITH T.. */ /*1201*/ 0x04cc, 1, 0x04cb, /* CYRILLIC CAPITAL LETTER KHAKASSIA.. */ /*1204*/ 0x04ce, 1, 0x04cd, /* CYRILLIC CAPITAL LETTER EM WITH T.. */ /*1207*/ 0x04cf, 1, 0x04c0, /* CYRILLIC LETTER PALOCHKA */ /*1210*/ 0x04d1, 1, 0x04d0, /* CYRILLIC CAPITAL LETTER A WITH BR.. */ /*1213*/ 0x04d3, 1, 0x04d2, /* CYRILLIC CAPITAL LETTER A WITH DI.. */ /*1216*/ 0x04d5, 1, 0x04d4, /* CYRILLIC CAPITAL LIGATURE A IE */ /*1219*/ 0x04d7, 1, 0x04d6, /* CYRILLIC CAPITAL LETTER IE WITH B.. */ /*1222*/ 0x04d9, 1, 0x04d8, /* CYRILLIC CAPITAL LETTER SCHWA */ /*1225*/ 0x04db, 1, 0x04da, /* CYRILLIC CAPITAL LETTER SCHWA WIT.. */ /*1228*/ 0x04dd, 1, 0x04dc, /* CYRILLIC CAPITAL LETTER ZHE WITH .. */ /*1231*/ 0x04df, 1, 0x04de, /* CYRILLIC CAPITAL LETTER ZE WITH D.. */ /*1234*/ 0x04e1, 1, 0x04e0, /* CYRILLIC CAPITAL LETTER ABKHASIAN.. */ /*1237*/ 0x04e3, 1, 0x04e2, /* CYRILLIC CAPITAL LETTER I WITH MA.. */ /*1240*/ 0x04e5, 1, 0x04e4, /* CYRILLIC CAPITAL LETTER I WITH DI.. */ /*1243*/ 0x04e7, 1, 0x04e6, /* CYRILLIC CAPITAL LETTER O WITH DI.. */ /*1246*/ 0x04e9, 1, 0x04e8, /* CYRILLIC CAPITAL LETTER BARRED O */ /*1249*/ 0x04eb, 1, 0x04ea, /* CYRILLIC CAPITAL LETTER BARRED O .. */ /*1252*/ 0x04ed, 1, 0x04ec, /* CYRILLIC CAPITAL LETTER E WITH DI.. */ /*1255*/ 0x04ef, 1, 0x04ee, /* CYRILLIC CAPITAL LETTER U WITH MA.. */ /*1258*/ 0x04f1, 1, 0x04f0, /* CYRILLIC CAPITAL LETTER U WITH DI.. */ /*1261*/ 0x04f3, 1, 0x04f2, /* CYRILLIC CAPITAL LETTER U WITH DO.. */ /*1264*/ 0x04f5, 1, 0x04f4, /* CYRILLIC CAPITAL LETTER CHE WITH .. */ /*1267*/ 0x04f7, 1, 0x04f6, /* CYRILLIC CAPITAL LETTER GHE WITH .. */ /*1270*/ 0x04f9, 1, 0x04f8, /* CYRILLIC CAPITAL LETTER YERU WITH.. */ /*1273*/ 0x04fb, 1, 0x04fa, /* CYRILLIC CAPITAL LETTER GHE WITH .. */ /*1276*/ 0x04fd, 1, 0x04fc, /* CYRILLIC CAPITAL LETTER HA WITH H.. */ /*1279*/ 0x04ff, 1, 0x04fe, /* CYRILLIC CAPITAL LETTER HA WITH S.. */ /*1282*/ 0x0501, 1, 0x0500, /* CYRILLIC CAPITAL LETTER KOMI DE */ /*1285*/ 0x0503, 1, 0x0502, /* CYRILLIC CAPITAL LETTER KOMI DJE */ /*1288*/ 0x0505, 1, 0x0504, /* CYRILLIC CAPITAL LETTER KOMI ZJE */ /*1291*/ 0x0507, 1, 0x0506, /* CYRILLIC CAPITAL LETTER KOMI DZJE */ /*1294*/ 0x0509, 1, 0x0508, /* CYRILLIC CAPITAL LETTER KOMI LJE */ /*1297*/ 0x050b, 1, 0x050a, /* CYRILLIC CAPITAL LETTER KOMI NJE */ /*1300*/ 0x050d, 1, 0x050c, /* CYRILLIC CAPITAL LETTER KOMI SJE */ /*1303*/ 0x050f, 1, 0x050e, /* CYRILLIC CAPITAL LETTER KOMI TJE */ /*1306*/ 0x0511, 1, 0x0510, /* CYRILLIC CAPITAL LETTER REVERSED .. */ /*1309*/ 0x0513, 1, 0x0512, /* CYRILLIC CAPITAL LETTER EL WITH H.. */ /*1312*/ 0x0515, 1, 0x0514, /* CYRILLIC CAPITAL LETTER LHA */ /*1315*/ 0x0517, 1, 0x0516, /* CYRILLIC CAPITAL LETTER RHA */ /*1318*/ 0x0519, 1, 0x0518, /* CYRILLIC CAPITAL LETTER YAE */ /*1321*/ 0x051b, 1, 0x051a, /* CYRILLIC CAPITAL LETTER QA */ /*1324*/ 0x051d, 1, 0x051c, /* CYRILLIC CAPITAL LETTER WE */ /*1327*/ 0x051f, 1, 0x051e, /* CYRILLIC CAPITAL LETTER ALEUT KA */ /*1330*/ 0x0521, 1, 0x0520, /* CYRILLIC CAPITAL LETTER EL WITH M.. */ /*1333*/ 0x0523, 1, 0x0522, /* CYRILLIC CAPITAL LETTER EN WITH M.. */ /*1336*/ 0x0525, 1, 0x0524, /* CYRILLIC CAPITAL LETTER PE WITH D.. */ /*1339*/ 0x0527, 1, 0x0526, /* CYRILLIC CAPITAL LETTER SHHA WITH.. */ /*1342*/ 0x0529, 1, 0x0528, /* CYRILLIC CAPITAL LETTER EN WITH L.. */ /*1345*/ 0x052b, 1, 0x052a, /* CYRILLIC CAPITAL LETTER DZZHE */ /*1348*/ 0x052d, 1, 0x052c, /* CYRILLIC CAPITAL LETTER DCHE */ /*1351*/ 0x052f, 1, 0x052e, /* CYRILLIC CAPITAL LETTER EL WITH D.. */ /*1354*/ 0x0561, 1, 0x0531, /* ARMENIAN CAPITAL LETTER AYB */ /*1357*/ 0x0562, 1, 0x0532, /* ARMENIAN CAPITAL LETTER BEN */ /*1360*/ 0x0563, 1, 0x0533, /* ARMENIAN CAPITAL LETTER GIM */ /*1363*/ 0x0564, 1, 0x0534, /* ARMENIAN CAPITAL LETTER DA */ /*1366*/ 0x0565, 1, 0x0535, /* ARMENIAN CAPITAL LETTER ECH */ /*1369*/ 0x0566, 1, 0x0536, /* ARMENIAN CAPITAL LETTER ZA */ /*1372*/ 0x0567, 1, 0x0537, /* ARMENIAN CAPITAL LETTER EH */ /*1375*/ 0x0568, 1, 0x0538, /* ARMENIAN CAPITAL LETTER ET */ /*1378*/ 0x0569, 1, 0x0539, /* ARMENIAN CAPITAL LETTER TO */ /*1381*/ 0x056a, 1, 0x053a, /* ARMENIAN CAPITAL LETTER ZHE */ /*1384*/ 0x056b, 1, 0x053b, /* ARMENIAN CAPITAL LETTER INI */ /*1387*/ 0x056c, 1, 0x053c, /* ARMENIAN CAPITAL LETTER LIWN */ /*1390*/ 0x056d, 1, 0x053d, /* ARMENIAN CAPITAL LETTER XEH */ /*1393*/ 0x056e, 1, 0x053e, /* ARMENIAN CAPITAL LETTER CA */ /*1396*/ 0x056f, 1, 0x053f, /* ARMENIAN CAPITAL LETTER KEN */ /*1399*/ 0x0570, 1, 0x0540, /* ARMENIAN CAPITAL LETTER HO */ /*1402*/ 0x0571, 1, 0x0541, /* ARMENIAN CAPITAL LETTER JA */ /*1405*/ 0x0572, 1, 0x0542, /* ARMENIAN CAPITAL LETTER GHAD */ /*1408*/ 0x0573, 1, 0x0543, /* ARMENIAN CAPITAL LETTER CHEH */ /*1411*/ 0x0574, 1, 0x0544, /* ARMENIAN CAPITAL LETTER MEN */ /*1414*/ 0x0575, 1, 0x0545, /* ARMENIAN CAPITAL LETTER YI */ /*1417*/ 0x0576, 1, 0x0546, /* ARMENIAN CAPITAL LETTER NOW */ /*1420*/ 0x0577, 1, 0x0547, /* ARMENIAN CAPITAL LETTER SHA */ /*1423*/ 0x0578, 1, 0x0548, /* ARMENIAN CAPITAL LETTER VO */ /*1426*/ 0x0579, 1, 0x0549, /* ARMENIAN CAPITAL LETTER CHA */ /*1429*/ 0x057a, 1, 0x054a, /* ARMENIAN CAPITAL LETTER PEH */ /*1432*/ 0x057b, 1, 0x054b, /* ARMENIAN CAPITAL LETTER JHEH */ /*1435*/ 0x057c, 1, 0x054c, /* ARMENIAN CAPITAL LETTER RA */ /*1438*/ 0x057d, 1, 0x054d, /* ARMENIAN CAPITAL LETTER SEH */ /*1441*/ 0x057e, 1, 0x054e, /* ARMENIAN CAPITAL LETTER VEW */ /*1444*/ 0x057f, 1, 0x054f, /* ARMENIAN CAPITAL LETTER TIWN */ /*1447*/ 0x0580, 1, 0x0550, /* ARMENIAN CAPITAL LETTER REH */ /*1450*/ 0x0581, 1, 0x0551, /* ARMENIAN CAPITAL LETTER CO */ /*1453*/ 0x0582, 1, 0x0552, /* ARMENIAN CAPITAL LETTER YIWN */ /*1456*/ 0x0583, 1, 0x0553, /* ARMENIAN CAPITAL LETTER PIWR */ /*1459*/ 0x0584, 1, 0x0554, /* ARMENIAN CAPITAL LETTER KEH */ /*1462*/ 0x0585, 1, 0x0555, /* ARMENIAN CAPITAL LETTER OH */ /*1465*/ 0x0586, 1, 0x0556, /* ARMENIAN CAPITAL LETTER FEH */ /*1468*/ 0x10d0, 1, 0x1c90, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1471*/ 0x10d1, 1, 0x1c91, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1474*/ 0x10d2, 1, 0x1c92, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1477*/ 0x10d3, 1, 0x1c93, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1480*/ 0x10d4, 1, 0x1c94, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1483*/ 0x10d5, 1, 0x1c95, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1486*/ 0x10d6, 1, 0x1c96, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1489*/ 0x10d7, 1, 0x1c97, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1492*/ 0x10d8, 1, 0x1c98, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1495*/ 0x10d9, 1, 0x1c99, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1498*/ 0x10da, 1, 0x1c9a, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1501*/ 0x10db, 1, 0x1c9b, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1504*/ 0x10dc, 1, 0x1c9c, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1507*/ 0x10dd, 1, 0x1c9d, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1510*/ 0x10de, 1, 0x1c9e, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1513*/ 0x10df, 1, 0x1c9f, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1516*/ 0x10e0, 1, 0x1ca0, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1519*/ 0x10e1, 1, 0x1ca1, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1522*/ 0x10e2, 1, 0x1ca2, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1525*/ 0x10e3, 1, 0x1ca3, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1528*/ 0x10e4, 1, 0x1ca4, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1531*/ 0x10e5, 1, 0x1ca5, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1534*/ 0x10e6, 1, 0x1ca6, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1537*/ 0x10e7, 1, 0x1ca7, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1540*/ 0x10e8, 1, 0x1ca8, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1543*/ 0x10e9, 1, 0x1ca9, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1546*/ 0x10ea, 1, 0x1caa, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1549*/ 0x10eb, 1, 0x1cab, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1552*/ 0x10ec, 1, 0x1cac, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1555*/ 0x10ed, 1, 0x1cad, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1558*/ 0x10ee, 1, 0x1cae, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1561*/ 0x10ef, 1, 0x1caf, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1564*/ 0x10f0, 1, 0x1cb0, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1567*/ 0x10f1, 1, 0x1cb1, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1570*/ 0x10f2, 1, 0x1cb2, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1573*/ 0x10f3, 1, 0x1cb3, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1576*/ 0x10f4, 1, 0x1cb4, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1579*/ 0x10f5, 1, 0x1cb5, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1582*/ 0x10f6, 1, 0x1cb6, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1585*/ 0x10f7, 1, 0x1cb7, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1588*/ 0x10f8, 1, 0x1cb8, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1591*/ 0x10f9, 1, 0x1cb9, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1594*/ 0x10fa, 1, 0x1cba, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1597*/ 0x10fd, 1, 0x1cbd, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1600*/ 0x10fe, 1, 0x1cbe, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1603*/ 0x10ff, 1, 0x1cbf, /* GEORGIAN MTAVRULI CAPITAL LETTER .. */ /*1606*/ 0x13a0, 1, 0xab70, /* CHEROKEE SMALL LETTER A */ /*1609*/ 0x13a1, 1, 0xab71, /* CHEROKEE SMALL LETTER E */ /*1612*/ 0x13a2, 1, 0xab72, /* CHEROKEE SMALL LETTER I */ /*1615*/ 0x13a3, 1, 0xab73, /* CHEROKEE SMALL LETTER O */ /*1618*/ 0x13a4, 1, 0xab74, /* CHEROKEE SMALL LETTER U */ /*1621*/ 0x13a5, 1, 0xab75, /* CHEROKEE SMALL LETTER V */ /*1624*/ 0x13a6, 1, 0xab76, /* CHEROKEE SMALL LETTER GA */ /*1627*/ 0x13a7, 1, 0xab77, /* CHEROKEE SMALL LETTER KA */ /*1630*/ 0x13a8, 1, 0xab78, /* CHEROKEE SMALL LETTER GE */ /*1633*/ 0x13a9, 1, 0xab79, /* CHEROKEE SMALL LETTER GI */ /*1636*/ 0x13aa, 1, 0xab7a, /* CHEROKEE SMALL LETTER GO */ /*1639*/ 0x13ab, 1, 0xab7b, /* CHEROKEE SMALL LETTER GU */ /*1642*/ 0x13ac, 1, 0xab7c, /* CHEROKEE SMALL LETTER GV */ /*1645*/ 0x13ad, 1, 0xab7d, /* CHEROKEE SMALL LETTER HA */ /*1648*/ 0x13ae, 1, 0xab7e, /* CHEROKEE SMALL LETTER HE */ /*1651*/ 0x13af, 1, 0xab7f, /* CHEROKEE SMALL LETTER HI */ /*1654*/ 0x13b0, 1, 0xab80, /* CHEROKEE SMALL LETTER HO */ /*1657*/ 0x13b1, 1, 0xab81, /* CHEROKEE SMALL LETTER HU */ /*1660*/ 0x13b2, 1, 0xab82, /* CHEROKEE SMALL LETTER HV */ /*1663*/ 0x13b3, 1, 0xab83, /* CHEROKEE SMALL LETTER LA */ /*1666*/ 0x13b4, 1, 0xab84, /* CHEROKEE SMALL LETTER LE */ /*1669*/ 0x13b5, 1, 0xab85, /* CHEROKEE SMALL LETTER LI */ /*1672*/ 0x13b6, 1, 0xab86, /* CHEROKEE SMALL LETTER LO */ /*1675*/ 0x13b7, 1, 0xab87, /* CHEROKEE SMALL LETTER LU */ /*1678*/ 0x13b8, 1, 0xab88, /* CHEROKEE SMALL LETTER LV */ /*1681*/ 0x13b9, 1, 0xab89, /* CHEROKEE SMALL LETTER MA */ /*1684*/ 0x13ba, 1, 0xab8a, /* CHEROKEE SMALL LETTER ME */ /*1687*/ 0x13bb, 1, 0xab8b, /* CHEROKEE SMALL LETTER MI */ /*1690*/ 0x13bc, 1, 0xab8c, /* CHEROKEE SMALL LETTER MO */ /*1693*/ 0x13bd, 1, 0xab8d, /* CHEROKEE SMALL LETTER MU */ /*1696*/ 0x13be, 1, 0xab8e, /* CHEROKEE SMALL LETTER NA */ /*1699*/ 0x13bf, 1, 0xab8f, /* CHEROKEE SMALL LETTER HNA */ /*1702*/ 0x13c0, 1, 0xab90, /* CHEROKEE SMALL LETTER NAH */ /*1705*/ 0x13c1, 1, 0xab91, /* CHEROKEE SMALL LETTER NE */ /*1708*/ 0x13c2, 1, 0xab92, /* CHEROKEE SMALL LETTER NI */ /*1711*/ 0x13c3, 1, 0xab93, /* CHEROKEE SMALL LETTER NO */ /*1714*/ 0x13c4, 1, 0xab94, /* CHEROKEE SMALL LETTER NU */ /*1717*/ 0x13c5, 1, 0xab95, /* CHEROKEE SMALL LETTER NV */ /*1720*/ 0x13c6, 1, 0xab96, /* CHEROKEE SMALL LETTER QUA */ /*1723*/ 0x13c7, 1, 0xab97, /* CHEROKEE SMALL LETTER QUE */ /*1726*/ 0x13c8, 1, 0xab98, /* CHEROKEE SMALL LETTER QUI */ /*1729*/ 0x13c9, 1, 0xab99, /* CHEROKEE SMALL LETTER QUO */ /*1732*/ 0x13ca, 1, 0xab9a, /* CHEROKEE SMALL LETTER QUU */ /*1735*/ 0x13cb, 1, 0xab9b, /* CHEROKEE SMALL LETTER QUV */ /*1738*/ 0x13cc, 1, 0xab9c, /* CHEROKEE SMALL LETTER SA */ /*1741*/ 0x13cd, 1, 0xab9d, /* CHEROKEE SMALL LETTER S */ /*1744*/ 0x13ce, 1, 0xab9e, /* CHEROKEE SMALL LETTER SE */ /*1747*/ 0x13cf, 1, 0xab9f, /* CHEROKEE SMALL LETTER SI */ /*1750*/ 0x13d0, 1, 0xaba0, /* CHEROKEE SMALL LETTER SO */ /*1753*/ 0x13d1, 1, 0xaba1, /* CHEROKEE SMALL LETTER SU */ /*1756*/ 0x13d2, 1, 0xaba2, /* CHEROKEE SMALL LETTER SV */ /*1759*/ 0x13d3, 1, 0xaba3, /* CHEROKEE SMALL LETTER DA */ /*1762*/ 0x13d4, 1, 0xaba4, /* CHEROKEE SMALL LETTER TA */ /*1765*/ 0x13d5, 1, 0xaba5, /* CHEROKEE SMALL LETTER DE */ /*1768*/ 0x13d6, 1, 0xaba6, /* CHEROKEE SMALL LETTER TE */ /*1771*/ 0x13d7, 1, 0xaba7, /* CHEROKEE SMALL LETTER DI */ /*1774*/ 0x13d8, 1, 0xaba8, /* CHEROKEE SMALL LETTER TI */ /*1777*/ 0x13d9, 1, 0xaba9, /* CHEROKEE SMALL LETTER DO */ /*1780*/ 0x13da, 1, 0xabaa, /* CHEROKEE SMALL LETTER DU */ /*1783*/ 0x13db, 1, 0xabab, /* CHEROKEE SMALL LETTER DV */ /*1786*/ 0x13dc, 1, 0xabac, /* CHEROKEE SMALL LETTER DLA */ /*1789*/ 0x13dd, 1, 0xabad, /* CHEROKEE SMALL LETTER TLA */ /*1792*/ 0x13de, 1, 0xabae, /* CHEROKEE SMALL LETTER TLE */ /*1795*/ 0x13df, 1, 0xabaf, /* CHEROKEE SMALL LETTER TLI */ /*1798*/ 0x13e0, 1, 0xabb0, /* CHEROKEE SMALL LETTER TLO */ /*1801*/ 0x13e1, 1, 0xabb1, /* CHEROKEE SMALL LETTER TLU */ /*1804*/ 0x13e2, 1, 0xabb2, /* CHEROKEE SMALL LETTER TLV */ /*1807*/ 0x13e3, 1, 0xabb3, /* CHEROKEE SMALL LETTER TSA */ /*1810*/ 0x13e4, 1, 0xabb4, /* CHEROKEE SMALL LETTER TSE */ /*1813*/ 0x13e5, 1, 0xabb5, /* CHEROKEE SMALL LETTER TSI */ /*1816*/ 0x13e6, 1, 0xabb6, /* CHEROKEE SMALL LETTER TSO */ /*1819*/ 0x13e7, 1, 0xabb7, /* CHEROKEE SMALL LETTER TSU */ /*1822*/ 0x13e8, 1, 0xabb8, /* CHEROKEE SMALL LETTER TSV */ /*1825*/ 0x13e9, 1, 0xabb9, /* CHEROKEE SMALL LETTER WA */ /*1828*/ 0x13ea, 1, 0xabba, /* CHEROKEE SMALL LETTER WE */ /*1831*/ 0x13eb, 1, 0xabbb, /* CHEROKEE SMALL LETTER WI */ /*1834*/ 0x13ec, 1, 0xabbc, /* CHEROKEE SMALL LETTER WO */ /*1837*/ 0x13ed, 1, 0xabbd, /* CHEROKEE SMALL LETTER WU */ /*1840*/ 0x13ee, 1, 0xabbe, /* CHEROKEE SMALL LETTER WV */ /*1843*/ 0x13ef, 1, 0xabbf, /* CHEROKEE SMALL LETTER YA */ /*1846*/ 0x13f0, 1, 0x13f8, /* CHEROKEE SMALL LETTER YE */ /*1849*/ 0x13f1, 1, 0x13f9, /* CHEROKEE SMALL LETTER YI */ /*1852*/ 0x13f2, 1, 0x13fa, /* CHEROKEE SMALL LETTER YO */ /*1855*/ 0x13f3, 1, 0x13fb, /* CHEROKEE SMALL LETTER YU */ /*1858*/ 0x13f4, 1, 0x13fc, /* CHEROKEE SMALL LETTER YV */ /*1861*/ 0x13f5, 1, 0x13fd, /* CHEROKEE SMALL LETTER MV */ /*1864*/ 0x1c8a, 1, 0x1c89, /* CYRILLIC CAPITAL LETTER TJE */ /*1867*/ 0x1d79, 1, 0xa77d, /* LATIN CAPITAL LETTER INSULAR G */ /*1870*/ 0x1d7d, 1, 0x2c63, /* LATIN CAPITAL LETTER P WITH STROKE */ /*1873*/ 0x1d8e, 1, 0xa7c6, /* LATIN CAPITAL LETTER Z WITH PALAT.. */ /*1876*/ 0x1e01, 1, 0x1e00, /* LATIN CAPITAL LETTER A WITH RING .. */ /*1879*/ 0x1e03, 1, 0x1e02, /* LATIN CAPITAL LETTER B WITH DOT A.. */ /*1882*/ 0x1e05, 1, 0x1e04, /* LATIN CAPITAL LETTER B WITH DOT B.. */ /*1885*/ 0x1e07, 1, 0x1e06, /* LATIN CAPITAL LETTER B WITH LINE .. */ /*1888*/ 0x1e09, 1, 0x1e08, /* LATIN CAPITAL LETTER C WITH CEDIL.. */ /*1891*/ 0x1e0b, 1, 0x1e0a, /* LATIN CAPITAL LETTER D WITH DOT A.. */ /*1894*/ 0x1e0d, 1, 0x1e0c, /* LATIN CAPITAL LETTER D WITH DOT B.. */ /*1897*/ 0x1e0f, 1, 0x1e0e, /* LATIN CAPITAL LETTER D WITH LINE .. */ /*1900*/ 0x1e11, 1, 0x1e10, /* LATIN CAPITAL LETTER D WITH CEDIL.. */ /*1903*/ 0x1e13, 1, 0x1e12, /* LATIN CAPITAL LETTER D WITH CIRCU.. */ /*1906*/ 0x1e15, 1, 0x1e14, /* LATIN CAPITAL LETTER E WITH MACRO.. */ /*1909*/ 0x1e17, 1, 0x1e16, /* LATIN CAPITAL LETTER E WITH MACRO.. */ /*1912*/ 0x1e19, 1, 0x1e18, /* LATIN CAPITAL LETTER E WITH CIRCU.. */ /*1915*/ 0x1e1b, 1, 0x1e1a, /* LATIN CAPITAL LETTER E WITH TILDE.. */ /*1918*/ 0x1e1d, 1, 0x1e1c, /* LATIN CAPITAL LETTER E WITH CEDIL.. */ /*1921*/ 0x1e1f, 1, 0x1e1e, /* LATIN CAPITAL LETTER F WITH DOT A.. */ /*1924*/ 0x1e21, 1, 0x1e20, /* LATIN CAPITAL LETTER G WITH MACRON */ /*1927*/ 0x1e23, 1, 0x1e22, /* LATIN CAPITAL LETTER H WITH DOT A.. */ /*1930*/ 0x1e25, 1, 0x1e24, /* LATIN CAPITAL LETTER H WITH DOT B.. */ /*1933*/ 0x1e27, 1, 0x1e26, /* LATIN CAPITAL LETTER H WITH DIAER.. */ /*1936*/ 0x1e29, 1, 0x1e28, /* LATIN CAPITAL LETTER H WITH CEDIL.. */ /*1939*/ 0x1e2b, 1, 0x1e2a, /* LATIN CAPITAL LETTER H WITH BREVE.. */ /*1942*/ 0x1e2d, 1, 0x1e2c, /* LATIN CAPITAL LETTER I WITH TILDE.. */ /*1945*/ 0x1e2f, 1, 0x1e2e, /* LATIN CAPITAL LETTER I WITH DIAER.. */ /*1948*/ 0x1e31, 1, 0x1e30, /* LATIN CAPITAL LETTER K WITH ACUTE */ /*1951*/ 0x1e33, 1, 0x1e32, /* LATIN CAPITAL LETTER K WITH DOT B.. */ /*1954*/ 0x1e35, 1, 0x1e34, /* LATIN CAPITAL LETTER K WITH LINE .. */ /*1957*/ 0x1e37, 1, 0x1e36, /* LATIN CAPITAL LETTER L WITH DOT B.. */ /*1960*/ 0x1e39, 1, 0x1e38, /* LATIN CAPITAL LETTER L WITH DOT B.. */ /*1963*/ 0x1e3b, 1, 0x1e3a, /* LATIN CAPITAL LETTER L WITH LINE .. */ /*1966*/ 0x1e3d, 1, 0x1e3c, /* LATIN CAPITAL LETTER L WITH CIRCU.. */ /*1969*/ 0x1e3f, 1, 0x1e3e, /* LATIN CAPITAL LETTER M WITH ACUTE */ /*1972*/ 0x1e41, 1, 0x1e40, /* LATIN CAPITAL LETTER M WITH DOT A.. */ /*1975*/ 0x1e43, 1, 0x1e42, /* LATIN CAPITAL LETTER M WITH DOT B.. */ /*1978*/ 0x1e45, 1, 0x1e44, /* LATIN CAPITAL LETTER N WITH DOT A.. */ /*1981*/ 0x1e47, 1, 0x1e46, /* LATIN CAPITAL LETTER N WITH DOT B.. */ /*1984*/ 0x1e49, 1, 0x1e48, /* LATIN CAPITAL LETTER N WITH LINE .. */ /*1987*/ 0x1e4b, 1, 0x1e4a, /* LATIN CAPITAL LETTER N WITH CIRCU.. */ /*1990*/ 0x1e4d, 1, 0x1e4c, /* LATIN CAPITAL LETTER O WITH TILDE.. */ /*1993*/ 0x1e4f, 1, 0x1e4e, /* LATIN CAPITAL LETTER O WITH TILDE.. */ /*1996*/ 0x1e51, 1, 0x1e50, /* LATIN CAPITAL LETTER O WITH MACRO.. */ /*1999*/ 0x1e53, 1, 0x1e52, /* LATIN CAPITAL LETTER O WITH MACRO.. */ /*2002*/ 0x1e55, 1, 0x1e54, /* LATIN CAPITAL LETTER P WITH ACUTE */ /*2005*/ 0x1e57, 1, 0x1e56, /* LATIN CAPITAL LETTER P WITH DOT A.. */ /*2008*/ 0x1e59, 1, 0x1e58, /* LATIN CAPITAL LETTER R WITH DOT A.. */ /*2011*/ 0x1e5b, 1, 0x1e5a, /* LATIN CAPITAL LETTER R WITH DOT B.. */ /*2014*/ 0x1e5d, 1, 0x1e5c, /* LATIN CAPITAL LETTER R WITH DOT B.. */ /*2017*/ 0x1e5f, 1, 0x1e5e, /* LATIN CAPITAL LETTER R WITH LINE .. */ /*2020*/ 0x1e61, 2, 0x1e60, 0x1e9b, /* LATIN CAPITAL LETTER S WITH DOT A.. */ /*2024*/ 0x1e63, 1, 0x1e62, /* LATIN CAPITAL LETTER S WITH DOT B.. */ /*2027*/ 0x1e65, 1, 0x1e64, /* LATIN CAPITAL LETTER S WITH ACUTE.. */ /*2030*/ 0x1e67, 1, 0x1e66, /* LATIN CAPITAL LETTER S WITH CARON.. */ /*2033*/ 0x1e69, 1, 0x1e68, /* LATIN CAPITAL LETTER S WITH DOT B.. */ /*2036*/ 0x1e6b, 1, 0x1e6a, /* LATIN CAPITAL LETTER T WITH DOT A.. */ /*2039*/ 0x1e6d, 1, 0x1e6c, /* LATIN CAPITAL LETTER T WITH DOT B.. */ /*2042*/ 0x1e6f, 1, 0x1e6e, /* LATIN CAPITAL LETTER T WITH LINE .. */ /*2045*/ 0x1e71, 1, 0x1e70, /* LATIN CAPITAL LETTER T WITH CIRCU.. */ /*2048*/ 0x1e73, 1, 0x1e72, /* LATIN CAPITAL LETTER U WITH DIAER.. */ /*2051*/ 0x1e75, 1, 0x1e74, /* LATIN CAPITAL LETTER U WITH TILDE.. */ /*2054*/ 0x1e77, 1, 0x1e76, /* LATIN CAPITAL LETTER U WITH CIRCU.. */ /*2057*/ 0x1e79, 1, 0x1e78, /* LATIN CAPITAL LETTER U WITH TILDE.. */ /*2060*/ 0x1e7b, 1, 0x1e7a, /* LATIN CAPITAL LETTER U WITH MACRO.. */ /*2063*/ 0x1e7d, 1, 0x1e7c, /* LATIN CAPITAL LETTER V WITH TILDE */ /*2066*/ 0x1e7f, 1, 0x1e7e, /* LATIN CAPITAL LETTER V WITH DOT B.. */ /*2069*/ 0x1e81, 1, 0x1e80, /* LATIN CAPITAL LETTER W WITH GRAVE */ /*2072*/ 0x1e83, 1, 0x1e82, /* LATIN CAPITAL LETTER W WITH ACUTE */ /*2075*/ 0x1e85, 1, 0x1e84, /* LATIN CAPITAL LETTER W WITH DIAER.. */ /*2078*/ 0x1e87, 1, 0x1e86, /* LATIN CAPITAL LETTER W WITH DOT A.. */ /*2081*/ 0x1e89, 1, 0x1e88, /* LATIN CAPITAL LETTER W WITH DOT B.. */ /*2084*/ 0x1e8b, 1, 0x1e8a, /* LATIN CAPITAL LETTER X WITH DOT A.. */ /*2087*/ 0x1e8d, 1, 0x1e8c, /* LATIN CAPITAL LETTER X WITH DIAER.. */ /*2090*/ 0x1e8f, 1, 0x1e8e, /* LATIN CAPITAL LETTER Y WITH DOT A.. */ /*2093*/ 0x1e91, 1, 0x1e90, /* LATIN CAPITAL LETTER Z WITH CIRCU.. */ /*2096*/ 0x1e93, 1, 0x1e92, /* LATIN CAPITAL LETTER Z WITH DOT B.. */ /*2099*/ 0x1e95, 1, 0x1e94, /* LATIN CAPITAL LETTER Z WITH LINE .. */ /*2102*/ 0x1ea1, 1, 0x1ea0, /* LATIN CAPITAL LETTER A WITH DOT B.. */ /*2105*/ 0x1ea3, 1, 0x1ea2, /* LATIN CAPITAL LETTER A WITH HOOK .. */ /*2108*/ 0x1ea5, 1, 0x1ea4, /* LATIN CAPITAL LETTER A WITH CIRCU.. */ /*2111*/ 0x1ea7, 1, 0x1ea6, /* LATIN CAPITAL LETTER A WITH CIRCU.. */ /*2114*/ 0x1ea9, 1, 0x1ea8, /* LATIN CAPITAL LETTER A WITH CIRCU.. */ /*2117*/ 0x1eab, 1, 0x1eaa, /* LATIN CAPITAL LETTER A WITH CIRCU.. */ /*2120*/ 0x1ead, 1, 0x1eac, /* LATIN CAPITAL LETTER A WITH CIRCU.. */ /*2123*/ 0x1eaf, 1, 0x1eae, /* LATIN CAPITAL LETTER A WITH BREVE.. */ /*2126*/ 0x1eb1, 1, 0x1eb0, /* LATIN CAPITAL LETTER A WITH BREVE.. */ /*2129*/ 0x1eb3, 1, 0x1eb2, /* LATIN CAPITAL LETTER A WITH BREVE.. */ /*2132*/ 0x1eb5, 1, 0x1eb4, /* LATIN CAPITAL LETTER A WITH BREVE.. */ /*2135*/ 0x1eb7, 1, 0x1eb6, /* LATIN CAPITAL LETTER A WITH BREVE.. */ /*2138*/ 0x1eb9, 1, 0x1eb8, /* LATIN CAPITAL LETTER E WITH DOT B.. */ /*2141*/ 0x1ebb, 1, 0x1eba, /* LATIN CAPITAL LETTER E WITH HOOK .. */ /*2144*/ 0x1ebd, 1, 0x1ebc, /* LATIN CAPITAL LETTER E WITH TILDE */ /*2147*/ 0x1ebf, 1, 0x1ebe, /* LATIN CAPITAL LETTER E WITH CIRCU.. */ /*2150*/ 0x1ec1, 1, 0x1ec0, /* LATIN CAPITAL LETTER E WITH CIRCU.. */ /*2153*/ 0x1ec3, 1, 0x1ec2, /* LATIN CAPITAL LETTER E WITH CIRCU.. */ /*2156*/ 0x1ec5, 1, 0x1ec4, /* LATIN CAPITAL LETTER E WITH CIRCU.. */ /*2159*/ 0x1ec7, 1, 0x1ec6, /* LATIN CAPITAL LETTER E WITH CIRCU.. */ /*2162*/ 0x1ec9, 1, 0x1ec8, /* LATIN CAPITAL LETTER I WITH HOOK .. */ /*2165*/ 0x1ecb, 1, 0x1eca, /* LATIN CAPITAL LETTER I WITH DOT B.. */ /*2168*/ 0x1ecd, 1, 0x1ecc, /* LATIN CAPITAL LETTER O WITH DOT B.. */ /*2171*/ 0x1ecf, 1, 0x1ece, /* LATIN CAPITAL LETTER O WITH HOOK .. */ /*2174*/ 0x1ed1, 1, 0x1ed0, /* LATIN CAPITAL LETTER O WITH CIRCU.. */ /*2177*/ 0x1ed3, 1, 0x1ed2, /* LATIN CAPITAL LETTER O WITH CIRCU.. */ /*2180*/ 0x1ed5, 1, 0x1ed4, /* LATIN CAPITAL LETTER O WITH CIRCU.. */ /*2183*/ 0x1ed7, 1, 0x1ed6, /* LATIN CAPITAL LETTER O WITH CIRCU.. */ /*2186*/ 0x1ed9, 1, 0x1ed8, /* LATIN CAPITAL LETTER O WITH CIRCU.. */ /*2189*/ 0x1edb, 1, 0x1eda, /* LATIN CAPITAL LETTER O WITH HORN .. */ /*2192*/ 0x1edd, 1, 0x1edc, /* LATIN CAPITAL LETTER O WITH HORN .. */ /*2195*/ 0x1edf, 1, 0x1ede, /* LATIN CAPITAL LETTER O WITH HORN .. */ /*2198*/ 0x1ee1, 1, 0x1ee0, /* LATIN CAPITAL LETTER O WITH HORN .. */ /*2201*/ 0x1ee3, 1, 0x1ee2, /* LATIN CAPITAL LETTER O WITH HORN .. */ /*2204*/ 0x1ee5, 1, 0x1ee4, /* LATIN CAPITAL LETTER U WITH DOT B.. */ /*2207*/ 0x1ee7, 1, 0x1ee6, /* LATIN CAPITAL LETTER U WITH HOOK .. */ /*2210*/ 0x1ee9, 1, 0x1ee8, /* LATIN CAPITAL LETTER U WITH HORN .. */ /*2213*/ 0x1eeb, 1, 0x1eea, /* LATIN CAPITAL LETTER U WITH HORN .. */ /*2216*/ 0x1eed, 1, 0x1eec, /* LATIN CAPITAL LETTER U WITH HORN .. */ /*2219*/ 0x1eef, 1, 0x1eee, /* LATIN CAPITAL LETTER U WITH HORN .. */ /*2222*/ 0x1ef1, 1, 0x1ef0, /* LATIN CAPITAL LETTER U WITH HORN .. */ /*2225*/ 0x1ef3, 1, 0x1ef2, /* LATIN CAPITAL LETTER Y WITH GRAVE */ /*2228*/ 0x1ef5, 1, 0x1ef4, /* LATIN CAPITAL LETTER Y WITH DOT B.. */ /*2231*/ 0x1ef7, 1, 0x1ef6, /* LATIN CAPITAL LETTER Y WITH HOOK .. */ /*2234*/ 0x1ef9, 1, 0x1ef8, /* LATIN CAPITAL LETTER Y WITH TILDE */ /*2237*/ 0x1efb, 1, 0x1efa, /* LATIN CAPITAL LETTER MIDDLE-WELSH.. */ /*2240*/ 0x1efd, 1, 0x1efc, /* LATIN CAPITAL LETTER MIDDLE-WELSH.. */ /*2243*/ 0x1eff, 1, 0x1efe, /* LATIN CAPITAL LETTER Y WITH LOOP */ /*2246*/ 0x1f00, 1, 0x1f08, /* GREEK CAPITAL LETTER ALPHA WITH P.. */ /*2249*/ 0x1f01, 1, 0x1f09, /* GREEK CAPITAL LETTER ALPHA WITH D.. */ /*2252*/ 0x1f02, 1, 0x1f0a, /* GREEK CAPITAL LETTER ALPHA WITH P.. */ /*2255*/ 0x1f03, 1, 0x1f0b, /* GREEK CAPITAL LETTER ALPHA WITH D.. */ /*2258*/ 0x1f04, 1, 0x1f0c, /* GREEK CAPITAL LETTER ALPHA WITH P.. */ /*2261*/ 0x1f05, 1, 0x1f0d, /* GREEK CAPITAL LETTER ALPHA WITH D.. */ /*2264*/ 0x1f06, 1, 0x1f0e, /* GREEK CAPITAL LETTER ALPHA WITH P.. */ /*2267*/ 0x1f07, 1, 0x1f0f, /* GREEK CAPITAL LETTER ALPHA WITH D.. */ /*2270*/ 0x1f10, 1, 0x1f18, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2273*/ 0x1f11, 1, 0x1f19, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2276*/ 0x1f12, 1, 0x1f1a, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2279*/ 0x1f13, 1, 0x1f1b, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2282*/ 0x1f14, 1, 0x1f1c, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2285*/ 0x1f15, 1, 0x1f1d, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2288*/ 0x1f20, 1, 0x1f28, /* GREEK CAPITAL LETTER ETA WITH PSI.. */ /*2291*/ 0x1f21, 1, 0x1f29, /* GREEK CAPITAL LETTER ETA WITH DAS.. */ /*2294*/ 0x1f22, 1, 0x1f2a, /* GREEK CAPITAL LETTER ETA WITH PSI.. */ /*2297*/ 0x1f23, 1, 0x1f2b, /* GREEK CAPITAL LETTER ETA WITH DAS.. */ /*2300*/ 0x1f24, 1, 0x1f2c, /* GREEK CAPITAL LETTER ETA WITH PSI.. */ /*2303*/ 0x1f25, 1, 0x1f2d, /* GREEK CAPITAL LETTER ETA WITH DAS.. */ /*2306*/ 0x1f26, 1, 0x1f2e, /* GREEK CAPITAL LETTER ETA WITH PSI.. */ /*2309*/ 0x1f27, 1, 0x1f2f, /* GREEK CAPITAL LETTER ETA WITH DAS.. */ /*2312*/ 0x1f30, 1, 0x1f38, /* GREEK CAPITAL LETTER IOTA WITH PS.. */ /*2315*/ 0x1f31, 1, 0x1f39, /* GREEK CAPITAL LETTER IOTA WITH DA.. */ /*2318*/ 0x1f32, 1, 0x1f3a, /* GREEK CAPITAL LETTER IOTA WITH PS.. */ /*2321*/ 0x1f33, 1, 0x1f3b, /* GREEK CAPITAL LETTER IOTA WITH DA.. */ /*2324*/ 0x1f34, 1, 0x1f3c, /* GREEK CAPITAL LETTER IOTA WITH PS.. */ /*2327*/ 0x1f35, 1, 0x1f3d, /* GREEK CAPITAL LETTER IOTA WITH DA.. */ /*2330*/ 0x1f36, 1, 0x1f3e, /* GREEK CAPITAL LETTER IOTA WITH PS.. */ /*2333*/ 0x1f37, 1, 0x1f3f, /* GREEK CAPITAL LETTER IOTA WITH DA.. */ /*2336*/ 0x1f40, 1, 0x1f48, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2339*/ 0x1f41, 1, 0x1f49, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2342*/ 0x1f42, 1, 0x1f4a, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2345*/ 0x1f43, 1, 0x1f4b, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2348*/ 0x1f44, 1, 0x1f4c, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2351*/ 0x1f45, 1, 0x1f4d, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2354*/ 0x1f51, 1, 0x1f59, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2357*/ 0x1f53, 1, 0x1f5b, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2360*/ 0x1f55, 1, 0x1f5d, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2363*/ 0x1f57, 1, 0x1f5f, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2366*/ 0x1f60, 1, 0x1f68, /* GREEK CAPITAL LETTER OMEGA WITH P.. */ /*2369*/ 0x1f61, 1, 0x1f69, /* GREEK CAPITAL LETTER OMEGA WITH D.. */ /*2372*/ 0x1f62, 1, 0x1f6a, /* GREEK CAPITAL LETTER OMEGA WITH P.. */ /*2375*/ 0x1f63, 1, 0x1f6b, /* GREEK CAPITAL LETTER OMEGA WITH D.. */ /*2378*/ 0x1f64, 1, 0x1f6c, /* GREEK CAPITAL LETTER OMEGA WITH P.. */ /*2381*/ 0x1f65, 1, 0x1f6d, /* GREEK CAPITAL LETTER OMEGA WITH D.. */ /*2384*/ 0x1f66, 1, 0x1f6e, /* GREEK CAPITAL LETTER OMEGA WITH P.. */ /*2387*/ 0x1f67, 1, 0x1f6f, /* GREEK CAPITAL LETTER OMEGA WITH D.. */ /*2390*/ 0x1f70, 1, 0x1fba, /* GREEK CAPITAL LETTER ALPHA WITH V.. */ /*2393*/ 0x1f71, 1, 0x1fbb, /* GREEK CAPITAL LETTER ALPHA WITH O.. */ /*2396*/ 0x1f72, 1, 0x1fc8, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2399*/ 0x1f73, 1, 0x1fc9, /* GREEK CAPITAL LETTER EPSILON WITH.. */ /*2402*/ 0x1f74, 1, 0x1fca, /* GREEK CAPITAL LETTER ETA WITH VAR.. */ /*2405*/ 0x1f75, 1, 0x1fcb, /* GREEK CAPITAL LETTER ETA WITH OXIA */ /*2408*/ 0x1f76, 1, 0x1fda, /* GREEK CAPITAL LETTER IOTA WITH VA.. */ /*2411*/ 0x1f77, 1, 0x1fdb, /* GREEK CAPITAL LETTER IOTA WITH OX.. */ /*2414*/ 0x1f78, 1, 0x1ff8, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2417*/ 0x1f79, 1, 0x1ff9, /* GREEK CAPITAL LETTER OMICRON WITH.. */ /*2420*/ 0x1f7a, 1, 0x1fea, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2423*/ 0x1f7b, 1, 0x1feb, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2426*/ 0x1f7c, 1, 0x1ffa, /* GREEK CAPITAL LETTER OMEGA WITH V.. */ /*2429*/ 0x1f7d, 1, 0x1ffb, /* GREEK CAPITAL LETTER OMEGA WITH O.. */ /*2432*/ 0x1fb0, 1, 0x1fb8, /* GREEK CAPITAL LETTER ALPHA WITH V.. */ /*2435*/ 0x1fb1, 1, 0x1fb9, /* GREEK CAPITAL LETTER ALPHA WITH M.. */ /*2438*/ 0x1fd0, 1, 0x1fd8, /* GREEK CAPITAL LETTER IOTA WITH VR.. */ /*2441*/ 0x1fd1, 1, 0x1fd9, /* GREEK CAPITAL LETTER IOTA WITH MA.. */ /*2444*/ 0x1fe0, 1, 0x1fe8, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2447*/ 0x1fe1, 1, 0x1fe9, /* GREEK CAPITAL LETTER UPSILON WITH.. */ /*2450*/ 0x1fe5, 1, 0x1fec, /* GREEK CAPITAL LETTER RHO WITH DAS.. */ /*2453*/ 0x214e, 1, 0x2132, /* TURNED CAPITAL F */ /*2456*/ 0x2170, 1, 0x2160, /* ROMAN NUMERAL ONE */ /*2459*/ 0x2171, 1, 0x2161, /* ROMAN NUMERAL TWO */ /*2462*/ 0x2172, 1, 0x2162, /* ROMAN NUMERAL THREE */ /*2465*/ 0x2173, 1, 0x2163, /* ROMAN NUMERAL FOUR */ /*2468*/ 0x2174, 1, 0x2164, /* ROMAN NUMERAL FIVE */ /*2471*/ 0x2175, 1, 0x2165, /* ROMAN NUMERAL SIX */ /*2474*/ 0x2176, 1, 0x2166, /* ROMAN NUMERAL SEVEN */ /*2477*/ 0x2177, 1, 0x2167, /* ROMAN NUMERAL EIGHT */ /*2480*/ 0x2178, 1, 0x2168, /* ROMAN NUMERAL NINE */ /*2483*/ 0x2179, 1, 0x2169, /* ROMAN NUMERAL TEN */ /*2486*/ 0x217a, 1, 0x216a, /* ROMAN NUMERAL ELEVEN */ /*2489*/ 0x217b, 1, 0x216b, /* ROMAN NUMERAL TWELVE */ /*2492*/ 0x217c, 1, 0x216c, /* ROMAN NUMERAL FIFTY */ /*2495*/ 0x217d, 1, 0x216d, /* ROMAN NUMERAL ONE HUNDRED */ /*2498*/ 0x217e, 1, 0x216e, /* ROMAN NUMERAL FIVE HUNDRED */ /*2501*/ 0x217f, 1, 0x216f, /* ROMAN NUMERAL ONE THOUSAND */ /*2504*/ 0x2184, 1, 0x2183, /* ROMAN NUMERAL REVERSED ONE HUNDRED */ /*2507*/ 0x24d0, 1, 0x24b6, /* CIRCLED LATIN CAPITAL LETTER A */ /*2510*/ 0x24d1, 1, 0x24b7, /* CIRCLED LATIN CAPITAL LETTER B */ /*2513*/ 0x24d2, 1, 0x24b8, /* CIRCLED LATIN CAPITAL LETTER C */ /*2516*/ 0x24d3, 1, 0x24b9, /* CIRCLED LATIN CAPITAL LETTER D */ /*2519*/ 0x24d4, 1, 0x24ba, /* CIRCLED LATIN CAPITAL LETTER E */ /*2522*/ 0x24d5, 1, 0x24bb, /* CIRCLED LATIN CAPITAL LETTER F */ /*2525*/ 0x24d6, 1, 0x24bc, /* CIRCLED LATIN CAPITAL LETTER G */ /*2528*/ 0x24d7, 1, 0x24bd, /* CIRCLED LATIN CAPITAL LETTER H */ /*2531*/ 0x24d8, 1, 0x24be, /* CIRCLED LATIN CAPITAL LETTER I */ /*2534*/ 0x24d9, 1, 0x24bf, /* CIRCLED LATIN CAPITAL LETTER J */ /*2537*/ 0x24da, 1, 0x24c0, /* CIRCLED LATIN CAPITAL LETTER K */ /*2540*/ 0x24db, 1, 0x24c1, /* CIRCLED LATIN CAPITAL LETTER L */ /*2543*/ 0x24dc, 1, 0x24c2, /* CIRCLED LATIN CAPITAL LETTER M */ /*2546*/ 0x24dd, 1, 0x24c3, /* CIRCLED LATIN CAPITAL LETTER N */ /*2549*/ 0x24de, 1, 0x24c4, /* CIRCLED LATIN CAPITAL LETTER O */ /*2552*/ 0x24df, 1, 0x24c5, /* CIRCLED LATIN CAPITAL LETTER P */ /*2555*/ 0x24e0, 1, 0x24c6, /* CIRCLED LATIN CAPITAL LETTER Q */ /*2558*/ 0x24e1, 1, 0x24c7, /* CIRCLED LATIN CAPITAL LETTER R */ /*2561*/ 0x24e2, 1, 0x24c8, /* CIRCLED LATIN CAPITAL LETTER S */ /*2564*/ 0x24e3, 1, 0x24c9, /* CIRCLED LATIN CAPITAL LETTER T */ /*2567*/ 0x24e4, 1, 0x24ca, /* CIRCLED LATIN CAPITAL LETTER U */ /*2570*/ 0x24e5, 1, 0x24cb, /* CIRCLED LATIN CAPITAL LETTER V */ /*2573*/ 0x24e6, 1, 0x24cc, /* CIRCLED LATIN CAPITAL LETTER W */ /*2576*/ 0x24e7, 1, 0x24cd, /* CIRCLED LATIN CAPITAL LETTER X */ /*2579*/ 0x24e8, 1, 0x24ce, /* CIRCLED LATIN CAPITAL LETTER Y */ /*2582*/ 0x24e9, 1, 0x24cf, /* CIRCLED LATIN CAPITAL LETTER Z */ /*2585*/ 0x2c30, 1, 0x2c00, /* GLAGOLITIC CAPITAL LETTER AZU */ /*2588*/ 0x2c31, 1, 0x2c01, /* GLAGOLITIC CAPITAL LETTER BUKY */ /*2591*/ 0x2c32, 1, 0x2c02, /* GLAGOLITIC CAPITAL LETTER VEDE */ /*2594*/ 0x2c33, 1, 0x2c03, /* GLAGOLITIC CAPITAL LETTER GLAGOLI */ /*2597*/ 0x2c34, 1, 0x2c04, /* GLAGOLITIC CAPITAL LETTER DOBRO */ /*2600*/ 0x2c35, 1, 0x2c05, /* GLAGOLITIC CAPITAL LETTER YESTU */ /*2603*/ 0x2c36, 1, 0x2c06, /* GLAGOLITIC CAPITAL LETTER ZHIVETE */ /*2606*/ 0x2c37, 1, 0x2c07, /* GLAGOLITIC CAPITAL LETTER DZELO */ /*2609*/ 0x2c38, 1, 0x2c08, /* GLAGOLITIC CAPITAL LETTER ZEMLJA */ /*2612*/ 0x2c39, 1, 0x2c09, /* GLAGOLITIC CAPITAL LETTER IZHE */ /*2615*/ 0x2c3a, 1, 0x2c0a, /* GLAGOLITIC CAPITAL LETTER INITIAL.. */ /*2618*/ 0x2c3b, 1, 0x2c0b, /* GLAGOLITIC CAPITAL LETTER I */ /*2621*/ 0x2c3c, 1, 0x2c0c, /* GLAGOLITIC CAPITAL LETTER DJERVI */ /*2624*/ 0x2c3d, 1, 0x2c0d, /* GLAGOLITIC CAPITAL LETTER KAKO */ /*2627*/ 0x2c3e, 1, 0x2c0e, /* GLAGOLITIC CAPITAL LETTER LJUDIJE */ /*2630*/ 0x2c3f, 1, 0x2c0f, /* GLAGOLITIC CAPITAL LETTER MYSLITE */ /*2633*/ 0x2c40, 1, 0x2c10, /* GLAGOLITIC CAPITAL LETTER NASHI */ /*2636*/ 0x2c41, 1, 0x2c11, /* GLAGOLITIC CAPITAL LETTER ONU */ /*2639*/ 0x2c42, 1, 0x2c12, /* GLAGOLITIC CAPITAL LETTER POKOJI */ /*2642*/ 0x2c43, 1, 0x2c13, /* GLAGOLITIC CAPITAL LETTER RITSI */ /*2645*/ 0x2c44, 1, 0x2c14, /* GLAGOLITIC CAPITAL LETTER SLOVO */ /*2648*/ 0x2c45, 1, 0x2c15, /* GLAGOLITIC CAPITAL LETTER TVRIDO */ /*2651*/ 0x2c46, 1, 0x2c16, /* GLAGOLITIC CAPITAL LETTER UKU */ /*2654*/ 0x2c47, 1, 0x2c17, /* GLAGOLITIC CAPITAL LETTER FRITU */ /*2657*/ 0x2c48, 1, 0x2c18, /* GLAGOLITIC CAPITAL LETTER HERU */ /*2660*/ 0x2c49, 1, 0x2c19, /* GLAGOLITIC CAPITAL LETTER OTU */ /*2663*/ 0x2c4a, 1, 0x2c1a, /* GLAGOLITIC CAPITAL LETTER PE */ /*2666*/ 0x2c4b, 1, 0x2c1b, /* GLAGOLITIC CAPITAL LETTER SHTA */ /*2669*/ 0x2c4c, 1, 0x2c1c, /* GLAGOLITIC CAPITAL LETTER TSI */ /*2672*/ 0x2c4d, 1, 0x2c1d, /* GLAGOLITIC CAPITAL LETTER CHRIVI */ /*2675*/ 0x2c4e, 1, 0x2c1e, /* GLAGOLITIC CAPITAL LETTER SHA */ /*2678*/ 0x2c4f, 1, 0x2c1f, /* GLAGOLITIC CAPITAL LETTER YERU */ /*2681*/ 0x2c50, 1, 0x2c20, /* GLAGOLITIC CAPITAL LETTER YERI */ /*2684*/ 0x2c51, 1, 0x2c21, /* GLAGOLITIC CAPITAL LETTER YATI */ /*2687*/ 0x2c52, 1, 0x2c22, /* GLAGOLITIC CAPITAL LETTER SPIDERY.. */ /*2690*/ 0x2c53, 1, 0x2c23, /* GLAGOLITIC CAPITAL LETTER YU */ /*2693*/ 0x2c54, 1, 0x2c24, /* GLAGOLITIC CAPITAL LETTER SMALL Y.. */ /*2696*/ 0x2c55, 1, 0x2c25, /* GLAGOLITIC CAPITAL LETTER SMALL Y.. */ /*2699*/ 0x2c56, 1, 0x2c26, /* GLAGOLITIC CAPITAL LETTER YO */ /*2702*/ 0x2c57, 1, 0x2c27, /* GLAGOLITIC CAPITAL LETTER IOTATED.. */ /*2705*/ 0x2c58, 1, 0x2c28, /* GLAGOLITIC CAPITAL LETTER BIG YUS */ /*2708*/ 0x2c59, 1, 0x2c29, /* GLAGOLITIC CAPITAL LETTER IOTATED.. */ /*2711*/ 0x2c5a, 1, 0x2c2a, /* GLAGOLITIC CAPITAL LETTER FITA */ /*2714*/ 0x2c5b, 1, 0x2c2b, /* GLAGOLITIC CAPITAL LETTER IZHITSA */ /*2717*/ 0x2c5c, 1, 0x2c2c, /* GLAGOLITIC CAPITAL LETTER SHTAPIC */ /*2720*/ 0x2c5d, 1, 0x2c2d, /* GLAGOLITIC CAPITAL LETTER TROKUTA.. */ /*2723*/ 0x2c5e, 1, 0x2c2e, /* GLAGOLITIC CAPITAL LETTER LATINAT.. */ /*2726*/ 0x2c5f, 1, 0x2c2f, /* GLAGOLITIC CAPITAL LETTER CAUDATE.. */ /*2729*/ 0x2c61, 1, 0x2c60, /* LATIN CAPITAL LETTER L WITH DOUBL.. */ /*2732*/ 0x2c65, 1, 0x023a, /* LATIN CAPITAL LETTER A WITH STROKE */ /*2735*/ 0x2c66, 1, 0x023e, /* LATIN CAPITAL LETTER T WITH DIAGO.. */ /*2738*/ 0x2c68, 1, 0x2c67, /* LATIN CAPITAL LETTER H WITH DESCE.. */ /*2741*/ 0x2c6a, 1, 0x2c69, /* LATIN CAPITAL LETTER K WITH DESCE.. */ /*2744*/ 0x2c6c, 1, 0x2c6b, /* LATIN CAPITAL LETTER Z WITH DESCE.. */ /*2747*/ 0x2c73, 1, 0x2c72, /* LATIN CAPITAL LETTER W WITH HOOK */ /*2750*/ 0x2c76, 1, 0x2c75, /* LATIN CAPITAL LETTER HALF H */ /*2753*/ 0x2c81, 1, 0x2c80, /* COPTIC CAPITAL LETTER ALFA */ /*2756*/ 0x2c83, 1, 0x2c82, /* COPTIC CAPITAL LETTER VIDA */ /*2759*/ 0x2c85, 1, 0x2c84, /* COPTIC CAPITAL LETTER GAMMA */ /*2762*/ 0x2c87, 1, 0x2c86, /* COPTIC CAPITAL LETTER DALDA */ /*2765*/ 0x2c89, 1, 0x2c88, /* COPTIC CAPITAL LETTER EIE */ /*2768*/ 0x2c8b, 1, 0x2c8a, /* COPTIC CAPITAL LETTER SOU */ /*2771*/ 0x2c8d, 1, 0x2c8c, /* COPTIC CAPITAL LETTER ZATA */ /*2774*/ 0x2c8f, 1, 0x2c8e, /* COPTIC CAPITAL LETTER HATE */ /*2777*/ 0x2c91, 1, 0x2c90, /* COPTIC CAPITAL LETTER THETHE */ /*2780*/ 0x2c93, 1, 0x2c92, /* COPTIC CAPITAL LETTER IAUDA */ /*2783*/ 0x2c95, 1, 0x2c94, /* COPTIC CAPITAL LETTER KAPA */ /*2786*/ 0x2c97, 1, 0x2c96, /* COPTIC CAPITAL LETTER LAULA */ /*2789*/ 0x2c99, 1, 0x2c98, /* COPTIC CAPITAL LETTER MI */ /*2792*/ 0x2c9b, 1, 0x2c9a, /* COPTIC CAPITAL LETTER NI */ /*2795*/ 0x2c9d, 1, 0x2c9c, /* COPTIC CAPITAL LETTER KSI */ /*2798*/ 0x2c9f, 1, 0x2c9e, /* COPTIC CAPITAL LETTER O */ /*2801*/ 0x2ca1, 1, 0x2ca0, /* COPTIC CAPITAL LETTER PI */ /*2804*/ 0x2ca3, 1, 0x2ca2, /* COPTIC CAPITAL LETTER RO */ /*2807*/ 0x2ca5, 1, 0x2ca4, /* COPTIC CAPITAL LETTER SIMA */ /*2810*/ 0x2ca7, 1, 0x2ca6, /* COPTIC CAPITAL LETTER TAU */ /*2813*/ 0x2ca9, 1, 0x2ca8, /* COPTIC CAPITAL LETTER UA */ /*2816*/ 0x2cab, 1, 0x2caa, /* COPTIC CAPITAL LETTER FI */ /*2819*/ 0x2cad, 1, 0x2cac, /* COPTIC CAPITAL LETTER KHI */ /*2822*/ 0x2caf, 1, 0x2cae, /* COPTIC CAPITAL LETTER PSI */ /*2825*/ 0x2cb1, 1, 0x2cb0, /* COPTIC CAPITAL LETTER OOU */ /*2828*/ 0x2cb3, 1, 0x2cb2, /* COPTIC CAPITAL LETTER DIALECT-P A.. */ /*2831*/ 0x2cb5, 1, 0x2cb4, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2834*/ 0x2cb7, 1, 0x2cb6, /* COPTIC CAPITAL LETTER CRYPTOGRAMM.. */ /*2837*/ 0x2cb9, 1, 0x2cb8, /* COPTIC CAPITAL LETTER DIALECT-P K.. */ /*2840*/ 0x2cbb, 1, 0x2cba, /* COPTIC CAPITAL LETTER DIALECT-P NI */ /*2843*/ 0x2cbd, 1, 0x2cbc, /* COPTIC CAPITAL LETTER CRYPTOGRAMM.. */ /*2846*/ 0x2cbf, 1, 0x2cbe, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2849*/ 0x2cc1, 1, 0x2cc0, /* COPTIC CAPITAL LETTER SAMPI */ /*2852*/ 0x2cc3, 1, 0x2cc2, /* COPTIC CAPITAL LETTER CROSSED SHEI */ /*2855*/ 0x2cc5, 1, 0x2cc4, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2858*/ 0x2cc7, 1, 0x2cc6, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2861*/ 0x2cc9, 1, 0x2cc8, /* COPTIC CAPITAL LETTER AKHMIMIC KH.. */ /*2864*/ 0x2ccb, 1, 0x2cca, /* COPTIC CAPITAL LETTER DIALECT-P H.. */ /*2867*/ 0x2ccd, 1, 0x2ccc, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2870*/ 0x2ccf, 1, 0x2cce, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2873*/ 0x2cd1, 1, 0x2cd0, /* COPTIC CAPITAL LETTER L-SHAPED HA */ /*2876*/ 0x2cd3, 1, 0x2cd2, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2879*/ 0x2cd5, 1, 0x2cd4, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2882*/ 0x2cd7, 1, 0x2cd6, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2885*/ 0x2cd9, 1, 0x2cd8, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2888*/ 0x2cdb, 1, 0x2cda, /* COPTIC CAPITAL LETTER OLD COPTIC .. */ /*2891*/ 0x2cdd, 1, 0x2cdc, /* COPTIC CAPITAL LETTER OLD NUBIAN .. */ /*2894*/ 0x2cdf, 1, 0x2cde, /* COPTIC CAPITAL LETTER OLD NUBIAN .. */ /*2897*/ 0x2ce1, 1, 0x2ce0, /* COPTIC CAPITAL LETTER OLD NUBIAN .. */ /*2900*/ 0x2ce3, 1, 0x2ce2, /* COPTIC CAPITAL LETTER OLD NUBIAN .. */ /*2903*/ 0x2cec, 1, 0x2ceb, /* COPTIC CAPITAL LETTER CRYPTOGRAMM.. */ /*2906*/ 0x2cee, 1, 0x2ced, /* COPTIC CAPITAL LETTER CRYPTOGRAMM.. */ /*2909*/ 0x2cf3, 1, 0x2cf2, /* COPTIC CAPITAL LETTER BOHAIRIC KH.. */ /*2912*/ 0x2d00, 1, 0x10a0, /* GEORGIAN CAPITAL LETTER AN */ /*2915*/ 0x2d01, 1, 0x10a1, /* GEORGIAN CAPITAL LETTER BAN */ /*2918*/ 0x2d02, 1, 0x10a2, /* GEORGIAN CAPITAL LETTER GAN */ /*2921*/ 0x2d03, 1, 0x10a3, /* GEORGIAN CAPITAL LETTER DON */ /*2924*/ 0x2d04, 1, 0x10a4, /* GEORGIAN CAPITAL LETTER EN */ /*2927*/ 0x2d05, 1, 0x10a5, /* GEORGIAN CAPITAL LETTER VIN */ /*2930*/ 0x2d06, 1, 0x10a6, /* GEORGIAN CAPITAL LETTER ZEN */ /*2933*/ 0x2d07, 1, 0x10a7, /* GEORGIAN CAPITAL LETTER TAN */ /*2936*/ 0x2d08, 1, 0x10a8, /* GEORGIAN CAPITAL LETTER IN */ /*2939*/ 0x2d09, 1, 0x10a9, /* GEORGIAN CAPITAL LETTER KAN */ /*2942*/ 0x2d0a, 1, 0x10aa, /* GEORGIAN CAPITAL LETTER LAS */ /*2945*/ 0x2d0b, 1, 0x10ab, /* GEORGIAN CAPITAL LETTER MAN */ /*2948*/ 0x2d0c, 1, 0x10ac, /* GEORGIAN CAPITAL LETTER NAR */ /*2951*/ 0x2d0d, 1, 0x10ad, /* GEORGIAN CAPITAL LETTER ON */ /*2954*/ 0x2d0e, 1, 0x10ae, /* GEORGIAN CAPITAL LETTER PAR */ /*2957*/ 0x2d0f, 1, 0x10af, /* GEORGIAN CAPITAL LETTER ZHAR */ /*2960*/ 0x2d10, 1, 0x10b0, /* GEORGIAN CAPITAL LETTER RAE */ /*2963*/ 0x2d11, 1, 0x10b1, /* GEORGIAN CAPITAL LETTER SAN */ /*2966*/ 0x2d12, 1, 0x10b2, /* GEORGIAN CAPITAL LETTER TAR */ /*2969*/ 0x2d13, 1, 0x10b3, /* GEORGIAN CAPITAL LETTER UN */ /*2972*/ 0x2d14, 1, 0x10b4, /* GEORGIAN CAPITAL LETTER PHAR */ /*2975*/ 0x2d15, 1, 0x10b5, /* GEORGIAN CAPITAL LETTER KHAR */ /*2978*/ 0x2d16, 1, 0x10b6, /* GEORGIAN CAPITAL LETTER GHAN */ /*2981*/ 0x2d17, 1, 0x10b7, /* GEORGIAN CAPITAL LETTER QAR */ /*2984*/ 0x2d18, 1, 0x10b8, /* GEORGIAN CAPITAL LETTER SHIN */ /*2987*/ 0x2d19, 1, 0x10b9, /* GEORGIAN CAPITAL LETTER CHIN */ /*2990*/ 0x2d1a, 1, 0x10ba, /* GEORGIAN CAPITAL LETTER CAN */ /*2993*/ 0x2d1b, 1, 0x10bb, /* GEORGIAN CAPITAL LETTER JIL */ /*2996*/ 0x2d1c, 1, 0x10bc, /* GEORGIAN CAPITAL LETTER CIL */ /*2999*/ 0x2d1d, 1, 0x10bd, /* GEORGIAN CAPITAL LETTER CHAR */ /*3002*/ 0x2d1e, 1, 0x10be, /* GEORGIAN CAPITAL LETTER XAN */ /*3005*/ 0x2d1f, 1, 0x10bf, /* GEORGIAN CAPITAL LETTER JHAN */ /*3008*/ 0x2d20, 1, 0x10c0, /* GEORGIAN CAPITAL LETTER HAE */ /*3011*/ 0x2d21, 1, 0x10c1, /* GEORGIAN CAPITAL LETTER HE */ /*3014*/ 0x2d22, 1, 0x10c2, /* GEORGIAN CAPITAL LETTER HIE */ /*3017*/ 0x2d23, 1, 0x10c3, /* GEORGIAN CAPITAL LETTER WE */ /*3020*/ 0x2d24, 1, 0x10c4, /* GEORGIAN CAPITAL LETTER HAR */ /*3023*/ 0x2d25, 1, 0x10c5, /* GEORGIAN CAPITAL LETTER HOE */ /*3026*/ 0x2d27, 1, 0x10c7, /* GEORGIAN CAPITAL LETTER YN */ /*3029*/ 0x2d2d, 1, 0x10cd, /* GEORGIAN CAPITAL LETTER AEN */ /*3032*/ 0xa641, 1, 0xa640, /* CYRILLIC CAPITAL LETTER ZEMLYA */ /*3035*/ 0xa643, 1, 0xa642, /* CYRILLIC CAPITAL LETTER DZELO */ /*3038*/ 0xa645, 1, 0xa644, /* CYRILLIC CAPITAL LETTER REVERSED .. */ /*3041*/ 0xa647, 1, 0xa646, /* CYRILLIC CAPITAL LETTER IOTA */ /*3044*/ 0xa649, 1, 0xa648, /* CYRILLIC CAPITAL LETTER DJERV */ /*3047*/ 0xa64b, 2, 0x1c88, 0xa64a, /* CYRILLIC SMALL LETTER UNBLENDED UK */ /*3051*/ 0xa64d, 1, 0xa64c, /* CYRILLIC CAPITAL LETTER BROAD OME.. */ /*3054*/ 0xa64f, 1, 0xa64e, /* CYRILLIC CAPITAL LETTER NEUTRAL Y.. */ /*3057*/ 0xa651, 1, 0xa650, /* CYRILLIC CAPITAL LETTER YERU WITH.. */ /*3060*/ 0xa653, 1, 0xa652, /* CYRILLIC CAPITAL LETTER IOTIFIED .. */ /*3063*/ 0xa655, 1, 0xa654, /* CYRILLIC CAPITAL LETTER REVERSED .. */ /*3066*/ 0xa657, 1, 0xa656, /* CYRILLIC CAPITAL LETTER IOTIFIED A */ /*3069*/ 0xa659, 1, 0xa658, /* CYRILLIC CAPITAL LETTER CLOSED LI.. */ /*3072*/ 0xa65b, 1, 0xa65a, /* CYRILLIC CAPITAL LETTER BLENDED Y.. */ /*3075*/ 0xa65d, 1, 0xa65c, /* CYRILLIC CAPITAL LETTER IOTIFIED .. */ /*3078*/ 0xa65f, 1, 0xa65e, /* CYRILLIC CAPITAL LETTER YN */ /*3081*/ 0xa661, 1, 0xa660, /* CYRILLIC CAPITAL LETTER REVERSED .. */ /*3084*/ 0xa663, 1, 0xa662, /* CYRILLIC CAPITAL LETTER SOFT DE */ /*3087*/ 0xa665, 1, 0xa664, /* CYRILLIC CAPITAL LETTER SOFT EL */ /*3090*/ 0xa667, 1, 0xa666, /* CYRILLIC CAPITAL LETTER SOFT EM */ /*3093*/ 0xa669, 1, 0xa668, /* CYRILLIC CAPITAL LETTER MONOCULAR.. */ /*3096*/ 0xa66b, 1, 0xa66a, /* CYRILLIC CAPITAL LETTER BINOCULAR.. */ /*3099*/ 0xa66d, 1, 0xa66c, /* CYRILLIC CAPITAL LETTER DOUBLE MO.. */ /*3102*/ 0xa681, 1, 0xa680, /* CYRILLIC CAPITAL LETTER DWE */ /*3105*/ 0xa683, 1, 0xa682, /* CYRILLIC CAPITAL LETTER DZWE */ /*3108*/ 0xa685, 1, 0xa684, /* CYRILLIC CAPITAL LETTER ZHWE */ /*3111*/ 0xa687, 1, 0xa686, /* CYRILLIC CAPITAL LETTER CCHE */ /*3114*/ 0xa689, 1, 0xa688, /* CYRILLIC CAPITAL LETTER DZZE */ /*3117*/ 0xa68b, 1, 0xa68a, /* CYRILLIC CAPITAL LETTER TE WITH M.. */ /*3120*/ 0xa68d, 1, 0xa68c, /* CYRILLIC CAPITAL LETTER TWE */ /*3123*/ 0xa68f, 1, 0xa68e, /* CYRILLIC CAPITAL LETTER TSWE */ /*3126*/ 0xa691, 1, 0xa690, /* CYRILLIC CAPITAL LETTER TSSE */ /*3129*/ 0xa693, 1, 0xa692, /* CYRILLIC CAPITAL LETTER TCHE */ /*3132*/ 0xa695, 1, 0xa694, /* CYRILLIC CAPITAL LETTER HWE */ /*3135*/ 0xa697, 1, 0xa696, /* CYRILLIC CAPITAL LETTER SHWE */ /*3138*/ 0xa699, 1, 0xa698, /* CYRILLIC CAPITAL LETTER DOUBLE O */ /*3141*/ 0xa69b, 1, 0xa69a, /* CYRILLIC CAPITAL LETTER CROSSED O */ /*3144*/ 0xa723, 1, 0xa722, /* LATIN CAPITAL LETTER EGYPTOLOGICA.. */ /*3147*/ 0xa725, 1, 0xa724, /* LATIN CAPITAL LETTER EGYPTOLOGICA.. */ /*3150*/ 0xa727, 1, 0xa726, /* LATIN CAPITAL LETTER HENG */ /*3153*/ 0xa729, 1, 0xa728, /* LATIN CAPITAL LETTER TZ */ /*3156*/ 0xa72b, 1, 0xa72a, /* LATIN CAPITAL LETTER TRESILLO */ /*3159*/ 0xa72d, 1, 0xa72c, /* LATIN CAPITAL LETTER CUATRILLO */ /*3162*/ 0xa72f, 1, 0xa72e, /* LATIN CAPITAL LETTER CUATRILLO WI.. */ /*3165*/ 0xa733, 1, 0xa732, /* LATIN CAPITAL LETTER AA */ /*3168*/ 0xa735, 1, 0xa734, /* LATIN CAPITAL LETTER AO */ /*3171*/ 0xa737, 1, 0xa736, /* LATIN CAPITAL LETTER AU */ /*3174*/ 0xa739, 1, 0xa738, /* LATIN CAPITAL LETTER AV */ /*3177*/ 0xa73b, 1, 0xa73a, /* LATIN CAPITAL LETTER AV WITH HORI.. */ /*3180*/ 0xa73d, 1, 0xa73c, /* LATIN CAPITAL LETTER AY */ /*3183*/ 0xa73f, 1, 0xa73e, /* LATIN CAPITAL LETTER REVERSED C W.. */ /*3186*/ 0xa741, 1, 0xa740, /* LATIN CAPITAL LETTER K WITH STROKE */ /*3189*/ 0xa743, 1, 0xa742, /* LATIN CAPITAL LETTER K WITH DIAGO.. */ /*3192*/ 0xa745, 1, 0xa744, /* LATIN CAPITAL LETTER K WITH STROK.. */ /*3195*/ 0xa747, 1, 0xa746, /* LATIN CAPITAL LETTER BROKEN L */ /*3198*/ 0xa749, 1, 0xa748, /* LATIN CAPITAL LETTER L WITH HIGH .. */ /*3201*/ 0xa74b, 1, 0xa74a, /* LATIN CAPITAL LETTER O WITH LONG .. */ /*3204*/ 0xa74d, 1, 0xa74c, /* LATIN CAPITAL LETTER O WITH LOOP */ /*3207*/ 0xa74f, 1, 0xa74e, /* LATIN CAPITAL LETTER OO */ /*3210*/ 0xa751, 1, 0xa750, /* LATIN CAPITAL LETTER P WITH STROK.. */ /*3213*/ 0xa753, 1, 0xa752, /* LATIN CAPITAL LETTER P WITH FLOUR.. */ /*3216*/ 0xa755, 1, 0xa754, /* LATIN CAPITAL LETTER P WITH SQUIR.. */ /*3219*/ 0xa757, 1, 0xa756, /* LATIN CAPITAL LETTER Q WITH STROK.. */ /*3222*/ 0xa759, 1, 0xa758, /* LATIN CAPITAL LETTER Q WITH DIAGO.. */ /*3225*/ 0xa75b, 1, 0xa75a, /* LATIN CAPITAL LETTER R ROTUNDA */ /*3228*/ 0xa75d, 1, 0xa75c, /* LATIN CAPITAL LETTER RUM ROTUNDA */ /*3231*/ 0xa75f, 1, 0xa75e, /* LATIN CAPITAL LETTER V WITH DIAGO.. */ /*3234*/ 0xa761, 1, 0xa760, /* LATIN CAPITAL LETTER VY */ /*3237*/ 0xa763, 1, 0xa762, /* LATIN CAPITAL LETTER VISIGOTHIC Z */ /*3240*/ 0xa765, 1, 0xa764, /* LATIN CAPITAL LETTER THORN WITH S.. */ /*3243*/ 0xa767, 1, 0xa766, /* LATIN CAPITAL LETTER THORN WITH S.. */ /*3246*/ 0xa769, 1, 0xa768, /* LATIN CAPITAL LETTER VEND */ /*3249*/ 0xa76b, 1, 0xa76a, /* LATIN CAPITAL LETTER ET */ /*3252*/ 0xa76d, 1, 0xa76c, /* LATIN CAPITAL LETTER IS */ /*3255*/ 0xa76f, 1, 0xa76e, /* LATIN CAPITAL LETTER CON */ /*3258*/ 0xa77a, 1, 0xa779, /* LATIN CAPITAL LETTER INSULAR D */ /*3261*/ 0xa77c, 1, 0xa77b, /* LATIN CAPITAL LETTER INSULAR F */ /*3264*/ 0xa77f, 1, 0xa77e, /* LATIN CAPITAL LETTER TURNED INSUL.. */ /*3267*/ 0xa781, 1, 0xa780, /* LATIN CAPITAL LETTER TURNED L */ /*3270*/ 0xa783, 1, 0xa782, /* LATIN CAPITAL LETTER INSULAR R */ /*3273*/ 0xa785, 1, 0xa784, /* LATIN CAPITAL LETTER INSULAR S */ /*3276*/ 0xa787, 1, 0xa786, /* LATIN CAPITAL LETTER INSULAR T */ /*3279*/ 0xa78c, 1, 0xa78b, /* LATIN CAPITAL LETTER SALTILLO */ /*3282*/ 0xa791, 1, 0xa790, /* LATIN CAPITAL LETTER N WITH DESCE.. */ /*3285*/ 0xa793, 1, 0xa792, /* LATIN CAPITAL LETTER C WITH BAR */ /*3288*/ 0xa794, 1, 0xa7c4, /* LATIN CAPITAL LETTER C WITH PALAT.. */ /*3291*/ 0xa797, 1, 0xa796, /* LATIN CAPITAL LETTER B WITH FLOUR.. */ /*3294*/ 0xa799, 1, 0xa798, /* LATIN CAPITAL LETTER F WITH STROKE */ /*3297*/ 0xa79b, 1, 0xa79a, /* LATIN CAPITAL LETTER VOLAPUK AE */ /*3300*/ 0xa79d, 1, 0xa79c, /* LATIN CAPITAL LETTER VOLAPUK OE */ /*3303*/ 0xa79f, 1, 0xa79e, /* LATIN CAPITAL LETTER VOLAPUK UE */ /*3306*/ 0xa7a1, 1, 0xa7a0, /* LATIN CAPITAL LETTER G WITH OBLIQ.. */ /*3309*/ 0xa7a3, 1, 0xa7a2, /* LATIN CAPITAL LETTER K WITH OBLIQ.. */ /*3312*/ 0xa7a5, 1, 0xa7a4, /* LATIN CAPITAL LETTER N WITH OBLIQ.. */ /*3315*/ 0xa7a7, 1, 0xa7a6, /* LATIN CAPITAL LETTER R WITH OBLIQ.. */ /*3318*/ 0xa7a9, 1, 0xa7a8, /* LATIN CAPITAL LETTER S WITH OBLIQ.. */ /*3321*/ 0xa7b5, 1, 0xa7b4, /* LATIN CAPITAL LETTER BETA */ /*3324*/ 0xa7b7, 1, 0xa7b6, /* LATIN CAPITAL LETTER OMEGA */ /*3327*/ 0xa7b9, 1, 0xa7b8, /* LATIN CAPITAL LETTER U WITH STROKE */ /*3330*/ 0xa7bb, 1, 0xa7ba, /* LATIN CAPITAL LETTER GLOTTAL A */ /*3333*/ 0xa7bd, 1, 0xa7bc, /* LATIN CAPITAL LETTER GLOTTAL I */ /*3336*/ 0xa7bf, 1, 0xa7be, /* LATIN CAPITAL LETTER GLOTTAL U */ /*3339*/ 0xa7c1, 1, 0xa7c0, /* LATIN CAPITAL LETTER OLD POLISH O */ /*3342*/ 0xa7c3, 1, 0xa7c2, /* LATIN CAPITAL LETTER ANGLICANA W */ /*3345*/ 0xa7c8, 1, 0xa7c7, /* LATIN CAPITAL LETTER D WITH SHORT.. */ /*3348*/ 0xa7ca, 1, 0xa7c9, /* LATIN CAPITAL LETTER S WITH SHORT.. */ /*3351*/ 0xa7cd, 1, 0xa7cc, /* LATIN CAPITAL LETTER S WITH DIAGO.. */ /*3354*/ 0xa7d1, 1, 0xa7d0, /* LATIN CAPITAL LETTER CLOSED INSUL.. */ /*3357*/ 0xa7d7, 1, 0xa7d6, /* LATIN CAPITAL LETTER MIDDLE SCOTS.. */ /*3360*/ 0xa7d9, 1, 0xa7d8, /* LATIN CAPITAL LETTER SIGMOID S */ /*3363*/ 0xa7db, 1, 0xa7da, /* LATIN CAPITAL LETTER LAMBDA */ /*3366*/ 0xa7f6, 1, 0xa7f5, /* LATIN CAPITAL LETTER REVERSED HAL.. */ /*3369*/ 0xab53, 1, 0xa7b3, /* LATIN CAPITAL LETTER CHI */ /*3372*/ 0xff41, 1, 0xff21, /* FULLWIDTH LATIN CAPITAL LETTER A */ /*3375*/ 0xff42, 1, 0xff22, /* FULLWIDTH LATIN CAPITAL LETTER B */ /*3378*/ 0xff43, 1, 0xff23, /* FULLWIDTH LATIN CAPITAL LETTER C */ /*3381*/ 0xff44, 1, 0xff24, /* FULLWIDTH LATIN CAPITAL LETTER D */ /*3384*/ 0xff45, 1, 0xff25, /* FULLWIDTH LATIN CAPITAL LETTER E */ /*3387*/ 0xff46, 1, 0xff26, /* FULLWIDTH LATIN CAPITAL LETTER F */ /*3390*/ 0xff47, 1, 0xff27, /* FULLWIDTH LATIN CAPITAL LETTER G */ /*3393*/ 0xff48, 1, 0xff28, /* FULLWIDTH LATIN CAPITAL LETTER H */ /*3396*/ 0xff49, 1, 0xff29, /* FULLWIDTH LATIN CAPITAL LETTER I */ /*3399*/ 0xff4a, 1, 0xff2a, /* FULLWIDTH LATIN CAPITAL LETTER J */ /*3402*/ 0xff4b, 1, 0xff2b, /* FULLWIDTH LATIN CAPITAL LETTER K */ /*3405*/ 0xff4c, 1, 0xff2c, /* FULLWIDTH LATIN CAPITAL LETTER L */ /*3408*/ 0xff4d, 1, 0xff2d, /* FULLWIDTH LATIN CAPITAL LETTER M */ /*3411*/ 0xff4e, 1, 0xff2e, /* FULLWIDTH LATIN CAPITAL LETTER N */ /*3414*/ 0xff4f, 1, 0xff2f, /* FULLWIDTH LATIN CAPITAL LETTER O */ /*3417*/ 0xff50, 1, 0xff30, /* FULLWIDTH LATIN CAPITAL LETTER P */ /*3420*/ 0xff51, 1, 0xff31, /* FULLWIDTH LATIN CAPITAL LETTER Q */ /*3423*/ 0xff52, 1, 0xff32, /* FULLWIDTH LATIN CAPITAL LETTER R */ /*3426*/ 0xff53, 1, 0xff33, /* FULLWIDTH LATIN CAPITAL LETTER S */ /*3429*/ 0xff54, 1, 0xff34, /* FULLWIDTH LATIN CAPITAL LETTER T */ /*3432*/ 0xff55, 1, 0xff35, /* FULLWIDTH LATIN CAPITAL LETTER U */ /*3435*/ 0xff56, 1, 0xff36, /* FULLWIDTH LATIN CAPITAL LETTER V */ /*3438*/ 0xff57, 1, 0xff37, /* FULLWIDTH LATIN CAPITAL LETTER W */ /*3441*/ 0xff58, 1, 0xff38, /* FULLWIDTH LATIN CAPITAL LETTER X */ /*3444*/ 0xff59, 1, 0xff39, /* FULLWIDTH LATIN CAPITAL LETTER Y */ /*3447*/ 0xff5a, 1, 0xff3a, /* FULLWIDTH LATIN CAPITAL LETTER Z */ /*3450*/ 0x010428, 1, 0x010400, /* DESERET CAPITAL LETTER LONG I */ /*3453*/ 0x010429, 1, 0x010401, /* DESERET CAPITAL LETTER LONG E */ /*3456*/ 0x01042a, 1, 0x010402, /* DESERET CAPITAL LETTER LONG A */ /*3459*/ 0x01042b, 1, 0x010403, /* DESERET CAPITAL LETTER LONG AH */ /*3462*/ 0x01042c, 1, 0x010404, /* DESERET CAPITAL LETTER LONG O */ /*3465*/ 0x01042d, 1, 0x010405, /* DESERET CAPITAL LETTER LONG OO */ /*3468*/ 0x01042e, 1, 0x010406, /* DESERET CAPITAL LETTER SHORT I */ /*3471*/ 0x01042f, 1, 0x010407, /* DESERET CAPITAL LETTER SHORT E */ /*3474*/ 0x010430, 1, 0x010408, /* DESERET CAPITAL LETTER SHORT A */ /*3477*/ 0x010431, 1, 0x010409, /* DESERET CAPITAL LETTER SHORT AH */ /*3480*/ 0x010432, 1, 0x01040a, /* DESERET CAPITAL LETTER SHORT O */ /*3483*/ 0x010433, 1, 0x01040b, /* DESERET CAPITAL LETTER SHORT OO */ /*3486*/ 0x010434, 1, 0x01040c, /* DESERET CAPITAL LETTER AY */ /*3489*/ 0x010435, 1, 0x01040d, /* DESERET CAPITAL LETTER OW */ /*3492*/ 0x010436, 1, 0x01040e, /* DESERET CAPITAL LETTER WU */ /*3495*/ 0x010437, 1, 0x01040f, /* DESERET CAPITAL LETTER YEE */ /*3498*/ 0x010438, 1, 0x010410, /* DESERET CAPITAL LETTER H */ /*3501*/ 0x010439, 1, 0x010411, /* DESERET CAPITAL LETTER PEE */ /*3504*/ 0x01043a, 1, 0x010412, /* DESERET CAPITAL LETTER BEE */ /*3507*/ 0x01043b, 1, 0x010413, /* DESERET CAPITAL LETTER TEE */ /*3510*/ 0x01043c, 1, 0x010414, /* DESERET CAPITAL LETTER DEE */ /*3513*/ 0x01043d, 1, 0x010415, /* DESERET CAPITAL LETTER CHEE */ /*3516*/ 0x01043e, 1, 0x010416, /* DESERET CAPITAL LETTER JEE */ /*3519*/ 0x01043f, 1, 0x010417, /* DESERET CAPITAL LETTER KAY */ /*3522*/ 0x010440, 1, 0x010418, /* DESERET CAPITAL LETTER GAY */ /*3525*/ 0x010441, 1, 0x010419, /* DESERET CAPITAL LETTER EF */ /*3528*/ 0x010442, 1, 0x01041a, /* DESERET CAPITAL LETTER VEE */ /*3531*/ 0x010443, 1, 0x01041b, /* DESERET CAPITAL LETTER ETH */ /*3534*/ 0x010444, 1, 0x01041c, /* DESERET CAPITAL LETTER THEE */ /*3537*/ 0x010445, 1, 0x01041d, /* DESERET CAPITAL LETTER ES */ /*3540*/ 0x010446, 1, 0x01041e, /* DESERET CAPITAL LETTER ZEE */ /*3543*/ 0x010447, 1, 0x01041f, /* DESERET CAPITAL LETTER ESH */ /*3546*/ 0x010448, 1, 0x010420, /* DESERET CAPITAL LETTER ZHEE */ /*3549*/ 0x010449, 1, 0x010421, /* DESERET CAPITAL LETTER ER */ /*3552*/ 0x01044a, 1, 0x010422, /* DESERET CAPITAL LETTER EL */ /*3555*/ 0x01044b, 1, 0x010423, /* DESERET CAPITAL LETTER EM */ /*3558*/ 0x01044c, 1, 0x010424, /* DESERET CAPITAL LETTER EN */ /*3561*/ 0x01044d, 1, 0x010425, /* DESERET CAPITAL LETTER ENG */ /*3564*/ 0x01044e, 1, 0x010426, /* DESERET CAPITAL LETTER OI */ /*3567*/ 0x01044f, 1, 0x010427, /* DESERET CAPITAL LETTER EW */ /*3570*/ 0x0104d8, 1, 0x0104b0, /* OSAGE CAPITAL LETTER A */ /*3573*/ 0x0104d9, 1, 0x0104b1, /* OSAGE CAPITAL LETTER AI */ /*3576*/ 0x0104da, 1, 0x0104b2, /* OSAGE CAPITAL LETTER AIN */ /*3579*/ 0x0104db, 1, 0x0104b3, /* OSAGE CAPITAL LETTER AH */ /*3582*/ 0x0104dc, 1, 0x0104b4, /* OSAGE CAPITAL LETTER BRA */ /*3585*/ 0x0104dd, 1, 0x0104b5, /* OSAGE CAPITAL LETTER CHA */ /*3588*/ 0x0104de, 1, 0x0104b6, /* OSAGE CAPITAL LETTER EHCHA */ /*3591*/ 0x0104df, 1, 0x0104b7, /* OSAGE CAPITAL LETTER E */ /*3594*/ 0x0104e0, 1, 0x0104b8, /* OSAGE CAPITAL LETTER EIN */ /*3597*/ 0x0104e1, 1, 0x0104b9, /* OSAGE CAPITAL LETTER HA */ /*3600*/ 0x0104e2, 1, 0x0104ba, /* OSAGE CAPITAL LETTER HYA */ /*3603*/ 0x0104e3, 1, 0x0104bb, /* OSAGE CAPITAL LETTER I */ /*3606*/ 0x0104e4, 1, 0x0104bc, /* OSAGE CAPITAL LETTER KA */ /*3609*/ 0x0104e5, 1, 0x0104bd, /* OSAGE CAPITAL LETTER EHKA */ /*3612*/ 0x0104e6, 1, 0x0104be, /* OSAGE CAPITAL LETTER KYA */ /*3615*/ 0x0104e7, 1, 0x0104bf, /* OSAGE CAPITAL LETTER LA */ /*3618*/ 0x0104e8, 1, 0x0104c0, /* OSAGE CAPITAL LETTER MA */ /*3621*/ 0x0104e9, 1, 0x0104c1, /* OSAGE CAPITAL LETTER NA */ /*3624*/ 0x0104ea, 1, 0x0104c2, /* OSAGE CAPITAL LETTER O */ /*3627*/ 0x0104eb, 1, 0x0104c3, /* OSAGE CAPITAL LETTER OIN */ /*3630*/ 0x0104ec, 1, 0x0104c4, /* OSAGE CAPITAL LETTER PA */ /*3633*/ 0x0104ed, 1, 0x0104c5, /* OSAGE CAPITAL LETTER EHPA */ /*3636*/ 0x0104ee, 1, 0x0104c6, /* OSAGE CAPITAL LETTER SA */ /*3639*/ 0x0104ef, 1, 0x0104c7, /* OSAGE CAPITAL LETTER SHA */ /*3642*/ 0x0104f0, 1, 0x0104c8, /* OSAGE CAPITAL LETTER TA */ /*3645*/ 0x0104f1, 1, 0x0104c9, /* OSAGE CAPITAL LETTER EHTA */ /*3648*/ 0x0104f2, 1, 0x0104ca, /* OSAGE CAPITAL LETTER TSA */ /*3651*/ 0x0104f3, 1, 0x0104cb, /* OSAGE CAPITAL LETTER EHTSA */ /*3654*/ 0x0104f4, 1, 0x0104cc, /* OSAGE CAPITAL LETTER TSHA */ /*3657*/ 0x0104f5, 1, 0x0104cd, /* OSAGE CAPITAL LETTER DHA */ /*3660*/ 0x0104f6, 1, 0x0104ce, /* OSAGE CAPITAL LETTER U */ /*3663*/ 0x0104f7, 1, 0x0104cf, /* OSAGE CAPITAL LETTER WA */ /*3666*/ 0x0104f8, 1, 0x0104d0, /* OSAGE CAPITAL LETTER KHA */ /*3669*/ 0x0104f9, 1, 0x0104d1, /* OSAGE CAPITAL LETTER GHA */ /*3672*/ 0x0104fa, 1, 0x0104d2, /* OSAGE CAPITAL LETTER ZA */ /*3675*/ 0x0104fb, 1, 0x0104d3, /* OSAGE CAPITAL LETTER ZHA */ /*3678*/ 0x010597, 1, 0x010570, /* VITHKUQI CAPITAL LETTER A */ /*3681*/ 0x010598, 1, 0x010571, /* VITHKUQI CAPITAL LETTER BBE */ /*3684*/ 0x010599, 1, 0x010572, /* VITHKUQI CAPITAL LETTER BE */ /*3687*/ 0x01059a, 1, 0x010573, /* VITHKUQI CAPITAL LETTER CE */ /*3690*/ 0x01059b, 1, 0x010574, /* VITHKUQI CAPITAL LETTER CHE */ /*3693*/ 0x01059c, 1, 0x010575, /* VITHKUQI CAPITAL LETTER DE */ /*3696*/ 0x01059d, 1, 0x010576, /* VITHKUQI CAPITAL LETTER DHE */ /*3699*/ 0x01059e, 1, 0x010577, /* VITHKUQI CAPITAL LETTER EI */ /*3702*/ 0x01059f, 1, 0x010578, /* VITHKUQI CAPITAL LETTER E */ /*3705*/ 0x0105a0, 1, 0x010579, /* VITHKUQI CAPITAL LETTER FE */ /*3708*/ 0x0105a1, 1, 0x01057a, /* VITHKUQI CAPITAL LETTER GA */ /*3711*/ 0x0105a3, 1, 0x01057c, /* VITHKUQI CAPITAL LETTER HA */ /*3714*/ 0x0105a4, 1, 0x01057d, /* VITHKUQI CAPITAL LETTER HHA */ /*3717*/ 0x0105a5, 1, 0x01057e, /* VITHKUQI CAPITAL LETTER I */ /*3720*/ 0x0105a6, 1, 0x01057f, /* VITHKUQI CAPITAL LETTER IJE */ /*3723*/ 0x0105a7, 1, 0x010580, /* VITHKUQI CAPITAL LETTER JE */ /*3726*/ 0x0105a8, 1, 0x010581, /* VITHKUQI CAPITAL LETTER KA */ /*3729*/ 0x0105a9, 1, 0x010582, /* VITHKUQI CAPITAL LETTER LA */ /*3732*/ 0x0105aa, 1, 0x010583, /* VITHKUQI CAPITAL LETTER LLA */ /*3735*/ 0x0105ab, 1, 0x010584, /* VITHKUQI CAPITAL LETTER ME */ /*3738*/ 0x0105ac, 1, 0x010585, /* VITHKUQI CAPITAL LETTER NE */ /*3741*/ 0x0105ad, 1, 0x010586, /* VITHKUQI CAPITAL LETTER NJE */ /*3744*/ 0x0105ae, 1, 0x010587, /* VITHKUQI CAPITAL LETTER O */ /*3747*/ 0x0105af, 1, 0x010588, /* VITHKUQI CAPITAL LETTER PE */ /*3750*/ 0x0105b0, 1, 0x010589, /* VITHKUQI CAPITAL LETTER QA */ /*3753*/ 0x0105b1, 1, 0x01058a, /* VITHKUQI CAPITAL LETTER RE */ /*3756*/ 0x0105b3, 1, 0x01058c, /* VITHKUQI CAPITAL LETTER SE */ /*3759*/ 0x0105b4, 1, 0x01058d, /* VITHKUQI CAPITAL LETTER SHE */ /*3762*/ 0x0105b5, 1, 0x01058e, /* VITHKUQI CAPITAL LETTER TE */ /*3765*/ 0x0105b6, 1, 0x01058f, /* VITHKUQI CAPITAL LETTER THE */ /*3768*/ 0x0105b7, 1, 0x010590, /* VITHKUQI CAPITAL LETTER U */ /*3771*/ 0x0105b8, 1, 0x010591, /* VITHKUQI CAPITAL LETTER VE */ /*3774*/ 0x0105b9, 1, 0x010592, /* VITHKUQI CAPITAL LETTER XE */ /*3777*/ 0x0105bb, 1, 0x010594, /* VITHKUQI CAPITAL LETTER Y */ /*3780*/ 0x0105bc, 1, 0x010595, /* VITHKUQI CAPITAL LETTER ZE */ /*3783*/ 0x010cc0, 1, 0x010c80, /* OLD HUNGARIAN CAPITAL LETTER A */ /*3786*/ 0x010cc1, 1, 0x010c81, /* OLD HUNGARIAN CAPITAL LETTER AA */ /*3789*/ 0x010cc2, 1, 0x010c82, /* OLD HUNGARIAN CAPITAL LETTER EB */ /*3792*/ 0x010cc3, 1, 0x010c83, /* OLD HUNGARIAN CAPITAL LETTER AMB */ /*3795*/ 0x010cc4, 1, 0x010c84, /* OLD HUNGARIAN CAPITAL LETTER EC */ /*3798*/ 0x010cc5, 1, 0x010c85, /* OLD HUNGARIAN CAPITAL LETTER ENC */ /*3801*/ 0x010cc6, 1, 0x010c86, /* OLD HUNGARIAN CAPITAL LETTER ECS */ /*3804*/ 0x010cc7, 1, 0x010c87, /* OLD HUNGARIAN CAPITAL LETTER ED */ /*3807*/ 0x010cc8, 1, 0x010c88, /* OLD HUNGARIAN CAPITAL LETTER AND */ /*3810*/ 0x010cc9, 1, 0x010c89, /* OLD HUNGARIAN CAPITAL LETTER E */ /*3813*/ 0x010cca, 1, 0x010c8a, /* OLD HUNGARIAN CAPITAL LETTER CLOS.. */ /*3816*/ 0x010ccb, 1, 0x010c8b, /* OLD HUNGARIAN CAPITAL LETTER EE */ /*3819*/ 0x010ccc, 1, 0x010c8c, /* OLD HUNGARIAN CAPITAL LETTER EF */ /*3822*/ 0x010ccd, 1, 0x010c8d, /* OLD HUNGARIAN CAPITAL LETTER EG */ /*3825*/ 0x010cce, 1, 0x010c8e, /* OLD HUNGARIAN CAPITAL LETTER EGY */ /*3828*/ 0x010ccf, 1, 0x010c8f, /* OLD HUNGARIAN CAPITAL LETTER EH */ /*3831*/ 0x010cd0, 1, 0x010c90, /* OLD HUNGARIAN CAPITAL LETTER I */ /*3834*/ 0x010cd1, 1, 0x010c91, /* OLD HUNGARIAN CAPITAL LETTER II */ /*3837*/ 0x010cd2, 1, 0x010c92, /* OLD HUNGARIAN CAPITAL LETTER EJ */ /*3840*/ 0x010cd3, 1, 0x010c93, /* OLD HUNGARIAN CAPITAL LETTER EK */ /*3843*/ 0x010cd4, 1, 0x010c94, /* OLD HUNGARIAN CAPITAL LETTER AK */ /*3846*/ 0x010cd5, 1, 0x010c95, /* OLD HUNGARIAN CAPITAL LETTER UNK */ /*3849*/ 0x010cd6, 1, 0x010c96, /* OLD HUNGARIAN CAPITAL LETTER EL */ /*3852*/ 0x010cd7, 1, 0x010c97, /* OLD HUNGARIAN CAPITAL LETTER ELY */ /*3855*/ 0x010cd8, 1, 0x010c98, /* OLD HUNGARIAN CAPITAL LETTER EM */ /*3858*/ 0x010cd9, 1, 0x010c99, /* OLD HUNGARIAN CAPITAL LETTER EN */ /*3861*/ 0x010cda, 1, 0x010c9a, /* OLD HUNGARIAN CAPITAL LETTER ENY */ /*3864*/ 0x010cdb, 1, 0x010c9b, /* OLD HUNGARIAN CAPITAL LETTER O */ /*3867*/ 0x010cdc, 1, 0x010c9c, /* OLD HUNGARIAN CAPITAL LETTER OO */ /*3870*/ 0x010cdd, 1, 0x010c9d, /* OLD HUNGARIAN CAPITAL LETTER NIKO.. */ /*3873*/ 0x010cde, 1, 0x010c9e, /* OLD HUNGARIAN CAPITAL LETTER RUDI.. */ /*3876*/ 0x010cdf, 1, 0x010c9f, /* OLD HUNGARIAN CAPITAL LETTER OEE */ /*3879*/ 0x010ce0, 1, 0x010ca0, /* OLD HUNGARIAN CAPITAL LETTER EP */ /*3882*/ 0x010ce1, 1, 0x010ca1, /* OLD HUNGARIAN CAPITAL LETTER EMP */ /*3885*/ 0x010ce2, 1, 0x010ca2, /* OLD HUNGARIAN CAPITAL LETTER ER */ /*3888*/ 0x010ce3, 1, 0x010ca3, /* OLD HUNGARIAN CAPITAL LETTER SHOR.. */ /*3891*/ 0x010ce4, 1, 0x010ca4, /* OLD HUNGARIAN CAPITAL LETTER ES */ /*3894*/ 0x010ce5, 1, 0x010ca5, /* OLD HUNGARIAN CAPITAL LETTER ESZ */ /*3897*/ 0x010ce6, 1, 0x010ca6, /* OLD HUNGARIAN CAPITAL LETTER ET */ /*3900*/ 0x010ce7, 1, 0x010ca7, /* OLD HUNGARIAN CAPITAL LETTER ENT */ /*3903*/ 0x010ce8, 1, 0x010ca8, /* OLD HUNGARIAN CAPITAL LETTER ETY */ /*3906*/ 0x010ce9, 1, 0x010ca9, /* OLD HUNGARIAN CAPITAL LETTER ECH */ /*3909*/ 0x010cea, 1, 0x010caa, /* OLD HUNGARIAN CAPITAL LETTER U */ /*3912*/ 0x010ceb, 1, 0x010cab, /* OLD HUNGARIAN CAPITAL LETTER UU */ /*3915*/ 0x010cec, 1, 0x010cac, /* OLD HUNGARIAN CAPITAL LETTER NIKO.. */ /*3918*/ 0x010ced, 1, 0x010cad, /* OLD HUNGARIAN CAPITAL LETTER RUDI.. */ /*3921*/ 0x010cee, 1, 0x010cae, /* OLD HUNGARIAN CAPITAL LETTER EV */ /*3924*/ 0x010cef, 1, 0x010caf, /* OLD HUNGARIAN CAPITAL LETTER EZ */ /*3927*/ 0x010cf0, 1, 0x010cb0, /* OLD HUNGARIAN CAPITAL LETTER EZS */ /*3930*/ 0x010cf1, 1, 0x010cb1, /* OLD HUNGARIAN CAPITAL LETTER ENT-.. */ /*3933*/ 0x010cf2, 1, 0x010cb2, /* OLD HUNGARIAN CAPITAL LETTER US */ /*3936*/ 0x010d70, 1, 0x010d50, /* GARAY CAPITAL LETTER A */ /*3939*/ 0x010d71, 1, 0x010d51, /* GARAY CAPITAL LETTER CA */ /*3942*/ 0x010d72, 1, 0x010d52, /* GARAY CAPITAL LETTER MA */ /*3945*/ 0x010d73, 1, 0x010d53, /* GARAY CAPITAL LETTER KA */ /*3948*/ 0x010d74, 1, 0x010d54, /* GARAY CAPITAL LETTER BA */ /*3951*/ 0x010d75, 1, 0x010d55, /* GARAY CAPITAL LETTER JA */ /*3954*/ 0x010d76, 1, 0x010d56, /* GARAY CAPITAL LETTER SA */ /*3957*/ 0x010d77, 1, 0x010d57, /* GARAY CAPITAL LETTER WA */ /*3960*/ 0x010d78, 1, 0x010d58, /* GARAY CAPITAL LETTER LA */ /*3963*/ 0x010d79, 1, 0x010d59, /* GARAY CAPITAL LETTER GA */ /*3966*/ 0x010d7a, 1, 0x010d5a, /* GARAY CAPITAL LETTER DA */ /*3969*/ 0x010d7b, 1, 0x010d5b, /* GARAY CAPITAL LETTER XA */ /*3972*/ 0x010d7c, 1, 0x010d5c, /* GARAY CAPITAL LETTER YA */ /*3975*/ 0x010d7d, 1, 0x010d5d, /* GARAY CAPITAL LETTER TA */ /*3978*/ 0x010d7e, 1, 0x010d5e, /* GARAY CAPITAL LETTER RA */ /*3981*/ 0x010d7f, 1, 0x010d5f, /* GARAY CAPITAL LETTER NYA */ /*3984*/ 0x010d80, 1, 0x010d60, /* GARAY CAPITAL LETTER FA */ /*3987*/ 0x010d81, 1, 0x010d61, /* GARAY CAPITAL LETTER NA */ /*3990*/ 0x010d82, 1, 0x010d62, /* GARAY CAPITAL LETTER PA */ /*3993*/ 0x010d83, 1, 0x010d63, /* GARAY CAPITAL LETTER HA */ /*3996*/ 0x010d84, 1, 0x010d64, /* GARAY CAPITAL LETTER OLD KA */ /*3999*/ 0x010d85, 1, 0x010d65, /* GARAY CAPITAL LETTER OLD NA */ /*4002*/ 0x0118c0, 1, 0x0118a0, /* WARANG CITI CAPITAL LETTER NGAA */ /*4005*/ 0x0118c1, 1, 0x0118a1, /* WARANG CITI CAPITAL LETTER A */ /*4008*/ 0x0118c2, 1, 0x0118a2, /* WARANG CITI CAPITAL LETTER WI */ /*4011*/ 0x0118c3, 1, 0x0118a3, /* WARANG CITI CAPITAL LETTER YU */ /*4014*/ 0x0118c4, 1, 0x0118a4, /* WARANG CITI CAPITAL LETTER YA */ /*4017*/ 0x0118c5, 1, 0x0118a5, /* WARANG CITI CAPITAL LETTER YO */ /*4020*/ 0x0118c6, 1, 0x0118a6, /* WARANG CITI CAPITAL LETTER II */ /*4023*/ 0x0118c7, 1, 0x0118a7, /* WARANG CITI CAPITAL LETTER UU */ /*4026*/ 0x0118c8, 1, 0x0118a8, /* WARANG CITI CAPITAL LETTER E */ /*4029*/ 0x0118c9, 1, 0x0118a9, /* WARANG CITI CAPITAL LETTER O */ /*4032*/ 0x0118ca, 1, 0x0118aa, /* WARANG CITI CAPITAL LETTER ANG */ /*4035*/ 0x0118cb, 1, 0x0118ab, /* WARANG CITI CAPITAL LETTER GA */ /*4038*/ 0x0118cc, 1, 0x0118ac, /* WARANG CITI CAPITAL LETTER KO */ /*4041*/ 0x0118cd, 1, 0x0118ad, /* WARANG CITI CAPITAL LETTER ENY */ /*4044*/ 0x0118ce, 1, 0x0118ae, /* WARANG CITI CAPITAL LETTER YUJ */ /*4047*/ 0x0118cf, 1, 0x0118af, /* WARANG CITI CAPITAL LETTER UC */ /*4050*/ 0x0118d0, 1, 0x0118b0, /* WARANG CITI CAPITAL LETTER ENN */ /*4053*/ 0x0118d1, 1, 0x0118b1, /* WARANG CITI CAPITAL LETTER ODD */ /*4056*/ 0x0118d2, 1, 0x0118b2, /* WARANG CITI CAPITAL LETTER TTE */ /*4059*/ 0x0118d3, 1, 0x0118b3, /* WARANG CITI CAPITAL LETTER NUNG */ /*4062*/ 0x0118d4, 1, 0x0118b4, /* WARANG CITI CAPITAL LETTER DA */ /*4065*/ 0x0118d5, 1, 0x0118b5, /* WARANG CITI CAPITAL LETTER AT */ /*4068*/ 0x0118d6, 1, 0x0118b6, /* WARANG CITI CAPITAL LETTER AM */ /*4071*/ 0x0118d7, 1, 0x0118b7, /* WARANG CITI CAPITAL LETTER BU */ /*4074*/ 0x0118d8, 1, 0x0118b8, /* WARANG CITI CAPITAL LETTER PU */ /*4077*/ 0x0118d9, 1, 0x0118b9, /* WARANG CITI CAPITAL LETTER HIYO */ /*4080*/ 0x0118da, 1, 0x0118ba, /* WARANG CITI CAPITAL LETTER HOLO */ /*4083*/ 0x0118db, 1, 0x0118bb, /* WARANG CITI CAPITAL LETTER HORR */ /*4086*/ 0x0118dc, 1, 0x0118bc, /* WARANG CITI CAPITAL LETTER HAR */ /*4089*/ 0x0118dd, 1, 0x0118bd, /* WARANG CITI CAPITAL LETTER SSUU */ /*4092*/ 0x0118de, 1, 0x0118be, /* WARANG CITI CAPITAL LETTER SII */ /*4095*/ 0x0118df, 1, 0x0118bf, /* WARANG CITI CAPITAL LETTER VIYO */ /*4098*/ 0x016e60, 1, 0x016e40, /* MEDEFAIDRIN CAPITAL LETTER M */ /*4101*/ 0x016e61, 1, 0x016e41, /* MEDEFAIDRIN CAPITAL LETTER S */ /*4104*/ 0x016e62, 1, 0x016e42, /* MEDEFAIDRIN CAPITAL LETTER V */ /*4107*/ 0x016e63, 1, 0x016e43, /* MEDEFAIDRIN CAPITAL LETTER W */ /*4110*/ 0x016e64, 1, 0x016e44, /* MEDEFAIDRIN CAPITAL LETTER ATIU */ /*4113*/ 0x016e65, 1, 0x016e45, /* MEDEFAIDRIN CAPITAL LETTER Z */ /*4116*/ 0x016e66, 1, 0x016e46, /* MEDEFAIDRIN CAPITAL LETTER KP */ /*4119*/ 0x016e67, 1, 0x016e47, /* MEDEFAIDRIN CAPITAL LETTER P */ /*4122*/ 0x016e68, 1, 0x016e48, /* MEDEFAIDRIN CAPITAL LETTER T */ /*4125*/ 0x016e69, 1, 0x016e49, /* MEDEFAIDRIN CAPITAL LETTER G */ /*4128*/ 0x016e6a, 1, 0x016e4a, /* MEDEFAIDRIN CAPITAL LETTER F */ /*4131*/ 0x016e6b, 1, 0x016e4b, /* MEDEFAIDRIN CAPITAL LETTER I */ /*4134*/ 0x016e6c, 1, 0x016e4c, /* MEDEFAIDRIN CAPITAL LETTER K */ /*4137*/ 0x016e6d, 1, 0x016e4d, /* MEDEFAIDRIN CAPITAL LETTER A */ /*4140*/ 0x016e6e, 1, 0x016e4e, /* MEDEFAIDRIN CAPITAL LETTER J */ /*4143*/ 0x016e6f, 1, 0x016e4f, /* MEDEFAIDRIN CAPITAL LETTER E */ /*4146*/ 0x016e70, 1, 0x016e50, /* MEDEFAIDRIN CAPITAL LETTER B */ /*4149*/ 0x016e71, 1, 0x016e51, /* MEDEFAIDRIN CAPITAL LETTER C */ /*4152*/ 0x016e72, 1, 0x016e52, /* MEDEFAIDRIN CAPITAL LETTER U */ /*4155*/ 0x016e73, 1, 0x016e53, /* MEDEFAIDRIN CAPITAL LETTER YU */ /*4158*/ 0x016e74, 1, 0x016e54, /* MEDEFAIDRIN CAPITAL LETTER L */ /*4161*/ 0x016e75, 1, 0x016e55, /* MEDEFAIDRIN CAPITAL LETTER Q */ /*4164*/ 0x016e76, 1, 0x016e56, /* MEDEFAIDRIN CAPITAL LETTER HP */ /*4167*/ 0x016e77, 1, 0x016e57, /* MEDEFAIDRIN CAPITAL LETTER NY */ /*4170*/ 0x016e78, 1, 0x016e58, /* MEDEFAIDRIN CAPITAL LETTER X */ /*4173*/ 0x016e79, 1, 0x016e59, /* MEDEFAIDRIN CAPITAL LETTER D */ /*4176*/ 0x016e7a, 1, 0x016e5a, /* MEDEFAIDRIN CAPITAL LETTER OE */ /*4179*/ 0x016e7b, 1, 0x016e5b, /* MEDEFAIDRIN CAPITAL LETTER N */ /*4182*/ 0x016e7c, 1, 0x016e5c, /* MEDEFAIDRIN CAPITAL LETTER R */ /*4185*/ 0x016e7d, 1, 0x016e5d, /* MEDEFAIDRIN CAPITAL LETTER O */ /*4188*/ 0x016e7e, 1, 0x016e5e, /* MEDEFAIDRIN CAPITAL LETTER AI */ /*4191*/ 0x016e7f, 1, 0x016e5f, /* MEDEFAIDRIN CAPITAL LETTER Y */ /*4194*/ 0x01e922, 1, 0x01e900, /* ADLAM CAPITAL LETTER ALIF */ /*4197*/ 0x01e923, 1, 0x01e901, /* ADLAM CAPITAL LETTER DAALI */ /*4200*/ 0x01e924, 1, 0x01e902, /* ADLAM CAPITAL LETTER LAAM */ /*4203*/ 0x01e925, 1, 0x01e903, /* ADLAM CAPITAL LETTER MIIM */ /*4206*/ 0x01e926, 1, 0x01e904, /* ADLAM CAPITAL LETTER BA */ /*4209*/ 0x01e927, 1, 0x01e905, /* ADLAM CAPITAL LETTER SINNYIIYHE */ /*4212*/ 0x01e928, 1, 0x01e906, /* ADLAM CAPITAL LETTER PE */ /*4215*/ 0x01e929, 1, 0x01e907, /* ADLAM CAPITAL LETTER BHE */ /*4218*/ 0x01e92a, 1, 0x01e908, /* ADLAM CAPITAL LETTER RA */ /*4221*/ 0x01e92b, 1, 0x01e909, /* ADLAM CAPITAL LETTER E */ /*4224*/ 0x01e92c, 1, 0x01e90a, /* ADLAM CAPITAL LETTER FA */ /*4227*/ 0x01e92d, 1, 0x01e90b, /* ADLAM CAPITAL LETTER I */ /*4230*/ 0x01e92e, 1, 0x01e90c, /* ADLAM CAPITAL LETTER O */ /*4233*/ 0x01e92f, 1, 0x01e90d, /* ADLAM CAPITAL LETTER DHA */ /*4236*/ 0x01e930, 1, 0x01e90e, /* ADLAM CAPITAL LETTER YHE */ /*4239*/ 0x01e931, 1, 0x01e90f, /* ADLAM CAPITAL LETTER WAW */ /*4242*/ 0x01e932, 1, 0x01e910, /* ADLAM CAPITAL LETTER NUN */ /*4245*/ 0x01e933, 1, 0x01e911, /* ADLAM CAPITAL LETTER KAF */ /*4248*/ 0x01e934, 1, 0x01e912, /* ADLAM CAPITAL LETTER YA */ /*4251*/ 0x01e935, 1, 0x01e913, /* ADLAM CAPITAL LETTER U */ /*4254*/ 0x01e936, 1, 0x01e914, /* ADLAM CAPITAL LETTER JIIM */ /*4257*/ 0x01e937, 1, 0x01e915, /* ADLAM CAPITAL LETTER CHI */ /*4260*/ 0x01e938, 1, 0x01e916, /* ADLAM CAPITAL LETTER HA */ /*4263*/ 0x01e939, 1, 0x01e917, /* ADLAM CAPITAL LETTER QAAF */ /*4266*/ 0x01e93a, 1, 0x01e918, /* ADLAM CAPITAL LETTER GA */ /*4269*/ 0x01e93b, 1, 0x01e919, /* ADLAM CAPITAL LETTER NYA */ /*4272*/ 0x01e93c, 1, 0x01e91a, /* ADLAM CAPITAL LETTER TU */ /*4275*/ 0x01e93d, 1, 0x01e91b, /* ADLAM CAPITAL LETTER NHA */ /*4278*/ 0x01e93e, 1, 0x01e91c, /* ADLAM CAPITAL LETTER VA */ /*4281*/ 0x01e93f, 1, 0x01e91d, /* ADLAM CAPITAL LETTER KHA */ /*4284*/ 0x01e940, 1, 0x01e91e, /* ADLAM CAPITAL LETTER GBE */ /*4287*/ 0x01e941, 1, 0x01e91f, /* ADLAM CAPITAL LETTER ZAL */ /*4290*/ 0x01e942, 1, 0x01e920, /* ADLAM CAPITAL LETTER KPO */ /*4293*/ 0x01e943, 1, 0x01e921, /* ADLAM CAPITAL LETTER SHA */ #define FOLDS1_NORMAL_END_INDEX 4296 /* ----- LOCALE ----- */ /*4296*/ 0x0069, 1, 0x0049, /* LATIN CAPITAL LETTER I */ #define FOLDS1_END_INDEX 4299 }; OnigCodePoint OnigUnicodeFolds2[] = { /* LATIN SMALL LETTER A WITH RIGHT HALF RING */ /* 0*/ 0x0061, 0x02be, 1, 0x1e9a, /* LATIN SMALL LIGATURE FF */ /* 4*/ 0x0066, 0x0066, 1, 0xfb00, /* LATIN SMALL LIGATURE FI */ /* 8*/ 0x0066, 0x0069, 1, 0xfb01, /* LATIN SMALL LIGATURE FL */ /* 12*/ 0x0066, 0x006c, 1, 0xfb02, /* LATIN SMALL LETTER H WITH LINE BELOW */ /* 16*/ 0x0068, 0x0331, 1, 0x1e96, /* LATIN SMALL LETTER J WITH CARON */ /* 20*/ 0x006a, 0x030c, 1, 0x01f0, /* LATIN SMALL LETTER SHARP S */ /* 24*/ 0x0073, 0x0073, 2, 0x00df, 0x1e9e, /* LATIN SMALL LIGATURE LONG S T */ /* 29*/ 0x0073, 0x0074, 2, 0xfb05, 0xfb06, /* LATIN SMALL LETTER T WITH DIAERESIS */ /* 34*/ 0x0074, 0x0308, 1, 0x1e97, /* LATIN SMALL LETTER W WITH RING ABOVE */ /* 38*/ 0x0077, 0x030a, 1, 0x1e98, /* LATIN SMALL LETTER Y WITH RING ABOVE */ /* 42*/ 0x0079, 0x030a, 1, 0x1e99, /* LATIN SMALL LETTER N PRECEDED BY APOSTROPHE */ /* 46*/ 0x02bc, 0x006e, 1, 0x0149, /* GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI */ /* 50*/ 0x03ac, 0x03b9, 1, 0x1fb4, /* GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI */ /* 54*/ 0x03ae, 0x03b9, 1, 0x1fc4, /* GREEK SMALL LETTER ALPHA WITH PERISPOMENI */ /* 58*/ 0x03b1, 0x0342, 1, 0x1fb6, /* GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI */ /* 62*/ 0x03b1, 0x03b9, 2, 0x1fb3, 0x1fbc, /* GREEK SMALL LETTER ETA WITH PERISPOMENI */ /* 67*/ 0x03b7, 0x0342, 1, 0x1fc6, /* GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI */ /* 71*/ 0x03b7, 0x03b9, 2, 0x1fc3, 0x1fcc, /* GREEK SMALL LETTER IOTA WITH PERISPOMENI */ /* 76*/ 0x03b9, 0x0342, 1, 0x1fd6, /* GREEK SMALL LETTER RHO WITH PSILI */ /* 80*/ 0x03c1, 0x0313, 1, 0x1fe4, /* GREEK SMALL LETTER UPSILON WITH PSILI */ /* 84*/ 0x03c5, 0x0313, 1, 0x1f50, /* GREEK SMALL LETTER UPSILON WITH PERISPOMENI */ /* 88*/ 0x03c5, 0x0342, 1, 0x1fe6, /* GREEK SMALL LETTER OMEGA WITH PERISPOMENI */ /* 92*/ 0x03c9, 0x0342, 1, 0x1ff6, /* GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI */ /* 96*/ 0x03c9, 0x03b9, 2, 0x1ff3, 0x1ffc, /* GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI */ /* 101*/ 0x03ce, 0x03b9, 1, 0x1ff4, /* ARMENIAN SMALL LIGATURE ECH YIWN */ /* 105*/ 0x0565, 0x0582, 1, 0x0587, /* ARMENIAN SMALL LIGATURE MEN ECH */ /* 109*/ 0x0574, 0x0565, 1, 0xfb14, /* ARMENIAN SMALL LIGATURE MEN INI */ /* 113*/ 0x0574, 0x056b, 1, 0xfb15, /* ARMENIAN SMALL LIGATURE MEN XEH */ /* 117*/ 0x0574, 0x056d, 1, 0xfb17, /* ARMENIAN SMALL LIGATURE MEN NOW */ /* 121*/ 0x0574, 0x0576, 1, 0xfb13, /* ARMENIAN SMALL LIGATURE VEW NOW */ /* 125*/ 0x057e, 0x0576, 1, 0xfb16, /* GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI */ /* 129*/ 0x1f00, 0x03b9, 2, 0x1f80, 0x1f88, /* GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI */ /* 134*/ 0x1f01, 0x03b9, 2, 0x1f81, 0x1f89, /* GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI */ /* 139*/ 0x1f02, 0x03b9, 2, 0x1f82, 0x1f8a, /* GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI */ /* 144*/ 0x1f03, 0x03b9, 2, 0x1f83, 0x1f8b, /* GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI */ /* 149*/ 0x1f04, 0x03b9, 2, 0x1f84, 0x1f8c, /* GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI */ /* 154*/ 0x1f05, 0x03b9, 2, 0x1f85, 0x1f8d, /* GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI */ /* 159*/ 0x1f06, 0x03b9, 2, 0x1f86, 0x1f8e, /* GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI */ /* 164*/ 0x1f07, 0x03b9, 2, 0x1f87, 0x1f8f, /* GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI */ /* 169*/ 0x1f20, 0x03b9, 2, 0x1f90, 0x1f98, /* GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI */ /* 174*/ 0x1f21, 0x03b9, 2, 0x1f91, 0x1f99, /* GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI */ /* 179*/ 0x1f22, 0x03b9, 2, 0x1f92, 0x1f9a, /* GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI */ /* 184*/ 0x1f23, 0x03b9, 2, 0x1f93, 0x1f9b, /* GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI */ /* 189*/ 0x1f24, 0x03b9, 2, 0x1f94, 0x1f9c, /* GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI */ /* 194*/ 0x1f25, 0x03b9, 2, 0x1f95, 0x1f9d, /* GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI */ /* 199*/ 0x1f26, 0x03b9, 2, 0x1f96, 0x1f9e, /* GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI */ /* 204*/ 0x1f27, 0x03b9, 2, 0x1f97, 0x1f9f, /* GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI */ /* 209*/ 0x1f60, 0x03b9, 2, 0x1fa0, 0x1fa8, /* GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI */ /* 214*/ 0x1f61, 0x03b9, 2, 0x1fa1, 0x1fa9, /* GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI */ /* 219*/ 0x1f62, 0x03b9, 2, 0x1fa2, 0x1faa, /* GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI */ /* 224*/ 0x1f63, 0x03b9, 2, 0x1fa3, 0x1fab, /* GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI */ /* 229*/ 0x1f64, 0x03b9, 2, 0x1fa4, 0x1fac, /* GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI */ /* 234*/ 0x1f65, 0x03b9, 2, 0x1fa5, 0x1fad, /* GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI */ /* 239*/ 0x1f66, 0x03b9, 2, 0x1fa6, 0x1fae, /* GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI */ /* 244*/ 0x1f67, 0x03b9, 2, 0x1fa7, 0x1faf, /* GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI */ /* 249*/ 0x1f70, 0x03b9, 1, 0x1fb2, /* GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI */ /* 253*/ 0x1f74, 0x03b9, 1, 0x1fc2, /* GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI */ /* 257*/ 0x1f7c, 0x03b9, 1, 0x1ff2, #define FOLDS2_NORMAL_END_INDEX 261 /* ----- LOCALE ----- */ /* LATIN CAPITAL LETTER I WITH DOT ABOVE */ /* 261*/ 0x0069, 0x0307, 1, 0x0130, #define FOLDS2_END_INDEX 265 }; OnigCodePoint OnigUnicodeFolds3[] = { /* LATIN SMALL LIGATURE FFI */ /* 0*/ 0x0066, 0x0066, 0x0069, 1, 0xfb03, /* LATIN SMALL LIGATURE FFL */ /* 5*/ 0x0066, 0x0066, 0x006c, 1, 0xfb04, /* GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI */ /* 10*/ 0x03b1, 0x0342, 0x03b9, 1, 0x1fb7, /* GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI */ /* 15*/ 0x03b7, 0x0342, 0x03b9, 1, 0x1fc7, /* GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA */ /* 20*/ 0x03b9, 0x0308, 0x0300, 1, 0x1fd2, /* GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ /* 25*/ 0x03b9, 0x0308, 0x0301, 2, 0x0390, 0x1fd3, /* GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI */ /* 31*/ 0x03b9, 0x0308, 0x0342, 1, 0x1fd7, /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA */ /* 36*/ 0x03c5, 0x0308, 0x0300, 1, 0x1fe2, /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ /* 41*/ 0x03c5, 0x0308, 0x0301, 2, 0x03b0, 0x1fe3, /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI */ /* 47*/ 0x03c5, 0x0308, 0x0342, 1, 0x1fe7, /* GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA */ /* 52*/ 0x03c5, 0x0313, 0x0300, 1, 0x1f52, /* GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA */ /* 57*/ 0x03c5, 0x0313, 0x0301, 1, 0x1f54, /* GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI */ /* 62*/ 0x03c5, 0x0313, 0x0342, 1, 0x1f56, /* GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI */ /* 67*/ 0x03c9, 0x0342, 0x03b9, 1, 0x1ff7, #define FOLDS3_NORMAL_END_INDEX 72 /* ----- LOCALE ----- */ #define FOLDS3_END_INDEX 72 }; jq-1.8.2/vendor/oniguruma/src/regext.c0000644000175100017510000001246615215513537013373 /********************************************************************** regext.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #if 0 static void conv_ext0be32(const UChar* s, const UChar* end, UChar* conv) { while (s < end) { *conv++ = '\0'; *conv++ = '\0'; *conv++ = '\0'; *conv++ = *s++; } } static void conv_ext0le32(const UChar* s, const UChar* end, UChar* conv) { while (s < end) { *conv++ = *s++; *conv++ = '\0'; *conv++ = '\0'; *conv++ = '\0'; } } static void conv_ext0be(const UChar* s, const UChar* end, UChar* conv) { while (s < end) { *conv++ = '\0'; *conv++ = *s++; } } static void conv_ext0le(const UChar* s, const UChar* end, UChar* conv) { while (s < end) { *conv++ = *s++; *conv++ = '\0'; } } static void conv_swap4bytes(const UChar* s, const UChar* end, UChar* conv) { while (s < end) { *conv++ = s[3]; *conv++ = s[2]; *conv++ = s[1]; *conv++ = s[0]; s += 4; } } static void conv_swap2bytes(const UChar* s, const UChar* end, UChar* conv) { while (s < end) { *conv++ = s[1]; *conv++ = s[0]; s += 2; } } static int conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end, UChar** conv, UChar** conv_end) { int len = (int )(end - s); if (to == ONIG_ENCODING_UTF16_BE) { if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) { *conv = (UChar* )xmalloc(len * 2); CHECK_NULL_RETURN_MEMERR(*conv); *conv_end = *conv + (len * 2); conv_ext0be(s, end, *conv); return 0; } else if (from == ONIG_ENCODING_UTF16_LE) { swap16: *conv = (UChar* )xmalloc(len); CHECK_NULL_RETURN_MEMERR(*conv); *conv_end = *conv + len; conv_swap2bytes(s, end, *conv); return 0; } } else if (to == ONIG_ENCODING_UTF16_LE) { if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) { *conv = (UChar* )xmalloc(len * 2); CHECK_NULL_RETURN_MEMERR(*conv); *conv_end = *conv + (len * 2); conv_ext0le(s, end, *conv); return 0; } else if (from == ONIG_ENCODING_UTF16_BE) { goto swap16; } } if (to == ONIG_ENCODING_UTF32_BE) { if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) { *conv = (UChar* )xmalloc(len * 4); CHECK_NULL_RETURN_MEMERR(*conv); *conv_end = *conv + (len * 4); conv_ext0be32(s, end, *conv); return 0; } else if (from == ONIG_ENCODING_UTF32_LE) { swap32: *conv = (UChar* )xmalloc(len); CHECK_NULL_RETURN_MEMERR(*conv); *conv_end = *conv + len; conv_swap4bytes(s, end, *conv); return 0; } } else if (to == ONIG_ENCODING_UTF32_LE) { if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) { *conv = (UChar* )xmalloc(len * 4); CHECK_NULL_RETURN_MEMERR(*conv); *conv_end = *conv + (len * 4); conv_ext0le32(s, end, *conv); return 0; } else if (from == ONIG_ENCODING_UTF32_BE) { goto swap32; } } return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION; } #endif extern int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo) { int r; UChar *cpat, *cpat_end; if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL; if (ci->pattern_enc != ci->target_enc) { return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION; } else { cpat = (UChar* )pattern; cpat_end = (UChar* )pattern_end; } *reg = (regex_t* )xmalloc(sizeof(regex_t)); if (IS_NULL(*reg)) { r = ONIGERR_MEMORY; goto err2; } r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc, ci->syntax); if (r != 0) goto err; r = onig_compile(*reg, cpat, cpat_end, einfo); if (r != 0) { err: onig_free(*reg); *reg = NULL; } err2: if (cpat != pattern) xfree(cpat); return r; } jq-1.8.2/vendor/oniguruma/src/regposix.c0000644000175100017510000003277715215513537013744 /********************************************************************** regposix.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2022 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #define regex_t onig_regex_t #include "regint.h" #undef regex_t #include "onigposix.h" #undef regex_t #undef regmatch_t #undef regoff_t #undef regcomp #undef regexec #undef regfree #undef regerror #undef reg_set_encoding #undef reg_name_to_group_numbers #undef reg_foreach_name #undef reg_number_of_names #define ONIG_C(reg) ((onig_regex_t* )((reg)->onig)) #define PONIG_C(reg) ((onig_regex_t** )(&(reg)->onig)) /* #define ENC_STRING_LEN(enc,s,len) len = strlen(s) */ #define ENC_STRING_LEN(enc,s,len) do { \ if (ONIGENC_MBC_MINLEN(enc) == 1) { \ UChar* tmps = (UChar* )(s); \ while (*tmps != 0) tmps++; \ len = (int )(tmps - (UChar* )(s));\ } \ else { \ len = onigenc_str_bytelen_null(enc, (UChar* )s); \ } \ } while(0) typedef struct { int onig_err; int posix_err; } O2PERR; static int onig2posix_error_code(int code) { static const O2PERR o2p[] = { { ONIG_MISMATCH, REG_NOMATCH }, { ONIG_NO_SUPPORT_CONFIG, REG_EONIG_INTERNAL }, { ONIG_ABORT, REG_EONIG_INTERNAL }, { ONIGERR_MEMORY, REG_ESPACE }, { ONIGERR_MATCH_STACK_LIMIT_OVER, REG_EONIG_INTERNAL }, { ONIGERR_RETRY_LIMIT_IN_MATCH_OVER, REG_EONIG_INTERNAL }, { ONIGERR_RETRY_LIMIT_IN_SEARCH_OVER, REG_EONIG_INTERNAL }, { ONIGERR_SUBEXP_CALL_LIMIT_IN_SEARCH_OVER, REG_EONIG_INTERNAL }, { ONIGERR_TYPE_BUG, REG_EONIG_INTERNAL }, { ONIGERR_PARSER_BUG, REG_EONIG_INTERNAL }, { ONIGERR_STACK_BUG, REG_EONIG_INTERNAL }, { ONIGERR_UNDEFINED_BYTECODE, REG_EONIG_INTERNAL }, { ONIGERR_UNEXPECTED_BYTECODE, REG_EONIG_INTERNAL }, { ONIGERR_DEFAULT_ENCODING_IS_NOT_SET, REG_EONIG_BADARG }, { ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR, REG_EONIG_BADARG }, { ONIGERR_FAIL_TO_INITIALIZE, REG_EONIG_INTERNAL }, { ONIGERR_INVALID_ARGUMENT, REG_EONIG_BADARG }, { ONIGERR_END_PATTERN_AT_LEFT_BRACE, REG_EBRACE }, { ONIGERR_END_PATTERN_AT_LEFT_BRACKET, REG_EBRACK }, { ONIGERR_EMPTY_CHAR_CLASS, REG_ECTYPE }, { ONIGERR_PREMATURE_END_OF_CHAR_CLASS, REG_ECTYPE }, { ONIGERR_END_PATTERN_AT_ESCAPE, REG_EESCAPE }, { ONIGERR_END_PATTERN_AT_META, REG_EESCAPE }, { ONIGERR_END_PATTERN_AT_CONTROL, REG_EESCAPE }, { ONIGERR_META_CODE_SYNTAX, REG_BADPAT }, { ONIGERR_CONTROL_CODE_SYNTAX, REG_BADPAT }, { ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE, REG_ECTYPE }, { ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE, REG_ECTYPE }, { ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS, REG_ECTYPE }, { ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED, REG_BADRPT }, { ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID, REG_BADRPT }, { ONIGERR_NESTED_REPEAT_OPERATOR, REG_BADRPT }, { ONIGERR_UNMATCHED_CLOSE_PARENTHESIS, REG_EPAREN }, { ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS, REG_EPAREN }, { ONIGERR_END_PATTERN_IN_GROUP, REG_BADPAT }, { ONIGERR_UNDEFINED_GROUP_OPTION, REG_BADPAT }, { ONIGERR_INVALID_GROUP_OPTION, REG_BADPAT }, { ONIGERR_INVALID_POSIX_BRACKET_TYPE, REG_BADPAT }, { ONIGERR_INVALID_LOOK_BEHIND_PATTERN, REG_BADPAT }, { ONIGERR_INVALID_REPEAT_RANGE_PATTERN, REG_BADPAT }, { ONIGERR_TOO_BIG_NUMBER, REG_BADPAT }, { ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE, REG_BADBR }, { ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE, REG_BADBR }, { ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS, REG_ECTYPE }, { ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE, REG_ECTYPE }, { ONIGERR_TOO_MANY_MULTI_BYTE_RANGES, REG_ECTYPE }, { ONIGERR_TOO_SHORT_MULTI_BYTE_STRING, REG_BADPAT }, { ONIGERR_TOO_BIG_BACKREF_NUMBER, REG_ESUBREG }, { ONIGERR_INVALID_BACKREF, REG_ESUBREG }, { ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED, REG_BADPAT }, { ONIGERR_TOO_BIG_WIDE_CHAR_VALUE, REG_EONIG_BADWC }, { ONIGERR_TOO_LONG_WIDE_CHAR_VALUE, REG_EONIG_BADWC }, { ONIGERR_UNDEFINED_OPERATOR, REG_BADPAT }, { ONIGERR_INVALID_CODE_POINT_VALUE, REG_EONIG_BADWC }, { ONIGERR_EMPTY_GROUP_NAME, REG_BADPAT }, { ONIGERR_INVALID_GROUP_NAME, REG_BADPAT }, { ONIGERR_INVALID_CHAR_IN_GROUP_NAME, REG_BADPAT }, { ONIGERR_UNDEFINED_NAME_REFERENCE, REG_BADPAT }, { ONIGERR_UNDEFINED_GROUP_REFERENCE, REG_BADPAT }, { ONIGERR_MULTIPLEX_DEFINED_NAME, REG_BADPAT }, { ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL, REG_BADPAT }, { ONIGERR_NEVER_ENDING_RECURSION, REG_BADPAT }, { ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY, REG_BADPAT }, { ONIGERR_INVALID_CHAR_PROPERTY_NAME, REG_BADPAT }, { ONIGERR_INVALID_IF_ELSE_SYNTAX, REG_BADPAT }, { ONIGERR_INVALID_ABSENT_GROUP_PATTERN, REG_BADPAT }, { ONIGERR_INVALID_ABSENT_GROUP_GENERATOR_PATTERN, REG_BADPAT }, { ONIGERR_INVALID_CALLOUT_PATTERN, REG_BADPAT }, { ONIGERR_INVALID_CALLOUT_NAME, REG_BADPAT }, { ONIGERR_UNDEFINED_CALLOUT_NAME, REG_BADPAT }, { ONIGERR_INVALID_CALLOUT_BODY, REG_BADPAT }, { ONIGERR_INVALID_CALLOUT_TAG_NAME, REG_BADPAT }, { ONIGERR_INVALID_CALLOUT_ARG, REG_BADPAT }, { ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION, REG_EONIG_BADARG }, { ONIGERR_VERY_INEFFICIENT_PATTERN, REG_BADPAT }, { ONIGERR_LIBRARY_IS_NOT_INITIALIZED, REG_EONIG_INTERNAL } }; int i; if (code >= 0) return 0; for (i = 0; i < (int )(sizeof(o2p) / sizeof(o2p[0])); i++) { if (code == o2p[i].onig_err) return o2p[i].posix_err; } return REG_EONIG_INTERNAL; /* but, unknown error code */ } extern int onig_posix_regcomp(onig_posix_regex_t* reg, const char* pattern, int posix_options) { int r, len; OnigSyntaxType* syntax = OnigDefaultSyntax; OnigOptionType options; reg->onig = (void* )0; if ((posix_options & REG_EXTENDED) == 0) syntax = ONIG_SYNTAX_POSIX_BASIC; options = syntax->options; if ((posix_options & REG_ICASE) != 0) ONIG_OPTION_ON(options, ONIG_OPTION_IGNORECASE); if ((posix_options & REG_NEWLINE) != 0) { ONIG_OPTION_ON( options, ONIG_OPTION_NEGATE_SINGLELINE); ONIG_OPTION_OFF(options, ONIG_OPTION_SINGLELINE); } reg->comp_options = posix_options; ENC_STRING_LEN(OnigEncDefaultCharEncoding, pattern, len); r = onig_new(PONIG_C(reg), (UChar* )pattern, (UChar* )(pattern + len), options, OnigEncDefaultCharEncoding, syntax, (OnigErrorInfo* )NULL); if (r != ONIG_NORMAL) { return onig2posix_error_code(r); } reg->re_nsub = ONIG_C(reg)->num_mem; return 0; } extern int onig_posix_regexec(onig_posix_regex_t* reg, const char* str, size_t nmatch, onig_posix_regmatch_t pmatch[], int posix_options) { int r, i, len; UChar* end; onig_posix_regmatch_t* pm; OnigOptionType options; options = ONIG_OPTION_POSIX_REGION; if ((posix_options & REG_NOTBOL) != 0) options |= ONIG_OPTION_NOTBOL; if ((posix_options & REG_NOTEOL) != 0) options |= ONIG_OPTION_NOTEOL; if (nmatch == 0 || (reg->comp_options & REG_NOSUB) != 0) { pm = (onig_posix_regmatch_t* )NULL; nmatch = 0; } else if ((int )nmatch < ONIG_C(reg)->num_mem + 1) { pm = (onig_posix_regmatch_t* )xmalloc(sizeof(onig_posix_regmatch_t) * (ONIG_C(reg)->num_mem + 1)); if (pm == NULL) return REG_ESPACE; } else { pm = pmatch; } ENC_STRING_LEN(ONIG_C(reg)->enc, str, len); end = (UChar* )(str + len); r = onig_search(ONIG_C(reg), (UChar* )str, end, (UChar* )str, end, (OnigRegion* )pm, options); if (r >= 0) { r = 0; /* Match */ if (pm != pmatch && pm != NULL) { xmemcpy(pmatch, pm, sizeof(onig_posix_regmatch_t) * nmatch); } } else if (r == ONIG_MISMATCH) { r = REG_NOMATCH; for (i = 0; i < (int )nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = ONIG_REGION_NOTPOS; } else { r = onig2posix_error_code(r); } if (pm != pmatch && pm != NULL) xfree(pm); #if 0 if (reg->re_nsub > nmatch - 1) reg->re_nsub = (nmatch <= 1 ? 0 : nmatch - 1); #endif return r; } extern void onig_posix_regfree(onig_posix_regex_t* reg) { onig_free(ONIG_C(reg)); reg->onig = (void* )0; } extern void onig_posix_reg_set_encoding(int mb_code) { OnigEncoding enc; switch (mb_code) { case REG_POSIX_ENCODING_ASCII: enc = ONIG_ENCODING_ASCII; break; case REG_POSIX_ENCODING_EUC_JP: enc = ONIG_ENCODING_EUC_JP; break; case REG_POSIX_ENCODING_SJIS: enc = ONIG_ENCODING_SJIS; break; case REG_POSIX_ENCODING_UTF8: enc = ONIG_ENCODING_UTF8; break; case REG_POSIX_ENCODING_UTF16_BE: enc = ONIG_ENCODING_UTF16_BE; break; case REG_POSIX_ENCODING_UTF16_LE: enc = ONIG_ENCODING_UTF16_LE; break; default: return ; break; } onig_initialize(&enc, 1); onigenc_set_default_encoding(enc); } extern int onig_posix_reg_name_to_group_numbers(onig_posix_regex_t* reg, const unsigned char* name, const unsigned char* name_end, int** nums) { return onig_name_to_group_numbers(ONIG_C(reg), name, name_end, nums); } typedef struct { int (*func)(const unsigned char*, const unsigned char*,int,int*,onig_posix_regex_t*,void*); onig_posix_regex_t* reg; void* arg; } i_wrap; static int i_wrapper(const UChar* name, const UChar* name_end, int ng, int* gs, onig_regex_t* reg ARG_UNUSED, void* arg) { i_wrap* warg = (i_wrap* )arg; return (*warg->func)(name, name_end, ng, gs, warg->reg, warg->arg); } extern int onig_posix_reg_foreach_name(onig_posix_regex_t* reg, int (*func)(const unsigned char*, const unsigned char*,int,int*,onig_posix_regex_t*,void*), void* arg) { i_wrap warg; warg.func = func; warg.reg = reg; warg.arg = arg; return onig_foreach_name(ONIG_C(reg), i_wrapper, &warg); } extern int onig_posix_reg_number_of_names(onig_posix_regex_t* reg) { return onig_number_of_names(ONIG_C(reg)); } #ifdef USE_BINARY_COMPATIBLE_POSIX_API extern int regcomp(onig_posix_regex_t* reg, const char* pattern, int posix_options) { return onig_posix_regcomp(reg, pattern, posix_options); } extern int regexec(onig_posix_regex_t* reg, const char* str, size_t nmatch, onig_posix_regmatch_t pmatch[], int posix_options) { return onig_posix_regexec(reg, str, nmatch, pmatch, posix_options); } extern void regfree(onig_posix_regex_t* reg) { onig_posix_regfree(reg); } extern void reg_set_encoding(int mb_code) { onig_posix_reg_set_encoding(mb_code); } extern int reg_name_to_group_numbers(onig_posix_regex_t* reg, const unsigned char* name, const unsigned char* name_end, int** nums) { return onig_posix_reg_name_to_group_numbers(reg, name, name_end, nums); } extern int reg_foreach_name(onig_posix_regex_t* reg, int (*func)(const unsigned char*, const unsigned char*,int,int*,onig_posix_regex_t*,void*), void* arg) { return onig_posix_reg_foreach_name(reg, func, arg); } extern int reg_number_of_names(onig_posix_regex_t* reg) { return onig_posix_reg_number_of_names(reg); } #endif /* USE_BINARY_COMPATIBLE_POSIX_API */ jq-1.8.2/vendor/oniguruma/src/onigposix.h0000644000175100017510000001515615215513537014120 #ifndef ONIGPOSIX_H #define ONIGPOSIX_H /********************************************************************** onigposix.h - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #ifndef ONIG_NO_STANDARD_C_HEADERS #include #endif #ifdef __cplusplus extern "C" { #endif /* options */ #define REG_ICASE (1<<0) #define REG_NEWLINE (1<<1) #define REG_NOTBOL (1<<2) #define REG_NOTEOL (1<<3) #define REG_EXTENDED (1<<4) /* if not set, Basic Onigular Expression */ #define REG_NOSUB (1<<5) /* POSIX error codes */ #define REG_NOMATCH 1 #define REG_BADPAT 2 #define REG_ECOLLATE 3 #define REG_ECTYPE 4 #define REG_EESCAPE 5 #define REG_ESUBREG 6 #define REG_EBRACK 7 #define REG_EPAREN 8 #define REG_EBRACE 9 #define REG_BADBR 10 #define REG_ERANGE 11 #define REG_ESPACE 12 #define REG_BADRPT 13 /* extended error codes */ #define REG_EONIG_INTERNAL 14 #define REG_EONIG_BADWC 15 #define REG_EONIG_BADARG 16 /* #define REG_EONIG_THREAD 17 */ /* character encodings (for reg_set_encoding()) */ #define REG_POSIX_ENCODING_ASCII 0 #define REG_POSIX_ENCODING_EUC_JP 1 #define REG_POSIX_ENCODING_SJIS 2 #define REG_POSIX_ENCODING_UTF8 3 #define REG_POSIX_ENCODING_UTF16_BE 4 #define REG_POSIX_ENCODING_UTF16_LE 5 typedef int onig_posix_regoff_t; typedef struct { onig_posix_regoff_t rm_so; onig_posix_regoff_t rm_eo; } onig_posix_regmatch_t; /* POSIX regex_t */ typedef struct { void* onig; /* Oniguruma regex_t* */ size_t re_nsub; int comp_options; } onig_posix_regex_t; #ifndef P_ #if defined(__STDC__) || defined(_WIN32) # define P_(args) args #else # define P_(args) () #endif #endif #ifndef ONIG_STATIC #ifndef ONIG_EXTERN #if defined(_WIN32) && !defined(__GNUC__) #if defined(ONIGURUMA_EXPORT) #define ONIG_EXTERN extern __declspec(dllexport) #else #define ONIG_EXTERN extern __declspec(dllimport) #endif #endif #endif #ifndef ONIG_EXTERN #define ONIG_EXTERN extern #endif #else #define ONIG_EXTERN extern #endif #ifndef ONIGURUMA_H typedef unsigned int OnigOptionType; /* syntax */ typedef struct { unsigned int op; unsigned int op2; unsigned int behavior; OnigOptionType options; /* default option */ } OnigSyntaxType; ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic; ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended; ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs; ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep; ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex; ONIG_EXTERN OnigSyntaxType OnigSyntaxJava; ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl; ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby; ONIG_EXTERN OnigSyntaxType OnigSyntaxOniguruma; /* predefined syntaxes (see regsyntax.c) */ #define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic) #define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended) #define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs) #define ONIG_SYNTAX_GREP (&OnigSyntaxGrep) #define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex) #define ONIG_SYNTAX_JAVA (&OnigSyntaxJava) #define ONIG_SYNTAX_PERL (&OnigSyntaxPerl) #define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby) #define ONIG_SYNTAX_ONIGURUMA (&OnigSyntaxOniguruma) /* default syntax */ #define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax; ONIG_EXTERN int onig_set_default_syntax P_((OnigSyntaxType* syntax)); ONIG_EXTERN void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from)); ONIG_EXTERN const char* onig_version P_((void)); ONIG_EXTERN const char* onig_copyright P_((void)); ONIG_EXTERN int onig_end P_((void)); #endif /* ONIGURUMA_H */ ONIG_EXTERN int onig_posix_regcomp P_((onig_posix_regex_t* reg, const char* pat, int options)); ONIG_EXTERN int onig_posix_regexec P_((onig_posix_regex_t* reg, const char* str, size_t nmatch, onig_posix_regmatch_t* matches, int options)); ONIG_EXTERN void onig_posix_regfree P_((onig_posix_regex_t* reg)); ONIG_EXTERN size_t onig_posix_regerror P_((int code, const onig_posix_regex_t* reg, char* buf, size_t size)); /* extended API */ ONIG_EXTERN void onig_posix_reg_set_encoding P_((int enc)); ONIG_EXTERN int onig_posix_reg_name_to_group_numbers P_((onig_posix_regex_t* reg, const unsigned char* name, const unsigned char* name_end, int** nums)); ONIG_EXTERN int onig_posix_reg_foreach_name P_((onig_posix_regex_t* reg, int (*func)(const unsigned char*, const unsigned char*,int,int*,onig_posix_regex_t*,void*), void* arg)); ONIG_EXTERN int onig_posix_reg_number_of_names P_((onig_posix_regex_t* reg)); /* aliases */ #define regex_t onig_posix_regex_t #define regmatch_t onig_posix_regmatch_t #define regoff_t onig_posix_regoff_t #define regcomp onig_posix_regcomp #define regexec onig_posix_regexec #define regfree onig_posix_regfree #define regerror onig_posix_regerror #define reg_set_encoding onig_posix_reg_set_encoding #define reg_name_to_group_numbers onig_posix_reg_name_to_group_numbers #define reg_foreach_name onig_posix_reg_foreach_name #define reg_number_of_names onig_posix_reg_number_of_names #ifdef __cplusplus } #endif #endif /* ONIGPOSIX_H */ jq-1.8.2/vendor/oniguruma/src/unicode_property_data.c0000644000175100017510000255136415215513537016467 /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -T -C -c -t -j1 -L ANSI-C --ignore-case --pic -Q unicode_prop_name_pool -N unicode_lookup_property_name --output-file gperf1.tmp unicode_property_data.gperf */ /* Computed positions: -k'1-3,5-6,12,16,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif /* Generated by make_unicode_property_data.py. */ /*- * Copyright (c) 2016-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ /* PROPERTY: 'NEWLINE': POSIX [[:NEWLINE:]] */ static const OnigCodePoint CR_NEWLINE[] = { 1, 0x000a, 0x000a, }; /* END of CR_NEWLINE */ /* PROPERTY: 'Alpha': POSIX [[:Alpha:]] */ static const OnigCodePoint CR_Alpha[] = { 757, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0345, 0x0345, 0x0363, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x05b0, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0657, 0x0659, 0x065f, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06e1, 0x06e8, 0x06ed, 0x06ef, 0x06fa, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x073f, 0x074d, 0x07b1, 0x07ca, 0x07ea, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x0800, 0x0817, 0x081a, 0x082c, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x0897, 0x08a0, 0x08c9, 0x08d4, 0x08df, 0x08e3, 0x08e9, 0x08f0, 0x093b, 0x093d, 0x094c, 0x094e, 0x0950, 0x0955, 0x0963, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09cc, 0x09ce, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09f0, 0x09f1, 0x09fc, 0x09fc, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4c, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a70, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acc, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0af9, 0x0afc, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4c, 0x0b56, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcc, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4c, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccc, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4c, 0x0d4e, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e46, 0x0e4d, 0x0e4d, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb9, 0x0ebb, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ecd, 0x0ecd, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f83, 0x0f88, 0x0f97, 0x0f99, 0x0fbc, 0x1000, 0x1036, 0x1038, 0x1038, 0x103b, 0x103f, 0x1050, 0x108f, 0x109a, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1713, 0x171f, 0x1733, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17b3, 0x17b6, 0x17c8, 0x17d7, 0x17d7, 0x17dc, 0x17dc, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x1938, 0x1950, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a61, 0x1a74, 0x1aa7, 0x1aa7, 0x1abf, 0x1ac0, 0x1acc, 0x1ace, 0x1b00, 0x1b33, 0x1b35, 0x1b43, 0x1b45, 0x1b4c, 0x1b80, 0x1ba9, 0x1bac, 0x1baf, 0x1bba, 0x1be5, 0x1be7, 0x1bf1, 0x1c00, 0x1c36, 0x1c4d, 0x1c4f, 0x1c5a, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1dd3, 0x1df4, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x24b6, 0x24e9, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x2e2f, 0x2e2f, 0x3005, 0x3007, 0x3021, 0x3029, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa61f, 0xa62a, 0xa62b, 0xa640, 0xa66e, 0xa674, 0xa67b, 0xa67f, 0xa6ef, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa805, 0xa807, 0xa827, 0xa840, 0xa873, 0xa880, 0xa8c3, 0xa8c5, 0xa8c5, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa8ff, 0xa90a, 0xa92a, 0xa930, 0xa952, 0xa960, 0xa97c, 0xa980, 0xa9b2, 0xa9b4, 0xa9bf, 0xa9cf, 0xa9cf, 0xa9e0, 0xa9ef, 0xa9fa, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa60, 0xaa76, 0xaa7a, 0xaabe, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf5, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff21, 0xff3a, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d4a, 0x10d65, 0x10d69, 0x10d69, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10efc, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11045, 0x11071, 0x11075, 0x11080, 0x110b8, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x11100, 0x11132, 0x11144, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11180, 0x111bf, 0x111c1, 0x111c4, 0x111ce, 0x111cf, 0x111da, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11234, 0x11237, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112e8, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134c, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113cd, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11441, 0x11443, 0x11445, 0x11447, 0x1144a, 0x1145f, 0x11461, 0x11480, 0x114c1, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x11580, 0x115b5, 0x115b8, 0x115be, 0x115d8, 0x115dd, 0x11600, 0x1163e, 0x11640, 0x11640, 0x11644, 0x11644, 0x11680, 0x116b5, 0x116b8, 0x116b8, 0x11700, 0x1171a, 0x1171d, 0x1172a, 0x11740, 0x11746, 0x11800, 0x11838, 0x118a0, 0x118df, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x1193c, 0x1193f, 0x11942, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119df, 0x119e1, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a32, 0x11a35, 0x11a3e, 0x11a50, 0x11a97, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c3e, 0x11c40, 0x11c40, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d41, 0x11d43, 0x11d43, 0x11d46, 0x11d47, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d96, 0x11d98, 0x11d98, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f40, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1612e, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a70, 0x16abe, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b40, 0x16b43, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9e, 0x1bc9e, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e4d0, 0x1e4eb, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5f0, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e900, 0x1e943, 0x1e947, 0x1e947, 0x1e94b, 0x1e94b, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Alpha */ /* PROPERTY: 'Blank': POSIX [[:Blank:]] */ static const OnigCodePoint CR_Blank[] = { 8, 0x0009, 0x0009, 0x0020, 0x0020, 0x00a0, 0x00a0, 0x1680, 0x1680, 0x2000, 0x200a, 0x202f, 0x202f, 0x205f, 0x205f, 0x3000, 0x3000, }; /* END of CR_Blank */ /* PROPERTY: 'Cntrl': POSIX [[:Cntrl:]] */ static const OnigCodePoint CR_Cntrl[] = { 2, 0x0000, 0x001f, 0x007f, 0x009f, }; /* END of CR_Cntrl */ /* PROPERTY: 'Digit': POSIX [[:Digit:]] */ static const OnigCodePoint CR_Digit[] = { 71, 0x0030, 0x0039, 0x0660, 0x0669, 0x06f0, 0x06f9, 0x07c0, 0x07c9, 0x0966, 0x096f, 0x09e6, 0x09ef, 0x0a66, 0x0a6f, 0x0ae6, 0x0aef, 0x0b66, 0x0b6f, 0x0be6, 0x0bef, 0x0c66, 0x0c6f, 0x0ce6, 0x0cef, 0x0d66, 0x0d6f, 0x0de6, 0x0def, 0x0e50, 0x0e59, 0x0ed0, 0x0ed9, 0x0f20, 0x0f29, 0x1040, 0x1049, 0x1090, 0x1099, 0x17e0, 0x17e9, 0x1810, 0x1819, 0x1946, 0x194f, 0x19d0, 0x19d9, 0x1a80, 0x1a89, 0x1a90, 0x1a99, 0x1b50, 0x1b59, 0x1bb0, 0x1bb9, 0x1c40, 0x1c49, 0x1c50, 0x1c59, 0xa620, 0xa629, 0xa8d0, 0xa8d9, 0xa900, 0xa909, 0xa9d0, 0xa9d9, 0xa9f0, 0xa9f9, 0xaa50, 0xaa59, 0xabf0, 0xabf9, 0xff10, 0xff19, 0x104a0, 0x104a9, 0x10d30, 0x10d39, 0x10d40, 0x10d49, 0x11066, 0x1106f, 0x110f0, 0x110f9, 0x11136, 0x1113f, 0x111d0, 0x111d9, 0x112f0, 0x112f9, 0x11450, 0x11459, 0x114d0, 0x114d9, 0x11650, 0x11659, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11730, 0x11739, 0x118e0, 0x118e9, 0x11950, 0x11959, 0x11bf0, 0x11bf9, 0x11c50, 0x11c59, 0x11d50, 0x11d59, 0x11da0, 0x11da9, 0x11f50, 0x11f59, 0x16130, 0x16139, 0x16a60, 0x16a69, 0x16ac0, 0x16ac9, 0x16b50, 0x16b59, 0x16d70, 0x16d79, 0x1ccf0, 0x1ccf9, 0x1d7ce, 0x1d7ff, 0x1e140, 0x1e149, 0x1e2f0, 0x1e2f9, 0x1e4f0, 0x1e4f9, 0x1e5f1, 0x1e5fa, 0x1e950, 0x1e959, 0x1fbf0, 0x1fbf9, }; /* END of CR_Digit */ /* PROPERTY: 'Graph': POSIX [[:Graph:]] */ static const OnigCodePoint CR_Graph[] = { 737, 0x0021, 0x007e, 0x00a1, 0x0377, 0x037a, 0x037f, 0x0384, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x052f, 0x0531, 0x0556, 0x0559, 0x058a, 0x058d, 0x058f, 0x0591, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f4, 0x0600, 0x070d, 0x070f, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07fa, 0x07fd, 0x082d, 0x0830, 0x083e, 0x0840, 0x085b, 0x085e, 0x085e, 0x0860, 0x086a, 0x0870, 0x088e, 0x0890, 0x0891, 0x0897, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a76, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0af1, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b77, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bfa, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c77, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4f, 0x0d54, 0x0d63, 0x0d66, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df4, 0x0e01, 0x0e3a, 0x0e3f, 0x0e5b, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f97, 0x0f99, 0x0fbc, 0x0fbe, 0x0fcc, 0x0fce, 0x0fda, 0x1000, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x137c, 0x1380, 0x1399, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1400, 0x167f, 0x1681, 0x169c, 0x16a0, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1736, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17dd, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x1800, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1940, 0x1940, 0x1944, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x19de, 0x1a1b, 0x1a1e, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa0, 0x1aad, 0x1ab0, 0x1ace, 0x1b00, 0x1b4c, 0x1b4e, 0x1bf3, 0x1bfc, 0x1c37, 0x1c3b, 0x1c49, 0x1c4d, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cc7, 0x1cd0, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fc4, 0x1fc6, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fdd, 0x1fef, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffe, 0x200b, 0x2027, 0x202a, 0x202e, 0x2030, 0x205e, 0x2060, 0x2064, 0x2066, 0x2071, 0x2074, 0x208e, 0x2090, 0x209c, 0x20a0, 0x20c0, 0x20d0, 0x20f0, 0x2100, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x2460, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2cf3, 0x2cf9, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d70, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x2fff, 0x3001, 0x303f, 0x3041, 0x3096, 0x3099, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x3190, 0x31e5, 0x31ef, 0x321e, 0x3220, 0xa48c, 0xa490, 0xa4c6, 0xa4d0, 0xa62b, 0xa640, 0xa6f7, 0xa700, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa82c, 0xa830, 0xa839, 0xa840, 0xa877, 0xa880, 0xa8c5, 0xa8ce, 0xa8d9, 0xa8e0, 0xa953, 0xa95f, 0xa97c, 0xa980, 0xa9cd, 0xa9cf, 0xa9d9, 0xa9de, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa5c, 0xaac2, 0xaadb, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab6b, 0xab70, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xe000, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbc2, 0xfbd3, 0xfd8f, 0xfd92, 0xfdc7, 0xfdcf, 0xfdcf, 0xfdf0, 0xfe19, 0xfe20, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xfeff, 0xfeff, 0xff01, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfff9, 0xfffd, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10100, 0x10102, 0x10107, 0x10133, 0x10137, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102fb, 0x10300, 0x10323, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x1039f, 0x103c3, 0x103c8, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x1056f, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10857, 0x1089e, 0x108a7, 0x108af, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x108fb, 0x1091b, 0x1091f, 0x10939, 0x1093f, 0x1093f, 0x10980, 0x109b7, 0x109bc, 0x109cf, 0x109d2, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a48, 0x10a50, 0x10a58, 0x10a60, 0x10a9f, 0x10ac0, 0x10ae6, 0x10aeb, 0x10af6, 0x10b00, 0x10b35, 0x10b39, 0x10b55, 0x10b58, 0x10b72, 0x10b78, 0x10b91, 0x10b99, 0x10b9c, 0x10ba9, 0x10baf, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10cfa, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d85, 0x10d8e, 0x10d8f, 0x10e60, 0x10e7e, 0x10e80, 0x10ea9, 0x10eab, 0x10ead, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f27, 0x10f30, 0x10f59, 0x10f70, 0x10f89, 0x10fb0, 0x10fcb, 0x10fe0, 0x10ff6, 0x11000, 0x1104d, 0x11052, 0x11075, 0x1107f, 0x110c2, 0x110cd, 0x110cd, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x11147, 0x11150, 0x11176, 0x11180, 0x111df, 0x111e1, 0x111f4, 0x11200, 0x11211, 0x11213, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a9, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d5, 0x113d7, 0x113d8, 0x113e1, 0x113e2, 0x11400, 0x1145b, 0x1145d, 0x11461, 0x11480, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115dd, 0x11600, 0x11644, 0x11650, 0x11659, 0x11660, 0x1166c, 0x11680, 0x116b9, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11746, 0x11800, 0x1183b, 0x118a0, 0x118f2, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11946, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e4, 0x11a00, 0x11a47, 0x11a50, 0x11aa2, 0x11ab0, 0x11af8, 0x11b00, 0x11b09, 0x11bc0, 0x11be1, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c45, 0x11c50, 0x11c6c, 0x11c70, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef8, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f5a, 0x11fb0, 0x11fb0, 0x11fc0, 0x11ff1, 0x11fff, 0x12399, 0x12400, 0x1246e, 0x12470, 0x12474, 0x12480, 0x12543, 0x12f90, 0x12ff2, 0x13000, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a6e, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af5, 0x16b00, 0x16b45, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d79, 0x16e40, 0x16e9a, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9c, 0x1bca3, 0x1cc00, 0x1ccf9, 0x1cd00, 0x1ceb3, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d1ea, 0x1d200, 0x1d245, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d300, 0x1d356, 0x1d360, 0x1d378, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1da8b, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14f, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e2ff, 0x1e2ff, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e5ff, 0x1e5ff, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8c7, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1e95e, 0x1e95f, 0x1ec71, 0x1ecb4, 0x1ed01, 0x1ed3d, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f100, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0001, 0xe0001, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, 0xf0000, 0xffffd, 0x100000, 0x10fffd, }; /* END of CR_Graph */ /* PROPERTY: 'Lower': POSIX [[:Lower:]] */ static const OnigCodePoint CR_Lower[] = { 675, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00df, 0x00f6, 0x00f8, 0x00ff, 0x0101, 0x0101, 0x0103, 0x0103, 0x0105, 0x0105, 0x0107, 0x0107, 0x0109, 0x0109, 0x010b, 0x010b, 0x010d, 0x010d, 0x010f, 0x010f, 0x0111, 0x0111, 0x0113, 0x0113, 0x0115, 0x0115, 0x0117, 0x0117, 0x0119, 0x0119, 0x011b, 0x011b, 0x011d, 0x011d, 0x011f, 0x011f, 0x0121, 0x0121, 0x0123, 0x0123, 0x0125, 0x0125, 0x0127, 0x0127, 0x0129, 0x0129, 0x012b, 0x012b, 0x012d, 0x012d, 0x012f, 0x012f, 0x0131, 0x0131, 0x0133, 0x0133, 0x0135, 0x0135, 0x0137, 0x0138, 0x013a, 0x013a, 0x013c, 0x013c, 0x013e, 0x013e, 0x0140, 0x0140, 0x0142, 0x0142, 0x0144, 0x0144, 0x0146, 0x0146, 0x0148, 0x0149, 0x014b, 0x014b, 0x014d, 0x014d, 0x014f, 0x014f, 0x0151, 0x0151, 0x0153, 0x0153, 0x0155, 0x0155, 0x0157, 0x0157, 0x0159, 0x0159, 0x015b, 0x015b, 0x015d, 0x015d, 0x015f, 0x015f, 0x0161, 0x0161, 0x0163, 0x0163, 0x0165, 0x0165, 0x0167, 0x0167, 0x0169, 0x0169, 0x016b, 0x016b, 0x016d, 0x016d, 0x016f, 0x016f, 0x0171, 0x0171, 0x0173, 0x0173, 0x0175, 0x0175, 0x0177, 0x0177, 0x017a, 0x017a, 0x017c, 0x017c, 0x017e, 0x0180, 0x0183, 0x0183, 0x0185, 0x0185, 0x0188, 0x0188, 0x018c, 0x018d, 0x0192, 0x0192, 0x0195, 0x0195, 0x0199, 0x019b, 0x019e, 0x019e, 0x01a1, 0x01a1, 0x01a3, 0x01a3, 0x01a5, 0x01a5, 0x01a8, 0x01a8, 0x01aa, 0x01ab, 0x01ad, 0x01ad, 0x01b0, 0x01b0, 0x01b4, 0x01b4, 0x01b6, 0x01b6, 0x01b9, 0x01ba, 0x01bd, 0x01bf, 0x01c6, 0x01c6, 0x01c9, 0x01c9, 0x01cc, 0x01cc, 0x01ce, 0x01ce, 0x01d0, 0x01d0, 0x01d2, 0x01d2, 0x01d4, 0x01d4, 0x01d6, 0x01d6, 0x01d8, 0x01d8, 0x01da, 0x01da, 0x01dc, 0x01dd, 0x01df, 0x01df, 0x01e1, 0x01e1, 0x01e3, 0x01e3, 0x01e5, 0x01e5, 0x01e7, 0x01e7, 0x01e9, 0x01e9, 0x01eb, 0x01eb, 0x01ed, 0x01ed, 0x01ef, 0x01f0, 0x01f3, 0x01f3, 0x01f5, 0x01f5, 0x01f9, 0x01f9, 0x01fb, 0x01fb, 0x01fd, 0x01fd, 0x01ff, 0x01ff, 0x0201, 0x0201, 0x0203, 0x0203, 0x0205, 0x0205, 0x0207, 0x0207, 0x0209, 0x0209, 0x020b, 0x020b, 0x020d, 0x020d, 0x020f, 0x020f, 0x0211, 0x0211, 0x0213, 0x0213, 0x0215, 0x0215, 0x0217, 0x0217, 0x0219, 0x0219, 0x021b, 0x021b, 0x021d, 0x021d, 0x021f, 0x021f, 0x0221, 0x0221, 0x0223, 0x0223, 0x0225, 0x0225, 0x0227, 0x0227, 0x0229, 0x0229, 0x022b, 0x022b, 0x022d, 0x022d, 0x022f, 0x022f, 0x0231, 0x0231, 0x0233, 0x0239, 0x023c, 0x023c, 0x023f, 0x0240, 0x0242, 0x0242, 0x0247, 0x0247, 0x0249, 0x0249, 0x024b, 0x024b, 0x024d, 0x024d, 0x024f, 0x0293, 0x0295, 0x02b8, 0x02c0, 0x02c1, 0x02e0, 0x02e4, 0x0345, 0x0345, 0x0371, 0x0371, 0x0373, 0x0373, 0x0377, 0x0377, 0x037a, 0x037d, 0x0390, 0x0390, 0x03ac, 0x03ce, 0x03d0, 0x03d1, 0x03d5, 0x03d7, 0x03d9, 0x03d9, 0x03db, 0x03db, 0x03dd, 0x03dd, 0x03df, 0x03df, 0x03e1, 0x03e1, 0x03e3, 0x03e3, 0x03e5, 0x03e5, 0x03e7, 0x03e7, 0x03e9, 0x03e9, 0x03eb, 0x03eb, 0x03ed, 0x03ed, 0x03ef, 0x03f3, 0x03f5, 0x03f5, 0x03f8, 0x03f8, 0x03fb, 0x03fc, 0x0430, 0x045f, 0x0461, 0x0461, 0x0463, 0x0463, 0x0465, 0x0465, 0x0467, 0x0467, 0x0469, 0x0469, 0x046b, 0x046b, 0x046d, 0x046d, 0x046f, 0x046f, 0x0471, 0x0471, 0x0473, 0x0473, 0x0475, 0x0475, 0x0477, 0x0477, 0x0479, 0x0479, 0x047b, 0x047b, 0x047d, 0x047d, 0x047f, 0x047f, 0x0481, 0x0481, 0x048b, 0x048b, 0x048d, 0x048d, 0x048f, 0x048f, 0x0491, 0x0491, 0x0493, 0x0493, 0x0495, 0x0495, 0x0497, 0x0497, 0x0499, 0x0499, 0x049b, 0x049b, 0x049d, 0x049d, 0x049f, 0x049f, 0x04a1, 0x04a1, 0x04a3, 0x04a3, 0x04a5, 0x04a5, 0x04a7, 0x04a7, 0x04a9, 0x04a9, 0x04ab, 0x04ab, 0x04ad, 0x04ad, 0x04af, 0x04af, 0x04b1, 0x04b1, 0x04b3, 0x04b3, 0x04b5, 0x04b5, 0x04b7, 0x04b7, 0x04b9, 0x04b9, 0x04bb, 0x04bb, 0x04bd, 0x04bd, 0x04bf, 0x04bf, 0x04c2, 0x04c2, 0x04c4, 0x04c4, 0x04c6, 0x04c6, 0x04c8, 0x04c8, 0x04ca, 0x04ca, 0x04cc, 0x04cc, 0x04ce, 0x04cf, 0x04d1, 0x04d1, 0x04d3, 0x04d3, 0x04d5, 0x04d5, 0x04d7, 0x04d7, 0x04d9, 0x04d9, 0x04db, 0x04db, 0x04dd, 0x04dd, 0x04df, 0x04df, 0x04e1, 0x04e1, 0x04e3, 0x04e3, 0x04e5, 0x04e5, 0x04e7, 0x04e7, 0x04e9, 0x04e9, 0x04eb, 0x04eb, 0x04ed, 0x04ed, 0x04ef, 0x04ef, 0x04f1, 0x04f1, 0x04f3, 0x04f3, 0x04f5, 0x04f5, 0x04f7, 0x04f7, 0x04f9, 0x04f9, 0x04fb, 0x04fb, 0x04fd, 0x04fd, 0x04ff, 0x04ff, 0x0501, 0x0501, 0x0503, 0x0503, 0x0505, 0x0505, 0x0507, 0x0507, 0x0509, 0x0509, 0x050b, 0x050b, 0x050d, 0x050d, 0x050f, 0x050f, 0x0511, 0x0511, 0x0513, 0x0513, 0x0515, 0x0515, 0x0517, 0x0517, 0x0519, 0x0519, 0x051b, 0x051b, 0x051d, 0x051d, 0x051f, 0x051f, 0x0521, 0x0521, 0x0523, 0x0523, 0x0525, 0x0525, 0x0527, 0x0527, 0x0529, 0x0529, 0x052b, 0x052b, 0x052d, 0x052d, 0x052f, 0x052f, 0x0560, 0x0588, 0x10d0, 0x10fa, 0x10fc, 0x10ff, 0x13f8, 0x13fd, 0x1c80, 0x1c88, 0x1c8a, 0x1c8a, 0x1d00, 0x1dbf, 0x1e01, 0x1e01, 0x1e03, 0x1e03, 0x1e05, 0x1e05, 0x1e07, 0x1e07, 0x1e09, 0x1e09, 0x1e0b, 0x1e0b, 0x1e0d, 0x1e0d, 0x1e0f, 0x1e0f, 0x1e11, 0x1e11, 0x1e13, 0x1e13, 0x1e15, 0x1e15, 0x1e17, 0x1e17, 0x1e19, 0x1e19, 0x1e1b, 0x1e1b, 0x1e1d, 0x1e1d, 0x1e1f, 0x1e1f, 0x1e21, 0x1e21, 0x1e23, 0x1e23, 0x1e25, 0x1e25, 0x1e27, 0x1e27, 0x1e29, 0x1e29, 0x1e2b, 0x1e2b, 0x1e2d, 0x1e2d, 0x1e2f, 0x1e2f, 0x1e31, 0x1e31, 0x1e33, 0x1e33, 0x1e35, 0x1e35, 0x1e37, 0x1e37, 0x1e39, 0x1e39, 0x1e3b, 0x1e3b, 0x1e3d, 0x1e3d, 0x1e3f, 0x1e3f, 0x1e41, 0x1e41, 0x1e43, 0x1e43, 0x1e45, 0x1e45, 0x1e47, 0x1e47, 0x1e49, 0x1e49, 0x1e4b, 0x1e4b, 0x1e4d, 0x1e4d, 0x1e4f, 0x1e4f, 0x1e51, 0x1e51, 0x1e53, 0x1e53, 0x1e55, 0x1e55, 0x1e57, 0x1e57, 0x1e59, 0x1e59, 0x1e5b, 0x1e5b, 0x1e5d, 0x1e5d, 0x1e5f, 0x1e5f, 0x1e61, 0x1e61, 0x1e63, 0x1e63, 0x1e65, 0x1e65, 0x1e67, 0x1e67, 0x1e69, 0x1e69, 0x1e6b, 0x1e6b, 0x1e6d, 0x1e6d, 0x1e6f, 0x1e6f, 0x1e71, 0x1e71, 0x1e73, 0x1e73, 0x1e75, 0x1e75, 0x1e77, 0x1e77, 0x1e79, 0x1e79, 0x1e7b, 0x1e7b, 0x1e7d, 0x1e7d, 0x1e7f, 0x1e7f, 0x1e81, 0x1e81, 0x1e83, 0x1e83, 0x1e85, 0x1e85, 0x1e87, 0x1e87, 0x1e89, 0x1e89, 0x1e8b, 0x1e8b, 0x1e8d, 0x1e8d, 0x1e8f, 0x1e8f, 0x1e91, 0x1e91, 0x1e93, 0x1e93, 0x1e95, 0x1e9d, 0x1e9f, 0x1e9f, 0x1ea1, 0x1ea1, 0x1ea3, 0x1ea3, 0x1ea5, 0x1ea5, 0x1ea7, 0x1ea7, 0x1ea9, 0x1ea9, 0x1eab, 0x1eab, 0x1ead, 0x1ead, 0x1eaf, 0x1eaf, 0x1eb1, 0x1eb1, 0x1eb3, 0x1eb3, 0x1eb5, 0x1eb5, 0x1eb7, 0x1eb7, 0x1eb9, 0x1eb9, 0x1ebb, 0x1ebb, 0x1ebd, 0x1ebd, 0x1ebf, 0x1ebf, 0x1ec1, 0x1ec1, 0x1ec3, 0x1ec3, 0x1ec5, 0x1ec5, 0x1ec7, 0x1ec7, 0x1ec9, 0x1ec9, 0x1ecb, 0x1ecb, 0x1ecd, 0x1ecd, 0x1ecf, 0x1ecf, 0x1ed1, 0x1ed1, 0x1ed3, 0x1ed3, 0x1ed5, 0x1ed5, 0x1ed7, 0x1ed7, 0x1ed9, 0x1ed9, 0x1edb, 0x1edb, 0x1edd, 0x1edd, 0x1edf, 0x1edf, 0x1ee1, 0x1ee1, 0x1ee3, 0x1ee3, 0x1ee5, 0x1ee5, 0x1ee7, 0x1ee7, 0x1ee9, 0x1ee9, 0x1eeb, 0x1eeb, 0x1eed, 0x1eed, 0x1eef, 0x1eef, 0x1ef1, 0x1ef1, 0x1ef3, 0x1ef3, 0x1ef5, 0x1ef5, 0x1ef7, 0x1ef7, 0x1ef9, 0x1ef9, 0x1efb, 0x1efb, 0x1efd, 0x1efd, 0x1eff, 0x1f07, 0x1f10, 0x1f15, 0x1f20, 0x1f27, 0x1f30, 0x1f37, 0x1f40, 0x1f45, 0x1f50, 0x1f57, 0x1f60, 0x1f67, 0x1f70, 0x1f7d, 0x1f80, 0x1f87, 0x1f90, 0x1f97, 0x1fa0, 0x1fa7, 0x1fb0, 0x1fb4, 0x1fb6, 0x1fb7, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fc7, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fd7, 0x1fe0, 0x1fe7, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ff7, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x210a, 0x210a, 0x210e, 0x210f, 0x2113, 0x2113, 0x212f, 0x212f, 0x2134, 0x2134, 0x2139, 0x2139, 0x213c, 0x213d, 0x2146, 0x2149, 0x214e, 0x214e, 0x2170, 0x217f, 0x2184, 0x2184, 0x24d0, 0x24e9, 0x2c30, 0x2c5f, 0x2c61, 0x2c61, 0x2c65, 0x2c66, 0x2c68, 0x2c68, 0x2c6a, 0x2c6a, 0x2c6c, 0x2c6c, 0x2c71, 0x2c71, 0x2c73, 0x2c74, 0x2c76, 0x2c7d, 0x2c81, 0x2c81, 0x2c83, 0x2c83, 0x2c85, 0x2c85, 0x2c87, 0x2c87, 0x2c89, 0x2c89, 0x2c8b, 0x2c8b, 0x2c8d, 0x2c8d, 0x2c8f, 0x2c8f, 0x2c91, 0x2c91, 0x2c93, 0x2c93, 0x2c95, 0x2c95, 0x2c97, 0x2c97, 0x2c99, 0x2c99, 0x2c9b, 0x2c9b, 0x2c9d, 0x2c9d, 0x2c9f, 0x2c9f, 0x2ca1, 0x2ca1, 0x2ca3, 0x2ca3, 0x2ca5, 0x2ca5, 0x2ca7, 0x2ca7, 0x2ca9, 0x2ca9, 0x2cab, 0x2cab, 0x2cad, 0x2cad, 0x2caf, 0x2caf, 0x2cb1, 0x2cb1, 0x2cb3, 0x2cb3, 0x2cb5, 0x2cb5, 0x2cb7, 0x2cb7, 0x2cb9, 0x2cb9, 0x2cbb, 0x2cbb, 0x2cbd, 0x2cbd, 0x2cbf, 0x2cbf, 0x2cc1, 0x2cc1, 0x2cc3, 0x2cc3, 0x2cc5, 0x2cc5, 0x2cc7, 0x2cc7, 0x2cc9, 0x2cc9, 0x2ccb, 0x2ccb, 0x2ccd, 0x2ccd, 0x2ccf, 0x2ccf, 0x2cd1, 0x2cd1, 0x2cd3, 0x2cd3, 0x2cd5, 0x2cd5, 0x2cd7, 0x2cd7, 0x2cd9, 0x2cd9, 0x2cdb, 0x2cdb, 0x2cdd, 0x2cdd, 0x2cdf, 0x2cdf, 0x2ce1, 0x2ce1, 0x2ce3, 0x2ce4, 0x2cec, 0x2cec, 0x2cee, 0x2cee, 0x2cf3, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa641, 0xa641, 0xa643, 0xa643, 0xa645, 0xa645, 0xa647, 0xa647, 0xa649, 0xa649, 0xa64b, 0xa64b, 0xa64d, 0xa64d, 0xa64f, 0xa64f, 0xa651, 0xa651, 0xa653, 0xa653, 0xa655, 0xa655, 0xa657, 0xa657, 0xa659, 0xa659, 0xa65b, 0xa65b, 0xa65d, 0xa65d, 0xa65f, 0xa65f, 0xa661, 0xa661, 0xa663, 0xa663, 0xa665, 0xa665, 0xa667, 0xa667, 0xa669, 0xa669, 0xa66b, 0xa66b, 0xa66d, 0xa66d, 0xa681, 0xa681, 0xa683, 0xa683, 0xa685, 0xa685, 0xa687, 0xa687, 0xa689, 0xa689, 0xa68b, 0xa68b, 0xa68d, 0xa68d, 0xa68f, 0xa68f, 0xa691, 0xa691, 0xa693, 0xa693, 0xa695, 0xa695, 0xa697, 0xa697, 0xa699, 0xa699, 0xa69b, 0xa69d, 0xa723, 0xa723, 0xa725, 0xa725, 0xa727, 0xa727, 0xa729, 0xa729, 0xa72b, 0xa72b, 0xa72d, 0xa72d, 0xa72f, 0xa731, 0xa733, 0xa733, 0xa735, 0xa735, 0xa737, 0xa737, 0xa739, 0xa739, 0xa73b, 0xa73b, 0xa73d, 0xa73d, 0xa73f, 0xa73f, 0xa741, 0xa741, 0xa743, 0xa743, 0xa745, 0xa745, 0xa747, 0xa747, 0xa749, 0xa749, 0xa74b, 0xa74b, 0xa74d, 0xa74d, 0xa74f, 0xa74f, 0xa751, 0xa751, 0xa753, 0xa753, 0xa755, 0xa755, 0xa757, 0xa757, 0xa759, 0xa759, 0xa75b, 0xa75b, 0xa75d, 0xa75d, 0xa75f, 0xa75f, 0xa761, 0xa761, 0xa763, 0xa763, 0xa765, 0xa765, 0xa767, 0xa767, 0xa769, 0xa769, 0xa76b, 0xa76b, 0xa76d, 0xa76d, 0xa76f, 0xa778, 0xa77a, 0xa77a, 0xa77c, 0xa77c, 0xa77f, 0xa77f, 0xa781, 0xa781, 0xa783, 0xa783, 0xa785, 0xa785, 0xa787, 0xa787, 0xa78c, 0xa78c, 0xa78e, 0xa78e, 0xa791, 0xa791, 0xa793, 0xa795, 0xa797, 0xa797, 0xa799, 0xa799, 0xa79b, 0xa79b, 0xa79d, 0xa79d, 0xa79f, 0xa79f, 0xa7a1, 0xa7a1, 0xa7a3, 0xa7a3, 0xa7a5, 0xa7a5, 0xa7a7, 0xa7a7, 0xa7a9, 0xa7a9, 0xa7af, 0xa7af, 0xa7b5, 0xa7b5, 0xa7b7, 0xa7b7, 0xa7b9, 0xa7b9, 0xa7bb, 0xa7bb, 0xa7bd, 0xa7bd, 0xa7bf, 0xa7bf, 0xa7c1, 0xa7c1, 0xa7c3, 0xa7c3, 0xa7c8, 0xa7c8, 0xa7ca, 0xa7ca, 0xa7cd, 0xa7cd, 0xa7d1, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7d5, 0xa7d7, 0xa7d7, 0xa7d9, 0xa7d9, 0xa7db, 0xa7db, 0xa7f2, 0xa7f4, 0xa7f6, 0xa7f6, 0xa7f8, 0xa7fa, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff41, 0xff5a, 0x10428, 0x1044f, 0x104d8, 0x104fb, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10780, 0x10780, 0x10783, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10cc0, 0x10cf2, 0x10d70, 0x10d85, 0x118c0, 0x118df, 0x16e60, 0x16e7f, 0x1d41a, 0x1d433, 0x1d44e, 0x1d454, 0x1d456, 0x1d467, 0x1d482, 0x1d49b, 0x1d4b6, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d4cf, 0x1d4ea, 0x1d503, 0x1d51e, 0x1d537, 0x1d552, 0x1d56b, 0x1d586, 0x1d59f, 0x1d5ba, 0x1d5d3, 0x1d5ee, 0x1d607, 0x1d622, 0x1d63b, 0x1d656, 0x1d66f, 0x1d68a, 0x1d6a5, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6e1, 0x1d6fc, 0x1d714, 0x1d716, 0x1d71b, 0x1d736, 0x1d74e, 0x1d750, 0x1d755, 0x1d770, 0x1d788, 0x1d78a, 0x1d78f, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7c9, 0x1d7cb, 0x1d7cb, 0x1df00, 0x1df09, 0x1df0b, 0x1df1e, 0x1df25, 0x1df2a, 0x1e030, 0x1e06d, 0x1e922, 0x1e943, }; /* END of CR_Lower */ /* PROPERTY: 'Print': POSIX [[:Print:]] */ static const OnigCodePoint CR_Print[] = { 733, 0x0020, 0x007e, 0x00a0, 0x0377, 0x037a, 0x037f, 0x0384, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x052f, 0x0531, 0x0556, 0x0559, 0x058a, 0x058d, 0x058f, 0x0591, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f4, 0x0600, 0x070d, 0x070f, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07fa, 0x07fd, 0x082d, 0x0830, 0x083e, 0x0840, 0x085b, 0x085e, 0x085e, 0x0860, 0x086a, 0x0870, 0x088e, 0x0890, 0x0891, 0x0897, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a76, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0af1, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b77, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bfa, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c77, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4f, 0x0d54, 0x0d63, 0x0d66, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df4, 0x0e01, 0x0e3a, 0x0e3f, 0x0e5b, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f97, 0x0f99, 0x0fbc, 0x0fbe, 0x0fcc, 0x0fce, 0x0fda, 0x1000, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x137c, 0x1380, 0x1399, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1400, 0x169c, 0x16a0, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1736, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17dd, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x1800, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1940, 0x1940, 0x1944, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x19de, 0x1a1b, 0x1a1e, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa0, 0x1aad, 0x1ab0, 0x1ace, 0x1b00, 0x1b4c, 0x1b4e, 0x1bf3, 0x1bfc, 0x1c37, 0x1c3b, 0x1c49, 0x1c4d, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cc7, 0x1cd0, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fc4, 0x1fc6, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fdd, 0x1fef, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffe, 0x2000, 0x2027, 0x202a, 0x2064, 0x2066, 0x2071, 0x2074, 0x208e, 0x2090, 0x209c, 0x20a0, 0x20c0, 0x20d0, 0x20f0, 0x2100, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x2460, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2cf3, 0x2cf9, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d70, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x303f, 0x3041, 0x3096, 0x3099, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x3190, 0x31e5, 0x31ef, 0x321e, 0x3220, 0xa48c, 0xa490, 0xa4c6, 0xa4d0, 0xa62b, 0xa640, 0xa6f7, 0xa700, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa82c, 0xa830, 0xa839, 0xa840, 0xa877, 0xa880, 0xa8c5, 0xa8ce, 0xa8d9, 0xa8e0, 0xa953, 0xa95f, 0xa97c, 0xa980, 0xa9cd, 0xa9cf, 0xa9d9, 0xa9de, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa5c, 0xaac2, 0xaadb, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab6b, 0xab70, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xe000, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbc2, 0xfbd3, 0xfd8f, 0xfd92, 0xfdc7, 0xfdcf, 0xfdcf, 0xfdf0, 0xfe19, 0xfe20, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xfeff, 0xfeff, 0xff01, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfff9, 0xfffd, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10100, 0x10102, 0x10107, 0x10133, 0x10137, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102fb, 0x10300, 0x10323, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x1039f, 0x103c3, 0x103c8, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x1056f, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10857, 0x1089e, 0x108a7, 0x108af, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x108fb, 0x1091b, 0x1091f, 0x10939, 0x1093f, 0x1093f, 0x10980, 0x109b7, 0x109bc, 0x109cf, 0x109d2, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a48, 0x10a50, 0x10a58, 0x10a60, 0x10a9f, 0x10ac0, 0x10ae6, 0x10aeb, 0x10af6, 0x10b00, 0x10b35, 0x10b39, 0x10b55, 0x10b58, 0x10b72, 0x10b78, 0x10b91, 0x10b99, 0x10b9c, 0x10ba9, 0x10baf, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10cfa, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d85, 0x10d8e, 0x10d8f, 0x10e60, 0x10e7e, 0x10e80, 0x10ea9, 0x10eab, 0x10ead, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f27, 0x10f30, 0x10f59, 0x10f70, 0x10f89, 0x10fb0, 0x10fcb, 0x10fe0, 0x10ff6, 0x11000, 0x1104d, 0x11052, 0x11075, 0x1107f, 0x110c2, 0x110cd, 0x110cd, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x11147, 0x11150, 0x11176, 0x11180, 0x111df, 0x111e1, 0x111f4, 0x11200, 0x11211, 0x11213, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a9, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d5, 0x113d7, 0x113d8, 0x113e1, 0x113e2, 0x11400, 0x1145b, 0x1145d, 0x11461, 0x11480, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115dd, 0x11600, 0x11644, 0x11650, 0x11659, 0x11660, 0x1166c, 0x11680, 0x116b9, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11746, 0x11800, 0x1183b, 0x118a0, 0x118f2, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11946, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e4, 0x11a00, 0x11a47, 0x11a50, 0x11aa2, 0x11ab0, 0x11af8, 0x11b00, 0x11b09, 0x11bc0, 0x11be1, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c45, 0x11c50, 0x11c6c, 0x11c70, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef8, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f5a, 0x11fb0, 0x11fb0, 0x11fc0, 0x11ff1, 0x11fff, 0x12399, 0x12400, 0x1246e, 0x12470, 0x12474, 0x12480, 0x12543, 0x12f90, 0x12ff2, 0x13000, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a6e, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af5, 0x16b00, 0x16b45, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d79, 0x16e40, 0x16e9a, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9c, 0x1bca3, 0x1cc00, 0x1ccf9, 0x1cd00, 0x1ceb3, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d1ea, 0x1d200, 0x1d245, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d300, 0x1d356, 0x1d360, 0x1d378, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1da8b, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14f, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e2ff, 0x1e2ff, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e5ff, 0x1e5ff, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8c7, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1e95e, 0x1e95f, 0x1ec71, 0x1ecb4, 0x1ed01, 0x1ed3d, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f100, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0001, 0xe0001, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, 0xf0000, 0xffffd, 0x100000, 0x10fffd, }; /* END of CR_Print */ /* PROPERTY: 'PosixPunct': POSIX [[:punct:]] */ static const OnigCodePoint CR_PosixPunct[] = { 349, 0x0021, 0x002f, 0x003a, 0x0040, 0x005b, 0x0060, 0x007b, 0x007e, 0x00a1, 0x00a9, 0x00ab, 0x00ac, 0x00ae, 0x00b1, 0x00b4, 0x00b4, 0x00b6, 0x00b8, 0x00bb, 0x00bb, 0x00bf, 0x00bf, 0x00d7, 0x00d7, 0x00f7, 0x00f7, 0x02c2, 0x02c5, 0x02d2, 0x02df, 0x02e5, 0x02eb, 0x02ed, 0x02ed, 0x02ef, 0x02ff, 0x0375, 0x0375, 0x037e, 0x037e, 0x0384, 0x0385, 0x0387, 0x0387, 0x03f6, 0x03f6, 0x0482, 0x0482, 0x055a, 0x055f, 0x0589, 0x058a, 0x058d, 0x058f, 0x05be, 0x05be, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05c6, 0x05c6, 0x05f3, 0x05f4, 0x0606, 0x060f, 0x061b, 0x061b, 0x061d, 0x061f, 0x066a, 0x066d, 0x06d4, 0x06d4, 0x06de, 0x06de, 0x06e9, 0x06e9, 0x06fd, 0x06fe, 0x0700, 0x070d, 0x07f6, 0x07f9, 0x07fe, 0x07ff, 0x0830, 0x083e, 0x085e, 0x085e, 0x0888, 0x0888, 0x0964, 0x0965, 0x0970, 0x0970, 0x09f2, 0x09f3, 0x09fa, 0x09fb, 0x09fd, 0x09fd, 0x0a76, 0x0a76, 0x0af0, 0x0af1, 0x0b70, 0x0b70, 0x0bf3, 0x0bfa, 0x0c77, 0x0c77, 0x0c7f, 0x0c7f, 0x0c84, 0x0c84, 0x0d4f, 0x0d4f, 0x0d79, 0x0d79, 0x0df4, 0x0df4, 0x0e3f, 0x0e3f, 0x0e4f, 0x0e4f, 0x0e5a, 0x0e5b, 0x0f01, 0x0f17, 0x0f1a, 0x0f1f, 0x0f34, 0x0f34, 0x0f36, 0x0f36, 0x0f38, 0x0f38, 0x0f3a, 0x0f3d, 0x0f85, 0x0f85, 0x0fbe, 0x0fc5, 0x0fc7, 0x0fcc, 0x0fce, 0x0fda, 0x104a, 0x104f, 0x109e, 0x109f, 0x10fb, 0x10fb, 0x1360, 0x1368, 0x1390, 0x1399, 0x1400, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x16eb, 0x16ed, 0x1735, 0x1736, 0x17d4, 0x17d6, 0x17d8, 0x17db, 0x1800, 0x180a, 0x1940, 0x1940, 0x1944, 0x1945, 0x19de, 0x19ff, 0x1a1e, 0x1a1f, 0x1aa0, 0x1aa6, 0x1aa8, 0x1aad, 0x1b4e, 0x1b4f, 0x1b5a, 0x1b6a, 0x1b74, 0x1b7f, 0x1bfc, 0x1bff, 0x1c3b, 0x1c3f, 0x1c7e, 0x1c7f, 0x1cc0, 0x1cc7, 0x1cd3, 0x1cd3, 0x1fbd, 0x1fbd, 0x1fbf, 0x1fc1, 0x1fcd, 0x1fcf, 0x1fdd, 0x1fdf, 0x1fed, 0x1fef, 0x1ffd, 0x1ffe, 0x2010, 0x2027, 0x2030, 0x205e, 0x207a, 0x207e, 0x208a, 0x208e, 0x20a0, 0x20c0, 0x2100, 0x2101, 0x2103, 0x2106, 0x2108, 0x2109, 0x2114, 0x2114, 0x2116, 0x2118, 0x211e, 0x2123, 0x2125, 0x2125, 0x2127, 0x2127, 0x2129, 0x2129, 0x212e, 0x212e, 0x213a, 0x213b, 0x2140, 0x2144, 0x214a, 0x214d, 0x214f, 0x214f, 0x218a, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x249c, 0x24e9, 0x2500, 0x2775, 0x2794, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2bff, 0x2ce5, 0x2cea, 0x2cf9, 0x2cfc, 0x2cfe, 0x2cff, 0x2d70, 0x2d70, 0x2e00, 0x2e2e, 0x2e30, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x2fff, 0x3001, 0x3004, 0x3008, 0x3020, 0x3030, 0x3030, 0x3036, 0x3037, 0x303d, 0x303f, 0x309b, 0x309c, 0x30a0, 0x30a0, 0x30fb, 0x30fb, 0x3190, 0x3191, 0x3196, 0x319f, 0x31c0, 0x31e5, 0x31ef, 0x31ef, 0x3200, 0x321e, 0x322a, 0x3247, 0x3250, 0x3250, 0x3260, 0x327f, 0x328a, 0x32b0, 0x32c0, 0x33ff, 0x4dc0, 0x4dff, 0xa490, 0xa4c6, 0xa4fe, 0xa4ff, 0xa60d, 0xa60f, 0xa673, 0xa673, 0xa67e, 0xa67e, 0xa6f2, 0xa6f7, 0xa700, 0xa716, 0xa720, 0xa721, 0xa789, 0xa78a, 0xa828, 0xa82b, 0xa836, 0xa839, 0xa874, 0xa877, 0xa8ce, 0xa8cf, 0xa8f8, 0xa8fa, 0xa8fc, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa95f, 0xa9c1, 0xa9cd, 0xa9de, 0xa9df, 0xaa5c, 0xaa5f, 0xaa77, 0xaa79, 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xab5b, 0xab5b, 0xab6a, 0xab6b, 0xabeb, 0xabeb, 0xfb29, 0xfb29, 0xfbb2, 0xfbc2, 0xfd3e, 0xfd4f, 0xfdcf, 0xfdcf, 0xfdfc, 0xfdff, 0xfe10, 0xfe19, 0xfe30, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xff01, 0xff0f, 0xff1a, 0xff20, 0xff3b, 0xff40, 0xff5b, 0xff65, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfffc, 0xfffd, 0x10100, 0x10102, 0x10137, 0x1013f, 0x10179, 0x10189, 0x1018c, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fc, 0x1039f, 0x1039f, 0x103d0, 0x103d0, 0x1056f, 0x1056f, 0x10857, 0x10857, 0x10877, 0x10878, 0x1091f, 0x1091f, 0x1093f, 0x1093f, 0x10a50, 0x10a58, 0x10a7f, 0x10a7f, 0x10ac8, 0x10ac8, 0x10af0, 0x10af6, 0x10b39, 0x10b3f, 0x10b99, 0x10b9c, 0x10d6e, 0x10d6e, 0x10d8e, 0x10d8f, 0x10ead, 0x10ead, 0x10f55, 0x10f59, 0x10f86, 0x10f89, 0x11047, 0x1104d, 0x110bb, 0x110bc, 0x110be, 0x110c1, 0x11140, 0x11143, 0x11174, 0x11175, 0x111c5, 0x111c8, 0x111cd, 0x111cd, 0x111db, 0x111db, 0x111dd, 0x111df, 0x11238, 0x1123d, 0x112a9, 0x112a9, 0x113d4, 0x113d5, 0x113d7, 0x113d8, 0x1144b, 0x1144f, 0x1145a, 0x1145b, 0x1145d, 0x1145d, 0x114c6, 0x114c6, 0x115c1, 0x115d7, 0x11641, 0x11643, 0x11660, 0x1166c, 0x116b9, 0x116b9, 0x1173c, 0x1173f, 0x1183b, 0x1183b, 0x11944, 0x11946, 0x119e2, 0x119e2, 0x11a3f, 0x11a46, 0x11a9a, 0x11a9c, 0x11a9e, 0x11aa2, 0x11b00, 0x11b09, 0x11be1, 0x11be1, 0x11c41, 0x11c45, 0x11c70, 0x11c71, 0x11ef7, 0x11ef8, 0x11f43, 0x11f4f, 0x11fd5, 0x11ff1, 0x11fff, 0x11fff, 0x12470, 0x12474, 0x12ff1, 0x12ff2, 0x16a6e, 0x16a6f, 0x16af5, 0x16af5, 0x16b37, 0x16b3f, 0x16b44, 0x16b45, 0x16d6d, 0x16d6f, 0x16e97, 0x16e9a, 0x16fe2, 0x16fe2, 0x1bc9c, 0x1bc9c, 0x1bc9f, 0x1bc9f, 0x1cc00, 0x1ccef, 0x1cd00, 0x1ceb3, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d164, 0x1d16a, 0x1d16c, 0x1d183, 0x1d184, 0x1d18c, 0x1d1a9, 0x1d1ae, 0x1d1ea, 0x1d200, 0x1d241, 0x1d245, 0x1d245, 0x1d300, 0x1d356, 0x1d6c1, 0x1d6c1, 0x1d6db, 0x1d6db, 0x1d6fb, 0x1d6fb, 0x1d715, 0x1d715, 0x1d735, 0x1d735, 0x1d74f, 0x1d74f, 0x1d76f, 0x1d76f, 0x1d789, 0x1d789, 0x1d7a9, 0x1d7a9, 0x1d7c3, 0x1d7c3, 0x1d800, 0x1d9ff, 0x1da37, 0x1da3a, 0x1da6d, 0x1da74, 0x1da76, 0x1da83, 0x1da85, 0x1da8b, 0x1e14f, 0x1e14f, 0x1e2ff, 0x1e2ff, 0x1e5ff, 0x1e5ff, 0x1e95e, 0x1e95f, 0x1ecac, 0x1ecac, 0x1ecb0, 0x1ecb0, 0x1ed2e, 0x1ed2e, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f10d, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbef, }; /* END of CR_PosixPunct */ /* PROPERTY: 'Space': POSIX [[:Space:]] */ static const OnigCodePoint CR_Space[] = { 10, 0x0009, 0x000d, 0x0020, 0x0020, 0x0085, 0x0085, 0x00a0, 0x00a0, 0x1680, 0x1680, 0x2000, 0x200a, 0x2028, 0x2029, 0x202f, 0x202f, 0x205f, 0x205f, 0x3000, 0x3000, }; /* END of CR_Space */ /* PROPERTY: 'Upper': POSIX [[:Upper:]] */ static const OnigCodePoint CR_Upper[] = { 656, 0x0041, 0x005a, 0x00c0, 0x00d6, 0x00d8, 0x00de, 0x0100, 0x0100, 0x0102, 0x0102, 0x0104, 0x0104, 0x0106, 0x0106, 0x0108, 0x0108, 0x010a, 0x010a, 0x010c, 0x010c, 0x010e, 0x010e, 0x0110, 0x0110, 0x0112, 0x0112, 0x0114, 0x0114, 0x0116, 0x0116, 0x0118, 0x0118, 0x011a, 0x011a, 0x011c, 0x011c, 0x011e, 0x011e, 0x0120, 0x0120, 0x0122, 0x0122, 0x0124, 0x0124, 0x0126, 0x0126, 0x0128, 0x0128, 0x012a, 0x012a, 0x012c, 0x012c, 0x012e, 0x012e, 0x0130, 0x0130, 0x0132, 0x0132, 0x0134, 0x0134, 0x0136, 0x0136, 0x0139, 0x0139, 0x013b, 0x013b, 0x013d, 0x013d, 0x013f, 0x013f, 0x0141, 0x0141, 0x0143, 0x0143, 0x0145, 0x0145, 0x0147, 0x0147, 0x014a, 0x014a, 0x014c, 0x014c, 0x014e, 0x014e, 0x0150, 0x0150, 0x0152, 0x0152, 0x0154, 0x0154, 0x0156, 0x0156, 0x0158, 0x0158, 0x015a, 0x015a, 0x015c, 0x015c, 0x015e, 0x015e, 0x0160, 0x0160, 0x0162, 0x0162, 0x0164, 0x0164, 0x0166, 0x0166, 0x0168, 0x0168, 0x016a, 0x016a, 0x016c, 0x016c, 0x016e, 0x016e, 0x0170, 0x0170, 0x0172, 0x0172, 0x0174, 0x0174, 0x0176, 0x0176, 0x0178, 0x0179, 0x017b, 0x017b, 0x017d, 0x017d, 0x0181, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, 0x0189, 0x018b, 0x018e, 0x0191, 0x0193, 0x0194, 0x0196, 0x0198, 0x019c, 0x019d, 0x019f, 0x01a0, 0x01a2, 0x01a2, 0x01a4, 0x01a4, 0x01a6, 0x01a7, 0x01a9, 0x01a9, 0x01ac, 0x01ac, 0x01ae, 0x01af, 0x01b1, 0x01b3, 0x01b5, 0x01b5, 0x01b7, 0x01b8, 0x01bc, 0x01bc, 0x01c4, 0x01c4, 0x01c7, 0x01c7, 0x01ca, 0x01ca, 0x01cd, 0x01cd, 0x01cf, 0x01cf, 0x01d1, 0x01d1, 0x01d3, 0x01d3, 0x01d5, 0x01d5, 0x01d7, 0x01d7, 0x01d9, 0x01d9, 0x01db, 0x01db, 0x01de, 0x01de, 0x01e0, 0x01e0, 0x01e2, 0x01e2, 0x01e4, 0x01e4, 0x01e6, 0x01e6, 0x01e8, 0x01e8, 0x01ea, 0x01ea, 0x01ec, 0x01ec, 0x01ee, 0x01ee, 0x01f1, 0x01f1, 0x01f4, 0x01f4, 0x01f6, 0x01f8, 0x01fa, 0x01fa, 0x01fc, 0x01fc, 0x01fe, 0x01fe, 0x0200, 0x0200, 0x0202, 0x0202, 0x0204, 0x0204, 0x0206, 0x0206, 0x0208, 0x0208, 0x020a, 0x020a, 0x020c, 0x020c, 0x020e, 0x020e, 0x0210, 0x0210, 0x0212, 0x0212, 0x0214, 0x0214, 0x0216, 0x0216, 0x0218, 0x0218, 0x021a, 0x021a, 0x021c, 0x021c, 0x021e, 0x021e, 0x0220, 0x0220, 0x0222, 0x0222, 0x0224, 0x0224, 0x0226, 0x0226, 0x0228, 0x0228, 0x022a, 0x022a, 0x022c, 0x022c, 0x022e, 0x022e, 0x0230, 0x0230, 0x0232, 0x0232, 0x023a, 0x023b, 0x023d, 0x023e, 0x0241, 0x0241, 0x0243, 0x0246, 0x0248, 0x0248, 0x024a, 0x024a, 0x024c, 0x024c, 0x024e, 0x024e, 0x0370, 0x0370, 0x0372, 0x0372, 0x0376, 0x0376, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x038f, 0x0391, 0x03a1, 0x03a3, 0x03ab, 0x03cf, 0x03cf, 0x03d2, 0x03d4, 0x03d8, 0x03d8, 0x03da, 0x03da, 0x03dc, 0x03dc, 0x03de, 0x03de, 0x03e0, 0x03e0, 0x03e2, 0x03e2, 0x03e4, 0x03e4, 0x03e6, 0x03e6, 0x03e8, 0x03e8, 0x03ea, 0x03ea, 0x03ec, 0x03ec, 0x03ee, 0x03ee, 0x03f4, 0x03f4, 0x03f7, 0x03f7, 0x03f9, 0x03fa, 0x03fd, 0x042f, 0x0460, 0x0460, 0x0462, 0x0462, 0x0464, 0x0464, 0x0466, 0x0466, 0x0468, 0x0468, 0x046a, 0x046a, 0x046c, 0x046c, 0x046e, 0x046e, 0x0470, 0x0470, 0x0472, 0x0472, 0x0474, 0x0474, 0x0476, 0x0476, 0x0478, 0x0478, 0x047a, 0x047a, 0x047c, 0x047c, 0x047e, 0x047e, 0x0480, 0x0480, 0x048a, 0x048a, 0x048c, 0x048c, 0x048e, 0x048e, 0x0490, 0x0490, 0x0492, 0x0492, 0x0494, 0x0494, 0x0496, 0x0496, 0x0498, 0x0498, 0x049a, 0x049a, 0x049c, 0x049c, 0x049e, 0x049e, 0x04a0, 0x04a0, 0x04a2, 0x04a2, 0x04a4, 0x04a4, 0x04a6, 0x04a6, 0x04a8, 0x04a8, 0x04aa, 0x04aa, 0x04ac, 0x04ac, 0x04ae, 0x04ae, 0x04b0, 0x04b0, 0x04b2, 0x04b2, 0x04b4, 0x04b4, 0x04b6, 0x04b6, 0x04b8, 0x04b8, 0x04ba, 0x04ba, 0x04bc, 0x04bc, 0x04be, 0x04be, 0x04c0, 0x04c1, 0x04c3, 0x04c3, 0x04c5, 0x04c5, 0x04c7, 0x04c7, 0x04c9, 0x04c9, 0x04cb, 0x04cb, 0x04cd, 0x04cd, 0x04d0, 0x04d0, 0x04d2, 0x04d2, 0x04d4, 0x04d4, 0x04d6, 0x04d6, 0x04d8, 0x04d8, 0x04da, 0x04da, 0x04dc, 0x04dc, 0x04de, 0x04de, 0x04e0, 0x04e0, 0x04e2, 0x04e2, 0x04e4, 0x04e4, 0x04e6, 0x04e6, 0x04e8, 0x04e8, 0x04ea, 0x04ea, 0x04ec, 0x04ec, 0x04ee, 0x04ee, 0x04f0, 0x04f0, 0x04f2, 0x04f2, 0x04f4, 0x04f4, 0x04f6, 0x04f6, 0x04f8, 0x04f8, 0x04fa, 0x04fa, 0x04fc, 0x04fc, 0x04fe, 0x04fe, 0x0500, 0x0500, 0x0502, 0x0502, 0x0504, 0x0504, 0x0506, 0x0506, 0x0508, 0x0508, 0x050a, 0x050a, 0x050c, 0x050c, 0x050e, 0x050e, 0x0510, 0x0510, 0x0512, 0x0512, 0x0514, 0x0514, 0x0516, 0x0516, 0x0518, 0x0518, 0x051a, 0x051a, 0x051c, 0x051c, 0x051e, 0x051e, 0x0520, 0x0520, 0x0522, 0x0522, 0x0524, 0x0524, 0x0526, 0x0526, 0x0528, 0x0528, 0x052a, 0x052a, 0x052c, 0x052c, 0x052e, 0x052e, 0x0531, 0x0556, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x13a0, 0x13f5, 0x1c89, 0x1c89, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1e00, 0x1e00, 0x1e02, 0x1e02, 0x1e04, 0x1e04, 0x1e06, 0x1e06, 0x1e08, 0x1e08, 0x1e0a, 0x1e0a, 0x1e0c, 0x1e0c, 0x1e0e, 0x1e0e, 0x1e10, 0x1e10, 0x1e12, 0x1e12, 0x1e14, 0x1e14, 0x1e16, 0x1e16, 0x1e18, 0x1e18, 0x1e1a, 0x1e1a, 0x1e1c, 0x1e1c, 0x1e1e, 0x1e1e, 0x1e20, 0x1e20, 0x1e22, 0x1e22, 0x1e24, 0x1e24, 0x1e26, 0x1e26, 0x1e28, 0x1e28, 0x1e2a, 0x1e2a, 0x1e2c, 0x1e2c, 0x1e2e, 0x1e2e, 0x1e30, 0x1e30, 0x1e32, 0x1e32, 0x1e34, 0x1e34, 0x1e36, 0x1e36, 0x1e38, 0x1e38, 0x1e3a, 0x1e3a, 0x1e3c, 0x1e3c, 0x1e3e, 0x1e3e, 0x1e40, 0x1e40, 0x1e42, 0x1e42, 0x1e44, 0x1e44, 0x1e46, 0x1e46, 0x1e48, 0x1e48, 0x1e4a, 0x1e4a, 0x1e4c, 0x1e4c, 0x1e4e, 0x1e4e, 0x1e50, 0x1e50, 0x1e52, 0x1e52, 0x1e54, 0x1e54, 0x1e56, 0x1e56, 0x1e58, 0x1e58, 0x1e5a, 0x1e5a, 0x1e5c, 0x1e5c, 0x1e5e, 0x1e5e, 0x1e60, 0x1e60, 0x1e62, 0x1e62, 0x1e64, 0x1e64, 0x1e66, 0x1e66, 0x1e68, 0x1e68, 0x1e6a, 0x1e6a, 0x1e6c, 0x1e6c, 0x1e6e, 0x1e6e, 0x1e70, 0x1e70, 0x1e72, 0x1e72, 0x1e74, 0x1e74, 0x1e76, 0x1e76, 0x1e78, 0x1e78, 0x1e7a, 0x1e7a, 0x1e7c, 0x1e7c, 0x1e7e, 0x1e7e, 0x1e80, 0x1e80, 0x1e82, 0x1e82, 0x1e84, 0x1e84, 0x1e86, 0x1e86, 0x1e88, 0x1e88, 0x1e8a, 0x1e8a, 0x1e8c, 0x1e8c, 0x1e8e, 0x1e8e, 0x1e90, 0x1e90, 0x1e92, 0x1e92, 0x1e94, 0x1e94, 0x1e9e, 0x1e9e, 0x1ea0, 0x1ea0, 0x1ea2, 0x1ea2, 0x1ea4, 0x1ea4, 0x1ea6, 0x1ea6, 0x1ea8, 0x1ea8, 0x1eaa, 0x1eaa, 0x1eac, 0x1eac, 0x1eae, 0x1eae, 0x1eb0, 0x1eb0, 0x1eb2, 0x1eb2, 0x1eb4, 0x1eb4, 0x1eb6, 0x1eb6, 0x1eb8, 0x1eb8, 0x1eba, 0x1eba, 0x1ebc, 0x1ebc, 0x1ebe, 0x1ebe, 0x1ec0, 0x1ec0, 0x1ec2, 0x1ec2, 0x1ec4, 0x1ec4, 0x1ec6, 0x1ec6, 0x1ec8, 0x1ec8, 0x1eca, 0x1eca, 0x1ecc, 0x1ecc, 0x1ece, 0x1ece, 0x1ed0, 0x1ed0, 0x1ed2, 0x1ed2, 0x1ed4, 0x1ed4, 0x1ed6, 0x1ed6, 0x1ed8, 0x1ed8, 0x1eda, 0x1eda, 0x1edc, 0x1edc, 0x1ede, 0x1ede, 0x1ee0, 0x1ee0, 0x1ee2, 0x1ee2, 0x1ee4, 0x1ee4, 0x1ee6, 0x1ee6, 0x1ee8, 0x1ee8, 0x1eea, 0x1eea, 0x1eec, 0x1eec, 0x1eee, 0x1eee, 0x1ef0, 0x1ef0, 0x1ef2, 0x1ef2, 0x1ef4, 0x1ef4, 0x1ef6, 0x1ef6, 0x1ef8, 0x1ef8, 0x1efa, 0x1efa, 0x1efc, 0x1efc, 0x1efe, 0x1efe, 0x1f08, 0x1f0f, 0x1f18, 0x1f1d, 0x1f28, 0x1f2f, 0x1f38, 0x1f3f, 0x1f48, 0x1f4d, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f5f, 0x1f68, 0x1f6f, 0x1fb8, 0x1fbb, 0x1fc8, 0x1fcb, 0x1fd8, 0x1fdb, 0x1fe8, 0x1fec, 0x1ff8, 0x1ffb, 0x2102, 0x2102, 0x2107, 0x2107, 0x210b, 0x210d, 0x2110, 0x2112, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x2130, 0x2133, 0x213e, 0x213f, 0x2145, 0x2145, 0x2160, 0x216f, 0x2183, 0x2183, 0x24b6, 0x24cf, 0x2c00, 0x2c2f, 0x2c60, 0x2c60, 0x2c62, 0x2c64, 0x2c67, 0x2c67, 0x2c69, 0x2c69, 0x2c6b, 0x2c6b, 0x2c6d, 0x2c70, 0x2c72, 0x2c72, 0x2c75, 0x2c75, 0x2c7e, 0x2c80, 0x2c82, 0x2c82, 0x2c84, 0x2c84, 0x2c86, 0x2c86, 0x2c88, 0x2c88, 0x2c8a, 0x2c8a, 0x2c8c, 0x2c8c, 0x2c8e, 0x2c8e, 0x2c90, 0x2c90, 0x2c92, 0x2c92, 0x2c94, 0x2c94, 0x2c96, 0x2c96, 0x2c98, 0x2c98, 0x2c9a, 0x2c9a, 0x2c9c, 0x2c9c, 0x2c9e, 0x2c9e, 0x2ca0, 0x2ca0, 0x2ca2, 0x2ca2, 0x2ca4, 0x2ca4, 0x2ca6, 0x2ca6, 0x2ca8, 0x2ca8, 0x2caa, 0x2caa, 0x2cac, 0x2cac, 0x2cae, 0x2cae, 0x2cb0, 0x2cb0, 0x2cb2, 0x2cb2, 0x2cb4, 0x2cb4, 0x2cb6, 0x2cb6, 0x2cb8, 0x2cb8, 0x2cba, 0x2cba, 0x2cbc, 0x2cbc, 0x2cbe, 0x2cbe, 0x2cc0, 0x2cc0, 0x2cc2, 0x2cc2, 0x2cc4, 0x2cc4, 0x2cc6, 0x2cc6, 0x2cc8, 0x2cc8, 0x2cca, 0x2cca, 0x2ccc, 0x2ccc, 0x2cce, 0x2cce, 0x2cd0, 0x2cd0, 0x2cd2, 0x2cd2, 0x2cd4, 0x2cd4, 0x2cd6, 0x2cd6, 0x2cd8, 0x2cd8, 0x2cda, 0x2cda, 0x2cdc, 0x2cdc, 0x2cde, 0x2cde, 0x2ce0, 0x2ce0, 0x2ce2, 0x2ce2, 0x2ceb, 0x2ceb, 0x2ced, 0x2ced, 0x2cf2, 0x2cf2, 0xa640, 0xa640, 0xa642, 0xa642, 0xa644, 0xa644, 0xa646, 0xa646, 0xa648, 0xa648, 0xa64a, 0xa64a, 0xa64c, 0xa64c, 0xa64e, 0xa64e, 0xa650, 0xa650, 0xa652, 0xa652, 0xa654, 0xa654, 0xa656, 0xa656, 0xa658, 0xa658, 0xa65a, 0xa65a, 0xa65c, 0xa65c, 0xa65e, 0xa65e, 0xa660, 0xa660, 0xa662, 0xa662, 0xa664, 0xa664, 0xa666, 0xa666, 0xa668, 0xa668, 0xa66a, 0xa66a, 0xa66c, 0xa66c, 0xa680, 0xa680, 0xa682, 0xa682, 0xa684, 0xa684, 0xa686, 0xa686, 0xa688, 0xa688, 0xa68a, 0xa68a, 0xa68c, 0xa68c, 0xa68e, 0xa68e, 0xa690, 0xa690, 0xa692, 0xa692, 0xa694, 0xa694, 0xa696, 0xa696, 0xa698, 0xa698, 0xa69a, 0xa69a, 0xa722, 0xa722, 0xa724, 0xa724, 0xa726, 0xa726, 0xa728, 0xa728, 0xa72a, 0xa72a, 0xa72c, 0xa72c, 0xa72e, 0xa72e, 0xa732, 0xa732, 0xa734, 0xa734, 0xa736, 0xa736, 0xa738, 0xa738, 0xa73a, 0xa73a, 0xa73c, 0xa73c, 0xa73e, 0xa73e, 0xa740, 0xa740, 0xa742, 0xa742, 0xa744, 0xa744, 0xa746, 0xa746, 0xa748, 0xa748, 0xa74a, 0xa74a, 0xa74c, 0xa74c, 0xa74e, 0xa74e, 0xa750, 0xa750, 0xa752, 0xa752, 0xa754, 0xa754, 0xa756, 0xa756, 0xa758, 0xa758, 0xa75a, 0xa75a, 0xa75c, 0xa75c, 0xa75e, 0xa75e, 0xa760, 0xa760, 0xa762, 0xa762, 0xa764, 0xa764, 0xa766, 0xa766, 0xa768, 0xa768, 0xa76a, 0xa76a, 0xa76c, 0xa76c, 0xa76e, 0xa76e, 0xa779, 0xa779, 0xa77b, 0xa77b, 0xa77d, 0xa77e, 0xa780, 0xa780, 0xa782, 0xa782, 0xa784, 0xa784, 0xa786, 0xa786, 0xa78b, 0xa78b, 0xa78d, 0xa78d, 0xa790, 0xa790, 0xa792, 0xa792, 0xa796, 0xa796, 0xa798, 0xa798, 0xa79a, 0xa79a, 0xa79c, 0xa79c, 0xa79e, 0xa79e, 0xa7a0, 0xa7a0, 0xa7a2, 0xa7a2, 0xa7a4, 0xa7a4, 0xa7a6, 0xa7a6, 0xa7a8, 0xa7a8, 0xa7aa, 0xa7ae, 0xa7b0, 0xa7b4, 0xa7b6, 0xa7b6, 0xa7b8, 0xa7b8, 0xa7ba, 0xa7ba, 0xa7bc, 0xa7bc, 0xa7be, 0xa7be, 0xa7c0, 0xa7c0, 0xa7c2, 0xa7c2, 0xa7c4, 0xa7c7, 0xa7c9, 0xa7c9, 0xa7cb, 0xa7cc, 0xa7d0, 0xa7d0, 0xa7d6, 0xa7d6, 0xa7d8, 0xa7d8, 0xa7da, 0xa7da, 0xa7dc, 0xa7dc, 0xa7f5, 0xa7f5, 0xff21, 0xff3a, 0x10400, 0x10427, 0x104b0, 0x104d3, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10c80, 0x10cb2, 0x10d50, 0x10d65, 0x118a0, 0x118bf, 0x16e40, 0x16e5f, 0x1d400, 0x1d419, 0x1d434, 0x1d44d, 0x1d468, 0x1d481, 0x1d49c, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b5, 0x1d4d0, 0x1d4e9, 0x1d504, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d538, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d56c, 0x1d585, 0x1d5a0, 0x1d5b9, 0x1d5d4, 0x1d5ed, 0x1d608, 0x1d621, 0x1d63c, 0x1d655, 0x1d670, 0x1d689, 0x1d6a8, 0x1d6c0, 0x1d6e2, 0x1d6fa, 0x1d71c, 0x1d734, 0x1d756, 0x1d76e, 0x1d790, 0x1d7a8, 0x1d7ca, 0x1d7ca, 0x1e900, 0x1e921, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, }; /* END of CR_Upper */ /* PROPERTY: 'XDigit': POSIX [[:XDigit:]] */ static const OnigCodePoint CR_XDigit[] = { 3, 0x0030, 0x0039, 0x0041, 0x0046, 0x0061, 0x0066, }; /* END of CR_XDigit */ /* PROPERTY: 'Word': POSIX [[:Word:]] */ static const OnigCodePoint CR_Word[] = { 795, 0x0030, 0x0039, 0x0041, 0x005a, 0x005f, 0x005f, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0300, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x0483, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0669, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06df, 0x06e8, 0x06ea, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07f5, 0x07fa, 0x07fa, 0x07fd, 0x07fd, 0x0800, 0x082d, 0x0840, 0x085b, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x08e1, 0x08e3, 0x0963, 0x0966, 0x096f, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09f1, 0x09fc, 0x09fc, 0x09fe, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0aef, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b6f, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bef, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d66, 0x0d6f, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e4e, 0x0e50, 0x0e59, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f18, 0x0f19, 0x0f20, 0x0f29, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f3e, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f84, 0x0f86, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x1000, 0x1049, 0x1050, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x135f, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1734, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17d3, 0x17d7, 0x17d7, 0x17dc, 0x17dd, 0x17e0, 0x17e9, 0x180b, 0x180d, 0x180f, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1946, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19d9, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa7, 0x1aa7, 0x1ab0, 0x1ace, 0x1b00, 0x1b4c, 0x1b50, 0x1b59, 0x1b6b, 0x1b73, 0x1b80, 0x1bf3, 0x1c00, 0x1c37, 0x1c40, 0x1c49, 0x1c4d, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1cd0, 0x1cd2, 0x1cd4, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x203f, 0x2040, 0x2054, 0x2054, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x20d0, 0x20f0, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x24b6, 0x24e9, 0x2c00, 0x2ce4, 0x2ceb, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x2e2f, 0x2e2f, 0x3005, 0x3007, 0x3021, 0x302f, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x3099, 0x309a, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa62b, 0xa640, 0xa672, 0xa674, 0xa67d, 0xa67f, 0xa6f1, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa827, 0xa82c, 0xa82c, 0xa840, 0xa873, 0xa880, 0xa8c5, 0xa8d0, 0xa8d9, 0xa8e0, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa92d, 0xa930, 0xa953, 0xa960, 0xa97c, 0xa980, 0xa9c0, 0xa9cf, 0xa9d9, 0xa9e0, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa60, 0xaa76, 0xaa7a, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xabec, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0xfe33, 0xfe34, 0xfe4d, 0xfe4f, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff10, 0xff19, 0xff21, 0xff3a, 0xff3f, 0xff3f, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x101fd, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102e0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae6, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d6d, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f50, 0x10f70, 0x10f85, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11046, 0x11066, 0x11075, 0x1107f, 0x110ba, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x1113f, 0x11144, 0x11147, 0x11150, 0x11173, 0x11176, 0x11176, 0x11180, 0x111c4, 0x111c9, 0x111cc, 0x111ce, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d3, 0x113e1, 0x113e2, 0x11400, 0x1144a, 0x11450, 0x11459, 0x1145e, 0x11461, 0x11480, 0x114c5, 0x114c7, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115c0, 0x115d8, 0x115dd, 0x11600, 0x11640, 0x11644, 0x11644, 0x11650, 0x11659, 0x11680, 0x116b8, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11739, 0x11740, 0x11746, 0x11800, 0x1183a, 0x118a0, 0x118e9, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11943, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a3e, 0x11a47, 0x11a47, 0x11a50, 0x11a99, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c40, 0x11c50, 0x11c59, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f42, 0x11f50, 0x11f5a, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13440, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a70, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af4, 0x16b00, 0x16b36, 0x16b40, 0x16b43, 0x16b50, 0x16b59, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16d70, 0x16d79, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9d, 0x1bc9e, 0x1ccf0, 0x1ccf9, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d165, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8d0, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, 0x1fbf0, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0100, 0xe01ef, }; /* END of CR_Word */ /* PROPERTY: 'Alnum': POSIX [[:Alnum:]] */ static const OnigCodePoint CR_Alnum[] = { 802, 0x0030, 0x0039, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0345, 0x0345, 0x0363, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x05b0, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0657, 0x0659, 0x0669, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06e1, 0x06e8, 0x06ed, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x073f, 0x074d, 0x07b1, 0x07c0, 0x07ea, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x0800, 0x0817, 0x081a, 0x082c, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x0897, 0x08a0, 0x08c9, 0x08d4, 0x08df, 0x08e3, 0x08e9, 0x08f0, 0x093b, 0x093d, 0x094c, 0x094e, 0x0950, 0x0955, 0x0963, 0x0966, 0x096f, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09cc, 0x09ce, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09f1, 0x09fc, 0x09fc, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4c, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acc, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0aef, 0x0af9, 0x0afc, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4c, 0x0b56, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b6f, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcc, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bef, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4c, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccc, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4c, 0x0d4e, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d66, 0x0d6f, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e46, 0x0e4d, 0x0e4d, 0x0e50, 0x0e59, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb9, 0x0ebb, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ecd, 0x0ecd, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f20, 0x0f29, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f83, 0x0f88, 0x0f97, 0x0f99, 0x0fbc, 0x1000, 0x1036, 0x1038, 0x1038, 0x103b, 0x1049, 0x1050, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1713, 0x171f, 0x1733, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17b3, 0x17b6, 0x17c8, 0x17d7, 0x17d7, 0x17dc, 0x17dc, 0x17e0, 0x17e9, 0x1810, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x1938, 0x1946, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19d9, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a61, 0x1a74, 0x1a80, 0x1a89, 0x1a90, 0x1a99, 0x1aa7, 0x1aa7, 0x1abf, 0x1ac0, 0x1acc, 0x1ace, 0x1b00, 0x1b33, 0x1b35, 0x1b43, 0x1b45, 0x1b4c, 0x1b50, 0x1b59, 0x1b80, 0x1ba9, 0x1bac, 0x1be5, 0x1be7, 0x1bf1, 0x1c00, 0x1c36, 0x1c40, 0x1c49, 0x1c4d, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1dd3, 0x1df4, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x24b6, 0x24e9, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x2e2f, 0x2e2f, 0x3005, 0x3007, 0x3021, 0x3029, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa62b, 0xa640, 0xa66e, 0xa674, 0xa67b, 0xa67f, 0xa6ef, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa805, 0xa807, 0xa827, 0xa840, 0xa873, 0xa880, 0xa8c3, 0xa8c5, 0xa8c5, 0xa8d0, 0xa8d9, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa92a, 0xa930, 0xa952, 0xa960, 0xa97c, 0xa980, 0xa9b2, 0xa9b4, 0xa9bf, 0xa9cf, 0xa9d9, 0xa9e0, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa60, 0xaa76, 0xaa7a, 0xaabe, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf5, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff10, 0xff19, 0xff21, 0xff3a, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d69, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10efc, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11045, 0x11066, 0x1106f, 0x11071, 0x11075, 0x11080, 0x110b8, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11132, 0x11136, 0x1113f, 0x11144, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11180, 0x111bf, 0x111c1, 0x111c4, 0x111ce, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11234, 0x11237, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112e8, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134c, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113cd, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11441, 0x11443, 0x11445, 0x11447, 0x1144a, 0x11450, 0x11459, 0x1145f, 0x11461, 0x11480, 0x114c1, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115be, 0x115d8, 0x115dd, 0x11600, 0x1163e, 0x11640, 0x11640, 0x11644, 0x11644, 0x11650, 0x11659, 0x11680, 0x116b5, 0x116b8, 0x116b8, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172a, 0x11730, 0x11739, 0x11740, 0x11746, 0x11800, 0x11838, 0x118a0, 0x118e9, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x1193c, 0x1193f, 0x11942, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119df, 0x119e1, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a32, 0x11a35, 0x11a3e, 0x11a50, 0x11a97, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c3e, 0x11c40, 0x11c40, 0x11c50, 0x11c59, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d41, 0x11d43, 0x11d43, 0x11d46, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d96, 0x11d98, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f40, 0x11f50, 0x11f59, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1612e, 0x16130, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a70, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b40, 0x16b43, 0x16b50, 0x16b59, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16d70, 0x16d79, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9e, 0x1bc9e, 0x1ccf0, 0x1ccf9, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e2f0, 0x1e2f9, 0x1e4d0, 0x1e4eb, 0x1e4f0, 0x1e4f9, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5fa, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e900, 0x1e943, 0x1e947, 0x1e947, 0x1e94b, 0x1e94b, 0x1e950, 0x1e959, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, 0x1fbf0, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Alnum */ /* PROPERTY: 'ASCII': POSIX [[:ASCII:]] */ static const OnigCodePoint CR_ASCII[] = { 1, 0x0000, 0x007f, }; /* END of CR_ASCII */ /* PROPERTY: 'ASCII_Hex_Digit': Binary Property */ #define CR_ASCII_Hex_Digit CR_XDigit /* PROPERTY: 'Adlam': Script */ static const OnigCodePoint CR_Adlam[] = { 3, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1e95e, 0x1e95f, }; /* END of CR_Adlam */ /* PROPERTY: 'Ahom': Script */ static const OnigCodePoint CR_Ahom[] = { 3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11746, }; /* END of CR_Ahom */ /* PROPERTY: 'Alphabetic': Derived Property */ #define CR_Alphabetic CR_Alpha /* PROPERTY: 'Anatolian_Hieroglyphs': Script */ static const OnigCodePoint CR_Anatolian_Hieroglyphs[] = { 1, 0x14400, 0x14646, }; /* END of CR_Anatolian_Hieroglyphs */ /* PROPERTY: 'Any': - */ static const OnigCodePoint CR_Any[] = { 1, 0x0000, 0x10ffff, }; /* END of CR_Any */ /* PROPERTY: 'Arabic': Script */ static const OnigCodePoint CR_Arabic[] = { 59, 0x0600, 0x0604, 0x0606, 0x060b, 0x060d, 0x061a, 0x061c, 0x061e, 0x0620, 0x063f, 0x0641, 0x064a, 0x0656, 0x066f, 0x0671, 0x06dc, 0x06de, 0x06ff, 0x0750, 0x077f, 0x0870, 0x088e, 0x0890, 0x0891, 0x0897, 0x08e1, 0x08e3, 0x08ff, 0xfb50, 0xfbc2, 0xfbd3, 0xfd3d, 0xfd40, 0xfd8f, 0xfd92, 0xfdc7, 0xfdcf, 0xfdcf, 0xfdf0, 0xfdff, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0x10e60, 0x10e7e, 0x10ec2, 0x10ec4, 0x10efc, 0x10eff, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, }; /* END of CR_Arabic */ /* PROPERTY: 'Armenian': Script */ static const OnigCodePoint CR_Armenian[] = { 4, 0x0531, 0x0556, 0x0559, 0x058a, 0x058d, 0x058f, 0xfb13, 0xfb17, }; /* END of CR_Armenian */ /* PROPERTY: 'Assigned': - */ static const OnigCodePoint CR_Assigned[] = { 731, 0x0000, 0x0377, 0x037a, 0x037f, 0x0384, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x052f, 0x0531, 0x0556, 0x0559, 0x058a, 0x058d, 0x058f, 0x0591, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f4, 0x0600, 0x070d, 0x070f, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07fa, 0x07fd, 0x082d, 0x0830, 0x083e, 0x0840, 0x085b, 0x085e, 0x085e, 0x0860, 0x086a, 0x0870, 0x088e, 0x0890, 0x0891, 0x0897, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a76, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0af1, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b77, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bfa, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c77, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4f, 0x0d54, 0x0d63, 0x0d66, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df4, 0x0e01, 0x0e3a, 0x0e3f, 0x0e5b, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f97, 0x0f99, 0x0fbc, 0x0fbe, 0x0fcc, 0x0fce, 0x0fda, 0x1000, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x137c, 0x1380, 0x1399, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1400, 0x169c, 0x16a0, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1736, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17dd, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x1800, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1940, 0x1940, 0x1944, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x19de, 0x1a1b, 0x1a1e, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa0, 0x1aad, 0x1ab0, 0x1ace, 0x1b00, 0x1b4c, 0x1b4e, 0x1bf3, 0x1bfc, 0x1c37, 0x1c3b, 0x1c49, 0x1c4d, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cc7, 0x1cd0, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fc4, 0x1fc6, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fdd, 0x1fef, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffe, 0x2000, 0x2064, 0x2066, 0x2071, 0x2074, 0x208e, 0x2090, 0x209c, 0x20a0, 0x20c0, 0x20d0, 0x20f0, 0x2100, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x2460, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2cf3, 0x2cf9, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d70, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x303f, 0x3041, 0x3096, 0x3099, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x3190, 0x31e5, 0x31ef, 0x321e, 0x3220, 0xa48c, 0xa490, 0xa4c6, 0xa4d0, 0xa62b, 0xa640, 0xa6f7, 0xa700, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa82c, 0xa830, 0xa839, 0xa840, 0xa877, 0xa880, 0xa8c5, 0xa8ce, 0xa8d9, 0xa8e0, 0xa953, 0xa95f, 0xa97c, 0xa980, 0xa9cd, 0xa9cf, 0xa9d9, 0xa9de, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa5c, 0xaac2, 0xaadb, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab6b, 0xab70, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xd800, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbc2, 0xfbd3, 0xfd8f, 0xfd92, 0xfdc7, 0xfdcf, 0xfdcf, 0xfdf0, 0xfe19, 0xfe20, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xfeff, 0xfeff, 0xff01, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfff9, 0xfffd, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10100, 0x10102, 0x10107, 0x10133, 0x10137, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102fb, 0x10300, 0x10323, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x1039f, 0x103c3, 0x103c8, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x1056f, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10857, 0x1089e, 0x108a7, 0x108af, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x108fb, 0x1091b, 0x1091f, 0x10939, 0x1093f, 0x1093f, 0x10980, 0x109b7, 0x109bc, 0x109cf, 0x109d2, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a48, 0x10a50, 0x10a58, 0x10a60, 0x10a9f, 0x10ac0, 0x10ae6, 0x10aeb, 0x10af6, 0x10b00, 0x10b35, 0x10b39, 0x10b55, 0x10b58, 0x10b72, 0x10b78, 0x10b91, 0x10b99, 0x10b9c, 0x10ba9, 0x10baf, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10cfa, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d85, 0x10d8e, 0x10d8f, 0x10e60, 0x10e7e, 0x10e80, 0x10ea9, 0x10eab, 0x10ead, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f27, 0x10f30, 0x10f59, 0x10f70, 0x10f89, 0x10fb0, 0x10fcb, 0x10fe0, 0x10ff6, 0x11000, 0x1104d, 0x11052, 0x11075, 0x1107f, 0x110c2, 0x110cd, 0x110cd, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x11147, 0x11150, 0x11176, 0x11180, 0x111df, 0x111e1, 0x111f4, 0x11200, 0x11211, 0x11213, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a9, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d5, 0x113d7, 0x113d8, 0x113e1, 0x113e2, 0x11400, 0x1145b, 0x1145d, 0x11461, 0x11480, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115dd, 0x11600, 0x11644, 0x11650, 0x11659, 0x11660, 0x1166c, 0x11680, 0x116b9, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11746, 0x11800, 0x1183b, 0x118a0, 0x118f2, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11946, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e4, 0x11a00, 0x11a47, 0x11a50, 0x11aa2, 0x11ab0, 0x11af8, 0x11b00, 0x11b09, 0x11bc0, 0x11be1, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c45, 0x11c50, 0x11c6c, 0x11c70, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef8, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f5a, 0x11fb0, 0x11fb0, 0x11fc0, 0x11ff1, 0x11fff, 0x12399, 0x12400, 0x1246e, 0x12470, 0x12474, 0x12480, 0x12543, 0x12f90, 0x12ff2, 0x13000, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a6e, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af5, 0x16b00, 0x16b45, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d79, 0x16e40, 0x16e9a, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9c, 0x1bca3, 0x1cc00, 0x1ccf9, 0x1cd00, 0x1ceb3, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d1ea, 0x1d200, 0x1d245, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d300, 0x1d356, 0x1d360, 0x1d378, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1da8b, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14f, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e2ff, 0x1e2ff, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e5ff, 0x1e5ff, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8c7, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1e95e, 0x1e95f, 0x1ec71, 0x1ecb4, 0x1ed01, 0x1ed3d, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f100, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0001, 0xe0001, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, 0xf0000, 0xffffd, 0x100000, 0x10fffd, }; /* END of CR_Assigned */ /* PROPERTY: 'Avestan': Script */ static const OnigCodePoint CR_Avestan[] = { 2, 0x10b00, 0x10b35, 0x10b39, 0x10b3f, }; /* END of CR_Avestan */ /* PROPERTY: 'Balinese': Script */ static const OnigCodePoint CR_Balinese[] = { 2, 0x1b00, 0x1b4c, 0x1b4e, 0x1b7f, }; /* END of CR_Balinese */ /* PROPERTY: 'Bamum': Script */ static const OnigCodePoint CR_Bamum[] = { 2, 0xa6a0, 0xa6f7, 0x16800, 0x16a38, }; /* END of CR_Bamum */ /* PROPERTY: 'Bassa_Vah': Script */ static const OnigCodePoint CR_Bassa_Vah[] = { 2, 0x16ad0, 0x16aed, 0x16af0, 0x16af5, }; /* END of CR_Bassa_Vah */ /* PROPERTY: 'Batak': Script */ static const OnigCodePoint CR_Batak[] = { 2, 0x1bc0, 0x1bf3, 0x1bfc, 0x1bff, }; /* END of CR_Batak */ /* PROPERTY: 'Bengali': Script */ static const OnigCodePoint CR_Bengali[] = { 14, 0x0980, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09fe, }; /* END of CR_Bengali */ /* PROPERTY: 'Bhaiksuki': Script */ static const OnigCodePoint CR_Bhaiksuki[] = { 4, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c45, 0x11c50, 0x11c6c, }; /* END of CR_Bhaiksuki */ /* PROPERTY: 'Bidi_Control': Binary Property */ static const OnigCodePoint CR_Bidi_Control[] = { 4, 0x061c, 0x061c, 0x200e, 0x200f, 0x202a, 0x202e, 0x2066, 0x2069, }; /* END of CR_Bidi_Control */ /* PROPERTY: 'Bopomofo': Script */ static const OnigCodePoint CR_Bopomofo[] = { 3, 0x02ea, 0x02eb, 0x3105, 0x312f, 0x31a0, 0x31bf, }; /* END of CR_Bopomofo */ /* PROPERTY: 'Brahmi': Script */ static const OnigCodePoint CR_Brahmi[] = { 3, 0x11000, 0x1104d, 0x11052, 0x11075, 0x1107f, 0x1107f, }; /* END of CR_Brahmi */ /* PROPERTY: 'Braille': Script */ static const OnigCodePoint CR_Braille[] = { 1, 0x2800, 0x28ff, }; /* END of CR_Braille */ /* PROPERTY: 'Buginese': Script */ static const OnigCodePoint CR_Buginese[] = { 2, 0x1a00, 0x1a1b, 0x1a1e, 0x1a1f, }; /* END of CR_Buginese */ /* PROPERTY: 'Buhid': Script */ static const OnigCodePoint CR_Buhid[] = { 1, 0x1740, 0x1753, }; /* END of CR_Buhid */ /* PROPERTY: 'C': Major Category */ static const OnigCodePoint CR_C[] = { 736, 0x0000, 0x001f, 0x007f, 0x009f, 0x00ad, 0x00ad, 0x0378, 0x0379, 0x0380, 0x0383, 0x038b, 0x038b, 0x038d, 0x038d, 0x03a2, 0x03a2, 0x0530, 0x0530, 0x0557, 0x0558, 0x058b, 0x058c, 0x0590, 0x0590, 0x05c8, 0x05cf, 0x05eb, 0x05ee, 0x05f5, 0x0605, 0x061c, 0x061c, 0x06dd, 0x06dd, 0x070e, 0x070f, 0x074b, 0x074c, 0x07b2, 0x07bf, 0x07fb, 0x07fc, 0x082e, 0x082f, 0x083f, 0x083f, 0x085c, 0x085d, 0x085f, 0x085f, 0x086b, 0x086f, 0x088f, 0x0896, 0x08e2, 0x08e2, 0x0984, 0x0984, 0x098d, 0x098e, 0x0991, 0x0992, 0x09a9, 0x09a9, 0x09b1, 0x09b1, 0x09b3, 0x09b5, 0x09ba, 0x09bb, 0x09c5, 0x09c6, 0x09c9, 0x09ca, 0x09cf, 0x09d6, 0x09d8, 0x09db, 0x09de, 0x09de, 0x09e4, 0x09e5, 0x09ff, 0x0a00, 0x0a04, 0x0a04, 0x0a0b, 0x0a0e, 0x0a11, 0x0a12, 0x0a29, 0x0a29, 0x0a31, 0x0a31, 0x0a34, 0x0a34, 0x0a37, 0x0a37, 0x0a3a, 0x0a3b, 0x0a3d, 0x0a3d, 0x0a43, 0x0a46, 0x0a49, 0x0a4a, 0x0a4e, 0x0a50, 0x0a52, 0x0a58, 0x0a5d, 0x0a5d, 0x0a5f, 0x0a65, 0x0a77, 0x0a80, 0x0a84, 0x0a84, 0x0a8e, 0x0a8e, 0x0a92, 0x0a92, 0x0aa9, 0x0aa9, 0x0ab1, 0x0ab1, 0x0ab4, 0x0ab4, 0x0aba, 0x0abb, 0x0ac6, 0x0ac6, 0x0aca, 0x0aca, 0x0ace, 0x0acf, 0x0ad1, 0x0adf, 0x0ae4, 0x0ae5, 0x0af2, 0x0af8, 0x0b00, 0x0b00, 0x0b04, 0x0b04, 0x0b0d, 0x0b0e, 0x0b11, 0x0b12, 0x0b29, 0x0b29, 0x0b31, 0x0b31, 0x0b34, 0x0b34, 0x0b3a, 0x0b3b, 0x0b45, 0x0b46, 0x0b49, 0x0b4a, 0x0b4e, 0x0b54, 0x0b58, 0x0b5b, 0x0b5e, 0x0b5e, 0x0b64, 0x0b65, 0x0b78, 0x0b81, 0x0b84, 0x0b84, 0x0b8b, 0x0b8d, 0x0b91, 0x0b91, 0x0b96, 0x0b98, 0x0b9b, 0x0b9b, 0x0b9d, 0x0b9d, 0x0ba0, 0x0ba2, 0x0ba5, 0x0ba7, 0x0bab, 0x0bad, 0x0bba, 0x0bbd, 0x0bc3, 0x0bc5, 0x0bc9, 0x0bc9, 0x0bce, 0x0bcf, 0x0bd1, 0x0bd6, 0x0bd8, 0x0be5, 0x0bfb, 0x0bff, 0x0c0d, 0x0c0d, 0x0c11, 0x0c11, 0x0c29, 0x0c29, 0x0c3a, 0x0c3b, 0x0c45, 0x0c45, 0x0c49, 0x0c49, 0x0c4e, 0x0c54, 0x0c57, 0x0c57, 0x0c5b, 0x0c5c, 0x0c5e, 0x0c5f, 0x0c64, 0x0c65, 0x0c70, 0x0c76, 0x0c8d, 0x0c8d, 0x0c91, 0x0c91, 0x0ca9, 0x0ca9, 0x0cb4, 0x0cb4, 0x0cba, 0x0cbb, 0x0cc5, 0x0cc5, 0x0cc9, 0x0cc9, 0x0cce, 0x0cd4, 0x0cd7, 0x0cdc, 0x0cdf, 0x0cdf, 0x0ce4, 0x0ce5, 0x0cf0, 0x0cf0, 0x0cf4, 0x0cff, 0x0d0d, 0x0d0d, 0x0d11, 0x0d11, 0x0d45, 0x0d45, 0x0d49, 0x0d49, 0x0d50, 0x0d53, 0x0d64, 0x0d65, 0x0d80, 0x0d80, 0x0d84, 0x0d84, 0x0d97, 0x0d99, 0x0db2, 0x0db2, 0x0dbc, 0x0dbc, 0x0dbe, 0x0dbf, 0x0dc7, 0x0dc9, 0x0dcb, 0x0dce, 0x0dd5, 0x0dd5, 0x0dd7, 0x0dd7, 0x0de0, 0x0de5, 0x0df0, 0x0df1, 0x0df5, 0x0e00, 0x0e3b, 0x0e3e, 0x0e5c, 0x0e80, 0x0e83, 0x0e83, 0x0e85, 0x0e85, 0x0e8b, 0x0e8b, 0x0ea4, 0x0ea4, 0x0ea6, 0x0ea6, 0x0ebe, 0x0ebf, 0x0ec5, 0x0ec5, 0x0ec7, 0x0ec7, 0x0ecf, 0x0ecf, 0x0eda, 0x0edb, 0x0ee0, 0x0eff, 0x0f48, 0x0f48, 0x0f6d, 0x0f70, 0x0f98, 0x0f98, 0x0fbd, 0x0fbd, 0x0fcd, 0x0fcd, 0x0fdb, 0x0fff, 0x10c6, 0x10c6, 0x10c8, 0x10cc, 0x10ce, 0x10cf, 0x1249, 0x1249, 0x124e, 0x124f, 0x1257, 0x1257, 0x1259, 0x1259, 0x125e, 0x125f, 0x1289, 0x1289, 0x128e, 0x128f, 0x12b1, 0x12b1, 0x12b6, 0x12b7, 0x12bf, 0x12bf, 0x12c1, 0x12c1, 0x12c6, 0x12c7, 0x12d7, 0x12d7, 0x1311, 0x1311, 0x1316, 0x1317, 0x135b, 0x135c, 0x137d, 0x137f, 0x139a, 0x139f, 0x13f6, 0x13f7, 0x13fe, 0x13ff, 0x169d, 0x169f, 0x16f9, 0x16ff, 0x1716, 0x171e, 0x1737, 0x173f, 0x1754, 0x175f, 0x176d, 0x176d, 0x1771, 0x1771, 0x1774, 0x177f, 0x17de, 0x17df, 0x17ea, 0x17ef, 0x17fa, 0x17ff, 0x180e, 0x180e, 0x181a, 0x181f, 0x1879, 0x187f, 0x18ab, 0x18af, 0x18f6, 0x18ff, 0x191f, 0x191f, 0x192c, 0x192f, 0x193c, 0x193f, 0x1941, 0x1943, 0x196e, 0x196f, 0x1975, 0x197f, 0x19ac, 0x19af, 0x19ca, 0x19cf, 0x19db, 0x19dd, 0x1a1c, 0x1a1d, 0x1a5f, 0x1a5f, 0x1a7d, 0x1a7e, 0x1a8a, 0x1a8f, 0x1a9a, 0x1a9f, 0x1aae, 0x1aaf, 0x1acf, 0x1aff, 0x1b4d, 0x1b4d, 0x1bf4, 0x1bfb, 0x1c38, 0x1c3a, 0x1c4a, 0x1c4c, 0x1c8b, 0x1c8f, 0x1cbb, 0x1cbc, 0x1cc8, 0x1ccf, 0x1cfb, 0x1cff, 0x1f16, 0x1f17, 0x1f1e, 0x1f1f, 0x1f46, 0x1f47, 0x1f4e, 0x1f4f, 0x1f58, 0x1f58, 0x1f5a, 0x1f5a, 0x1f5c, 0x1f5c, 0x1f5e, 0x1f5e, 0x1f7e, 0x1f7f, 0x1fb5, 0x1fb5, 0x1fc5, 0x1fc5, 0x1fd4, 0x1fd5, 0x1fdc, 0x1fdc, 0x1ff0, 0x1ff1, 0x1ff5, 0x1ff5, 0x1fff, 0x1fff, 0x200b, 0x200f, 0x202a, 0x202e, 0x2060, 0x206f, 0x2072, 0x2073, 0x208f, 0x208f, 0x209d, 0x209f, 0x20c1, 0x20cf, 0x20f1, 0x20ff, 0x218c, 0x218f, 0x242a, 0x243f, 0x244b, 0x245f, 0x2b74, 0x2b75, 0x2b96, 0x2b96, 0x2cf4, 0x2cf8, 0x2d26, 0x2d26, 0x2d28, 0x2d2c, 0x2d2e, 0x2d2f, 0x2d68, 0x2d6e, 0x2d71, 0x2d7e, 0x2d97, 0x2d9f, 0x2da7, 0x2da7, 0x2daf, 0x2daf, 0x2db7, 0x2db7, 0x2dbf, 0x2dbf, 0x2dc7, 0x2dc7, 0x2dcf, 0x2dcf, 0x2dd7, 0x2dd7, 0x2ddf, 0x2ddf, 0x2e5e, 0x2e7f, 0x2e9a, 0x2e9a, 0x2ef4, 0x2eff, 0x2fd6, 0x2fef, 0x3040, 0x3040, 0x3097, 0x3098, 0x3100, 0x3104, 0x3130, 0x3130, 0x318f, 0x318f, 0x31e6, 0x31ee, 0x321f, 0x321f, 0xa48d, 0xa48f, 0xa4c7, 0xa4cf, 0xa62c, 0xa63f, 0xa6f8, 0xa6ff, 0xa7ce, 0xa7cf, 0xa7d2, 0xa7d2, 0xa7d4, 0xa7d4, 0xa7dd, 0xa7f1, 0xa82d, 0xa82f, 0xa83a, 0xa83f, 0xa878, 0xa87f, 0xa8c6, 0xa8cd, 0xa8da, 0xa8df, 0xa954, 0xa95e, 0xa97d, 0xa97f, 0xa9ce, 0xa9ce, 0xa9da, 0xa9dd, 0xa9ff, 0xa9ff, 0xaa37, 0xaa3f, 0xaa4e, 0xaa4f, 0xaa5a, 0xaa5b, 0xaac3, 0xaada, 0xaaf7, 0xab00, 0xab07, 0xab08, 0xab0f, 0xab10, 0xab17, 0xab1f, 0xab27, 0xab27, 0xab2f, 0xab2f, 0xab6c, 0xab6f, 0xabee, 0xabef, 0xabfa, 0xabff, 0xd7a4, 0xd7af, 0xd7c7, 0xd7ca, 0xd7fc, 0xf8ff, 0xfa6e, 0xfa6f, 0xfada, 0xfaff, 0xfb07, 0xfb12, 0xfb18, 0xfb1c, 0xfb37, 0xfb37, 0xfb3d, 0xfb3d, 0xfb3f, 0xfb3f, 0xfb42, 0xfb42, 0xfb45, 0xfb45, 0xfbc3, 0xfbd2, 0xfd90, 0xfd91, 0xfdc8, 0xfdce, 0xfdd0, 0xfdef, 0xfe1a, 0xfe1f, 0xfe53, 0xfe53, 0xfe67, 0xfe67, 0xfe6c, 0xfe6f, 0xfe75, 0xfe75, 0xfefd, 0xff00, 0xffbf, 0xffc1, 0xffc8, 0xffc9, 0xffd0, 0xffd1, 0xffd8, 0xffd9, 0xffdd, 0xffdf, 0xffe7, 0xffe7, 0xffef, 0xfffb, 0xfffe, 0xffff, 0x1000c, 0x1000c, 0x10027, 0x10027, 0x1003b, 0x1003b, 0x1003e, 0x1003e, 0x1004e, 0x1004f, 0x1005e, 0x1007f, 0x100fb, 0x100ff, 0x10103, 0x10106, 0x10134, 0x10136, 0x1018f, 0x1018f, 0x1019d, 0x1019f, 0x101a1, 0x101cf, 0x101fe, 0x1027f, 0x1029d, 0x1029f, 0x102d1, 0x102df, 0x102fc, 0x102ff, 0x10324, 0x1032c, 0x1034b, 0x1034f, 0x1037b, 0x1037f, 0x1039e, 0x1039e, 0x103c4, 0x103c7, 0x103d6, 0x103ff, 0x1049e, 0x1049f, 0x104aa, 0x104af, 0x104d4, 0x104d7, 0x104fc, 0x104ff, 0x10528, 0x1052f, 0x10564, 0x1056e, 0x1057b, 0x1057b, 0x1058b, 0x1058b, 0x10593, 0x10593, 0x10596, 0x10596, 0x105a2, 0x105a2, 0x105b2, 0x105b2, 0x105ba, 0x105ba, 0x105bd, 0x105bf, 0x105f4, 0x105ff, 0x10737, 0x1073f, 0x10756, 0x1075f, 0x10768, 0x1077f, 0x10786, 0x10786, 0x107b1, 0x107b1, 0x107bb, 0x107ff, 0x10806, 0x10807, 0x10809, 0x10809, 0x10836, 0x10836, 0x10839, 0x1083b, 0x1083d, 0x1083e, 0x10856, 0x10856, 0x1089f, 0x108a6, 0x108b0, 0x108df, 0x108f3, 0x108f3, 0x108f6, 0x108fa, 0x1091c, 0x1091e, 0x1093a, 0x1093e, 0x10940, 0x1097f, 0x109b8, 0x109bb, 0x109d0, 0x109d1, 0x10a04, 0x10a04, 0x10a07, 0x10a0b, 0x10a14, 0x10a14, 0x10a18, 0x10a18, 0x10a36, 0x10a37, 0x10a3b, 0x10a3e, 0x10a49, 0x10a4f, 0x10a59, 0x10a5f, 0x10aa0, 0x10abf, 0x10ae7, 0x10aea, 0x10af7, 0x10aff, 0x10b36, 0x10b38, 0x10b56, 0x10b57, 0x10b73, 0x10b77, 0x10b92, 0x10b98, 0x10b9d, 0x10ba8, 0x10bb0, 0x10bff, 0x10c49, 0x10c7f, 0x10cb3, 0x10cbf, 0x10cf3, 0x10cf9, 0x10d28, 0x10d2f, 0x10d3a, 0x10d3f, 0x10d66, 0x10d68, 0x10d86, 0x10d8d, 0x10d90, 0x10e5f, 0x10e7f, 0x10e7f, 0x10eaa, 0x10eaa, 0x10eae, 0x10eaf, 0x10eb2, 0x10ec1, 0x10ec5, 0x10efb, 0x10f28, 0x10f2f, 0x10f5a, 0x10f6f, 0x10f8a, 0x10faf, 0x10fcc, 0x10fdf, 0x10ff7, 0x10fff, 0x1104e, 0x11051, 0x11076, 0x1107e, 0x110bd, 0x110bd, 0x110c3, 0x110cf, 0x110e9, 0x110ef, 0x110fa, 0x110ff, 0x11135, 0x11135, 0x11148, 0x1114f, 0x11177, 0x1117f, 0x111e0, 0x111e0, 0x111f5, 0x111ff, 0x11212, 0x11212, 0x11242, 0x1127f, 0x11287, 0x11287, 0x11289, 0x11289, 0x1128e, 0x1128e, 0x1129e, 0x1129e, 0x112aa, 0x112af, 0x112eb, 0x112ef, 0x112fa, 0x112ff, 0x11304, 0x11304, 0x1130d, 0x1130e, 0x11311, 0x11312, 0x11329, 0x11329, 0x11331, 0x11331, 0x11334, 0x11334, 0x1133a, 0x1133a, 0x11345, 0x11346, 0x11349, 0x1134a, 0x1134e, 0x1134f, 0x11351, 0x11356, 0x11358, 0x1135c, 0x11364, 0x11365, 0x1136d, 0x1136f, 0x11375, 0x1137f, 0x1138a, 0x1138a, 0x1138c, 0x1138d, 0x1138f, 0x1138f, 0x113b6, 0x113b6, 0x113c1, 0x113c1, 0x113c3, 0x113c4, 0x113c6, 0x113c6, 0x113cb, 0x113cb, 0x113d6, 0x113d6, 0x113d9, 0x113e0, 0x113e3, 0x113ff, 0x1145c, 0x1145c, 0x11462, 0x1147f, 0x114c8, 0x114cf, 0x114da, 0x1157f, 0x115b6, 0x115b7, 0x115de, 0x115ff, 0x11645, 0x1164f, 0x1165a, 0x1165f, 0x1166d, 0x1167f, 0x116ba, 0x116bf, 0x116ca, 0x116cf, 0x116e4, 0x116ff, 0x1171b, 0x1171c, 0x1172c, 0x1172f, 0x11747, 0x117ff, 0x1183c, 0x1189f, 0x118f3, 0x118fe, 0x11907, 0x11908, 0x1190a, 0x1190b, 0x11914, 0x11914, 0x11917, 0x11917, 0x11936, 0x11936, 0x11939, 0x1193a, 0x11947, 0x1194f, 0x1195a, 0x1199f, 0x119a8, 0x119a9, 0x119d8, 0x119d9, 0x119e5, 0x119ff, 0x11a48, 0x11a4f, 0x11aa3, 0x11aaf, 0x11af9, 0x11aff, 0x11b0a, 0x11bbf, 0x11be2, 0x11bef, 0x11bfa, 0x11bff, 0x11c09, 0x11c09, 0x11c37, 0x11c37, 0x11c46, 0x11c4f, 0x11c6d, 0x11c6f, 0x11c90, 0x11c91, 0x11ca8, 0x11ca8, 0x11cb7, 0x11cff, 0x11d07, 0x11d07, 0x11d0a, 0x11d0a, 0x11d37, 0x11d39, 0x11d3b, 0x11d3b, 0x11d3e, 0x11d3e, 0x11d48, 0x11d4f, 0x11d5a, 0x11d5f, 0x11d66, 0x11d66, 0x11d69, 0x11d69, 0x11d8f, 0x11d8f, 0x11d92, 0x11d92, 0x11d99, 0x11d9f, 0x11daa, 0x11edf, 0x11ef9, 0x11eff, 0x11f11, 0x11f11, 0x11f3b, 0x11f3d, 0x11f5b, 0x11faf, 0x11fb1, 0x11fbf, 0x11ff2, 0x11ffe, 0x1239a, 0x123ff, 0x1246f, 0x1246f, 0x12475, 0x1247f, 0x12544, 0x12f8f, 0x12ff3, 0x12fff, 0x13430, 0x1343f, 0x13456, 0x1345f, 0x143fb, 0x143ff, 0x14647, 0x160ff, 0x1613a, 0x167ff, 0x16a39, 0x16a3f, 0x16a5f, 0x16a5f, 0x16a6a, 0x16a6d, 0x16abf, 0x16abf, 0x16aca, 0x16acf, 0x16aee, 0x16aef, 0x16af6, 0x16aff, 0x16b46, 0x16b4f, 0x16b5a, 0x16b5a, 0x16b62, 0x16b62, 0x16b78, 0x16b7c, 0x16b90, 0x16d3f, 0x16d7a, 0x16e3f, 0x16e9b, 0x16eff, 0x16f4b, 0x16f4e, 0x16f88, 0x16f8e, 0x16fa0, 0x16fdf, 0x16fe5, 0x16fef, 0x16ff2, 0x16fff, 0x187f8, 0x187ff, 0x18cd6, 0x18cfe, 0x18d09, 0x1afef, 0x1aff4, 0x1aff4, 0x1affc, 0x1affc, 0x1afff, 0x1afff, 0x1b123, 0x1b131, 0x1b133, 0x1b14f, 0x1b153, 0x1b154, 0x1b156, 0x1b163, 0x1b168, 0x1b16f, 0x1b2fc, 0x1bbff, 0x1bc6b, 0x1bc6f, 0x1bc7d, 0x1bc7f, 0x1bc89, 0x1bc8f, 0x1bc9a, 0x1bc9b, 0x1bca0, 0x1cbff, 0x1ccfa, 0x1ccff, 0x1ceb4, 0x1ceff, 0x1cf2e, 0x1cf2f, 0x1cf47, 0x1cf4f, 0x1cfc4, 0x1cfff, 0x1d0f6, 0x1d0ff, 0x1d127, 0x1d128, 0x1d173, 0x1d17a, 0x1d1eb, 0x1d1ff, 0x1d246, 0x1d2bf, 0x1d2d4, 0x1d2df, 0x1d2f4, 0x1d2ff, 0x1d357, 0x1d35f, 0x1d379, 0x1d3ff, 0x1d455, 0x1d455, 0x1d49d, 0x1d49d, 0x1d4a0, 0x1d4a1, 0x1d4a3, 0x1d4a4, 0x1d4a7, 0x1d4a8, 0x1d4ad, 0x1d4ad, 0x1d4ba, 0x1d4ba, 0x1d4bc, 0x1d4bc, 0x1d4c4, 0x1d4c4, 0x1d506, 0x1d506, 0x1d50b, 0x1d50c, 0x1d515, 0x1d515, 0x1d51d, 0x1d51d, 0x1d53a, 0x1d53a, 0x1d53f, 0x1d53f, 0x1d545, 0x1d545, 0x1d547, 0x1d549, 0x1d551, 0x1d551, 0x1d6a6, 0x1d6a7, 0x1d7cc, 0x1d7cd, 0x1da8c, 0x1da9a, 0x1daa0, 0x1daa0, 0x1dab0, 0x1deff, 0x1df1f, 0x1df24, 0x1df2b, 0x1dfff, 0x1e007, 0x1e007, 0x1e019, 0x1e01a, 0x1e022, 0x1e022, 0x1e025, 0x1e025, 0x1e02b, 0x1e02f, 0x1e06e, 0x1e08e, 0x1e090, 0x1e0ff, 0x1e12d, 0x1e12f, 0x1e13e, 0x1e13f, 0x1e14a, 0x1e14d, 0x1e150, 0x1e28f, 0x1e2af, 0x1e2bf, 0x1e2fa, 0x1e2fe, 0x1e300, 0x1e4cf, 0x1e4fa, 0x1e5cf, 0x1e5fb, 0x1e5fe, 0x1e600, 0x1e7df, 0x1e7e7, 0x1e7e7, 0x1e7ec, 0x1e7ec, 0x1e7ef, 0x1e7ef, 0x1e7ff, 0x1e7ff, 0x1e8c5, 0x1e8c6, 0x1e8d7, 0x1e8ff, 0x1e94c, 0x1e94f, 0x1e95a, 0x1e95d, 0x1e960, 0x1ec70, 0x1ecb5, 0x1ed00, 0x1ed3e, 0x1edff, 0x1ee04, 0x1ee04, 0x1ee20, 0x1ee20, 0x1ee23, 0x1ee23, 0x1ee25, 0x1ee26, 0x1ee28, 0x1ee28, 0x1ee33, 0x1ee33, 0x1ee38, 0x1ee38, 0x1ee3a, 0x1ee3a, 0x1ee3c, 0x1ee41, 0x1ee43, 0x1ee46, 0x1ee48, 0x1ee48, 0x1ee4a, 0x1ee4a, 0x1ee4c, 0x1ee4c, 0x1ee50, 0x1ee50, 0x1ee53, 0x1ee53, 0x1ee55, 0x1ee56, 0x1ee58, 0x1ee58, 0x1ee5a, 0x1ee5a, 0x1ee5c, 0x1ee5c, 0x1ee5e, 0x1ee5e, 0x1ee60, 0x1ee60, 0x1ee63, 0x1ee63, 0x1ee65, 0x1ee66, 0x1ee6b, 0x1ee6b, 0x1ee73, 0x1ee73, 0x1ee78, 0x1ee78, 0x1ee7d, 0x1ee7d, 0x1ee7f, 0x1ee7f, 0x1ee8a, 0x1ee8a, 0x1ee9c, 0x1eea0, 0x1eea4, 0x1eea4, 0x1eeaa, 0x1eeaa, 0x1eebc, 0x1eeef, 0x1eef2, 0x1efff, 0x1f02c, 0x1f02f, 0x1f094, 0x1f09f, 0x1f0af, 0x1f0b0, 0x1f0c0, 0x1f0c0, 0x1f0d0, 0x1f0d0, 0x1f0f6, 0x1f0ff, 0x1f1ae, 0x1f1e5, 0x1f203, 0x1f20f, 0x1f23c, 0x1f23f, 0x1f249, 0x1f24f, 0x1f252, 0x1f25f, 0x1f266, 0x1f2ff, 0x1f6d8, 0x1f6db, 0x1f6ed, 0x1f6ef, 0x1f6fd, 0x1f6ff, 0x1f777, 0x1f77a, 0x1f7da, 0x1f7df, 0x1f7ec, 0x1f7ef, 0x1f7f1, 0x1f7ff, 0x1f80c, 0x1f80f, 0x1f848, 0x1f84f, 0x1f85a, 0x1f85f, 0x1f888, 0x1f88f, 0x1f8ae, 0x1f8af, 0x1f8bc, 0x1f8bf, 0x1f8c2, 0x1f8ff, 0x1fa54, 0x1fa5f, 0x1fa6e, 0x1fa6f, 0x1fa7d, 0x1fa7f, 0x1fa8a, 0x1fa8e, 0x1fac7, 0x1facd, 0x1fadd, 0x1fade, 0x1faea, 0x1faef, 0x1faf9, 0x1faff, 0x1fb93, 0x1fb93, 0x1fbfa, 0x1ffff, 0x2a6e0, 0x2a6ff, 0x2b73a, 0x2b73f, 0x2b81e, 0x2b81f, 0x2cea2, 0x2ceaf, 0x2ebe1, 0x2ebef, 0x2ee5e, 0x2f7ff, 0x2fa1e, 0x2ffff, 0x3134b, 0x3134f, 0x323b0, 0xe00ff, 0xe01f0, 0x10ffff, }; /* END of CR_C */ /* PROPERTY: 'Canadian_Aboriginal': Script */ static const OnigCodePoint CR_Canadian_Aboriginal[] = { 3, 0x1400, 0x167f, 0x18b0, 0x18f5, 0x11ab0, 0x11abf, }; /* END of CR_Canadian_Aboriginal */ /* PROPERTY: 'Carian': Script */ static const OnigCodePoint CR_Carian[] = { 1, 0x102a0, 0x102d0, }; /* END of CR_Carian */ /* PROPERTY: 'Case_Ignorable': Derived Property */ static const OnigCodePoint CR_Case_Ignorable[] = { 452, 0x0027, 0x0027, 0x002e, 0x002e, 0x003a, 0x003a, 0x005e, 0x005e, 0x0060, 0x0060, 0x00a8, 0x00a8, 0x00ad, 0x00ad, 0x00af, 0x00af, 0x00b4, 0x00b4, 0x00b7, 0x00b8, 0x02b0, 0x036f, 0x0374, 0x0375, 0x037a, 0x037a, 0x0384, 0x0385, 0x0387, 0x0387, 0x0483, 0x0489, 0x0559, 0x0559, 0x055f, 0x055f, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05f4, 0x05f4, 0x0600, 0x0605, 0x0610, 0x061a, 0x061c, 0x061c, 0x0640, 0x0640, 0x064b, 0x065f, 0x0670, 0x0670, 0x06d6, 0x06dd, 0x06df, 0x06e8, 0x06ea, 0x06ed, 0x070f, 0x070f, 0x0711, 0x0711, 0x0730, 0x074a, 0x07a6, 0x07b0, 0x07eb, 0x07f5, 0x07fa, 0x07fa, 0x07fd, 0x07fd, 0x0816, 0x082d, 0x0859, 0x085b, 0x0888, 0x0888, 0x0890, 0x0891, 0x0897, 0x089f, 0x08c9, 0x0902, 0x093a, 0x093a, 0x093c, 0x093c, 0x0941, 0x0948, 0x094d, 0x094d, 0x0951, 0x0957, 0x0962, 0x0963, 0x0971, 0x0971, 0x0981, 0x0981, 0x09bc, 0x09bc, 0x09c1, 0x09c4, 0x09cd, 0x09cd, 0x09e2, 0x09e3, 0x09fe, 0x09fe, 0x0a01, 0x0a02, 0x0a3c, 0x0a3c, 0x0a41, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a70, 0x0a71, 0x0a75, 0x0a75, 0x0a81, 0x0a82, 0x0abc, 0x0abc, 0x0ac1, 0x0ac5, 0x0ac7, 0x0ac8, 0x0acd, 0x0acd, 0x0ae2, 0x0ae3, 0x0afa, 0x0aff, 0x0b01, 0x0b01, 0x0b3c, 0x0b3c, 0x0b3f, 0x0b3f, 0x0b41, 0x0b44, 0x0b4d, 0x0b4d, 0x0b55, 0x0b56, 0x0b62, 0x0b63, 0x0b82, 0x0b82, 0x0bc0, 0x0bc0, 0x0bcd, 0x0bcd, 0x0c00, 0x0c00, 0x0c04, 0x0c04, 0x0c3c, 0x0c3c, 0x0c3e, 0x0c40, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c62, 0x0c63, 0x0c81, 0x0c81, 0x0cbc, 0x0cbc, 0x0cbf, 0x0cbf, 0x0cc6, 0x0cc6, 0x0ccc, 0x0ccd, 0x0ce2, 0x0ce3, 0x0d00, 0x0d01, 0x0d3b, 0x0d3c, 0x0d41, 0x0d44, 0x0d4d, 0x0d4d, 0x0d62, 0x0d63, 0x0d81, 0x0d81, 0x0dca, 0x0dca, 0x0dd2, 0x0dd4, 0x0dd6, 0x0dd6, 0x0e31, 0x0e31, 0x0e34, 0x0e3a, 0x0e46, 0x0e4e, 0x0eb1, 0x0eb1, 0x0eb4, 0x0ebc, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0f18, 0x0f19, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f71, 0x0f7e, 0x0f80, 0x0f84, 0x0f86, 0x0f87, 0x0f8d, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x102d, 0x1030, 0x1032, 0x1037, 0x1039, 0x103a, 0x103d, 0x103e, 0x1058, 0x1059, 0x105e, 0x1060, 0x1071, 0x1074, 0x1082, 0x1082, 0x1085, 0x1086, 0x108d, 0x108d, 0x109d, 0x109d, 0x10fc, 0x10fc, 0x135d, 0x135f, 0x1712, 0x1714, 0x1732, 0x1733, 0x1752, 0x1753, 0x1772, 0x1773, 0x17b4, 0x17b5, 0x17b7, 0x17bd, 0x17c6, 0x17c6, 0x17c9, 0x17d3, 0x17d7, 0x17d7, 0x17dd, 0x17dd, 0x180b, 0x180f, 0x1843, 0x1843, 0x1885, 0x1886, 0x18a9, 0x18a9, 0x1920, 0x1922, 0x1927, 0x1928, 0x1932, 0x1932, 0x1939, 0x193b, 0x1a17, 0x1a18, 0x1a1b, 0x1a1b, 0x1a56, 0x1a56, 0x1a58, 0x1a5e, 0x1a60, 0x1a60, 0x1a62, 0x1a62, 0x1a65, 0x1a6c, 0x1a73, 0x1a7c, 0x1a7f, 0x1a7f, 0x1aa7, 0x1aa7, 0x1ab0, 0x1ace, 0x1b00, 0x1b03, 0x1b34, 0x1b34, 0x1b36, 0x1b3a, 0x1b3c, 0x1b3c, 0x1b42, 0x1b42, 0x1b6b, 0x1b73, 0x1b80, 0x1b81, 0x1ba2, 0x1ba5, 0x1ba8, 0x1ba9, 0x1bab, 0x1bad, 0x1be6, 0x1be6, 0x1be8, 0x1be9, 0x1bed, 0x1bed, 0x1bef, 0x1bf1, 0x1c2c, 0x1c33, 0x1c36, 0x1c37, 0x1c78, 0x1c7d, 0x1cd0, 0x1cd2, 0x1cd4, 0x1ce0, 0x1ce2, 0x1ce8, 0x1ced, 0x1ced, 0x1cf4, 0x1cf4, 0x1cf8, 0x1cf9, 0x1d2c, 0x1d6a, 0x1d78, 0x1d78, 0x1d9b, 0x1dff, 0x1fbd, 0x1fbd, 0x1fbf, 0x1fc1, 0x1fcd, 0x1fcf, 0x1fdd, 0x1fdf, 0x1fed, 0x1fef, 0x1ffd, 0x1ffe, 0x200b, 0x200f, 0x2018, 0x2019, 0x2024, 0x2024, 0x2027, 0x2027, 0x202a, 0x202e, 0x2060, 0x2064, 0x2066, 0x206f, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x20d0, 0x20f0, 0x2c7c, 0x2c7d, 0x2cef, 0x2cf1, 0x2d6f, 0x2d6f, 0x2d7f, 0x2d7f, 0x2de0, 0x2dff, 0x2e2f, 0x2e2f, 0x3005, 0x3005, 0x302a, 0x302d, 0x3031, 0x3035, 0x303b, 0x303b, 0x3099, 0x309e, 0x30fc, 0x30fe, 0xa015, 0xa015, 0xa4f8, 0xa4fd, 0xa60c, 0xa60c, 0xa66f, 0xa672, 0xa674, 0xa67d, 0xa67f, 0xa67f, 0xa69c, 0xa69f, 0xa6f0, 0xa6f1, 0xa700, 0xa721, 0xa770, 0xa770, 0xa788, 0xa78a, 0xa7f2, 0xa7f4, 0xa7f8, 0xa7f9, 0xa802, 0xa802, 0xa806, 0xa806, 0xa80b, 0xa80b, 0xa825, 0xa826, 0xa82c, 0xa82c, 0xa8c4, 0xa8c5, 0xa8e0, 0xa8f1, 0xa8ff, 0xa8ff, 0xa926, 0xa92d, 0xa947, 0xa951, 0xa980, 0xa982, 0xa9b3, 0xa9b3, 0xa9b6, 0xa9b9, 0xa9bc, 0xa9bd, 0xa9cf, 0xa9cf, 0xa9e5, 0xa9e6, 0xaa29, 0xaa2e, 0xaa31, 0xaa32, 0xaa35, 0xaa36, 0xaa43, 0xaa43, 0xaa4c, 0xaa4c, 0xaa70, 0xaa70, 0xaa7c, 0xaa7c, 0xaab0, 0xaab0, 0xaab2, 0xaab4, 0xaab7, 0xaab8, 0xaabe, 0xaabf, 0xaac1, 0xaac1, 0xaadd, 0xaadd, 0xaaec, 0xaaed, 0xaaf3, 0xaaf4, 0xaaf6, 0xaaf6, 0xab5b, 0xab5f, 0xab69, 0xab6b, 0xabe5, 0xabe5, 0xabe8, 0xabe8, 0xabed, 0xabed, 0xfb1e, 0xfb1e, 0xfbb2, 0xfbc2, 0xfe00, 0xfe0f, 0xfe13, 0xfe13, 0xfe20, 0xfe2f, 0xfe52, 0xfe52, 0xfe55, 0xfe55, 0xfeff, 0xfeff, 0xff07, 0xff07, 0xff0e, 0xff0e, 0xff1a, 0xff1a, 0xff3e, 0xff3e, 0xff40, 0xff40, 0xff70, 0xff70, 0xff9e, 0xff9f, 0xffe3, 0xffe3, 0xfff9, 0xfffb, 0x101fd, 0x101fd, 0x102e0, 0x102e0, 0x10376, 0x1037a, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10a01, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a0f, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10ae5, 0x10ae6, 0x10d24, 0x10d27, 0x10d4e, 0x10d4e, 0x10d69, 0x10d6d, 0x10d6f, 0x10d6f, 0x10eab, 0x10eac, 0x10efc, 0x10eff, 0x10f46, 0x10f50, 0x10f82, 0x10f85, 0x11001, 0x11001, 0x11038, 0x11046, 0x11070, 0x11070, 0x11073, 0x11074, 0x1107f, 0x11081, 0x110b3, 0x110b6, 0x110b9, 0x110ba, 0x110bd, 0x110bd, 0x110c2, 0x110c2, 0x110cd, 0x110cd, 0x11100, 0x11102, 0x11127, 0x1112b, 0x1112d, 0x11134, 0x11173, 0x11173, 0x11180, 0x11181, 0x111b6, 0x111be, 0x111c9, 0x111cc, 0x111cf, 0x111cf, 0x1122f, 0x11231, 0x11234, 0x11234, 0x11236, 0x11237, 0x1123e, 0x1123e, 0x11241, 0x11241, 0x112df, 0x112df, 0x112e3, 0x112ea, 0x11300, 0x11301, 0x1133b, 0x1133c, 0x11340, 0x11340, 0x11366, 0x1136c, 0x11370, 0x11374, 0x113bb, 0x113c0, 0x113ce, 0x113ce, 0x113d0, 0x113d0, 0x113d2, 0x113d2, 0x113e1, 0x113e2, 0x11438, 0x1143f, 0x11442, 0x11444, 0x11446, 0x11446, 0x1145e, 0x1145e, 0x114b3, 0x114b8, 0x114ba, 0x114ba, 0x114bf, 0x114c0, 0x114c2, 0x114c3, 0x115b2, 0x115b5, 0x115bc, 0x115bd, 0x115bf, 0x115c0, 0x115dc, 0x115dd, 0x11633, 0x1163a, 0x1163d, 0x1163d, 0x1163f, 0x11640, 0x116ab, 0x116ab, 0x116ad, 0x116ad, 0x116b0, 0x116b5, 0x116b7, 0x116b7, 0x1171d, 0x1171d, 0x1171f, 0x1171f, 0x11722, 0x11725, 0x11727, 0x1172b, 0x1182f, 0x11837, 0x11839, 0x1183a, 0x1193b, 0x1193c, 0x1193e, 0x1193e, 0x11943, 0x11943, 0x119d4, 0x119d7, 0x119da, 0x119db, 0x119e0, 0x119e0, 0x11a01, 0x11a0a, 0x11a33, 0x11a38, 0x11a3b, 0x11a3e, 0x11a47, 0x11a47, 0x11a51, 0x11a56, 0x11a59, 0x11a5b, 0x11a8a, 0x11a96, 0x11a98, 0x11a99, 0x11c30, 0x11c36, 0x11c38, 0x11c3d, 0x11c3f, 0x11c3f, 0x11c92, 0x11ca7, 0x11caa, 0x11cb0, 0x11cb2, 0x11cb3, 0x11cb5, 0x11cb6, 0x11d31, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d45, 0x11d47, 0x11d47, 0x11d90, 0x11d91, 0x11d95, 0x11d95, 0x11d97, 0x11d97, 0x11ef3, 0x11ef4, 0x11f00, 0x11f01, 0x11f36, 0x11f3a, 0x11f40, 0x11f40, 0x11f42, 0x11f42, 0x11f5a, 0x11f5a, 0x13430, 0x13440, 0x13447, 0x13455, 0x1611e, 0x16129, 0x1612d, 0x1612f, 0x16af0, 0x16af4, 0x16b30, 0x16b36, 0x16b40, 0x16b43, 0x16d40, 0x16d42, 0x16d6b, 0x16d6c, 0x16f4f, 0x16f4f, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe4, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1bc9d, 0x1bc9e, 0x1bca0, 0x1bca3, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d167, 0x1d169, 0x1d173, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e130, 0x1e13d, 0x1e2ae, 0x1e2ae, 0x1e2ec, 0x1e2ef, 0x1e4eb, 0x1e4ef, 0x1e5ee, 0x1e5ef, 0x1e8d0, 0x1e8d6, 0x1e944, 0x1e94b, 0x1f3fb, 0x1f3ff, 0xe0001, 0xe0001, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, }; /* END of CR_Case_Ignorable */ /* PROPERTY: 'Cased': Derived Property */ static const OnigCodePoint CR_Cased[] = { 159, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x01ba, 0x01bc, 0x01bf, 0x01c4, 0x0293, 0x0295, 0x02b8, 0x02c0, 0x02c1, 0x02e0, 0x02e4, 0x0345, 0x0345, 0x0370, 0x0373, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0560, 0x0588, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x10ff, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1d00, 0x1dbf, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2134, 0x2139, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x217f, 0x2183, 0x2184, 0x24b6, 0x24e9, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa640, 0xa66d, 0xa680, 0xa69d, 0xa722, 0xa787, 0xa78b, 0xa78e, 0xa790, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa7f6, 0xa7f8, 0xa7fa, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff21, 0xff3a, 0xff41, 0xff5a, 0x10400, 0x1044f, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10780, 0x10780, 0x10783, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d50, 0x10d65, 0x10d70, 0x10d85, 0x118a0, 0x118df, 0x16e40, 0x16e7f, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1df00, 0x1df09, 0x1df0b, 0x1df1e, 0x1df25, 0x1df2a, 0x1e030, 0x1e06d, 0x1e900, 0x1e943, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, }; /* END of CR_Cased */ /* PROPERTY: 'Caucasian_Albanian': Script */ static const OnigCodePoint CR_Caucasian_Albanian[] = { 2, 0x10530, 0x10563, 0x1056f, 0x1056f, }; /* END of CR_Caucasian_Albanian */ /* PROPERTY: 'Cc': General Category */ #define CR_Cc CR_Cntrl /* PROPERTY: 'Cf': General Category */ static const OnigCodePoint CR_Cf[] = { 21, 0x00ad, 0x00ad, 0x0600, 0x0605, 0x061c, 0x061c, 0x06dd, 0x06dd, 0x070f, 0x070f, 0x0890, 0x0891, 0x08e2, 0x08e2, 0x180e, 0x180e, 0x200b, 0x200f, 0x202a, 0x202e, 0x2060, 0x2064, 0x2066, 0x206f, 0xfeff, 0xfeff, 0xfff9, 0xfffb, 0x110bd, 0x110bd, 0x110cd, 0x110cd, 0x13430, 0x1343f, 0x1bca0, 0x1bca3, 0x1d173, 0x1d17a, 0xe0001, 0xe0001, 0xe0020, 0xe007f, }; /* END of CR_Cf */ /* PROPERTY: 'Chakma': Script */ static const OnigCodePoint CR_Chakma[] = { 2, 0x11100, 0x11134, 0x11136, 0x11147, }; /* END of CR_Chakma */ /* PROPERTY: 'Cham': Script */ static const OnigCodePoint CR_Cham[] = { 4, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa5c, 0xaa5f, }; /* END of CR_Cham */ /* PROPERTY: 'Changes_When_Casefolded': Derived Property */ static const OnigCodePoint CR_Changes_When_Casefolded[] = { 626, 0x0041, 0x005a, 0x00b5, 0x00b5, 0x00c0, 0x00d6, 0x00d8, 0x00df, 0x0100, 0x0100, 0x0102, 0x0102, 0x0104, 0x0104, 0x0106, 0x0106, 0x0108, 0x0108, 0x010a, 0x010a, 0x010c, 0x010c, 0x010e, 0x010e, 0x0110, 0x0110, 0x0112, 0x0112, 0x0114, 0x0114, 0x0116, 0x0116, 0x0118, 0x0118, 0x011a, 0x011a, 0x011c, 0x011c, 0x011e, 0x011e, 0x0120, 0x0120, 0x0122, 0x0122, 0x0124, 0x0124, 0x0126, 0x0126, 0x0128, 0x0128, 0x012a, 0x012a, 0x012c, 0x012c, 0x012e, 0x012e, 0x0130, 0x0130, 0x0132, 0x0132, 0x0134, 0x0134, 0x0136, 0x0136, 0x0139, 0x0139, 0x013b, 0x013b, 0x013d, 0x013d, 0x013f, 0x013f, 0x0141, 0x0141, 0x0143, 0x0143, 0x0145, 0x0145, 0x0147, 0x0147, 0x0149, 0x014a, 0x014c, 0x014c, 0x014e, 0x014e, 0x0150, 0x0150, 0x0152, 0x0152, 0x0154, 0x0154, 0x0156, 0x0156, 0x0158, 0x0158, 0x015a, 0x015a, 0x015c, 0x015c, 0x015e, 0x015e, 0x0160, 0x0160, 0x0162, 0x0162, 0x0164, 0x0164, 0x0166, 0x0166, 0x0168, 0x0168, 0x016a, 0x016a, 0x016c, 0x016c, 0x016e, 0x016e, 0x0170, 0x0170, 0x0172, 0x0172, 0x0174, 0x0174, 0x0176, 0x0176, 0x0178, 0x0179, 0x017b, 0x017b, 0x017d, 0x017d, 0x017f, 0x017f, 0x0181, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, 0x0189, 0x018b, 0x018e, 0x0191, 0x0193, 0x0194, 0x0196, 0x0198, 0x019c, 0x019d, 0x019f, 0x01a0, 0x01a2, 0x01a2, 0x01a4, 0x01a4, 0x01a6, 0x01a7, 0x01a9, 0x01a9, 0x01ac, 0x01ac, 0x01ae, 0x01af, 0x01b1, 0x01b3, 0x01b5, 0x01b5, 0x01b7, 0x01b8, 0x01bc, 0x01bc, 0x01c4, 0x01c5, 0x01c7, 0x01c8, 0x01ca, 0x01cb, 0x01cd, 0x01cd, 0x01cf, 0x01cf, 0x01d1, 0x01d1, 0x01d3, 0x01d3, 0x01d5, 0x01d5, 0x01d7, 0x01d7, 0x01d9, 0x01d9, 0x01db, 0x01db, 0x01de, 0x01de, 0x01e0, 0x01e0, 0x01e2, 0x01e2, 0x01e4, 0x01e4, 0x01e6, 0x01e6, 0x01e8, 0x01e8, 0x01ea, 0x01ea, 0x01ec, 0x01ec, 0x01ee, 0x01ee, 0x01f1, 0x01f2, 0x01f4, 0x01f4, 0x01f6, 0x01f8, 0x01fa, 0x01fa, 0x01fc, 0x01fc, 0x01fe, 0x01fe, 0x0200, 0x0200, 0x0202, 0x0202, 0x0204, 0x0204, 0x0206, 0x0206, 0x0208, 0x0208, 0x020a, 0x020a, 0x020c, 0x020c, 0x020e, 0x020e, 0x0210, 0x0210, 0x0212, 0x0212, 0x0214, 0x0214, 0x0216, 0x0216, 0x0218, 0x0218, 0x021a, 0x021a, 0x021c, 0x021c, 0x021e, 0x021e, 0x0220, 0x0220, 0x0222, 0x0222, 0x0224, 0x0224, 0x0226, 0x0226, 0x0228, 0x0228, 0x022a, 0x022a, 0x022c, 0x022c, 0x022e, 0x022e, 0x0230, 0x0230, 0x0232, 0x0232, 0x023a, 0x023b, 0x023d, 0x023e, 0x0241, 0x0241, 0x0243, 0x0246, 0x0248, 0x0248, 0x024a, 0x024a, 0x024c, 0x024c, 0x024e, 0x024e, 0x0345, 0x0345, 0x0370, 0x0370, 0x0372, 0x0372, 0x0376, 0x0376, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x038f, 0x0391, 0x03a1, 0x03a3, 0x03ab, 0x03c2, 0x03c2, 0x03cf, 0x03d1, 0x03d5, 0x03d6, 0x03d8, 0x03d8, 0x03da, 0x03da, 0x03dc, 0x03dc, 0x03de, 0x03de, 0x03e0, 0x03e0, 0x03e2, 0x03e2, 0x03e4, 0x03e4, 0x03e6, 0x03e6, 0x03e8, 0x03e8, 0x03ea, 0x03ea, 0x03ec, 0x03ec, 0x03ee, 0x03ee, 0x03f0, 0x03f1, 0x03f4, 0x03f5, 0x03f7, 0x03f7, 0x03f9, 0x03fa, 0x03fd, 0x042f, 0x0460, 0x0460, 0x0462, 0x0462, 0x0464, 0x0464, 0x0466, 0x0466, 0x0468, 0x0468, 0x046a, 0x046a, 0x046c, 0x046c, 0x046e, 0x046e, 0x0470, 0x0470, 0x0472, 0x0472, 0x0474, 0x0474, 0x0476, 0x0476, 0x0478, 0x0478, 0x047a, 0x047a, 0x047c, 0x047c, 0x047e, 0x047e, 0x0480, 0x0480, 0x048a, 0x048a, 0x048c, 0x048c, 0x048e, 0x048e, 0x0490, 0x0490, 0x0492, 0x0492, 0x0494, 0x0494, 0x0496, 0x0496, 0x0498, 0x0498, 0x049a, 0x049a, 0x049c, 0x049c, 0x049e, 0x049e, 0x04a0, 0x04a0, 0x04a2, 0x04a2, 0x04a4, 0x04a4, 0x04a6, 0x04a6, 0x04a8, 0x04a8, 0x04aa, 0x04aa, 0x04ac, 0x04ac, 0x04ae, 0x04ae, 0x04b0, 0x04b0, 0x04b2, 0x04b2, 0x04b4, 0x04b4, 0x04b6, 0x04b6, 0x04b8, 0x04b8, 0x04ba, 0x04ba, 0x04bc, 0x04bc, 0x04be, 0x04be, 0x04c0, 0x04c1, 0x04c3, 0x04c3, 0x04c5, 0x04c5, 0x04c7, 0x04c7, 0x04c9, 0x04c9, 0x04cb, 0x04cb, 0x04cd, 0x04cd, 0x04d0, 0x04d0, 0x04d2, 0x04d2, 0x04d4, 0x04d4, 0x04d6, 0x04d6, 0x04d8, 0x04d8, 0x04da, 0x04da, 0x04dc, 0x04dc, 0x04de, 0x04de, 0x04e0, 0x04e0, 0x04e2, 0x04e2, 0x04e4, 0x04e4, 0x04e6, 0x04e6, 0x04e8, 0x04e8, 0x04ea, 0x04ea, 0x04ec, 0x04ec, 0x04ee, 0x04ee, 0x04f0, 0x04f0, 0x04f2, 0x04f2, 0x04f4, 0x04f4, 0x04f6, 0x04f6, 0x04f8, 0x04f8, 0x04fa, 0x04fa, 0x04fc, 0x04fc, 0x04fe, 0x04fe, 0x0500, 0x0500, 0x0502, 0x0502, 0x0504, 0x0504, 0x0506, 0x0506, 0x0508, 0x0508, 0x050a, 0x050a, 0x050c, 0x050c, 0x050e, 0x050e, 0x0510, 0x0510, 0x0512, 0x0512, 0x0514, 0x0514, 0x0516, 0x0516, 0x0518, 0x0518, 0x051a, 0x051a, 0x051c, 0x051c, 0x051e, 0x051e, 0x0520, 0x0520, 0x0522, 0x0522, 0x0524, 0x0524, 0x0526, 0x0526, 0x0528, 0x0528, 0x052a, 0x052a, 0x052c, 0x052c, 0x052e, 0x052e, 0x0531, 0x0556, 0x0587, 0x0587, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x13f8, 0x13fd, 0x1c80, 0x1c89, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1e00, 0x1e00, 0x1e02, 0x1e02, 0x1e04, 0x1e04, 0x1e06, 0x1e06, 0x1e08, 0x1e08, 0x1e0a, 0x1e0a, 0x1e0c, 0x1e0c, 0x1e0e, 0x1e0e, 0x1e10, 0x1e10, 0x1e12, 0x1e12, 0x1e14, 0x1e14, 0x1e16, 0x1e16, 0x1e18, 0x1e18, 0x1e1a, 0x1e1a, 0x1e1c, 0x1e1c, 0x1e1e, 0x1e1e, 0x1e20, 0x1e20, 0x1e22, 0x1e22, 0x1e24, 0x1e24, 0x1e26, 0x1e26, 0x1e28, 0x1e28, 0x1e2a, 0x1e2a, 0x1e2c, 0x1e2c, 0x1e2e, 0x1e2e, 0x1e30, 0x1e30, 0x1e32, 0x1e32, 0x1e34, 0x1e34, 0x1e36, 0x1e36, 0x1e38, 0x1e38, 0x1e3a, 0x1e3a, 0x1e3c, 0x1e3c, 0x1e3e, 0x1e3e, 0x1e40, 0x1e40, 0x1e42, 0x1e42, 0x1e44, 0x1e44, 0x1e46, 0x1e46, 0x1e48, 0x1e48, 0x1e4a, 0x1e4a, 0x1e4c, 0x1e4c, 0x1e4e, 0x1e4e, 0x1e50, 0x1e50, 0x1e52, 0x1e52, 0x1e54, 0x1e54, 0x1e56, 0x1e56, 0x1e58, 0x1e58, 0x1e5a, 0x1e5a, 0x1e5c, 0x1e5c, 0x1e5e, 0x1e5e, 0x1e60, 0x1e60, 0x1e62, 0x1e62, 0x1e64, 0x1e64, 0x1e66, 0x1e66, 0x1e68, 0x1e68, 0x1e6a, 0x1e6a, 0x1e6c, 0x1e6c, 0x1e6e, 0x1e6e, 0x1e70, 0x1e70, 0x1e72, 0x1e72, 0x1e74, 0x1e74, 0x1e76, 0x1e76, 0x1e78, 0x1e78, 0x1e7a, 0x1e7a, 0x1e7c, 0x1e7c, 0x1e7e, 0x1e7e, 0x1e80, 0x1e80, 0x1e82, 0x1e82, 0x1e84, 0x1e84, 0x1e86, 0x1e86, 0x1e88, 0x1e88, 0x1e8a, 0x1e8a, 0x1e8c, 0x1e8c, 0x1e8e, 0x1e8e, 0x1e90, 0x1e90, 0x1e92, 0x1e92, 0x1e94, 0x1e94, 0x1e9a, 0x1e9b, 0x1e9e, 0x1e9e, 0x1ea0, 0x1ea0, 0x1ea2, 0x1ea2, 0x1ea4, 0x1ea4, 0x1ea6, 0x1ea6, 0x1ea8, 0x1ea8, 0x1eaa, 0x1eaa, 0x1eac, 0x1eac, 0x1eae, 0x1eae, 0x1eb0, 0x1eb0, 0x1eb2, 0x1eb2, 0x1eb4, 0x1eb4, 0x1eb6, 0x1eb6, 0x1eb8, 0x1eb8, 0x1eba, 0x1eba, 0x1ebc, 0x1ebc, 0x1ebe, 0x1ebe, 0x1ec0, 0x1ec0, 0x1ec2, 0x1ec2, 0x1ec4, 0x1ec4, 0x1ec6, 0x1ec6, 0x1ec8, 0x1ec8, 0x1eca, 0x1eca, 0x1ecc, 0x1ecc, 0x1ece, 0x1ece, 0x1ed0, 0x1ed0, 0x1ed2, 0x1ed2, 0x1ed4, 0x1ed4, 0x1ed6, 0x1ed6, 0x1ed8, 0x1ed8, 0x1eda, 0x1eda, 0x1edc, 0x1edc, 0x1ede, 0x1ede, 0x1ee0, 0x1ee0, 0x1ee2, 0x1ee2, 0x1ee4, 0x1ee4, 0x1ee6, 0x1ee6, 0x1ee8, 0x1ee8, 0x1eea, 0x1eea, 0x1eec, 0x1eec, 0x1eee, 0x1eee, 0x1ef0, 0x1ef0, 0x1ef2, 0x1ef2, 0x1ef4, 0x1ef4, 0x1ef6, 0x1ef6, 0x1ef8, 0x1ef8, 0x1efa, 0x1efa, 0x1efc, 0x1efc, 0x1efe, 0x1efe, 0x1f08, 0x1f0f, 0x1f18, 0x1f1d, 0x1f28, 0x1f2f, 0x1f38, 0x1f3f, 0x1f48, 0x1f4d, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f5f, 0x1f68, 0x1f6f, 0x1f80, 0x1faf, 0x1fb2, 0x1fb4, 0x1fb7, 0x1fbc, 0x1fc2, 0x1fc4, 0x1fc7, 0x1fcc, 0x1fd8, 0x1fdb, 0x1fe8, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff7, 0x1ffc, 0x2126, 0x2126, 0x212a, 0x212b, 0x2132, 0x2132, 0x2160, 0x216f, 0x2183, 0x2183, 0x24b6, 0x24cf, 0x2c00, 0x2c2f, 0x2c60, 0x2c60, 0x2c62, 0x2c64, 0x2c67, 0x2c67, 0x2c69, 0x2c69, 0x2c6b, 0x2c6b, 0x2c6d, 0x2c70, 0x2c72, 0x2c72, 0x2c75, 0x2c75, 0x2c7e, 0x2c80, 0x2c82, 0x2c82, 0x2c84, 0x2c84, 0x2c86, 0x2c86, 0x2c88, 0x2c88, 0x2c8a, 0x2c8a, 0x2c8c, 0x2c8c, 0x2c8e, 0x2c8e, 0x2c90, 0x2c90, 0x2c92, 0x2c92, 0x2c94, 0x2c94, 0x2c96, 0x2c96, 0x2c98, 0x2c98, 0x2c9a, 0x2c9a, 0x2c9c, 0x2c9c, 0x2c9e, 0x2c9e, 0x2ca0, 0x2ca0, 0x2ca2, 0x2ca2, 0x2ca4, 0x2ca4, 0x2ca6, 0x2ca6, 0x2ca8, 0x2ca8, 0x2caa, 0x2caa, 0x2cac, 0x2cac, 0x2cae, 0x2cae, 0x2cb0, 0x2cb0, 0x2cb2, 0x2cb2, 0x2cb4, 0x2cb4, 0x2cb6, 0x2cb6, 0x2cb8, 0x2cb8, 0x2cba, 0x2cba, 0x2cbc, 0x2cbc, 0x2cbe, 0x2cbe, 0x2cc0, 0x2cc0, 0x2cc2, 0x2cc2, 0x2cc4, 0x2cc4, 0x2cc6, 0x2cc6, 0x2cc8, 0x2cc8, 0x2cca, 0x2cca, 0x2ccc, 0x2ccc, 0x2cce, 0x2cce, 0x2cd0, 0x2cd0, 0x2cd2, 0x2cd2, 0x2cd4, 0x2cd4, 0x2cd6, 0x2cd6, 0x2cd8, 0x2cd8, 0x2cda, 0x2cda, 0x2cdc, 0x2cdc, 0x2cde, 0x2cde, 0x2ce0, 0x2ce0, 0x2ce2, 0x2ce2, 0x2ceb, 0x2ceb, 0x2ced, 0x2ced, 0x2cf2, 0x2cf2, 0xa640, 0xa640, 0xa642, 0xa642, 0xa644, 0xa644, 0xa646, 0xa646, 0xa648, 0xa648, 0xa64a, 0xa64a, 0xa64c, 0xa64c, 0xa64e, 0xa64e, 0xa650, 0xa650, 0xa652, 0xa652, 0xa654, 0xa654, 0xa656, 0xa656, 0xa658, 0xa658, 0xa65a, 0xa65a, 0xa65c, 0xa65c, 0xa65e, 0xa65e, 0xa660, 0xa660, 0xa662, 0xa662, 0xa664, 0xa664, 0xa666, 0xa666, 0xa668, 0xa668, 0xa66a, 0xa66a, 0xa66c, 0xa66c, 0xa680, 0xa680, 0xa682, 0xa682, 0xa684, 0xa684, 0xa686, 0xa686, 0xa688, 0xa688, 0xa68a, 0xa68a, 0xa68c, 0xa68c, 0xa68e, 0xa68e, 0xa690, 0xa690, 0xa692, 0xa692, 0xa694, 0xa694, 0xa696, 0xa696, 0xa698, 0xa698, 0xa69a, 0xa69a, 0xa722, 0xa722, 0xa724, 0xa724, 0xa726, 0xa726, 0xa728, 0xa728, 0xa72a, 0xa72a, 0xa72c, 0xa72c, 0xa72e, 0xa72e, 0xa732, 0xa732, 0xa734, 0xa734, 0xa736, 0xa736, 0xa738, 0xa738, 0xa73a, 0xa73a, 0xa73c, 0xa73c, 0xa73e, 0xa73e, 0xa740, 0xa740, 0xa742, 0xa742, 0xa744, 0xa744, 0xa746, 0xa746, 0xa748, 0xa748, 0xa74a, 0xa74a, 0xa74c, 0xa74c, 0xa74e, 0xa74e, 0xa750, 0xa750, 0xa752, 0xa752, 0xa754, 0xa754, 0xa756, 0xa756, 0xa758, 0xa758, 0xa75a, 0xa75a, 0xa75c, 0xa75c, 0xa75e, 0xa75e, 0xa760, 0xa760, 0xa762, 0xa762, 0xa764, 0xa764, 0xa766, 0xa766, 0xa768, 0xa768, 0xa76a, 0xa76a, 0xa76c, 0xa76c, 0xa76e, 0xa76e, 0xa779, 0xa779, 0xa77b, 0xa77b, 0xa77d, 0xa77e, 0xa780, 0xa780, 0xa782, 0xa782, 0xa784, 0xa784, 0xa786, 0xa786, 0xa78b, 0xa78b, 0xa78d, 0xa78d, 0xa790, 0xa790, 0xa792, 0xa792, 0xa796, 0xa796, 0xa798, 0xa798, 0xa79a, 0xa79a, 0xa79c, 0xa79c, 0xa79e, 0xa79e, 0xa7a0, 0xa7a0, 0xa7a2, 0xa7a2, 0xa7a4, 0xa7a4, 0xa7a6, 0xa7a6, 0xa7a8, 0xa7a8, 0xa7aa, 0xa7ae, 0xa7b0, 0xa7b4, 0xa7b6, 0xa7b6, 0xa7b8, 0xa7b8, 0xa7ba, 0xa7ba, 0xa7bc, 0xa7bc, 0xa7be, 0xa7be, 0xa7c0, 0xa7c0, 0xa7c2, 0xa7c2, 0xa7c4, 0xa7c7, 0xa7c9, 0xa7c9, 0xa7cb, 0xa7cc, 0xa7d0, 0xa7d0, 0xa7d6, 0xa7d6, 0xa7d8, 0xa7d8, 0xa7da, 0xa7da, 0xa7dc, 0xa7dc, 0xa7f5, 0xa7f5, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff21, 0xff3a, 0x10400, 0x10427, 0x104b0, 0x104d3, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10c80, 0x10cb2, 0x10d50, 0x10d65, 0x118a0, 0x118bf, 0x16e40, 0x16e5f, 0x1e900, 0x1e921, }; /* END of CR_Changes_When_Casefolded */ /* PROPERTY: 'Changes_When_Casemapped': Derived Property */ static const OnigCodePoint CR_Changes_When_Casemapped[] = { 131, 0x0041, 0x005a, 0x0061, 0x007a, 0x00b5, 0x00b5, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x0137, 0x0139, 0x018c, 0x018e, 0x01a9, 0x01ac, 0x01b9, 0x01bc, 0x01bd, 0x01bf, 0x01bf, 0x01c4, 0x0220, 0x0222, 0x0233, 0x023a, 0x0254, 0x0256, 0x0257, 0x0259, 0x0259, 0x025b, 0x025c, 0x0260, 0x0261, 0x0263, 0x0266, 0x0268, 0x026c, 0x026f, 0x026f, 0x0271, 0x0272, 0x0275, 0x0275, 0x027d, 0x027d, 0x0280, 0x0280, 0x0282, 0x0283, 0x0287, 0x028c, 0x0292, 0x0292, 0x029d, 0x029e, 0x0345, 0x0345, 0x0370, 0x0373, 0x0376, 0x0377, 0x037b, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03d1, 0x03d5, 0x03f5, 0x03f7, 0x03fb, 0x03fd, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0561, 0x0587, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fd, 0x10ff, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1d79, 0x1d79, 0x1d7d, 0x1d7d, 0x1d8e, 0x1d8e, 0x1e00, 0x1e9b, 0x1e9e, 0x1e9e, 0x1ea0, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2126, 0x2126, 0x212a, 0x212b, 0x2132, 0x2132, 0x214e, 0x214e, 0x2160, 0x217f, 0x2183, 0x2184, 0x24b6, 0x24e9, 0x2c00, 0x2c70, 0x2c72, 0x2c73, 0x2c75, 0x2c76, 0x2c7e, 0x2ce3, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa640, 0xa66d, 0xa680, 0xa69b, 0xa722, 0xa72f, 0xa732, 0xa76f, 0xa779, 0xa787, 0xa78b, 0xa78d, 0xa790, 0xa794, 0xa796, 0xa7ae, 0xa7b0, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d6, 0xa7dc, 0xa7f5, 0xa7f6, 0xab53, 0xab53, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff21, 0xff3a, 0xff41, 0xff5a, 0x10400, 0x1044f, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d50, 0x10d65, 0x10d70, 0x10d85, 0x118a0, 0x118df, 0x16e40, 0x16e7f, 0x1e900, 0x1e943, }; /* END of CR_Changes_When_Casemapped */ /* PROPERTY: 'Changes_When_Lowercased': Derived Property */ static const OnigCodePoint CR_Changes_When_Lowercased[] = { 614, 0x0041, 0x005a, 0x00c0, 0x00d6, 0x00d8, 0x00de, 0x0100, 0x0100, 0x0102, 0x0102, 0x0104, 0x0104, 0x0106, 0x0106, 0x0108, 0x0108, 0x010a, 0x010a, 0x010c, 0x010c, 0x010e, 0x010e, 0x0110, 0x0110, 0x0112, 0x0112, 0x0114, 0x0114, 0x0116, 0x0116, 0x0118, 0x0118, 0x011a, 0x011a, 0x011c, 0x011c, 0x011e, 0x011e, 0x0120, 0x0120, 0x0122, 0x0122, 0x0124, 0x0124, 0x0126, 0x0126, 0x0128, 0x0128, 0x012a, 0x012a, 0x012c, 0x012c, 0x012e, 0x012e, 0x0130, 0x0130, 0x0132, 0x0132, 0x0134, 0x0134, 0x0136, 0x0136, 0x0139, 0x0139, 0x013b, 0x013b, 0x013d, 0x013d, 0x013f, 0x013f, 0x0141, 0x0141, 0x0143, 0x0143, 0x0145, 0x0145, 0x0147, 0x0147, 0x014a, 0x014a, 0x014c, 0x014c, 0x014e, 0x014e, 0x0150, 0x0150, 0x0152, 0x0152, 0x0154, 0x0154, 0x0156, 0x0156, 0x0158, 0x0158, 0x015a, 0x015a, 0x015c, 0x015c, 0x015e, 0x015e, 0x0160, 0x0160, 0x0162, 0x0162, 0x0164, 0x0164, 0x0166, 0x0166, 0x0168, 0x0168, 0x016a, 0x016a, 0x016c, 0x016c, 0x016e, 0x016e, 0x0170, 0x0170, 0x0172, 0x0172, 0x0174, 0x0174, 0x0176, 0x0176, 0x0178, 0x0179, 0x017b, 0x017b, 0x017d, 0x017d, 0x0181, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, 0x0189, 0x018b, 0x018e, 0x0191, 0x0193, 0x0194, 0x0196, 0x0198, 0x019c, 0x019d, 0x019f, 0x01a0, 0x01a2, 0x01a2, 0x01a4, 0x01a4, 0x01a6, 0x01a7, 0x01a9, 0x01a9, 0x01ac, 0x01ac, 0x01ae, 0x01af, 0x01b1, 0x01b3, 0x01b5, 0x01b5, 0x01b7, 0x01b8, 0x01bc, 0x01bc, 0x01c4, 0x01c5, 0x01c7, 0x01c8, 0x01ca, 0x01cb, 0x01cd, 0x01cd, 0x01cf, 0x01cf, 0x01d1, 0x01d1, 0x01d3, 0x01d3, 0x01d5, 0x01d5, 0x01d7, 0x01d7, 0x01d9, 0x01d9, 0x01db, 0x01db, 0x01de, 0x01de, 0x01e0, 0x01e0, 0x01e2, 0x01e2, 0x01e4, 0x01e4, 0x01e6, 0x01e6, 0x01e8, 0x01e8, 0x01ea, 0x01ea, 0x01ec, 0x01ec, 0x01ee, 0x01ee, 0x01f1, 0x01f2, 0x01f4, 0x01f4, 0x01f6, 0x01f8, 0x01fa, 0x01fa, 0x01fc, 0x01fc, 0x01fe, 0x01fe, 0x0200, 0x0200, 0x0202, 0x0202, 0x0204, 0x0204, 0x0206, 0x0206, 0x0208, 0x0208, 0x020a, 0x020a, 0x020c, 0x020c, 0x020e, 0x020e, 0x0210, 0x0210, 0x0212, 0x0212, 0x0214, 0x0214, 0x0216, 0x0216, 0x0218, 0x0218, 0x021a, 0x021a, 0x021c, 0x021c, 0x021e, 0x021e, 0x0220, 0x0220, 0x0222, 0x0222, 0x0224, 0x0224, 0x0226, 0x0226, 0x0228, 0x0228, 0x022a, 0x022a, 0x022c, 0x022c, 0x022e, 0x022e, 0x0230, 0x0230, 0x0232, 0x0232, 0x023a, 0x023b, 0x023d, 0x023e, 0x0241, 0x0241, 0x0243, 0x0246, 0x0248, 0x0248, 0x024a, 0x024a, 0x024c, 0x024c, 0x024e, 0x024e, 0x0370, 0x0370, 0x0372, 0x0372, 0x0376, 0x0376, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x038f, 0x0391, 0x03a1, 0x03a3, 0x03ab, 0x03cf, 0x03cf, 0x03d8, 0x03d8, 0x03da, 0x03da, 0x03dc, 0x03dc, 0x03de, 0x03de, 0x03e0, 0x03e0, 0x03e2, 0x03e2, 0x03e4, 0x03e4, 0x03e6, 0x03e6, 0x03e8, 0x03e8, 0x03ea, 0x03ea, 0x03ec, 0x03ec, 0x03ee, 0x03ee, 0x03f4, 0x03f4, 0x03f7, 0x03f7, 0x03f9, 0x03fa, 0x03fd, 0x042f, 0x0460, 0x0460, 0x0462, 0x0462, 0x0464, 0x0464, 0x0466, 0x0466, 0x0468, 0x0468, 0x046a, 0x046a, 0x046c, 0x046c, 0x046e, 0x046e, 0x0470, 0x0470, 0x0472, 0x0472, 0x0474, 0x0474, 0x0476, 0x0476, 0x0478, 0x0478, 0x047a, 0x047a, 0x047c, 0x047c, 0x047e, 0x047e, 0x0480, 0x0480, 0x048a, 0x048a, 0x048c, 0x048c, 0x048e, 0x048e, 0x0490, 0x0490, 0x0492, 0x0492, 0x0494, 0x0494, 0x0496, 0x0496, 0x0498, 0x0498, 0x049a, 0x049a, 0x049c, 0x049c, 0x049e, 0x049e, 0x04a0, 0x04a0, 0x04a2, 0x04a2, 0x04a4, 0x04a4, 0x04a6, 0x04a6, 0x04a8, 0x04a8, 0x04aa, 0x04aa, 0x04ac, 0x04ac, 0x04ae, 0x04ae, 0x04b0, 0x04b0, 0x04b2, 0x04b2, 0x04b4, 0x04b4, 0x04b6, 0x04b6, 0x04b8, 0x04b8, 0x04ba, 0x04ba, 0x04bc, 0x04bc, 0x04be, 0x04be, 0x04c0, 0x04c1, 0x04c3, 0x04c3, 0x04c5, 0x04c5, 0x04c7, 0x04c7, 0x04c9, 0x04c9, 0x04cb, 0x04cb, 0x04cd, 0x04cd, 0x04d0, 0x04d0, 0x04d2, 0x04d2, 0x04d4, 0x04d4, 0x04d6, 0x04d6, 0x04d8, 0x04d8, 0x04da, 0x04da, 0x04dc, 0x04dc, 0x04de, 0x04de, 0x04e0, 0x04e0, 0x04e2, 0x04e2, 0x04e4, 0x04e4, 0x04e6, 0x04e6, 0x04e8, 0x04e8, 0x04ea, 0x04ea, 0x04ec, 0x04ec, 0x04ee, 0x04ee, 0x04f0, 0x04f0, 0x04f2, 0x04f2, 0x04f4, 0x04f4, 0x04f6, 0x04f6, 0x04f8, 0x04f8, 0x04fa, 0x04fa, 0x04fc, 0x04fc, 0x04fe, 0x04fe, 0x0500, 0x0500, 0x0502, 0x0502, 0x0504, 0x0504, 0x0506, 0x0506, 0x0508, 0x0508, 0x050a, 0x050a, 0x050c, 0x050c, 0x050e, 0x050e, 0x0510, 0x0510, 0x0512, 0x0512, 0x0514, 0x0514, 0x0516, 0x0516, 0x0518, 0x0518, 0x051a, 0x051a, 0x051c, 0x051c, 0x051e, 0x051e, 0x0520, 0x0520, 0x0522, 0x0522, 0x0524, 0x0524, 0x0526, 0x0526, 0x0528, 0x0528, 0x052a, 0x052a, 0x052c, 0x052c, 0x052e, 0x052e, 0x0531, 0x0556, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x13a0, 0x13f5, 0x1c89, 0x1c89, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1e00, 0x1e00, 0x1e02, 0x1e02, 0x1e04, 0x1e04, 0x1e06, 0x1e06, 0x1e08, 0x1e08, 0x1e0a, 0x1e0a, 0x1e0c, 0x1e0c, 0x1e0e, 0x1e0e, 0x1e10, 0x1e10, 0x1e12, 0x1e12, 0x1e14, 0x1e14, 0x1e16, 0x1e16, 0x1e18, 0x1e18, 0x1e1a, 0x1e1a, 0x1e1c, 0x1e1c, 0x1e1e, 0x1e1e, 0x1e20, 0x1e20, 0x1e22, 0x1e22, 0x1e24, 0x1e24, 0x1e26, 0x1e26, 0x1e28, 0x1e28, 0x1e2a, 0x1e2a, 0x1e2c, 0x1e2c, 0x1e2e, 0x1e2e, 0x1e30, 0x1e30, 0x1e32, 0x1e32, 0x1e34, 0x1e34, 0x1e36, 0x1e36, 0x1e38, 0x1e38, 0x1e3a, 0x1e3a, 0x1e3c, 0x1e3c, 0x1e3e, 0x1e3e, 0x1e40, 0x1e40, 0x1e42, 0x1e42, 0x1e44, 0x1e44, 0x1e46, 0x1e46, 0x1e48, 0x1e48, 0x1e4a, 0x1e4a, 0x1e4c, 0x1e4c, 0x1e4e, 0x1e4e, 0x1e50, 0x1e50, 0x1e52, 0x1e52, 0x1e54, 0x1e54, 0x1e56, 0x1e56, 0x1e58, 0x1e58, 0x1e5a, 0x1e5a, 0x1e5c, 0x1e5c, 0x1e5e, 0x1e5e, 0x1e60, 0x1e60, 0x1e62, 0x1e62, 0x1e64, 0x1e64, 0x1e66, 0x1e66, 0x1e68, 0x1e68, 0x1e6a, 0x1e6a, 0x1e6c, 0x1e6c, 0x1e6e, 0x1e6e, 0x1e70, 0x1e70, 0x1e72, 0x1e72, 0x1e74, 0x1e74, 0x1e76, 0x1e76, 0x1e78, 0x1e78, 0x1e7a, 0x1e7a, 0x1e7c, 0x1e7c, 0x1e7e, 0x1e7e, 0x1e80, 0x1e80, 0x1e82, 0x1e82, 0x1e84, 0x1e84, 0x1e86, 0x1e86, 0x1e88, 0x1e88, 0x1e8a, 0x1e8a, 0x1e8c, 0x1e8c, 0x1e8e, 0x1e8e, 0x1e90, 0x1e90, 0x1e92, 0x1e92, 0x1e94, 0x1e94, 0x1e9e, 0x1e9e, 0x1ea0, 0x1ea0, 0x1ea2, 0x1ea2, 0x1ea4, 0x1ea4, 0x1ea6, 0x1ea6, 0x1ea8, 0x1ea8, 0x1eaa, 0x1eaa, 0x1eac, 0x1eac, 0x1eae, 0x1eae, 0x1eb0, 0x1eb0, 0x1eb2, 0x1eb2, 0x1eb4, 0x1eb4, 0x1eb6, 0x1eb6, 0x1eb8, 0x1eb8, 0x1eba, 0x1eba, 0x1ebc, 0x1ebc, 0x1ebe, 0x1ebe, 0x1ec0, 0x1ec0, 0x1ec2, 0x1ec2, 0x1ec4, 0x1ec4, 0x1ec6, 0x1ec6, 0x1ec8, 0x1ec8, 0x1eca, 0x1eca, 0x1ecc, 0x1ecc, 0x1ece, 0x1ece, 0x1ed0, 0x1ed0, 0x1ed2, 0x1ed2, 0x1ed4, 0x1ed4, 0x1ed6, 0x1ed6, 0x1ed8, 0x1ed8, 0x1eda, 0x1eda, 0x1edc, 0x1edc, 0x1ede, 0x1ede, 0x1ee0, 0x1ee0, 0x1ee2, 0x1ee2, 0x1ee4, 0x1ee4, 0x1ee6, 0x1ee6, 0x1ee8, 0x1ee8, 0x1eea, 0x1eea, 0x1eec, 0x1eec, 0x1eee, 0x1eee, 0x1ef0, 0x1ef0, 0x1ef2, 0x1ef2, 0x1ef4, 0x1ef4, 0x1ef6, 0x1ef6, 0x1ef8, 0x1ef8, 0x1efa, 0x1efa, 0x1efc, 0x1efc, 0x1efe, 0x1efe, 0x1f08, 0x1f0f, 0x1f18, 0x1f1d, 0x1f28, 0x1f2f, 0x1f38, 0x1f3f, 0x1f48, 0x1f4d, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f5f, 0x1f68, 0x1f6f, 0x1f88, 0x1f8f, 0x1f98, 0x1f9f, 0x1fa8, 0x1faf, 0x1fb8, 0x1fbc, 0x1fc8, 0x1fcc, 0x1fd8, 0x1fdb, 0x1fe8, 0x1fec, 0x1ff8, 0x1ffc, 0x2126, 0x2126, 0x212a, 0x212b, 0x2132, 0x2132, 0x2160, 0x216f, 0x2183, 0x2183, 0x24b6, 0x24cf, 0x2c00, 0x2c2f, 0x2c60, 0x2c60, 0x2c62, 0x2c64, 0x2c67, 0x2c67, 0x2c69, 0x2c69, 0x2c6b, 0x2c6b, 0x2c6d, 0x2c70, 0x2c72, 0x2c72, 0x2c75, 0x2c75, 0x2c7e, 0x2c80, 0x2c82, 0x2c82, 0x2c84, 0x2c84, 0x2c86, 0x2c86, 0x2c88, 0x2c88, 0x2c8a, 0x2c8a, 0x2c8c, 0x2c8c, 0x2c8e, 0x2c8e, 0x2c90, 0x2c90, 0x2c92, 0x2c92, 0x2c94, 0x2c94, 0x2c96, 0x2c96, 0x2c98, 0x2c98, 0x2c9a, 0x2c9a, 0x2c9c, 0x2c9c, 0x2c9e, 0x2c9e, 0x2ca0, 0x2ca0, 0x2ca2, 0x2ca2, 0x2ca4, 0x2ca4, 0x2ca6, 0x2ca6, 0x2ca8, 0x2ca8, 0x2caa, 0x2caa, 0x2cac, 0x2cac, 0x2cae, 0x2cae, 0x2cb0, 0x2cb0, 0x2cb2, 0x2cb2, 0x2cb4, 0x2cb4, 0x2cb6, 0x2cb6, 0x2cb8, 0x2cb8, 0x2cba, 0x2cba, 0x2cbc, 0x2cbc, 0x2cbe, 0x2cbe, 0x2cc0, 0x2cc0, 0x2cc2, 0x2cc2, 0x2cc4, 0x2cc4, 0x2cc6, 0x2cc6, 0x2cc8, 0x2cc8, 0x2cca, 0x2cca, 0x2ccc, 0x2ccc, 0x2cce, 0x2cce, 0x2cd0, 0x2cd0, 0x2cd2, 0x2cd2, 0x2cd4, 0x2cd4, 0x2cd6, 0x2cd6, 0x2cd8, 0x2cd8, 0x2cda, 0x2cda, 0x2cdc, 0x2cdc, 0x2cde, 0x2cde, 0x2ce0, 0x2ce0, 0x2ce2, 0x2ce2, 0x2ceb, 0x2ceb, 0x2ced, 0x2ced, 0x2cf2, 0x2cf2, 0xa640, 0xa640, 0xa642, 0xa642, 0xa644, 0xa644, 0xa646, 0xa646, 0xa648, 0xa648, 0xa64a, 0xa64a, 0xa64c, 0xa64c, 0xa64e, 0xa64e, 0xa650, 0xa650, 0xa652, 0xa652, 0xa654, 0xa654, 0xa656, 0xa656, 0xa658, 0xa658, 0xa65a, 0xa65a, 0xa65c, 0xa65c, 0xa65e, 0xa65e, 0xa660, 0xa660, 0xa662, 0xa662, 0xa664, 0xa664, 0xa666, 0xa666, 0xa668, 0xa668, 0xa66a, 0xa66a, 0xa66c, 0xa66c, 0xa680, 0xa680, 0xa682, 0xa682, 0xa684, 0xa684, 0xa686, 0xa686, 0xa688, 0xa688, 0xa68a, 0xa68a, 0xa68c, 0xa68c, 0xa68e, 0xa68e, 0xa690, 0xa690, 0xa692, 0xa692, 0xa694, 0xa694, 0xa696, 0xa696, 0xa698, 0xa698, 0xa69a, 0xa69a, 0xa722, 0xa722, 0xa724, 0xa724, 0xa726, 0xa726, 0xa728, 0xa728, 0xa72a, 0xa72a, 0xa72c, 0xa72c, 0xa72e, 0xa72e, 0xa732, 0xa732, 0xa734, 0xa734, 0xa736, 0xa736, 0xa738, 0xa738, 0xa73a, 0xa73a, 0xa73c, 0xa73c, 0xa73e, 0xa73e, 0xa740, 0xa740, 0xa742, 0xa742, 0xa744, 0xa744, 0xa746, 0xa746, 0xa748, 0xa748, 0xa74a, 0xa74a, 0xa74c, 0xa74c, 0xa74e, 0xa74e, 0xa750, 0xa750, 0xa752, 0xa752, 0xa754, 0xa754, 0xa756, 0xa756, 0xa758, 0xa758, 0xa75a, 0xa75a, 0xa75c, 0xa75c, 0xa75e, 0xa75e, 0xa760, 0xa760, 0xa762, 0xa762, 0xa764, 0xa764, 0xa766, 0xa766, 0xa768, 0xa768, 0xa76a, 0xa76a, 0xa76c, 0xa76c, 0xa76e, 0xa76e, 0xa779, 0xa779, 0xa77b, 0xa77b, 0xa77d, 0xa77e, 0xa780, 0xa780, 0xa782, 0xa782, 0xa784, 0xa784, 0xa786, 0xa786, 0xa78b, 0xa78b, 0xa78d, 0xa78d, 0xa790, 0xa790, 0xa792, 0xa792, 0xa796, 0xa796, 0xa798, 0xa798, 0xa79a, 0xa79a, 0xa79c, 0xa79c, 0xa79e, 0xa79e, 0xa7a0, 0xa7a0, 0xa7a2, 0xa7a2, 0xa7a4, 0xa7a4, 0xa7a6, 0xa7a6, 0xa7a8, 0xa7a8, 0xa7aa, 0xa7ae, 0xa7b0, 0xa7b4, 0xa7b6, 0xa7b6, 0xa7b8, 0xa7b8, 0xa7ba, 0xa7ba, 0xa7bc, 0xa7bc, 0xa7be, 0xa7be, 0xa7c0, 0xa7c0, 0xa7c2, 0xa7c2, 0xa7c4, 0xa7c7, 0xa7c9, 0xa7c9, 0xa7cb, 0xa7cc, 0xa7d0, 0xa7d0, 0xa7d6, 0xa7d6, 0xa7d8, 0xa7d8, 0xa7da, 0xa7da, 0xa7dc, 0xa7dc, 0xa7f5, 0xa7f5, 0xff21, 0xff3a, 0x10400, 0x10427, 0x104b0, 0x104d3, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10c80, 0x10cb2, 0x10d50, 0x10d65, 0x118a0, 0x118bf, 0x16e40, 0x16e5f, 0x1e900, 0x1e921, }; /* END of CR_Changes_When_Lowercased */ /* PROPERTY: 'Changes_When_Titlecased': Derived Property */ static const OnigCodePoint CR_Changes_When_Titlecased[] = { 629, 0x0061, 0x007a, 0x00b5, 0x00b5, 0x00df, 0x00f6, 0x00f8, 0x00ff, 0x0101, 0x0101, 0x0103, 0x0103, 0x0105, 0x0105, 0x0107, 0x0107, 0x0109, 0x0109, 0x010b, 0x010b, 0x010d, 0x010d, 0x010f, 0x010f, 0x0111, 0x0111, 0x0113, 0x0113, 0x0115, 0x0115, 0x0117, 0x0117, 0x0119, 0x0119, 0x011b, 0x011b, 0x011d, 0x011d, 0x011f, 0x011f, 0x0121, 0x0121, 0x0123, 0x0123, 0x0125, 0x0125, 0x0127, 0x0127, 0x0129, 0x0129, 0x012b, 0x012b, 0x012d, 0x012d, 0x012f, 0x012f, 0x0131, 0x0131, 0x0133, 0x0133, 0x0135, 0x0135, 0x0137, 0x0137, 0x013a, 0x013a, 0x013c, 0x013c, 0x013e, 0x013e, 0x0140, 0x0140, 0x0142, 0x0142, 0x0144, 0x0144, 0x0146, 0x0146, 0x0148, 0x0149, 0x014b, 0x014b, 0x014d, 0x014d, 0x014f, 0x014f, 0x0151, 0x0151, 0x0153, 0x0153, 0x0155, 0x0155, 0x0157, 0x0157, 0x0159, 0x0159, 0x015b, 0x015b, 0x015d, 0x015d, 0x015f, 0x015f, 0x0161, 0x0161, 0x0163, 0x0163, 0x0165, 0x0165, 0x0167, 0x0167, 0x0169, 0x0169, 0x016b, 0x016b, 0x016d, 0x016d, 0x016f, 0x016f, 0x0171, 0x0171, 0x0173, 0x0173, 0x0175, 0x0175, 0x0177, 0x0177, 0x017a, 0x017a, 0x017c, 0x017c, 0x017e, 0x0180, 0x0183, 0x0183, 0x0185, 0x0185, 0x0188, 0x0188, 0x018c, 0x018c, 0x0192, 0x0192, 0x0195, 0x0195, 0x0199, 0x019b, 0x019e, 0x019e, 0x01a1, 0x01a1, 0x01a3, 0x01a3, 0x01a5, 0x01a5, 0x01a8, 0x01a8, 0x01ad, 0x01ad, 0x01b0, 0x01b0, 0x01b4, 0x01b4, 0x01b6, 0x01b6, 0x01b9, 0x01b9, 0x01bd, 0x01bd, 0x01bf, 0x01bf, 0x01c4, 0x01c4, 0x01c6, 0x01c7, 0x01c9, 0x01ca, 0x01cc, 0x01cc, 0x01ce, 0x01ce, 0x01d0, 0x01d0, 0x01d2, 0x01d2, 0x01d4, 0x01d4, 0x01d6, 0x01d6, 0x01d8, 0x01d8, 0x01da, 0x01da, 0x01dc, 0x01dd, 0x01df, 0x01df, 0x01e1, 0x01e1, 0x01e3, 0x01e3, 0x01e5, 0x01e5, 0x01e7, 0x01e7, 0x01e9, 0x01e9, 0x01eb, 0x01eb, 0x01ed, 0x01ed, 0x01ef, 0x01f1, 0x01f3, 0x01f3, 0x01f5, 0x01f5, 0x01f9, 0x01f9, 0x01fb, 0x01fb, 0x01fd, 0x01fd, 0x01ff, 0x01ff, 0x0201, 0x0201, 0x0203, 0x0203, 0x0205, 0x0205, 0x0207, 0x0207, 0x0209, 0x0209, 0x020b, 0x020b, 0x020d, 0x020d, 0x020f, 0x020f, 0x0211, 0x0211, 0x0213, 0x0213, 0x0215, 0x0215, 0x0217, 0x0217, 0x0219, 0x0219, 0x021b, 0x021b, 0x021d, 0x021d, 0x021f, 0x021f, 0x0223, 0x0223, 0x0225, 0x0225, 0x0227, 0x0227, 0x0229, 0x0229, 0x022b, 0x022b, 0x022d, 0x022d, 0x022f, 0x022f, 0x0231, 0x0231, 0x0233, 0x0233, 0x023c, 0x023c, 0x023f, 0x0240, 0x0242, 0x0242, 0x0247, 0x0247, 0x0249, 0x0249, 0x024b, 0x024b, 0x024d, 0x024d, 0x024f, 0x0254, 0x0256, 0x0257, 0x0259, 0x0259, 0x025b, 0x025c, 0x0260, 0x0261, 0x0263, 0x0266, 0x0268, 0x026c, 0x026f, 0x026f, 0x0271, 0x0272, 0x0275, 0x0275, 0x027d, 0x027d, 0x0280, 0x0280, 0x0282, 0x0283, 0x0287, 0x028c, 0x0292, 0x0292, 0x029d, 0x029e, 0x0345, 0x0345, 0x0371, 0x0371, 0x0373, 0x0373, 0x0377, 0x0377, 0x037b, 0x037d, 0x0390, 0x0390, 0x03ac, 0x03ce, 0x03d0, 0x03d1, 0x03d5, 0x03d7, 0x03d9, 0x03d9, 0x03db, 0x03db, 0x03dd, 0x03dd, 0x03df, 0x03df, 0x03e1, 0x03e1, 0x03e3, 0x03e3, 0x03e5, 0x03e5, 0x03e7, 0x03e7, 0x03e9, 0x03e9, 0x03eb, 0x03eb, 0x03ed, 0x03ed, 0x03ef, 0x03f3, 0x03f5, 0x03f5, 0x03f8, 0x03f8, 0x03fb, 0x03fb, 0x0430, 0x045f, 0x0461, 0x0461, 0x0463, 0x0463, 0x0465, 0x0465, 0x0467, 0x0467, 0x0469, 0x0469, 0x046b, 0x046b, 0x046d, 0x046d, 0x046f, 0x046f, 0x0471, 0x0471, 0x0473, 0x0473, 0x0475, 0x0475, 0x0477, 0x0477, 0x0479, 0x0479, 0x047b, 0x047b, 0x047d, 0x047d, 0x047f, 0x047f, 0x0481, 0x0481, 0x048b, 0x048b, 0x048d, 0x048d, 0x048f, 0x048f, 0x0491, 0x0491, 0x0493, 0x0493, 0x0495, 0x0495, 0x0497, 0x0497, 0x0499, 0x0499, 0x049b, 0x049b, 0x049d, 0x049d, 0x049f, 0x049f, 0x04a1, 0x04a1, 0x04a3, 0x04a3, 0x04a5, 0x04a5, 0x04a7, 0x04a7, 0x04a9, 0x04a9, 0x04ab, 0x04ab, 0x04ad, 0x04ad, 0x04af, 0x04af, 0x04b1, 0x04b1, 0x04b3, 0x04b3, 0x04b5, 0x04b5, 0x04b7, 0x04b7, 0x04b9, 0x04b9, 0x04bb, 0x04bb, 0x04bd, 0x04bd, 0x04bf, 0x04bf, 0x04c2, 0x04c2, 0x04c4, 0x04c4, 0x04c6, 0x04c6, 0x04c8, 0x04c8, 0x04ca, 0x04ca, 0x04cc, 0x04cc, 0x04ce, 0x04cf, 0x04d1, 0x04d1, 0x04d3, 0x04d3, 0x04d5, 0x04d5, 0x04d7, 0x04d7, 0x04d9, 0x04d9, 0x04db, 0x04db, 0x04dd, 0x04dd, 0x04df, 0x04df, 0x04e1, 0x04e1, 0x04e3, 0x04e3, 0x04e5, 0x04e5, 0x04e7, 0x04e7, 0x04e9, 0x04e9, 0x04eb, 0x04eb, 0x04ed, 0x04ed, 0x04ef, 0x04ef, 0x04f1, 0x04f1, 0x04f3, 0x04f3, 0x04f5, 0x04f5, 0x04f7, 0x04f7, 0x04f9, 0x04f9, 0x04fb, 0x04fb, 0x04fd, 0x04fd, 0x04ff, 0x04ff, 0x0501, 0x0501, 0x0503, 0x0503, 0x0505, 0x0505, 0x0507, 0x0507, 0x0509, 0x0509, 0x050b, 0x050b, 0x050d, 0x050d, 0x050f, 0x050f, 0x0511, 0x0511, 0x0513, 0x0513, 0x0515, 0x0515, 0x0517, 0x0517, 0x0519, 0x0519, 0x051b, 0x051b, 0x051d, 0x051d, 0x051f, 0x051f, 0x0521, 0x0521, 0x0523, 0x0523, 0x0525, 0x0525, 0x0527, 0x0527, 0x0529, 0x0529, 0x052b, 0x052b, 0x052d, 0x052d, 0x052f, 0x052f, 0x0561, 0x0587, 0x13f8, 0x13fd, 0x1c80, 0x1c88, 0x1c8a, 0x1c8a, 0x1d79, 0x1d79, 0x1d7d, 0x1d7d, 0x1d8e, 0x1d8e, 0x1e01, 0x1e01, 0x1e03, 0x1e03, 0x1e05, 0x1e05, 0x1e07, 0x1e07, 0x1e09, 0x1e09, 0x1e0b, 0x1e0b, 0x1e0d, 0x1e0d, 0x1e0f, 0x1e0f, 0x1e11, 0x1e11, 0x1e13, 0x1e13, 0x1e15, 0x1e15, 0x1e17, 0x1e17, 0x1e19, 0x1e19, 0x1e1b, 0x1e1b, 0x1e1d, 0x1e1d, 0x1e1f, 0x1e1f, 0x1e21, 0x1e21, 0x1e23, 0x1e23, 0x1e25, 0x1e25, 0x1e27, 0x1e27, 0x1e29, 0x1e29, 0x1e2b, 0x1e2b, 0x1e2d, 0x1e2d, 0x1e2f, 0x1e2f, 0x1e31, 0x1e31, 0x1e33, 0x1e33, 0x1e35, 0x1e35, 0x1e37, 0x1e37, 0x1e39, 0x1e39, 0x1e3b, 0x1e3b, 0x1e3d, 0x1e3d, 0x1e3f, 0x1e3f, 0x1e41, 0x1e41, 0x1e43, 0x1e43, 0x1e45, 0x1e45, 0x1e47, 0x1e47, 0x1e49, 0x1e49, 0x1e4b, 0x1e4b, 0x1e4d, 0x1e4d, 0x1e4f, 0x1e4f, 0x1e51, 0x1e51, 0x1e53, 0x1e53, 0x1e55, 0x1e55, 0x1e57, 0x1e57, 0x1e59, 0x1e59, 0x1e5b, 0x1e5b, 0x1e5d, 0x1e5d, 0x1e5f, 0x1e5f, 0x1e61, 0x1e61, 0x1e63, 0x1e63, 0x1e65, 0x1e65, 0x1e67, 0x1e67, 0x1e69, 0x1e69, 0x1e6b, 0x1e6b, 0x1e6d, 0x1e6d, 0x1e6f, 0x1e6f, 0x1e71, 0x1e71, 0x1e73, 0x1e73, 0x1e75, 0x1e75, 0x1e77, 0x1e77, 0x1e79, 0x1e79, 0x1e7b, 0x1e7b, 0x1e7d, 0x1e7d, 0x1e7f, 0x1e7f, 0x1e81, 0x1e81, 0x1e83, 0x1e83, 0x1e85, 0x1e85, 0x1e87, 0x1e87, 0x1e89, 0x1e89, 0x1e8b, 0x1e8b, 0x1e8d, 0x1e8d, 0x1e8f, 0x1e8f, 0x1e91, 0x1e91, 0x1e93, 0x1e93, 0x1e95, 0x1e9b, 0x1ea1, 0x1ea1, 0x1ea3, 0x1ea3, 0x1ea5, 0x1ea5, 0x1ea7, 0x1ea7, 0x1ea9, 0x1ea9, 0x1eab, 0x1eab, 0x1ead, 0x1ead, 0x1eaf, 0x1eaf, 0x1eb1, 0x1eb1, 0x1eb3, 0x1eb3, 0x1eb5, 0x1eb5, 0x1eb7, 0x1eb7, 0x1eb9, 0x1eb9, 0x1ebb, 0x1ebb, 0x1ebd, 0x1ebd, 0x1ebf, 0x1ebf, 0x1ec1, 0x1ec1, 0x1ec3, 0x1ec3, 0x1ec5, 0x1ec5, 0x1ec7, 0x1ec7, 0x1ec9, 0x1ec9, 0x1ecb, 0x1ecb, 0x1ecd, 0x1ecd, 0x1ecf, 0x1ecf, 0x1ed1, 0x1ed1, 0x1ed3, 0x1ed3, 0x1ed5, 0x1ed5, 0x1ed7, 0x1ed7, 0x1ed9, 0x1ed9, 0x1edb, 0x1edb, 0x1edd, 0x1edd, 0x1edf, 0x1edf, 0x1ee1, 0x1ee1, 0x1ee3, 0x1ee3, 0x1ee5, 0x1ee5, 0x1ee7, 0x1ee7, 0x1ee9, 0x1ee9, 0x1eeb, 0x1eeb, 0x1eed, 0x1eed, 0x1eef, 0x1eef, 0x1ef1, 0x1ef1, 0x1ef3, 0x1ef3, 0x1ef5, 0x1ef5, 0x1ef7, 0x1ef7, 0x1ef9, 0x1ef9, 0x1efb, 0x1efb, 0x1efd, 0x1efd, 0x1eff, 0x1f07, 0x1f10, 0x1f15, 0x1f20, 0x1f27, 0x1f30, 0x1f37, 0x1f40, 0x1f45, 0x1f50, 0x1f57, 0x1f60, 0x1f67, 0x1f70, 0x1f7d, 0x1f80, 0x1f87, 0x1f90, 0x1f97, 0x1fa0, 0x1fa7, 0x1fb0, 0x1fb4, 0x1fb6, 0x1fb7, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fc7, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fd7, 0x1fe0, 0x1fe7, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ff7, 0x214e, 0x214e, 0x2170, 0x217f, 0x2184, 0x2184, 0x24d0, 0x24e9, 0x2c30, 0x2c5f, 0x2c61, 0x2c61, 0x2c65, 0x2c66, 0x2c68, 0x2c68, 0x2c6a, 0x2c6a, 0x2c6c, 0x2c6c, 0x2c73, 0x2c73, 0x2c76, 0x2c76, 0x2c81, 0x2c81, 0x2c83, 0x2c83, 0x2c85, 0x2c85, 0x2c87, 0x2c87, 0x2c89, 0x2c89, 0x2c8b, 0x2c8b, 0x2c8d, 0x2c8d, 0x2c8f, 0x2c8f, 0x2c91, 0x2c91, 0x2c93, 0x2c93, 0x2c95, 0x2c95, 0x2c97, 0x2c97, 0x2c99, 0x2c99, 0x2c9b, 0x2c9b, 0x2c9d, 0x2c9d, 0x2c9f, 0x2c9f, 0x2ca1, 0x2ca1, 0x2ca3, 0x2ca3, 0x2ca5, 0x2ca5, 0x2ca7, 0x2ca7, 0x2ca9, 0x2ca9, 0x2cab, 0x2cab, 0x2cad, 0x2cad, 0x2caf, 0x2caf, 0x2cb1, 0x2cb1, 0x2cb3, 0x2cb3, 0x2cb5, 0x2cb5, 0x2cb7, 0x2cb7, 0x2cb9, 0x2cb9, 0x2cbb, 0x2cbb, 0x2cbd, 0x2cbd, 0x2cbf, 0x2cbf, 0x2cc1, 0x2cc1, 0x2cc3, 0x2cc3, 0x2cc5, 0x2cc5, 0x2cc7, 0x2cc7, 0x2cc9, 0x2cc9, 0x2ccb, 0x2ccb, 0x2ccd, 0x2ccd, 0x2ccf, 0x2ccf, 0x2cd1, 0x2cd1, 0x2cd3, 0x2cd3, 0x2cd5, 0x2cd5, 0x2cd7, 0x2cd7, 0x2cd9, 0x2cd9, 0x2cdb, 0x2cdb, 0x2cdd, 0x2cdd, 0x2cdf, 0x2cdf, 0x2ce1, 0x2ce1, 0x2ce3, 0x2ce3, 0x2cec, 0x2cec, 0x2cee, 0x2cee, 0x2cf3, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa641, 0xa641, 0xa643, 0xa643, 0xa645, 0xa645, 0xa647, 0xa647, 0xa649, 0xa649, 0xa64b, 0xa64b, 0xa64d, 0xa64d, 0xa64f, 0xa64f, 0xa651, 0xa651, 0xa653, 0xa653, 0xa655, 0xa655, 0xa657, 0xa657, 0xa659, 0xa659, 0xa65b, 0xa65b, 0xa65d, 0xa65d, 0xa65f, 0xa65f, 0xa661, 0xa661, 0xa663, 0xa663, 0xa665, 0xa665, 0xa667, 0xa667, 0xa669, 0xa669, 0xa66b, 0xa66b, 0xa66d, 0xa66d, 0xa681, 0xa681, 0xa683, 0xa683, 0xa685, 0xa685, 0xa687, 0xa687, 0xa689, 0xa689, 0xa68b, 0xa68b, 0xa68d, 0xa68d, 0xa68f, 0xa68f, 0xa691, 0xa691, 0xa693, 0xa693, 0xa695, 0xa695, 0xa697, 0xa697, 0xa699, 0xa699, 0xa69b, 0xa69b, 0xa723, 0xa723, 0xa725, 0xa725, 0xa727, 0xa727, 0xa729, 0xa729, 0xa72b, 0xa72b, 0xa72d, 0xa72d, 0xa72f, 0xa72f, 0xa733, 0xa733, 0xa735, 0xa735, 0xa737, 0xa737, 0xa739, 0xa739, 0xa73b, 0xa73b, 0xa73d, 0xa73d, 0xa73f, 0xa73f, 0xa741, 0xa741, 0xa743, 0xa743, 0xa745, 0xa745, 0xa747, 0xa747, 0xa749, 0xa749, 0xa74b, 0xa74b, 0xa74d, 0xa74d, 0xa74f, 0xa74f, 0xa751, 0xa751, 0xa753, 0xa753, 0xa755, 0xa755, 0xa757, 0xa757, 0xa759, 0xa759, 0xa75b, 0xa75b, 0xa75d, 0xa75d, 0xa75f, 0xa75f, 0xa761, 0xa761, 0xa763, 0xa763, 0xa765, 0xa765, 0xa767, 0xa767, 0xa769, 0xa769, 0xa76b, 0xa76b, 0xa76d, 0xa76d, 0xa76f, 0xa76f, 0xa77a, 0xa77a, 0xa77c, 0xa77c, 0xa77f, 0xa77f, 0xa781, 0xa781, 0xa783, 0xa783, 0xa785, 0xa785, 0xa787, 0xa787, 0xa78c, 0xa78c, 0xa791, 0xa791, 0xa793, 0xa794, 0xa797, 0xa797, 0xa799, 0xa799, 0xa79b, 0xa79b, 0xa79d, 0xa79d, 0xa79f, 0xa79f, 0xa7a1, 0xa7a1, 0xa7a3, 0xa7a3, 0xa7a5, 0xa7a5, 0xa7a7, 0xa7a7, 0xa7a9, 0xa7a9, 0xa7b5, 0xa7b5, 0xa7b7, 0xa7b7, 0xa7b9, 0xa7b9, 0xa7bb, 0xa7bb, 0xa7bd, 0xa7bd, 0xa7bf, 0xa7bf, 0xa7c1, 0xa7c1, 0xa7c3, 0xa7c3, 0xa7c8, 0xa7c8, 0xa7ca, 0xa7ca, 0xa7cd, 0xa7cd, 0xa7d1, 0xa7d1, 0xa7d7, 0xa7d7, 0xa7d9, 0xa7d9, 0xa7db, 0xa7db, 0xa7f6, 0xa7f6, 0xab53, 0xab53, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff41, 0xff5a, 0x10428, 0x1044f, 0x104d8, 0x104fb, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10cc0, 0x10cf2, 0x10d70, 0x10d85, 0x118c0, 0x118df, 0x16e60, 0x16e7f, 0x1e922, 0x1e943, }; /* END of CR_Changes_When_Titlecased */ /* PROPERTY: 'Changes_When_Uppercased': Derived Property */ static const OnigCodePoint CR_Changes_When_Uppercased[] = { 630, 0x0061, 0x007a, 0x00b5, 0x00b5, 0x00df, 0x00f6, 0x00f8, 0x00ff, 0x0101, 0x0101, 0x0103, 0x0103, 0x0105, 0x0105, 0x0107, 0x0107, 0x0109, 0x0109, 0x010b, 0x010b, 0x010d, 0x010d, 0x010f, 0x010f, 0x0111, 0x0111, 0x0113, 0x0113, 0x0115, 0x0115, 0x0117, 0x0117, 0x0119, 0x0119, 0x011b, 0x011b, 0x011d, 0x011d, 0x011f, 0x011f, 0x0121, 0x0121, 0x0123, 0x0123, 0x0125, 0x0125, 0x0127, 0x0127, 0x0129, 0x0129, 0x012b, 0x012b, 0x012d, 0x012d, 0x012f, 0x012f, 0x0131, 0x0131, 0x0133, 0x0133, 0x0135, 0x0135, 0x0137, 0x0137, 0x013a, 0x013a, 0x013c, 0x013c, 0x013e, 0x013e, 0x0140, 0x0140, 0x0142, 0x0142, 0x0144, 0x0144, 0x0146, 0x0146, 0x0148, 0x0149, 0x014b, 0x014b, 0x014d, 0x014d, 0x014f, 0x014f, 0x0151, 0x0151, 0x0153, 0x0153, 0x0155, 0x0155, 0x0157, 0x0157, 0x0159, 0x0159, 0x015b, 0x015b, 0x015d, 0x015d, 0x015f, 0x015f, 0x0161, 0x0161, 0x0163, 0x0163, 0x0165, 0x0165, 0x0167, 0x0167, 0x0169, 0x0169, 0x016b, 0x016b, 0x016d, 0x016d, 0x016f, 0x016f, 0x0171, 0x0171, 0x0173, 0x0173, 0x0175, 0x0175, 0x0177, 0x0177, 0x017a, 0x017a, 0x017c, 0x017c, 0x017e, 0x0180, 0x0183, 0x0183, 0x0185, 0x0185, 0x0188, 0x0188, 0x018c, 0x018c, 0x0192, 0x0192, 0x0195, 0x0195, 0x0199, 0x019b, 0x019e, 0x019e, 0x01a1, 0x01a1, 0x01a3, 0x01a3, 0x01a5, 0x01a5, 0x01a8, 0x01a8, 0x01ad, 0x01ad, 0x01b0, 0x01b0, 0x01b4, 0x01b4, 0x01b6, 0x01b6, 0x01b9, 0x01b9, 0x01bd, 0x01bd, 0x01bf, 0x01bf, 0x01c5, 0x01c6, 0x01c8, 0x01c9, 0x01cb, 0x01cc, 0x01ce, 0x01ce, 0x01d0, 0x01d0, 0x01d2, 0x01d2, 0x01d4, 0x01d4, 0x01d6, 0x01d6, 0x01d8, 0x01d8, 0x01da, 0x01da, 0x01dc, 0x01dd, 0x01df, 0x01df, 0x01e1, 0x01e1, 0x01e3, 0x01e3, 0x01e5, 0x01e5, 0x01e7, 0x01e7, 0x01e9, 0x01e9, 0x01eb, 0x01eb, 0x01ed, 0x01ed, 0x01ef, 0x01f0, 0x01f2, 0x01f3, 0x01f5, 0x01f5, 0x01f9, 0x01f9, 0x01fb, 0x01fb, 0x01fd, 0x01fd, 0x01ff, 0x01ff, 0x0201, 0x0201, 0x0203, 0x0203, 0x0205, 0x0205, 0x0207, 0x0207, 0x0209, 0x0209, 0x020b, 0x020b, 0x020d, 0x020d, 0x020f, 0x020f, 0x0211, 0x0211, 0x0213, 0x0213, 0x0215, 0x0215, 0x0217, 0x0217, 0x0219, 0x0219, 0x021b, 0x021b, 0x021d, 0x021d, 0x021f, 0x021f, 0x0223, 0x0223, 0x0225, 0x0225, 0x0227, 0x0227, 0x0229, 0x0229, 0x022b, 0x022b, 0x022d, 0x022d, 0x022f, 0x022f, 0x0231, 0x0231, 0x0233, 0x0233, 0x023c, 0x023c, 0x023f, 0x0240, 0x0242, 0x0242, 0x0247, 0x0247, 0x0249, 0x0249, 0x024b, 0x024b, 0x024d, 0x024d, 0x024f, 0x0254, 0x0256, 0x0257, 0x0259, 0x0259, 0x025b, 0x025c, 0x0260, 0x0261, 0x0263, 0x0266, 0x0268, 0x026c, 0x026f, 0x026f, 0x0271, 0x0272, 0x0275, 0x0275, 0x027d, 0x027d, 0x0280, 0x0280, 0x0282, 0x0283, 0x0287, 0x028c, 0x0292, 0x0292, 0x029d, 0x029e, 0x0345, 0x0345, 0x0371, 0x0371, 0x0373, 0x0373, 0x0377, 0x0377, 0x037b, 0x037d, 0x0390, 0x0390, 0x03ac, 0x03ce, 0x03d0, 0x03d1, 0x03d5, 0x03d7, 0x03d9, 0x03d9, 0x03db, 0x03db, 0x03dd, 0x03dd, 0x03df, 0x03df, 0x03e1, 0x03e1, 0x03e3, 0x03e3, 0x03e5, 0x03e5, 0x03e7, 0x03e7, 0x03e9, 0x03e9, 0x03eb, 0x03eb, 0x03ed, 0x03ed, 0x03ef, 0x03f3, 0x03f5, 0x03f5, 0x03f8, 0x03f8, 0x03fb, 0x03fb, 0x0430, 0x045f, 0x0461, 0x0461, 0x0463, 0x0463, 0x0465, 0x0465, 0x0467, 0x0467, 0x0469, 0x0469, 0x046b, 0x046b, 0x046d, 0x046d, 0x046f, 0x046f, 0x0471, 0x0471, 0x0473, 0x0473, 0x0475, 0x0475, 0x0477, 0x0477, 0x0479, 0x0479, 0x047b, 0x047b, 0x047d, 0x047d, 0x047f, 0x047f, 0x0481, 0x0481, 0x048b, 0x048b, 0x048d, 0x048d, 0x048f, 0x048f, 0x0491, 0x0491, 0x0493, 0x0493, 0x0495, 0x0495, 0x0497, 0x0497, 0x0499, 0x0499, 0x049b, 0x049b, 0x049d, 0x049d, 0x049f, 0x049f, 0x04a1, 0x04a1, 0x04a3, 0x04a3, 0x04a5, 0x04a5, 0x04a7, 0x04a7, 0x04a9, 0x04a9, 0x04ab, 0x04ab, 0x04ad, 0x04ad, 0x04af, 0x04af, 0x04b1, 0x04b1, 0x04b3, 0x04b3, 0x04b5, 0x04b5, 0x04b7, 0x04b7, 0x04b9, 0x04b9, 0x04bb, 0x04bb, 0x04bd, 0x04bd, 0x04bf, 0x04bf, 0x04c2, 0x04c2, 0x04c4, 0x04c4, 0x04c6, 0x04c6, 0x04c8, 0x04c8, 0x04ca, 0x04ca, 0x04cc, 0x04cc, 0x04ce, 0x04cf, 0x04d1, 0x04d1, 0x04d3, 0x04d3, 0x04d5, 0x04d5, 0x04d7, 0x04d7, 0x04d9, 0x04d9, 0x04db, 0x04db, 0x04dd, 0x04dd, 0x04df, 0x04df, 0x04e1, 0x04e1, 0x04e3, 0x04e3, 0x04e5, 0x04e5, 0x04e7, 0x04e7, 0x04e9, 0x04e9, 0x04eb, 0x04eb, 0x04ed, 0x04ed, 0x04ef, 0x04ef, 0x04f1, 0x04f1, 0x04f3, 0x04f3, 0x04f5, 0x04f5, 0x04f7, 0x04f7, 0x04f9, 0x04f9, 0x04fb, 0x04fb, 0x04fd, 0x04fd, 0x04ff, 0x04ff, 0x0501, 0x0501, 0x0503, 0x0503, 0x0505, 0x0505, 0x0507, 0x0507, 0x0509, 0x0509, 0x050b, 0x050b, 0x050d, 0x050d, 0x050f, 0x050f, 0x0511, 0x0511, 0x0513, 0x0513, 0x0515, 0x0515, 0x0517, 0x0517, 0x0519, 0x0519, 0x051b, 0x051b, 0x051d, 0x051d, 0x051f, 0x051f, 0x0521, 0x0521, 0x0523, 0x0523, 0x0525, 0x0525, 0x0527, 0x0527, 0x0529, 0x0529, 0x052b, 0x052b, 0x052d, 0x052d, 0x052f, 0x052f, 0x0561, 0x0587, 0x10d0, 0x10fa, 0x10fd, 0x10ff, 0x13f8, 0x13fd, 0x1c80, 0x1c88, 0x1c8a, 0x1c8a, 0x1d79, 0x1d79, 0x1d7d, 0x1d7d, 0x1d8e, 0x1d8e, 0x1e01, 0x1e01, 0x1e03, 0x1e03, 0x1e05, 0x1e05, 0x1e07, 0x1e07, 0x1e09, 0x1e09, 0x1e0b, 0x1e0b, 0x1e0d, 0x1e0d, 0x1e0f, 0x1e0f, 0x1e11, 0x1e11, 0x1e13, 0x1e13, 0x1e15, 0x1e15, 0x1e17, 0x1e17, 0x1e19, 0x1e19, 0x1e1b, 0x1e1b, 0x1e1d, 0x1e1d, 0x1e1f, 0x1e1f, 0x1e21, 0x1e21, 0x1e23, 0x1e23, 0x1e25, 0x1e25, 0x1e27, 0x1e27, 0x1e29, 0x1e29, 0x1e2b, 0x1e2b, 0x1e2d, 0x1e2d, 0x1e2f, 0x1e2f, 0x1e31, 0x1e31, 0x1e33, 0x1e33, 0x1e35, 0x1e35, 0x1e37, 0x1e37, 0x1e39, 0x1e39, 0x1e3b, 0x1e3b, 0x1e3d, 0x1e3d, 0x1e3f, 0x1e3f, 0x1e41, 0x1e41, 0x1e43, 0x1e43, 0x1e45, 0x1e45, 0x1e47, 0x1e47, 0x1e49, 0x1e49, 0x1e4b, 0x1e4b, 0x1e4d, 0x1e4d, 0x1e4f, 0x1e4f, 0x1e51, 0x1e51, 0x1e53, 0x1e53, 0x1e55, 0x1e55, 0x1e57, 0x1e57, 0x1e59, 0x1e59, 0x1e5b, 0x1e5b, 0x1e5d, 0x1e5d, 0x1e5f, 0x1e5f, 0x1e61, 0x1e61, 0x1e63, 0x1e63, 0x1e65, 0x1e65, 0x1e67, 0x1e67, 0x1e69, 0x1e69, 0x1e6b, 0x1e6b, 0x1e6d, 0x1e6d, 0x1e6f, 0x1e6f, 0x1e71, 0x1e71, 0x1e73, 0x1e73, 0x1e75, 0x1e75, 0x1e77, 0x1e77, 0x1e79, 0x1e79, 0x1e7b, 0x1e7b, 0x1e7d, 0x1e7d, 0x1e7f, 0x1e7f, 0x1e81, 0x1e81, 0x1e83, 0x1e83, 0x1e85, 0x1e85, 0x1e87, 0x1e87, 0x1e89, 0x1e89, 0x1e8b, 0x1e8b, 0x1e8d, 0x1e8d, 0x1e8f, 0x1e8f, 0x1e91, 0x1e91, 0x1e93, 0x1e93, 0x1e95, 0x1e9b, 0x1ea1, 0x1ea1, 0x1ea3, 0x1ea3, 0x1ea5, 0x1ea5, 0x1ea7, 0x1ea7, 0x1ea9, 0x1ea9, 0x1eab, 0x1eab, 0x1ead, 0x1ead, 0x1eaf, 0x1eaf, 0x1eb1, 0x1eb1, 0x1eb3, 0x1eb3, 0x1eb5, 0x1eb5, 0x1eb7, 0x1eb7, 0x1eb9, 0x1eb9, 0x1ebb, 0x1ebb, 0x1ebd, 0x1ebd, 0x1ebf, 0x1ebf, 0x1ec1, 0x1ec1, 0x1ec3, 0x1ec3, 0x1ec5, 0x1ec5, 0x1ec7, 0x1ec7, 0x1ec9, 0x1ec9, 0x1ecb, 0x1ecb, 0x1ecd, 0x1ecd, 0x1ecf, 0x1ecf, 0x1ed1, 0x1ed1, 0x1ed3, 0x1ed3, 0x1ed5, 0x1ed5, 0x1ed7, 0x1ed7, 0x1ed9, 0x1ed9, 0x1edb, 0x1edb, 0x1edd, 0x1edd, 0x1edf, 0x1edf, 0x1ee1, 0x1ee1, 0x1ee3, 0x1ee3, 0x1ee5, 0x1ee5, 0x1ee7, 0x1ee7, 0x1ee9, 0x1ee9, 0x1eeb, 0x1eeb, 0x1eed, 0x1eed, 0x1eef, 0x1eef, 0x1ef1, 0x1ef1, 0x1ef3, 0x1ef3, 0x1ef5, 0x1ef5, 0x1ef7, 0x1ef7, 0x1ef9, 0x1ef9, 0x1efb, 0x1efb, 0x1efd, 0x1efd, 0x1eff, 0x1f07, 0x1f10, 0x1f15, 0x1f20, 0x1f27, 0x1f30, 0x1f37, 0x1f40, 0x1f45, 0x1f50, 0x1f57, 0x1f60, 0x1f67, 0x1f70, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fb7, 0x1fbc, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fc7, 0x1fcc, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fd7, 0x1fe0, 0x1fe7, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ff7, 0x1ffc, 0x1ffc, 0x214e, 0x214e, 0x2170, 0x217f, 0x2184, 0x2184, 0x24d0, 0x24e9, 0x2c30, 0x2c5f, 0x2c61, 0x2c61, 0x2c65, 0x2c66, 0x2c68, 0x2c68, 0x2c6a, 0x2c6a, 0x2c6c, 0x2c6c, 0x2c73, 0x2c73, 0x2c76, 0x2c76, 0x2c81, 0x2c81, 0x2c83, 0x2c83, 0x2c85, 0x2c85, 0x2c87, 0x2c87, 0x2c89, 0x2c89, 0x2c8b, 0x2c8b, 0x2c8d, 0x2c8d, 0x2c8f, 0x2c8f, 0x2c91, 0x2c91, 0x2c93, 0x2c93, 0x2c95, 0x2c95, 0x2c97, 0x2c97, 0x2c99, 0x2c99, 0x2c9b, 0x2c9b, 0x2c9d, 0x2c9d, 0x2c9f, 0x2c9f, 0x2ca1, 0x2ca1, 0x2ca3, 0x2ca3, 0x2ca5, 0x2ca5, 0x2ca7, 0x2ca7, 0x2ca9, 0x2ca9, 0x2cab, 0x2cab, 0x2cad, 0x2cad, 0x2caf, 0x2caf, 0x2cb1, 0x2cb1, 0x2cb3, 0x2cb3, 0x2cb5, 0x2cb5, 0x2cb7, 0x2cb7, 0x2cb9, 0x2cb9, 0x2cbb, 0x2cbb, 0x2cbd, 0x2cbd, 0x2cbf, 0x2cbf, 0x2cc1, 0x2cc1, 0x2cc3, 0x2cc3, 0x2cc5, 0x2cc5, 0x2cc7, 0x2cc7, 0x2cc9, 0x2cc9, 0x2ccb, 0x2ccb, 0x2ccd, 0x2ccd, 0x2ccf, 0x2ccf, 0x2cd1, 0x2cd1, 0x2cd3, 0x2cd3, 0x2cd5, 0x2cd5, 0x2cd7, 0x2cd7, 0x2cd9, 0x2cd9, 0x2cdb, 0x2cdb, 0x2cdd, 0x2cdd, 0x2cdf, 0x2cdf, 0x2ce1, 0x2ce1, 0x2ce3, 0x2ce3, 0x2cec, 0x2cec, 0x2cee, 0x2cee, 0x2cf3, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa641, 0xa641, 0xa643, 0xa643, 0xa645, 0xa645, 0xa647, 0xa647, 0xa649, 0xa649, 0xa64b, 0xa64b, 0xa64d, 0xa64d, 0xa64f, 0xa64f, 0xa651, 0xa651, 0xa653, 0xa653, 0xa655, 0xa655, 0xa657, 0xa657, 0xa659, 0xa659, 0xa65b, 0xa65b, 0xa65d, 0xa65d, 0xa65f, 0xa65f, 0xa661, 0xa661, 0xa663, 0xa663, 0xa665, 0xa665, 0xa667, 0xa667, 0xa669, 0xa669, 0xa66b, 0xa66b, 0xa66d, 0xa66d, 0xa681, 0xa681, 0xa683, 0xa683, 0xa685, 0xa685, 0xa687, 0xa687, 0xa689, 0xa689, 0xa68b, 0xa68b, 0xa68d, 0xa68d, 0xa68f, 0xa68f, 0xa691, 0xa691, 0xa693, 0xa693, 0xa695, 0xa695, 0xa697, 0xa697, 0xa699, 0xa699, 0xa69b, 0xa69b, 0xa723, 0xa723, 0xa725, 0xa725, 0xa727, 0xa727, 0xa729, 0xa729, 0xa72b, 0xa72b, 0xa72d, 0xa72d, 0xa72f, 0xa72f, 0xa733, 0xa733, 0xa735, 0xa735, 0xa737, 0xa737, 0xa739, 0xa739, 0xa73b, 0xa73b, 0xa73d, 0xa73d, 0xa73f, 0xa73f, 0xa741, 0xa741, 0xa743, 0xa743, 0xa745, 0xa745, 0xa747, 0xa747, 0xa749, 0xa749, 0xa74b, 0xa74b, 0xa74d, 0xa74d, 0xa74f, 0xa74f, 0xa751, 0xa751, 0xa753, 0xa753, 0xa755, 0xa755, 0xa757, 0xa757, 0xa759, 0xa759, 0xa75b, 0xa75b, 0xa75d, 0xa75d, 0xa75f, 0xa75f, 0xa761, 0xa761, 0xa763, 0xa763, 0xa765, 0xa765, 0xa767, 0xa767, 0xa769, 0xa769, 0xa76b, 0xa76b, 0xa76d, 0xa76d, 0xa76f, 0xa76f, 0xa77a, 0xa77a, 0xa77c, 0xa77c, 0xa77f, 0xa77f, 0xa781, 0xa781, 0xa783, 0xa783, 0xa785, 0xa785, 0xa787, 0xa787, 0xa78c, 0xa78c, 0xa791, 0xa791, 0xa793, 0xa794, 0xa797, 0xa797, 0xa799, 0xa799, 0xa79b, 0xa79b, 0xa79d, 0xa79d, 0xa79f, 0xa79f, 0xa7a1, 0xa7a1, 0xa7a3, 0xa7a3, 0xa7a5, 0xa7a5, 0xa7a7, 0xa7a7, 0xa7a9, 0xa7a9, 0xa7b5, 0xa7b5, 0xa7b7, 0xa7b7, 0xa7b9, 0xa7b9, 0xa7bb, 0xa7bb, 0xa7bd, 0xa7bd, 0xa7bf, 0xa7bf, 0xa7c1, 0xa7c1, 0xa7c3, 0xa7c3, 0xa7c8, 0xa7c8, 0xa7ca, 0xa7ca, 0xa7cd, 0xa7cd, 0xa7d1, 0xa7d1, 0xa7d7, 0xa7d7, 0xa7d9, 0xa7d9, 0xa7db, 0xa7db, 0xa7f6, 0xa7f6, 0xab53, 0xab53, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff41, 0xff5a, 0x10428, 0x1044f, 0x104d8, 0x104fb, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10cc0, 0x10cf2, 0x10d70, 0x10d85, 0x118c0, 0x118df, 0x16e60, 0x16e7f, 0x1e922, 0x1e943, }; /* END of CR_Changes_When_Uppercased */ /* PROPERTY: 'Cherokee': Script */ static const OnigCodePoint CR_Cherokee[] = { 3, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0xab70, 0xabbf, }; /* END of CR_Cherokee */ /* PROPERTY: 'Chorasmian': Script */ static const OnigCodePoint CR_Chorasmian[] = { 1, 0x10fb0, 0x10fcb, }; /* END of CR_Chorasmian */ /* PROPERTY: 'Cn': General Category */ static const OnigCodePoint CR_Cn[] = { 731, 0x0378, 0x0379, 0x0380, 0x0383, 0x038b, 0x038b, 0x038d, 0x038d, 0x03a2, 0x03a2, 0x0530, 0x0530, 0x0557, 0x0558, 0x058b, 0x058c, 0x0590, 0x0590, 0x05c8, 0x05cf, 0x05eb, 0x05ee, 0x05f5, 0x05ff, 0x070e, 0x070e, 0x074b, 0x074c, 0x07b2, 0x07bf, 0x07fb, 0x07fc, 0x082e, 0x082f, 0x083f, 0x083f, 0x085c, 0x085d, 0x085f, 0x085f, 0x086b, 0x086f, 0x088f, 0x088f, 0x0892, 0x0896, 0x0984, 0x0984, 0x098d, 0x098e, 0x0991, 0x0992, 0x09a9, 0x09a9, 0x09b1, 0x09b1, 0x09b3, 0x09b5, 0x09ba, 0x09bb, 0x09c5, 0x09c6, 0x09c9, 0x09ca, 0x09cf, 0x09d6, 0x09d8, 0x09db, 0x09de, 0x09de, 0x09e4, 0x09e5, 0x09ff, 0x0a00, 0x0a04, 0x0a04, 0x0a0b, 0x0a0e, 0x0a11, 0x0a12, 0x0a29, 0x0a29, 0x0a31, 0x0a31, 0x0a34, 0x0a34, 0x0a37, 0x0a37, 0x0a3a, 0x0a3b, 0x0a3d, 0x0a3d, 0x0a43, 0x0a46, 0x0a49, 0x0a4a, 0x0a4e, 0x0a50, 0x0a52, 0x0a58, 0x0a5d, 0x0a5d, 0x0a5f, 0x0a65, 0x0a77, 0x0a80, 0x0a84, 0x0a84, 0x0a8e, 0x0a8e, 0x0a92, 0x0a92, 0x0aa9, 0x0aa9, 0x0ab1, 0x0ab1, 0x0ab4, 0x0ab4, 0x0aba, 0x0abb, 0x0ac6, 0x0ac6, 0x0aca, 0x0aca, 0x0ace, 0x0acf, 0x0ad1, 0x0adf, 0x0ae4, 0x0ae5, 0x0af2, 0x0af8, 0x0b00, 0x0b00, 0x0b04, 0x0b04, 0x0b0d, 0x0b0e, 0x0b11, 0x0b12, 0x0b29, 0x0b29, 0x0b31, 0x0b31, 0x0b34, 0x0b34, 0x0b3a, 0x0b3b, 0x0b45, 0x0b46, 0x0b49, 0x0b4a, 0x0b4e, 0x0b54, 0x0b58, 0x0b5b, 0x0b5e, 0x0b5e, 0x0b64, 0x0b65, 0x0b78, 0x0b81, 0x0b84, 0x0b84, 0x0b8b, 0x0b8d, 0x0b91, 0x0b91, 0x0b96, 0x0b98, 0x0b9b, 0x0b9b, 0x0b9d, 0x0b9d, 0x0ba0, 0x0ba2, 0x0ba5, 0x0ba7, 0x0bab, 0x0bad, 0x0bba, 0x0bbd, 0x0bc3, 0x0bc5, 0x0bc9, 0x0bc9, 0x0bce, 0x0bcf, 0x0bd1, 0x0bd6, 0x0bd8, 0x0be5, 0x0bfb, 0x0bff, 0x0c0d, 0x0c0d, 0x0c11, 0x0c11, 0x0c29, 0x0c29, 0x0c3a, 0x0c3b, 0x0c45, 0x0c45, 0x0c49, 0x0c49, 0x0c4e, 0x0c54, 0x0c57, 0x0c57, 0x0c5b, 0x0c5c, 0x0c5e, 0x0c5f, 0x0c64, 0x0c65, 0x0c70, 0x0c76, 0x0c8d, 0x0c8d, 0x0c91, 0x0c91, 0x0ca9, 0x0ca9, 0x0cb4, 0x0cb4, 0x0cba, 0x0cbb, 0x0cc5, 0x0cc5, 0x0cc9, 0x0cc9, 0x0cce, 0x0cd4, 0x0cd7, 0x0cdc, 0x0cdf, 0x0cdf, 0x0ce4, 0x0ce5, 0x0cf0, 0x0cf0, 0x0cf4, 0x0cff, 0x0d0d, 0x0d0d, 0x0d11, 0x0d11, 0x0d45, 0x0d45, 0x0d49, 0x0d49, 0x0d50, 0x0d53, 0x0d64, 0x0d65, 0x0d80, 0x0d80, 0x0d84, 0x0d84, 0x0d97, 0x0d99, 0x0db2, 0x0db2, 0x0dbc, 0x0dbc, 0x0dbe, 0x0dbf, 0x0dc7, 0x0dc9, 0x0dcb, 0x0dce, 0x0dd5, 0x0dd5, 0x0dd7, 0x0dd7, 0x0de0, 0x0de5, 0x0df0, 0x0df1, 0x0df5, 0x0e00, 0x0e3b, 0x0e3e, 0x0e5c, 0x0e80, 0x0e83, 0x0e83, 0x0e85, 0x0e85, 0x0e8b, 0x0e8b, 0x0ea4, 0x0ea4, 0x0ea6, 0x0ea6, 0x0ebe, 0x0ebf, 0x0ec5, 0x0ec5, 0x0ec7, 0x0ec7, 0x0ecf, 0x0ecf, 0x0eda, 0x0edb, 0x0ee0, 0x0eff, 0x0f48, 0x0f48, 0x0f6d, 0x0f70, 0x0f98, 0x0f98, 0x0fbd, 0x0fbd, 0x0fcd, 0x0fcd, 0x0fdb, 0x0fff, 0x10c6, 0x10c6, 0x10c8, 0x10cc, 0x10ce, 0x10cf, 0x1249, 0x1249, 0x124e, 0x124f, 0x1257, 0x1257, 0x1259, 0x1259, 0x125e, 0x125f, 0x1289, 0x1289, 0x128e, 0x128f, 0x12b1, 0x12b1, 0x12b6, 0x12b7, 0x12bf, 0x12bf, 0x12c1, 0x12c1, 0x12c6, 0x12c7, 0x12d7, 0x12d7, 0x1311, 0x1311, 0x1316, 0x1317, 0x135b, 0x135c, 0x137d, 0x137f, 0x139a, 0x139f, 0x13f6, 0x13f7, 0x13fe, 0x13ff, 0x169d, 0x169f, 0x16f9, 0x16ff, 0x1716, 0x171e, 0x1737, 0x173f, 0x1754, 0x175f, 0x176d, 0x176d, 0x1771, 0x1771, 0x1774, 0x177f, 0x17de, 0x17df, 0x17ea, 0x17ef, 0x17fa, 0x17ff, 0x181a, 0x181f, 0x1879, 0x187f, 0x18ab, 0x18af, 0x18f6, 0x18ff, 0x191f, 0x191f, 0x192c, 0x192f, 0x193c, 0x193f, 0x1941, 0x1943, 0x196e, 0x196f, 0x1975, 0x197f, 0x19ac, 0x19af, 0x19ca, 0x19cf, 0x19db, 0x19dd, 0x1a1c, 0x1a1d, 0x1a5f, 0x1a5f, 0x1a7d, 0x1a7e, 0x1a8a, 0x1a8f, 0x1a9a, 0x1a9f, 0x1aae, 0x1aaf, 0x1acf, 0x1aff, 0x1b4d, 0x1b4d, 0x1bf4, 0x1bfb, 0x1c38, 0x1c3a, 0x1c4a, 0x1c4c, 0x1c8b, 0x1c8f, 0x1cbb, 0x1cbc, 0x1cc8, 0x1ccf, 0x1cfb, 0x1cff, 0x1f16, 0x1f17, 0x1f1e, 0x1f1f, 0x1f46, 0x1f47, 0x1f4e, 0x1f4f, 0x1f58, 0x1f58, 0x1f5a, 0x1f5a, 0x1f5c, 0x1f5c, 0x1f5e, 0x1f5e, 0x1f7e, 0x1f7f, 0x1fb5, 0x1fb5, 0x1fc5, 0x1fc5, 0x1fd4, 0x1fd5, 0x1fdc, 0x1fdc, 0x1ff0, 0x1ff1, 0x1ff5, 0x1ff5, 0x1fff, 0x1fff, 0x2065, 0x2065, 0x2072, 0x2073, 0x208f, 0x208f, 0x209d, 0x209f, 0x20c1, 0x20cf, 0x20f1, 0x20ff, 0x218c, 0x218f, 0x242a, 0x243f, 0x244b, 0x245f, 0x2b74, 0x2b75, 0x2b96, 0x2b96, 0x2cf4, 0x2cf8, 0x2d26, 0x2d26, 0x2d28, 0x2d2c, 0x2d2e, 0x2d2f, 0x2d68, 0x2d6e, 0x2d71, 0x2d7e, 0x2d97, 0x2d9f, 0x2da7, 0x2da7, 0x2daf, 0x2daf, 0x2db7, 0x2db7, 0x2dbf, 0x2dbf, 0x2dc7, 0x2dc7, 0x2dcf, 0x2dcf, 0x2dd7, 0x2dd7, 0x2ddf, 0x2ddf, 0x2e5e, 0x2e7f, 0x2e9a, 0x2e9a, 0x2ef4, 0x2eff, 0x2fd6, 0x2fef, 0x3040, 0x3040, 0x3097, 0x3098, 0x3100, 0x3104, 0x3130, 0x3130, 0x318f, 0x318f, 0x31e6, 0x31ee, 0x321f, 0x321f, 0xa48d, 0xa48f, 0xa4c7, 0xa4cf, 0xa62c, 0xa63f, 0xa6f8, 0xa6ff, 0xa7ce, 0xa7cf, 0xa7d2, 0xa7d2, 0xa7d4, 0xa7d4, 0xa7dd, 0xa7f1, 0xa82d, 0xa82f, 0xa83a, 0xa83f, 0xa878, 0xa87f, 0xa8c6, 0xa8cd, 0xa8da, 0xa8df, 0xa954, 0xa95e, 0xa97d, 0xa97f, 0xa9ce, 0xa9ce, 0xa9da, 0xa9dd, 0xa9ff, 0xa9ff, 0xaa37, 0xaa3f, 0xaa4e, 0xaa4f, 0xaa5a, 0xaa5b, 0xaac3, 0xaada, 0xaaf7, 0xab00, 0xab07, 0xab08, 0xab0f, 0xab10, 0xab17, 0xab1f, 0xab27, 0xab27, 0xab2f, 0xab2f, 0xab6c, 0xab6f, 0xabee, 0xabef, 0xabfa, 0xabff, 0xd7a4, 0xd7af, 0xd7c7, 0xd7ca, 0xd7fc, 0xd7ff, 0xfa6e, 0xfa6f, 0xfada, 0xfaff, 0xfb07, 0xfb12, 0xfb18, 0xfb1c, 0xfb37, 0xfb37, 0xfb3d, 0xfb3d, 0xfb3f, 0xfb3f, 0xfb42, 0xfb42, 0xfb45, 0xfb45, 0xfbc3, 0xfbd2, 0xfd90, 0xfd91, 0xfdc8, 0xfdce, 0xfdd0, 0xfdef, 0xfe1a, 0xfe1f, 0xfe53, 0xfe53, 0xfe67, 0xfe67, 0xfe6c, 0xfe6f, 0xfe75, 0xfe75, 0xfefd, 0xfefe, 0xff00, 0xff00, 0xffbf, 0xffc1, 0xffc8, 0xffc9, 0xffd0, 0xffd1, 0xffd8, 0xffd9, 0xffdd, 0xffdf, 0xffe7, 0xffe7, 0xffef, 0xfff8, 0xfffe, 0xffff, 0x1000c, 0x1000c, 0x10027, 0x10027, 0x1003b, 0x1003b, 0x1003e, 0x1003e, 0x1004e, 0x1004f, 0x1005e, 0x1007f, 0x100fb, 0x100ff, 0x10103, 0x10106, 0x10134, 0x10136, 0x1018f, 0x1018f, 0x1019d, 0x1019f, 0x101a1, 0x101cf, 0x101fe, 0x1027f, 0x1029d, 0x1029f, 0x102d1, 0x102df, 0x102fc, 0x102ff, 0x10324, 0x1032c, 0x1034b, 0x1034f, 0x1037b, 0x1037f, 0x1039e, 0x1039e, 0x103c4, 0x103c7, 0x103d6, 0x103ff, 0x1049e, 0x1049f, 0x104aa, 0x104af, 0x104d4, 0x104d7, 0x104fc, 0x104ff, 0x10528, 0x1052f, 0x10564, 0x1056e, 0x1057b, 0x1057b, 0x1058b, 0x1058b, 0x10593, 0x10593, 0x10596, 0x10596, 0x105a2, 0x105a2, 0x105b2, 0x105b2, 0x105ba, 0x105ba, 0x105bd, 0x105bf, 0x105f4, 0x105ff, 0x10737, 0x1073f, 0x10756, 0x1075f, 0x10768, 0x1077f, 0x10786, 0x10786, 0x107b1, 0x107b1, 0x107bb, 0x107ff, 0x10806, 0x10807, 0x10809, 0x10809, 0x10836, 0x10836, 0x10839, 0x1083b, 0x1083d, 0x1083e, 0x10856, 0x10856, 0x1089f, 0x108a6, 0x108b0, 0x108df, 0x108f3, 0x108f3, 0x108f6, 0x108fa, 0x1091c, 0x1091e, 0x1093a, 0x1093e, 0x10940, 0x1097f, 0x109b8, 0x109bb, 0x109d0, 0x109d1, 0x10a04, 0x10a04, 0x10a07, 0x10a0b, 0x10a14, 0x10a14, 0x10a18, 0x10a18, 0x10a36, 0x10a37, 0x10a3b, 0x10a3e, 0x10a49, 0x10a4f, 0x10a59, 0x10a5f, 0x10aa0, 0x10abf, 0x10ae7, 0x10aea, 0x10af7, 0x10aff, 0x10b36, 0x10b38, 0x10b56, 0x10b57, 0x10b73, 0x10b77, 0x10b92, 0x10b98, 0x10b9d, 0x10ba8, 0x10bb0, 0x10bff, 0x10c49, 0x10c7f, 0x10cb3, 0x10cbf, 0x10cf3, 0x10cf9, 0x10d28, 0x10d2f, 0x10d3a, 0x10d3f, 0x10d66, 0x10d68, 0x10d86, 0x10d8d, 0x10d90, 0x10e5f, 0x10e7f, 0x10e7f, 0x10eaa, 0x10eaa, 0x10eae, 0x10eaf, 0x10eb2, 0x10ec1, 0x10ec5, 0x10efb, 0x10f28, 0x10f2f, 0x10f5a, 0x10f6f, 0x10f8a, 0x10faf, 0x10fcc, 0x10fdf, 0x10ff7, 0x10fff, 0x1104e, 0x11051, 0x11076, 0x1107e, 0x110c3, 0x110cc, 0x110ce, 0x110cf, 0x110e9, 0x110ef, 0x110fa, 0x110ff, 0x11135, 0x11135, 0x11148, 0x1114f, 0x11177, 0x1117f, 0x111e0, 0x111e0, 0x111f5, 0x111ff, 0x11212, 0x11212, 0x11242, 0x1127f, 0x11287, 0x11287, 0x11289, 0x11289, 0x1128e, 0x1128e, 0x1129e, 0x1129e, 0x112aa, 0x112af, 0x112eb, 0x112ef, 0x112fa, 0x112ff, 0x11304, 0x11304, 0x1130d, 0x1130e, 0x11311, 0x11312, 0x11329, 0x11329, 0x11331, 0x11331, 0x11334, 0x11334, 0x1133a, 0x1133a, 0x11345, 0x11346, 0x11349, 0x1134a, 0x1134e, 0x1134f, 0x11351, 0x11356, 0x11358, 0x1135c, 0x11364, 0x11365, 0x1136d, 0x1136f, 0x11375, 0x1137f, 0x1138a, 0x1138a, 0x1138c, 0x1138d, 0x1138f, 0x1138f, 0x113b6, 0x113b6, 0x113c1, 0x113c1, 0x113c3, 0x113c4, 0x113c6, 0x113c6, 0x113cb, 0x113cb, 0x113d6, 0x113d6, 0x113d9, 0x113e0, 0x113e3, 0x113ff, 0x1145c, 0x1145c, 0x11462, 0x1147f, 0x114c8, 0x114cf, 0x114da, 0x1157f, 0x115b6, 0x115b7, 0x115de, 0x115ff, 0x11645, 0x1164f, 0x1165a, 0x1165f, 0x1166d, 0x1167f, 0x116ba, 0x116bf, 0x116ca, 0x116cf, 0x116e4, 0x116ff, 0x1171b, 0x1171c, 0x1172c, 0x1172f, 0x11747, 0x117ff, 0x1183c, 0x1189f, 0x118f3, 0x118fe, 0x11907, 0x11908, 0x1190a, 0x1190b, 0x11914, 0x11914, 0x11917, 0x11917, 0x11936, 0x11936, 0x11939, 0x1193a, 0x11947, 0x1194f, 0x1195a, 0x1199f, 0x119a8, 0x119a9, 0x119d8, 0x119d9, 0x119e5, 0x119ff, 0x11a48, 0x11a4f, 0x11aa3, 0x11aaf, 0x11af9, 0x11aff, 0x11b0a, 0x11bbf, 0x11be2, 0x11bef, 0x11bfa, 0x11bff, 0x11c09, 0x11c09, 0x11c37, 0x11c37, 0x11c46, 0x11c4f, 0x11c6d, 0x11c6f, 0x11c90, 0x11c91, 0x11ca8, 0x11ca8, 0x11cb7, 0x11cff, 0x11d07, 0x11d07, 0x11d0a, 0x11d0a, 0x11d37, 0x11d39, 0x11d3b, 0x11d3b, 0x11d3e, 0x11d3e, 0x11d48, 0x11d4f, 0x11d5a, 0x11d5f, 0x11d66, 0x11d66, 0x11d69, 0x11d69, 0x11d8f, 0x11d8f, 0x11d92, 0x11d92, 0x11d99, 0x11d9f, 0x11daa, 0x11edf, 0x11ef9, 0x11eff, 0x11f11, 0x11f11, 0x11f3b, 0x11f3d, 0x11f5b, 0x11faf, 0x11fb1, 0x11fbf, 0x11ff2, 0x11ffe, 0x1239a, 0x123ff, 0x1246f, 0x1246f, 0x12475, 0x1247f, 0x12544, 0x12f8f, 0x12ff3, 0x12fff, 0x13456, 0x1345f, 0x143fb, 0x143ff, 0x14647, 0x160ff, 0x1613a, 0x167ff, 0x16a39, 0x16a3f, 0x16a5f, 0x16a5f, 0x16a6a, 0x16a6d, 0x16abf, 0x16abf, 0x16aca, 0x16acf, 0x16aee, 0x16aef, 0x16af6, 0x16aff, 0x16b46, 0x16b4f, 0x16b5a, 0x16b5a, 0x16b62, 0x16b62, 0x16b78, 0x16b7c, 0x16b90, 0x16d3f, 0x16d7a, 0x16e3f, 0x16e9b, 0x16eff, 0x16f4b, 0x16f4e, 0x16f88, 0x16f8e, 0x16fa0, 0x16fdf, 0x16fe5, 0x16fef, 0x16ff2, 0x16fff, 0x187f8, 0x187ff, 0x18cd6, 0x18cfe, 0x18d09, 0x1afef, 0x1aff4, 0x1aff4, 0x1affc, 0x1affc, 0x1afff, 0x1afff, 0x1b123, 0x1b131, 0x1b133, 0x1b14f, 0x1b153, 0x1b154, 0x1b156, 0x1b163, 0x1b168, 0x1b16f, 0x1b2fc, 0x1bbff, 0x1bc6b, 0x1bc6f, 0x1bc7d, 0x1bc7f, 0x1bc89, 0x1bc8f, 0x1bc9a, 0x1bc9b, 0x1bca4, 0x1cbff, 0x1ccfa, 0x1ccff, 0x1ceb4, 0x1ceff, 0x1cf2e, 0x1cf2f, 0x1cf47, 0x1cf4f, 0x1cfc4, 0x1cfff, 0x1d0f6, 0x1d0ff, 0x1d127, 0x1d128, 0x1d1eb, 0x1d1ff, 0x1d246, 0x1d2bf, 0x1d2d4, 0x1d2df, 0x1d2f4, 0x1d2ff, 0x1d357, 0x1d35f, 0x1d379, 0x1d3ff, 0x1d455, 0x1d455, 0x1d49d, 0x1d49d, 0x1d4a0, 0x1d4a1, 0x1d4a3, 0x1d4a4, 0x1d4a7, 0x1d4a8, 0x1d4ad, 0x1d4ad, 0x1d4ba, 0x1d4ba, 0x1d4bc, 0x1d4bc, 0x1d4c4, 0x1d4c4, 0x1d506, 0x1d506, 0x1d50b, 0x1d50c, 0x1d515, 0x1d515, 0x1d51d, 0x1d51d, 0x1d53a, 0x1d53a, 0x1d53f, 0x1d53f, 0x1d545, 0x1d545, 0x1d547, 0x1d549, 0x1d551, 0x1d551, 0x1d6a6, 0x1d6a7, 0x1d7cc, 0x1d7cd, 0x1da8c, 0x1da9a, 0x1daa0, 0x1daa0, 0x1dab0, 0x1deff, 0x1df1f, 0x1df24, 0x1df2b, 0x1dfff, 0x1e007, 0x1e007, 0x1e019, 0x1e01a, 0x1e022, 0x1e022, 0x1e025, 0x1e025, 0x1e02b, 0x1e02f, 0x1e06e, 0x1e08e, 0x1e090, 0x1e0ff, 0x1e12d, 0x1e12f, 0x1e13e, 0x1e13f, 0x1e14a, 0x1e14d, 0x1e150, 0x1e28f, 0x1e2af, 0x1e2bf, 0x1e2fa, 0x1e2fe, 0x1e300, 0x1e4cf, 0x1e4fa, 0x1e5cf, 0x1e5fb, 0x1e5fe, 0x1e600, 0x1e7df, 0x1e7e7, 0x1e7e7, 0x1e7ec, 0x1e7ec, 0x1e7ef, 0x1e7ef, 0x1e7ff, 0x1e7ff, 0x1e8c5, 0x1e8c6, 0x1e8d7, 0x1e8ff, 0x1e94c, 0x1e94f, 0x1e95a, 0x1e95d, 0x1e960, 0x1ec70, 0x1ecb5, 0x1ed00, 0x1ed3e, 0x1edff, 0x1ee04, 0x1ee04, 0x1ee20, 0x1ee20, 0x1ee23, 0x1ee23, 0x1ee25, 0x1ee26, 0x1ee28, 0x1ee28, 0x1ee33, 0x1ee33, 0x1ee38, 0x1ee38, 0x1ee3a, 0x1ee3a, 0x1ee3c, 0x1ee41, 0x1ee43, 0x1ee46, 0x1ee48, 0x1ee48, 0x1ee4a, 0x1ee4a, 0x1ee4c, 0x1ee4c, 0x1ee50, 0x1ee50, 0x1ee53, 0x1ee53, 0x1ee55, 0x1ee56, 0x1ee58, 0x1ee58, 0x1ee5a, 0x1ee5a, 0x1ee5c, 0x1ee5c, 0x1ee5e, 0x1ee5e, 0x1ee60, 0x1ee60, 0x1ee63, 0x1ee63, 0x1ee65, 0x1ee66, 0x1ee6b, 0x1ee6b, 0x1ee73, 0x1ee73, 0x1ee78, 0x1ee78, 0x1ee7d, 0x1ee7d, 0x1ee7f, 0x1ee7f, 0x1ee8a, 0x1ee8a, 0x1ee9c, 0x1eea0, 0x1eea4, 0x1eea4, 0x1eeaa, 0x1eeaa, 0x1eebc, 0x1eeef, 0x1eef2, 0x1efff, 0x1f02c, 0x1f02f, 0x1f094, 0x1f09f, 0x1f0af, 0x1f0b0, 0x1f0c0, 0x1f0c0, 0x1f0d0, 0x1f0d0, 0x1f0f6, 0x1f0ff, 0x1f1ae, 0x1f1e5, 0x1f203, 0x1f20f, 0x1f23c, 0x1f23f, 0x1f249, 0x1f24f, 0x1f252, 0x1f25f, 0x1f266, 0x1f2ff, 0x1f6d8, 0x1f6db, 0x1f6ed, 0x1f6ef, 0x1f6fd, 0x1f6ff, 0x1f777, 0x1f77a, 0x1f7da, 0x1f7df, 0x1f7ec, 0x1f7ef, 0x1f7f1, 0x1f7ff, 0x1f80c, 0x1f80f, 0x1f848, 0x1f84f, 0x1f85a, 0x1f85f, 0x1f888, 0x1f88f, 0x1f8ae, 0x1f8af, 0x1f8bc, 0x1f8bf, 0x1f8c2, 0x1f8ff, 0x1fa54, 0x1fa5f, 0x1fa6e, 0x1fa6f, 0x1fa7d, 0x1fa7f, 0x1fa8a, 0x1fa8e, 0x1fac7, 0x1facd, 0x1fadd, 0x1fade, 0x1faea, 0x1faef, 0x1faf9, 0x1faff, 0x1fb93, 0x1fb93, 0x1fbfa, 0x1ffff, 0x2a6e0, 0x2a6ff, 0x2b73a, 0x2b73f, 0x2b81e, 0x2b81f, 0x2cea2, 0x2ceaf, 0x2ebe1, 0x2ebef, 0x2ee5e, 0x2f7ff, 0x2fa1e, 0x2ffff, 0x3134b, 0x3134f, 0x323b0, 0xe0000, 0xe0002, 0xe001f, 0xe0080, 0xe00ff, 0xe01f0, 0xeffff, 0xffffe, 0xfffff, 0x10fffe, 0x10ffff, }; /* END of CR_Cn */ /* PROPERTY: 'Co': General Category */ static const OnigCodePoint CR_Co[] = { 3, 0xe000, 0xf8ff, 0xf0000, 0xffffd, 0x100000, 0x10fffd, }; /* END of CR_Co */ /* PROPERTY: 'Common': Script */ static const OnigCodePoint CR_Common[] = { 174, 0x0000, 0x0040, 0x005b, 0x0060, 0x007b, 0x00a9, 0x00ab, 0x00b9, 0x00bb, 0x00bf, 0x00d7, 0x00d7, 0x00f7, 0x00f7, 0x02b9, 0x02df, 0x02e5, 0x02e9, 0x02ec, 0x02ff, 0x0374, 0x0374, 0x037e, 0x037e, 0x0385, 0x0385, 0x0387, 0x0387, 0x0605, 0x0605, 0x060c, 0x060c, 0x061b, 0x061b, 0x061f, 0x061f, 0x0640, 0x0640, 0x06dd, 0x06dd, 0x08e2, 0x08e2, 0x0964, 0x0965, 0x0e3f, 0x0e3f, 0x0fd5, 0x0fd8, 0x10fb, 0x10fb, 0x16eb, 0x16ed, 0x1735, 0x1736, 0x1802, 0x1803, 0x1805, 0x1805, 0x1cd3, 0x1cd3, 0x1ce1, 0x1ce1, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf7, 0x1cfa, 0x1cfa, 0x2000, 0x200b, 0x200e, 0x2064, 0x2066, 0x2070, 0x2074, 0x207e, 0x2080, 0x208e, 0x20a0, 0x20c0, 0x2100, 0x2125, 0x2127, 0x2129, 0x212c, 0x2131, 0x2133, 0x214d, 0x214f, 0x215f, 0x2189, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x2460, 0x27ff, 0x2900, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2bff, 0x2e00, 0x2e5d, 0x2ff0, 0x3004, 0x3006, 0x3006, 0x3008, 0x3020, 0x3030, 0x3037, 0x303c, 0x303f, 0x309b, 0x309c, 0x30a0, 0x30a0, 0x30fb, 0x30fc, 0x3190, 0x319f, 0x31c0, 0x31e5, 0x31ef, 0x31ef, 0x3220, 0x325f, 0x327f, 0x32cf, 0x32ff, 0x32ff, 0x3358, 0x33ff, 0x4dc0, 0x4dff, 0xa700, 0xa721, 0xa788, 0xa78a, 0xa830, 0xa839, 0xa92e, 0xa92e, 0xa9cf, 0xa9cf, 0xab5b, 0xab5b, 0xab6a, 0xab6b, 0xfd3e, 0xfd3f, 0xfe10, 0xfe19, 0xfe30, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xfeff, 0xfeff, 0xff01, 0xff20, 0xff3b, 0xff40, 0xff5b, 0xff65, 0xff70, 0xff70, 0xff9e, 0xff9f, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfff9, 0xfffd, 0x10100, 0x10102, 0x10107, 0x10133, 0x10137, 0x1013f, 0x10190, 0x1019c, 0x101d0, 0x101fc, 0x102e1, 0x102fb, 0x1bca0, 0x1bca3, 0x1cc00, 0x1ccf9, 0x1cd00, 0x1ceb3, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d166, 0x1d16a, 0x1d17a, 0x1d183, 0x1d184, 0x1d18c, 0x1d1a9, 0x1d1ae, 0x1d1ea, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d300, 0x1d356, 0x1d360, 0x1d378, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1ec71, 0x1ecb4, 0x1ed01, 0x1ed3d, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f100, 0x1f1ad, 0x1f1e6, 0x1f1ff, 0x1f201, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbf9, 0xe0001, 0xe0001, 0xe0020, 0xe007f, }; /* END of CR_Common */ /* PROPERTY: 'Coptic': Script */ static const OnigCodePoint CR_Coptic[] = { 3, 0x03e2, 0x03ef, 0x2c80, 0x2cf3, 0x2cf9, 0x2cff, }; /* END of CR_Coptic */ /* PROPERTY: 'Cs': General Category */ static const OnigCodePoint CR_Cs[] = { 1, 0xd800, 0xdfff, }; /* END of CR_Cs */ /* PROPERTY: 'Cuneiform': Script */ static const OnigCodePoint CR_Cuneiform[] = { 4, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12470, 0x12474, 0x12480, 0x12543, }; /* END of CR_Cuneiform */ /* PROPERTY: 'Cypriot': Script */ static const OnigCodePoint CR_Cypriot[] = { 6, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x1083f, }; /* END of CR_Cypriot */ /* PROPERTY: 'Cypro_Minoan': Script */ static const OnigCodePoint CR_Cypro_Minoan[] = { 1, 0x12f90, 0x12ff2, }; /* END of CR_Cypro_Minoan */ /* PROPERTY: 'Cyrillic': Script */ static const OnigCodePoint CR_Cyrillic[] = { 10, 0x0400, 0x0484, 0x0487, 0x052f, 0x1c80, 0x1c8a, 0x1d2b, 0x1d2b, 0x1d78, 0x1d78, 0x2de0, 0x2dff, 0xa640, 0xa69f, 0xfe2e, 0xfe2f, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, }; /* END of CR_Cyrillic */ /* PROPERTY: 'Dash': Binary Property */ static const OnigCodePoint CR_Dash[] = { 24, 0x002d, 0x002d, 0x058a, 0x058a, 0x05be, 0x05be, 0x1400, 0x1400, 0x1806, 0x1806, 0x2010, 0x2015, 0x2053, 0x2053, 0x207b, 0x207b, 0x208b, 0x208b, 0x2212, 0x2212, 0x2e17, 0x2e17, 0x2e1a, 0x2e1a, 0x2e3a, 0x2e3b, 0x2e40, 0x2e40, 0x2e5d, 0x2e5d, 0x301c, 0x301c, 0x3030, 0x3030, 0x30a0, 0x30a0, 0xfe31, 0xfe32, 0xfe58, 0xfe58, 0xfe63, 0xfe63, 0xff0d, 0xff0d, 0x10d6e, 0x10d6e, 0x10ead, 0x10ead, }; /* END of CR_Dash */ /* PROPERTY: 'Default_Ignorable_Code_Point': Derived Property */ static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = { 17, 0x00ad, 0x00ad, 0x034f, 0x034f, 0x061c, 0x061c, 0x115f, 0x1160, 0x17b4, 0x17b5, 0x180b, 0x180f, 0x200b, 0x200f, 0x202a, 0x202e, 0x2060, 0x206f, 0x3164, 0x3164, 0xfe00, 0xfe0f, 0xfeff, 0xfeff, 0xffa0, 0xffa0, 0xfff0, 0xfff8, 0x1bca0, 0x1bca3, 0x1d173, 0x1d17a, 0xe0000, 0xe0fff, }; /* END of CR_Default_Ignorable_Code_Point */ /* PROPERTY: 'Deprecated': Binary Property */ static const OnigCodePoint CR_Deprecated[] = { 8, 0x0149, 0x0149, 0x0673, 0x0673, 0x0f77, 0x0f77, 0x0f79, 0x0f79, 0x17a3, 0x17a4, 0x206a, 0x206f, 0x2329, 0x232a, 0xe0001, 0xe0001, }; /* END of CR_Deprecated */ /* PROPERTY: 'Deseret': Script */ static const OnigCodePoint CR_Deseret[] = { 1, 0x10400, 0x1044f, }; /* END of CR_Deseret */ /* PROPERTY: 'Devanagari': Script */ static const OnigCodePoint CR_Devanagari[] = { 5, 0x0900, 0x0950, 0x0955, 0x0963, 0x0966, 0x097f, 0xa8e0, 0xa8ff, 0x11b00, 0x11b09, }; /* END of CR_Devanagari */ /* PROPERTY: 'Diacritic': Binary Property */ static const OnigCodePoint CR_Diacritic[] = { 214, 0x005e, 0x005e, 0x0060, 0x0060, 0x00a8, 0x00a8, 0x00af, 0x00af, 0x00b4, 0x00b4, 0x00b7, 0x00b8, 0x02b0, 0x034e, 0x0350, 0x0357, 0x035d, 0x0362, 0x0374, 0x0375, 0x037a, 0x037a, 0x0384, 0x0385, 0x0483, 0x0487, 0x0559, 0x0559, 0x0591, 0x05a1, 0x05a3, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c4, 0x064b, 0x0652, 0x0657, 0x0658, 0x06df, 0x06e0, 0x06e5, 0x06e6, 0x06ea, 0x06ec, 0x0730, 0x074a, 0x07a6, 0x07b0, 0x07eb, 0x07f5, 0x0818, 0x0819, 0x0898, 0x089f, 0x08c9, 0x08d2, 0x08e3, 0x08fe, 0x093c, 0x093c, 0x094d, 0x094d, 0x0951, 0x0954, 0x0971, 0x0971, 0x09bc, 0x09bc, 0x09cd, 0x09cd, 0x0a3c, 0x0a3c, 0x0a4d, 0x0a4d, 0x0abc, 0x0abc, 0x0acd, 0x0acd, 0x0afd, 0x0aff, 0x0b3c, 0x0b3c, 0x0b4d, 0x0b4d, 0x0b55, 0x0b55, 0x0bcd, 0x0bcd, 0x0c3c, 0x0c3c, 0x0c4d, 0x0c4d, 0x0cbc, 0x0cbc, 0x0ccd, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0d4d, 0x0dca, 0x0dca, 0x0e3a, 0x0e3a, 0x0e47, 0x0e4c, 0x0e4e, 0x0e4e, 0x0eba, 0x0eba, 0x0ec8, 0x0ecc, 0x0f18, 0x0f19, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f3e, 0x0f3f, 0x0f82, 0x0f84, 0x0f86, 0x0f87, 0x0fc6, 0x0fc6, 0x1037, 0x1037, 0x1039, 0x103a, 0x1063, 0x1064, 0x1069, 0x106d, 0x1087, 0x108d, 0x108f, 0x108f, 0x109a, 0x109b, 0x135d, 0x135f, 0x1714, 0x1715, 0x1734, 0x1734, 0x17c9, 0x17d3, 0x17dd, 0x17dd, 0x1939, 0x193b, 0x1a60, 0x1a60, 0x1a75, 0x1a7c, 0x1a7f, 0x1a7f, 0x1ab0, 0x1abe, 0x1ac1, 0x1acb, 0x1b34, 0x1b34, 0x1b44, 0x1b44, 0x1b6b, 0x1b73, 0x1baa, 0x1bab, 0x1be6, 0x1be6, 0x1bf2, 0x1bf3, 0x1c36, 0x1c37, 0x1c78, 0x1c7d, 0x1cd0, 0x1ce8, 0x1ced, 0x1ced, 0x1cf4, 0x1cf4, 0x1cf7, 0x1cf9, 0x1d2c, 0x1d6a, 0x1dc4, 0x1dcf, 0x1df5, 0x1dff, 0x1fbd, 0x1fbd, 0x1fbf, 0x1fc1, 0x1fcd, 0x1fcf, 0x1fdd, 0x1fdf, 0x1fed, 0x1fef, 0x1ffd, 0x1ffe, 0x2cef, 0x2cf1, 0x2e2f, 0x2e2f, 0x302a, 0x302f, 0x3099, 0x309c, 0x30fc, 0x30fc, 0xa66f, 0xa66f, 0xa67c, 0xa67d, 0xa67f, 0xa67f, 0xa69c, 0xa69d, 0xa6f0, 0xa6f1, 0xa700, 0xa721, 0xa788, 0xa78a, 0xa7f8, 0xa7f9, 0xa806, 0xa806, 0xa82c, 0xa82c, 0xa8c4, 0xa8c4, 0xa8e0, 0xa8f1, 0xa92b, 0xa92e, 0xa953, 0xa953, 0xa9b3, 0xa9b3, 0xa9c0, 0xa9c0, 0xa9e5, 0xa9e5, 0xaa7b, 0xaa7d, 0xaabf, 0xaac2, 0xaaf6, 0xaaf6, 0xab5b, 0xab5f, 0xab69, 0xab6b, 0xabec, 0xabed, 0xfb1e, 0xfb1e, 0xfe20, 0xfe2f, 0xff3e, 0xff3e, 0xff40, 0xff40, 0xff70, 0xff70, 0xff9e, 0xff9f, 0xffe3, 0xffe3, 0x102e0, 0x102e0, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10ae5, 0x10ae6, 0x10d22, 0x10d27, 0x10d4e, 0x10d4e, 0x10d69, 0x10d6d, 0x10efd, 0x10eff, 0x10f46, 0x10f50, 0x10f82, 0x10f85, 0x11046, 0x11046, 0x11070, 0x11070, 0x110b9, 0x110ba, 0x11133, 0x11134, 0x11173, 0x11173, 0x111c0, 0x111c0, 0x111ca, 0x111cc, 0x11235, 0x11236, 0x112e9, 0x112ea, 0x1133b, 0x1133c, 0x1134d, 0x1134d, 0x11366, 0x1136c, 0x11370, 0x11374, 0x113ce, 0x113d0, 0x113d2, 0x113d3, 0x113e1, 0x113e2, 0x11442, 0x11442, 0x11446, 0x11446, 0x114c2, 0x114c3, 0x115bf, 0x115c0, 0x1163f, 0x1163f, 0x116b6, 0x116b7, 0x1172b, 0x1172b, 0x11839, 0x1183a, 0x1193d, 0x1193e, 0x11943, 0x11943, 0x119e0, 0x119e0, 0x11a34, 0x11a34, 0x11a47, 0x11a47, 0x11a99, 0x11a99, 0x11c3f, 0x11c3f, 0x11d42, 0x11d42, 0x11d44, 0x11d45, 0x11d97, 0x11d97, 0x11f41, 0x11f42, 0x11f5a, 0x11f5a, 0x13447, 0x13455, 0x1612f, 0x1612f, 0x16af0, 0x16af4, 0x16b30, 0x16b36, 0x16d6b, 0x16d6c, 0x16f8f, 0x16f9f, 0x16ff0, 0x16ff1, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d167, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1e030, 0x1e06d, 0x1e130, 0x1e136, 0x1e2ae, 0x1e2ae, 0x1e2ec, 0x1e2ef, 0x1e5ee, 0x1e5ef, 0x1e8d0, 0x1e8d6, 0x1e944, 0x1e946, 0x1e948, 0x1e94a, }; /* END of CR_Diacritic */ /* PROPERTY: 'Dives_Akuru': Script */ static const OnigCodePoint CR_Dives_Akuru[] = { 8, 0x11900, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11946, 0x11950, 0x11959, }; /* END of CR_Dives_Akuru */ /* PROPERTY: 'Dogra': Script */ static const OnigCodePoint CR_Dogra[] = { 1, 0x11800, 0x1183b, }; /* END of CR_Dogra */ /* PROPERTY: 'Duployan': Script */ static const OnigCodePoint CR_Duployan[] = { 5, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9c, 0x1bc9f, }; /* END of CR_Duployan */ /* PROPERTY: 'Egyptian_Hieroglyphs': Script */ static const OnigCodePoint CR_Egyptian_Hieroglyphs[] = { 2, 0x13000, 0x13455, 0x13460, 0x143fa, }; /* END of CR_Egyptian_Hieroglyphs */ /* PROPERTY: 'Elbasan': Script */ static const OnigCodePoint CR_Elbasan[] = { 1, 0x10500, 0x10527, }; /* END of CR_Elbasan */ /* PROPERTY: 'Elymaic': Script */ static const OnigCodePoint CR_Elymaic[] = { 1, 0x10fe0, 0x10ff6, }; /* END of CR_Elymaic */ /* PROPERTY: 'Emoji': Emoji Property */ static const OnigCodePoint CR_Emoji[] = { 150, 0x0023, 0x0023, 0x002a, 0x002a, 0x0030, 0x0039, 0x00a9, 0x00a9, 0x00ae, 0x00ae, 0x203c, 0x203c, 0x2049, 0x2049, 0x2122, 0x2122, 0x2139, 0x2139, 0x2194, 0x2199, 0x21a9, 0x21aa, 0x231a, 0x231b, 0x2328, 0x2328, 0x23cf, 0x23cf, 0x23e9, 0x23f3, 0x23f8, 0x23fa, 0x24c2, 0x24c2, 0x25aa, 0x25ab, 0x25b6, 0x25b6, 0x25c0, 0x25c0, 0x25fb, 0x25fe, 0x2600, 0x2604, 0x260e, 0x260e, 0x2611, 0x2611, 0x2614, 0x2615, 0x2618, 0x2618, 0x261d, 0x261d, 0x2620, 0x2620, 0x2622, 0x2623, 0x2626, 0x2626, 0x262a, 0x262a, 0x262e, 0x262f, 0x2638, 0x263a, 0x2640, 0x2640, 0x2642, 0x2642, 0x2648, 0x2653, 0x265f, 0x2660, 0x2663, 0x2663, 0x2665, 0x2666, 0x2668, 0x2668, 0x267b, 0x267b, 0x267e, 0x267f, 0x2692, 0x2697, 0x2699, 0x2699, 0x269b, 0x269c, 0x26a0, 0x26a1, 0x26a7, 0x26a7, 0x26aa, 0x26ab, 0x26b0, 0x26b1, 0x26bd, 0x26be, 0x26c4, 0x26c5, 0x26c8, 0x26c8, 0x26ce, 0x26cf, 0x26d1, 0x26d1, 0x26d3, 0x26d4, 0x26e9, 0x26ea, 0x26f0, 0x26f5, 0x26f7, 0x26fa, 0x26fd, 0x26fd, 0x2702, 0x2702, 0x2705, 0x2705, 0x2708, 0x270d, 0x270f, 0x270f, 0x2712, 0x2712, 0x2714, 0x2714, 0x2716, 0x2716, 0x271d, 0x271d, 0x2721, 0x2721, 0x2728, 0x2728, 0x2733, 0x2734, 0x2744, 0x2744, 0x2747, 0x2747, 0x274c, 0x274c, 0x274e, 0x274e, 0x2753, 0x2755, 0x2757, 0x2757, 0x2763, 0x2764, 0x2795, 0x2797, 0x27a1, 0x27a1, 0x27b0, 0x27b0, 0x27bf, 0x27bf, 0x2934, 0x2935, 0x2b05, 0x2b07, 0x2b1b, 0x2b1c, 0x2b50, 0x2b50, 0x2b55, 0x2b55, 0x3030, 0x3030, 0x303d, 0x303d, 0x3297, 0x3297, 0x3299, 0x3299, 0x1f004, 0x1f004, 0x1f0cf, 0x1f0cf, 0x1f170, 0x1f171, 0x1f17e, 0x1f17f, 0x1f18e, 0x1f18e, 0x1f191, 0x1f19a, 0x1f1e6, 0x1f1ff, 0x1f201, 0x1f202, 0x1f21a, 0x1f21a, 0x1f22f, 0x1f22f, 0x1f232, 0x1f23a, 0x1f250, 0x1f251, 0x1f300, 0x1f321, 0x1f324, 0x1f393, 0x1f396, 0x1f397, 0x1f399, 0x1f39b, 0x1f39e, 0x1f3f0, 0x1f3f3, 0x1f3f5, 0x1f3f7, 0x1f4fd, 0x1f4ff, 0x1f53d, 0x1f549, 0x1f54e, 0x1f550, 0x1f567, 0x1f56f, 0x1f570, 0x1f573, 0x1f57a, 0x1f587, 0x1f587, 0x1f58a, 0x1f58d, 0x1f590, 0x1f590, 0x1f595, 0x1f596, 0x1f5a4, 0x1f5a5, 0x1f5a8, 0x1f5a8, 0x1f5b1, 0x1f5b2, 0x1f5bc, 0x1f5bc, 0x1f5c2, 0x1f5c4, 0x1f5d1, 0x1f5d3, 0x1f5dc, 0x1f5de, 0x1f5e1, 0x1f5e1, 0x1f5e3, 0x1f5e3, 0x1f5e8, 0x1f5e8, 0x1f5ef, 0x1f5ef, 0x1f5f3, 0x1f5f3, 0x1f5fa, 0x1f64f, 0x1f680, 0x1f6c5, 0x1f6cb, 0x1f6d2, 0x1f6d5, 0x1f6d7, 0x1f6dc, 0x1f6e5, 0x1f6e9, 0x1f6e9, 0x1f6eb, 0x1f6ec, 0x1f6f0, 0x1f6f0, 0x1f6f3, 0x1f6fc, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f90c, 0x1f93a, 0x1f93c, 0x1f945, 0x1f947, 0x1f9ff, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, }; /* END of CR_Emoji */ /* PROPERTY: 'Emoji_Component': Emoji Property */ static const OnigCodePoint CR_Emoji_Component[] = { 10, 0x0023, 0x0023, 0x002a, 0x002a, 0x0030, 0x0039, 0x200d, 0x200d, 0x20e3, 0x20e3, 0xfe0f, 0xfe0f, 0x1f1e6, 0x1f1ff, 0x1f3fb, 0x1f3ff, 0x1f9b0, 0x1f9b3, 0xe0020, 0xe007f, }; /* END of CR_Emoji_Component */ /* PROPERTY: 'Emoji_Modifier': Emoji Property */ static const OnigCodePoint CR_Emoji_Modifier[] = { 1, 0x1f3fb, 0x1f3ff, }; /* END of CR_Emoji_Modifier */ /* PROPERTY: 'Emoji_Modifier_Base': Emoji Property */ static const OnigCodePoint CR_Emoji_Modifier_Base[] = { 40, 0x261d, 0x261d, 0x26f9, 0x26f9, 0x270a, 0x270d, 0x1f385, 0x1f385, 0x1f3c2, 0x1f3c4, 0x1f3c7, 0x1f3c7, 0x1f3ca, 0x1f3cc, 0x1f442, 0x1f443, 0x1f446, 0x1f450, 0x1f466, 0x1f478, 0x1f47c, 0x1f47c, 0x1f481, 0x1f483, 0x1f485, 0x1f487, 0x1f48f, 0x1f48f, 0x1f491, 0x1f491, 0x1f4aa, 0x1f4aa, 0x1f574, 0x1f575, 0x1f57a, 0x1f57a, 0x1f590, 0x1f590, 0x1f595, 0x1f596, 0x1f645, 0x1f647, 0x1f64b, 0x1f64f, 0x1f6a3, 0x1f6a3, 0x1f6b4, 0x1f6b6, 0x1f6c0, 0x1f6c0, 0x1f6cc, 0x1f6cc, 0x1f90c, 0x1f90c, 0x1f90f, 0x1f90f, 0x1f918, 0x1f91f, 0x1f926, 0x1f926, 0x1f930, 0x1f939, 0x1f93c, 0x1f93e, 0x1f977, 0x1f977, 0x1f9b5, 0x1f9b6, 0x1f9b8, 0x1f9b9, 0x1f9bb, 0x1f9bb, 0x1f9cd, 0x1f9cf, 0x1f9d1, 0x1f9dd, 0x1fac3, 0x1fac5, 0x1faf0, 0x1faf8, }; /* END of CR_Emoji_Modifier_Base */ /* PROPERTY: 'Emoji_Presentation': Emoji Property */ static const OnigCodePoint CR_Emoji_Presentation[] = { 80, 0x231a, 0x231b, 0x23e9, 0x23ec, 0x23f0, 0x23f0, 0x23f3, 0x23f3, 0x25fd, 0x25fe, 0x2614, 0x2615, 0x2648, 0x2653, 0x267f, 0x267f, 0x2693, 0x2693, 0x26a1, 0x26a1, 0x26aa, 0x26ab, 0x26bd, 0x26be, 0x26c4, 0x26c5, 0x26ce, 0x26ce, 0x26d4, 0x26d4, 0x26ea, 0x26ea, 0x26f2, 0x26f3, 0x26f5, 0x26f5, 0x26fa, 0x26fa, 0x26fd, 0x26fd, 0x2705, 0x2705, 0x270a, 0x270b, 0x2728, 0x2728, 0x274c, 0x274c, 0x274e, 0x274e, 0x2753, 0x2755, 0x2757, 0x2757, 0x2795, 0x2797, 0x27b0, 0x27b0, 0x27bf, 0x27bf, 0x2b1b, 0x2b1c, 0x2b50, 0x2b50, 0x2b55, 0x2b55, 0x1f004, 0x1f004, 0x1f0cf, 0x1f0cf, 0x1f18e, 0x1f18e, 0x1f191, 0x1f19a, 0x1f1e6, 0x1f1ff, 0x1f201, 0x1f201, 0x1f21a, 0x1f21a, 0x1f22f, 0x1f22f, 0x1f232, 0x1f236, 0x1f238, 0x1f23a, 0x1f250, 0x1f251, 0x1f300, 0x1f320, 0x1f32d, 0x1f335, 0x1f337, 0x1f37c, 0x1f37e, 0x1f393, 0x1f3a0, 0x1f3ca, 0x1f3cf, 0x1f3d3, 0x1f3e0, 0x1f3f0, 0x1f3f4, 0x1f3f4, 0x1f3f8, 0x1f43e, 0x1f440, 0x1f440, 0x1f442, 0x1f4fc, 0x1f4ff, 0x1f53d, 0x1f54b, 0x1f54e, 0x1f550, 0x1f567, 0x1f57a, 0x1f57a, 0x1f595, 0x1f596, 0x1f5a4, 0x1f5a4, 0x1f5fb, 0x1f64f, 0x1f680, 0x1f6c5, 0x1f6cc, 0x1f6cc, 0x1f6d0, 0x1f6d2, 0x1f6d5, 0x1f6d7, 0x1f6dc, 0x1f6df, 0x1f6eb, 0x1f6ec, 0x1f6f4, 0x1f6fc, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f90c, 0x1f93a, 0x1f93c, 0x1f945, 0x1f947, 0x1f9ff, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, }; /* END of CR_Emoji_Presentation */ /* PROPERTY: 'Ethiopic': Script */ static const OnigCodePoint CR_Ethiopic[] = { 36, 0x1200, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x137c, 0x1380, 0x1399, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, }; /* END of CR_Ethiopic */ /* PROPERTY: 'Extended_Pictographic': Emoji Property */ static const OnigCodePoint CR_Extended_Pictographic[] = { 78, 0x00a9, 0x00a9, 0x00ae, 0x00ae, 0x203c, 0x203c, 0x2049, 0x2049, 0x2122, 0x2122, 0x2139, 0x2139, 0x2194, 0x2199, 0x21a9, 0x21aa, 0x231a, 0x231b, 0x2328, 0x2328, 0x2388, 0x2388, 0x23cf, 0x23cf, 0x23e9, 0x23f3, 0x23f8, 0x23fa, 0x24c2, 0x24c2, 0x25aa, 0x25ab, 0x25b6, 0x25b6, 0x25c0, 0x25c0, 0x25fb, 0x25fe, 0x2600, 0x2605, 0x2607, 0x2612, 0x2614, 0x2685, 0x2690, 0x2705, 0x2708, 0x2712, 0x2714, 0x2714, 0x2716, 0x2716, 0x271d, 0x271d, 0x2721, 0x2721, 0x2728, 0x2728, 0x2733, 0x2734, 0x2744, 0x2744, 0x2747, 0x2747, 0x274c, 0x274c, 0x274e, 0x274e, 0x2753, 0x2755, 0x2757, 0x2757, 0x2763, 0x2767, 0x2795, 0x2797, 0x27a1, 0x27a1, 0x27b0, 0x27b0, 0x27bf, 0x27bf, 0x2934, 0x2935, 0x2b05, 0x2b07, 0x2b1b, 0x2b1c, 0x2b50, 0x2b50, 0x2b55, 0x2b55, 0x3030, 0x3030, 0x303d, 0x303d, 0x3297, 0x3297, 0x3299, 0x3299, 0x1f000, 0x1f0ff, 0x1f10d, 0x1f10f, 0x1f12f, 0x1f12f, 0x1f16c, 0x1f171, 0x1f17e, 0x1f17f, 0x1f18e, 0x1f18e, 0x1f191, 0x1f19a, 0x1f1ad, 0x1f1e5, 0x1f201, 0x1f20f, 0x1f21a, 0x1f21a, 0x1f22f, 0x1f22f, 0x1f232, 0x1f23a, 0x1f23c, 0x1f23f, 0x1f249, 0x1f3fa, 0x1f400, 0x1f53d, 0x1f546, 0x1f64f, 0x1f680, 0x1f6ff, 0x1f774, 0x1f77f, 0x1f7d5, 0x1f7ff, 0x1f80c, 0x1f80f, 0x1f848, 0x1f84f, 0x1f85a, 0x1f85f, 0x1f888, 0x1f88f, 0x1f8ae, 0x1f8ff, 0x1f90c, 0x1f93a, 0x1f93c, 0x1f945, 0x1f947, 0x1faff, 0x1fc00, 0x1fffd, }; /* END of CR_Extended_Pictographic */ /* PROPERTY: 'Extender': Binary Property */ static const OnigCodePoint CR_Extender[] = { 41, 0x00b7, 0x00b7, 0x02d0, 0x02d1, 0x0640, 0x0640, 0x07fa, 0x07fa, 0x0a71, 0x0a71, 0x0afb, 0x0afb, 0x0b55, 0x0b55, 0x0e46, 0x0e46, 0x0ec6, 0x0ec6, 0x180a, 0x180a, 0x1843, 0x1843, 0x1aa7, 0x1aa7, 0x1c36, 0x1c36, 0x1c7b, 0x1c7b, 0x3005, 0x3005, 0x3031, 0x3035, 0x309d, 0x309e, 0x30fc, 0x30fe, 0xa015, 0xa015, 0xa60c, 0xa60c, 0xa9cf, 0xa9cf, 0xa9e6, 0xa9e6, 0xaa70, 0xaa70, 0xaadd, 0xaadd, 0xaaf3, 0xaaf4, 0xff70, 0xff70, 0x10781, 0x10782, 0x10d4e, 0x10d4e, 0x10d6a, 0x10d6a, 0x10d6f, 0x10d6f, 0x11237, 0x11237, 0x1135d, 0x1135d, 0x113d2, 0x113d3, 0x115c6, 0x115c8, 0x11a98, 0x11a98, 0x16b42, 0x16b43, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x1e13c, 0x1e13d, 0x1e5ef, 0x1e5ef, 0x1e944, 0x1e946, }; /* END of CR_Extender */ /* PROPERTY: 'Garay': Script */ static const OnigCodePoint CR_Garay[] = { 3, 0x10d40, 0x10d65, 0x10d69, 0x10d85, 0x10d8e, 0x10d8f, }; /* END of CR_Garay */ /* PROPERTY: 'Georgian': Script */ static const OnigCodePoint CR_Georgian[] = { 10, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x10ff, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, }; /* END of CR_Georgian */ /* PROPERTY: 'Glagolitic': Script */ static const OnigCodePoint CR_Glagolitic[] = { 6, 0x2c00, 0x2c5f, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, }; /* END of CR_Glagolitic */ /* PROPERTY: 'Gothic': Script */ static const OnigCodePoint CR_Gothic[] = { 1, 0x10330, 0x1034a, }; /* END of CR_Gothic */ /* PROPERTY: 'Grantha': Script */ static const OnigCodePoint CR_Grantha[] = { 15, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133c, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, }; /* END of CR_Grantha */ /* PROPERTY: 'Grapheme_Base': Derived Property */ static const OnigCodePoint CR_Grapheme_Base[] = { 894, 0x0020, 0x007e, 0x00a0, 0x00ac, 0x00ae, 0x02ff, 0x0370, 0x0377, 0x037a, 0x037f, 0x0384, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x0482, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x058a, 0x058d, 0x058f, 0x05be, 0x05be, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05c6, 0x05c6, 0x05d0, 0x05ea, 0x05ef, 0x05f4, 0x0606, 0x060f, 0x061b, 0x061b, 0x061d, 0x064a, 0x0660, 0x066f, 0x0671, 0x06d5, 0x06de, 0x06de, 0x06e5, 0x06e6, 0x06e9, 0x06e9, 0x06ee, 0x070d, 0x0710, 0x0710, 0x0712, 0x072f, 0x074d, 0x07a5, 0x07b1, 0x07b1, 0x07c0, 0x07ea, 0x07f4, 0x07fa, 0x07fe, 0x0815, 0x081a, 0x081a, 0x0824, 0x0824, 0x0828, 0x0828, 0x0830, 0x083e, 0x0840, 0x0858, 0x085e, 0x085e, 0x0860, 0x086a, 0x0870, 0x088e, 0x08a0, 0x08c9, 0x0903, 0x0939, 0x093b, 0x093b, 0x093d, 0x0940, 0x0949, 0x094c, 0x094e, 0x0950, 0x0958, 0x0961, 0x0964, 0x0980, 0x0982, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09bd, 0x09bf, 0x09c0, 0x09c7, 0x09c8, 0x09cb, 0x09cc, 0x09ce, 0x09ce, 0x09dc, 0x09dd, 0x09df, 0x09e1, 0x09e6, 0x09fd, 0x0a03, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3e, 0x0a40, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a6f, 0x0a72, 0x0a74, 0x0a76, 0x0a76, 0x0a83, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0ac0, 0x0ac9, 0x0ac9, 0x0acb, 0x0acc, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae1, 0x0ae6, 0x0af1, 0x0af9, 0x0af9, 0x0b02, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b3d, 0x0b40, 0x0b40, 0x0b47, 0x0b48, 0x0b4b, 0x0b4c, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b61, 0x0b66, 0x0b77, 0x0b83, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbf, 0x0bbf, 0x0bc1, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcc, 0x0bd0, 0x0bd0, 0x0be6, 0x0bfa, 0x0c01, 0x0c03, 0x0c05, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c3d, 0x0c41, 0x0c44, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c61, 0x0c66, 0x0c6f, 0x0c77, 0x0c80, 0x0c82, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cbe, 0x0cc1, 0x0cc1, 0x0cc3, 0x0cc4, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce1, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d02, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d3d, 0x0d3f, 0x0d40, 0x0d46, 0x0d48, 0x0d4a, 0x0d4c, 0x0d4e, 0x0d4f, 0x0d54, 0x0d56, 0x0d58, 0x0d61, 0x0d66, 0x0d7f, 0x0d82, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dd0, 0x0dd1, 0x0dd8, 0x0dde, 0x0de6, 0x0def, 0x0df2, 0x0df4, 0x0e01, 0x0e30, 0x0e32, 0x0e33, 0x0e3f, 0x0e46, 0x0e4f, 0x0e5b, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb0, 0x0eb2, 0x0eb3, 0x0ebd, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f17, 0x0f1a, 0x0f34, 0x0f36, 0x0f36, 0x0f38, 0x0f38, 0x0f3a, 0x0f47, 0x0f49, 0x0f6c, 0x0f7f, 0x0f7f, 0x0f85, 0x0f85, 0x0f88, 0x0f8c, 0x0fbe, 0x0fc5, 0x0fc7, 0x0fcc, 0x0fce, 0x0fda, 0x1000, 0x102c, 0x1031, 0x1031, 0x1038, 0x1038, 0x103b, 0x103c, 0x103f, 0x1057, 0x105a, 0x105d, 0x1061, 0x1070, 0x1075, 0x1081, 0x1083, 0x1084, 0x1087, 0x108c, 0x108e, 0x109c, 0x109e, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1360, 0x137c, 0x1380, 0x1399, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1400, 0x169c, 0x16a0, 0x16f8, 0x1700, 0x1711, 0x171f, 0x1731, 0x1735, 0x1736, 0x1740, 0x1751, 0x1760, 0x176c, 0x176e, 0x1770, 0x1780, 0x17b3, 0x17b6, 0x17b6, 0x17be, 0x17c5, 0x17c7, 0x17c8, 0x17d4, 0x17dc, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x1800, 0x180a, 0x1810, 0x1819, 0x1820, 0x1878, 0x1880, 0x1884, 0x1887, 0x18a8, 0x18aa, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1923, 0x1926, 0x1929, 0x192b, 0x1930, 0x1931, 0x1933, 0x1938, 0x1940, 0x1940, 0x1944, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x19de, 0x1a16, 0x1a19, 0x1a1a, 0x1a1e, 0x1a55, 0x1a57, 0x1a57, 0x1a61, 0x1a61, 0x1a63, 0x1a64, 0x1a6d, 0x1a72, 0x1a80, 0x1a89, 0x1a90, 0x1a99, 0x1aa0, 0x1aad, 0x1b04, 0x1b33, 0x1b3e, 0x1b41, 0x1b45, 0x1b4c, 0x1b4e, 0x1b6a, 0x1b74, 0x1b7f, 0x1b82, 0x1ba1, 0x1ba6, 0x1ba7, 0x1bae, 0x1be5, 0x1be7, 0x1be7, 0x1bea, 0x1bec, 0x1bee, 0x1bee, 0x1bfc, 0x1c2b, 0x1c34, 0x1c35, 0x1c3b, 0x1c49, 0x1c4d, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cc7, 0x1cd3, 0x1cd3, 0x1ce1, 0x1ce1, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf7, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fc4, 0x1fc6, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fdd, 0x1fef, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffe, 0x2000, 0x200a, 0x2010, 0x2027, 0x202f, 0x205f, 0x2070, 0x2071, 0x2074, 0x208e, 0x2090, 0x209c, 0x20a0, 0x20c0, 0x2100, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x2460, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2cee, 0x2cf2, 0x2cf3, 0x2cf9, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d70, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2e00, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x3029, 0x3030, 0x303f, 0x3041, 0x3096, 0x309b, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x3190, 0x31e5, 0x31ef, 0x321e, 0x3220, 0xa48c, 0xa490, 0xa4c6, 0xa4d0, 0xa62b, 0xa640, 0xa66e, 0xa673, 0xa673, 0xa67e, 0xa69d, 0xa6a0, 0xa6ef, 0xa6f2, 0xa6f7, 0xa700, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa801, 0xa803, 0xa805, 0xa807, 0xa80a, 0xa80c, 0xa824, 0xa827, 0xa82b, 0xa830, 0xa839, 0xa840, 0xa877, 0xa880, 0xa8c3, 0xa8ce, 0xa8d9, 0xa8f2, 0xa8fe, 0xa900, 0xa925, 0xa92e, 0xa946, 0xa952, 0xa952, 0xa95f, 0xa97c, 0xa983, 0xa9b2, 0xa9b4, 0xa9b5, 0xa9ba, 0xa9bb, 0xa9be, 0xa9bf, 0xa9c1, 0xa9cd, 0xa9cf, 0xa9d9, 0xa9de, 0xa9e4, 0xa9e6, 0xa9fe, 0xaa00, 0xaa28, 0xaa2f, 0xaa30, 0xaa33, 0xaa34, 0xaa40, 0xaa42, 0xaa44, 0xaa4b, 0xaa4d, 0xaa4d, 0xaa50, 0xaa59, 0xaa5c, 0xaa7b, 0xaa7d, 0xaaaf, 0xaab1, 0xaab1, 0xaab5, 0xaab6, 0xaab9, 0xaabd, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaaeb, 0xaaee, 0xaaf5, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab6b, 0xab70, 0xabe4, 0xabe6, 0xabe7, 0xabe9, 0xabec, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb1d, 0xfb1f, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbc2, 0xfbd3, 0xfd8f, 0xfd92, 0xfdc7, 0xfdcf, 0xfdcf, 0xfdf0, 0xfdff, 0xfe10, 0xfe19, 0xfe30, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff01, 0xff9d, 0xffa0, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfffc, 0xfffd, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10100, 0x10102, 0x10107, 0x10133, 0x10137, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fc, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e1, 0x102fb, 0x10300, 0x10323, 0x1032d, 0x1034a, 0x10350, 0x10375, 0x10380, 0x1039d, 0x1039f, 0x103c3, 0x103c8, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x1056f, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10857, 0x1089e, 0x108a7, 0x108af, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x108fb, 0x1091b, 0x1091f, 0x10939, 0x1093f, 0x1093f, 0x10980, 0x109b7, 0x109bc, 0x109cf, 0x109d2, 0x10a00, 0x10a10, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a40, 0x10a48, 0x10a50, 0x10a58, 0x10a60, 0x10a9f, 0x10ac0, 0x10ae4, 0x10aeb, 0x10af6, 0x10b00, 0x10b35, 0x10b39, 0x10b55, 0x10b58, 0x10b72, 0x10b78, 0x10b91, 0x10b99, 0x10b9c, 0x10ba9, 0x10baf, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10cfa, 0x10d23, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d6e, 0x10d85, 0x10d8e, 0x10d8f, 0x10e60, 0x10e7e, 0x10e80, 0x10ea9, 0x10ead, 0x10ead, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10f00, 0x10f27, 0x10f30, 0x10f45, 0x10f51, 0x10f59, 0x10f70, 0x10f81, 0x10f86, 0x10f89, 0x10fb0, 0x10fcb, 0x10fe0, 0x10ff6, 0x11000, 0x11000, 0x11002, 0x11037, 0x11047, 0x1104d, 0x11052, 0x1106f, 0x11071, 0x11072, 0x11075, 0x11075, 0x11082, 0x110b2, 0x110b7, 0x110b8, 0x110bb, 0x110bc, 0x110be, 0x110c1, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11103, 0x11126, 0x1112c, 0x1112c, 0x11136, 0x11147, 0x11150, 0x11172, 0x11174, 0x11176, 0x11182, 0x111b5, 0x111bf, 0x111bf, 0x111c1, 0x111c8, 0x111cd, 0x111ce, 0x111d0, 0x111df, 0x111e1, 0x111f4, 0x11200, 0x11211, 0x11213, 0x1122e, 0x11232, 0x11233, 0x11238, 0x1123d, 0x1123f, 0x11240, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a9, 0x112b0, 0x112de, 0x112e0, 0x112e2, 0x112f0, 0x112f9, 0x11302, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x1133d, 0x1133f, 0x1133f, 0x11341, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134c, 0x11350, 0x11350, 0x1135d, 0x11363, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113b7, 0x113b9, 0x113ba, 0x113ca, 0x113ca, 0x113cc, 0x113cd, 0x113d1, 0x113d1, 0x113d3, 0x113d5, 0x113d7, 0x113d8, 0x11400, 0x11437, 0x11440, 0x11441, 0x11445, 0x11445, 0x11447, 0x1145b, 0x1145d, 0x1145d, 0x1145f, 0x11461, 0x11480, 0x114af, 0x114b1, 0x114b2, 0x114b9, 0x114b9, 0x114bb, 0x114bc, 0x114be, 0x114be, 0x114c1, 0x114c1, 0x114c4, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115ae, 0x115b0, 0x115b1, 0x115b8, 0x115bb, 0x115be, 0x115be, 0x115c1, 0x115db, 0x11600, 0x11632, 0x1163b, 0x1163c, 0x1163e, 0x1163e, 0x11641, 0x11644, 0x11650, 0x11659, 0x11660, 0x1166c, 0x11680, 0x116aa, 0x116ac, 0x116ac, 0x116ae, 0x116af, 0x116b8, 0x116b9, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171e, 0x1171e, 0x11720, 0x11721, 0x11726, 0x11726, 0x11730, 0x11746, 0x11800, 0x1182e, 0x11838, 0x11838, 0x1183b, 0x1183b, 0x118a0, 0x118f2, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x1192f, 0x11931, 0x11935, 0x11937, 0x11938, 0x1193f, 0x11942, 0x11944, 0x11946, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d3, 0x119dc, 0x119df, 0x119e1, 0x119e4, 0x11a00, 0x11a00, 0x11a0b, 0x11a32, 0x11a39, 0x11a3a, 0x11a3f, 0x11a46, 0x11a50, 0x11a50, 0x11a57, 0x11a58, 0x11a5c, 0x11a89, 0x11a97, 0x11a97, 0x11a9a, 0x11aa2, 0x11ab0, 0x11af8, 0x11b00, 0x11b09, 0x11bc0, 0x11be1, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c2f, 0x11c3e, 0x11c3e, 0x11c40, 0x11c45, 0x11c50, 0x11c6c, 0x11c70, 0x11c8f, 0x11ca9, 0x11ca9, 0x11cb1, 0x11cb1, 0x11cb4, 0x11cb4, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d30, 0x11d46, 0x11d46, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d93, 0x11d94, 0x11d96, 0x11d96, 0x11d98, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef2, 0x11ef5, 0x11ef8, 0x11f02, 0x11f10, 0x11f12, 0x11f35, 0x11f3e, 0x11f3f, 0x11f43, 0x11f59, 0x11fb0, 0x11fb0, 0x11fc0, 0x11ff1, 0x11fff, 0x12399, 0x12400, 0x1246e, 0x12470, 0x12474, 0x12480, 0x12543, 0x12f90, 0x12ff2, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1611d, 0x1612a, 0x1612c, 0x16130, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a6e, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af5, 0x16af5, 0x16b00, 0x16b2f, 0x16b37, 0x16b45, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d79, 0x16e40, 0x16e9a, 0x16f00, 0x16f4a, 0x16f50, 0x16f87, 0x16f93, 0x16f9f, 0x16fe0, 0x16fe3, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9c, 0x1bc9c, 0x1bc9f, 0x1bc9f, 0x1cc00, 0x1ccf9, 0x1cd00, 0x1ceb3, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d164, 0x1d16a, 0x1d16c, 0x1d183, 0x1d184, 0x1d18c, 0x1d1a9, 0x1d1ae, 0x1d1ea, 0x1d200, 0x1d241, 0x1d245, 0x1d245, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d300, 0x1d356, 0x1d360, 0x1d378, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1d9ff, 0x1da37, 0x1da3a, 0x1da6d, 0x1da74, 0x1da76, 0x1da83, 0x1da85, 0x1da8b, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e030, 0x1e06d, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14f, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e2f0, 0x1e2f9, 0x1e2ff, 0x1e2ff, 0x1e4d0, 0x1e4eb, 0x1e4f0, 0x1e4f9, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5fa, 0x1e5ff, 0x1e5ff, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8c7, 0x1e8cf, 0x1e900, 0x1e943, 0x1e94b, 0x1e94b, 0x1e950, 0x1e959, 0x1e95e, 0x1e95f, 0x1ec71, 0x1ecb4, 0x1ed01, 0x1ed3d, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f100, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Grapheme_Base */ /* PROPERTY: 'Grapheme_Extend': Derived Property */ static const OnigCodePoint CR_Grapheme_Extend[] = { 375, 0x0300, 0x036f, 0x0483, 0x0489, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x0610, 0x061a, 0x064b, 0x065f, 0x0670, 0x0670, 0x06d6, 0x06dc, 0x06df, 0x06e4, 0x06e7, 0x06e8, 0x06ea, 0x06ed, 0x0711, 0x0711, 0x0730, 0x074a, 0x07a6, 0x07b0, 0x07eb, 0x07f3, 0x07fd, 0x07fd, 0x0816, 0x0819, 0x081b, 0x0823, 0x0825, 0x0827, 0x0829, 0x082d, 0x0859, 0x085b, 0x0897, 0x089f, 0x08ca, 0x08e1, 0x08e3, 0x0902, 0x093a, 0x093a, 0x093c, 0x093c, 0x0941, 0x0948, 0x094d, 0x094d, 0x0951, 0x0957, 0x0962, 0x0963, 0x0981, 0x0981, 0x09bc, 0x09bc, 0x09be, 0x09be, 0x09c1, 0x09c4, 0x09cd, 0x09cd, 0x09d7, 0x09d7, 0x09e2, 0x09e3, 0x09fe, 0x09fe, 0x0a01, 0x0a02, 0x0a3c, 0x0a3c, 0x0a41, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a70, 0x0a71, 0x0a75, 0x0a75, 0x0a81, 0x0a82, 0x0abc, 0x0abc, 0x0ac1, 0x0ac5, 0x0ac7, 0x0ac8, 0x0acd, 0x0acd, 0x0ae2, 0x0ae3, 0x0afa, 0x0aff, 0x0b01, 0x0b01, 0x0b3c, 0x0b3c, 0x0b3e, 0x0b3f, 0x0b41, 0x0b44, 0x0b4d, 0x0b4d, 0x0b55, 0x0b57, 0x0b62, 0x0b63, 0x0b82, 0x0b82, 0x0bbe, 0x0bbe, 0x0bc0, 0x0bc0, 0x0bcd, 0x0bcd, 0x0bd7, 0x0bd7, 0x0c00, 0x0c00, 0x0c04, 0x0c04, 0x0c3c, 0x0c3c, 0x0c3e, 0x0c40, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c62, 0x0c63, 0x0c81, 0x0c81, 0x0cbc, 0x0cbc, 0x0cbf, 0x0cc0, 0x0cc2, 0x0cc2, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0ce2, 0x0ce3, 0x0d00, 0x0d01, 0x0d3b, 0x0d3c, 0x0d3e, 0x0d3e, 0x0d41, 0x0d44, 0x0d4d, 0x0d4d, 0x0d57, 0x0d57, 0x0d62, 0x0d63, 0x0d81, 0x0d81, 0x0dca, 0x0dca, 0x0dcf, 0x0dcf, 0x0dd2, 0x0dd4, 0x0dd6, 0x0dd6, 0x0ddf, 0x0ddf, 0x0e31, 0x0e31, 0x0e34, 0x0e3a, 0x0e47, 0x0e4e, 0x0eb1, 0x0eb1, 0x0eb4, 0x0ebc, 0x0ec8, 0x0ece, 0x0f18, 0x0f19, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f71, 0x0f7e, 0x0f80, 0x0f84, 0x0f86, 0x0f87, 0x0f8d, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x102d, 0x1030, 0x1032, 0x1037, 0x1039, 0x103a, 0x103d, 0x103e, 0x1058, 0x1059, 0x105e, 0x1060, 0x1071, 0x1074, 0x1082, 0x1082, 0x1085, 0x1086, 0x108d, 0x108d, 0x109d, 0x109d, 0x135d, 0x135f, 0x1712, 0x1715, 0x1732, 0x1734, 0x1752, 0x1753, 0x1772, 0x1773, 0x17b4, 0x17b5, 0x17b7, 0x17bd, 0x17c6, 0x17c6, 0x17c9, 0x17d3, 0x17dd, 0x17dd, 0x180b, 0x180d, 0x180f, 0x180f, 0x1885, 0x1886, 0x18a9, 0x18a9, 0x1920, 0x1922, 0x1927, 0x1928, 0x1932, 0x1932, 0x1939, 0x193b, 0x1a17, 0x1a18, 0x1a1b, 0x1a1b, 0x1a56, 0x1a56, 0x1a58, 0x1a5e, 0x1a60, 0x1a60, 0x1a62, 0x1a62, 0x1a65, 0x1a6c, 0x1a73, 0x1a7c, 0x1a7f, 0x1a7f, 0x1ab0, 0x1ace, 0x1b00, 0x1b03, 0x1b34, 0x1b3d, 0x1b42, 0x1b44, 0x1b6b, 0x1b73, 0x1b80, 0x1b81, 0x1ba2, 0x1ba5, 0x1ba8, 0x1bad, 0x1be6, 0x1be6, 0x1be8, 0x1be9, 0x1bed, 0x1bed, 0x1bef, 0x1bf3, 0x1c2c, 0x1c33, 0x1c36, 0x1c37, 0x1cd0, 0x1cd2, 0x1cd4, 0x1ce0, 0x1ce2, 0x1ce8, 0x1ced, 0x1ced, 0x1cf4, 0x1cf4, 0x1cf8, 0x1cf9, 0x1dc0, 0x1dff, 0x200c, 0x200c, 0x20d0, 0x20f0, 0x2cef, 0x2cf1, 0x2d7f, 0x2d7f, 0x2de0, 0x2dff, 0x302a, 0x302f, 0x3099, 0x309a, 0xa66f, 0xa672, 0xa674, 0xa67d, 0xa69e, 0xa69f, 0xa6f0, 0xa6f1, 0xa802, 0xa802, 0xa806, 0xa806, 0xa80b, 0xa80b, 0xa825, 0xa826, 0xa82c, 0xa82c, 0xa8c4, 0xa8c5, 0xa8e0, 0xa8f1, 0xa8ff, 0xa8ff, 0xa926, 0xa92d, 0xa947, 0xa951, 0xa953, 0xa953, 0xa980, 0xa982, 0xa9b3, 0xa9b3, 0xa9b6, 0xa9b9, 0xa9bc, 0xa9bd, 0xa9c0, 0xa9c0, 0xa9e5, 0xa9e5, 0xaa29, 0xaa2e, 0xaa31, 0xaa32, 0xaa35, 0xaa36, 0xaa43, 0xaa43, 0xaa4c, 0xaa4c, 0xaa7c, 0xaa7c, 0xaab0, 0xaab0, 0xaab2, 0xaab4, 0xaab7, 0xaab8, 0xaabe, 0xaabf, 0xaac1, 0xaac1, 0xaaec, 0xaaed, 0xaaf6, 0xaaf6, 0xabe5, 0xabe5, 0xabe8, 0xabe8, 0xabed, 0xabed, 0xfb1e, 0xfb1e, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0xff9e, 0xff9f, 0x101fd, 0x101fd, 0x102e0, 0x102e0, 0x10376, 0x1037a, 0x10a01, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a0f, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10ae5, 0x10ae6, 0x10d24, 0x10d27, 0x10d69, 0x10d6d, 0x10eab, 0x10eac, 0x10efc, 0x10eff, 0x10f46, 0x10f50, 0x10f82, 0x10f85, 0x11001, 0x11001, 0x11038, 0x11046, 0x11070, 0x11070, 0x11073, 0x11074, 0x1107f, 0x11081, 0x110b3, 0x110b6, 0x110b9, 0x110ba, 0x110c2, 0x110c2, 0x11100, 0x11102, 0x11127, 0x1112b, 0x1112d, 0x11134, 0x11173, 0x11173, 0x11180, 0x11181, 0x111b6, 0x111be, 0x111c0, 0x111c0, 0x111c9, 0x111cc, 0x111cf, 0x111cf, 0x1122f, 0x11231, 0x11234, 0x11237, 0x1123e, 0x1123e, 0x11241, 0x11241, 0x112df, 0x112df, 0x112e3, 0x112ea, 0x11300, 0x11301, 0x1133b, 0x1133c, 0x1133e, 0x1133e, 0x11340, 0x11340, 0x1134d, 0x1134d, 0x11357, 0x11357, 0x11366, 0x1136c, 0x11370, 0x11374, 0x113b8, 0x113b8, 0x113bb, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113c9, 0x113ce, 0x113d0, 0x113d2, 0x113d2, 0x113e1, 0x113e2, 0x11438, 0x1143f, 0x11442, 0x11444, 0x11446, 0x11446, 0x1145e, 0x1145e, 0x114b0, 0x114b0, 0x114b3, 0x114b8, 0x114ba, 0x114ba, 0x114bd, 0x114bd, 0x114bf, 0x114c0, 0x114c2, 0x114c3, 0x115af, 0x115af, 0x115b2, 0x115b5, 0x115bc, 0x115bd, 0x115bf, 0x115c0, 0x115dc, 0x115dd, 0x11633, 0x1163a, 0x1163d, 0x1163d, 0x1163f, 0x11640, 0x116ab, 0x116ab, 0x116ad, 0x116ad, 0x116b0, 0x116b7, 0x1171d, 0x1171d, 0x1171f, 0x1171f, 0x11722, 0x11725, 0x11727, 0x1172b, 0x1182f, 0x11837, 0x11839, 0x1183a, 0x11930, 0x11930, 0x1193b, 0x1193e, 0x11943, 0x11943, 0x119d4, 0x119d7, 0x119da, 0x119db, 0x119e0, 0x119e0, 0x11a01, 0x11a0a, 0x11a33, 0x11a38, 0x11a3b, 0x11a3e, 0x11a47, 0x11a47, 0x11a51, 0x11a56, 0x11a59, 0x11a5b, 0x11a8a, 0x11a96, 0x11a98, 0x11a99, 0x11c30, 0x11c36, 0x11c38, 0x11c3d, 0x11c3f, 0x11c3f, 0x11c92, 0x11ca7, 0x11caa, 0x11cb0, 0x11cb2, 0x11cb3, 0x11cb5, 0x11cb6, 0x11d31, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d45, 0x11d47, 0x11d47, 0x11d90, 0x11d91, 0x11d95, 0x11d95, 0x11d97, 0x11d97, 0x11ef3, 0x11ef4, 0x11f00, 0x11f01, 0x11f36, 0x11f3a, 0x11f40, 0x11f42, 0x11f5a, 0x11f5a, 0x13440, 0x13440, 0x13447, 0x13455, 0x1611e, 0x16129, 0x1612d, 0x1612f, 0x16af0, 0x16af4, 0x16b30, 0x16b36, 0x16f4f, 0x16f4f, 0x16f8f, 0x16f92, 0x16fe4, 0x16fe4, 0x16ff0, 0x16ff1, 0x1bc9d, 0x1bc9e, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d165, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e08f, 0x1e08f, 0x1e130, 0x1e136, 0x1e2ae, 0x1e2ae, 0x1e2ec, 0x1e2ef, 0x1e4ec, 0x1e4ef, 0x1e5ee, 0x1e5ef, 0x1e8d0, 0x1e8d6, 0x1e944, 0x1e94a, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, }; /* END of CR_Grapheme_Extend */ /* PROPERTY: 'Grapheme_Link': Derived Property */ static const OnigCodePoint CR_Grapheme_Link[] = { 58, 0x094d, 0x094d, 0x09cd, 0x09cd, 0x0a4d, 0x0a4d, 0x0acd, 0x0acd, 0x0b4d, 0x0b4d, 0x0bcd, 0x0bcd, 0x0c4d, 0x0c4d, 0x0ccd, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0d4d, 0x0dca, 0x0dca, 0x0e3a, 0x0e3a, 0x0eba, 0x0eba, 0x0f84, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1715, 0x1734, 0x1734, 0x17d2, 0x17d2, 0x1a60, 0x1a60, 0x1b44, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0x2d7f, 0xa806, 0xa806, 0xa82c, 0xa82c, 0xa8c4, 0xa8c4, 0xa953, 0xa953, 0xa9c0, 0xa9c0, 0xaaf6, 0xaaf6, 0xabed, 0xabed, 0x10a3f, 0x10a3f, 0x11046, 0x11046, 0x11070, 0x11070, 0x1107f, 0x1107f, 0x110b9, 0x110b9, 0x11133, 0x11134, 0x111c0, 0x111c0, 0x11235, 0x11235, 0x112ea, 0x112ea, 0x1134d, 0x1134d, 0x113ce, 0x113d0, 0x11442, 0x11442, 0x114c2, 0x114c2, 0x115bf, 0x115bf, 0x1163f, 0x1163f, 0x116b6, 0x116b6, 0x1172b, 0x1172b, 0x11839, 0x11839, 0x1193d, 0x1193e, 0x119e0, 0x119e0, 0x11a34, 0x11a34, 0x11a47, 0x11a47, 0x11a99, 0x11a99, 0x11c3f, 0x11c3f, 0x11d44, 0x11d45, 0x11d97, 0x11d97, 0x11f41, 0x11f42, 0x1612f, 0x1612f, }; /* END of CR_Grapheme_Link */ /* PROPERTY: 'Greek': Script */ static const OnigCodePoint CR_Greek[] = { 36, 0x0370, 0x0373, 0x0375, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0384, 0x0384, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03e1, 0x03f0, 0x03ff, 0x1d26, 0x1d2a, 0x1d5d, 0x1d61, 0x1d66, 0x1d6a, 0x1dbf, 0x1dbf, 0x1f00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fc4, 0x1fc6, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fdd, 0x1fef, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffe, 0x2126, 0x2126, 0xab65, 0xab65, 0x10140, 0x1018e, 0x101a0, 0x101a0, 0x1d200, 0x1d245, }; /* END of CR_Greek */ /* PROPERTY: 'Gujarati': Script */ static const OnigCodePoint CR_Gujarati[] = { 14, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0af1, 0x0af9, 0x0aff, }; /* END of CR_Gujarati */ /* PROPERTY: 'Gunjala_Gondi': Script */ static const OnigCodePoint CR_Gunjala_Gondi[] = { 6, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, }; /* END of CR_Gunjala_Gondi */ /* PROPERTY: 'Gurmukhi': Script */ static const OnigCodePoint CR_Gurmukhi[] = { 16, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a76, }; /* END of CR_Gurmukhi */ /* PROPERTY: 'Gurung_Khema': Script */ static const OnigCodePoint CR_Gurung_Khema[] = { 1, 0x16100, 0x16139, }; /* END of CR_Gurung_Khema */ /* PROPERTY: 'Han': Script */ static const OnigCodePoint CR_Han[] = { 22, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x3005, 0x3005, 0x3007, 0x3007, 0x3021, 0x3029, 0x3038, 0x303b, 0x3400, 0x4dbf, 0x4e00, 0x9fff, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0x16fe2, 0x16fe3, 0x16ff0, 0x16ff1, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Han */ /* PROPERTY: 'Hangul': Script */ static const OnigCodePoint CR_Hangul[] = { 14, 0x1100, 0x11ff, 0x302e, 0x302f, 0x3131, 0x318e, 0x3200, 0x321e, 0x3260, 0x327e, 0xa960, 0xa97c, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xffa0, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, }; /* END of CR_Hangul */ /* PROPERTY: 'Hanifi_Rohingya': Script */ static const OnigCodePoint CR_Hanifi_Rohingya[] = { 2, 0x10d00, 0x10d27, 0x10d30, 0x10d39, }; /* END of CR_Hanifi_Rohingya */ /* PROPERTY: 'Hanunoo': Script */ static const OnigCodePoint CR_Hanunoo[] = { 1, 0x1720, 0x1734, }; /* END of CR_Hanunoo */ /* PROPERTY: 'Hatran': Script */ static const OnigCodePoint CR_Hatran[] = { 3, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x108fb, 0x108ff, }; /* END of CR_Hatran */ /* PROPERTY: 'Hebrew': Script */ static const OnigCodePoint CR_Hebrew[] = { 9, 0x0591, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f4, 0xfb1d, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfb4f, }; /* END of CR_Hebrew */ /* PROPERTY: 'Hex_Digit': Binary Property */ static const OnigCodePoint CR_Hex_Digit[] = { 6, 0x0030, 0x0039, 0x0041, 0x0046, 0x0061, 0x0066, 0xff10, 0xff19, 0xff21, 0xff26, 0xff41, 0xff46, }; /* END of CR_Hex_Digit */ /* PROPERTY: 'Hiragana': Script */ static const OnigCodePoint CR_Hiragana[] = { 6, 0x3041, 0x3096, 0x309d, 0x309f, 0x1b001, 0x1b11f, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1f200, 0x1f200, }; /* END of CR_Hiragana */ /* PROPERTY: 'Hyphen': Binary Property */ static const OnigCodePoint CR_Hyphen[] = { 10, 0x002d, 0x002d, 0x00ad, 0x00ad, 0x058a, 0x058a, 0x1806, 0x1806, 0x2010, 0x2011, 0x2e17, 0x2e17, 0x30fb, 0x30fb, 0xfe63, 0xfe63, 0xff0d, 0xff0d, 0xff65, 0xff65, }; /* END of CR_Hyphen */ /* PROPERTY: 'IDS_Binary_Operator': Binary Property */ static const OnigCodePoint CR_IDS_Binary_Operator[] = { 3, 0x2ff0, 0x2ff1, 0x2ff4, 0x2ffd, 0x31ef, 0x31ef, }; /* END of CR_IDS_Binary_Operator */ /* PROPERTY: 'IDS_Trinary_Operator': Binary Property */ static const OnigCodePoint CR_IDS_Trinary_Operator[] = { 1, 0x2ff2, 0x2ff3, }; /* END of CR_IDS_Trinary_Operator */ /* PROPERTY: 'IDS_Unary_Operator': Binary Property */ static const OnigCodePoint CR_IDS_Unary_Operator[] = { 1, 0x2ffe, 0x2fff, }; /* END of CR_IDS_Unary_Operator */ /* PROPERTY: 'ID_Compat_Math_Continue': Binary Property */ static const OnigCodePoint CR_ID_Compat_Math_Continue[] = { 18, 0x00b2, 0x00b3, 0x00b9, 0x00b9, 0x2070, 0x2070, 0x2074, 0x207e, 0x2080, 0x208e, 0x2202, 0x2202, 0x2207, 0x2207, 0x221e, 0x221e, 0x1d6c1, 0x1d6c1, 0x1d6db, 0x1d6db, 0x1d6fb, 0x1d6fb, 0x1d715, 0x1d715, 0x1d735, 0x1d735, 0x1d74f, 0x1d74f, 0x1d76f, 0x1d76f, 0x1d789, 0x1d789, 0x1d7a9, 0x1d7a9, 0x1d7c3, 0x1d7c3, }; /* END of CR_ID_Compat_Math_Continue */ /* PROPERTY: 'ID_Compat_Math_Start': Binary Property */ static const OnigCodePoint CR_ID_Compat_Math_Start[] = { 13, 0x2202, 0x2202, 0x2207, 0x2207, 0x221e, 0x221e, 0x1d6c1, 0x1d6c1, 0x1d6db, 0x1d6db, 0x1d6fb, 0x1d6fb, 0x1d715, 0x1d715, 0x1d735, 0x1d735, 0x1d74f, 0x1d74f, 0x1d76f, 0x1d76f, 0x1d789, 0x1d789, 0x1d7a9, 0x1d7a9, 0x1d7c3, 0x1d7c3, }; /* END of CR_ID_Compat_Math_Start */ /* PROPERTY: 'ID_Continue': Derived Property */ static const OnigCodePoint CR_ID_Continue[] = { 793, 0x0030, 0x0039, 0x0041, 0x005a, 0x005f, 0x005f, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00b7, 0x00b7, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0300, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x0483, 0x0487, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0669, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06df, 0x06e8, 0x06ea, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07f5, 0x07fa, 0x07fa, 0x07fd, 0x07fd, 0x0800, 0x082d, 0x0840, 0x085b, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x08e1, 0x08e3, 0x0963, 0x0966, 0x096f, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09f1, 0x09fc, 0x09fc, 0x09fe, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0aef, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b6f, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bef, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d66, 0x0d6f, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e4e, 0x0e50, 0x0e59, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f18, 0x0f19, 0x0f20, 0x0f29, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f3e, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f84, 0x0f86, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x1000, 0x1049, 0x1050, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x135f, 0x1369, 0x1371, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1734, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17d3, 0x17d7, 0x17d7, 0x17dc, 0x17dd, 0x17e0, 0x17e9, 0x180b, 0x180d, 0x180f, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1946, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa7, 0x1aa7, 0x1ab0, 0x1abd, 0x1abf, 0x1ace, 0x1b00, 0x1b4c, 0x1b50, 0x1b59, 0x1b6b, 0x1b73, 0x1b80, 0x1bf3, 0x1c00, 0x1c37, 0x1c40, 0x1c49, 0x1c4d, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1cd0, 0x1cd2, 0x1cd4, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x200c, 0x200d, 0x203f, 0x2040, 0x2054, 0x2054, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x20d0, 0x20dc, 0x20e1, 0x20e1, 0x20e5, 0x20f0, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2118, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x2c00, 0x2ce4, 0x2ceb, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x3005, 0x3007, 0x3021, 0x302f, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x3099, 0x309f, 0x30a1, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa62b, 0xa640, 0xa66f, 0xa674, 0xa67d, 0xa67f, 0xa6f1, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa827, 0xa82c, 0xa82c, 0xa840, 0xa873, 0xa880, 0xa8c5, 0xa8d0, 0xa8d9, 0xa8e0, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa92d, 0xa930, 0xa953, 0xa960, 0xa97c, 0xa980, 0xa9c0, 0xa9cf, 0xa9d9, 0xa9e0, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa60, 0xaa76, 0xaa7a, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xabec, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0xfe33, 0xfe34, 0xfe4d, 0xfe4f, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff10, 0xff19, 0xff21, 0xff3a, 0xff3f, 0xff3f, 0xff41, 0xff5a, 0xff65, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x101fd, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102e0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae6, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d6d, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f50, 0x10f70, 0x10f85, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11046, 0x11066, 0x11075, 0x1107f, 0x110ba, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x1113f, 0x11144, 0x11147, 0x11150, 0x11173, 0x11176, 0x11176, 0x11180, 0x111c4, 0x111c9, 0x111cc, 0x111ce, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d3, 0x113e1, 0x113e2, 0x11400, 0x1144a, 0x11450, 0x11459, 0x1145e, 0x11461, 0x11480, 0x114c5, 0x114c7, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115c0, 0x115d8, 0x115dd, 0x11600, 0x11640, 0x11644, 0x11644, 0x11650, 0x11659, 0x11680, 0x116b8, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11739, 0x11740, 0x11746, 0x11800, 0x1183a, 0x118a0, 0x118e9, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11943, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a3e, 0x11a47, 0x11a47, 0x11a50, 0x11a99, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c40, 0x11c50, 0x11c59, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f42, 0x11f50, 0x11f5a, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13440, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a70, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af4, 0x16b00, 0x16b36, 0x16b40, 0x16b43, 0x16b50, 0x16b59, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16d70, 0x16d79, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9d, 0x1bc9e, 0x1ccf0, 0x1ccf9, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d165, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8d0, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1fbf0, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0100, 0xe01ef, }; /* END of CR_ID_Continue */ /* PROPERTY: 'ID_Start': Derived Property */ static const OnigCodePoint CR_ID_Start[] = { 677, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0370, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0620, 0x064a, 0x066e, 0x066f, 0x0671, 0x06d3, 0x06d5, 0x06d5, 0x06e5, 0x06e6, 0x06ee, 0x06ef, 0x06fa, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x0710, 0x0712, 0x072f, 0x074d, 0x07a5, 0x07b1, 0x07b1, 0x07ca, 0x07ea, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x0800, 0x0815, 0x081a, 0x081a, 0x0824, 0x0824, 0x0828, 0x0828, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x08a0, 0x08c9, 0x0904, 0x0939, 0x093d, 0x093d, 0x0950, 0x0950, 0x0958, 0x0961, 0x0971, 0x0980, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09bd, 0x09ce, 0x09ce, 0x09dc, 0x09dd, 0x09df, 0x09e1, 0x09f0, 0x09f1, 0x09fc, 0x09fc, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a72, 0x0a74, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0abd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae1, 0x0af9, 0x0af9, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b3d, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b61, 0x0b71, 0x0b71, 0x0b83, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bd0, 0x0bd0, 0x0c05, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c3d, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c61, 0x0c80, 0x0c80, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cbd, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce1, 0x0cf1, 0x0cf2, 0x0d04, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d3d, 0x0d4e, 0x0d4e, 0x0d54, 0x0d56, 0x0d5f, 0x0d61, 0x0d7a, 0x0d7f, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0e01, 0x0e30, 0x0e32, 0x0e33, 0x0e40, 0x0e46, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb0, 0x0eb2, 0x0eb3, 0x0ebd, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f88, 0x0f8c, 0x1000, 0x102a, 0x103f, 0x103f, 0x1050, 0x1055, 0x105a, 0x105d, 0x1061, 0x1061, 0x1065, 0x1066, 0x106e, 0x1070, 0x1075, 0x1081, 0x108e, 0x108e, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1711, 0x171f, 0x1731, 0x1740, 0x1751, 0x1760, 0x176c, 0x176e, 0x1770, 0x1780, 0x17b3, 0x17d7, 0x17d7, 0x17dc, 0x17dc, 0x1820, 0x1878, 0x1880, 0x18a8, 0x18aa, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1950, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x1a00, 0x1a16, 0x1a20, 0x1a54, 0x1aa7, 0x1aa7, 0x1b05, 0x1b33, 0x1b45, 0x1b4c, 0x1b83, 0x1ba0, 0x1bae, 0x1baf, 0x1bba, 0x1be5, 0x1c00, 0x1c23, 0x1c4d, 0x1c4f, 0x1c5a, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2118, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x3005, 0x3007, 0x3021, 0x3029, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x309b, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa61f, 0xa62a, 0xa62b, 0xa640, 0xa66e, 0xa67f, 0xa69d, 0xa6a0, 0xa6ef, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa801, 0xa803, 0xa805, 0xa807, 0xa80a, 0xa80c, 0xa822, 0xa840, 0xa873, 0xa882, 0xa8b3, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa8fe, 0xa90a, 0xa925, 0xa930, 0xa946, 0xa960, 0xa97c, 0xa984, 0xa9b2, 0xa9cf, 0xa9cf, 0xa9e0, 0xa9e4, 0xa9e6, 0xa9ef, 0xa9fa, 0xa9fe, 0xaa00, 0xaa28, 0xaa40, 0xaa42, 0xaa44, 0xaa4b, 0xaa60, 0xaa76, 0xaa7a, 0xaa7a, 0xaa7e, 0xaaaf, 0xaab1, 0xaab1, 0xaab5, 0xaab6, 0xaab9, 0xaabd, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaea, 0xaaf2, 0xaaf4, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabe2, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb1d, 0xfb1f, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff21, 0xff3a, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x10375, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a00, 0x10a10, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d23, 0x10d4a, 0x10d65, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11003, 0x11037, 0x11071, 0x11072, 0x11075, 0x11075, 0x11083, 0x110af, 0x110d0, 0x110e8, 0x11103, 0x11126, 0x11144, 0x11144, 0x11147, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11183, 0x111b2, 0x111c1, 0x111c4, 0x111da, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x1122b, 0x1123f, 0x11240, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112de, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x1133d, 0x11350, 0x11350, 0x1135d, 0x11361, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113b7, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11434, 0x11447, 0x1144a, 0x1145f, 0x11461, 0x11480, 0x114af, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x11580, 0x115ae, 0x115d8, 0x115db, 0x11600, 0x1162f, 0x11644, 0x11644, 0x11680, 0x116aa, 0x116b8, 0x116b8, 0x11700, 0x1171a, 0x11740, 0x11746, 0x11800, 0x1182b, 0x118a0, 0x118df, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x1192f, 0x1193f, 0x1193f, 0x11941, 0x11941, 0x119a0, 0x119a7, 0x119aa, 0x119d0, 0x119e1, 0x119e1, 0x119e3, 0x119e3, 0x11a00, 0x11a00, 0x11a0b, 0x11a32, 0x11a3a, 0x11a3a, 0x11a50, 0x11a50, 0x11a5c, 0x11a89, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11c00, 0x11c08, 0x11c0a, 0x11c2e, 0x11c40, 0x11c40, 0x11c72, 0x11c8f, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d30, 0x11d46, 0x11d46, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d89, 0x11d98, 0x11d98, 0x11ee0, 0x11ef2, 0x11f02, 0x11f02, 0x11f04, 0x11f10, 0x11f12, 0x11f33, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1611d, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a70, 0x16abe, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b40, 0x16b43, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f50, 0x16f50, 0x16f93, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e030, 0x1e06d, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e4d0, 0x1e4eb, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5f0, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e900, 0x1e943, 0x1e94b, 0x1e94b, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_ID_Start */ /* PROPERTY: 'Ideographic': Binary Property */ static const OnigCodePoint CR_Ideographic[] = { 21, 0x3006, 0x3007, 0x3021, 0x3029, 0x3038, 0x303a, 0x3400, 0x4dbf, 0x4e00, 0x9fff, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0x16fe4, 0x16fe4, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1b170, 0x1b2fb, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Ideographic */ /* PROPERTY: 'Imperial_Aramaic': Script */ static const OnigCodePoint CR_Imperial_Aramaic[] = { 2, 0x10840, 0x10855, 0x10857, 0x1085f, }; /* END of CR_Imperial_Aramaic */ /* PROPERTY: 'InCB': Derived Property */ static const OnigCodePoint CR_InCB[] = { 293, 0x094d, 0x094d, 0x09cd, 0x09cd, 0x0acd, 0x0acd, 0x0b4d, 0x0b4d, 0x0c4d, 0x0c4d, 0x0d4d, 0x0d4d, 0x0d57, 0x0d57, 0x0d62, 0x0d63, 0x0d81, 0x0d81, 0x0dca, 0x0dca, 0x0dcf, 0x0dcf, 0x0dd2, 0x0dd4, 0x0dd6, 0x0dd6, 0x0ddf, 0x0ddf, 0x0e31, 0x0e31, 0x0e34, 0x0e3a, 0x0e47, 0x0e4e, 0x0eb1, 0x0eb1, 0x0eb4, 0x0ebc, 0x0ec8, 0x0ece, 0x0f18, 0x0f19, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f71, 0x0f7e, 0x0f80, 0x0f84, 0x0f86, 0x0f87, 0x0f8d, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x102d, 0x1030, 0x1032, 0x1037, 0x1039, 0x103a, 0x103d, 0x103e, 0x1058, 0x1059, 0x105e, 0x1060, 0x1071, 0x1074, 0x1082, 0x1082, 0x1085, 0x1086, 0x108d, 0x108d, 0x109d, 0x109d, 0x135d, 0x135f, 0x1712, 0x1715, 0x1732, 0x1734, 0x1752, 0x1753, 0x1772, 0x1773, 0x17b4, 0x17b5, 0x17b7, 0x17bd, 0x17c6, 0x17c6, 0x17c9, 0x17d3, 0x17dd, 0x17dd, 0x180b, 0x180d, 0x180f, 0x180f, 0x1885, 0x1886, 0x18a9, 0x18a9, 0x1920, 0x1922, 0x1927, 0x1928, 0x1932, 0x1932, 0x1939, 0x193b, 0x1a17, 0x1a18, 0x1a1b, 0x1a1b, 0x1a56, 0x1a56, 0x1a58, 0x1a5e, 0x1a60, 0x1a60, 0x1a62, 0x1a62, 0x1a65, 0x1a6c, 0x1a73, 0x1a7c, 0x1a7f, 0x1a7f, 0x1ab0, 0x1ace, 0x1b00, 0x1b03, 0x1b34, 0x1b3d, 0x1b42, 0x1b44, 0x1b6b, 0x1b73, 0x1b80, 0x1b81, 0x1ba2, 0x1ba5, 0x1ba8, 0x1bad, 0x1be6, 0x1be6, 0x1be8, 0x1be9, 0x1bed, 0x1bed, 0x1bef, 0x1bf3, 0x1c2c, 0x1c33, 0x1c36, 0x1c37, 0x1cd0, 0x1cd2, 0x1cd4, 0x1ce0, 0x1ce2, 0x1ce8, 0x1ced, 0x1ced, 0x1cf4, 0x1cf4, 0x1cf8, 0x1cf9, 0x1dc0, 0x1dff, 0x200d, 0x200d, 0x20d0, 0x20f0, 0x2cef, 0x2cf1, 0x2d7f, 0x2d7f, 0x2de0, 0x2dff, 0x302a, 0x302f, 0x3099, 0x309a, 0xa66f, 0xa672, 0xa674, 0xa67d, 0xa69e, 0xa69f, 0xa6f0, 0xa6f1, 0xa802, 0xa802, 0xa806, 0xa806, 0xa80b, 0xa80b, 0xa825, 0xa826, 0xa82c, 0xa82c, 0xa8c4, 0xa8c5, 0xa8e0, 0xa8f1, 0xa8ff, 0xa8ff, 0xa926, 0xa92d, 0xa947, 0xa951, 0xa953, 0xa953, 0xa980, 0xa982, 0xa9b3, 0xa9b3, 0xa9b6, 0xa9b9, 0xa9bc, 0xa9bd, 0xa9c0, 0xa9c0, 0xa9e5, 0xa9e5, 0xaa29, 0xaa2e, 0xaa31, 0xaa32, 0xaa35, 0xaa36, 0xaa43, 0xaa43, 0xaa4c, 0xaa4c, 0xaa7c, 0xaa7c, 0xaab0, 0xaab0, 0xaab2, 0xaab4, 0xaab7, 0xaab8, 0xaabe, 0xaabf, 0xaac1, 0xaac1, 0xaaec, 0xaaed, 0xaaf6, 0xaaf6, 0xabe5, 0xabe5, 0xabe8, 0xabe8, 0xabed, 0xabed, 0xfb1e, 0xfb1e, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0xff9e, 0xff9f, 0x101fd, 0x101fd, 0x102e0, 0x102e0, 0x10376, 0x1037a, 0x10a01, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a0f, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10ae5, 0x10ae6, 0x10d24, 0x10d27, 0x10d69, 0x10d6d, 0x10eab, 0x10eac, 0x10efc, 0x10eff, 0x10f46, 0x10f50, 0x10f82, 0x10f85, 0x11001, 0x11001, 0x11038, 0x11046, 0x11070, 0x11070, 0x11073, 0x11074, 0x1107f, 0x11081, 0x110b3, 0x110b6, 0x110b9, 0x110ba, 0x110c2, 0x110c2, 0x11100, 0x11102, 0x11127, 0x1112b, 0x1112d, 0x11134, 0x11173, 0x11173, 0x11180, 0x11181, 0x111b6, 0x111be, 0x111c0, 0x111c0, 0x111c9, 0x111cc, 0x111cf, 0x111cf, 0x1122f, 0x11231, 0x11234, 0x11237, 0x1123e, 0x1123e, 0x11241, 0x11241, 0x112df, 0x112df, 0x112e3, 0x112ea, 0x11300, 0x11301, 0x1133b, 0x1133c, 0x1133e, 0x1133e, 0x11340, 0x11340, 0x1134d, 0x1134d, 0x11357, 0x11357, 0x11366, 0x1136c, 0x11370, 0x11374, 0x113b8, 0x113b8, 0x113bb, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113c9, 0x113ce, 0x113d0, 0x113d2, 0x113d2, 0x113e1, 0x113e2, 0x11438, 0x1143f, 0x11442, 0x11444, 0x11446, 0x11446, 0x1145e, 0x1145e, 0x114b0, 0x114b0, 0x114b3, 0x114b8, 0x114ba, 0x114ba, 0x114bd, 0x114bd, 0x114bf, 0x114c0, 0x114c2, 0x114c3, 0x115af, 0x115af, 0x115b2, 0x115b5, 0x115bc, 0x115bd, 0x115bf, 0x115c0, 0x115dc, 0x115dd, 0x11633, 0x1163a, 0x1163d, 0x1163d, 0x1163f, 0x11640, 0x116ab, 0x116ab, 0x116ad, 0x116ad, 0x116b0, 0x116b7, 0x1171d, 0x1171d, 0x1171f, 0x1171f, 0x11722, 0x11725, 0x11727, 0x1172b, 0x1182f, 0x11837, 0x11839, 0x1183a, 0x11930, 0x11930, 0x1193b, 0x1193e, 0x11943, 0x11943, 0x119d4, 0x119d7, 0x119da, 0x119db, 0x119e0, 0x119e0, 0x11a01, 0x11a0a, 0x11a33, 0x11a38, 0x11a3b, 0x11a3e, 0x11a47, 0x11a47, 0x11a51, 0x11a56, 0x11a59, 0x11a5b, 0x11a8a, 0x11a96, 0x11a98, 0x11a99, 0x11c30, 0x11c36, 0x11c38, 0x11c3d, 0x11c3f, 0x11c3f, 0x11c92, 0x11ca7, 0x11caa, 0x11cb0, 0x11cb2, 0x11cb3, 0x11cb5, 0x11cb6, 0x11d31, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d45, 0x11d47, 0x11d47, 0x11d90, 0x11d91, 0x11d95, 0x11d95, 0x11d97, 0x11d97, 0x11ef3, 0x11ef4, 0x11f00, 0x11f01, 0x11f36, 0x11f3a, 0x11f40, 0x11f42, 0x11f5a, 0x11f5a, 0x13440, 0x13440, 0x13447, 0x13455, 0x1611e, 0x16129, 0x1612d, 0x1612f, 0x16af0, 0x16af4, 0x16b30, 0x16b36, 0x16f4f, 0x16f4f, 0x16f8f, 0x16f92, 0x16fe4, 0x16fe4, 0x16ff0, 0x16ff1, 0x1bc9d, 0x1bc9e, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d165, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e08f, 0x1e08f, 0x1e130, 0x1e136, 0x1e2ae, 0x1e2ae, 0x1e2ec, 0x1e2ef, 0x1e4ec, 0x1e4ef, 0x1e5ee, 0x1e5ef, 0x1e8d0, 0x1e8d6, 0x1e944, 0x1e94a, 0x1f3fb, 0x1f3ff, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, }; /* END of CR_InCB */ /* PROPERTY: 'Inherited': Script */ static const OnigCodePoint CR_Inherited[] = { 29, 0x0300, 0x036f, 0x0485, 0x0486, 0x064b, 0x0655, 0x0670, 0x0670, 0x0951, 0x0954, 0x1ab0, 0x1ace, 0x1cd0, 0x1cd2, 0x1cd4, 0x1ce0, 0x1ce2, 0x1ce8, 0x1ced, 0x1ced, 0x1cf4, 0x1cf4, 0x1cf8, 0x1cf9, 0x1dc0, 0x1dff, 0x200c, 0x200d, 0x20d0, 0x20f0, 0x302a, 0x302d, 0x3099, 0x309a, 0xfe00, 0xfe0f, 0xfe20, 0xfe2d, 0x101fd, 0x101fd, 0x102e0, 0x102e0, 0x1133b, 0x1133b, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d167, 0x1d169, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0xe0100, 0xe01ef, }; /* END of CR_Inherited */ /* PROPERTY: 'Inscriptional_Pahlavi': Script */ static const OnigCodePoint CR_Inscriptional_Pahlavi[] = { 2, 0x10b60, 0x10b72, 0x10b78, 0x10b7f, }; /* END of CR_Inscriptional_Pahlavi */ /* PROPERTY: 'Inscriptional_Parthian': Script */ static const OnigCodePoint CR_Inscriptional_Parthian[] = { 2, 0x10b40, 0x10b55, 0x10b58, 0x10b5f, }; /* END of CR_Inscriptional_Parthian */ /* PROPERTY: 'Javanese': Script */ static const OnigCodePoint CR_Javanese[] = { 3, 0xa980, 0xa9cd, 0xa9d0, 0xa9d9, 0xa9de, 0xa9df, }; /* END of CR_Javanese */ /* PROPERTY: 'Join_Control': Binary Property */ static const OnigCodePoint CR_Join_Control[] = { 1, 0x200c, 0x200d, }; /* END of CR_Join_Control */ /* PROPERTY: 'Kaithi': Script */ static const OnigCodePoint CR_Kaithi[] = { 2, 0x11080, 0x110c2, 0x110cd, 0x110cd, }; /* END of CR_Kaithi */ /* PROPERTY: 'Kannada': Script */ static const OnigCodePoint CR_Kannada[] = { 13, 0x0c80, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, }; /* END of CR_Kannada */ /* PROPERTY: 'Katakana': Script */ static const OnigCodePoint CR_Katakana[] = { 14, 0x30a1, 0x30fa, 0x30fd, 0x30ff, 0x31f0, 0x31ff, 0x32d0, 0x32fe, 0x3300, 0x3357, 0xff66, 0xff6f, 0xff71, 0xff9d, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b000, 0x1b120, 0x1b122, 0x1b155, 0x1b155, 0x1b164, 0x1b167, }; /* END of CR_Katakana */ /* PROPERTY: 'Kawi': Script */ static const OnigCodePoint CR_Kawi[] = { 3, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f5a, }; /* END of CR_Kawi */ /* PROPERTY: 'Kayah_Li': Script */ static const OnigCodePoint CR_Kayah_Li[] = { 2, 0xa900, 0xa92d, 0xa92f, 0xa92f, }; /* END of CR_Kayah_Li */ /* PROPERTY: 'Kharoshthi': Script */ static const OnigCodePoint CR_Kharoshthi[] = { 8, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a48, 0x10a50, 0x10a58, }; /* END of CR_Kharoshthi */ /* PROPERTY: 'Khitan_Small_Script': Script */ static const OnigCodePoint CR_Khitan_Small_Script[] = { 3, 0x16fe4, 0x16fe4, 0x18b00, 0x18cd5, 0x18cff, 0x18cff, }; /* END of CR_Khitan_Small_Script */ /* PROPERTY: 'Khmer': Script */ static const OnigCodePoint CR_Khmer[] = { 4, 0x1780, 0x17dd, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x19e0, 0x19ff, }; /* END of CR_Khmer */ /* PROPERTY: 'Khojki': Script */ static const OnigCodePoint CR_Khojki[] = { 2, 0x11200, 0x11211, 0x11213, 0x11241, }; /* END of CR_Khojki */ /* PROPERTY: 'Khudawadi': Script */ static const OnigCodePoint CR_Khudawadi[] = { 2, 0x112b0, 0x112ea, 0x112f0, 0x112f9, }; /* END of CR_Khudawadi */ /* PROPERTY: 'Kirat_Rai': Script */ static const OnigCodePoint CR_Kirat_Rai[] = { 1, 0x16d40, 0x16d79, }; /* END of CR_Kirat_Rai */ /* PROPERTY: 'L': Major Category */ static const OnigCodePoint CR_L[] = { 677, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0370, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0620, 0x064a, 0x066e, 0x066f, 0x0671, 0x06d3, 0x06d5, 0x06d5, 0x06e5, 0x06e6, 0x06ee, 0x06ef, 0x06fa, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x0710, 0x0712, 0x072f, 0x074d, 0x07a5, 0x07b1, 0x07b1, 0x07ca, 0x07ea, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x0800, 0x0815, 0x081a, 0x081a, 0x0824, 0x0824, 0x0828, 0x0828, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x08a0, 0x08c9, 0x0904, 0x0939, 0x093d, 0x093d, 0x0950, 0x0950, 0x0958, 0x0961, 0x0971, 0x0980, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09bd, 0x09ce, 0x09ce, 0x09dc, 0x09dd, 0x09df, 0x09e1, 0x09f0, 0x09f1, 0x09fc, 0x09fc, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a72, 0x0a74, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0abd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae1, 0x0af9, 0x0af9, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b3d, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b61, 0x0b71, 0x0b71, 0x0b83, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bd0, 0x0bd0, 0x0c05, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c3d, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c61, 0x0c80, 0x0c80, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cbd, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce1, 0x0cf1, 0x0cf2, 0x0d04, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d3d, 0x0d4e, 0x0d4e, 0x0d54, 0x0d56, 0x0d5f, 0x0d61, 0x0d7a, 0x0d7f, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0e01, 0x0e30, 0x0e32, 0x0e33, 0x0e40, 0x0e46, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb0, 0x0eb2, 0x0eb3, 0x0ebd, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f88, 0x0f8c, 0x1000, 0x102a, 0x103f, 0x103f, 0x1050, 0x1055, 0x105a, 0x105d, 0x1061, 0x1061, 0x1065, 0x1066, 0x106e, 0x1070, 0x1075, 0x1081, 0x108e, 0x108e, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16f1, 0x16f8, 0x1700, 0x1711, 0x171f, 0x1731, 0x1740, 0x1751, 0x1760, 0x176c, 0x176e, 0x1770, 0x1780, 0x17b3, 0x17d7, 0x17d7, 0x17dc, 0x17dc, 0x1820, 0x1878, 0x1880, 0x1884, 0x1887, 0x18a8, 0x18aa, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1950, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x1a00, 0x1a16, 0x1a20, 0x1a54, 0x1aa7, 0x1aa7, 0x1b05, 0x1b33, 0x1b45, 0x1b4c, 0x1b83, 0x1ba0, 0x1bae, 0x1baf, 0x1bba, 0x1be5, 0x1c00, 0x1c23, 0x1c4d, 0x1c4f, 0x1c5a, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2183, 0x2184, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2e2f, 0x2e2f, 0x3005, 0x3006, 0x3031, 0x3035, 0x303b, 0x303c, 0x3041, 0x3096, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa61f, 0xa62a, 0xa62b, 0xa640, 0xa66e, 0xa67f, 0xa69d, 0xa6a0, 0xa6e5, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa801, 0xa803, 0xa805, 0xa807, 0xa80a, 0xa80c, 0xa822, 0xa840, 0xa873, 0xa882, 0xa8b3, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa8fe, 0xa90a, 0xa925, 0xa930, 0xa946, 0xa960, 0xa97c, 0xa984, 0xa9b2, 0xa9cf, 0xa9cf, 0xa9e0, 0xa9e4, 0xa9e6, 0xa9ef, 0xa9fa, 0xa9fe, 0xaa00, 0xaa28, 0xaa40, 0xaa42, 0xaa44, 0xaa4b, 0xaa60, 0xaa76, 0xaa7a, 0xaa7a, 0xaa7e, 0xaaaf, 0xaab1, 0xaab1, 0xaab5, 0xaab6, 0xaab9, 0xaabd, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaea, 0xaaf2, 0xaaf4, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabe2, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb1d, 0xfb1f, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff21, 0xff3a, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x10340, 0x10342, 0x10349, 0x10350, 0x10375, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x10400, 0x1049d, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a00, 0x10a10, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d23, 0x10d4a, 0x10d65, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11003, 0x11037, 0x11071, 0x11072, 0x11075, 0x11075, 0x11083, 0x110af, 0x110d0, 0x110e8, 0x11103, 0x11126, 0x11144, 0x11144, 0x11147, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11183, 0x111b2, 0x111c1, 0x111c4, 0x111da, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x1122b, 0x1123f, 0x11240, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112de, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x1133d, 0x11350, 0x11350, 0x1135d, 0x11361, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113b7, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11434, 0x11447, 0x1144a, 0x1145f, 0x11461, 0x11480, 0x114af, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x11580, 0x115ae, 0x115d8, 0x115db, 0x11600, 0x1162f, 0x11644, 0x11644, 0x11680, 0x116aa, 0x116b8, 0x116b8, 0x11700, 0x1171a, 0x11740, 0x11746, 0x11800, 0x1182b, 0x118a0, 0x118df, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x1192f, 0x1193f, 0x1193f, 0x11941, 0x11941, 0x119a0, 0x119a7, 0x119aa, 0x119d0, 0x119e1, 0x119e1, 0x119e3, 0x119e3, 0x11a00, 0x11a00, 0x11a0b, 0x11a32, 0x11a3a, 0x11a3a, 0x11a50, 0x11a50, 0x11a5c, 0x11a89, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11c00, 0x11c08, 0x11c0a, 0x11c2e, 0x11c40, 0x11c40, 0x11c72, 0x11c8f, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d30, 0x11d46, 0x11d46, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d89, 0x11d98, 0x11d98, 0x11ee0, 0x11ef2, 0x11f02, 0x11f02, 0x11f04, 0x11f10, 0x11f12, 0x11f33, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1611d, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a70, 0x16abe, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b40, 0x16b43, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f50, 0x16f50, 0x16f93, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e030, 0x1e06d, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e4d0, 0x1e4eb, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5f0, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e900, 0x1e943, 0x1e94b, 0x1e94b, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_L */ /* PROPERTY: 'LC': General Category */ static const OnigCodePoint CR_LC[] = { 145, 0x0041, 0x005a, 0x0061, 0x007a, 0x00b5, 0x00b5, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x01ba, 0x01bc, 0x01bf, 0x01c4, 0x0293, 0x0295, 0x02af, 0x0370, 0x0373, 0x0376, 0x0377, 0x037b, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0560, 0x0588, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fd, 0x10ff, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1d00, 0x1d2b, 0x1d6b, 0x1d77, 0x1d79, 0x1d9a, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2134, 0x2139, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2183, 0x2184, 0x2c00, 0x2c7b, 0x2c7e, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa640, 0xa66d, 0xa680, 0xa69b, 0xa722, 0xa76f, 0xa771, 0xa787, 0xa78b, 0xa78e, 0xa790, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f5, 0xa7f6, 0xa7fa, 0xa7fa, 0xab30, 0xab5a, 0xab60, 0xab68, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff21, 0xff3a, 0xff41, 0xff5a, 0x10400, 0x1044f, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d50, 0x10d65, 0x10d70, 0x10d85, 0x118a0, 0x118df, 0x16e40, 0x16e7f, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1df00, 0x1df09, 0x1df0b, 0x1df1e, 0x1df25, 0x1df2a, 0x1e900, 0x1e943, }; /* END of CR_LC */ /* PROPERTY: 'Lao': Script */ static const OnigCodePoint CR_Lao[] = { 11, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, }; /* END of CR_Lao */ /* PROPERTY: 'Latin': Script */ static const OnigCodePoint CR_Latin[] = { 39, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02b8, 0x02e0, 0x02e4, 0x1d00, 0x1d25, 0x1d2c, 0x1d5c, 0x1d62, 0x1d65, 0x1d6b, 0x1d77, 0x1d79, 0x1dbe, 0x1e00, 0x1eff, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x212a, 0x212b, 0x2132, 0x2132, 0x214e, 0x214e, 0x2160, 0x2188, 0x2c60, 0x2c7f, 0xa722, 0xa787, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa7ff, 0xab30, 0xab5a, 0xab5c, 0xab64, 0xab66, 0xab69, 0xfb00, 0xfb06, 0xff21, 0xff3a, 0xff41, 0xff5a, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, }; /* END of CR_Latin */ /* PROPERTY: 'Lepcha': Script */ static const OnigCodePoint CR_Lepcha[] = { 3, 0x1c00, 0x1c37, 0x1c3b, 0x1c49, 0x1c4d, 0x1c4f, }; /* END of CR_Lepcha */ /* PROPERTY: 'Limbu': Script */ static const OnigCodePoint CR_Limbu[] = { 5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1940, 0x1940, 0x1944, 0x194f, }; /* END of CR_Limbu */ /* PROPERTY: 'Linear_A': Script */ static const OnigCodePoint CR_Linear_A[] = { 3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, }; /* END of CR_Linear_A */ /* PROPERTY: 'Linear_B': Script */ static const OnigCodePoint CR_Linear_B[] = { 7, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, }; /* END of CR_Linear_B */ /* PROPERTY: 'Lisu': Script */ static const OnigCodePoint CR_Lisu[] = { 2, 0xa4d0, 0xa4ff, 0x11fb0, 0x11fb0, }; /* END of CR_Lisu */ /* PROPERTY: 'Ll': General Category */ static const OnigCodePoint CR_Ll[] = { 662, 0x0061, 0x007a, 0x00b5, 0x00b5, 0x00df, 0x00f6, 0x00f8, 0x00ff, 0x0101, 0x0101, 0x0103, 0x0103, 0x0105, 0x0105, 0x0107, 0x0107, 0x0109, 0x0109, 0x010b, 0x010b, 0x010d, 0x010d, 0x010f, 0x010f, 0x0111, 0x0111, 0x0113, 0x0113, 0x0115, 0x0115, 0x0117, 0x0117, 0x0119, 0x0119, 0x011b, 0x011b, 0x011d, 0x011d, 0x011f, 0x011f, 0x0121, 0x0121, 0x0123, 0x0123, 0x0125, 0x0125, 0x0127, 0x0127, 0x0129, 0x0129, 0x012b, 0x012b, 0x012d, 0x012d, 0x012f, 0x012f, 0x0131, 0x0131, 0x0133, 0x0133, 0x0135, 0x0135, 0x0137, 0x0138, 0x013a, 0x013a, 0x013c, 0x013c, 0x013e, 0x013e, 0x0140, 0x0140, 0x0142, 0x0142, 0x0144, 0x0144, 0x0146, 0x0146, 0x0148, 0x0149, 0x014b, 0x014b, 0x014d, 0x014d, 0x014f, 0x014f, 0x0151, 0x0151, 0x0153, 0x0153, 0x0155, 0x0155, 0x0157, 0x0157, 0x0159, 0x0159, 0x015b, 0x015b, 0x015d, 0x015d, 0x015f, 0x015f, 0x0161, 0x0161, 0x0163, 0x0163, 0x0165, 0x0165, 0x0167, 0x0167, 0x0169, 0x0169, 0x016b, 0x016b, 0x016d, 0x016d, 0x016f, 0x016f, 0x0171, 0x0171, 0x0173, 0x0173, 0x0175, 0x0175, 0x0177, 0x0177, 0x017a, 0x017a, 0x017c, 0x017c, 0x017e, 0x0180, 0x0183, 0x0183, 0x0185, 0x0185, 0x0188, 0x0188, 0x018c, 0x018d, 0x0192, 0x0192, 0x0195, 0x0195, 0x0199, 0x019b, 0x019e, 0x019e, 0x01a1, 0x01a1, 0x01a3, 0x01a3, 0x01a5, 0x01a5, 0x01a8, 0x01a8, 0x01aa, 0x01ab, 0x01ad, 0x01ad, 0x01b0, 0x01b0, 0x01b4, 0x01b4, 0x01b6, 0x01b6, 0x01b9, 0x01ba, 0x01bd, 0x01bf, 0x01c6, 0x01c6, 0x01c9, 0x01c9, 0x01cc, 0x01cc, 0x01ce, 0x01ce, 0x01d0, 0x01d0, 0x01d2, 0x01d2, 0x01d4, 0x01d4, 0x01d6, 0x01d6, 0x01d8, 0x01d8, 0x01da, 0x01da, 0x01dc, 0x01dd, 0x01df, 0x01df, 0x01e1, 0x01e1, 0x01e3, 0x01e3, 0x01e5, 0x01e5, 0x01e7, 0x01e7, 0x01e9, 0x01e9, 0x01eb, 0x01eb, 0x01ed, 0x01ed, 0x01ef, 0x01f0, 0x01f3, 0x01f3, 0x01f5, 0x01f5, 0x01f9, 0x01f9, 0x01fb, 0x01fb, 0x01fd, 0x01fd, 0x01ff, 0x01ff, 0x0201, 0x0201, 0x0203, 0x0203, 0x0205, 0x0205, 0x0207, 0x0207, 0x0209, 0x0209, 0x020b, 0x020b, 0x020d, 0x020d, 0x020f, 0x020f, 0x0211, 0x0211, 0x0213, 0x0213, 0x0215, 0x0215, 0x0217, 0x0217, 0x0219, 0x0219, 0x021b, 0x021b, 0x021d, 0x021d, 0x021f, 0x021f, 0x0221, 0x0221, 0x0223, 0x0223, 0x0225, 0x0225, 0x0227, 0x0227, 0x0229, 0x0229, 0x022b, 0x022b, 0x022d, 0x022d, 0x022f, 0x022f, 0x0231, 0x0231, 0x0233, 0x0239, 0x023c, 0x023c, 0x023f, 0x0240, 0x0242, 0x0242, 0x0247, 0x0247, 0x0249, 0x0249, 0x024b, 0x024b, 0x024d, 0x024d, 0x024f, 0x0293, 0x0295, 0x02af, 0x0371, 0x0371, 0x0373, 0x0373, 0x0377, 0x0377, 0x037b, 0x037d, 0x0390, 0x0390, 0x03ac, 0x03ce, 0x03d0, 0x03d1, 0x03d5, 0x03d7, 0x03d9, 0x03d9, 0x03db, 0x03db, 0x03dd, 0x03dd, 0x03df, 0x03df, 0x03e1, 0x03e1, 0x03e3, 0x03e3, 0x03e5, 0x03e5, 0x03e7, 0x03e7, 0x03e9, 0x03e9, 0x03eb, 0x03eb, 0x03ed, 0x03ed, 0x03ef, 0x03f3, 0x03f5, 0x03f5, 0x03f8, 0x03f8, 0x03fb, 0x03fc, 0x0430, 0x045f, 0x0461, 0x0461, 0x0463, 0x0463, 0x0465, 0x0465, 0x0467, 0x0467, 0x0469, 0x0469, 0x046b, 0x046b, 0x046d, 0x046d, 0x046f, 0x046f, 0x0471, 0x0471, 0x0473, 0x0473, 0x0475, 0x0475, 0x0477, 0x0477, 0x0479, 0x0479, 0x047b, 0x047b, 0x047d, 0x047d, 0x047f, 0x047f, 0x0481, 0x0481, 0x048b, 0x048b, 0x048d, 0x048d, 0x048f, 0x048f, 0x0491, 0x0491, 0x0493, 0x0493, 0x0495, 0x0495, 0x0497, 0x0497, 0x0499, 0x0499, 0x049b, 0x049b, 0x049d, 0x049d, 0x049f, 0x049f, 0x04a1, 0x04a1, 0x04a3, 0x04a3, 0x04a5, 0x04a5, 0x04a7, 0x04a7, 0x04a9, 0x04a9, 0x04ab, 0x04ab, 0x04ad, 0x04ad, 0x04af, 0x04af, 0x04b1, 0x04b1, 0x04b3, 0x04b3, 0x04b5, 0x04b5, 0x04b7, 0x04b7, 0x04b9, 0x04b9, 0x04bb, 0x04bb, 0x04bd, 0x04bd, 0x04bf, 0x04bf, 0x04c2, 0x04c2, 0x04c4, 0x04c4, 0x04c6, 0x04c6, 0x04c8, 0x04c8, 0x04ca, 0x04ca, 0x04cc, 0x04cc, 0x04ce, 0x04cf, 0x04d1, 0x04d1, 0x04d3, 0x04d3, 0x04d5, 0x04d5, 0x04d7, 0x04d7, 0x04d9, 0x04d9, 0x04db, 0x04db, 0x04dd, 0x04dd, 0x04df, 0x04df, 0x04e1, 0x04e1, 0x04e3, 0x04e3, 0x04e5, 0x04e5, 0x04e7, 0x04e7, 0x04e9, 0x04e9, 0x04eb, 0x04eb, 0x04ed, 0x04ed, 0x04ef, 0x04ef, 0x04f1, 0x04f1, 0x04f3, 0x04f3, 0x04f5, 0x04f5, 0x04f7, 0x04f7, 0x04f9, 0x04f9, 0x04fb, 0x04fb, 0x04fd, 0x04fd, 0x04ff, 0x04ff, 0x0501, 0x0501, 0x0503, 0x0503, 0x0505, 0x0505, 0x0507, 0x0507, 0x0509, 0x0509, 0x050b, 0x050b, 0x050d, 0x050d, 0x050f, 0x050f, 0x0511, 0x0511, 0x0513, 0x0513, 0x0515, 0x0515, 0x0517, 0x0517, 0x0519, 0x0519, 0x051b, 0x051b, 0x051d, 0x051d, 0x051f, 0x051f, 0x0521, 0x0521, 0x0523, 0x0523, 0x0525, 0x0525, 0x0527, 0x0527, 0x0529, 0x0529, 0x052b, 0x052b, 0x052d, 0x052d, 0x052f, 0x052f, 0x0560, 0x0588, 0x10d0, 0x10fa, 0x10fd, 0x10ff, 0x13f8, 0x13fd, 0x1c80, 0x1c88, 0x1c8a, 0x1c8a, 0x1d00, 0x1d2b, 0x1d6b, 0x1d77, 0x1d79, 0x1d9a, 0x1e01, 0x1e01, 0x1e03, 0x1e03, 0x1e05, 0x1e05, 0x1e07, 0x1e07, 0x1e09, 0x1e09, 0x1e0b, 0x1e0b, 0x1e0d, 0x1e0d, 0x1e0f, 0x1e0f, 0x1e11, 0x1e11, 0x1e13, 0x1e13, 0x1e15, 0x1e15, 0x1e17, 0x1e17, 0x1e19, 0x1e19, 0x1e1b, 0x1e1b, 0x1e1d, 0x1e1d, 0x1e1f, 0x1e1f, 0x1e21, 0x1e21, 0x1e23, 0x1e23, 0x1e25, 0x1e25, 0x1e27, 0x1e27, 0x1e29, 0x1e29, 0x1e2b, 0x1e2b, 0x1e2d, 0x1e2d, 0x1e2f, 0x1e2f, 0x1e31, 0x1e31, 0x1e33, 0x1e33, 0x1e35, 0x1e35, 0x1e37, 0x1e37, 0x1e39, 0x1e39, 0x1e3b, 0x1e3b, 0x1e3d, 0x1e3d, 0x1e3f, 0x1e3f, 0x1e41, 0x1e41, 0x1e43, 0x1e43, 0x1e45, 0x1e45, 0x1e47, 0x1e47, 0x1e49, 0x1e49, 0x1e4b, 0x1e4b, 0x1e4d, 0x1e4d, 0x1e4f, 0x1e4f, 0x1e51, 0x1e51, 0x1e53, 0x1e53, 0x1e55, 0x1e55, 0x1e57, 0x1e57, 0x1e59, 0x1e59, 0x1e5b, 0x1e5b, 0x1e5d, 0x1e5d, 0x1e5f, 0x1e5f, 0x1e61, 0x1e61, 0x1e63, 0x1e63, 0x1e65, 0x1e65, 0x1e67, 0x1e67, 0x1e69, 0x1e69, 0x1e6b, 0x1e6b, 0x1e6d, 0x1e6d, 0x1e6f, 0x1e6f, 0x1e71, 0x1e71, 0x1e73, 0x1e73, 0x1e75, 0x1e75, 0x1e77, 0x1e77, 0x1e79, 0x1e79, 0x1e7b, 0x1e7b, 0x1e7d, 0x1e7d, 0x1e7f, 0x1e7f, 0x1e81, 0x1e81, 0x1e83, 0x1e83, 0x1e85, 0x1e85, 0x1e87, 0x1e87, 0x1e89, 0x1e89, 0x1e8b, 0x1e8b, 0x1e8d, 0x1e8d, 0x1e8f, 0x1e8f, 0x1e91, 0x1e91, 0x1e93, 0x1e93, 0x1e95, 0x1e9d, 0x1e9f, 0x1e9f, 0x1ea1, 0x1ea1, 0x1ea3, 0x1ea3, 0x1ea5, 0x1ea5, 0x1ea7, 0x1ea7, 0x1ea9, 0x1ea9, 0x1eab, 0x1eab, 0x1ead, 0x1ead, 0x1eaf, 0x1eaf, 0x1eb1, 0x1eb1, 0x1eb3, 0x1eb3, 0x1eb5, 0x1eb5, 0x1eb7, 0x1eb7, 0x1eb9, 0x1eb9, 0x1ebb, 0x1ebb, 0x1ebd, 0x1ebd, 0x1ebf, 0x1ebf, 0x1ec1, 0x1ec1, 0x1ec3, 0x1ec3, 0x1ec5, 0x1ec5, 0x1ec7, 0x1ec7, 0x1ec9, 0x1ec9, 0x1ecb, 0x1ecb, 0x1ecd, 0x1ecd, 0x1ecf, 0x1ecf, 0x1ed1, 0x1ed1, 0x1ed3, 0x1ed3, 0x1ed5, 0x1ed5, 0x1ed7, 0x1ed7, 0x1ed9, 0x1ed9, 0x1edb, 0x1edb, 0x1edd, 0x1edd, 0x1edf, 0x1edf, 0x1ee1, 0x1ee1, 0x1ee3, 0x1ee3, 0x1ee5, 0x1ee5, 0x1ee7, 0x1ee7, 0x1ee9, 0x1ee9, 0x1eeb, 0x1eeb, 0x1eed, 0x1eed, 0x1eef, 0x1eef, 0x1ef1, 0x1ef1, 0x1ef3, 0x1ef3, 0x1ef5, 0x1ef5, 0x1ef7, 0x1ef7, 0x1ef9, 0x1ef9, 0x1efb, 0x1efb, 0x1efd, 0x1efd, 0x1eff, 0x1f07, 0x1f10, 0x1f15, 0x1f20, 0x1f27, 0x1f30, 0x1f37, 0x1f40, 0x1f45, 0x1f50, 0x1f57, 0x1f60, 0x1f67, 0x1f70, 0x1f7d, 0x1f80, 0x1f87, 0x1f90, 0x1f97, 0x1fa0, 0x1fa7, 0x1fb0, 0x1fb4, 0x1fb6, 0x1fb7, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fc7, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fd7, 0x1fe0, 0x1fe7, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ff7, 0x210a, 0x210a, 0x210e, 0x210f, 0x2113, 0x2113, 0x212f, 0x212f, 0x2134, 0x2134, 0x2139, 0x2139, 0x213c, 0x213d, 0x2146, 0x2149, 0x214e, 0x214e, 0x2184, 0x2184, 0x2c30, 0x2c5f, 0x2c61, 0x2c61, 0x2c65, 0x2c66, 0x2c68, 0x2c68, 0x2c6a, 0x2c6a, 0x2c6c, 0x2c6c, 0x2c71, 0x2c71, 0x2c73, 0x2c74, 0x2c76, 0x2c7b, 0x2c81, 0x2c81, 0x2c83, 0x2c83, 0x2c85, 0x2c85, 0x2c87, 0x2c87, 0x2c89, 0x2c89, 0x2c8b, 0x2c8b, 0x2c8d, 0x2c8d, 0x2c8f, 0x2c8f, 0x2c91, 0x2c91, 0x2c93, 0x2c93, 0x2c95, 0x2c95, 0x2c97, 0x2c97, 0x2c99, 0x2c99, 0x2c9b, 0x2c9b, 0x2c9d, 0x2c9d, 0x2c9f, 0x2c9f, 0x2ca1, 0x2ca1, 0x2ca3, 0x2ca3, 0x2ca5, 0x2ca5, 0x2ca7, 0x2ca7, 0x2ca9, 0x2ca9, 0x2cab, 0x2cab, 0x2cad, 0x2cad, 0x2caf, 0x2caf, 0x2cb1, 0x2cb1, 0x2cb3, 0x2cb3, 0x2cb5, 0x2cb5, 0x2cb7, 0x2cb7, 0x2cb9, 0x2cb9, 0x2cbb, 0x2cbb, 0x2cbd, 0x2cbd, 0x2cbf, 0x2cbf, 0x2cc1, 0x2cc1, 0x2cc3, 0x2cc3, 0x2cc5, 0x2cc5, 0x2cc7, 0x2cc7, 0x2cc9, 0x2cc9, 0x2ccb, 0x2ccb, 0x2ccd, 0x2ccd, 0x2ccf, 0x2ccf, 0x2cd1, 0x2cd1, 0x2cd3, 0x2cd3, 0x2cd5, 0x2cd5, 0x2cd7, 0x2cd7, 0x2cd9, 0x2cd9, 0x2cdb, 0x2cdb, 0x2cdd, 0x2cdd, 0x2cdf, 0x2cdf, 0x2ce1, 0x2ce1, 0x2ce3, 0x2ce4, 0x2cec, 0x2cec, 0x2cee, 0x2cee, 0x2cf3, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa641, 0xa641, 0xa643, 0xa643, 0xa645, 0xa645, 0xa647, 0xa647, 0xa649, 0xa649, 0xa64b, 0xa64b, 0xa64d, 0xa64d, 0xa64f, 0xa64f, 0xa651, 0xa651, 0xa653, 0xa653, 0xa655, 0xa655, 0xa657, 0xa657, 0xa659, 0xa659, 0xa65b, 0xa65b, 0xa65d, 0xa65d, 0xa65f, 0xa65f, 0xa661, 0xa661, 0xa663, 0xa663, 0xa665, 0xa665, 0xa667, 0xa667, 0xa669, 0xa669, 0xa66b, 0xa66b, 0xa66d, 0xa66d, 0xa681, 0xa681, 0xa683, 0xa683, 0xa685, 0xa685, 0xa687, 0xa687, 0xa689, 0xa689, 0xa68b, 0xa68b, 0xa68d, 0xa68d, 0xa68f, 0xa68f, 0xa691, 0xa691, 0xa693, 0xa693, 0xa695, 0xa695, 0xa697, 0xa697, 0xa699, 0xa699, 0xa69b, 0xa69b, 0xa723, 0xa723, 0xa725, 0xa725, 0xa727, 0xa727, 0xa729, 0xa729, 0xa72b, 0xa72b, 0xa72d, 0xa72d, 0xa72f, 0xa731, 0xa733, 0xa733, 0xa735, 0xa735, 0xa737, 0xa737, 0xa739, 0xa739, 0xa73b, 0xa73b, 0xa73d, 0xa73d, 0xa73f, 0xa73f, 0xa741, 0xa741, 0xa743, 0xa743, 0xa745, 0xa745, 0xa747, 0xa747, 0xa749, 0xa749, 0xa74b, 0xa74b, 0xa74d, 0xa74d, 0xa74f, 0xa74f, 0xa751, 0xa751, 0xa753, 0xa753, 0xa755, 0xa755, 0xa757, 0xa757, 0xa759, 0xa759, 0xa75b, 0xa75b, 0xa75d, 0xa75d, 0xa75f, 0xa75f, 0xa761, 0xa761, 0xa763, 0xa763, 0xa765, 0xa765, 0xa767, 0xa767, 0xa769, 0xa769, 0xa76b, 0xa76b, 0xa76d, 0xa76d, 0xa76f, 0xa76f, 0xa771, 0xa778, 0xa77a, 0xa77a, 0xa77c, 0xa77c, 0xa77f, 0xa77f, 0xa781, 0xa781, 0xa783, 0xa783, 0xa785, 0xa785, 0xa787, 0xa787, 0xa78c, 0xa78c, 0xa78e, 0xa78e, 0xa791, 0xa791, 0xa793, 0xa795, 0xa797, 0xa797, 0xa799, 0xa799, 0xa79b, 0xa79b, 0xa79d, 0xa79d, 0xa79f, 0xa79f, 0xa7a1, 0xa7a1, 0xa7a3, 0xa7a3, 0xa7a5, 0xa7a5, 0xa7a7, 0xa7a7, 0xa7a9, 0xa7a9, 0xa7af, 0xa7af, 0xa7b5, 0xa7b5, 0xa7b7, 0xa7b7, 0xa7b9, 0xa7b9, 0xa7bb, 0xa7bb, 0xa7bd, 0xa7bd, 0xa7bf, 0xa7bf, 0xa7c1, 0xa7c1, 0xa7c3, 0xa7c3, 0xa7c8, 0xa7c8, 0xa7ca, 0xa7ca, 0xa7cd, 0xa7cd, 0xa7d1, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7d5, 0xa7d7, 0xa7d7, 0xa7d9, 0xa7d9, 0xa7db, 0xa7db, 0xa7f6, 0xa7f6, 0xa7fa, 0xa7fa, 0xab30, 0xab5a, 0xab60, 0xab68, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff41, 0xff5a, 0x10428, 0x1044f, 0x104d8, 0x104fb, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10cc0, 0x10cf2, 0x10d70, 0x10d85, 0x118c0, 0x118df, 0x16e60, 0x16e7f, 0x1d41a, 0x1d433, 0x1d44e, 0x1d454, 0x1d456, 0x1d467, 0x1d482, 0x1d49b, 0x1d4b6, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d4cf, 0x1d4ea, 0x1d503, 0x1d51e, 0x1d537, 0x1d552, 0x1d56b, 0x1d586, 0x1d59f, 0x1d5ba, 0x1d5d3, 0x1d5ee, 0x1d607, 0x1d622, 0x1d63b, 0x1d656, 0x1d66f, 0x1d68a, 0x1d6a5, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6e1, 0x1d6fc, 0x1d714, 0x1d716, 0x1d71b, 0x1d736, 0x1d74e, 0x1d750, 0x1d755, 0x1d770, 0x1d788, 0x1d78a, 0x1d78f, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7c9, 0x1d7cb, 0x1d7cb, 0x1df00, 0x1df09, 0x1df0b, 0x1df1e, 0x1df25, 0x1df2a, 0x1e922, 0x1e943, }; /* END of CR_Ll */ /* PROPERTY: 'Lm': General Category */ static const OnigCodePoint CR_Lm[] = { 75, 0x02b0, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0374, 0x0374, 0x037a, 0x037a, 0x0559, 0x0559, 0x0640, 0x0640, 0x06e5, 0x06e6, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x081a, 0x081a, 0x0824, 0x0824, 0x0828, 0x0828, 0x08c9, 0x08c9, 0x0971, 0x0971, 0x0e46, 0x0e46, 0x0ec6, 0x0ec6, 0x10fc, 0x10fc, 0x17d7, 0x17d7, 0x1843, 0x1843, 0x1aa7, 0x1aa7, 0x1c78, 0x1c7d, 0x1d2c, 0x1d6a, 0x1d78, 0x1d78, 0x1d9b, 0x1dbf, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2c7c, 0x2c7d, 0x2d6f, 0x2d6f, 0x2e2f, 0x2e2f, 0x3005, 0x3005, 0x3031, 0x3035, 0x303b, 0x303b, 0x309d, 0x309e, 0x30fc, 0x30fe, 0xa015, 0xa015, 0xa4f8, 0xa4fd, 0xa60c, 0xa60c, 0xa67f, 0xa67f, 0xa69c, 0xa69d, 0xa717, 0xa71f, 0xa770, 0xa770, 0xa788, 0xa788, 0xa7f2, 0xa7f4, 0xa7f8, 0xa7f9, 0xa9cf, 0xa9cf, 0xa9e6, 0xa9e6, 0xaa70, 0xaa70, 0xaadd, 0xaadd, 0xaaf3, 0xaaf4, 0xab5c, 0xab5f, 0xab69, 0xab69, 0xff70, 0xff70, 0xff9e, 0xff9f, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10d4e, 0x10d4e, 0x10d6f, 0x10d6f, 0x16b40, 0x16b43, 0x16d40, 0x16d42, 0x16d6b, 0x16d6c, 0x16f93, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1e030, 0x1e06d, 0x1e137, 0x1e13d, 0x1e4eb, 0x1e4eb, 0x1e94b, 0x1e94b, }; /* END of CR_Lm */ /* PROPERTY: 'Lo': General Category */ static const OnigCodePoint CR_Lo[] = { 528, 0x00aa, 0x00aa, 0x00ba, 0x00ba, 0x01bb, 0x01bb, 0x01c0, 0x01c3, 0x0294, 0x0294, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0620, 0x063f, 0x0641, 0x064a, 0x066e, 0x066f, 0x0671, 0x06d3, 0x06d5, 0x06d5, 0x06ee, 0x06ef, 0x06fa, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x0710, 0x0712, 0x072f, 0x074d, 0x07a5, 0x07b1, 0x07b1, 0x07ca, 0x07ea, 0x0800, 0x0815, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x08a0, 0x08c8, 0x0904, 0x0939, 0x093d, 0x093d, 0x0950, 0x0950, 0x0958, 0x0961, 0x0972, 0x0980, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09bd, 0x09ce, 0x09ce, 0x09dc, 0x09dd, 0x09df, 0x09e1, 0x09f0, 0x09f1, 0x09fc, 0x09fc, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a72, 0x0a74, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0abd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae1, 0x0af9, 0x0af9, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b3d, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b61, 0x0b71, 0x0b71, 0x0b83, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bd0, 0x0bd0, 0x0c05, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c3d, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c61, 0x0c80, 0x0c80, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cbd, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce1, 0x0cf1, 0x0cf2, 0x0d04, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d3d, 0x0d4e, 0x0d4e, 0x0d54, 0x0d56, 0x0d5f, 0x0d61, 0x0d7a, 0x0d7f, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0e01, 0x0e30, 0x0e32, 0x0e33, 0x0e40, 0x0e45, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb0, 0x0eb2, 0x0eb3, 0x0ebd, 0x0ebd, 0x0ec0, 0x0ec4, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f88, 0x0f8c, 0x1000, 0x102a, 0x103f, 0x103f, 0x1050, 0x1055, 0x105a, 0x105d, 0x1061, 0x1061, 0x1065, 0x1066, 0x106e, 0x1070, 0x1075, 0x1081, 0x108e, 0x108e, 0x1100, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16f1, 0x16f8, 0x1700, 0x1711, 0x171f, 0x1731, 0x1740, 0x1751, 0x1760, 0x176c, 0x176e, 0x1770, 0x1780, 0x17b3, 0x17dc, 0x17dc, 0x1820, 0x1842, 0x1844, 0x1878, 0x1880, 0x1884, 0x1887, 0x18a8, 0x18aa, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1950, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x1a00, 0x1a16, 0x1a20, 0x1a54, 0x1b05, 0x1b33, 0x1b45, 0x1b4c, 0x1b83, 0x1ba0, 0x1bae, 0x1baf, 0x1bba, 0x1be5, 0x1c00, 0x1c23, 0x1c4d, 0x1c4f, 0x1c5a, 0x1c77, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x2135, 0x2138, 0x2d30, 0x2d67, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x3006, 0x3006, 0x303c, 0x303c, 0x3041, 0x3096, 0x309f, 0x309f, 0x30a1, 0x30fa, 0x30ff, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa014, 0xa016, 0xa48c, 0xa4d0, 0xa4f7, 0xa500, 0xa60b, 0xa610, 0xa61f, 0xa62a, 0xa62b, 0xa66e, 0xa66e, 0xa6a0, 0xa6e5, 0xa78f, 0xa78f, 0xa7f7, 0xa7f7, 0xa7fb, 0xa801, 0xa803, 0xa805, 0xa807, 0xa80a, 0xa80c, 0xa822, 0xa840, 0xa873, 0xa882, 0xa8b3, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa8fe, 0xa90a, 0xa925, 0xa930, 0xa946, 0xa960, 0xa97c, 0xa984, 0xa9b2, 0xa9e0, 0xa9e4, 0xa9e7, 0xa9ef, 0xa9fa, 0xa9fe, 0xaa00, 0xaa28, 0xaa40, 0xaa42, 0xaa44, 0xaa4b, 0xaa60, 0xaa6f, 0xaa71, 0xaa76, 0xaa7a, 0xaa7a, 0xaa7e, 0xaaaf, 0xaab1, 0xaab1, 0xaab5, 0xaab6, 0xaab9, 0xaabd, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadc, 0xaae0, 0xaaea, 0xaaf2, 0xaaf2, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xabc0, 0xabe2, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb1d, 0xfb1d, 0xfb1f, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff66, 0xff6f, 0xff71, 0xff9d, 0xffa0, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x10340, 0x10342, 0x10349, 0x10350, 0x10375, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x10450, 0x1049d, 0x10500, 0x10527, 0x10530, 0x10563, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a00, 0x10a10, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10d00, 0x10d23, 0x10d4a, 0x10d4d, 0x10d4f, 0x10d4f, 0x10e80, 0x10ea9, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11003, 0x11037, 0x11071, 0x11072, 0x11075, 0x11075, 0x11083, 0x110af, 0x110d0, 0x110e8, 0x11103, 0x11126, 0x11144, 0x11144, 0x11147, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11183, 0x111b2, 0x111c1, 0x111c4, 0x111da, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x1122b, 0x1123f, 0x11240, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112de, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x1133d, 0x11350, 0x11350, 0x1135d, 0x11361, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113b7, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11434, 0x11447, 0x1144a, 0x1145f, 0x11461, 0x11480, 0x114af, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x11580, 0x115ae, 0x115d8, 0x115db, 0x11600, 0x1162f, 0x11644, 0x11644, 0x11680, 0x116aa, 0x116b8, 0x116b8, 0x11700, 0x1171a, 0x11740, 0x11746, 0x11800, 0x1182b, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x1192f, 0x1193f, 0x1193f, 0x11941, 0x11941, 0x119a0, 0x119a7, 0x119aa, 0x119d0, 0x119e1, 0x119e1, 0x119e3, 0x119e3, 0x11a00, 0x11a00, 0x11a0b, 0x11a32, 0x11a3a, 0x11a3a, 0x11a50, 0x11a50, 0x11a5c, 0x11a89, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11c00, 0x11c08, 0x11c0a, 0x11c2e, 0x11c40, 0x11c40, 0x11c72, 0x11c8f, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d30, 0x11d46, 0x11d46, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d89, 0x11d98, 0x11d98, 0x11ee0, 0x11ef2, 0x11f02, 0x11f02, 0x11f04, 0x11f10, 0x11f12, 0x11f33, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1611d, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a70, 0x16abe, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d43, 0x16d6a, 0x16f00, 0x16f4a, 0x16f50, 0x16f50, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1df0a, 0x1df0a, 0x1e100, 0x1e12c, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e4d0, 0x1e4ea, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5f0, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Lo */ /* PROPERTY: 'Logical_Order_Exception': Binary Property */ static const OnigCodePoint CR_Logical_Order_Exception[] = { 7, 0x0e40, 0x0e44, 0x0ec0, 0x0ec4, 0x19b5, 0x19b7, 0x19ba, 0x19ba, 0xaab5, 0xaab6, 0xaab9, 0xaab9, 0xaabb, 0xaabc, }; /* END of CR_Logical_Order_Exception */ /* PROPERTY: 'Lowercase': Derived Property */ #define CR_Lowercase CR_Lower /* PROPERTY: 'Lt': General Category */ static const OnigCodePoint CR_Lt[] = { 10, 0x01c5, 0x01c5, 0x01c8, 0x01c8, 0x01cb, 0x01cb, 0x01f2, 0x01f2, 0x1f88, 0x1f8f, 0x1f98, 0x1f9f, 0x1fa8, 0x1faf, 0x1fbc, 0x1fbc, 0x1fcc, 0x1fcc, 0x1ffc, 0x1ffc, }; /* END of CR_Lt */ /* PROPERTY: 'Lu': General Category */ static const OnigCodePoint CR_Lu[] = { 651, 0x0041, 0x005a, 0x00c0, 0x00d6, 0x00d8, 0x00de, 0x0100, 0x0100, 0x0102, 0x0102, 0x0104, 0x0104, 0x0106, 0x0106, 0x0108, 0x0108, 0x010a, 0x010a, 0x010c, 0x010c, 0x010e, 0x010e, 0x0110, 0x0110, 0x0112, 0x0112, 0x0114, 0x0114, 0x0116, 0x0116, 0x0118, 0x0118, 0x011a, 0x011a, 0x011c, 0x011c, 0x011e, 0x011e, 0x0120, 0x0120, 0x0122, 0x0122, 0x0124, 0x0124, 0x0126, 0x0126, 0x0128, 0x0128, 0x012a, 0x012a, 0x012c, 0x012c, 0x012e, 0x012e, 0x0130, 0x0130, 0x0132, 0x0132, 0x0134, 0x0134, 0x0136, 0x0136, 0x0139, 0x0139, 0x013b, 0x013b, 0x013d, 0x013d, 0x013f, 0x013f, 0x0141, 0x0141, 0x0143, 0x0143, 0x0145, 0x0145, 0x0147, 0x0147, 0x014a, 0x014a, 0x014c, 0x014c, 0x014e, 0x014e, 0x0150, 0x0150, 0x0152, 0x0152, 0x0154, 0x0154, 0x0156, 0x0156, 0x0158, 0x0158, 0x015a, 0x015a, 0x015c, 0x015c, 0x015e, 0x015e, 0x0160, 0x0160, 0x0162, 0x0162, 0x0164, 0x0164, 0x0166, 0x0166, 0x0168, 0x0168, 0x016a, 0x016a, 0x016c, 0x016c, 0x016e, 0x016e, 0x0170, 0x0170, 0x0172, 0x0172, 0x0174, 0x0174, 0x0176, 0x0176, 0x0178, 0x0179, 0x017b, 0x017b, 0x017d, 0x017d, 0x0181, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, 0x0189, 0x018b, 0x018e, 0x0191, 0x0193, 0x0194, 0x0196, 0x0198, 0x019c, 0x019d, 0x019f, 0x01a0, 0x01a2, 0x01a2, 0x01a4, 0x01a4, 0x01a6, 0x01a7, 0x01a9, 0x01a9, 0x01ac, 0x01ac, 0x01ae, 0x01af, 0x01b1, 0x01b3, 0x01b5, 0x01b5, 0x01b7, 0x01b8, 0x01bc, 0x01bc, 0x01c4, 0x01c4, 0x01c7, 0x01c7, 0x01ca, 0x01ca, 0x01cd, 0x01cd, 0x01cf, 0x01cf, 0x01d1, 0x01d1, 0x01d3, 0x01d3, 0x01d5, 0x01d5, 0x01d7, 0x01d7, 0x01d9, 0x01d9, 0x01db, 0x01db, 0x01de, 0x01de, 0x01e0, 0x01e0, 0x01e2, 0x01e2, 0x01e4, 0x01e4, 0x01e6, 0x01e6, 0x01e8, 0x01e8, 0x01ea, 0x01ea, 0x01ec, 0x01ec, 0x01ee, 0x01ee, 0x01f1, 0x01f1, 0x01f4, 0x01f4, 0x01f6, 0x01f8, 0x01fa, 0x01fa, 0x01fc, 0x01fc, 0x01fe, 0x01fe, 0x0200, 0x0200, 0x0202, 0x0202, 0x0204, 0x0204, 0x0206, 0x0206, 0x0208, 0x0208, 0x020a, 0x020a, 0x020c, 0x020c, 0x020e, 0x020e, 0x0210, 0x0210, 0x0212, 0x0212, 0x0214, 0x0214, 0x0216, 0x0216, 0x0218, 0x0218, 0x021a, 0x021a, 0x021c, 0x021c, 0x021e, 0x021e, 0x0220, 0x0220, 0x0222, 0x0222, 0x0224, 0x0224, 0x0226, 0x0226, 0x0228, 0x0228, 0x022a, 0x022a, 0x022c, 0x022c, 0x022e, 0x022e, 0x0230, 0x0230, 0x0232, 0x0232, 0x023a, 0x023b, 0x023d, 0x023e, 0x0241, 0x0241, 0x0243, 0x0246, 0x0248, 0x0248, 0x024a, 0x024a, 0x024c, 0x024c, 0x024e, 0x024e, 0x0370, 0x0370, 0x0372, 0x0372, 0x0376, 0x0376, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x038f, 0x0391, 0x03a1, 0x03a3, 0x03ab, 0x03cf, 0x03cf, 0x03d2, 0x03d4, 0x03d8, 0x03d8, 0x03da, 0x03da, 0x03dc, 0x03dc, 0x03de, 0x03de, 0x03e0, 0x03e0, 0x03e2, 0x03e2, 0x03e4, 0x03e4, 0x03e6, 0x03e6, 0x03e8, 0x03e8, 0x03ea, 0x03ea, 0x03ec, 0x03ec, 0x03ee, 0x03ee, 0x03f4, 0x03f4, 0x03f7, 0x03f7, 0x03f9, 0x03fa, 0x03fd, 0x042f, 0x0460, 0x0460, 0x0462, 0x0462, 0x0464, 0x0464, 0x0466, 0x0466, 0x0468, 0x0468, 0x046a, 0x046a, 0x046c, 0x046c, 0x046e, 0x046e, 0x0470, 0x0470, 0x0472, 0x0472, 0x0474, 0x0474, 0x0476, 0x0476, 0x0478, 0x0478, 0x047a, 0x047a, 0x047c, 0x047c, 0x047e, 0x047e, 0x0480, 0x0480, 0x048a, 0x048a, 0x048c, 0x048c, 0x048e, 0x048e, 0x0490, 0x0490, 0x0492, 0x0492, 0x0494, 0x0494, 0x0496, 0x0496, 0x0498, 0x0498, 0x049a, 0x049a, 0x049c, 0x049c, 0x049e, 0x049e, 0x04a0, 0x04a0, 0x04a2, 0x04a2, 0x04a4, 0x04a4, 0x04a6, 0x04a6, 0x04a8, 0x04a8, 0x04aa, 0x04aa, 0x04ac, 0x04ac, 0x04ae, 0x04ae, 0x04b0, 0x04b0, 0x04b2, 0x04b2, 0x04b4, 0x04b4, 0x04b6, 0x04b6, 0x04b8, 0x04b8, 0x04ba, 0x04ba, 0x04bc, 0x04bc, 0x04be, 0x04be, 0x04c0, 0x04c1, 0x04c3, 0x04c3, 0x04c5, 0x04c5, 0x04c7, 0x04c7, 0x04c9, 0x04c9, 0x04cb, 0x04cb, 0x04cd, 0x04cd, 0x04d0, 0x04d0, 0x04d2, 0x04d2, 0x04d4, 0x04d4, 0x04d6, 0x04d6, 0x04d8, 0x04d8, 0x04da, 0x04da, 0x04dc, 0x04dc, 0x04de, 0x04de, 0x04e0, 0x04e0, 0x04e2, 0x04e2, 0x04e4, 0x04e4, 0x04e6, 0x04e6, 0x04e8, 0x04e8, 0x04ea, 0x04ea, 0x04ec, 0x04ec, 0x04ee, 0x04ee, 0x04f0, 0x04f0, 0x04f2, 0x04f2, 0x04f4, 0x04f4, 0x04f6, 0x04f6, 0x04f8, 0x04f8, 0x04fa, 0x04fa, 0x04fc, 0x04fc, 0x04fe, 0x04fe, 0x0500, 0x0500, 0x0502, 0x0502, 0x0504, 0x0504, 0x0506, 0x0506, 0x0508, 0x0508, 0x050a, 0x050a, 0x050c, 0x050c, 0x050e, 0x050e, 0x0510, 0x0510, 0x0512, 0x0512, 0x0514, 0x0514, 0x0516, 0x0516, 0x0518, 0x0518, 0x051a, 0x051a, 0x051c, 0x051c, 0x051e, 0x051e, 0x0520, 0x0520, 0x0522, 0x0522, 0x0524, 0x0524, 0x0526, 0x0526, 0x0528, 0x0528, 0x052a, 0x052a, 0x052c, 0x052c, 0x052e, 0x052e, 0x0531, 0x0556, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x13a0, 0x13f5, 0x1c89, 0x1c89, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1e00, 0x1e00, 0x1e02, 0x1e02, 0x1e04, 0x1e04, 0x1e06, 0x1e06, 0x1e08, 0x1e08, 0x1e0a, 0x1e0a, 0x1e0c, 0x1e0c, 0x1e0e, 0x1e0e, 0x1e10, 0x1e10, 0x1e12, 0x1e12, 0x1e14, 0x1e14, 0x1e16, 0x1e16, 0x1e18, 0x1e18, 0x1e1a, 0x1e1a, 0x1e1c, 0x1e1c, 0x1e1e, 0x1e1e, 0x1e20, 0x1e20, 0x1e22, 0x1e22, 0x1e24, 0x1e24, 0x1e26, 0x1e26, 0x1e28, 0x1e28, 0x1e2a, 0x1e2a, 0x1e2c, 0x1e2c, 0x1e2e, 0x1e2e, 0x1e30, 0x1e30, 0x1e32, 0x1e32, 0x1e34, 0x1e34, 0x1e36, 0x1e36, 0x1e38, 0x1e38, 0x1e3a, 0x1e3a, 0x1e3c, 0x1e3c, 0x1e3e, 0x1e3e, 0x1e40, 0x1e40, 0x1e42, 0x1e42, 0x1e44, 0x1e44, 0x1e46, 0x1e46, 0x1e48, 0x1e48, 0x1e4a, 0x1e4a, 0x1e4c, 0x1e4c, 0x1e4e, 0x1e4e, 0x1e50, 0x1e50, 0x1e52, 0x1e52, 0x1e54, 0x1e54, 0x1e56, 0x1e56, 0x1e58, 0x1e58, 0x1e5a, 0x1e5a, 0x1e5c, 0x1e5c, 0x1e5e, 0x1e5e, 0x1e60, 0x1e60, 0x1e62, 0x1e62, 0x1e64, 0x1e64, 0x1e66, 0x1e66, 0x1e68, 0x1e68, 0x1e6a, 0x1e6a, 0x1e6c, 0x1e6c, 0x1e6e, 0x1e6e, 0x1e70, 0x1e70, 0x1e72, 0x1e72, 0x1e74, 0x1e74, 0x1e76, 0x1e76, 0x1e78, 0x1e78, 0x1e7a, 0x1e7a, 0x1e7c, 0x1e7c, 0x1e7e, 0x1e7e, 0x1e80, 0x1e80, 0x1e82, 0x1e82, 0x1e84, 0x1e84, 0x1e86, 0x1e86, 0x1e88, 0x1e88, 0x1e8a, 0x1e8a, 0x1e8c, 0x1e8c, 0x1e8e, 0x1e8e, 0x1e90, 0x1e90, 0x1e92, 0x1e92, 0x1e94, 0x1e94, 0x1e9e, 0x1e9e, 0x1ea0, 0x1ea0, 0x1ea2, 0x1ea2, 0x1ea4, 0x1ea4, 0x1ea6, 0x1ea6, 0x1ea8, 0x1ea8, 0x1eaa, 0x1eaa, 0x1eac, 0x1eac, 0x1eae, 0x1eae, 0x1eb0, 0x1eb0, 0x1eb2, 0x1eb2, 0x1eb4, 0x1eb4, 0x1eb6, 0x1eb6, 0x1eb8, 0x1eb8, 0x1eba, 0x1eba, 0x1ebc, 0x1ebc, 0x1ebe, 0x1ebe, 0x1ec0, 0x1ec0, 0x1ec2, 0x1ec2, 0x1ec4, 0x1ec4, 0x1ec6, 0x1ec6, 0x1ec8, 0x1ec8, 0x1eca, 0x1eca, 0x1ecc, 0x1ecc, 0x1ece, 0x1ece, 0x1ed0, 0x1ed0, 0x1ed2, 0x1ed2, 0x1ed4, 0x1ed4, 0x1ed6, 0x1ed6, 0x1ed8, 0x1ed8, 0x1eda, 0x1eda, 0x1edc, 0x1edc, 0x1ede, 0x1ede, 0x1ee0, 0x1ee0, 0x1ee2, 0x1ee2, 0x1ee4, 0x1ee4, 0x1ee6, 0x1ee6, 0x1ee8, 0x1ee8, 0x1eea, 0x1eea, 0x1eec, 0x1eec, 0x1eee, 0x1eee, 0x1ef0, 0x1ef0, 0x1ef2, 0x1ef2, 0x1ef4, 0x1ef4, 0x1ef6, 0x1ef6, 0x1ef8, 0x1ef8, 0x1efa, 0x1efa, 0x1efc, 0x1efc, 0x1efe, 0x1efe, 0x1f08, 0x1f0f, 0x1f18, 0x1f1d, 0x1f28, 0x1f2f, 0x1f38, 0x1f3f, 0x1f48, 0x1f4d, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f5f, 0x1f68, 0x1f6f, 0x1fb8, 0x1fbb, 0x1fc8, 0x1fcb, 0x1fd8, 0x1fdb, 0x1fe8, 0x1fec, 0x1ff8, 0x1ffb, 0x2102, 0x2102, 0x2107, 0x2107, 0x210b, 0x210d, 0x2110, 0x2112, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x2130, 0x2133, 0x213e, 0x213f, 0x2145, 0x2145, 0x2183, 0x2183, 0x2c00, 0x2c2f, 0x2c60, 0x2c60, 0x2c62, 0x2c64, 0x2c67, 0x2c67, 0x2c69, 0x2c69, 0x2c6b, 0x2c6b, 0x2c6d, 0x2c70, 0x2c72, 0x2c72, 0x2c75, 0x2c75, 0x2c7e, 0x2c80, 0x2c82, 0x2c82, 0x2c84, 0x2c84, 0x2c86, 0x2c86, 0x2c88, 0x2c88, 0x2c8a, 0x2c8a, 0x2c8c, 0x2c8c, 0x2c8e, 0x2c8e, 0x2c90, 0x2c90, 0x2c92, 0x2c92, 0x2c94, 0x2c94, 0x2c96, 0x2c96, 0x2c98, 0x2c98, 0x2c9a, 0x2c9a, 0x2c9c, 0x2c9c, 0x2c9e, 0x2c9e, 0x2ca0, 0x2ca0, 0x2ca2, 0x2ca2, 0x2ca4, 0x2ca4, 0x2ca6, 0x2ca6, 0x2ca8, 0x2ca8, 0x2caa, 0x2caa, 0x2cac, 0x2cac, 0x2cae, 0x2cae, 0x2cb0, 0x2cb0, 0x2cb2, 0x2cb2, 0x2cb4, 0x2cb4, 0x2cb6, 0x2cb6, 0x2cb8, 0x2cb8, 0x2cba, 0x2cba, 0x2cbc, 0x2cbc, 0x2cbe, 0x2cbe, 0x2cc0, 0x2cc0, 0x2cc2, 0x2cc2, 0x2cc4, 0x2cc4, 0x2cc6, 0x2cc6, 0x2cc8, 0x2cc8, 0x2cca, 0x2cca, 0x2ccc, 0x2ccc, 0x2cce, 0x2cce, 0x2cd0, 0x2cd0, 0x2cd2, 0x2cd2, 0x2cd4, 0x2cd4, 0x2cd6, 0x2cd6, 0x2cd8, 0x2cd8, 0x2cda, 0x2cda, 0x2cdc, 0x2cdc, 0x2cde, 0x2cde, 0x2ce0, 0x2ce0, 0x2ce2, 0x2ce2, 0x2ceb, 0x2ceb, 0x2ced, 0x2ced, 0x2cf2, 0x2cf2, 0xa640, 0xa640, 0xa642, 0xa642, 0xa644, 0xa644, 0xa646, 0xa646, 0xa648, 0xa648, 0xa64a, 0xa64a, 0xa64c, 0xa64c, 0xa64e, 0xa64e, 0xa650, 0xa650, 0xa652, 0xa652, 0xa654, 0xa654, 0xa656, 0xa656, 0xa658, 0xa658, 0xa65a, 0xa65a, 0xa65c, 0xa65c, 0xa65e, 0xa65e, 0xa660, 0xa660, 0xa662, 0xa662, 0xa664, 0xa664, 0xa666, 0xa666, 0xa668, 0xa668, 0xa66a, 0xa66a, 0xa66c, 0xa66c, 0xa680, 0xa680, 0xa682, 0xa682, 0xa684, 0xa684, 0xa686, 0xa686, 0xa688, 0xa688, 0xa68a, 0xa68a, 0xa68c, 0xa68c, 0xa68e, 0xa68e, 0xa690, 0xa690, 0xa692, 0xa692, 0xa694, 0xa694, 0xa696, 0xa696, 0xa698, 0xa698, 0xa69a, 0xa69a, 0xa722, 0xa722, 0xa724, 0xa724, 0xa726, 0xa726, 0xa728, 0xa728, 0xa72a, 0xa72a, 0xa72c, 0xa72c, 0xa72e, 0xa72e, 0xa732, 0xa732, 0xa734, 0xa734, 0xa736, 0xa736, 0xa738, 0xa738, 0xa73a, 0xa73a, 0xa73c, 0xa73c, 0xa73e, 0xa73e, 0xa740, 0xa740, 0xa742, 0xa742, 0xa744, 0xa744, 0xa746, 0xa746, 0xa748, 0xa748, 0xa74a, 0xa74a, 0xa74c, 0xa74c, 0xa74e, 0xa74e, 0xa750, 0xa750, 0xa752, 0xa752, 0xa754, 0xa754, 0xa756, 0xa756, 0xa758, 0xa758, 0xa75a, 0xa75a, 0xa75c, 0xa75c, 0xa75e, 0xa75e, 0xa760, 0xa760, 0xa762, 0xa762, 0xa764, 0xa764, 0xa766, 0xa766, 0xa768, 0xa768, 0xa76a, 0xa76a, 0xa76c, 0xa76c, 0xa76e, 0xa76e, 0xa779, 0xa779, 0xa77b, 0xa77b, 0xa77d, 0xa77e, 0xa780, 0xa780, 0xa782, 0xa782, 0xa784, 0xa784, 0xa786, 0xa786, 0xa78b, 0xa78b, 0xa78d, 0xa78d, 0xa790, 0xa790, 0xa792, 0xa792, 0xa796, 0xa796, 0xa798, 0xa798, 0xa79a, 0xa79a, 0xa79c, 0xa79c, 0xa79e, 0xa79e, 0xa7a0, 0xa7a0, 0xa7a2, 0xa7a2, 0xa7a4, 0xa7a4, 0xa7a6, 0xa7a6, 0xa7a8, 0xa7a8, 0xa7aa, 0xa7ae, 0xa7b0, 0xa7b4, 0xa7b6, 0xa7b6, 0xa7b8, 0xa7b8, 0xa7ba, 0xa7ba, 0xa7bc, 0xa7bc, 0xa7be, 0xa7be, 0xa7c0, 0xa7c0, 0xa7c2, 0xa7c2, 0xa7c4, 0xa7c7, 0xa7c9, 0xa7c9, 0xa7cb, 0xa7cc, 0xa7d0, 0xa7d0, 0xa7d6, 0xa7d6, 0xa7d8, 0xa7d8, 0xa7da, 0xa7da, 0xa7dc, 0xa7dc, 0xa7f5, 0xa7f5, 0xff21, 0xff3a, 0x10400, 0x10427, 0x104b0, 0x104d3, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10c80, 0x10cb2, 0x10d50, 0x10d65, 0x118a0, 0x118bf, 0x16e40, 0x16e5f, 0x1d400, 0x1d419, 0x1d434, 0x1d44d, 0x1d468, 0x1d481, 0x1d49c, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b5, 0x1d4d0, 0x1d4e9, 0x1d504, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d538, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d56c, 0x1d585, 0x1d5a0, 0x1d5b9, 0x1d5d4, 0x1d5ed, 0x1d608, 0x1d621, 0x1d63c, 0x1d655, 0x1d670, 0x1d689, 0x1d6a8, 0x1d6c0, 0x1d6e2, 0x1d6fa, 0x1d71c, 0x1d734, 0x1d756, 0x1d76e, 0x1d790, 0x1d7a8, 0x1d7ca, 0x1d7ca, 0x1e900, 0x1e921, }; /* END of CR_Lu */ /* PROPERTY: 'Lycian': Script */ static const OnigCodePoint CR_Lycian[] = { 1, 0x10280, 0x1029c, }; /* END of CR_Lycian */ /* PROPERTY: 'Lydian': Script */ static const OnigCodePoint CR_Lydian[] = { 2, 0x10920, 0x10939, 0x1093f, 0x1093f, }; /* END of CR_Lydian */ /* PROPERTY: 'M': Major Category */ static const OnigCodePoint CR_M[] = { 321, 0x0300, 0x036f, 0x0483, 0x0489, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x0610, 0x061a, 0x064b, 0x065f, 0x0670, 0x0670, 0x06d6, 0x06dc, 0x06df, 0x06e4, 0x06e7, 0x06e8, 0x06ea, 0x06ed, 0x0711, 0x0711, 0x0730, 0x074a, 0x07a6, 0x07b0, 0x07eb, 0x07f3, 0x07fd, 0x07fd, 0x0816, 0x0819, 0x081b, 0x0823, 0x0825, 0x0827, 0x0829, 0x082d, 0x0859, 0x085b, 0x0897, 0x089f, 0x08ca, 0x08e1, 0x08e3, 0x0903, 0x093a, 0x093c, 0x093e, 0x094f, 0x0951, 0x0957, 0x0962, 0x0963, 0x0981, 0x0983, 0x09bc, 0x09bc, 0x09be, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09cd, 0x09d7, 0x09d7, 0x09e2, 0x09e3, 0x09fe, 0x09fe, 0x0a01, 0x0a03, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a70, 0x0a71, 0x0a75, 0x0a75, 0x0a81, 0x0a83, 0x0abc, 0x0abc, 0x0abe, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ae2, 0x0ae3, 0x0afa, 0x0aff, 0x0b01, 0x0b03, 0x0b3c, 0x0b3c, 0x0b3e, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b62, 0x0b63, 0x0b82, 0x0b82, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd7, 0x0bd7, 0x0c00, 0x0c04, 0x0c3c, 0x0c3c, 0x0c3e, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c62, 0x0c63, 0x0c81, 0x0c83, 0x0cbc, 0x0cbc, 0x0cbe, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0ce2, 0x0ce3, 0x0cf3, 0x0cf3, 0x0d00, 0x0d03, 0x0d3b, 0x0d3c, 0x0d3e, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4d, 0x0d57, 0x0d57, 0x0d62, 0x0d63, 0x0d81, 0x0d83, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0df2, 0x0df3, 0x0e31, 0x0e31, 0x0e34, 0x0e3a, 0x0e47, 0x0e4e, 0x0eb1, 0x0eb1, 0x0eb4, 0x0ebc, 0x0ec8, 0x0ece, 0x0f18, 0x0f19, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f3e, 0x0f3f, 0x0f71, 0x0f84, 0x0f86, 0x0f87, 0x0f8d, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x102b, 0x103e, 0x1056, 0x1059, 0x105e, 0x1060, 0x1062, 0x1064, 0x1067, 0x106d, 0x1071, 0x1074, 0x1082, 0x108d, 0x108f, 0x108f, 0x109a, 0x109d, 0x135d, 0x135f, 0x1712, 0x1715, 0x1732, 0x1734, 0x1752, 0x1753, 0x1772, 0x1773, 0x17b4, 0x17d3, 0x17dd, 0x17dd, 0x180b, 0x180d, 0x180f, 0x180f, 0x1885, 0x1886, 0x18a9, 0x18a9, 0x1920, 0x192b, 0x1930, 0x193b, 0x1a17, 0x1a1b, 0x1a55, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a7f, 0x1ab0, 0x1ace, 0x1b00, 0x1b04, 0x1b34, 0x1b44, 0x1b6b, 0x1b73, 0x1b80, 0x1b82, 0x1ba1, 0x1bad, 0x1be6, 0x1bf3, 0x1c24, 0x1c37, 0x1cd0, 0x1cd2, 0x1cd4, 0x1ce8, 0x1ced, 0x1ced, 0x1cf4, 0x1cf4, 0x1cf7, 0x1cf9, 0x1dc0, 0x1dff, 0x20d0, 0x20f0, 0x2cef, 0x2cf1, 0x2d7f, 0x2d7f, 0x2de0, 0x2dff, 0x302a, 0x302f, 0x3099, 0x309a, 0xa66f, 0xa672, 0xa674, 0xa67d, 0xa69e, 0xa69f, 0xa6f0, 0xa6f1, 0xa802, 0xa802, 0xa806, 0xa806, 0xa80b, 0xa80b, 0xa823, 0xa827, 0xa82c, 0xa82c, 0xa880, 0xa881, 0xa8b4, 0xa8c5, 0xa8e0, 0xa8f1, 0xa8ff, 0xa8ff, 0xa926, 0xa92d, 0xa947, 0xa953, 0xa980, 0xa983, 0xa9b3, 0xa9c0, 0xa9e5, 0xa9e5, 0xaa29, 0xaa36, 0xaa43, 0xaa43, 0xaa4c, 0xaa4d, 0xaa7b, 0xaa7d, 0xaab0, 0xaab0, 0xaab2, 0xaab4, 0xaab7, 0xaab8, 0xaabe, 0xaabf, 0xaac1, 0xaac1, 0xaaeb, 0xaaef, 0xaaf5, 0xaaf6, 0xabe3, 0xabea, 0xabec, 0xabed, 0xfb1e, 0xfb1e, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0x101fd, 0x101fd, 0x102e0, 0x102e0, 0x10376, 0x1037a, 0x10a01, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a0f, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10ae5, 0x10ae6, 0x10d24, 0x10d27, 0x10d69, 0x10d6d, 0x10eab, 0x10eac, 0x10efc, 0x10eff, 0x10f46, 0x10f50, 0x10f82, 0x10f85, 0x11000, 0x11002, 0x11038, 0x11046, 0x11070, 0x11070, 0x11073, 0x11074, 0x1107f, 0x11082, 0x110b0, 0x110ba, 0x110c2, 0x110c2, 0x11100, 0x11102, 0x11127, 0x11134, 0x11145, 0x11146, 0x11173, 0x11173, 0x11180, 0x11182, 0x111b3, 0x111c0, 0x111c9, 0x111cc, 0x111ce, 0x111cf, 0x1122c, 0x11237, 0x1123e, 0x1123e, 0x11241, 0x11241, 0x112df, 0x112ea, 0x11300, 0x11303, 0x1133b, 0x1133c, 0x1133e, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11357, 0x11357, 0x11362, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x113b8, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d0, 0x113d2, 0x113d2, 0x113e1, 0x113e2, 0x11435, 0x11446, 0x1145e, 0x1145e, 0x114b0, 0x114c3, 0x115af, 0x115b5, 0x115b8, 0x115c0, 0x115dc, 0x115dd, 0x11630, 0x11640, 0x116ab, 0x116b7, 0x1171d, 0x1172b, 0x1182c, 0x1183a, 0x11930, 0x11935, 0x11937, 0x11938, 0x1193b, 0x1193e, 0x11940, 0x11940, 0x11942, 0x11943, 0x119d1, 0x119d7, 0x119da, 0x119e0, 0x119e4, 0x119e4, 0x11a01, 0x11a0a, 0x11a33, 0x11a39, 0x11a3b, 0x11a3e, 0x11a47, 0x11a47, 0x11a51, 0x11a5b, 0x11a8a, 0x11a99, 0x11c2f, 0x11c36, 0x11c38, 0x11c3f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d31, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d45, 0x11d47, 0x11d47, 0x11d8a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d97, 0x11ef3, 0x11ef6, 0x11f00, 0x11f01, 0x11f03, 0x11f03, 0x11f34, 0x11f3a, 0x11f3e, 0x11f42, 0x11f5a, 0x11f5a, 0x13440, 0x13440, 0x13447, 0x13455, 0x1611e, 0x1612f, 0x16af0, 0x16af4, 0x16b30, 0x16b36, 0x16f4f, 0x16f4f, 0x16f51, 0x16f87, 0x16f8f, 0x16f92, 0x16fe4, 0x16fe4, 0x16ff0, 0x16ff1, 0x1bc9d, 0x1bc9e, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d165, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e08f, 0x1e08f, 0x1e130, 0x1e136, 0x1e2ae, 0x1e2ae, 0x1e2ec, 0x1e2ef, 0x1e4ec, 0x1e4ef, 0x1e5ee, 0x1e5ef, 0x1e8d0, 0x1e8d6, 0x1e944, 0x1e94a, 0xe0100, 0xe01ef, }; /* END of CR_M */ /* PROPERTY: 'Mahajani': Script */ static const OnigCodePoint CR_Mahajani[] = { 1, 0x11150, 0x11176, }; /* END of CR_Mahajani */ /* PROPERTY: 'Makasar': Script */ static const OnigCodePoint CR_Makasar[] = { 1, 0x11ee0, 0x11ef8, }; /* END of CR_Makasar */ /* PROPERTY: 'Malayalam': Script */ static const OnigCodePoint CR_Malayalam[] = { 7, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4f, 0x0d54, 0x0d63, 0x0d66, 0x0d7f, }; /* END of CR_Malayalam */ /* PROPERTY: 'Mandaic': Script */ static const OnigCodePoint CR_Mandaic[] = { 2, 0x0840, 0x085b, 0x085e, 0x085e, }; /* END of CR_Mandaic */ /* PROPERTY: 'Manichaean': Script */ static const OnigCodePoint CR_Manichaean[] = { 2, 0x10ac0, 0x10ae6, 0x10aeb, 0x10af6, }; /* END of CR_Manichaean */ /* PROPERTY: 'Marchen': Script */ static const OnigCodePoint CR_Marchen[] = { 3, 0x11c70, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, }; /* END of CR_Marchen */ /* PROPERTY: 'Masaram_Gondi': Script */ static const OnigCodePoint CR_Masaram_Gondi[] = { 7, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, }; /* END of CR_Masaram_Gondi */ /* PROPERTY: 'Math': Derived Property */ static const OnigCodePoint CR_Math[] = { 139, 0x002b, 0x002b, 0x003c, 0x003e, 0x005e, 0x005e, 0x007c, 0x007c, 0x007e, 0x007e, 0x00ac, 0x00ac, 0x00b1, 0x00b1, 0x00d7, 0x00d7, 0x00f7, 0x00f7, 0x03d0, 0x03d2, 0x03d5, 0x03d5, 0x03f0, 0x03f1, 0x03f4, 0x03f6, 0x0606, 0x0608, 0x2016, 0x2016, 0x2032, 0x2034, 0x2040, 0x2040, 0x2044, 0x2044, 0x2052, 0x2052, 0x2061, 0x2064, 0x207a, 0x207e, 0x208a, 0x208e, 0x20d0, 0x20dc, 0x20e1, 0x20e1, 0x20e5, 0x20e6, 0x20eb, 0x20ef, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2118, 0x211d, 0x2124, 0x2124, 0x2128, 0x2129, 0x212c, 0x212d, 0x212f, 0x2131, 0x2133, 0x2138, 0x213c, 0x2149, 0x214b, 0x214b, 0x2190, 0x21a7, 0x21a9, 0x21ae, 0x21b0, 0x21b1, 0x21b6, 0x21b7, 0x21bc, 0x21db, 0x21dd, 0x21dd, 0x21e4, 0x21e5, 0x21f4, 0x22ff, 0x2308, 0x230b, 0x2320, 0x2321, 0x237c, 0x237c, 0x239b, 0x23b5, 0x23b7, 0x23b7, 0x23d0, 0x23d0, 0x23dc, 0x23e2, 0x25a0, 0x25a1, 0x25ae, 0x25b7, 0x25bc, 0x25c1, 0x25c6, 0x25c7, 0x25ca, 0x25cb, 0x25cf, 0x25d3, 0x25e2, 0x25e2, 0x25e4, 0x25e4, 0x25e7, 0x25ec, 0x25f8, 0x25ff, 0x2605, 0x2606, 0x2640, 0x2640, 0x2642, 0x2642, 0x2660, 0x2663, 0x266d, 0x266f, 0x27c0, 0x27ff, 0x2900, 0x2aff, 0x2b30, 0x2b44, 0x2b47, 0x2b4c, 0xfb29, 0xfb29, 0xfe61, 0xfe66, 0xfe68, 0xfe68, 0xff0b, 0xff0b, 0xff1c, 0xff1e, 0xff3c, 0xff3c, 0xff3e, 0xff3e, 0xff5c, 0xff5c, 0xff5e, 0xff5e, 0xffe2, 0xffe2, 0xffe9, 0xffec, 0x10d8e, 0x10d8f, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, }; /* END of CR_Math */ /* PROPERTY: 'Mc': General Category */ static const OnigCodePoint CR_Mc[] = { 190, 0x0903, 0x0903, 0x093b, 0x093b, 0x093e, 0x0940, 0x0949, 0x094c, 0x094e, 0x094f, 0x0982, 0x0983, 0x09be, 0x09c0, 0x09c7, 0x09c8, 0x09cb, 0x09cc, 0x09d7, 0x09d7, 0x0a03, 0x0a03, 0x0a3e, 0x0a40, 0x0a83, 0x0a83, 0x0abe, 0x0ac0, 0x0ac9, 0x0ac9, 0x0acb, 0x0acc, 0x0b02, 0x0b03, 0x0b3e, 0x0b3e, 0x0b40, 0x0b40, 0x0b47, 0x0b48, 0x0b4b, 0x0b4c, 0x0b57, 0x0b57, 0x0bbe, 0x0bbf, 0x0bc1, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcc, 0x0bd7, 0x0bd7, 0x0c01, 0x0c03, 0x0c41, 0x0c44, 0x0c82, 0x0c83, 0x0cbe, 0x0cbe, 0x0cc0, 0x0cc4, 0x0cc7, 0x0cc8, 0x0cca, 0x0ccb, 0x0cd5, 0x0cd6, 0x0cf3, 0x0cf3, 0x0d02, 0x0d03, 0x0d3e, 0x0d40, 0x0d46, 0x0d48, 0x0d4a, 0x0d4c, 0x0d57, 0x0d57, 0x0d82, 0x0d83, 0x0dcf, 0x0dd1, 0x0dd8, 0x0ddf, 0x0df2, 0x0df3, 0x0f3e, 0x0f3f, 0x0f7f, 0x0f7f, 0x102b, 0x102c, 0x1031, 0x1031, 0x1038, 0x1038, 0x103b, 0x103c, 0x1056, 0x1057, 0x1062, 0x1064, 0x1067, 0x106d, 0x1083, 0x1084, 0x1087, 0x108c, 0x108f, 0x108f, 0x109a, 0x109c, 0x1715, 0x1715, 0x1734, 0x1734, 0x17b6, 0x17b6, 0x17be, 0x17c5, 0x17c7, 0x17c8, 0x1923, 0x1926, 0x1929, 0x192b, 0x1930, 0x1931, 0x1933, 0x1938, 0x1a19, 0x1a1a, 0x1a55, 0x1a55, 0x1a57, 0x1a57, 0x1a61, 0x1a61, 0x1a63, 0x1a64, 0x1a6d, 0x1a72, 0x1b04, 0x1b04, 0x1b35, 0x1b35, 0x1b3b, 0x1b3b, 0x1b3d, 0x1b41, 0x1b43, 0x1b44, 0x1b82, 0x1b82, 0x1ba1, 0x1ba1, 0x1ba6, 0x1ba7, 0x1baa, 0x1baa, 0x1be7, 0x1be7, 0x1bea, 0x1bec, 0x1bee, 0x1bee, 0x1bf2, 0x1bf3, 0x1c24, 0x1c2b, 0x1c34, 0x1c35, 0x1ce1, 0x1ce1, 0x1cf7, 0x1cf7, 0x302e, 0x302f, 0xa823, 0xa824, 0xa827, 0xa827, 0xa880, 0xa881, 0xa8b4, 0xa8c3, 0xa952, 0xa953, 0xa983, 0xa983, 0xa9b4, 0xa9b5, 0xa9ba, 0xa9bb, 0xa9be, 0xa9c0, 0xaa2f, 0xaa30, 0xaa33, 0xaa34, 0xaa4d, 0xaa4d, 0xaa7b, 0xaa7b, 0xaa7d, 0xaa7d, 0xaaeb, 0xaaeb, 0xaaee, 0xaaef, 0xaaf5, 0xaaf5, 0xabe3, 0xabe4, 0xabe6, 0xabe7, 0xabe9, 0xabea, 0xabec, 0xabec, 0x11000, 0x11000, 0x11002, 0x11002, 0x11082, 0x11082, 0x110b0, 0x110b2, 0x110b7, 0x110b8, 0x1112c, 0x1112c, 0x11145, 0x11146, 0x11182, 0x11182, 0x111b3, 0x111b5, 0x111bf, 0x111c0, 0x111ce, 0x111ce, 0x1122c, 0x1122e, 0x11232, 0x11233, 0x11235, 0x11235, 0x112e0, 0x112e2, 0x11302, 0x11303, 0x1133e, 0x1133f, 0x11341, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11357, 0x11357, 0x11362, 0x11363, 0x113b8, 0x113ba, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113cd, 0x113cf, 0x113cf, 0x11435, 0x11437, 0x11440, 0x11441, 0x11445, 0x11445, 0x114b0, 0x114b2, 0x114b9, 0x114b9, 0x114bb, 0x114be, 0x114c1, 0x114c1, 0x115af, 0x115b1, 0x115b8, 0x115bb, 0x115be, 0x115be, 0x11630, 0x11632, 0x1163b, 0x1163c, 0x1163e, 0x1163e, 0x116ac, 0x116ac, 0x116ae, 0x116af, 0x116b6, 0x116b6, 0x1171e, 0x1171e, 0x11720, 0x11721, 0x11726, 0x11726, 0x1182c, 0x1182e, 0x11838, 0x11838, 0x11930, 0x11935, 0x11937, 0x11938, 0x1193d, 0x1193d, 0x11940, 0x11940, 0x11942, 0x11942, 0x119d1, 0x119d3, 0x119dc, 0x119df, 0x119e4, 0x119e4, 0x11a39, 0x11a39, 0x11a57, 0x11a58, 0x11a97, 0x11a97, 0x11c2f, 0x11c2f, 0x11c3e, 0x11c3e, 0x11ca9, 0x11ca9, 0x11cb1, 0x11cb1, 0x11cb4, 0x11cb4, 0x11d8a, 0x11d8e, 0x11d93, 0x11d94, 0x11d96, 0x11d96, 0x11ef5, 0x11ef6, 0x11f03, 0x11f03, 0x11f34, 0x11f35, 0x11f3e, 0x11f3f, 0x11f41, 0x11f41, 0x1612a, 0x1612c, 0x16f51, 0x16f87, 0x16ff0, 0x16ff1, 0x1d165, 0x1d166, 0x1d16d, 0x1d172, }; /* END of CR_Mc */ /* PROPERTY: 'Me': General Category */ static const OnigCodePoint CR_Me[] = { 5, 0x0488, 0x0489, 0x1abe, 0x1abe, 0x20dd, 0x20e0, 0x20e2, 0x20e4, 0xa670, 0xa672, }; /* END of CR_Me */ /* PROPERTY: 'Medefaidrin': Script */ static const OnigCodePoint CR_Medefaidrin[] = { 1, 0x16e40, 0x16e9a, }; /* END of CR_Medefaidrin */ /* PROPERTY: 'Meetei_Mayek': Script */ static const OnigCodePoint CR_Meetei_Mayek[] = { 3, 0xaae0, 0xaaf6, 0xabc0, 0xabed, 0xabf0, 0xabf9, }; /* END of CR_Meetei_Mayek */ /* PROPERTY: 'Mende_Kikakui': Script */ static const OnigCodePoint CR_Mende_Kikakui[] = { 2, 0x1e800, 0x1e8c4, 0x1e8c7, 0x1e8d6, }; /* END of CR_Mende_Kikakui */ /* PROPERTY: 'Meroitic_Cursive': Script */ static const OnigCodePoint CR_Meroitic_Cursive[] = { 3, 0x109a0, 0x109b7, 0x109bc, 0x109cf, 0x109d2, 0x109ff, }; /* END of CR_Meroitic_Cursive */ /* PROPERTY: 'Meroitic_Hieroglyphs': Script */ static const OnigCodePoint CR_Meroitic_Hieroglyphs[] = { 1, 0x10980, 0x1099f, }; /* END of CR_Meroitic_Hieroglyphs */ /* PROPERTY: 'Miao': Script */ static const OnigCodePoint CR_Miao[] = { 3, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, }; /* END of CR_Miao */ /* PROPERTY: 'Mn': General Category */ static const OnigCodePoint CR_Mn[] = { 357, 0x0300, 0x036f, 0x0483, 0x0487, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x0610, 0x061a, 0x064b, 0x065f, 0x0670, 0x0670, 0x06d6, 0x06dc, 0x06df, 0x06e4, 0x06e7, 0x06e8, 0x06ea, 0x06ed, 0x0711, 0x0711, 0x0730, 0x074a, 0x07a6, 0x07b0, 0x07eb, 0x07f3, 0x07fd, 0x07fd, 0x0816, 0x0819, 0x081b, 0x0823, 0x0825, 0x0827, 0x0829, 0x082d, 0x0859, 0x085b, 0x0897, 0x089f, 0x08ca, 0x08e1, 0x08e3, 0x0902, 0x093a, 0x093a, 0x093c, 0x093c, 0x0941, 0x0948, 0x094d, 0x094d, 0x0951, 0x0957, 0x0962, 0x0963, 0x0981, 0x0981, 0x09bc, 0x09bc, 0x09c1, 0x09c4, 0x09cd, 0x09cd, 0x09e2, 0x09e3, 0x09fe, 0x09fe, 0x0a01, 0x0a02, 0x0a3c, 0x0a3c, 0x0a41, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a70, 0x0a71, 0x0a75, 0x0a75, 0x0a81, 0x0a82, 0x0abc, 0x0abc, 0x0ac1, 0x0ac5, 0x0ac7, 0x0ac8, 0x0acd, 0x0acd, 0x0ae2, 0x0ae3, 0x0afa, 0x0aff, 0x0b01, 0x0b01, 0x0b3c, 0x0b3c, 0x0b3f, 0x0b3f, 0x0b41, 0x0b44, 0x0b4d, 0x0b4d, 0x0b55, 0x0b56, 0x0b62, 0x0b63, 0x0b82, 0x0b82, 0x0bc0, 0x0bc0, 0x0bcd, 0x0bcd, 0x0c00, 0x0c00, 0x0c04, 0x0c04, 0x0c3c, 0x0c3c, 0x0c3e, 0x0c40, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c62, 0x0c63, 0x0c81, 0x0c81, 0x0cbc, 0x0cbc, 0x0cbf, 0x0cbf, 0x0cc6, 0x0cc6, 0x0ccc, 0x0ccd, 0x0ce2, 0x0ce3, 0x0d00, 0x0d01, 0x0d3b, 0x0d3c, 0x0d41, 0x0d44, 0x0d4d, 0x0d4d, 0x0d62, 0x0d63, 0x0d81, 0x0d81, 0x0dca, 0x0dca, 0x0dd2, 0x0dd4, 0x0dd6, 0x0dd6, 0x0e31, 0x0e31, 0x0e34, 0x0e3a, 0x0e47, 0x0e4e, 0x0eb1, 0x0eb1, 0x0eb4, 0x0ebc, 0x0ec8, 0x0ece, 0x0f18, 0x0f19, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f71, 0x0f7e, 0x0f80, 0x0f84, 0x0f86, 0x0f87, 0x0f8d, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x102d, 0x1030, 0x1032, 0x1037, 0x1039, 0x103a, 0x103d, 0x103e, 0x1058, 0x1059, 0x105e, 0x1060, 0x1071, 0x1074, 0x1082, 0x1082, 0x1085, 0x1086, 0x108d, 0x108d, 0x109d, 0x109d, 0x135d, 0x135f, 0x1712, 0x1714, 0x1732, 0x1733, 0x1752, 0x1753, 0x1772, 0x1773, 0x17b4, 0x17b5, 0x17b7, 0x17bd, 0x17c6, 0x17c6, 0x17c9, 0x17d3, 0x17dd, 0x17dd, 0x180b, 0x180d, 0x180f, 0x180f, 0x1885, 0x1886, 0x18a9, 0x18a9, 0x1920, 0x1922, 0x1927, 0x1928, 0x1932, 0x1932, 0x1939, 0x193b, 0x1a17, 0x1a18, 0x1a1b, 0x1a1b, 0x1a56, 0x1a56, 0x1a58, 0x1a5e, 0x1a60, 0x1a60, 0x1a62, 0x1a62, 0x1a65, 0x1a6c, 0x1a73, 0x1a7c, 0x1a7f, 0x1a7f, 0x1ab0, 0x1abd, 0x1abf, 0x1ace, 0x1b00, 0x1b03, 0x1b34, 0x1b34, 0x1b36, 0x1b3a, 0x1b3c, 0x1b3c, 0x1b42, 0x1b42, 0x1b6b, 0x1b73, 0x1b80, 0x1b81, 0x1ba2, 0x1ba5, 0x1ba8, 0x1ba9, 0x1bab, 0x1bad, 0x1be6, 0x1be6, 0x1be8, 0x1be9, 0x1bed, 0x1bed, 0x1bef, 0x1bf1, 0x1c2c, 0x1c33, 0x1c36, 0x1c37, 0x1cd0, 0x1cd2, 0x1cd4, 0x1ce0, 0x1ce2, 0x1ce8, 0x1ced, 0x1ced, 0x1cf4, 0x1cf4, 0x1cf8, 0x1cf9, 0x1dc0, 0x1dff, 0x20d0, 0x20dc, 0x20e1, 0x20e1, 0x20e5, 0x20f0, 0x2cef, 0x2cf1, 0x2d7f, 0x2d7f, 0x2de0, 0x2dff, 0x302a, 0x302d, 0x3099, 0x309a, 0xa66f, 0xa66f, 0xa674, 0xa67d, 0xa69e, 0xa69f, 0xa6f0, 0xa6f1, 0xa802, 0xa802, 0xa806, 0xa806, 0xa80b, 0xa80b, 0xa825, 0xa826, 0xa82c, 0xa82c, 0xa8c4, 0xa8c5, 0xa8e0, 0xa8f1, 0xa8ff, 0xa8ff, 0xa926, 0xa92d, 0xa947, 0xa951, 0xa980, 0xa982, 0xa9b3, 0xa9b3, 0xa9b6, 0xa9b9, 0xa9bc, 0xa9bd, 0xa9e5, 0xa9e5, 0xaa29, 0xaa2e, 0xaa31, 0xaa32, 0xaa35, 0xaa36, 0xaa43, 0xaa43, 0xaa4c, 0xaa4c, 0xaa7c, 0xaa7c, 0xaab0, 0xaab0, 0xaab2, 0xaab4, 0xaab7, 0xaab8, 0xaabe, 0xaabf, 0xaac1, 0xaac1, 0xaaec, 0xaaed, 0xaaf6, 0xaaf6, 0xabe5, 0xabe5, 0xabe8, 0xabe8, 0xabed, 0xabed, 0xfb1e, 0xfb1e, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0x101fd, 0x101fd, 0x102e0, 0x102e0, 0x10376, 0x1037a, 0x10a01, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a0f, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10ae5, 0x10ae6, 0x10d24, 0x10d27, 0x10d69, 0x10d6d, 0x10eab, 0x10eac, 0x10efc, 0x10eff, 0x10f46, 0x10f50, 0x10f82, 0x10f85, 0x11001, 0x11001, 0x11038, 0x11046, 0x11070, 0x11070, 0x11073, 0x11074, 0x1107f, 0x11081, 0x110b3, 0x110b6, 0x110b9, 0x110ba, 0x110c2, 0x110c2, 0x11100, 0x11102, 0x11127, 0x1112b, 0x1112d, 0x11134, 0x11173, 0x11173, 0x11180, 0x11181, 0x111b6, 0x111be, 0x111c9, 0x111cc, 0x111cf, 0x111cf, 0x1122f, 0x11231, 0x11234, 0x11234, 0x11236, 0x11237, 0x1123e, 0x1123e, 0x11241, 0x11241, 0x112df, 0x112df, 0x112e3, 0x112ea, 0x11300, 0x11301, 0x1133b, 0x1133c, 0x11340, 0x11340, 0x11366, 0x1136c, 0x11370, 0x11374, 0x113bb, 0x113c0, 0x113ce, 0x113ce, 0x113d0, 0x113d0, 0x113d2, 0x113d2, 0x113e1, 0x113e2, 0x11438, 0x1143f, 0x11442, 0x11444, 0x11446, 0x11446, 0x1145e, 0x1145e, 0x114b3, 0x114b8, 0x114ba, 0x114ba, 0x114bf, 0x114c0, 0x114c2, 0x114c3, 0x115b2, 0x115b5, 0x115bc, 0x115bd, 0x115bf, 0x115c0, 0x115dc, 0x115dd, 0x11633, 0x1163a, 0x1163d, 0x1163d, 0x1163f, 0x11640, 0x116ab, 0x116ab, 0x116ad, 0x116ad, 0x116b0, 0x116b5, 0x116b7, 0x116b7, 0x1171d, 0x1171d, 0x1171f, 0x1171f, 0x11722, 0x11725, 0x11727, 0x1172b, 0x1182f, 0x11837, 0x11839, 0x1183a, 0x1193b, 0x1193c, 0x1193e, 0x1193e, 0x11943, 0x11943, 0x119d4, 0x119d7, 0x119da, 0x119db, 0x119e0, 0x119e0, 0x11a01, 0x11a0a, 0x11a33, 0x11a38, 0x11a3b, 0x11a3e, 0x11a47, 0x11a47, 0x11a51, 0x11a56, 0x11a59, 0x11a5b, 0x11a8a, 0x11a96, 0x11a98, 0x11a99, 0x11c30, 0x11c36, 0x11c38, 0x11c3d, 0x11c3f, 0x11c3f, 0x11c92, 0x11ca7, 0x11caa, 0x11cb0, 0x11cb2, 0x11cb3, 0x11cb5, 0x11cb6, 0x11d31, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d45, 0x11d47, 0x11d47, 0x11d90, 0x11d91, 0x11d95, 0x11d95, 0x11d97, 0x11d97, 0x11ef3, 0x11ef4, 0x11f00, 0x11f01, 0x11f36, 0x11f3a, 0x11f40, 0x11f40, 0x11f42, 0x11f42, 0x11f5a, 0x11f5a, 0x13440, 0x13440, 0x13447, 0x13455, 0x1611e, 0x16129, 0x1612d, 0x1612f, 0x16af0, 0x16af4, 0x16b30, 0x16b36, 0x16f4f, 0x16f4f, 0x16f8f, 0x16f92, 0x16fe4, 0x16fe4, 0x1bc9d, 0x1bc9e, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d167, 0x1d169, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e08f, 0x1e08f, 0x1e130, 0x1e136, 0x1e2ae, 0x1e2ae, 0x1e2ec, 0x1e2ef, 0x1e4ec, 0x1e4ef, 0x1e5ee, 0x1e5ef, 0x1e8d0, 0x1e8d6, 0x1e944, 0x1e94a, 0xe0100, 0xe01ef, }; /* END of CR_Mn */ /* PROPERTY: 'Modi': Script */ static const OnigCodePoint CR_Modi[] = { 2, 0x11600, 0x11644, 0x11650, 0x11659, }; /* END of CR_Modi */ /* PROPERTY: 'Modifier_Combining_Mark': Binary Property */ static const OnigCodePoint CR_Modifier_Combining_Mark[] = { 9, 0x0654, 0x0655, 0x0658, 0x0658, 0x06dc, 0x06dc, 0x06e3, 0x06e3, 0x06e7, 0x06e8, 0x08ca, 0x08cb, 0x08cd, 0x08cf, 0x08d3, 0x08d3, 0x08f3, 0x08f3, }; /* END of CR_Modifier_Combining_Mark */ /* PROPERTY: 'Mongolian': Script */ static const OnigCodePoint CR_Mongolian[] = { 6, 0x1800, 0x1801, 0x1804, 0x1804, 0x1806, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x11660, 0x1166c, }; /* END of CR_Mongolian */ /* PROPERTY: 'Mro': Script */ static const OnigCodePoint CR_Mro[] = { 3, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a6e, 0x16a6f, }; /* END of CR_Mro */ /* PROPERTY: 'Multani': Script */ static const OnigCodePoint CR_Multani[] = { 5, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a9, }; /* END of CR_Multani */ /* PROPERTY: 'Myanmar': Script */ static const OnigCodePoint CR_Myanmar[] = { 4, 0x1000, 0x109f, 0xa9e0, 0xa9fe, 0xaa60, 0xaa7f, 0x116d0, 0x116e3, }; /* END of CR_Myanmar */ /* PROPERTY: 'N': Major Category */ static const OnigCodePoint CR_N[] = { 144, 0x0030, 0x0039, 0x00b2, 0x00b3, 0x00b9, 0x00b9, 0x00bc, 0x00be, 0x0660, 0x0669, 0x06f0, 0x06f9, 0x07c0, 0x07c9, 0x0966, 0x096f, 0x09e6, 0x09ef, 0x09f4, 0x09f9, 0x0a66, 0x0a6f, 0x0ae6, 0x0aef, 0x0b66, 0x0b6f, 0x0b72, 0x0b77, 0x0be6, 0x0bf2, 0x0c66, 0x0c6f, 0x0c78, 0x0c7e, 0x0ce6, 0x0cef, 0x0d58, 0x0d5e, 0x0d66, 0x0d78, 0x0de6, 0x0def, 0x0e50, 0x0e59, 0x0ed0, 0x0ed9, 0x0f20, 0x0f33, 0x1040, 0x1049, 0x1090, 0x1099, 0x1369, 0x137c, 0x16ee, 0x16f0, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x1810, 0x1819, 0x1946, 0x194f, 0x19d0, 0x19da, 0x1a80, 0x1a89, 0x1a90, 0x1a99, 0x1b50, 0x1b59, 0x1bb0, 0x1bb9, 0x1c40, 0x1c49, 0x1c50, 0x1c59, 0x2070, 0x2070, 0x2074, 0x2079, 0x2080, 0x2089, 0x2150, 0x2182, 0x2185, 0x2189, 0x2460, 0x249b, 0x24ea, 0x24ff, 0x2776, 0x2793, 0x2cfd, 0x2cfd, 0x3007, 0x3007, 0x3021, 0x3029, 0x3038, 0x303a, 0x3192, 0x3195, 0x3220, 0x3229, 0x3248, 0x324f, 0x3251, 0x325f, 0x3280, 0x3289, 0x32b1, 0x32bf, 0xa620, 0xa629, 0xa6e6, 0xa6ef, 0xa830, 0xa835, 0xa8d0, 0xa8d9, 0xa900, 0xa909, 0xa9d0, 0xa9d9, 0xa9f0, 0xa9f9, 0xaa50, 0xaa59, 0xabf0, 0xabf9, 0xff10, 0xff19, 0x10107, 0x10133, 0x10140, 0x10178, 0x1018a, 0x1018b, 0x102e1, 0x102fb, 0x10320, 0x10323, 0x10341, 0x10341, 0x1034a, 0x1034a, 0x103d1, 0x103d5, 0x104a0, 0x104a9, 0x10858, 0x1085f, 0x10879, 0x1087f, 0x108a7, 0x108af, 0x108fb, 0x108ff, 0x10916, 0x1091b, 0x109bc, 0x109bd, 0x109c0, 0x109cf, 0x109d2, 0x109ff, 0x10a40, 0x10a48, 0x10a7d, 0x10a7e, 0x10a9d, 0x10a9f, 0x10aeb, 0x10aef, 0x10b58, 0x10b5f, 0x10b78, 0x10b7f, 0x10ba9, 0x10baf, 0x10cfa, 0x10cff, 0x10d30, 0x10d39, 0x10d40, 0x10d49, 0x10e60, 0x10e7e, 0x10f1d, 0x10f26, 0x10f51, 0x10f54, 0x10fc5, 0x10fcb, 0x11052, 0x1106f, 0x110f0, 0x110f9, 0x11136, 0x1113f, 0x111d0, 0x111d9, 0x111e1, 0x111f4, 0x112f0, 0x112f9, 0x11450, 0x11459, 0x114d0, 0x114d9, 0x11650, 0x11659, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11730, 0x1173b, 0x118e0, 0x118f2, 0x11950, 0x11959, 0x11bf0, 0x11bf9, 0x11c50, 0x11c6c, 0x11d50, 0x11d59, 0x11da0, 0x11da9, 0x11f50, 0x11f59, 0x11fc0, 0x11fd4, 0x12400, 0x1246e, 0x16130, 0x16139, 0x16a60, 0x16a69, 0x16ac0, 0x16ac9, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16d70, 0x16d79, 0x16e80, 0x16e96, 0x1ccf0, 0x1ccf9, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d360, 0x1d378, 0x1d7ce, 0x1d7ff, 0x1e140, 0x1e149, 0x1e2f0, 0x1e2f9, 0x1e4f0, 0x1e4f9, 0x1e5f1, 0x1e5fa, 0x1e8c7, 0x1e8cf, 0x1e950, 0x1e959, 0x1ec71, 0x1ecab, 0x1ecad, 0x1ecaf, 0x1ecb1, 0x1ecb4, 0x1ed01, 0x1ed2d, 0x1ed2f, 0x1ed3d, 0x1f100, 0x1f10c, 0x1fbf0, 0x1fbf9, }; /* END of CR_N */ /* PROPERTY: 'Nabataean': Script */ static const OnigCodePoint CR_Nabataean[] = { 2, 0x10880, 0x1089e, 0x108a7, 0x108af, }; /* END of CR_Nabataean */ /* PROPERTY: 'Nag_Mundari': Script */ static const OnigCodePoint CR_Nag_Mundari[] = { 1, 0x1e4d0, 0x1e4f9, }; /* END of CR_Nag_Mundari */ /* PROPERTY: 'Nandinagari': Script */ static const OnigCodePoint CR_Nandinagari[] = { 3, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e4, }; /* END of CR_Nandinagari */ /* PROPERTY: 'Nd': General Category */ #define CR_Nd CR_Digit /* PROPERTY: 'New_Tai_Lue': Script */ static const OnigCodePoint CR_New_Tai_Lue[] = { 4, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x19de, 0x19df, }; /* END of CR_New_Tai_Lue */ /* PROPERTY: 'Newa': Script */ static const OnigCodePoint CR_Newa[] = { 2, 0x11400, 0x1145b, 0x1145d, 0x11461, }; /* END of CR_Newa */ /* PROPERTY: 'Nko': Script */ static const OnigCodePoint CR_Nko[] = { 2, 0x07c0, 0x07fa, 0x07fd, 0x07ff, }; /* END of CR_Nko */ /* PROPERTY: 'Nl': General Category */ static const OnigCodePoint CR_Nl[] = { 12, 0x16ee, 0x16f0, 0x2160, 0x2182, 0x2185, 0x2188, 0x3007, 0x3007, 0x3021, 0x3029, 0x3038, 0x303a, 0xa6e6, 0xa6ef, 0x10140, 0x10174, 0x10341, 0x10341, 0x1034a, 0x1034a, 0x103d1, 0x103d5, 0x12400, 0x1246e, }; /* END of CR_Nl */ /* PROPERTY: 'No': General Category */ static const OnigCodePoint CR_No[] = { 72, 0x00b2, 0x00b3, 0x00b9, 0x00b9, 0x00bc, 0x00be, 0x09f4, 0x09f9, 0x0b72, 0x0b77, 0x0bf0, 0x0bf2, 0x0c78, 0x0c7e, 0x0d58, 0x0d5e, 0x0d70, 0x0d78, 0x0f2a, 0x0f33, 0x1369, 0x137c, 0x17f0, 0x17f9, 0x19da, 0x19da, 0x2070, 0x2070, 0x2074, 0x2079, 0x2080, 0x2089, 0x2150, 0x215f, 0x2189, 0x2189, 0x2460, 0x249b, 0x24ea, 0x24ff, 0x2776, 0x2793, 0x2cfd, 0x2cfd, 0x3192, 0x3195, 0x3220, 0x3229, 0x3248, 0x324f, 0x3251, 0x325f, 0x3280, 0x3289, 0x32b1, 0x32bf, 0xa830, 0xa835, 0x10107, 0x10133, 0x10175, 0x10178, 0x1018a, 0x1018b, 0x102e1, 0x102fb, 0x10320, 0x10323, 0x10858, 0x1085f, 0x10879, 0x1087f, 0x108a7, 0x108af, 0x108fb, 0x108ff, 0x10916, 0x1091b, 0x109bc, 0x109bd, 0x109c0, 0x109cf, 0x109d2, 0x109ff, 0x10a40, 0x10a48, 0x10a7d, 0x10a7e, 0x10a9d, 0x10a9f, 0x10aeb, 0x10aef, 0x10b58, 0x10b5f, 0x10b78, 0x10b7f, 0x10ba9, 0x10baf, 0x10cfa, 0x10cff, 0x10e60, 0x10e7e, 0x10f1d, 0x10f26, 0x10f51, 0x10f54, 0x10fc5, 0x10fcb, 0x11052, 0x11065, 0x111e1, 0x111f4, 0x1173a, 0x1173b, 0x118ea, 0x118f2, 0x11c5a, 0x11c6c, 0x11fc0, 0x11fd4, 0x16b5b, 0x16b61, 0x16e80, 0x16e96, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d360, 0x1d378, 0x1e8c7, 0x1e8cf, 0x1ec71, 0x1ecab, 0x1ecad, 0x1ecaf, 0x1ecb1, 0x1ecb4, 0x1ed01, 0x1ed2d, 0x1ed2f, 0x1ed3d, 0x1f100, 0x1f10c, }; /* END of CR_No */ /* PROPERTY: 'Noncharacter_Code_Point': Binary Property */ static const OnigCodePoint CR_Noncharacter_Code_Point[] = { 18, 0xfdd0, 0xfdef, 0xfffe, 0xffff, 0x1fffe, 0x1ffff, 0x2fffe, 0x2ffff, 0x3fffe, 0x3ffff, 0x4fffe, 0x4ffff, 0x5fffe, 0x5ffff, 0x6fffe, 0x6ffff, 0x7fffe, 0x7ffff, 0x8fffe, 0x8ffff, 0x9fffe, 0x9ffff, 0xafffe, 0xaffff, 0xbfffe, 0xbffff, 0xcfffe, 0xcffff, 0xdfffe, 0xdffff, 0xefffe, 0xeffff, 0xffffe, 0xfffff, 0x10fffe, 0x10ffff, }; /* END of CR_Noncharacter_Code_Point */ /* PROPERTY: 'Nushu': Script */ static const OnigCodePoint CR_Nushu[] = { 2, 0x16fe1, 0x16fe1, 0x1b170, 0x1b2fb, }; /* END of CR_Nushu */ /* PROPERTY: 'Nyiakeng_Puachue_Hmong': Script */ static const OnigCodePoint CR_Nyiakeng_Puachue_Hmong[] = { 4, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14f, }; /* END of CR_Nyiakeng_Puachue_Hmong */ /* PROPERTY: 'Ogham': Script */ static const OnigCodePoint CR_Ogham[] = { 1, 0x1680, 0x169c, }; /* END of CR_Ogham */ /* PROPERTY: 'Ol_Chiki': Script */ static const OnigCodePoint CR_Ol_Chiki[] = { 1, 0x1c50, 0x1c7f, }; /* END of CR_Ol_Chiki */ /* PROPERTY: 'Ol_Onal': Script */ static const OnigCodePoint CR_Ol_Onal[] = { 2, 0x1e5d0, 0x1e5fa, 0x1e5ff, 0x1e5ff, }; /* END of CR_Ol_Onal */ /* PROPERTY: 'Old_Hungarian': Script */ static const OnigCodePoint CR_Old_Hungarian[] = { 3, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10cfa, 0x10cff, }; /* END of CR_Old_Hungarian */ /* PROPERTY: 'Old_Italic': Script */ static const OnigCodePoint CR_Old_Italic[] = { 2, 0x10300, 0x10323, 0x1032d, 0x1032f, }; /* END of CR_Old_Italic */ /* PROPERTY: 'Old_North_Arabian': Script */ static const OnigCodePoint CR_Old_North_Arabian[] = { 1, 0x10a80, 0x10a9f, }; /* END of CR_Old_North_Arabian */ /* PROPERTY: 'Old_Permic': Script */ static const OnigCodePoint CR_Old_Permic[] = { 1, 0x10350, 0x1037a, }; /* END of CR_Old_Permic */ /* PROPERTY: 'Old_Persian': Script */ static const OnigCodePoint CR_Old_Persian[] = { 2, 0x103a0, 0x103c3, 0x103c8, 0x103d5, }; /* END of CR_Old_Persian */ /* PROPERTY: 'Old_Sogdian': Script */ static const OnigCodePoint CR_Old_Sogdian[] = { 1, 0x10f00, 0x10f27, }; /* END of CR_Old_Sogdian */ /* PROPERTY: 'Old_South_Arabian': Script */ static const OnigCodePoint CR_Old_South_Arabian[] = { 1, 0x10a60, 0x10a7f, }; /* END of CR_Old_South_Arabian */ /* PROPERTY: 'Old_Turkic': Script */ static const OnigCodePoint CR_Old_Turkic[] = { 1, 0x10c00, 0x10c48, }; /* END of CR_Old_Turkic */ /* PROPERTY: 'Old_Uyghur': Script */ static const OnigCodePoint CR_Old_Uyghur[] = { 1, 0x10f70, 0x10f89, }; /* END of CR_Old_Uyghur */ /* PROPERTY: 'Oriya': Script */ static const OnigCodePoint CR_Oriya[] = { 14, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b77, }; /* END of CR_Oriya */ /* PROPERTY: 'Osage': Script */ static const OnigCodePoint CR_Osage[] = { 2, 0x104b0, 0x104d3, 0x104d8, 0x104fb, }; /* END of CR_Osage */ /* PROPERTY: 'Osmanya': Script */ static const OnigCodePoint CR_Osmanya[] = { 2, 0x10480, 0x1049d, 0x104a0, 0x104a9, }; /* END of CR_Osmanya */ /* PROPERTY: 'Other_Alphabetic': Binary Property */ static const OnigCodePoint CR_Other_Alphabetic[] = { 250, 0x0345, 0x0345, 0x0363, 0x036f, 0x05b0, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x0610, 0x061a, 0x064b, 0x0657, 0x0659, 0x065f, 0x0670, 0x0670, 0x06d6, 0x06dc, 0x06e1, 0x06e4, 0x06e7, 0x06e8, 0x06ed, 0x06ed, 0x0711, 0x0711, 0x0730, 0x073f, 0x07a6, 0x07b0, 0x0816, 0x0817, 0x081b, 0x0823, 0x0825, 0x0827, 0x0829, 0x082c, 0x0897, 0x0897, 0x08d4, 0x08df, 0x08e3, 0x08e9, 0x08f0, 0x0903, 0x093a, 0x093b, 0x093e, 0x094c, 0x094e, 0x094f, 0x0955, 0x0957, 0x0962, 0x0963, 0x0981, 0x0983, 0x09be, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09cc, 0x09d7, 0x09d7, 0x09e2, 0x09e3, 0x0a01, 0x0a03, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4c, 0x0a51, 0x0a51, 0x0a70, 0x0a71, 0x0a75, 0x0a75, 0x0a81, 0x0a83, 0x0abe, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acc, 0x0ae2, 0x0ae3, 0x0afa, 0x0afc, 0x0b01, 0x0b03, 0x0b3e, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4c, 0x0b56, 0x0b57, 0x0b62, 0x0b63, 0x0b82, 0x0b82, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcc, 0x0bd7, 0x0bd7, 0x0c00, 0x0c04, 0x0c3e, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4c, 0x0c55, 0x0c56, 0x0c62, 0x0c63, 0x0c81, 0x0c83, 0x0cbe, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccc, 0x0cd5, 0x0cd6, 0x0ce2, 0x0ce3, 0x0cf3, 0x0cf3, 0x0d00, 0x0d03, 0x0d3e, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4c, 0x0d57, 0x0d57, 0x0d62, 0x0d63, 0x0d81, 0x0d83, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0df2, 0x0df3, 0x0e31, 0x0e31, 0x0e34, 0x0e3a, 0x0e4d, 0x0e4d, 0x0eb1, 0x0eb1, 0x0eb4, 0x0eb9, 0x0ebb, 0x0ebc, 0x0ecd, 0x0ecd, 0x0f71, 0x0f83, 0x0f8d, 0x0f97, 0x0f99, 0x0fbc, 0x102b, 0x1036, 0x1038, 0x1038, 0x103b, 0x103e, 0x1056, 0x1059, 0x105e, 0x1060, 0x1062, 0x1064, 0x1067, 0x106d, 0x1071, 0x1074, 0x1082, 0x108d, 0x108f, 0x108f, 0x109a, 0x109d, 0x1712, 0x1713, 0x1732, 0x1733, 0x1752, 0x1753, 0x1772, 0x1773, 0x17b6, 0x17c8, 0x1885, 0x1886, 0x18a9, 0x18a9, 0x1920, 0x192b, 0x1930, 0x1938, 0x1a17, 0x1a1b, 0x1a55, 0x1a5e, 0x1a61, 0x1a74, 0x1abf, 0x1ac0, 0x1acc, 0x1ace, 0x1b00, 0x1b04, 0x1b35, 0x1b43, 0x1b80, 0x1b82, 0x1ba1, 0x1ba9, 0x1bac, 0x1bad, 0x1be7, 0x1bf1, 0x1c24, 0x1c36, 0x1dd3, 0x1df4, 0x24b6, 0x24e9, 0x2de0, 0x2dff, 0xa674, 0xa67b, 0xa69e, 0xa69f, 0xa802, 0xa802, 0xa80b, 0xa80b, 0xa823, 0xa827, 0xa880, 0xa881, 0xa8b4, 0xa8c3, 0xa8c5, 0xa8c5, 0xa8ff, 0xa8ff, 0xa926, 0xa92a, 0xa947, 0xa952, 0xa980, 0xa983, 0xa9b4, 0xa9bf, 0xa9e5, 0xa9e5, 0xaa29, 0xaa36, 0xaa43, 0xaa43, 0xaa4c, 0xaa4d, 0xaa7b, 0xaa7d, 0xaab0, 0xaab0, 0xaab2, 0xaab4, 0xaab7, 0xaab8, 0xaabe, 0xaabe, 0xaaeb, 0xaaef, 0xaaf5, 0xaaf5, 0xabe3, 0xabea, 0xfb1e, 0xfb1e, 0x10376, 0x1037a, 0x10a01, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a0f, 0x10d24, 0x10d27, 0x10d69, 0x10d69, 0x10eab, 0x10eac, 0x10efc, 0x10efc, 0x11000, 0x11002, 0x11038, 0x11045, 0x11073, 0x11074, 0x11080, 0x11082, 0x110b0, 0x110b8, 0x110c2, 0x110c2, 0x11100, 0x11102, 0x11127, 0x11132, 0x11145, 0x11146, 0x11180, 0x11182, 0x111b3, 0x111bf, 0x111ce, 0x111cf, 0x1122c, 0x11234, 0x11237, 0x11237, 0x1123e, 0x1123e, 0x11241, 0x11241, 0x112df, 0x112e8, 0x11300, 0x11303, 0x1133e, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134c, 0x11357, 0x11357, 0x11362, 0x11363, 0x113b8, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113cd, 0x11435, 0x11441, 0x11443, 0x11445, 0x114b0, 0x114c1, 0x115af, 0x115b5, 0x115b8, 0x115be, 0x115dc, 0x115dd, 0x11630, 0x1163e, 0x11640, 0x11640, 0x116ab, 0x116b5, 0x1171d, 0x1172a, 0x1182c, 0x11838, 0x11930, 0x11935, 0x11937, 0x11938, 0x1193b, 0x1193c, 0x11940, 0x11940, 0x11942, 0x11942, 0x119d1, 0x119d7, 0x119da, 0x119df, 0x119e4, 0x119e4, 0x11a01, 0x11a0a, 0x11a35, 0x11a39, 0x11a3b, 0x11a3e, 0x11a51, 0x11a5b, 0x11a8a, 0x11a97, 0x11c2f, 0x11c36, 0x11c38, 0x11c3e, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d31, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d41, 0x11d43, 0x11d43, 0x11d47, 0x11d47, 0x11d8a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d96, 0x11ef3, 0x11ef6, 0x11f00, 0x11f01, 0x11f03, 0x11f03, 0x11f34, 0x11f3a, 0x11f3e, 0x11f40, 0x1611e, 0x1612e, 0x16f4f, 0x16f4f, 0x16f51, 0x16f87, 0x16f8f, 0x16f92, 0x16ff0, 0x16ff1, 0x1bc9e, 0x1bc9e, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e08f, 0x1e08f, 0x1e947, 0x1e947, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, }; /* END of CR_Other_Alphabetic */ /* PROPERTY: 'Other_Default_Ignorable_Code_Point': Binary Property */ static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = { 11, 0x034f, 0x034f, 0x115f, 0x1160, 0x17b4, 0x17b5, 0x2065, 0x2065, 0x3164, 0x3164, 0xffa0, 0xffa0, 0xfff0, 0xfff8, 0xe0000, 0xe0000, 0xe0002, 0xe001f, 0xe0080, 0xe00ff, 0xe01f0, 0xe0fff, }; /* END of CR_Other_Default_Ignorable_Code_Point */ /* PROPERTY: 'Other_Grapheme_Extend': Binary Property */ static const OnigCodePoint CR_Other_Grapheme_Extend[] = { 49, 0x09be, 0x09be, 0x09d7, 0x09d7, 0x0b3e, 0x0b3e, 0x0b57, 0x0b57, 0x0bbe, 0x0bbe, 0x0bd7, 0x0bd7, 0x0cc0, 0x0cc0, 0x0cc2, 0x0cc2, 0x0cc7, 0x0cc8, 0x0cca, 0x0ccb, 0x0cd5, 0x0cd6, 0x0d3e, 0x0d3e, 0x0d57, 0x0d57, 0x0dcf, 0x0dcf, 0x0ddf, 0x0ddf, 0x1715, 0x1715, 0x1734, 0x1734, 0x1b35, 0x1b35, 0x1b3b, 0x1b3b, 0x1b3d, 0x1b3d, 0x1b43, 0x1b44, 0x1baa, 0x1baa, 0x1bf2, 0x1bf3, 0x200c, 0x200c, 0x302e, 0x302f, 0xa953, 0xa953, 0xa9c0, 0xa9c0, 0xff9e, 0xff9f, 0x111c0, 0x111c0, 0x11235, 0x11235, 0x1133e, 0x1133e, 0x1134d, 0x1134d, 0x11357, 0x11357, 0x113b8, 0x113b8, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113c9, 0x113cf, 0x113cf, 0x114b0, 0x114b0, 0x114bd, 0x114bd, 0x115af, 0x115af, 0x116b6, 0x116b6, 0x11930, 0x11930, 0x1193d, 0x1193d, 0x11f41, 0x11f41, 0x16ff0, 0x16ff1, 0x1d165, 0x1d166, 0x1d16d, 0x1d172, 0xe0020, 0xe007f, }; /* END of CR_Other_Grapheme_Extend */ /* PROPERTY: 'Other_ID_Continue': Binary Property */ static const OnigCodePoint CR_Other_ID_Continue[] = { 7, 0x00b7, 0x00b7, 0x0387, 0x0387, 0x1369, 0x1371, 0x19da, 0x19da, 0x200c, 0x200d, 0x30fb, 0x30fb, 0xff65, 0xff65, }; /* END of CR_Other_ID_Continue */ /* PROPERTY: 'Other_ID_Start': Binary Property */ static const OnigCodePoint CR_Other_ID_Start[] = { 4, 0x1885, 0x1886, 0x2118, 0x2118, 0x212e, 0x212e, 0x309b, 0x309c, }; /* END of CR_Other_ID_Start */ /* PROPERTY: 'Other_Lowercase': Binary Property */ static const OnigCodePoint CR_Other_Lowercase[] = { 28, 0x00aa, 0x00aa, 0x00ba, 0x00ba, 0x02b0, 0x02b8, 0x02c0, 0x02c1, 0x02e0, 0x02e4, 0x0345, 0x0345, 0x037a, 0x037a, 0x10fc, 0x10fc, 0x1d2c, 0x1d6a, 0x1d78, 0x1d78, 0x1d9b, 0x1dbf, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2170, 0x217f, 0x24d0, 0x24e9, 0x2c7c, 0x2c7d, 0xa69c, 0xa69d, 0xa770, 0xa770, 0xa7f2, 0xa7f4, 0xa7f8, 0xa7f9, 0xab5c, 0xab5f, 0xab69, 0xab69, 0x10780, 0x10780, 0x10783, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x1e030, 0x1e06d, }; /* END of CR_Other_Lowercase */ /* PROPERTY: 'Other_Math': Binary Property */ static const OnigCodePoint CR_Other_Math[] = { 134, 0x005e, 0x005e, 0x03d0, 0x03d2, 0x03d5, 0x03d5, 0x03f0, 0x03f1, 0x03f4, 0x03f5, 0x2016, 0x2016, 0x2032, 0x2034, 0x2040, 0x2040, 0x2061, 0x2064, 0x207d, 0x207e, 0x208d, 0x208e, 0x20d0, 0x20dc, 0x20e1, 0x20e1, 0x20e5, 0x20e6, 0x20eb, 0x20ef, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2128, 0x2129, 0x212c, 0x212d, 0x212f, 0x2131, 0x2133, 0x2138, 0x213c, 0x213f, 0x2145, 0x2149, 0x2195, 0x2199, 0x219c, 0x219f, 0x21a1, 0x21a2, 0x21a4, 0x21a5, 0x21a7, 0x21a7, 0x21a9, 0x21ad, 0x21b0, 0x21b1, 0x21b6, 0x21b7, 0x21bc, 0x21cd, 0x21d0, 0x21d1, 0x21d3, 0x21d3, 0x21d5, 0x21db, 0x21dd, 0x21dd, 0x21e4, 0x21e5, 0x2308, 0x230b, 0x23b4, 0x23b5, 0x23b7, 0x23b7, 0x23d0, 0x23d0, 0x23e2, 0x23e2, 0x25a0, 0x25a1, 0x25ae, 0x25b6, 0x25bc, 0x25c0, 0x25c6, 0x25c7, 0x25ca, 0x25cb, 0x25cf, 0x25d3, 0x25e2, 0x25e2, 0x25e4, 0x25e4, 0x25e7, 0x25ec, 0x2605, 0x2606, 0x2640, 0x2640, 0x2642, 0x2642, 0x2660, 0x2663, 0x266d, 0x266e, 0x27c5, 0x27c6, 0x27e6, 0x27ef, 0x2983, 0x2998, 0x29d8, 0x29db, 0x29fc, 0x29fd, 0xfe61, 0xfe61, 0xfe63, 0xfe63, 0xfe68, 0xfe68, 0xff3c, 0xff3c, 0xff3e, 0xff3e, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, }; /* END of CR_Other_Math */ /* PROPERTY: 'Other_Uppercase': Binary Property */ static const OnigCodePoint CR_Other_Uppercase[] = { 5, 0x2160, 0x216f, 0x24b6, 0x24cf, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, }; /* END of CR_Other_Uppercase */ /* PROPERTY: 'P': Major Category */ static const OnigCodePoint CR_P[] = { 198, 0x0021, 0x0023, 0x0025, 0x002a, 0x002c, 0x002f, 0x003a, 0x003b, 0x003f, 0x0040, 0x005b, 0x005d, 0x005f, 0x005f, 0x007b, 0x007b, 0x007d, 0x007d, 0x00a1, 0x00a1, 0x00a7, 0x00a7, 0x00ab, 0x00ab, 0x00b6, 0x00b7, 0x00bb, 0x00bb, 0x00bf, 0x00bf, 0x037e, 0x037e, 0x0387, 0x0387, 0x055a, 0x055f, 0x0589, 0x058a, 0x05be, 0x05be, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05c6, 0x05c6, 0x05f3, 0x05f4, 0x0609, 0x060a, 0x060c, 0x060d, 0x061b, 0x061b, 0x061d, 0x061f, 0x066a, 0x066d, 0x06d4, 0x06d4, 0x0700, 0x070d, 0x07f7, 0x07f9, 0x0830, 0x083e, 0x085e, 0x085e, 0x0964, 0x0965, 0x0970, 0x0970, 0x09fd, 0x09fd, 0x0a76, 0x0a76, 0x0af0, 0x0af0, 0x0c77, 0x0c77, 0x0c84, 0x0c84, 0x0df4, 0x0df4, 0x0e4f, 0x0e4f, 0x0e5a, 0x0e5b, 0x0f04, 0x0f12, 0x0f14, 0x0f14, 0x0f3a, 0x0f3d, 0x0f85, 0x0f85, 0x0fd0, 0x0fd4, 0x0fd9, 0x0fda, 0x104a, 0x104f, 0x10fb, 0x10fb, 0x1360, 0x1368, 0x1400, 0x1400, 0x166e, 0x166e, 0x169b, 0x169c, 0x16eb, 0x16ed, 0x1735, 0x1736, 0x17d4, 0x17d6, 0x17d8, 0x17da, 0x1800, 0x180a, 0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1aa0, 0x1aa6, 0x1aa8, 0x1aad, 0x1b4e, 0x1b4f, 0x1b5a, 0x1b60, 0x1b7d, 0x1b7f, 0x1bfc, 0x1bff, 0x1c3b, 0x1c3f, 0x1c7e, 0x1c7f, 0x1cc0, 0x1cc7, 0x1cd3, 0x1cd3, 0x2010, 0x2027, 0x2030, 0x2043, 0x2045, 0x2051, 0x2053, 0x205e, 0x207d, 0x207e, 0x208d, 0x208e, 0x2308, 0x230b, 0x2329, 0x232a, 0x2768, 0x2775, 0x27c5, 0x27c6, 0x27e6, 0x27ef, 0x2983, 0x2998, 0x29d8, 0x29db, 0x29fc, 0x29fd, 0x2cf9, 0x2cfc, 0x2cfe, 0x2cff, 0x2d70, 0x2d70, 0x2e00, 0x2e2e, 0x2e30, 0x2e4f, 0x2e52, 0x2e5d, 0x3001, 0x3003, 0x3008, 0x3011, 0x3014, 0x301f, 0x3030, 0x3030, 0x303d, 0x303d, 0x30a0, 0x30a0, 0x30fb, 0x30fb, 0xa4fe, 0xa4ff, 0xa60d, 0xa60f, 0xa673, 0xa673, 0xa67e, 0xa67e, 0xa6f2, 0xa6f7, 0xa874, 0xa877, 0xa8ce, 0xa8cf, 0xa8f8, 0xa8fa, 0xa8fc, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa95f, 0xa9c1, 0xa9cd, 0xa9de, 0xa9df, 0xaa5c, 0xaa5f, 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xabeb, 0xfd3e, 0xfd3f, 0xfe10, 0xfe19, 0xfe30, 0xfe52, 0xfe54, 0xfe61, 0xfe63, 0xfe63, 0xfe68, 0xfe68, 0xfe6a, 0xfe6b, 0xff01, 0xff03, 0xff05, 0xff0a, 0xff0c, 0xff0f, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3b, 0xff3d, 0xff3f, 0xff3f, 0xff5b, 0xff5b, 0xff5d, 0xff5d, 0xff5f, 0xff65, 0x10100, 0x10102, 0x1039f, 0x1039f, 0x103d0, 0x103d0, 0x1056f, 0x1056f, 0x10857, 0x10857, 0x1091f, 0x1091f, 0x1093f, 0x1093f, 0x10a50, 0x10a58, 0x10a7f, 0x10a7f, 0x10af0, 0x10af6, 0x10b39, 0x10b3f, 0x10b99, 0x10b9c, 0x10d6e, 0x10d6e, 0x10ead, 0x10ead, 0x10f55, 0x10f59, 0x10f86, 0x10f89, 0x11047, 0x1104d, 0x110bb, 0x110bc, 0x110be, 0x110c1, 0x11140, 0x11143, 0x11174, 0x11175, 0x111c5, 0x111c8, 0x111cd, 0x111cd, 0x111db, 0x111db, 0x111dd, 0x111df, 0x11238, 0x1123d, 0x112a9, 0x112a9, 0x113d4, 0x113d5, 0x113d7, 0x113d8, 0x1144b, 0x1144f, 0x1145a, 0x1145b, 0x1145d, 0x1145d, 0x114c6, 0x114c6, 0x115c1, 0x115d7, 0x11641, 0x11643, 0x11660, 0x1166c, 0x116b9, 0x116b9, 0x1173c, 0x1173e, 0x1183b, 0x1183b, 0x11944, 0x11946, 0x119e2, 0x119e2, 0x11a3f, 0x11a46, 0x11a9a, 0x11a9c, 0x11a9e, 0x11aa2, 0x11b00, 0x11b09, 0x11be1, 0x11be1, 0x11c41, 0x11c45, 0x11c70, 0x11c71, 0x11ef7, 0x11ef8, 0x11f43, 0x11f4f, 0x11fff, 0x11fff, 0x12470, 0x12474, 0x12ff1, 0x12ff2, 0x16a6e, 0x16a6f, 0x16af5, 0x16af5, 0x16b37, 0x16b3b, 0x16b44, 0x16b44, 0x16d6d, 0x16d6f, 0x16e97, 0x16e9a, 0x16fe2, 0x16fe2, 0x1bc9f, 0x1bc9f, 0x1da87, 0x1da8b, 0x1e5ff, 0x1e5ff, 0x1e95e, 0x1e95f, }; /* END of CR_P */ /* PROPERTY: 'Pahawh_Hmong': Script */ static const OnigCodePoint CR_Pahawh_Hmong[] = { 5, 0x16b00, 0x16b45, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, }; /* END of CR_Pahawh_Hmong */ /* PROPERTY: 'Palmyrene': Script */ static const OnigCodePoint CR_Palmyrene[] = { 1, 0x10860, 0x1087f, }; /* END of CR_Palmyrene */ /* PROPERTY: 'Pattern_Syntax': Binary Property */ static const OnigCodePoint CR_Pattern_Syntax[] = { 28, 0x0021, 0x002f, 0x003a, 0x0040, 0x005b, 0x005e, 0x0060, 0x0060, 0x007b, 0x007e, 0x00a1, 0x00a7, 0x00a9, 0x00a9, 0x00ab, 0x00ac, 0x00ae, 0x00ae, 0x00b0, 0x00b1, 0x00b6, 0x00b6, 0x00bb, 0x00bb, 0x00bf, 0x00bf, 0x00d7, 0x00d7, 0x00f7, 0x00f7, 0x2010, 0x2027, 0x2030, 0x203e, 0x2041, 0x2053, 0x2055, 0x205e, 0x2190, 0x245f, 0x2500, 0x2775, 0x2794, 0x2bff, 0x2e00, 0x2e7f, 0x3001, 0x3003, 0x3008, 0x3020, 0x3030, 0x3030, 0xfd3e, 0xfd3f, 0xfe45, 0xfe46, }; /* END of CR_Pattern_Syntax */ /* PROPERTY: 'Pattern_White_Space': Binary Property */ static const OnigCodePoint CR_Pattern_White_Space[] = { 5, 0x0009, 0x000d, 0x0020, 0x0020, 0x0085, 0x0085, 0x200e, 0x200f, 0x2028, 0x2029, }; /* END of CR_Pattern_White_Space */ /* PROPERTY: 'Pau_Cin_Hau': Script */ static const OnigCodePoint CR_Pau_Cin_Hau[] = { 1, 0x11ac0, 0x11af8, }; /* END of CR_Pau_Cin_Hau */ /* PROPERTY: 'Pc': General Category */ static const OnigCodePoint CR_Pc[] = { 6, 0x005f, 0x005f, 0x203f, 0x2040, 0x2054, 0x2054, 0xfe33, 0xfe34, 0xfe4d, 0xfe4f, 0xff3f, 0xff3f, }; /* END of CR_Pc */ /* PROPERTY: 'Pd': General Category */ static const OnigCodePoint CR_Pd[] = { 20, 0x002d, 0x002d, 0x058a, 0x058a, 0x05be, 0x05be, 0x1400, 0x1400, 0x1806, 0x1806, 0x2010, 0x2015, 0x2e17, 0x2e17, 0x2e1a, 0x2e1a, 0x2e3a, 0x2e3b, 0x2e40, 0x2e40, 0x2e5d, 0x2e5d, 0x301c, 0x301c, 0x3030, 0x3030, 0x30a0, 0x30a0, 0xfe31, 0xfe32, 0xfe58, 0xfe58, 0xfe63, 0xfe63, 0xff0d, 0xff0d, 0x10d6e, 0x10d6e, 0x10ead, 0x10ead, }; /* END of CR_Pd */ /* PROPERTY: 'Pe': General Category */ static const OnigCodePoint CR_Pe[] = { 76, 0x0029, 0x0029, 0x005d, 0x005d, 0x007d, 0x007d, 0x0f3b, 0x0f3b, 0x0f3d, 0x0f3d, 0x169c, 0x169c, 0x2046, 0x2046, 0x207e, 0x207e, 0x208e, 0x208e, 0x2309, 0x2309, 0x230b, 0x230b, 0x232a, 0x232a, 0x2769, 0x2769, 0x276b, 0x276b, 0x276d, 0x276d, 0x276f, 0x276f, 0x2771, 0x2771, 0x2773, 0x2773, 0x2775, 0x2775, 0x27c6, 0x27c6, 0x27e7, 0x27e7, 0x27e9, 0x27e9, 0x27eb, 0x27eb, 0x27ed, 0x27ed, 0x27ef, 0x27ef, 0x2984, 0x2984, 0x2986, 0x2986, 0x2988, 0x2988, 0x298a, 0x298a, 0x298c, 0x298c, 0x298e, 0x298e, 0x2990, 0x2990, 0x2992, 0x2992, 0x2994, 0x2994, 0x2996, 0x2996, 0x2998, 0x2998, 0x29d9, 0x29d9, 0x29db, 0x29db, 0x29fd, 0x29fd, 0x2e23, 0x2e23, 0x2e25, 0x2e25, 0x2e27, 0x2e27, 0x2e29, 0x2e29, 0x2e56, 0x2e56, 0x2e58, 0x2e58, 0x2e5a, 0x2e5a, 0x2e5c, 0x2e5c, 0x3009, 0x3009, 0x300b, 0x300b, 0x300d, 0x300d, 0x300f, 0x300f, 0x3011, 0x3011, 0x3015, 0x3015, 0x3017, 0x3017, 0x3019, 0x3019, 0x301b, 0x301b, 0x301e, 0x301f, 0xfd3e, 0xfd3e, 0xfe18, 0xfe18, 0xfe36, 0xfe36, 0xfe38, 0xfe38, 0xfe3a, 0xfe3a, 0xfe3c, 0xfe3c, 0xfe3e, 0xfe3e, 0xfe40, 0xfe40, 0xfe42, 0xfe42, 0xfe44, 0xfe44, 0xfe48, 0xfe48, 0xfe5a, 0xfe5a, 0xfe5c, 0xfe5c, 0xfe5e, 0xfe5e, 0xff09, 0xff09, 0xff3d, 0xff3d, 0xff5d, 0xff5d, 0xff60, 0xff60, 0xff63, 0xff63, }; /* END of CR_Pe */ /* PROPERTY: 'Pf': General Category */ static const OnigCodePoint CR_Pf[] = { 10, 0x00bb, 0x00bb, 0x2019, 0x2019, 0x201d, 0x201d, 0x203a, 0x203a, 0x2e03, 0x2e03, 0x2e05, 0x2e05, 0x2e0a, 0x2e0a, 0x2e0d, 0x2e0d, 0x2e1d, 0x2e1d, 0x2e21, 0x2e21, }; /* END of CR_Pf */ /* PROPERTY: 'Phags_Pa': Script */ static const OnigCodePoint CR_Phags_Pa[] = { 1, 0xa840, 0xa877, }; /* END of CR_Phags_Pa */ /* PROPERTY: 'Phoenician': Script */ static const OnigCodePoint CR_Phoenician[] = { 2, 0x10900, 0x1091b, 0x1091f, 0x1091f, }; /* END of CR_Phoenician */ /* PROPERTY: 'Pi': General Category */ static const OnigCodePoint CR_Pi[] = { 11, 0x00ab, 0x00ab, 0x2018, 0x2018, 0x201b, 0x201c, 0x201f, 0x201f, 0x2039, 0x2039, 0x2e02, 0x2e02, 0x2e04, 0x2e04, 0x2e09, 0x2e09, 0x2e0c, 0x2e0c, 0x2e1c, 0x2e1c, 0x2e20, 0x2e20, }; /* END of CR_Pi */ /* PROPERTY: 'Po': General Category */ static const OnigCodePoint CR_Po[] = { 193, 0x0021, 0x0023, 0x0025, 0x0027, 0x002a, 0x002a, 0x002c, 0x002c, 0x002e, 0x002f, 0x003a, 0x003b, 0x003f, 0x0040, 0x005c, 0x005c, 0x00a1, 0x00a1, 0x00a7, 0x00a7, 0x00b6, 0x00b7, 0x00bf, 0x00bf, 0x037e, 0x037e, 0x0387, 0x0387, 0x055a, 0x055f, 0x0589, 0x0589, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05c6, 0x05c6, 0x05f3, 0x05f4, 0x0609, 0x060a, 0x060c, 0x060d, 0x061b, 0x061b, 0x061d, 0x061f, 0x066a, 0x066d, 0x06d4, 0x06d4, 0x0700, 0x070d, 0x07f7, 0x07f9, 0x0830, 0x083e, 0x085e, 0x085e, 0x0964, 0x0965, 0x0970, 0x0970, 0x09fd, 0x09fd, 0x0a76, 0x0a76, 0x0af0, 0x0af0, 0x0c77, 0x0c77, 0x0c84, 0x0c84, 0x0df4, 0x0df4, 0x0e4f, 0x0e4f, 0x0e5a, 0x0e5b, 0x0f04, 0x0f12, 0x0f14, 0x0f14, 0x0f85, 0x0f85, 0x0fd0, 0x0fd4, 0x0fd9, 0x0fda, 0x104a, 0x104f, 0x10fb, 0x10fb, 0x1360, 0x1368, 0x166e, 0x166e, 0x16eb, 0x16ed, 0x1735, 0x1736, 0x17d4, 0x17d6, 0x17d8, 0x17da, 0x1800, 0x1805, 0x1807, 0x180a, 0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1aa0, 0x1aa6, 0x1aa8, 0x1aad, 0x1b4e, 0x1b4f, 0x1b5a, 0x1b60, 0x1b7d, 0x1b7f, 0x1bfc, 0x1bff, 0x1c3b, 0x1c3f, 0x1c7e, 0x1c7f, 0x1cc0, 0x1cc7, 0x1cd3, 0x1cd3, 0x2016, 0x2017, 0x2020, 0x2027, 0x2030, 0x2038, 0x203b, 0x203e, 0x2041, 0x2043, 0x2047, 0x2051, 0x2053, 0x2053, 0x2055, 0x205e, 0x2cf9, 0x2cfc, 0x2cfe, 0x2cff, 0x2d70, 0x2d70, 0x2e00, 0x2e01, 0x2e06, 0x2e08, 0x2e0b, 0x2e0b, 0x2e0e, 0x2e16, 0x2e18, 0x2e19, 0x2e1b, 0x2e1b, 0x2e1e, 0x2e1f, 0x2e2a, 0x2e2e, 0x2e30, 0x2e39, 0x2e3c, 0x2e3f, 0x2e41, 0x2e41, 0x2e43, 0x2e4f, 0x2e52, 0x2e54, 0x3001, 0x3003, 0x303d, 0x303d, 0x30fb, 0x30fb, 0xa4fe, 0xa4ff, 0xa60d, 0xa60f, 0xa673, 0xa673, 0xa67e, 0xa67e, 0xa6f2, 0xa6f7, 0xa874, 0xa877, 0xa8ce, 0xa8cf, 0xa8f8, 0xa8fa, 0xa8fc, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa95f, 0xa9c1, 0xa9cd, 0xa9de, 0xa9df, 0xaa5c, 0xaa5f, 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xabeb, 0xfe10, 0xfe16, 0xfe19, 0xfe19, 0xfe30, 0xfe30, 0xfe45, 0xfe46, 0xfe49, 0xfe4c, 0xfe50, 0xfe52, 0xfe54, 0xfe57, 0xfe5f, 0xfe61, 0xfe68, 0xfe68, 0xfe6a, 0xfe6b, 0xff01, 0xff03, 0xff05, 0xff07, 0xff0a, 0xff0a, 0xff0c, 0xff0c, 0xff0e, 0xff0f, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3c, 0xff3c, 0xff61, 0xff61, 0xff64, 0xff65, 0x10100, 0x10102, 0x1039f, 0x1039f, 0x103d0, 0x103d0, 0x1056f, 0x1056f, 0x10857, 0x10857, 0x1091f, 0x1091f, 0x1093f, 0x1093f, 0x10a50, 0x10a58, 0x10a7f, 0x10a7f, 0x10af0, 0x10af6, 0x10b39, 0x10b3f, 0x10b99, 0x10b9c, 0x10f55, 0x10f59, 0x10f86, 0x10f89, 0x11047, 0x1104d, 0x110bb, 0x110bc, 0x110be, 0x110c1, 0x11140, 0x11143, 0x11174, 0x11175, 0x111c5, 0x111c8, 0x111cd, 0x111cd, 0x111db, 0x111db, 0x111dd, 0x111df, 0x11238, 0x1123d, 0x112a9, 0x112a9, 0x113d4, 0x113d5, 0x113d7, 0x113d8, 0x1144b, 0x1144f, 0x1145a, 0x1145b, 0x1145d, 0x1145d, 0x114c6, 0x114c6, 0x115c1, 0x115d7, 0x11641, 0x11643, 0x11660, 0x1166c, 0x116b9, 0x116b9, 0x1173c, 0x1173e, 0x1183b, 0x1183b, 0x11944, 0x11946, 0x119e2, 0x119e2, 0x11a3f, 0x11a46, 0x11a9a, 0x11a9c, 0x11a9e, 0x11aa2, 0x11b00, 0x11b09, 0x11be1, 0x11be1, 0x11c41, 0x11c45, 0x11c70, 0x11c71, 0x11ef7, 0x11ef8, 0x11f43, 0x11f4f, 0x11fff, 0x11fff, 0x12470, 0x12474, 0x12ff1, 0x12ff2, 0x16a6e, 0x16a6f, 0x16af5, 0x16af5, 0x16b37, 0x16b3b, 0x16b44, 0x16b44, 0x16d6d, 0x16d6f, 0x16e97, 0x16e9a, 0x16fe2, 0x16fe2, 0x1bc9f, 0x1bc9f, 0x1da87, 0x1da8b, 0x1e5ff, 0x1e5ff, 0x1e95e, 0x1e95f, }; /* END of CR_Po */ /* PROPERTY: 'Prepended_Concatenation_Mark': Binary Property */ static const OnigCodePoint CR_Prepended_Concatenation_Mark[] = { 7, 0x0600, 0x0605, 0x06dd, 0x06dd, 0x070f, 0x070f, 0x0890, 0x0891, 0x08e2, 0x08e2, 0x110bd, 0x110bd, 0x110cd, 0x110cd, }; /* END of CR_Prepended_Concatenation_Mark */ /* PROPERTY: 'Ps': General Category */ static const OnigCodePoint CR_Ps[] = { 79, 0x0028, 0x0028, 0x005b, 0x005b, 0x007b, 0x007b, 0x0f3a, 0x0f3a, 0x0f3c, 0x0f3c, 0x169b, 0x169b, 0x201a, 0x201a, 0x201e, 0x201e, 0x2045, 0x2045, 0x207d, 0x207d, 0x208d, 0x208d, 0x2308, 0x2308, 0x230a, 0x230a, 0x2329, 0x2329, 0x2768, 0x2768, 0x276a, 0x276a, 0x276c, 0x276c, 0x276e, 0x276e, 0x2770, 0x2770, 0x2772, 0x2772, 0x2774, 0x2774, 0x27c5, 0x27c5, 0x27e6, 0x27e6, 0x27e8, 0x27e8, 0x27ea, 0x27ea, 0x27ec, 0x27ec, 0x27ee, 0x27ee, 0x2983, 0x2983, 0x2985, 0x2985, 0x2987, 0x2987, 0x2989, 0x2989, 0x298b, 0x298b, 0x298d, 0x298d, 0x298f, 0x298f, 0x2991, 0x2991, 0x2993, 0x2993, 0x2995, 0x2995, 0x2997, 0x2997, 0x29d8, 0x29d8, 0x29da, 0x29da, 0x29fc, 0x29fc, 0x2e22, 0x2e22, 0x2e24, 0x2e24, 0x2e26, 0x2e26, 0x2e28, 0x2e28, 0x2e42, 0x2e42, 0x2e55, 0x2e55, 0x2e57, 0x2e57, 0x2e59, 0x2e59, 0x2e5b, 0x2e5b, 0x3008, 0x3008, 0x300a, 0x300a, 0x300c, 0x300c, 0x300e, 0x300e, 0x3010, 0x3010, 0x3014, 0x3014, 0x3016, 0x3016, 0x3018, 0x3018, 0x301a, 0x301a, 0x301d, 0x301d, 0xfd3f, 0xfd3f, 0xfe17, 0xfe17, 0xfe35, 0xfe35, 0xfe37, 0xfe37, 0xfe39, 0xfe39, 0xfe3b, 0xfe3b, 0xfe3d, 0xfe3d, 0xfe3f, 0xfe3f, 0xfe41, 0xfe41, 0xfe43, 0xfe43, 0xfe47, 0xfe47, 0xfe59, 0xfe59, 0xfe5b, 0xfe5b, 0xfe5d, 0xfe5d, 0xff08, 0xff08, 0xff3b, 0xff3b, 0xff5b, 0xff5b, 0xff5f, 0xff5f, 0xff62, 0xff62, }; /* END of CR_Ps */ /* PROPERTY: 'Psalter_Pahlavi': Script */ static const OnigCodePoint CR_Psalter_Pahlavi[] = { 3, 0x10b80, 0x10b91, 0x10b99, 0x10b9c, 0x10ba9, 0x10baf, }; /* END of CR_Psalter_Pahlavi */ /* PROPERTY: 'Quotation_Mark': Binary Property */ static const OnigCodePoint CR_Quotation_Mark[] = { 13, 0x0022, 0x0022, 0x0027, 0x0027, 0x00ab, 0x00ab, 0x00bb, 0x00bb, 0x2018, 0x201f, 0x2039, 0x203a, 0x2e42, 0x2e42, 0x300c, 0x300f, 0x301d, 0x301f, 0xfe41, 0xfe44, 0xff02, 0xff02, 0xff07, 0xff07, 0xff62, 0xff63, }; /* END of CR_Quotation_Mark */ /* PROPERTY: 'Radical': Binary Property */ static const OnigCodePoint CR_Radical[] = { 3, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, }; /* END of CR_Radical */ /* PROPERTY: 'Regional_Indicator': Binary Property */ static const OnigCodePoint CR_Regional_Indicator[] = { 1, 0x1f1e6, 0x1f1ff, }; /* END of CR_Regional_Indicator */ /* PROPERTY: 'Rejang': Script */ static const OnigCodePoint CR_Rejang[] = { 2, 0xa930, 0xa953, 0xa95f, 0xa95f, }; /* END of CR_Rejang */ /* PROPERTY: 'Runic': Script */ static const OnigCodePoint CR_Runic[] = { 2, 0x16a0, 0x16ea, 0x16ee, 0x16f8, }; /* END of CR_Runic */ /* PROPERTY: 'S': Major Category */ static const OnigCodePoint CR_S[] = { 236, 0x0024, 0x0024, 0x002b, 0x002b, 0x003c, 0x003e, 0x005e, 0x005e, 0x0060, 0x0060, 0x007c, 0x007c, 0x007e, 0x007e, 0x00a2, 0x00a6, 0x00a8, 0x00a9, 0x00ac, 0x00ac, 0x00ae, 0x00b1, 0x00b4, 0x00b4, 0x00b8, 0x00b8, 0x00d7, 0x00d7, 0x00f7, 0x00f7, 0x02c2, 0x02c5, 0x02d2, 0x02df, 0x02e5, 0x02eb, 0x02ed, 0x02ed, 0x02ef, 0x02ff, 0x0375, 0x0375, 0x0384, 0x0385, 0x03f6, 0x03f6, 0x0482, 0x0482, 0x058d, 0x058f, 0x0606, 0x0608, 0x060b, 0x060b, 0x060e, 0x060f, 0x06de, 0x06de, 0x06e9, 0x06e9, 0x06fd, 0x06fe, 0x07f6, 0x07f6, 0x07fe, 0x07ff, 0x0888, 0x0888, 0x09f2, 0x09f3, 0x09fa, 0x09fb, 0x0af1, 0x0af1, 0x0b70, 0x0b70, 0x0bf3, 0x0bfa, 0x0c7f, 0x0c7f, 0x0d4f, 0x0d4f, 0x0d79, 0x0d79, 0x0e3f, 0x0e3f, 0x0f01, 0x0f03, 0x0f13, 0x0f13, 0x0f15, 0x0f17, 0x0f1a, 0x0f1f, 0x0f34, 0x0f34, 0x0f36, 0x0f36, 0x0f38, 0x0f38, 0x0fbe, 0x0fc5, 0x0fc7, 0x0fcc, 0x0fce, 0x0fcf, 0x0fd5, 0x0fd8, 0x109e, 0x109f, 0x1390, 0x1399, 0x166d, 0x166d, 0x17db, 0x17db, 0x1940, 0x1940, 0x19de, 0x19ff, 0x1b61, 0x1b6a, 0x1b74, 0x1b7c, 0x1fbd, 0x1fbd, 0x1fbf, 0x1fc1, 0x1fcd, 0x1fcf, 0x1fdd, 0x1fdf, 0x1fed, 0x1fef, 0x1ffd, 0x1ffe, 0x2044, 0x2044, 0x2052, 0x2052, 0x207a, 0x207c, 0x208a, 0x208c, 0x20a0, 0x20c0, 0x2100, 0x2101, 0x2103, 0x2106, 0x2108, 0x2109, 0x2114, 0x2114, 0x2116, 0x2118, 0x211e, 0x2123, 0x2125, 0x2125, 0x2127, 0x2127, 0x2129, 0x2129, 0x212e, 0x212e, 0x213a, 0x213b, 0x2140, 0x2144, 0x214a, 0x214d, 0x214f, 0x214f, 0x218a, 0x218b, 0x2190, 0x2307, 0x230c, 0x2328, 0x232b, 0x2429, 0x2440, 0x244a, 0x249c, 0x24e9, 0x2500, 0x2767, 0x2794, 0x27c4, 0x27c7, 0x27e5, 0x27f0, 0x2982, 0x2999, 0x29d7, 0x29dc, 0x29fb, 0x29fe, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2bff, 0x2ce5, 0x2cea, 0x2e50, 0x2e51, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x2fff, 0x3004, 0x3004, 0x3012, 0x3013, 0x3020, 0x3020, 0x3036, 0x3037, 0x303e, 0x303f, 0x309b, 0x309c, 0x3190, 0x3191, 0x3196, 0x319f, 0x31c0, 0x31e5, 0x31ef, 0x31ef, 0x3200, 0x321e, 0x322a, 0x3247, 0x3250, 0x3250, 0x3260, 0x327f, 0x328a, 0x32b0, 0x32c0, 0x33ff, 0x4dc0, 0x4dff, 0xa490, 0xa4c6, 0xa700, 0xa716, 0xa720, 0xa721, 0xa789, 0xa78a, 0xa828, 0xa82b, 0xa836, 0xa839, 0xaa77, 0xaa79, 0xab5b, 0xab5b, 0xab6a, 0xab6b, 0xfb29, 0xfb29, 0xfbb2, 0xfbc2, 0xfd40, 0xfd4f, 0xfdcf, 0xfdcf, 0xfdfc, 0xfdff, 0xfe62, 0xfe62, 0xfe64, 0xfe66, 0xfe69, 0xfe69, 0xff04, 0xff04, 0xff0b, 0xff0b, 0xff1c, 0xff1e, 0xff3e, 0xff3e, 0xff40, 0xff40, 0xff5c, 0xff5c, 0xff5e, 0xff5e, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfffc, 0xfffd, 0x10137, 0x1013f, 0x10179, 0x10189, 0x1018c, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fc, 0x10877, 0x10878, 0x10ac8, 0x10ac8, 0x10d8e, 0x10d8f, 0x1173f, 0x1173f, 0x11fd5, 0x11ff1, 0x16b3c, 0x16b3f, 0x16b45, 0x16b45, 0x1bc9c, 0x1bc9c, 0x1cc00, 0x1ccef, 0x1cd00, 0x1ceb3, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d164, 0x1d16a, 0x1d16c, 0x1d183, 0x1d184, 0x1d18c, 0x1d1a9, 0x1d1ae, 0x1d1ea, 0x1d200, 0x1d241, 0x1d245, 0x1d245, 0x1d300, 0x1d356, 0x1d6c1, 0x1d6c1, 0x1d6db, 0x1d6db, 0x1d6fb, 0x1d6fb, 0x1d715, 0x1d715, 0x1d735, 0x1d735, 0x1d74f, 0x1d74f, 0x1d76f, 0x1d76f, 0x1d789, 0x1d789, 0x1d7a9, 0x1d7a9, 0x1d7c3, 0x1d7c3, 0x1d800, 0x1d9ff, 0x1da37, 0x1da3a, 0x1da6d, 0x1da74, 0x1da76, 0x1da83, 0x1da85, 0x1da86, 0x1e14f, 0x1e14f, 0x1e2ff, 0x1e2ff, 0x1ecac, 0x1ecac, 0x1ecb0, 0x1ecb0, 0x1ed2e, 0x1ed2e, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f10d, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbef, }; /* END of CR_S */ /* PROPERTY: 'Samaritan': Script */ static const OnigCodePoint CR_Samaritan[] = { 2, 0x0800, 0x082d, 0x0830, 0x083e, }; /* END of CR_Samaritan */ /* PROPERTY: 'Saurashtra': Script */ static const OnigCodePoint CR_Saurashtra[] = { 2, 0xa880, 0xa8c5, 0xa8ce, 0xa8d9, }; /* END of CR_Saurashtra */ /* PROPERTY: 'Sc': General Category */ static const OnigCodePoint CR_Sc[] = { 21, 0x0024, 0x0024, 0x00a2, 0x00a5, 0x058f, 0x058f, 0x060b, 0x060b, 0x07fe, 0x07ff, 0x09f2, 0x09f3, 0x09fb, 0x09fb, 0x0af1, 0x0af1, 0x0bf9, 0x0bf9, 0x0e3f, 0x0e3f, 0x17db, 0x17db, 0x20a0, 0x20c0, 0xa838, 0xa838, 0xfdfc, 0xfdfc, 0xfe69, 0xfe69, 0xff04, 0xff04, 0xffe0, 0xffe1, 0xffe5, 0xffe6, 0x11fdd, 0x11fe0, 0x1e2ff, 0x1e2ff, 0x1ecb0, 0x1ecb0, }; /* END of CR_Sc */ /* PROPERTY: 'Sentence_Terminal': Binary Property */ static const OnigCodePoint CR_Sentence_Terminal[] = { 88, 0x0021, 0x0021, 0x002e, 0x002e, 0x003f, 0x003f, 0x0589, 0x0589, 0x061d, 0x061f, 0x06d4, 0x06d4, 0x0700, 0x0702, 0x07f9, 0x07f9, 0x0837, 0x0837, 0x0839, 0x0839, 0x083d, 0x083e, 0x0964, 0x0965, 0x104a, 0x104b, 0x1362, 0x1362, 0x1367, 0x1368, 0x166e, 0x166e, 0x1735, 0x1736, 0x17d4, 0x17d5, 0x1803, 0x1803, 0x1809, 0x1809, 0x1944, 0x1945, 0x1aa8, 0x1aab, 0x1b4e, 0x1b4f, 0x1b5a, 0x1b5b, 0x1b5e, 0x1b5f, 0x1b7d, 0x1b7f, 0x1c3b, 0x1c3c, 0x1c7e, 0x1c7f, 0x2024, 0x2024, 0x203c, 0x203d, 0x2047, 0x2049, 0x2cf9, 0x2cfb, 0x2e2e, 0x2e2e, 0x2e3c, 0x2e3c, 0x2e53, 0x2e54, 0x3002, 0x3002, 0xa4ff, 0xa4ff, 0xa60e, 0xa60f, 0xa6f3, 0xa6f3, 0xa6f7, 0xa6f7, 0xa876, 0xa877, 0xa8ce, 0xa8cf, 0xa92f, 0xa92f, 0xa9c8, 0xa9c9, 0xaa5d, 0xaa5f, 0xaaf0, 0xaaf1, 0xabeb, 0xabeb, 0xfe12, 0xfe12, 0xfe15, 0xfe16, 0xfe52, 0xfe52, 0xfe56, 0xfe57, 0xff01, 0xff01, 0xff0e, 0xff0e, 0xff1f, 0xff1f, 0xff61, 0xff61, 0x10a56, 0x10a57, 0x10f55, 0x10f59, 0x10f86, 0x10f89, 0x11047, 0x11048, 0x110be, 0x110c1, 0x11141, 0x11143, 0x111c5, 0x111c6, 0x111cd, 0x111cd, 0x111de, 0x111df, 0x11238, 0x11239, 0x1123b, 0x1123c, 0x112a9, 0x112a9, 0x113d4, 0x113d5, 0x1144b, 0x1144c, 0x115c2, 0x115c3, 0x115c9, 0x115d7, 0x11641, 0x11642, 0x1173c, 0x1173e, 0x11944, 0x11944, 0x11946, 0x11946, 0x11a42, 0x11a43, 0x11a9b, 0x11a9c, 0x11c41, 0x11c42, 0x11ef7, 0x11ef8, 0x11f43, 0x11f44, 0x16a6e, 0x16a6f, 0x16af5, 0x16af5, 0x16b37, 0x16b38, 0x16b44, 0x16b44, 0x16d6e, 0x16d6f, 0x16e98, 0x16e98, 0x1bc9f, 0x1bc9f, 0x1da88, 0x1da88, }; /* END of CR_Sentence_Terminal */ /* PROPERTY: 'Sharada': Script */ static const OnigCodePoint CR_Sharada[] = { 1, 0x11180, 0x111df, }; /* END of CR_Sharada */ /* PROPERTY: 'Shavian': Script */ static const OnigCodePoint CR_Shavian[] = { 1, 0x10450, 0x1047f, }; /* END of CR_Shavian */ /* PROPERTY: 'Siddham': Script */ static const OnigCodePoint CR_Siddham[] = { 2, 0x11580, 0x115b5, 0x115b8, 0x115dd, }; /* END of CR_Siddham */ /* PROPERTY: 'SignWriting': Script */ static const OnigCodePoint CR_SignWriting[] = { 3, 0x1d800, 0x1da8b, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, }; /* END of CR_SignWriting */ /* PROPERTY: 'Sinhala': Script */ static const OnigCodePoint CR_Sinhala[] = { 13, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df4, 0x111e1, 0x111f4, }; /* END of CR_Sinhala */ /* PROPERTY: 'Sk': General Category */ static const OnigCodePoint CR_Sk[] = { 31, 0x005e, 0x005e, 0x0060, 0x0060, 0x00a8, 0x00a8, 0x00af, 0x00af, 0x00b4, 0x00b4, 0x00b8, 0x00b8, 0x02c2, 0x02c5, 0x02d2, 0x02df, 0x02e5, 0x02eb, 0x02ed, 0x02ed, 0x02ef, 0x02ff, 0x0375, 0x0375, 0x0384, 0x0385, 0x0888, 0x0888, 0x1fbd, 0x1fbd, 0x1fbf, 0x1fc1, 0x1fcd, 0x1fcf, 0x1fdd, 0x1fdf, 0x1fed, 0x1fef, 0x1ffd, 0x1ffe, 0x309b, 0x309c, 0xa700, 0xa716, 0xa720, 0xa721, 0xa789, 0xa78a, 0xab5b, 0xab5b, 0xab6a, 0xab6b, 0xfbb2, 0xfbc2, 0xff3e, 0xff3e, 0xff40, 0xff40, 0xffe3, 0xffe3, 0x1f3fb, 0x1f3ff, }; /* END of CR_Sk */ /* PROPERTY: 'Sm': General Category */ static const OnigCodePoint CR_Sm[] = { 65, 0x002b, 0x002b, 0x003c, 0x003e, 0x007c, 0x007c, 0x007e, 0x007e, 0x00ac, 0x00ac, 0x00b1, 0x00b1, 0x00d7, 0x00d7, 0x00f7, 0x00f7, 0x03f6, 0x03f6, 0x0606, 0x0608, 0x2044, 0x2044, 0x2052, 0x2052, 0x207a, 0x207c, 0x208a, 0x208c, 0x2118, 0x2118, 0x2140, 0x2144, 0x214b, 0x214b, 0x2190, 0x2194, 0x219a, 0x219b, 0x21a0, 0x21a0, 0x21a3, 0x21a3, 0x21a6, 0x21a6, 0x21ae, 0x21ae, 0x21ce, 0x21cf, 0x21d2, 0x21d2, 0x21d4, 0x21d4, 0x21f4, 0x22ff, 0x2320, 0x2321, 0x237c, 0x237c, 0x239b, 0x23b3, 0x23dc, 0x23e1, 0x25b7, 0x25b7, 0x25c1, 0x25c1, 0x25f8, 0x25ff, 0x266f, 0x266f, 0x27c0, 0x27c4, 0x27c7, 0x27e5, 0x27f0, 0x27ff, 0x2900, 0x2982, 0x2999, 0x29d7, 0x29dc, 0x29fb, 0x29fe, 0x2aff, 0x2b30, 0x2b44, 0x2b47, 0x2b4c, 0xfb29, 0xfb29, 0xfe62, 0xfe62, 0xfe64, 0xfe66, 0xff0b, 0xff0b, 0xff1c, 0xff1e, 0xff5c, 0xff5c, 0xff5e, 0xff5e, 0xffe2, 0xffe2, 0xffe9, 0xffec, 0x10d8e, 0x10d8f, 0x1d6c1, 0x1d6c1, 0x1d6db, 0x1d6db, 0x1d6fb, 0x1d6fb, 0x1d715, 0x1d715, 0x1d735, 0x1d735, 0x1d74f, 0x1d74f, 0x1d76f, 0x1d76f, 0x1d789, 0x1d789, 0x1d7a9, 0x1d7a9, 0x1d7c3, 0x1d7c3, 0x1eef0, 0x1eef1, }; /* END of CR_Sm */ /* PROPERTY: 'So': General Category */ static const OnigCodePoint CR_So[] = { 187, 0x00a6, 0x00a6, 0x00a9, 0x00a9, 0x00ae, 0x00ae, 0x00b0, 0x00b0, 0x0482, 0x0482, 0x058d, 0x058e, 0x060e, 0x060f, 0x06de, 0x06de, 0x06e9, 0x06e9, 0x06fd, 0x06fe, 0x07f6, 0x07f6, 0x09fa, 0x09fa, 0x0b70, 0x0b70, 0x0bf3, 0x0bf8, 0x0bfa, 0x0bfa, 0x0c7f, 0x0c7f, 0x0d4f, 0x0d4f, 0x0d79, 0x0d79, 0x0f01, 0x0f03, 0x0f13, 0x0f13, 0x0f15, 0x0f17, 0x0f1a, 0x0f1f, 0x0f34, 0x0f34, 0x0f36, 0x0f36, 0x0f38, 0x0f38, 0x0fbe, 0x0fc5, 0x0fc7, 0x0fcc, 0x0fce, 0x0fcf, 0x0fd5, 0x0fd8, 0x109e, 0x109f, 0x1390, 0x1399, 0x166d, 0x166d, 0x1940, 0x1940, 0x19de, 0x19ff, 0x1b61, 0x1b6a, 0x1b74, 0x1b7c, 0x2100, 0x2101, 0x2103, 0x2106, 0x2108, 0x2109, 0x2114, 0x2114, 0x2116, 0x2117, 0x211e, 0x2123, 0x2125, 0x2125, 0x2127, 0x2127, 0x2129, 0x2129, 0x212e, 0x212e, 0x213a, 0x213b, 0x214a, 0x214a, 0x214c, 0x214d, 0x214f, 0x214f, 0x218a, 0x218b, 0x2195, 0x2199, 0x219c, 0x219f, 0x21a1, 0x21a2, 0x21a4, 0x21a5, 0x21a7, 0x21ad, 0x21af, 0x21cd, 0x21d0, 0x21d1, 0x21d3, 0x21d3, 0x21d5, 0x21f3, 0x2300, 0x2307, 0x230c, 0x231f, 0x2322, 0x2328, 0x232b, 0x237b, 0x237d, 0x239a, 0x23b4, 0x23db, 0x23e2, 0x2429, 0x2440, 0x244a, 0x249c, 0x24e9, 0x2500, 0x25b6, 0x25b8, 0x25c0, 0x25c2, 0x25f7, 0x2600, 0x266e, 0x2670, 0x2767, 0x2794, 0x27bf, 0x2800, 0x28ff, 0x2b00, 0x2b2f, 0x2b45, 0x2b46, 0x2b4d, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2bff, 0x2ce5, 0x2cea, 0x2e50, 0x2e51, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x2fff, 0x3004, 0x3004, 0x3012, 0x3013, 0x3020, 0x3020, 0x3036, 0x3037, 0x303e, 0x303f, 0x3190, 0x3191, 0x3196, 0x319f, 0x31c0, 0x31e5, 0x31ef, 0x31ef, 0x3200, 0x321e, 0x322a, 0x3247, 0x3250, 0x3250, 0x3260, 0x327f, 0x328a, 0x32b0, 0x32c0, 0x33ff, 0x4dc0, 0x4dff, 0xa490, 0xa4c6, 0xa828, 0xa82b, 0xa836, 0xa837, 0xa839, 0xa839, 0xaa77, 0xaa79, 0xfd40, 0xfd4f, 0xfdcf, 0xfdcf, 0xfdfd, 0xfdff, 0xffe4, 0xffe4, 0xffe8, 0xffe8, 0xffed, 0xffee, 0xfffc, 0xfffd, 0x10137, 0x1013f, 0x10179, 0x10189, 0x1018c, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fc, 0x10877, 0x10878, 0x10ac8, 0x10ac8, 0x1173f, 0x1173f, 0x11fd5, 0x11fdc, 0x11fe1, 0x11ff1, 0x16b3c, 0x16b3f, 0x16b45, 0x16b45, 0x1bc9c, 0x1bc9c, 0x1cc00, 0x1ccef, 0x1cd00, 0x1ceb3, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d164, 0x1d16a, 0x1d16c, 0x1d183, 0x1d184, 0x1d18c, 0x1d1a9, 0x1d1ae, 0x1d1ea, 0x1d200, 0x1d241, 0x1d245, 0x1d245, 0x1d300, 0x1d356, 0x1d800, 0x1d9ff, 0x1da37, 0x1da3a, 0x1da6d, 0x1da74, 0x1da76, 0x1da83, 0x1da85, 0x1da86, 0x1e14f, 0x1e14f, 0x1ecac, 0x1ecac, 0x1ed2e, 0x1ed2e, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f10d, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f3fa, 0x1f400, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbef, }; /* END of CR_So */ /* PROPERTY: 'Soft_Dotted': Binary Property */ static const OnigCodePoint CR_Soft_Dotted[] = { 34, 0x0069, 0x006a, 0x012f, 0x012f, 0x0249, 0x0249, 0x0268, 0x0268, 0x029d, 0x029d, 0x02b2, 0x02b2, 0x03f3, 0x03f3, 0x0456, 0x0456, 0x0458, 0x0458, 0x1d62, 0x1d62, 0x1d96, 0x1d96, 0x1da4, 0x1da4, 0x1da8, 0x1da8, 0x1e2d, 0x1e2d, 0x1ecb, 0x1ecb, 0x2071, 0x2071, 0x2148, 0x2149, 0x2c7c, 0x2c7c, 0x1d422, 0x1d423, 0x1d456, 0x1d457, 0x1d48a, 0x1d48b, 0x1d4be, 0x1d4bf, 0x1d4f2, 0x1d4f3, 0x1d526, 0x1d527, 0x1d55a, 0x1d55b, 0x1d58e, 0x1d58f, 0x1d5c2, 0x1d5c3, 0x1d5f6, 0x1d5f7, 0x1d62a, 0x1d62b, 0x1d65e, 0x1d65f, 0x1d692, 0x1d693, 0x1df1a, 0x1df1a, 0x1e04c, 0x1e04d, 0x1e068, 0x1e068, }; /* END of CR_Soft_Dotted */ /* PROPERTY: 'Sogdian': Script */ static const OnigCodePoint CR_Sogdian[] = { 1, 0x10f30, 0x10f59, }; /* END of CR_Sogdian */ /* PROPERTY: 'Sora_Sompeng': Script */ static const OnigCodePoint CR_Sora_Sompeng[] = { 2, 0x110d0, 0x110e8, 0x110f0, 0x110f9, }; /* END of CR_Sora_Sompeng */ /* PROPERTY: 'Soyombo': Script */ static const OnigCodePoint CR_Soyombo[] = { 1, 0x11a50, 0x11aa2, }; /* END of CR_Soyombo */ /* PROPERTY: 'Sundanese': Script */ static const OnigCodePoint CR_Sundanese[] = { 2, 0x1b80, 0x1bbf, 0x1cc0, 0x1cc7, }; /* END of CR_Sundanese */ /* PROPERTY: 'Sunuwar': Script */ static const OnigCodePoint CR_Sunuwar[] = { 2, 0x11bc0, 0x11be1, 0x11bf0, 0x11bf9, }; /* END of CR_Sunuwar */ /* PROPERTY: 'Syloti_Nagri': Script */ static const OnigCodePoint CR_Syloti_Nagri[] = { 1, 0xa800, 0xa82c, }; /* END of CR_Syloti_Nagri */ /* PROPERTY: 'Syriac': Script */ static const OnigCodePoint CR_Syriac[] = { 4, 0x0700, 0x070d, 0x070f, 0x074a, 0x074d, 0x074f, 0x0860, 0x086a, }; /* END of CR_Syriac */ /* PROPERTY: 'Tagalog': Script */ static const OnigCodePoint CR_Tagalog[] = { 2, 0x1700, 0x1715, 0x171f, 0x171f, }; /* END of CR_Tagalog */ /* PROPERTY: 'Tagbanwa': Script */ static const OnigCodePoint CR_Tagbanwa[] = { 3, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, }; /* END of CR_Tagbanwa */ /* PROPERTY: 'Tai_Le': Script */ static const OnigCodePoint CR_Tai_Le[] = { 2, 0x1950, 0x196d, 0x1970, 0x1974, }; /* END of CR_Tai_Le */ /* PROPERTY: 'Tai_Tham': Script */ static const OnigCodePoint CR_Tai_Tham[] = { 5, 0x1a20, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa0, 0x1aad, }; /* END of CR_Tai_Tham */ /* PROPERTY: 'Tai_Viet': Script */ static const OnigCodePoint CR_Tai_Viet[] = { 2, 0xaa80, 0xaac2, 0xaadb, 0xaadf, }; /* END of CR_Tai_Viet */ /* PROPERTY: 'Takri': Script */ static const OnigCodePoint CR_Takri[] = { 2, 0x11680, 0x116b9, 0x116c0, 0x116c9, }; /* END of CR_Takri */ /* PROPERTY: 'Tamil': Script */ static const OnigCodePoint CR_Tamil[] = { 18, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bfa, 0x11fc0, 0x11ff1, 0x11fff, 0x11fff, }; /* END of CR_Tamil */ /* PROPERTY: 'Tangsa': Script */ static const OnigCodePoint CR_Tangsa[] = { 2, 0x16a70, 0x16abe, 0x16ac0, 0x16ac9, }; /* END of CR_Tangsa */ /* PROPERTY: 'Tangut': Script */ static const OnigCodePoint CR_Tangut[] = { 4, 0x16fe0, 0x16fe0, 0x17000, 0x187f7, 0x18800, 0x18aff, 0x18d00, 0x18d08, }; /* END of CR_Tangut */ /* PROPERTY: 'Telugu': Script */ static const OnigCodePoint CR_Telugu[] = { 13, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c77, 0x0c7f, }; /* END of CR_Telugu */ /* PROPERTY: 'Terminal_Punctuation': Binary Property */ static const OnigCodePoint CR_Terminal_Punctuation[] = { 116, 0x0021, 0x0021, 0x002c, 0x002c, 0x002e, 0x002e, 0x003a, 0x003b, 0x003f, 0x003f, 0x037e, 0x037e, 0x0387, 0x0387, 0x0589, 0x0589, 0x05c3, 0x05c3, 0x060c, 0x060c, 0x061b, 0x061b, 0x061d, 0x061f, 0x06d4, 0x06d4, 0x0700, 0x070a, 0x070c, 0x070c, 0x07f8, 0x07f9, 0x0830, 0x0835, 0x0837, 0x083e, 0x085e, 0x085e, 0x0964, 0x0965, 0x0e5a, 0x0e5b, 0x0f08, 0x0f08, 0x0f0d, 0x0f12, 0x104a, 0x104b, 0x1361, 0x1368, 0x166e, 0x166e, 0x16eb, 0x16ed, 0x1735, 0x1736, 0x17d4, 0x17d6, 0x17da, 0x17da, 0x1802, 0x1805, 0x1808, 0x1809, 0x1944, 0x1945, 0x1aa8, 0x1aab, 0x1b4e, 0x1b4f, 0x1b5a, 0x1b5b, 0x1b5d, 0x1b5f, 0x1b7d, 0x1b7f, 0x1c3b, 0x1c3f, 0x1c7e, 0x1c7f, 0x2024, 0x2024, 0x203c, 0x203d, 0x2047, 0x2049, 0x2cf9, 0x2cfb, 0x2e2e, 0x2e2e, 0x2e3c, 0x2e3c, 0x2e41, 0x2e41, 0x2e4c, 0x2e4c, 0x2e4e, 0x2e4f, 0x2e53, 0x2e54, 0x3001, 0x3002, 0xa4fe, 0xa4ff, 0xa60d, 0xa60f, 0xa6f3, 0xa6f7, 0xa876, 0xa877, 0xa8ce, 0xa8cf, 0xa92f, 0xa92f, 0xa9c7, 0xa9c9, 0xaa5d, 0xaa5f, 0xaadf, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xabeb, 0xfe12, 0xfe12, 0xfe15, 0xfe16, 0xfe50, 0xfe52, 0xfe54, 0xfe57, 0xff01, 0xff01, 0xff0c, 0xff0c, 0xff0e, 0xff0e, 0xff1a, 0xff1b, 0xff1f, 0xff1f, 0xff61, 0xff61, 0xff64, 0xff64, 0x1039f, 0x1039f, 0x103d0, 0x103d0, 0x10857, 0x10857, 0x1091f, 0x1091f, 0x10a56, 0x10a57, 0x10af0, 0x10af5, 0x10b3a, 0x10b3f, 0x10b99, 0x10b9c, 0x10f55, 0x10f59, 0x10f86, 0x10f89, 0x11047, 0x1104d, 0x110be, 0x110c1, 0x11141, 0x11143, 0x111c5, 0x111c6, 0x111cd, 0x111cd, 0x111de, 0x111df, 0x11238, 0x1123c, 0x112a9, 0x112a9, 0x113d4, 0x113d5, 0x1144b, 0x1144d, 0x1145a, 0x1145b, 0x115c2, 0x115c5, 0x115c9, 0x115d7, 0x11641, 0x11642, 0x1173c, 0x1173e, 0x11944, 0x11944, 0x11946, 0x11946, 0x11a42, 0x11a43, 0x11a9b, 0x11a9c, 0x11aa1, 0x11aa2, 0x11c41, 0x11c43, 0x11c71, 0x11c71, 0x11ef7, 0x11ef8, 0x11f43, 0x11f44, 0x12470, 0x12474, 0x16a6e, 0x16a6f, 0x16af5, 0x16af5, 0x16b37, 0x16b39, 0x16b44, 0x16b44, 0x16d6e, 0x16d6f, 0x16e97, 0x16e98, 0x1bc9f, 0x1bc9f, 0x1da87, 0x1da8a, }; /* END of CR_Terminal_Punctuation */ /* PROPERTY: 'Thaana': Script */ static const OnigCodePoint CR_Thaana[] = { 1, 0x0780, 0x07b1, }; /* END of CR_Thaana */ /* PROPERTY: 'Thai': Script */ static const OnigCodePoint CR_Thai[] = { 2, 0x0e01, 0x0e3a, 0x0e40, 0x0e5b, }; /* END of CR_Thai */ /* PROPERTY: 'Tibetan': Script */ static const OnigCodePoint CR_Tibetan[] = { 7, 0x0f00, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f97, 0x0f99, 0x0fbc, 0x0fbe, 0x0fcc, 0x0fce, 0x0fd4, 0x0fd9, 0x0fda, }; /* END of CR_Tibetan */ /* PROPERTY: 'Tifinagh': Script */ static const OnigCodePoint CR_Tifinagh[] = { 3, 0x2d30, 0x2d67, 0x2d6f, 0x2d70, 0x2d7f, 0x2d7f, }; /* END of CR_Tifinagh */ /* PROPERTY: 'Tirhuta': Script */ static const OnigCodePoint CR_Tirhuta[] = { 2, 0x11480, 0x114c7, 0x114d0, 0x114d9, }; /* END of CR_Tirhuta */ /* PROPERTY: 'Todhri': Script */ static const OnigCodePoint CR_Todhri[] = { 1, 0x105c0, 0x105f3, }; /* END of CR_Todhri */ /* PROPERTY: 'Toto': Script */ static const OnigCodePoint CR_Toto[] = { 1, 0x1e290, 0x1e2ae, }; /* END of CR_Toto */ /* PROPERTY: 'Tulu_Tigalari': Script */ static const OnigCodePoint CR_Tulu_Tigalari[] = { 11, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d5, 0x113d7, 0x113d8, 0x113e1, 0x113e2, }; /* END of CR_Tulu_Tigalari */ /* PROPERTY: 'Ugaritic': Script */ static const OnigCodePoint CR_Ugaritic[] = { 2, 0x10380, 0x1039d, 0x1039f, 0x1039f, }; /* END of CR_Ugaritic */ /* PROPERTY: 'Unified_Ideograph': Binary Property */ static const OnigCodePoint CR_Unified_Ideograph[] = { 17, 0x3400, 0x4dbf, 0x4e00, 0x9fff, 0xfa0e, 0xfa0f, 0xfa11, 0xfa11, 0xfa13, 0xfa14, 0xfa1f, 0xfa1f, 0xfa21, 0xfa21, 0xfa23, 0xfa24, 0xfa27, 0xfa29, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Unified_Ideograph */ /* PROPERTY: 'Unknown': Script */ static const OnigCodePoint CR_Unknown[] = { 729, 0x0378, 0x0379, 0x0380, 0x0383, 0x038b, 0x038b, 0x038d, 0x038d, 0x03a2, 0x03a2, 0x0530, 0x0530, 0x0557, 0x0558, 0x058b, 0x058c, 0x0590, 0x0590, 0x05c8, 0x05cf, 0x05eb, 0x05ee, 0x05f5, 0x05ff, 0x070e, 0x070e, 0x074b, 0x074c, 0x07b2, 0x07bf, 0x07fb, 0x07fc, 0x082e, 0x082f, 0x083f, 0x083f, 0x085c, 0x085d, 0x085f, 0x085f, 0x086b, 0x086f, 0x088f, 0x088f, 0x0892, 0x0896, 0x0984, 0x0984, 0x098d, 0x098e, 0x0991, 0x0992, 0x09a9, 0x09a9, 0x09b1, 0x09b1, 0x09b3, 0x09b5, 0x09ba, 0x09bb, 0x09c5, 0x09c6, 0x09c9, 0x09ca, 0x09cf, 0x09d6, 0x09d8, 0x09db, 0x09de, 0x09de, 0x09e4, 0x09e5, 0x09ff, 0x0a00, 0x0a04, 0x0a04, 0x0a0b, 0x0a0e, 0x0a11, 0x0a12, 0x0a29, 0x0a29, 0x0a31, 0x0a31, 0x0a34, 0x0a34, 0x0a37, 0x0a37, 0x0a3a, 0x0a3b, 0x0a3d, 0x0a3d, 0x0a43, 0x0a46, 0x0a49, 0x0a4a, 0x0a4e, 0x0a50, 0x0a52, 0x0a58, 0x0a5d, 0x0a5d, 0x0a5f, 0x0a65, 0x0a77, 0x0a80, 0x0a84, 0x0a84, 0x0a8e, 0x0a8e, 0x0a92, 0x0a92, 0x0aa9, 0x0aa9, 0x0ab1, 0x0ab1, 0x0ab4, 0x0ab4, 0x0aba, 0x0abb, 0x0ac6, 0x0ac6, 0x0aca, 0x0aca, 0x0ace, 0x0acf, 0x0ad1, 0x0adf, 0x0ae4, 0x0ae5, 0x0af2, 0x0af8, 0x0b00, 0x0b00, 0x0b04, 0x0b04, 0x0b0d, 0x0b0e, 0x0b11, 0x0b12, 0x0b29, 0x0b29, 0x0b31, 0x0b31, 0x0b34, 0x0b34, 0x0b3a, 0x0b3b, 0x0b45, 0x0b46, 0x0b49, 0x0b4a, 0x0b4e, 0x0b54, 0x0b58, 0x0b5b, 0x0b5e, 0x0b5e, 0x0b64, 0x0b65, 0x0b78, 0x0b81, 0x0b84, 0x0b84, 0x0b8b, 0x0b8d, 0x0b91, 0x0b91, 0x0b96, 0x0b98, 0x0b9b, 0x0b9b, 0x0b9d, 0x0b9d, 0x0ba0, 0x0ba2, 0x0ba5, 0x0ba7, 0x0bab, 0x0bad, 0x0bba, 0x0bbd, 0x0bc3, 0x0bc5, 0x0bc9, 0x0bc9, 0x0bce, 0x0bcf, 0x0bd1, 0x0bd6, 0x0bd8, 0x0be5, 0x0bfb, 0x0bff, 0x0c0d, 0x0c0d, 0x0c11, 0x0c11, 0x0c29, 0x0c29, 0x0c3a, 0x0c3b, 0x0c45, 0x0c45, 0x0c49, 0x0c49, 0x0c4e, 0x0c54, 0x0c57, 0x0c57, 0x0c5b, 0x0c5c, 0x0c5e, 0x0c5f, 0x0c64, 0x0c65, 0x0c70, 0x0c76, 0x0c8d, 0x0c8d, 0x0c91, 0x0c91, 0x0ca9, 0x0ca9, 0x0cb4, 0x0cb4, 0x0cba, 0x0cbb, 0x0cc5, 0x0cc5, 0x0cc9, 0x0cc9, 0x0cce, 0x0cd4, 0x0cd7, 0x0cdc, 0x0cdf, 0x0cdf, 0x0ce4, 0x0ce5, 0x0cf0, 0x0cf0, 0x0cf4, 0x0cff, 0x0d0d, 0x0d0d, 0x0d11, 0x0d11, 0x0d45, 0x0d45, 0x0d49, 0x0d49, 0x0d50, 0x0d53, 0x0d64, 0x0d65, 0x0d80, 0x0d80, 0x0d84, 0x0d84, 0x0d97, 0x0d99, 0x0db2, 0x0db2, 0x0dbc, 0x0dbc, 0x0dbe, 0x0dbf, 0x0dc7, 0x0dc9, 0x0dcb, 0x0dce, 0x0dd5, 0x0dd5, 0x0dd7, 0x0dd7, 0x0de0, 0x0de5, 0x0df0, 0x0df1, 0x0df5, 0x0e00, 0x0e3b, 0x0e3e, 0x0e5c, 0x0e80, 0x0e83, 0x0e83, 0x0e85, 0x0e85, 0x0e8b, 0x0e8b, 0x0ea4, 0x0ea4, 0x0ea6, 0x0ea6, 0x0ebe, 0x0ebf, 0x0ec5, 0x0ec5, 0x0ec7, 0x0ec7, 0x0ecf, 0x0ecf, 0x0eda, 0x0edb, 0x0ee0, 0x0eff, 0x0f48, 0x0f48, 0x0f6d, 0x0f70, 0x0f98, 0x0f98, 0x0fbd, 0x0fbd, 0x0fcd, 0x0fcd, 0x0fdb, 0x0fff, 0x10c6, 0x10c6, 0x10c8, 0x10cc, 0x10ce, 0x10cf, 0x1249, 0x1249, 0x124e, 0x124f, 0x1257, 0x1257, 0x1259, 0x1259, 0x125e, 0x125f, 0x1289, 0x1289, 0x128e, 0x128f, 0x12b1, 0x12b1, 0x12b6, 0x12b7, 0x12bf, 0x12bf, 0x12c1, 0x12c1, 0x12c6, 0x12c7, 0x12d7, 0x12d7, 0x1311, 0x1311, 0x1316, 0x1317, 0x135b, 0x135c, 0x137d, 0x137f, 0x139a, 0x139f, 0x13f6, 0x13f7, 0x13fe, 0x13ff, 0x169d, 0x169f, 0x16f9, 0x16ff, 0x1716, 0x171e, 0x1737, 0x173f, 0x1754, 0x175f, 0x176d, 0x176d, 0x1771, 0x1771, 0x1774, 0x177f, 0x17de, 0x17df, 0x17ea, 0x17ef, 0x17fa, 0x17ff, 0x181a, 0x181f, 0x1879, 0x187f, 0x18ab, 0x18af, 0x18f6, 0x18ff, 0x191f, 0x191f, 0x192c, 0x192f, 0x193c, 0x193f, 0x1941, 0x1943, 0x196e, 0x196f, 0x1975, 0x197f, 0x19ac, 0x19af, 0x19ca, 0x19cf, 0x19db, 0x19dd, 0x1a1c, 0x1a1d, 0x1a5f, 0x1a5f, 0x1a7d, 0x1a7e, 0x1a8a, 0x1a8f, 0x1a9a, 0x1a9f, 0x1aae, 0x1aaf, 0x1acf, 0x1aff, 0x1b4d, 0x1b4d, 0x1bf4, 0x1bfb, 0x1c38, 0x1c3a, 0x1c4a, 0x1c4c, 0x1c8b, 0x1c8f, 0x1cbb, 0x1cbc, 0x1cc8, 0x1ccf, 0x1cfb, 0x1cff, 0x1f16, 0x1f17, 0x1f1e, 0x1f1f, 0x1f46, 0x1f47, 0x1f4e, 0x1f4f, 0x1f58, 0x1f58, 0x1f5a, 0x1f5a, 0x1f5c, 0x1f5c, 0x1f5e, 0x1f5e, 0x1f7e, 0x1f7f, 0x1fb5, 0x1fb5, 0x1fc5, 0x1fc5, 0x1fd4, 0x1fd5, 0x1fdc, 0x1fdc, 0x1ff0, 0x1ff1, 0x1ff5, 0x1ff5, 0x1fff, 0x1fff, 0x2065, 0x2065, 0x2072, 0x2073, 0x208f, 0x208f, 0x209d, 0x209f, 0x20c1, 0x20cf, 0x20f1, 0x20ff, 0x218c, 0x218f, 0x242a, 0x243f, 0x244b, 0x245f, 0x2b74, 0x2b75, 0x2b96, 0x2b96, 0x2cf4, 0x2cf8, 0x2d26, 0x2d26, 0x2d28, 0x2d2c, 0x2d2e, 0x2d2f, 0x2d68, 0x2d6e, 0x2d71, 0x2d7e, 0x2d97, 0x2d9f, 0x2da7, 0x2da7, 0x2daf, 0x2daf, 0x2db7, 0x2db7, 0x2dbf, 0x2dbf, 0x2dc7, 0x2dc7, 0x2dcf, 0x2dcf, 0x2dd7, 0x2dd7, 0x2ddf, 0x2ddf, 0x2e5e, 0x2e7f, 0x2e9a, 0x2e9a, 0x2ef4, 0x2eff, 0x2fd6, 0x2fef, 0x3040, 0x3040, 0x3097, 0x3098, 0x3100, 0x3104, 0x3130, 0x3130, 0x318f, 0x318f, 0x31e6, 0x31ee, 0x321f, 0x321f, 0xa48d, 0xa48f, 0xa4c7, 0xa4cf, 0xa62c, 0xa63f, 0xa6f8, 0xa6ff, 0xa7ce, 0xa7cf, 0xa7d2, 0xa7d2, 0xa7d4, 0xa7d4, 0xa7dd, 0xa7f1, 0xa82d, 0xa82f, 0xa83a, 0xa83f, 0xa878, 0xa87f, 0xa8c6, 0xa8cd, 0xa8da, 0xa8df, 0xa954, 0xa95e, 0xa97d, 0xa97f, 0xa9ce, 0xa9ce, 0xa9da, 0xa9dd, 0xa9ff, 0xa9ff, 0xaa37, 0xaa3f, 0xaa4e, 0xaa4f, 0xaa5a, 0xaa5b, 0xaac3, 0xaada, 0xaaf7, 0xab00, 0xab07, 0xab08, 0xab0f, 0xab10, 0xab17, 0xab1f, 0xab27, 0xab27, 0xab2f, 0xab2f, 0xab6c, 0xab6f, 0xabee, 0xabef, 0xabfa, 0xabff, 0xd7a4, 0xd7af, 0xd7c7, 0xd7ca, 0xd7fc, 0xf8ff, 0xfa6e, 0xfa6f, 0xfada, 0xfaff, 0xfb07, 0xfb12, 0xfb18, 0xfb1c, 0xfb37, 0xfb37, 0xfb3d, 0xfb3d, 0xfb3f, 0xfb3f, 0xfb42, 0xfb42, 0xfb45, 0xfb45, 0xfbc3, 0xfbd2, 0xfd90, 0xfd91, 0xfdc8, 0xfdce, 0xfdd0, 0xfdef, 0xfe1a, 0xfe1f, 0xfe53, 0xfe53, 0xfe67, 0xfe67, 0xfe6c, 0xfe6f, 0xfe75, 0xfe75, 0xfefd, 0xfefe, 0xff00, 0xff00, 0xffbf, 0xffc1, 0xffc8, 0xffc9, 0xffd0, 0xffd1, 0xffd8, 0xffd9, 0xffdd, 0xffdf, 0xffe7, 0xffe7, 0xffef, 0xfff8, 0xfffe, 0xffff, 0x1000c, 0x1000c, 0x10027, 0x10027, 0x1003b, 0x1003b, 0x1003e, 0x1003e, 0x1004e, 0x1004f, 0x1005e, 0x1007f, 0x100fb, 0x100ff, 0x10103, 0x10106, 0x10134, 0x10136, 0x1018f, 0x1018f, 0x1019d, 0x1019f, 0x101a1, 0x101cf, 0x101fe, 0x1027f, 0x1029d, 0x1029f, 0x102d1, 0x102df, 0x102fc, 0x102ff, 0x10324, 0x1032c, 0x1034b, 0x1034f, 0x1037b, 0x1037f, 0x1039e, 0x1039e, 0x103c4, 0x103c7, 0x103d6, 0x103ff, 0x1049e, 0x1049f, 0x104aa, 0x104af, 0x104d4, 0x104d7, 0x104fc, 0x104ff, 0x10528, 0x1052f, 0x10564, 0x1056e, 0x1057b, 0x1057b, 0x1058b, 0x1058b, 0x10593, 0x10593, 0x10596, 0x10596, 0x105a2, 0x105a2, 0x105b2, 0x105b2, 0x105ba, 0x105ba, 0x105bd, 0x105bf, 0x105f4, 0x105ff, 0x10737, 0x1073f, 0x10756, 0x1075f, 0x10768, 0x1077f, 0x10786, 0x10786, 0x107b1, 0x107b1, 0x107bb, 0x107ff, 0x10806, 0x10807, 0x10809, 0x10809, 0x10836, 0x10836, 0x10839, 0x1083b, 0x1083d, 0x1083e, 0x10856, 0x10856, 0x1089f, 0x108a6, 0x108b0, 0x108df, 0x108f3, 0x108f3, 0x108f6, 0x108fa, 0x1091c, 0x1091e, 0x1093a, 0x1093e, 0x10940, 0x1097f, 0x109b8, 0x109bb, 0x109d0, 0x109d1, 0x10a04, 0x10a04, 0x10a07, 0x10a0b, 0x10a14, 0x10a14, 0x10a18, 0x10a18, 0x10a36, 0x10a37, 0x10a3b, 0x10a3e, 0x10a49, 0x10a4f, 0x10a59, 0x10a5f, 0x10aa0, 0x10abf, 0x10ae7, 0x10aea, 0x10af7, 0x10aff, 0x10b36, 0x10b38, 0x10b56, 0x10b57, 0x10b73, 0x10b77, 0x10b92, 0x10b98, 0x10b9d, 0x10ba8, 0x10bb0, 0x10bff, 0x10c49, 0x10c7f, 0x10cb3, 0x10cbf, 0x10cf3, 0x10cf9, 0x10d28, 0x10d2f, 0x10d3a, 0x10d3f, 0x10d66, 0x10d68, 0x10d86, 0x10d8d, 0x10d90, 0x10e5f, 0x10e7f, 0x10e7f, 0x10eaa, 0x10eaa, 0x10eae, 0x10eaf, 0x10eb2, 0x10ec1, 0x10ec5, 0x10efb, 0x10f28, 0x10f2f, 0x10f5a, 0x10f6f, 0x10f8a, 0x10faf, 0x10fcc, 0x10fdf, 0x10ff7, 0x10fff, 0x1104e, 0x11051, 0x11076, 0x1107e, 0x110c3, 0x110cc, 0x110ce, 0x110cf, 0x110e9, 0x110ef, 0x110fa, 0x110ff, 0x11135, 0x11135, 0x11148, 0x1114f, 0x11177, 0x1117f, 0x111e0, 0x111e0, 0x111f5, 0x111ff, 0x11212, 0x11212, 0x11242, 0x1127f, 0x11287, 0x11287, 0x11289, 0x11289, 0x1128e, 0x1128e, 0x1129e, 0x1129e, 0x112aa, 0x112af, 0x112eb, 0x112ef, 0x112fa, 0x112ff, 0x11304, 0x11304, 0x1130d, 0x1130e, 0x11311, 0x11312, 0x11329, 0x11329, 0x11331, 0x11331, 0x11334, 0x11334, 0x1133a, 0x1133a, 0x11345, 0x11346, 0x11349, 0x1134a, 0x1134e, 0x1134f, 0x11351, 0x11356, 0x11358, 0x1135c, 0x11364, 0x11365, 0x1136d, 0x1136f, 0x11375, 0x1137f, 0x1138a, 0x1138a, 0x1138c, 0x1138d, 0x1138f, 0x1138f, 0x113b6, 0x113b6, 0x113c1, 0x113c1, 0x113c3, 0x113c4, 0x113c6, 0x113c6, 0x113cb, 0x113cb, 0x113d6, 0x113d6, 0x113d9, 0x113e0, 0x113e3, 0x113ff, 0x1145c, 0x1145c, 0x11462, 0x1147f, 0x114c8, 0x114cf, 0x114da, 0x1157f, 0x115b6, 0x115b7, 0x115de, 0x115ff, 0x11645, 0x1164f, 0x1165a, 0x1165f, 0x1166d, 0x1167f, 0x116ba, 0x116bf, 0x116ca, 0x116cf, 0x116e4, 0x116ff, 0x1171b, 0x1171c, 0x1172c, 0x1172f, 0x11747, 0x117ff, 0x1183c, 0x1189f, 0x118f3, 0x118fe, 0x11907, 0x11908, 0x1190a, 0x1190b, 0x11914, 0x11914, 0x11917, 0x11917, 0x11936, 0x11936, 0x11939, 0x1193a, 0x11947, 0x1194f, 0x1195a, 0x1199f, 0x119a8, 0x119a9, 0x119d8, 0x119d9, 0x119e5, 0x119ff, 0x11a48, 0x11a4f, 0x11aa3, 0x11aaf, 0x11af9, 0x11aff, 0x11b0a, 0x11bbf, 0x11be2, 0x11bef, 0x11bfa, 0x11bff, 0x11c09, 0x11c09, 0x11c37, 0x11c37, 0x11c46, 0x11c4f, 0x11c6d, 0x11c6f, 0x11c90, 0x11c91, 0x11ca8, 0x11ca8, 0x11cb7, 0x11cff, 0x11d07, 0x11d07, 0x11d0a, 0x11d0a, 0x11d37, 0x11d39, 0x11d3b, 0x11d3b, 0x11d3e, 0x11d3e, 0x11d48, 0x11d4f, 0x11d5a, 0x11d5f, 0x11d66, 0x11d66, 0x11d69, 0x11d69, 0x11d8f, 0x11d8f, 0x11d92, 0x11d92, 0x11d99, 0x11d9f, 0x11daa, 0x11edf, 0x11ef9, 0x11eff, 0x11f11, 0x11f11, 0x11f3b, 0x11f3d, 0x11f5b, 0x11faf, 0x11fb1, 0x11fbf, 0x11ff2, 0x11ffe, 0x1239a, 0x123ff, 0x1246f, 0x1246f, 0x12475, 0x1247f, 0x12544, 0x12f8f, 0x12ff3, 0x12fff, 0x13456, 0x1345f, 0x143fb, 0x143ff, 0x14647, 0x160ff, 0x1613a, 0x167ff, 0x16a39, 0x16a3f, 0x16a5f, 0x16a5f, 0x16a6a, 0x16a6d, 0x16abf, 0x16abf, 0x16aca, 0x16acf, 0x16aee, 0x16aef, 0x16af6, 0x16aff, 0x16b46, 0x16b4f, 0x16b5a, 0x16b5a, 0x16b62, 0x16b62, 0x16b78, 0x16b7c, 0x16b90, 0x16d3f, 0x16d7a, 0x16e3f, 0x16e9b, 0x16eff, 0x16f4b, 0x16f4e, 0x16f88, 0x16f8e, 0x16fa0, 0x16fdf, 0x16fe5, 0x16fef, 0x16ff2, 0x16fff, 0x187f8, 0x187ff, 0x18cd6, 0x18cfe, 0x18d09, 0x1afef, 0x1aff4, 0x1aff4, 0x1affc, 0x1affc, 0x1afff, 0x1afff, 0x1b123, 0x1b131, 0x1b133, 0x1b14f, 0x1b153, 0x1b154, 0x1b156, 0x1b163, 0x1b168, 0x1b16f, 0x1b2fc, 0x1bbff, 0x1bc6b, 0x1bc6f, 0x1bc7d, 0x1bc7f, 0x1bc89, 0x1bc8f, 0x1bc9a, 0x1bc9b, 0x1bca4, 0x1cbff, 0x1ccfa, 0x1ccff, 0x1ceb4, 0x1ceff, 0x1cf2e, 0x1cf2f, 0x1cf47, 0x1cf4f, 0x1cfc4, 0x1cfff, 0x1d0f6, 0x1d0ff, 0x1d127, 0x1d128, 0x1d1eb, 0x1d1ff, 0x1d246, 0x1d2bf, 0x1d2d4, 0x1d2df, 0x1d2f4, 0x1d2ff, 0x1d357, 0x1d35f, 0x1d379, 0x1d3ff, 0x1d455, 0x1d455, 0x1d49d, 0x1d49d, 0x1d4a0, 0x1d4a1, 0x1d4a3, 0x1d4a4, 0x1d4a7, 0x1d4a8, 0x1d4ad, 0x1d4ad, 0x1d4ba, 0x1d4ba, 0x1d4bc, 0x1d4bc, 0x1d4c4, 0x1d4c4, 0x1d506, 0x1d506, 0x1d50b, 0x1d50c, 0x1d515, 0x1d515, 0x1d51d, 0x1d51d, 0x1d53a, 0x1d53a, 0x1d53f, 0x1d53f, 0x1d545, 0x1d545, 0x1d547, 0x1d549, 0x1d551, 0x1d551, 0x1d6a6, 0x1d6a7, 0x1d7cc, 0x1d7cd, 0x1da8c, 0x1da9a, 0x1daa0, 0x1daa0, 0x1dab0, 0x1deff, 0x1df1f, 0x1df24, 0x1df2b, 0x1dfff, 0x1e007, 0x1e007, 0x1e019, 0x1e01a, 0x1e022, 0x1e022, 0x1e025, 0x1e025, 0x1e02b, 0x1e02f, 0x1e06e, 0x1e08e, 0x1e090, 0x1e0ff, 0x1e12d, 0x1e12f, 0x1e13e, 0x1e13f, 0x1e14a, 0x1e14d, 0x1e150, 0x1e28f, 0x1e2af, 0x1e2bf, 0x1e2fa, 0x1e2fe, 0x1e300, 0x1e4cf, 0x1e4fa, 0x1e5cf, 0x1e5fb, 0x1e5fe, 0x1e600, 0x1e7df, 0x1e7e7, 0x1e7e7, 0x1e7ec, 0x1e7ec, 0x1e7ef, 0x1e7ef, 0x1e7ff, 0x1e7ff, 0x1e8c5, 0x1e8c6, 0x1e8d7, 0x1e8ff, 0x1e94c, 0x1e94f, 0x1e95a, 0x1e95d, 0x1e960, 0x1ec70, 0x1ecb5, 0x1ed00, 0x1ed3e, 0x1edff, 0x1ee04, 0x1ee04, 0x1ee20, 0x1ee20, 0x1ee23, 0x1ee23, 0x1ee25, 0x1ee26, 0x1ee28, 0x1ee28, 0x1ee33, 0x1ee33, 0x1ee38, 0x1ee38, 0x1ee3a, 0x1ee3a, 0x1ee3c, 0x1ee41, 0x1ee43, 0x1ee46, 0x1ee48, 0x1ee48, 0x1ee4a, 0x1ee4a, 0x1ee4c, 0x1ee4c, 0x1ee50, 0x1ee50, 0x1ee53, 0x1ee53, 0x1ee55, 0x1ee56, 0x1ee58, 0x1ee58, 0x1ee5a, 0x1ee5a, 0x1ee5c, 0x1ee5c, 0x1ee5e, 0x1ee5e, 0x1ee60, 0x1ee60, 0x1ee63, 0x1ee63, 0x1ee65, 0x1ee66, 0x1ee6b, 0x1ee6b, 0x1ee73, 0x1ee73, 0x1ee78, 0x1ee78, 0x1ee7d, 0x1ee7d, 0x1ee7f, 0x1ee7f, 0x1ee8a, 0x1ee8a, 0x1ee9c, 0x1eea0, 0x1eea4, 0x1eea4, 0x1eeaa, 0x1eeaa, 0x1eebc, 0x1eeef, 0x1eef2, 0x1efff, 0x1f02c, 0x1f02f, 0x1f094, 0x1f09f, 0x1f0af, 0x1f0b0, 0x1f0c0, 0x1f0c0, 0x1f0d0, 0x1f0d0, 0x1f0f6, 0x1f0ff, 0x1f1ae, 0x1f1e5, 0x1f203, 0x1f20f, 0x1f23c, 0x1f23f, 0x1f249, 0x1f24f, 0x1f252, 0x1f25f, 0x1f266, 0x1f2ff, 0x1f6d8, 0x1f6db, 0x1f6ed, 0x1f6ef, 0x1f6fd, 0x1f6ff, 0x1f777, 0x1f77a, 0x1f7da, 0x1f7df, 0x1f7ec, 0x1f7ef, 0x1f7f1, 0x1f7ff, 0x1f80c, 0x1f80f, 0x1f848, 0x1f84f, 0x1f85a, 0x1f85f, 0x1f888, 0x1f88f, 0x1f8ae, 0x1f8af, 0x1f8bc, 0x1f8bf, 0x1f8c2, 0x1f8ff, 0x1fa54, 0x1fa5f, 0x1fa6e, 0x1fa6f, 0x1fa7d, 0x1fa7f, 0x1fa8a, 0x1fa8e, 0x1fac7, 0x1facd, 0x1fadd, 0x1fade, 0x1faea, 0x1faef, 0x1faf9, 0x1faff, 0x1fb93, 0x1fb93, 0x1fbfa, 0x1ffff, 0x2a6e0, 0x2a6ff, 0x2b73a, 0x2b73f, 0x2b81e, 0x2b81f, 0x2cea2, 0x2ceaf, 0x2ebe1, 0x2ebef, 0x2ee5e, 0x2f7ff, 0x2fa1e, 0x2ffff, 0x3134b, 0x3134f, 0x323b0, 0xe0000, 0xe0002, 0xe001f, 0xe0080, 0xe00ff, 0xe01f0, 0x10ffff, }; /* END of CR_Unknown */ /* PROPERTY: 'Uppercase': Derived Property */ #define CR_Uppercase CR_Upper /* PROPERTY: 'Vai': Script */ static const OnigCodePoint CR_Vai[] = { 1, 0xa500, 0xa62b, }; /* END of CR_Vai */ /* PROPERTY: 'Variation_Selector': Binary Property */ static const OnigCodePoint CR_Variation_Selector[] = { 4, 0x180b, 0x180d, 0x180f, 0x180f, 0xfe00, 0xfe0f, 0xe0100, 0xe01ef, }; /* END of CR_Variation_Selector */ /* PROPERTY: 'Vithkuqi': Script */ static const OnigCodePoint CR_Vithkuqi[] = { 8, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, }; /* END of CR_Vithkuqi */ /* PROPERTY: 'Wancho': Script */ static const OnigCodePoint CR_Wancho[] = { 2, 0x1e2c0, 0x1e2f9, 0x1e2ff, 0x1e2ff, }; /* END of CR_Wancho */ /* PROPERTY: 'Warang_Citi': Script */ static const OnigCodePoint CR_Warang_Citi[] = { 2, 0x118a0, 0x118f2, 0x118ff, 0x118ff, }; /* END of CR_Warang_Citi */ /* PROPERTY: 'White_Space': Binary Property */ #define CR_White_Space CR_Space /* PROPERTY: 'XID_Continue': Derived Property */ static const OnigCodePoint CR_XID_Continue[] = { 800, 0x0030, 0x0039, 0x0041, 0x005a, 0x005f, 0x005f, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00b7, 0x00b7, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0300, 0x0374, 0x0376, 0x0377, 0x037b, 0x037d, 0x037f, 0x037f, 0x0386, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x0483, 0x0487, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0669, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06df, 0x06e8, 0x06ea, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07f5, 0x07fa, 0x07fa, 0x07fd, 0x07fd, 0x0800, 0x082d, 0x0840, 0x085b, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x08e1, 0x08e3, 0x0963, 0x0966, 0x096f, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09f1, 0x09fc, 0x09fc, 0x09fe, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0aef, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b6f, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bef, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d66, 0x0d6f, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e4e, 0x0e50, 0x0e59, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f18, 0x0f19, 0x0f20, 0x0f29, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f3e, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f84, 0x0f86, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x1000, 0x1049, 0x1050, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x135f, 0x1369, 0x1371, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1734, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17d3, 0x17d7, 0x17d7, 0x17dc, 0x17dd, 0x17e0, 0x17e9, 0x180b, 0x180d, 0x180f, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1946, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa7, 0x1aa7, 0x1ab0, 0x1abd, 0x1abf, 0x1ace, 0x1b00, 0x1b4c, 0x1b50, 0x1b59, 0x1b6b, 0x1b73, 0x1b80, 0x1bf3, 0x1c00, 0x1c37, 0x1c40, 0x1c49, 0x1c4d, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1cd0, 0x1cd2, 0x1cd4, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x200c, 0x200d, 0x203f, 0x2040, 0x2054, 0x2054, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x20d0, 0x20dc, 0x20e1, 0x20e1, 0x20e5, 0x20f0, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2118, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x2c00, 0x2ce4, 0x2ceb, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x3005, 0x3007, 0x3021, 0x302f, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x3099, 0x309a, 0x309d, 0x309f, 0x30a1, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa62b, 0xa640, 0xa66f, 0xa674, 0xa67d, 0xa67f, 0xa6f1, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa827, 0xa82c, 0xa82c, 0xa840, 0xa873, 0xa880, 0xa8c5, 0xa8d0, 0xa8d9, 0xa8e0, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa92d, 0xa930, 0xa953, 0xa960, 0xa97c, 0xa980, 0xa9c0, 0xa9cf, 0xa9d9, 0xa9e0, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa60, 0xaa76, 0xaa7a, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xabec, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfc5d, 0xfc64, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdf9, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0xfe33, 0xfe34, 0xfe4d, 0xfe4f, 0xfe71, 0xfe71, 0xfe73, 0xfe73, 0xfe77, 0xfe77, 0xfe79, 0xfe79, 0xfe7b, 0xfe7b, 0xfe7d, 0xfe7d, 0xfe7f, 0xfefc, 0xff10, 0xff19, 0xff21, 0xff3a, 0xff3f, 0xff3f, 0xff41, 0xff5a, 0xff65, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x101fd, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102e0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae6, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d6d, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f50, 0x10f70, 0x10f85, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11046, 0x11066, 0x11075, 0x1107f, 0x110ba, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x1113f, 0x11144, 0x11147, 0x11150, 0x11173, 0x11176, 0x11176, 0x11180, 0x111c4, 0x111c9, 0x111cc, 0x111ce, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d3, 0x113e1, 0x113e2, 0x11400, 0x1144a, 0x11450, 0x11459, 0x1145e, 0x11461, 0x11480, 0x114c5, 0x114c7, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115c0, 0x115d8, 0x115dd, 0x11600, 0x11640, 0x11644, 0x11644, 0x11650, 0x11659, 0x11680, 0x116b8, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11739, 0x11740, 0x11746, 0x11800, 0x1183a, 0x118a0, 0x118e9, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11943, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a3e, 0x11a47, 0x11a47, 0x11a50, 0x11a99, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c40, 0x11c50, 0x11c59, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f42, 0x11f50, 0x11f5a, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13440, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a70, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af4, 0x16b00, 0x16b36, 0x16b40, 0x16b43, 0x16b50, 0x16b59, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16d70, 0x16d79, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9d, 0x1bc9e, 0x1ccf0, 0x1ccf9, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d165, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8d0, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1fbf0, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0100, 0xe01ef, }; /* END of CR_XID_Continue */ /* PROPERTY: 'XID_Start': Derived Property */ static const OnigCodePoint CR_XID_Start[] = { 684, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0370, 0x0374, 0x0376, 0x0377, 0x037b, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0620, 0x064a, 0x066e, 0x066f, 0x0671, 0x06d3, 0x06d5, 0x06d5, 0x06e5, 0x06e6, 0x06ee, 0x06ef, 0x06fa, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x0710, 0x0712, 0x072f, 0x074d, 0x07a5, 0x07b1, 0x07b1, 0x07ca, 0x07ea, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x0800, 0x0815, 0x081a, 0x081a, 0x0824, 0x0824, 0x0828, 0x0828, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x08a0, 0x08c9, 0x0904, 0x0939, 0x093d, 0x093d, 0x0950, 0x0950, 0x0958, 0x0961, 0x0971, 0x0980, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09bd, 0x09ce, 0x09ce, 0x09dc, 0x09dd, 0x09df, 0x09e1, 0x09f0, 0x09f1, 0x09fc, 0x09fc, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a72, 0x0a74, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0abd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae1, 0x0af9, 0x0af9, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b3d, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b61, 0x0b71, 0x0b71, 0x0b83, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bd0, 0x0bd0, 0x0c05, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c3d, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c61, 0x0c80, 0x0c80, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cbd, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce1, 0x0cf1, 0x0cf2, 0x0d04, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d3d, 0x0d4e, 0x0d4e, 0x0d54, 0x0d56, 0x0d5f, 0x0d61, 0x0d7a, 0x0d7f, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0e01, 0x0e30, 0x0e32, 0x0e32, 0x0e40, 0x0e46, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb0, 0x0eb2, 0x0eb2, 0x0ebd, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f88, 0x0f8c, 0x1000, 0x102a, 0x103f, 0x103f, 0x1050, 0x1055, 0x105a, 0x105d, 0x1061, 0x1061, 0x1065, 0x1066, 0x106e, 0x1070, 0x1075, 0x1081, 0x108e, 0x108e, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1711, 0x171f, 0x1731, 0x1740, 0x1751, 0x1760, 0x176c, 0x176e, 0x1770, 0x1780, 0x17b3, 0x17d7, 0x17d7, 0x17dc, 0x17dc, 0x1820, 0x1878, 0x1880, 0x18a8, 0x18aa, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1950, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x1a00, 0x1a16, 0x1a20, 0x1a54, 0x1aa7, 0x1aa7, 0x1b05, 0x1b33, 0x1b45, 0x1b4c, 0x1b83, 0x1ba0, 0x1bae, 0x1baf, 0x1bba, 0x1be5, 0x1c00, 0x1c23, 0x1c4d, 0x1c4f, 0x1c5a, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2118, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x3005, 0x3007, 0x3021, 0x3029, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa61f, 0xa62a, 0xa62b, 0xa640, 0xa66e, 0xa67f, 0xa69d, 0xa6a0, 0xa6ef, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa801, 0xa803, 0xa805, 0xa807, 0xa80a, 0xa80c, 0xa822, 0xa840, 0xa873, 0xa882, 0xa8b3, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa8fe, 0xa90a, 0xa925, 0xa930, 0xa946, 0xa960, 0xa97c, 0xa984, 0xa9b2, 0xa9cf, 0xa9cf, 0xa9e0, 0xa9e4, 0xa9e6, 0xa9ef, 0xa9fa, 0xa9fe, 0xaa00, 0xaa28, 0xaa40, 0xaa42, 0xaa44, 0xaa4b, 0xaa60, 0xaa76, 0xaa7a, 0xaa7a, 0xaa7e, 0xaaaf, 0xaab1, 0xaab1, 0xaab5, 0xaab6, 0xaab9, 0xaabd, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaea, 0xaaf2, 0xaaf4, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabe2, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb1d, 0xfb1f, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfc5d, 0xfc64, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdf9, 0xfe71, 0xfe71, 0xfe73, 0xfe73, 0xfe77, 0xfe77, 0xfe79, 0xfe79, 0xfe7b, 0xfe7b, 0xfe7d, 0xfe7d, 0xfe7f, 0xfefc, 0xff21, 0xff3a, 0xff41, 0xff5a, 0xff66, 0xff9d, 0xffa0, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x10375, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a00, 0x10a10, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d23, 0x10d4a, 0x10d65, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11003, 0x11037, 0x11071, 0x11072, 0x11075, 0x11075, 0x11083, 0x110af, 0x110d0, 0x110e8, 0x11103, 0x11126, 0x11144, 0x11144, 0x11147, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11183, 0x111b2, 0x111c1, 0x111c4, 0x111da, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x1122b, 0x1123f, 0x11240, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112de, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x1133d, 0x11350, 0x11350, 0x1135d, 0x11361, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113b7, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11434, 0x11447, 0x1144a, 0x1145f, 0x11461, 0x11480, 0x114af, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x11580, 0x115ae, 0x115d8, 0x115db, 0x11600, 0x1162f, 0x11644, 0x11644, 0x11680, 0x116aa, 0x116b8, 0x116b8, 0x11700, 0x1171a, 0x11740, 0x11746, 0x11800, 0x1182b, 0x118a0, 0x118df, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x1192f, 0x1193f, 0x1193f, 0x11941, 0x11941, 0x119a0, 0x119a7, 0x119aa, 0x119d0, 0x119e1, 0x119e1, 0x119e3, 0x119e3, 0x11a00, 0x11a00, 0x11a0b, 0x11a32, 0x11a3a, 0x11a3a, 0x11a50, 0x11a50, 0x11a5c, 0x11a89, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11c00, 0x11c08, 0x11c0a, 0x11c2e, 0x11c40, 0x11c40, 0x11c72, 0x11c8f, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d30, 0x11d46, 0x11d46, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d89, 0x11d98, 0x11d98, 0x11ee0, 0x11ef2, 0x11f02, 0x11f02, 0x11f04, 0x11f10, 0x11f12, 0x11f33, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1611d, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a70, 0x16abe, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b40, 0x16b43, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f50, 0x16f50, 0x16f93, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e030, 0x1e06d, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e4d0, 0x1e4eb, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5f0, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e900, 0x1e943, 0x1e94b, 0x1e94b, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_XID_Start */ /* PROPERTY: 'Yezidi': Script */ static const OnigCodePoint CR_Yezidi[] = { 3, 0x10e80, 0x10ea9, 0x10eab, 0x10ead, 0x10eb0, 0x10eb1, }; /* END of CR_Yezidi */ /* PROPERTY: 'Yi': Script */ static const OnigCodePoint CR_Yi[] = { 2, 0xa000, 0xa48c, 0xa490, 0xa4c6, }; /* END of CR_Yi */ /* PROPERTY: 'Z': Major Category */ static const OnigCodePoint CR_Z[] = { 8, 0x0020, 0x0020, 0x00a0, 0x00a0, 0x1680, 0x1680, 0x2000, 0x200a, 0x2028, 0x2029, 0x202f, 0x202f, 0x205f, 0x205f, 0x3000, 0x3000, }; /* END of CR_Z */ /* PROPERTY: 'Zanabazar_Square': Script */ static const OnigCodePoint CR_Zanabazar_Square[] = { 1, 0x11a00, 0x11a47, }; /* END of CR_Zanabazar_Square */ /* PROPERTY: 'Zl': General Category */ static const OnigCodePoint CR_Zl[] = { 1, 0x2028, 0x2028, }; /* END of CR_Zl */ /* PROPERTY: 'Zp': General Category */ static const OnigCodePoint CR_Zp[] = { 1, 0x2029, 0x2029, }; /* END of CR_Zp */ /* PROPERTY: 'Zs': General Category */ static const OnigCodePoint CR_Zs[] = { 7, 0x0020, 0x0020, 0x00a0, 0x00a0, 0x1680, 0x1680, 0x2000, 0x200a, 0x202f, 0x202f, 0x205f, 0x205f, 0x3000, 0x3000, }; /* END of CR_Zs */ /* PROPERTY: 'In_Basic_Latin': Block */ #define CR_In_Basic_Latin CR_ASCII /* PROPERTY: 'In_Latin_1_Supplement': Block */ static const OnigCodePoint CR_In_Latin_1_Supplement[] = { 1, 0x0080, 0x00ff, }; /* END of CR_In_Latin_1_Supplement */ /* PROPERTY: 'In_Latin_Extended_A': Block */ static const OnigCodePoint CR_In_Latin_Extended_A[] = { 1, 0x0100, 0x017f, }; /* END of CR_In_Latin_Extended_A */ /* PROPERTY: 'In_Latin_Extended_B': Block */ static const OnigCodePoint CR_In_Latin_Extended_B[] = { 1, 0x0180, 0x024f, }; /* END of CR_In_Latin_Extended_B */ /* PROPERTY: 'In_IPA_Extensions': Block */ static const OnigCodePoint CR_In_IPA_Extensions[] = { 1, 0x0250, 0x02af, }; /* END of CR_In_IPA_Extensions */ /* PROPERTY: 'In_Spacing_Modifier_Letters': Block */ static const OnigCodePoint CR_In_Spacing_Modifier_Letters[] = { 1, 0x02b0, 0x02ff, }; /* END of CR_In_Spacing_Modifier_Letters */ /* PROPERTY: 'In_Combining_Diacritical_Marks': Block */ static const OnigCodePoint CR_In_Combining_Diacritical_Marks[] = { 1, 0x0300, 0x036f, }; /* END of CR_In_Combining_Diacritical_Marks */ /* PROPERTY: 'In_Greek_and_Coptic': Block */ static const OnigCodePoint CR_In_Greek_and_Coptic[] = { 1, 0x0370, 0x03ff, }; /* END of CR_In_Greek_and_Coptic */ /* PROPERTY: 'In_Cyrillic': Block */ static const OnigCodePoint CR_In_Cyrillic[] = { 1, 0x0400, 0x04ff, }; /* END of CR_In_Cyrillic */ /* PROPERTY: 'In_Cyrillic_Supplement': Block */ static const OnigCodePoint CR_In_Cyrillic_Supplement[] = { 1, 0x0500, 0x052f, }; /* END of CR_In_Cyrillic_Supplement */ /* PROPERTY: 'In_Armenian': Block */ static const OnigCodePoint CR_In_Armenian[] = { 1, 0x0530, 0x058f, }; /* END of CR_In_Armenian */ /* PROPERTY: 'In_Hebrew': Block */ static const OnigCodePoint CR_In_Hebrew[] = { 1, 0x0590, 0x05ff, }; /* END of CR_In_Hebrew */ /* PROPERTY: 'In_Arabic': Block */ static const OnigCodePoint CR_In_Arabic[] = { 1, 0x0600, 0x06ff, }; /* END of CR_In_Arabic */ /* PROPERTY: 'In_Syriac': Block */ static const OnigCodePoint CR_In_Syriac[] = { 1, 0x0700, 0x074f, }; /* END of CR_In_Syriac */ /* PROPERTY: 'In_Arabic_Supplement': Block */ static const OnigCodePoint CR_In_Arabic_Supplement[] = { 1, 0x0750, 0x077f, }; /* END of CR_In_Arabic_Supplement */ /* PROPERTY: 'In_Thaana': Block */ static const OnigCodePoint CR_In_Thaana[] = { 1, 0x0780, 0x07bf, }; /* END of CR_In_Thaana */ /* PROPERTY: 'In_NKo': Block */ static const OnigCodePoint CR_In_NKo[] = { 1, 0x07c0, 0x07ff, }; /* END of CR_In_NKo */ /* PROPERTY: 'In_Samaritan': Block */ static const OnigCodePoint CR_In_Samaritan[] = { 1, 0x0800, 0x083f, }; /* END of CR_In_Samaritan */ /* PROPERTY: 'In_Mandaic': Block */ static const OnigCodePoint CR_In_Mandaic[] = { 1, 0x0840, 0x085f, }; /* END of CR_In_Mandaic */ /* PROPERTY: 'In_Syriac_Supplement': Block */ static const OnigCodePoint CR_In_Syriac_Supplement[] = { 1, 0x0860, 0x086f, }; /* END of CR_In_Syriac_Supplement */ /* PROPERTY: 'In_Arabic_Extended_B': Block */ static const OnigCodePoint CR_In_Arabic_Extended_B[] = { 1, 0x0870, 0x089f, }; /* END of CR_In_Arabic_Extended_B */ /* PROPERTY: 'In_Arabic_Extended_A': Block */ static const OnigCodePoint CR_In_Arabic_Extended_A[] = { 1, 0x08a0, 0x08ff, }; /* END of CR_In_Arabic_Extended_A */ /* PROPERTY: 'In_Devanagari': Block */ static const OnigCodePoint CR_In_Devanagari[] = { 1, 0x0900, 0x097f, }; /* END of CR_In_Devanagari */ /* PROPERTY: 'In_Bengali': Block */ static const OnigCodePoint CR_In_Bengali[] = { 1, 0x0980, 0x09ff, }; /* END of CR_In_Bengali */ /* PROPERTY: 'In_Gurmukhi': Block */ static const OnigCodePoint CR_In_Gurmukhi[] = { 1, 0x0a00, 0x0a7f, }; /* END of CR_In_Gurmukhi */ /* PROPERTY: 'In_Gujarati': Block */ static const OnigCodePoint CR_In_Gujarati[] = { 1, 0x0a80, 0x0aff, }; /* END of CR_In_Gujarati */ /* PROPERTY: 'In_Oriya': Block */ static const OnigCodePoint CR_In_Oriya[] = { 1, 0x0b00, 0x0b7f, }; /* END of CR_In_Oriya */ /* PROPERTY: 'In_Tamil': Block */ static const OnigCodePoint CR_In_Tamil[] = { 1, 0x0b80, 0x0bff, }; /* END of CR_In_Tamil */ /* PROPERTY: 'In_Telugu': Block */ static const OnigCodePoint CR_In_Telugu[] = { 1, 0x0c00, 0x0c7f, }; /* END of CR_In_Telugu */ /* PROPERTY: 'In_Kannada': Block */ static const OnigCodePoint CR_In_Kannada[] = { 1, 0x0c80, 0x0cff, }; /* END of CR_In_Kannada */ /* PROPERTY: 'In_Malayalam': Block */ static const OnigCodePoint CR_In_Malayalam[] = { 1, 0x0d00, 0x0d7f, }; /* END of CR_In_Malayalam */ /* PROPERTY: 'In_Sinhala': Block */ static const OnigCodePoint CR_In_Sinhala[] = { 1, 0x0d80, 0x0dff, }; /* END of CR_In_Sinhala */ /* PROPERTY: 'In_Thai': Block */ static const OnigCodePoint CR_In_Thai[] = { 1, 0x0e00, 0x0e7f, }; /* END of CR_In_Thai */ /* PROPERTY: 'In_Lao': Block */ static const OnigCodePoint CR_In_Lao[] = { 1, 0x0e80, 0x0eff, }; /* END of CR_In_Lao */ /* PROPERTY: 'In_Tibetan': Block */ static const OnigCodePoint CR_In_Tibetan[] = { 1, 0x0f00, 0x0fff, }; /* END of CR_In_Tibetan */ /* PROPERTY: 'In_Myanmar': Block */ static const OnigCodePoint CR_In_Myanmar[] = { 1, 0x1000, 0x109f, }; /* END of CR_In_Myanmar */ /* PROPERTY: 'In_Georgian': Block */ static const OnigCodePoint CR_In_Georgian[] = { 1, 0x10a0, 0x10ff, }; /* END of CR_In_Georgian */ /* PROPERTY: 'In_Hangul_Jamo': Block */ static const OnigCodePoint CR_In_Hangul_Jamo[] = { 1, 0x1100, 0x11ff, }; /* END of CR_In_Hangul_Jamo */ /* PROPERTY: 'In_Ethiopic': Block */ static const OnigCodePoint CR_In_Ethiopic[] = { 1, 0x1200, 0x137f, }; /* END of CR_In_Ethiopic */ /* PROPERTY: 'In_Ethiopic_Supplement': Block */ static const OnigCodePoint CR_In_Ethiopic_Supplement[] = { 1, 0x1380, 0x139f, }; /* END of CR_In_Ethiopic_Supplement */ /* PROPERTY: 'In_Cherokee': Block */ static const OnigCodePoint CR_In_Cherokee[] = { 1, 0x13a0, 0x13ff, }; /* END of CR_In_Cherokee */ /* PROPERTY: 'In_Unified_Canadian_Aboriginal_Syllabics': Block */ static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics[] = { 1, 0x1400, 0x167f, }; /* END of CR_In_Unified_Canadian_Aboriginal_Syllabics */ /* PROPERTY: 'In_Ogham': Block */ static const OnigCodePoint CR_In_Ogham[] = { 1, 0x1680, 0x169f, }; /* END of CR_In_Ogham */ /* PROPERTY: 'In_Runic': Block */ static const OnigCodePoint CR_In_Runic[] = { 1, 0x16a0, 0x16ff, }; /* END of CR_In_Runic */ /* PROPERTY: 'In_Tagalog': Block */ static const OnigCodePoint CR_In_Tagalog[] = { 1, 0x1700, 0x171f, }; /* END of CR_In_Tagalog */ /* PROPERTY: 'In_Hanunoo': Block */ static const OnigCodePoint CR_In_Hanunoo[] = { 1, 0x1720, 0x173f, }; /* END of CR_In_Hanunoo */ /* PROPERTY: 'In_Buhid': Block */ static const OnigCodePoint CR_In_Buhid[] = { 1, 0x1740, 0x175f, }; /* END of CR_In_Buhid */ /* PROPERTY: 'In_Tagbanwa': Block */ static const OnigCodePoint CR_In_Tagbanwa[] = { 1, 0x1760, 0x177f, }; /* END of CR_In_Tagbanwa */ /* PROPERTY: 'In_Khmer': Block */ static const OnigCodePoint CR_In_Khmer[] = { 1, 0x1780, 0x17ff, }; /* END of CR_In_Khmer */ /* PROPERTY: 'In_Mongolian': Block */ static const OnigCodePoint CR_In_Mongolian[] = { 1, 0x1800, 0x18af, }; /* END of CR_In_Mongolian */ /* PROPERTY: 'In_Unified_Canadian_Aboriginal_Syllabics_Extended': Block */ static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended[] = { 1, 0x18b0, 0x18ff, }; /* END of CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended */ /* PROPERTY: 'In_Limbu': Block */ static const OnigCodePoint CR_In_Limbu[] = { 1, 0x1900, 0x194f, }; /* END of CR_In_Limbu */ /* PROPERTY: 'In_Tai_Le': Block */ static const OnigCodePoint CR_In_Tai_Le[] = { 1, 0x1950, 0x197f, }; /* END of CR_In_Tai_Le */ /* PROPERTY: 'In_New_Tai_Lue': Block */ static const OnigCodePoint CR_In_New_Tai_Lue[] = { 1, 0x1980, 0x19df, }; /* END of CR_In_New_Tai_Lue */ /* PROPERTY: 'In_Khmer_Symbols': Block */ static const OnigCodePoint CR_In_Khmer_Symbols[] = { 1, 0x19e0, 0x19ff, }; /* END of CR_In_Khmer_Symbols */ /* PROPERTY: 'In_Buginese': Block */ static const OnigCodePoint CR_In_Buginese[] = { 1, 0x1a00, 0x1a1f, }; /* END of CR_In_Buginese */ /* PROPERTY: 'In_Tai_Tham': Block */ static const OnigCodePoint CR_In_Tai_Tham[] = { 1, 0x1a20, 0x1aaf, }; /* END of CR_In_Tai_Tham */ /* PROPERTY: 'In_Combining_Diacritical_Marks_Extended': Block */ static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Extended[] = { 1, 0x1ab0, 0x1aff, }; /* END of CR_In_Combining_Diacritical_Marks_Extended */ /* PROPERTY: 'In_Balinese': Block */ static const OnigCodePoint CR_In_Balinese[] = { 1, 0x1b00, 0x1b7f, }; /* END of CR_In_Balinese */ /* PROPERTY: 'In_Sundanese': Block */ static const OnigCodePoint CR_In_Sundanese[] = { 1, 0x1b80, 0x1bbf, }; /* END of CR_In_Sundanese */ /* PROPERTY: 'In_Batak': Block */ static const OnigCodePoint CR_In_Batak[] = { 1, 0x1bc0, 0x1bff, }; /* END of CR_In_Batak */ /* PROPERTY: 'In_Lepcha': Block */ static const OnigCodePoint CR_In_Lepcha[] = { 1, 0x1c00, 0x1c4f, }; /* END of CR_In_Lepcha */ /* PROPERTY: 'In_Ol_Chiki': Block */ #define CR_In_Ol_Chiki CR_Ol_Chiki /* PROPERTY: 'In_Cyrillic_Extended_C': Block */ static const OnigCodePoint CR_In_Cyrillic_Extended_C[] = { 1, 0x1c80, 0x1c8f, }; /* END of CR_In_Cyrillic_Extended_C */ /* PROPERTY: 'In_Georgian_Extended': Block */ static const OnigCodePoint CR_In_Georgian_Extended[] = { 1, 0x1c90, 0x1cbf, }; /* END of CR_In_Georgian_Extended */ /* PROPERTY: 'In_Sundanese_Supplement': Block */ static const OnigCodePoint CR_In_Sundanese_Supplement[] = { 1, 0x1cc0, 0x1ccf, }; /* END of CR_In_Sundanese_Supplement */ /* PROPERTY: 'In_Vedic_Extensions': Block */ static const OnigCodePoint CR_In_Vedic_Extensions[] = { 1, 0x1cd0, 0x1cff, }; /* END of CR_In_Vedic_Extensions */ /* PROPERTY: 'In_Phonetic_Extensions': Block */ static const OnigCodePoint CR_In_Phonetic_Extensions[] = { 1, 0x1d00, 0x1d7f, }; /* END of CR_In_Phonetic_Extensions */ /* PROPERTY: 'In_Phonetic_Extensions_Supplement': Block */ static const OnigCodePoint CR_In_Phonetic_Extensions_Supplement[] = { 1, 0x1d80, 0x1dbf, }; /* END of CR_In_Phonetic_Extensions_Supplement */ /* PROPERTY: 'In_Combining_Diacritical_Marks_Supplement': Block */ static const OnigCodePoint CR_In_Combining_Diacritical_Marks_Supplement[] = { 1, 0x1dc0, 0x1dff, }; /* END of CR_In_Combining_Diacritical_Marks_Supplement */ /* PROPERTY: 'In_Latin_Extended_Additional': Block */ static const OnigCodePoint CR_In_Latin_Extended_Additional[] = { 1, 0x1e00, 0x1eff, }; /* END of CR_In_Latin_Extended_Additional */ /* PROPERTY: 'In_Greek_Extended': Block */ static const OnigCodePoint CR_In_Greek_Extended[] = { 1, 0x1f00, 0x1fff, }; /* END of CR_In_Greek_Extended */ /* PROPERTY: 'In_General_Punctuation': Block */ static const OnigCodePoint CR_In_General_Punctuation[] = { 1, 0x2000, 0x206f, }; /* END of CR_In_General_Punctuation */ /* PROPERTY: 'In_Superscripts_and_Subscripts': Block */ static const OnigCodePoint CR_In_Superscripts_and_Subscripts[] = { 1, 0x2070, 0x209f, }; /* END of CR_In_Superscripts_and_Subscripts */ /* PROPERTY: 'In_Currency_Symbols': Block */ static const OnigCodePoint CR_In_Currency_Symbols[] = { 1, 0x20a0, 0x20cf, }; /* END of CR_In_Currency_Symbols */ /* PROPERTY: 'In_Combining_Diacritical_Marks_for_Symbols': Block */ static const OnigCodePoint CR_In_Combining_Diacritical_Marks_for_Symbols[] = { 1, 0x20d0, 0x20ff, }; /* END of CR_In_Combining_Diacritical_Marks_for_Symbols */ /* PROPERTY: 'In_Letterlike_Symbols': Block */ static const OnigCodePoint CR_In_Letterlike_Symbols[] = { 1, 0x2100, 0x214f, }; /* END of CR_In_Letterlike_Symbols */ /* PROPERTY: 'In_Number_Forms': Block */ static const OnigCodePoint CR_In_Number_Forms[] = { 1, 0x2150, 0x218f, }; /* END of CR_In_Number_Forms */ /* PROPERTY: 'In_Arrows': Block */ static const OnigCodePoint CR_In_Arrows[] = { 1, 0x2190, 0x21ff, }; /* END of CR_In_Arrows */ /* PROPERTY: 'In_Mathematical_Operators': Block */ static const OnigCodePoint CR_In_Mathematical_Operators[] = { 1, 0x2200, 0x22ff, }; /* END of CR_In_Mathematical_Operators */ /* PROPERTY: 'In_Miscellaneous_Technical': Block */ static const OnigCodePoint CR_In_Miscellaneous_Technical[] = { 1, 0x2300, 0x23ff, }; /* END of CR_In_Miscellaneous_Technical */ /* PROPERTY: 'In_Control_Pictures': Block */ static const OnigCodePoint CR_In_Control_Pictures[] = { 1, 0x2400, 0x243f, }; /* END of CR_In_Control_Pictures */ /* PROPERTY: 'In_Optical_Character_Recognition': Block */ static const OnigCodePoint CR_In_Optical_Character_Recognition[] = { 1, 0x2440, 0x245f, }; /* END of CR_In_Optical_Character_Recognition */ /* PROPERTY: 'In_Enclosed_Alphanumerics': Block */ static const OnigCodePoint CR_In_Enclosed_Alphanumerics[] = { 1, 0x2460, 0x24ff, }; /* END of CR_In_Enclosed_Alphanumerics */ /* PROPERTY: 'In_Box_Drawing': Block */ static const OnigCodePoint CR_In_Box_Drawing[] = { 1, 0x2500, 0x257f, }; /* END of CR_In_Box_Drawing */ /* PROPERTY: 'In_Block_Elements': Block */ static const OnigCodePoint CR_In_Block_Elements[] = { 1, 0x2580, 0x259f, }; /* END of CR_In_Block_Elements */ /* PROPERTY: 'In_Geometric_Shapes': Block */ static const OnigCodePoint CR_In_Geometric_Shapes[] = { 1, 0x25a0, 0x25ff, }; /* END of CR_In_Geometric_Shapes */ /* PROPERTY: 'In_Miscellaneous_Symbols': Block */ static const OnigCodePoint CR_In_Miscellaneous_Symbols[] = { 1, 0x2600, 0x26ff, }; /* END of CR_In_Miscellaneous_Symbols */ /* PROPERTY: 'In_Dingbats': Block */ static const OnigCodePoint CR_In_Dingbats[] = { 1, 0x2700, 0x27bf, }; /* END of CR_In_Dingbats */ /* PROPERTY: 'In_Miscellaneous_Mathematical_Symbols_A': Block */ static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_A[] = { 1, 0x27c0, 0x27ef, }; /* END of CR_In_Miscellaneous_Mathematical_Symbols_A */ /* PROPERTY: 'In_Supplemental_Arrows_A': Block */ static const OnigCodePoint CR_In_Supplemental_Arrows_A[] = { 1, 0x27f0, 0x27ff, }; /* END of CR_In_Supplemental_Arrows_A */ /* PROPERTY: 'In_Braille_Patterns': Block */ #define CR_In_Braille_Patterns CR_Braille /* PROPERTY: 'In_Supplemental_Arrows_B': Block */ static const OnigCodePoint CR_In_Supplemental_Arrows_B[] = { 1, 0x2900, 0x297f, }; /* END of CR_In_Supplemental_Arrows_B */ /* PROPERTY: 'In_Miscellaneous_Mathematical_Symbols_B': Block */ static const OnigCodePoint CR_In_Miscellaneous_Mathematical_Symbols_B[] = { 1, 0x2980, 0x29ff, }; /* END of CR_In_Miscellaneous_Mathematical_Symbols_B */ /* PROPERTY: 'In_Supplemental_Mathematical_Operators': Block */ static const OnigCodePoint CR_In_Supplemental_Mathematical_Operators[] = { 1, 0x2a00, 0x2aff, }; /* END of CR_In_Supplemental_Mathematical_Operators */ /* PROPERTY: 'In_Miscellaneous_Symbols_and_Arrows': Block */ static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Arrows[] = { 1, 0x2b00, 0x2bff, }; /* END of CR_In_Miscellaneous_Symbols_and_Arrows */ /* PROPERTY: 'In_Glagolitic': Block */ static const OnigCodePoint CR_In_Glagolitic[] = { 1, 0x2c00, 0x2c5f, }; /* END of CR_In_Glagolitic */ /* PROPERTY: 'In_Latin_Extended_C': Block */ static const OnigCodePoint CR_In_Latin_Extended_C[] = { 1, 0x2c60, 0x2c7f, }; /* END of CR_In_Latin_Extended_C */ /* PROPERTY: 'In_Coptic': Block */ static const OnigCodePoint CR_In_Coptic[] = { 1, 0x2c80, 0x2cff, }; /* END of CR_In_Coptic */ /* PROPERTY: 'In_Georgian_Supplement': Block */ static const OnigCodePoint CR_In_Georgian_Supplement[] = { 1, 0x2d00, 0x2d2f, }; /* END of CR_In_Georgian_Supplement */ /* PROPERTY: 'In_Tifinagh': Block */ static const OnigCodePoint CR_In_Tifinagh[] = { 1, 0x2d30, 0x2d7f, }; /* END of CR_In_Tifinagh */ /* PROPERTY: 'In_Ethiopic_Extended': Block */ static const OnigCodePoint CR_In_Ethiopic_Extended[] = { 1, 0x2d80, 0x2ddf, }; /* END of CR_In_Ethiopic_Extended */ /* PROPERTY: 'In_Cyrillic_Extended_A': Block */ static const OnigCodePoint CR_In_Cyrillic_Extended_A[] = { 1, 0x2de0, 0x2dff, }; /* END of CR_In_Cyrillic_Extended_A */ /* PROPERTY: 'In_Supplemental_Punctuation': Block */ static const OnigCodePoint CR_In_Supplemental_Punctuation[] = { 1, 0x2e00, 0x2e7f, }; /* END of CR_In_Supplemental_Punctuation */ /* PROPERTY: 'In_CJK_Radicals_Supplement': Block */ static const OnigCodePoint CR_In_CJK_Radicals_Supplement[] = { 1, 0x2e80, 0x2eff, }; /* END of CR_In_CJK_Radicals_Supplement */ /* PROPERTY: 'In_Kangxi_Radicals': Block */ static const OnigCodePoint CR_In_Kangxi_Radicals[] = { 1, 0x2f00, 0x2fdf, }; /* END of CR_In_Kangxi_Radicals */ /* PROPERTY: 'In_Ideographic_Description_Characters': Block */ static const OnigCodePoint CR_In_Ideographic_Description_Characters[] = { 1, 0x2ff0, 0x2fff, }; /* END of CR_In_Ideographic_Description_Characters */ /* PROPERTY: 'In_CJK_Symbols_and_Punctuation': Block */ static const OnigCodePoint CR_In_CJK_Symbols_and_Punctuation[] = { 1, 0x3000, 0x303f, }; /* END of CR_In_CJK_Symbols_and_Punctuation */ /* PROPERTY: 'In_Hiragana': Block */ static const OnigCodePoint CR_In_Hiragana[] = { 1, 0x3040, 0x309f, }; /* END of CR_In_Hiragana */ /* PROPERTY: 'In_Katakana': Block */ static const OnigCodePoint CR_In_Katakana[] = { 1, 0x30a0, 0x30ff, }; /* END of CR_In_Katakana */ /* PROPERTY: 'In_Bopomofo': Block */ static const OnigCodePoint CR_In_Bopomofo[] = { 1, 0x3100, 0x312f, }; /* END of CR_In_Bopomofo */ /* PROPERTY: 'In_Hangul_Compatibility_Jamo': Block */ static const OnigCodePoint CR_In_Hangul_Compatibility_Jamo[] = { 1, 0x3130, 0x318f, }; /* END of CR_In_Hangul_Compatibility_Jamo */ /* PROPERTY: 'In_Kanbun': Block */ static const OnigCodePoint CR_In_Kanbun[] = { 1, 0x3190, 0x319f, }; /* END of CR_In_Kanbun */ /* PROPERTY: 'In_Bopomofo_Extended': Block */ static const OnigCodePoint CR_In_Bopomofo_Extended[] = { 1, 0x31a0, 0x31bf, }; /* END of CR_In_Bopomofo_Extended */ /* PROPERTY: 'In_CJK_Strokes': Block */ static const OnigCodePoint CR_In_CJK_Strokes[] = { 1, 0x31c0, 0x31ef, }; /* END of CR_In_CJK_Strokes */ /* PROPERTY: 'In_Katakana_Phonetic_Extensions': Block */ static const OnigCodePoint CR_In_Katakana_Phonetic_Extensions[] = { 1, 0x31f0, 0x31ff, }; /* END of CR_In_Katakana_Phonetic_Extensions */ /* PROPERTY: 'In_Enclosed_CJK_Letters_and_Months': Block */ static const OnigCodePoint CR_In_Enclosed_CJK_Letters_and_Months[] = { 1, 0x3200, 0x32ff, }; /* END of CR_In_Enclosed_CJK_Letters_and_Months */ /* PROPERTY: 'In_CJK_Compatibility': Block */ static const OnigCodePoint CR_In_CJK_Compatibility[] = { 1, 0x3300, 0x33ff, }; /* END of CR_In_CJK_Compatibility */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_A': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_A[] = { 1, 0x3400, 0x4dbf, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_A */ /* PROPERTY: 'In_Yijing_Hexagram_Symbols': Block */ static const OnigCodePoint CR_In_Yijing_Hexagram_Symbols[] = { 1, 0x4dc0, 0x4dff, }; /* END of CR_In_Yijing_Hexagram_Symbols */ /* PROPERTY: 'In_CJK_Unified_Ideographs': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs[] = { 1, 0x4e00, 0x9fff, }; /* END of CR_In_CJK_Unified_Ideographs */ /* PROPERTY: 'In_Yi_Syllables': Block */ static const OnigCodePoint CR_In_Yi_Syllables[] = { 1, 0xa000, 0xa48f, }; /* END of CR_In_Yi_Syllables */ /* PROPERTY: 'In_Yi_Radicals': Block */ static const OnigCodePoint CR_In_Yi_Radicals[] = { 1, 0xa490, 0xa4cf, }; /* END of CR_In_Yi_Radicals */ /* PROPERTY: 'In_Lisu': Block */ static const OnigCodePoint CR_In_Lisu[] = { 1, 0xa4d0, 0xa4ff, }; /* END of CR_In_Lisu */ /* PROPERTY: 'In_Vai': Block */ static const OnigCodePoint CR_In_Vai[] = { 1, 0xa500, 0xa63f, }; /* END of CR_In_Vai */ /* PROPERTY: 'In_Cyrillic_Extended_B': Block */ static const OnigCodePoint CR_In_Cyrillic_Extended_B[] = { 1, 0xa640, 0xa69f, }; /* END of CR_In_Cyrillic_Extended_B */ /* PROPERTY: 'In_Bamum': Block */ static const OnigCodePoint CR_In_Bamum[] = { 1, 0xa6a0, 0xa6ff, }; /* END of CR_In_Bamum */ /* PROPERTY: 'In_Modifier_Tone_Letters': Block */ static const OnigCodePoint CR_In_Modifier_Tone_Letters[] = { 1, 0xa700, 0xa71f, }; /* END of CR_In_Modifier_Tone_Letters */ /* PROPERTY: 'In_Latin_Extended_D': Block */ static const OnigCodePoint CR_In_Latin_Extended_D[] = { 1, 0xa720, 0xa7ff, }; /* END of CR_In_Latin_Extended_D */ /* PROPERTY: 'In_Syloti_Nagri': Block */ static const OnigCodePoint CR_In_Syloti_Nagri[] = { 1, 0xa800, 0xa82f, }; /* END of CR_In_Syloti_Nagri */ /* PROPERTY: 'In_Common_Indic_Number_Forms': Block */ static const OnigCodePoint CR_In_Common_Indic_Number_Forms[] = { 1, 0xa830, 0xa83f, }; /* END of CR_In_Common_Indic_Number_Forms */ /* PROPERTY: 'In_Phags_pa': Block */ static const OnigCodePoint CR_In_Phags_pa[] = { 1, 0xa840, 0xa87f, }; /* END of CR_In_Phags_pa */ /* PROPERTY: 'In_Saurashtra': Block */ static const OnigCodePoint CR_In_Saurashtra[] = { 1, 0xa880, 0xa8df, }; /* END of CR_In_Saurashtra */ /* PROPERTY: 'In_Devanagari_Extended': Block */ static const OnigCodePoint CR_In_Devanagari_Extended[] = { 1, 0xa8e0, 0xa8ff, }; /* END of CR_In_Devanagari_Extended */ /* PROPERTY: 'In_Kayah_Li': Block */ static const OnigCodePoint CR_In_Kayah_Li[] = { 1, 0xa900, 0xa92f, }; /* END of CR_In_Kayah_Li */ /* PROPERTY: 'In_Rejang': Block */ static const OnigCodePoint CR_In_Rejang[] = { 1, 0xa930, 0xa95f, }; /* END of CR_In_Rejang */ /* PROPERTY: 'In_Hangul_Jamo_Extended_A': Block */ static const OnigCodePoint CR_In_Hangul_Jamo_Extended_A[] = { 1, 0xa960, 0xa97f, }; /* END of CR_In_Hangul_Jamo_Extended_A */ /* PROPERTY: 'In_Javanese': Block */ static const OnigCodePoint CR_In_Javanese[] = { 1, 0xa980, 0xa9df, }; /* END of CR_In_Javanese */ /* PROPERTY: 'In_Myanmar_Extended_B': Block */ static const OnigCodePoint CR_In_Myanmar_Extended_B[] = { 1, 0xa9e0, 0xa9ff, }; /* END of CR_In_Myanmar_Extended_B */ /* PROPERTY: 'In_Cham': Block */ static const OnigCodePoint CR_In_Cham[] = { 1, 0xaa00, 0xaa5f, }; /* END of CR_In_Cham */ /* PROPERTY: 'In_Myanmar_Extended_A': Block */ static const OnigCodePoint CR_In_Myanmar_Extended_A[] = { 1, 0xaa60, 0xaa7f, }; /* END of CR_In_Myanmar_Extended_A */ /* PROPERTY: 'In_Tai_Viet': Block */ static const OnigCodePoint CR_In_Tai_Viet[] = { 1, 0xaa80, 0xaadf, }; /* END of CR_In_Tai_Viet */ /* PROPERTY: 'In_Meetei_Mayek_Extensions': Block */ static const OnigCodePoint CR_In_Meetei_Mayek_Extensions[] = { 1, 0xaae0, 0xaaff, }; /* END of CR_In_Meetei_Mayek_Extensions */ /* PROPERTY: 'In_Ethiopic_Extended_A': Block */ static const OnigCodePoint CR_In_Ethiopic_Extended_A[] = { 1, 0xab00, 0xab2f, }; /* END of CR_In_Ethiopic_Extended_A */ /* PROPERTY: 'In_Latin_Extended_E': Block */ static const OnigCodePoint CR_In_Latin_Extended_E[] = { 1, 0xab30, 0xab6f, }; /* END of CR_In_Latin_Extended_E */ /* PROPERTY: 'In_Cherokee_Supplement': Block */ static const OnigCodePoint CR_In_Cherokee_Supplement[] = { 1, 0xab70, 0xabbf, }; /* END of CR_In_Cherokee_Supplement */ /* PROPERTY: 'In_Meetei_Mayek': Block */ static const OnigCodePoint CR_In_Meetei_Mayek[] = { 1, 0xabc0, 0xabff, }; /* END of CR_In_Meetei_Mayek */ /* PROPERTY: 'In_Hangul_Syllables': Block */ static const OnigCodePoint CR_In_Hangul_Syllables[] = { 1, 0xac00, 0xd7af, }; /* END of CR_In_Hangul_Syllables */ /* PROPERTY: 'In_Hangul_Jamo_Extended_B': Block */ static const OnigCodePoint CR_In_Hangul_Jamo_Extended_B[] = { 1, 0xd7b0, 0xd7ff, }; /* END of CR_In_Hangul_Jamo_Extended_B */ /* PROPERTY: 'In_High_Surrogates': Block */ static const OnigCodePoint CR_In_High_Surrogates[] = { 1, 0xd800, 0xdb7f, }; /* END of CR_In_High_Surrogates */ /* PROPERTY: 'In_High_Private_Use_Surrogates': Block */ static const OnigCodePoint CR_In_High_Private_Use_Surrogates[] = { 1, 0xdb80, 0xdbff, }; /* END of CR_In_High_Private_Use_Surrogates */ /* PROPERTY: 'In_Low_Surrogates': Block */ static const OnigCodePoint CR_In_Low_Surrogates[] = { 1, 0xdc00, 0xdfff, }; /* END of CR_In_Low_Surrogates */ /* PROPERTY: 'In_Private_Use_Area': Block */ static const OnigCodePoint CR_In_Private_Use_Area[] = { 1, 0xe000, 0xf8ff, }; /* END of CR_In_Private_Use_Area */ /* PROPERTY: 'In_CJK_Compatibility_Ideographs': Block */ static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs[] = { 1, 0xf900, 0xfaff, }; /* END of CR_In_CJK_Compatibility_Ideographs */ /* PROPERTY: 'In_Alphabetic_Presentation_Forms': Block */ static const OnigCodePoint CR_In_Alphabetic_Presentation_Forms[] = { 1, 0xfb00, 0xfb4f, }; /* END of CR_In_Alphabetic_Presentation_Forms */ /* PROPERTY: 'In_Arabic_Presentation_Forms_A': Block */ static const OnigCodePoint CR_In_Arabic_Presentation_Forms_A[] = { 1, 0xfb50, 0xfdff, }; /* END of CR_In_Arabic_Presentation_Forms_A */ /* PROPERTY: 'In_Variation_Selectors': Block */ static const OnigCodePoint CR_In_Variation_Selectors[] = { 1, 0xfe00, 0xfe0f, }; /* END of CR_In_Variation_Selectors */ /* PROPERTY: 'In_Vertical_Forms': Block */ static const OnigCodePoint CR_In_Vertical_Forms[] = { 1, 0xfe10, 0xfe1f, }; /* END of CR_In_Vertical_Forms */ /* PROPERTY: 'In_Combining_Half_Marks': Block */ static const OnigCodePoint CR_In_Combining_Half_Marks[] = { 1, 0xfe20, 0xfe2f, }; /* END of CR_In_Combining_Half_Marks */ /* PROPERTY: 'In_CJK_Compatibility_Forms': Block */ static const OnigCodePoint CR_In_CJK_Compatibility_Forms[] = { 1, 0xfe30, 0xfe4f, }; /* END of CR_In_CJK_Compatibility_Forms */ /* PROPERTY: 'In_Small_Form_Variants': Block */ static const OnigCodePoint CR_In_Small_Form_Variants[] = { 1, 0xfe50, 0xfe6f, }; /* END of CR_In_Small_Form_Variants */ /* PROPERTY: 'In_Arabic_Presentation_Forms_B': Block */ static const OnigCodePoint CR_In_Arabic_Presentation_Forms_B[] = { 1, 0xfe70, 0xfeff, }; /* END of CR_In_Arabic_Presentation_Forms_B */ /* PROPERTY: 'In_Halfwidth_and_Fullwidth_Forms': Block */ static const OnigCodePoint CR_In_Halfwidth_and_Fullwidth_Forms[] = { 1, 0xff00, 0xffef, }; /* END of CR_In_Halfwidth_and_Fullwidth_Forms */ /* PROPERTY: 'In_Specials': Block */ static const OnigCodePoint CR_In_Specials[] = { 1, 0xfff0, 0xffff, }; /* END of CR_In_Specials */ /* PROPERTY: 'In_Linear_B_Syllabary': Block */ static const OnigCodePoint CR_In_Linear_B_Syllabary[] = { 1, 0x10000, 0x1007f, }; /* END of CR_In_Linear_B_Syllabary */ /* PROPERTY: 'In_Linear_B_Ideograms': Block */ static const OnigCodePoint CR_In_Linear_B_Ideograms[] = { 1, 0x10080, 0x100ff, }; /* END of CR_In_Linear_B_Ideograms */ /* PROPERTY: 'In_Aegean_Numbers': Block */ static const OnigCodePoint CR_In_Aegean_Numbers[] = { 1, 0x10100, 0x1013f, }; /* END of CR_In_Aegean_Numbers */ /* PROPERTY: 'In_Ancient_Greek_Numbers': Block */ static const OnigCodePoint CR_In_Ancient_Greek_Numbers[] = { 1, 0x10140, 0x1018f, }; /* END of CR_In_Ancient_Greek_Numbers */ /* PROPERTY: 'In_Ancient_Symbols': Block */ static const OnigCodePoint CR_In_Ancient_Symbols[] = { 1, 0x10190, 0x101cf, }; /* END of CR_In_Ancient_Symbols */ /* PROPERTY: 'In_Phaistos_Disc': Block */ static const OnigCodePoint CR_In_Phaistos_Disc[] = { 1, 0x101d0, 0x101ff, }; /* END of CR_In_Phaistos_Disc */ /* PROPERTY: 'In_Lycian': Block */ static const OnigCodePoint CR_In_Lycian[] = { 1, 0x10280, 0x1029f, }; /* END of CR_In_Lycian */ /* PROPERTY: 'In_Carian': Block */ static const OnigCodePoint CR_In_Carian[] = { 1, 0x102a0, 0x102df, }; /* END of CR_In_Carian */ /* PROPERTY: 'In_Coptic_Epact_Numbers': Block */ static const OnigCodePoint CR_In_Coptic_Epact_Numbers[] = { 1, 0x102e0, 0x102ff, }; /* END of CR_In_Coptic_Epact_Numbers */ /* PROPERTY: 'In_Old_Italic': Block */ static const OnigCodePoint CR_In_Old_Italic[] = { 1, 0x10300, 0x1032f, }; /* END of CR_In_Old_Italic */ /* PROPERTY: 'In_Gothic': Block */ static const OnigCodePoint CR_In_Gothic[] = { 1, 0x10330, 0x1034f, }; /* END of CR_In_Gothic */ /* PROPERTY: 'In_Old_Permic': Block */ static const OnigCodePoint CR_In_Old_Permic[] = { 1, 0x10350, 0x1037f, }; /* END of CR_In_Old_Permic */ /* PROPERTY: 'In_Ugaritic': Block */ static const OnigCodePoint CR_In_Ugaritic[] = { 1, 0x10380, 0x1039f, }; /* END of CR_In_Ugaritic */ /* PROPERTY: 'In_Old_Persian': Block */ static const OnigCodePoint CR_In_Old_Persian[] = { 1, 0x103a0, 0x103df, }; /* END of CR_In_Old_Persian */ /* PROPERTY: 'In_Deseret': Block */ #define CR_In_Deseret CR_Deseret /* PROPERTY: 'In_Shavian': Block */ #define CR_In_Shavian CR_Shavian /* PROPERTY: 'In_Osmanya': Block */ static const OnigCodePoint CR_In_Osmanya[] = { 1, 0x10480, 0x104af, }; /* END of CR_In_Osmanya */ /* PROPERTY: 'In_Osage': Block */ static const OnigCodePoint CR_In_Osage[] = { 1, 0x104b0, 0x104ff, }; /* END of CR_In_Osage */ /* PROPERTY: 'In_Elbasan': Block */ static const OnigCodePoint CR_In_Elbasan[] = { 1, 0x10500, 0x1052f, }; /* END of CR_In_Elbasan */ /* PROPERTY: 'In_Caucasian_Albanian': Block */ static const OnigCodePoint CR_In_Caucasian_Albanian[] = { 1, 0x10530, 0x1056f, }; /* END of CR_In_Caucasian_Albanian */ /* PROPERTY: 'In_Vithkuqi': Block */ static const OnigCodePoint CR_In_Vithkuqi[] = { 1, 0x10570, 0x105bf, }; /* END of CR_In_Vithkuqi */ /* PROPERTY: 'In_Todhri': Block */ static const OnigCodePoint CR_In_Todhri[] = { 1, 0x105c0, 0x105ff, }; /* END of CR_In_Todhri */ /* PROPERTY: 'In_Linear_A': Block */ static const OnigCodePoint CR_In_Linear_A[] = { 1, 0x10600, 0x1077f, }; /* END of CR_In_Linear_A */ /* PROPERTY: 'In_Latin_Extended_F': Block */ static const OnigCodePoint CR_In_Latin_Extended_F[] = { 1, 0x10780, 0x107bf, }; /* END of CR_In_Latin_Extended_F */ /* PROPERTY: 'In_Cypriot_Syllabary': Block */ static const OnigCodePoint CR_In_Cypriot_Syllabary[] = { 1, 0x10800, 0x1083f, }; /* END of CR_In_Cypriot_Syllabary */ /* PROPERTY: 'In_Imperial_Aramaic': Block */ static const OnigCodePoint CR_In_Imperial_Aramaic[] = { 1, 0x10840, 0x1085f, }; /* END of CR_In_Imperial_Aramaic */ /* PROPERTY: 'In_Palmyrene': Block */ #define CR_In_Palmyrene CR_Palmyrene /* PROPERTY: 'In_Nabataean': Block */ static const OnigCodePoint CR_In_Nabataean[] = { 1, 0x10880, 0x108af, }; /* END of CR_In_Nabataean */ /* PROPERTY: 'In_Hatran': Block */ static const OnigCodePoint CR_In_Hatran[] = { 1, 0x108e0, 0x108ff, }; /* END of CR_In_Hatran */ /* PROPERTY: 'In_Phoenician': Block */ static const OnigCodePoint CR_In_Phoenician[] = { 1, 0x10900, 0x1091f, }; /* END of CR_In_Phoenician */ /* PROPERTY: 'In_Lydian': Block */ static const OnigCodePoint CR_In_Lydian[] = { 1, 0x10920, 0x1093f, }; /* END of CR_In_Lydian */ /* PROPERTY: 'In_Meroitic_Hieroglyphs': Block */ #define CR_In_Meroitic_Hieroglyphs CR_Meroitic_Hieroglyphs /* PROPERTY: 'In_Meroitic_Cursive': Block */ static const OnigCodePoint CR_In_Meroitic_Cursive[] = { 1, 0x109a0, 0x109ff, }; /* END of CR_In_Meroitic_Cursive */ /* PROPERTY: 'In_Kharoshthi': Block */ static const OnigCodePoint CR_In_Kharoshthi[] = { 1, 0x10a00, 0x10a5f, }; /* END of CR_In_Kharoshthi */ /* PROPERTY: 'In_Old_South_Arabian': Block */ #define CR_In_Old_South_Arabian CR_Old_South_Arabian /* PROPERTY: 'In_Old_North_Arabian': Block */ #define CR_In_Old_North_Arabian CR_Old_North_Arabian /* PROPERTY: 'In_Manichaean': Block */ static const OnigCodePoint CR_In_Manichaean[] = { 1, 0x10ac0, 0x10aff, }; /* END of CR_In_Manichaean */ /* PROPERTY: 'In_Avestan': Block */ static const OnigCodePoint CR_In_Avestan[] = { 1, 0x10b00, 0x10b3f, }; /* END of CR_In_Avestan */ /* PROPERTY: 'In_Inscriptional_Parthian': Block */ static const OnigCodePoint CR_In_Inscriptional_Parthian[] = { 1, 0x10b40, 0x10b5f, }; /* END of CR_In_Inscriptional_Parthian */ /* PROPERTY: 'In_Inscriptional_Pahlavi': Block */ static const OnigCodePoint CR_In_Inscriptional_Pahlavi[] = { 1, 0x10b60, 0x10b7f, }; /* END of CR_In_Inscriptional_Pahlavi */ /* PROPERTY: 'In_Psalter_Pahlavi': Block */ static const OnigCodePoint CR_In_Psalter_Pahlavi[] = { 1, 0x10b80, 0x10baf, }; /* END of CR_In_Psalter_Pahlavi */ /* PROPERTY: 'In_Old_Turkic': Block */ static const OnigCodePoint CR_In_Old_Turkic[] = { 1, 0x10c00, 0x10c4f, }; /* END of CR_In_Old_Turkic */ /* PROPERTY: 'In_Old_Hungarian': Block */ static const OnigCodePoint CR_In_Old_Hungarian[] = { 1, 0x10c80, 0x10cff, }; /* END of CR_In_Old_Hungarian */ /* PROPERTY: 'In_Hanifi_Rohingya': Block */ static const OnigCodePoint CR_In_Hanifi_Rohingya[] = { 1, 0x10d00, 0x10d3f, }; /* END of CR_In_Hanifi_Rohingya */ /* PROPERTY: 'In_Garay': Block */ static const OnigCodePoint CR_In_Garay[] = { 1, 0x10d40, 0x10d8f, }; /* END of CR_In_Garay */ /* PROPERTY: 'In_Rumi_Numeral_Symbols': Block */ static const OnigCodePoint CR_In_Rumi_Numeral_Symbols[] = { 1, 0x10e60, 0x10e7f, }; /* END of CR_In_Rumi_Numeral_Symbols */ /* PROPERTY: 'In_Yezidi': Block */ static const OnigCodePoint CR_In_Yezidi[] = { 1, 0x10e80, 0x10ebf, }; /* END of CR_In_Yezidi */ /* PROPERTY: 'In_Arabic_Extended_C': Block */ static const OnigCodePoint CR_In_Arabic_Extended_C[] = { 1, 0x10ec0, 0x10eff, }; /* END of CR_In_Arabic_Extended_C */ /* PROPERTY: 'In_Old_Sogdian': Block */ static const OnigCodePoint CR_In_Old_Sogdian[] = { 1, 0x10f00, 0x10f2f, }; /* END of CR_In_Old_Sogdian */ /* PROPERTY: 'In_Sogdian': Block */ static const OnigCodePoint CR_In_Sogdian[] = { 1, 0x10f30, 0x10f6f, }; /* END of CR_In_Sogdian */ /* PROPERTY: 'In_Old_Uyghur': Block */ static const OnigCodePoint CR_In_Old_Uyghur[] = { 1, 0x10f70, 0x10faf, }; /* END of CR_In_Old_Uyghur */ /* PROPERTY: 'In_Chorasmian': Block */ static const OnigCodePoint CR_In_Chorasmian[] = { 1, 0x10fb0, 0x10fdf, }; /* END of CR_In_Chorasmian */ /* PROPERTY: 'In_Elymaic': Block */ static const OnigCodePoint CR_In_Elymaic[] = { 1, 0x10fe0, 0x10fff, }; /* END of CR_In_Elymaic */ /* PROPERTY: 'In_Brahmi': Block */ static const OnigCodePoint CR_In_Brahmi[] = { 1, 0x11000, 0x1107f, }; /* END of CR_In_Brahmi */ /* PROPERTY: 'In_Kaithi': Block */ static const OnigCodePoint CR_In_Kaithi[] = { 1, 0x11080, 0x110cf, }; /* END of CR_In_Kaithi */ /* PROPERTY: 'In_Sora_Sompeng': Block */ static const OnigCodePoint CR_In_Sora_Sompeng[] = { 1, 0x110d0, 0x110ff, }; /* END of CR_In_Sora_Sompeng */ /* PROPERTY: 'In_Chakma': Block */ static const OnigCodePoint CR_In_Chakma[] = { 1, 0x11100, 0x1114f, }; /* END of CR_In_Chakma */ /* PROPERTY: 'In_Mahajani': Block */ static const OnigCodePoint CR_In_Mahajani[] = { 1, 0x11150, 0x1117f, }; /* END of CR_In_Mahajani */ /* PROPERTY: 'In_Sharada': Block */ #define CR_In_Sharada CR_Sharada /* PROPERTY: 'In_Sinhala_Archaic_Numbers': Block */ static const OnigCodePoint CR_In_Sinhala_Archaic_Numbers[] = { 1, 0x111e0, 0x111ff, }; /* END of CR_In_Sinhala_Archaic_Numbers */ /* PROPERTY: 'In_Khojki': Block */ static const OnigCodePoint CR_In_Khojki[] = { 1, 0x11200, 0x1124f, }; /* END of CR_In_Khojki */ /* PROPERTY: 'In_Multani': Block */ static const OnigCodePoint CR_In_Multani[] = { 1, 0x11280, 0x112af, }; /* END of CR_In_Multani */ /* PROPERTY: 'In_Khudawadi': Block */ static const OnigCodePoint CR_In_Khudawadi[] = { 1, 0x112b0, 0x112ff, }; /* END of CR_In_Khudawadi */ /* PROPERTY: 'In_Grantha': Block */ static const OnigCodePoint CR_In_Grantha[] = { 1, 0x11300, 0x1137f, }; /* END of CR_In_Grantha */ /* PROPERTY: 'In_Tulu_Tigalari': Block */ static const OnigCodePoint CR_In_Tulu_Tigalari[] = { 1, 0x11380, 0x113ff, }; /* END of CR_In_Tulu_Tigalari */ /* PROPERTY: 'In_Newa': Block */ static const OnigCodePoint CR_In_Newa[] = { 1, 0x11400, 0x1147f, }; /* END of CR_In_Newa */ /* PROPERTY: 'In_Tirhuta': Block */ static const OnigCodePoint CR_In_Tirhuta[] = { 1, 0x11480, 0x114df, }; /* END of CR_In_Tirhuta */ /* PROPERTY: 'In_Siddham': Block */ static const OnigCodePoint CR_In_Siddham[] = { 1, 0x11580, 0x115ff, }; /* END of CR_In_Siddham */ /* PROPERTY: 'In_Modi': Block */ static const OnigCodePoint CR_In_Modi[] = { 1, 0x11600, 0x1165f, }; /* END of CR_In_Modi */ /* PROPERTY: 'In_Mongolian_Supplement': Block */ static const OnigCodePoint CR_In_Mongolian_Supplement[] = { 1, 0x11660, 0x1167f, }; /* END of CR_In_Mongolian_Supplement */ /* PROPERTY: 'In_Takri': Block */ static const OnigCodePoint CR_In_Takri[] = { 1, 0x11680, 0x116cf, }; /* END of CR_In_Takri */ /* PROPERTY: 'In_Myanmar_Extended_C': Block */ static const OnigCodePoint CR_In_Myanmar_Extended_C[] = { 1, 0x116d0, 0x116ff, }; /* END of CR_In_Myanmar_Extended_C */ /* PROPERTY: 'In_Ahom': Block */ static const OnigCodePoint CR_In_Ahom[] = { 1, 0x11700, 0x1174f, }; /* END of CR_In_Ahom */ /* PROPERTY: 'In_Dogra': Block */ static const OnigCodePoint CR_In_Dogra[] = { 1, 0x11800, 0x1184f, }; /* END of CR_In_Dogra */ /* PROPERTY: 'In_Warang_Citi': Block */ static const OnigCodePoint CR_In_Warang_Citi[] = { 1, 0x118a0, 0x118ff, }; /* END of CR_In_Warang_Citi */ /* PROPERTY: 'In_Dives_Akuru': Block */ static const OnigCodePoint CR_In_Dives_Akuru[] = { 1, 0x11900, 0x1195f, }; /* END of CR_In_Dives_Akuru */ /* PROPERTY: 'In_Nandinagari': Block */ static const OnigCodePoint CR_In_Nandinagari[] = { 1, 0x119a0, 0x119ff, }; /* END of CR_In_Nandinagari */ /* PROPERTY: 'In_Zanabazar_Square': Block */ static const OnigCodePoint CR_In_Zanabazar_Square[] = { 1, 0x11a00, 0x11a4f, }; /* END of CR_In_Zanabazar_Square */ /* PROPERTY: 'In_Soyombo': Block */ static const OnigCodePoint CR_In_Soyombo[] = { 1, 0x11a50, 0x11aaf, }; /* END of CR_In_Soyombo */ /* PROPERTY: 'In_Unified_Canadian_Aboriginal_Syllabics_Extended_A': Block */ static const OnigCodePoint CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended_A[] = { 1, 0x11ab0, 0x11abf, }; /* END of CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended_A */ /* PROPERTY: 'In_Pau_Cin_Hau': Block */ static const OnigCodePoint CR_In_Pau_Cin_Hau[] = { 1, 0x11ac0, 0x11aff, }; /* END of CR_In_Pau_Cin_Hau */ /* PROPERTY: 'In_Devanagari_Extended_A': Block */ static const OnigCodePoint CR_In_Devanagari_Extended_A[] = { 1, 0x11b00, 0x11b5f, }; /* END of CR_In_Devanagari_Extended_A */ /* PROPERTY: 'In_Sunuwar': Block */ static const OnigCodePoint CR_In_Sunuwar[] = { 1, 0x11bc0, 0x11bff, }; /* END of CR_In_Sunuwar */ /* PROPERTY: 'In_Bhaiksuki': Block */ static const OnigCodePoint CR_In_Bhaiksuki[] = { 1, 0x11c00, 0x11c6f, }; /* END of CR_In_Bhaiksuki */ /* PROPERTY: 'In_Marchen': Block */ static const OnigCodePoint CR_In_Marchen[] = { 1, 0x11c70, 0x11cbf, }; /* END of CR_In_Marchen */ /* PROPERTY: 'In_Masaram_Gondi': Block */ static const OnigCodePoint CR_In_Masaram_Gondi[] = { 1, 0x11d00, 0x11d5f, }; /* END of CR_In_Masaram_Gondi */ /* PROPERTY: 'In_Gunjala_Gondi': Block */ static const OnigCodePoint CR_In_Gunjala_Gondi[] = { 1, 0x11d60, 0x11daf, }; /* END of CR_In_Gunjala_Gondi */ /* PROPERTY: 'In_Makasar': Block */ static const OnigCodePoint CR_In_Makasar[] = { 1, 0x11ee0, 0x11eff, }; /* END of CR_In_Makasar */ /* PROPERTY: 'In_Kawi': Block */ static const OnigCodePoint CR_In_Kawi[] = { 1, 0x11f00, 0x11f5f, }; /* END of CR_In_Kawi */ /* PROPERTY: 'In_Lisu_Supplement': Block */ static const OnigCodePoint CR_In_Lisu_Supplement[] = { 1, 0x11fb0, 0x11fbf, }; /* END of CR_In_Lisu_Supplement */ /* PROPERTY: 'In_Tamil_Supplement': Block */ static const OnigCodePoint CR_In_Tamil_Supplement[] = { 1, 0x11fc0, 0x11fff, }; /* END of CR_In_Tamil_Supplement */ /* PROPERTY: 'In_Cuneiform': Block */ static const OnigCodePoint CR_In_Cuneiform[] = { 1, 0x12000, 0x123ff, }; /* END of CR_In_Cuneiform */ /* PROPERTY: 'In_Cuneiform_Numbers_and_Punctuation': Block */ static const OnigCodePoint CR_In_Cuneiform_Numbers_and_Punctuation[] = { 1, 0x12400, 0x1247f, }; /* END of CR_In_Cuneiform_Numbers_and_Punctuation */ /* PROPERTY: 'In_Early_Dynastic_Cuneiform': Block */ static const OnigCodePoint CR_In_Early_Dynastic_Cuneiform[] = { 1, 0x12480, 0x1254f, }; /* END of CR_In_Early_Dynastic_Cuneiform */ /* PROPERTY: 'In_Cypro_Minoan': Block */ static const OnigCodePoint CR_In_Cypro_Minoan[] = { 1, 0x12f90, 0x12fff, }; /* END of CR_In_Cypro_Minoan */ /* PROPERTY: 'In_Egyptian_Hieroglyphs': Block */ static const OnigCodePoint CR_In_Egyptian_Hieroglyphs[] = { 1, 0x13000, 0x1342f, }; /* END of CR_In_Egyptian_Hieroglyphs */ /* PROPERTY: 'In_Egyptian_Hieroglyph_Format_Controls': Block */ static const OnigCodePoint CR_In_Egyptian_Hieroglyph_Format_Controls[] = { 1, 0x13430, 0x1345f, }; /* END of CR_In_Egyptian_Hieroglyph_Format_Controls */ /* PROPERTY: 'In_Egyptian_Hieroglyphs_Extended_A': Block */ static const OnigCodePoint CR_In_Egyptian_Hieroglyphs_Extended_A[] = { 1, 0x13460, 0x143ff, }; /* END of CR_In_Egyptian_Hieroglyphs_Extended_A */ /* PROPERTY: 'In_Anatolian_Hieroglyphs': Block */ static const OnigCodePoint CR_In_Anatolian_Hieroglyphs[] = { 1, 0x14400, 0x1467f, }; /* END of CR_In_Anatolian_Hieroglyphs */ /* PROPERTY: 'In_Gurung_Khema': Block */ static const OnigCodePoint CR_In_Gurung_Khema[] = { 1, 0x16100, 0x1613f, }; /* END of CR_In_Gurung_Khema */ /* PROPERTY: 'In_Bamum_Supplement': Block */ static const OnigCodePoint CR_In_Bamum_Supplement[] = { 1, 0x16800, 0x16a3f, }; /* END of CR_In_Bamum_Supplement */ /* PROPERTY: 'In_Mro': Block */ static const OnigCodePoint CR_In_Mro[] = { 1, 0x16a40, 0x16a6f, }; /* END of CR_In_Mro */ /* PROPERTY: 'In_Tangsa': Block */ static const OnigCodePoint CR_In_Tangsa[] = { 1, 0x16a70, 0x16acf, }; /* END of CR_In_Tangsa */ /* PROPERTY: 'In_Bassa_Vah': Block */ static const OnigCodePoint CR_In_Bassa_Vah[] = { 1, 0x16ad0, 0x16aff, }; /* END of CR_In_Bassa_Vah */ /* PROPERTY: 'In_Pahawh_Hmong': Block */ static const OnigCodePoint CR_In_Pahawh_Hmong[] = { 1, 0x16b00, 0x16b8f, }; /* END of CR_In_Pahawh_Hmong */ /* PROPERTY: 'In_Kirat_Rai': Block */ static const OnigCodePoint CR_In_Kirat_Rai[] = { 1, 0x16d40, 0x16d7f, }; /* END of CR_In_Kirat_Rai */ /* PROPERTY: 'In_Medefaidrin': Block */ static const OnigCodePoint CR_In_Medefaidrin[] = { 1, 0x16e40, 0x16e9f, }; /* END of CR_In_Medefaidrin */ /* PROPERTY: 'In_Miao': Block */ static const OnigCodePoint CR_In_Miao[] = { 1, 0x16f00, 0x16f9f, }; /* END of CR_In_Miao */ /* PROPERTY: 'In_Ideographic_Symbols_and_Punctuation': Block */ static const OnigCodePoint CR_In_Ideographic_Symbols_and_Punctuation[] = { 1, 0x16fe0, 0x16fff, }; /* END of CR_In_Ideographic_Symbols_and_Punctuation */ /* PROPERTY: 'In_Tangut': Block */ static const OnigCodePoint CR_In_Tangut[] = { 1, 0x17000, 0x187ff, }; /* END of CR_In_Tangut */ /* PROPERTY: 'In_Tangut_Components': Block */ static const OnigCodePoint CR_In_Tangut_Components[] = { 1, 0x18800, 0x18aff, }; /* END of CR_In_Tangut_Components */ /* PROPERTY: 'In_Khitan_Small_Script': Block */ static const OnigCodePoint CR_In_Khitan_Small_Script[] = { 1, 0x18b00, 0x18cff, }; /* END of CR_In_Khitan_Small_Script */ /* PROPERTY: 'In_Tangut_Supplement': Block */ static const OnigCodePoint CR_In_Tangut_Supplement[] = { 1, 0x18d00, 0x18d7f, }; /* END of CR_In_Tangut_Supplement */ /* PROPERTY: 'In_Kana_Extended_B': Block */ static const OnigCodePoint CR_In_Kana_Extended_B[] = { 1, 0x1aff0, 0x1afff, }; /* END of CR_In_Kana_Extended_B */ /* PROPERTY: 'In_Kana_Supplement': Block */ static const OnigCodePoint CR_In_Kana_Supplement[] = { 1, 0x1b000, 0x1b0ff, }; /* END of CR_In_Kana_Supplement */ /* PROPERTY: 'In_Kana_Extended_A': Block */ static const OnigCodePoint CR_In_Kana_Extended_A[] = { 1, 0x1b100, 0x1b12f, }; /* END of CR_In_Kana_Extended_A */ /* PROPERTY: 'In_Small_Kana_Extension': Block */ static const OnigCodePoint CR_In_Small_Kana_Extension[] = { 1, 0x1b130, 0x1b16f, }; /* END of CR_In_Small_Kana_Extension */ /* PROPERTY: 'In_Nushu': Block */ static const OnigCodePoint CR_In_Nushu[] = { 1, 0x1b170, 0x1b2ff, }; /* END of CR_In_Nushu */ /* PROPERTY: 'In_Duployan': Block */ static const OnigCodePoint CR_In_Duployan[] = { 1, 0x1bc00, 0x1bc9f, }; /* END of CR_In_Duployan */ /* PROPERTY: 'In_Shorthand_Format_Controls': Block */ static const OnigCodePoint CR_In_Shorthand_Format_Controls[] = { 1, 0x1bca0, 0x1bcaf, }; /* END of CR_In_Shorthand_Format_Controls */ /* PROPERTY: 'In_Symbols_for_Legacy_Computing_Supplement': Block */ static const OnigCodePoint CR_In_Symbols_for_Legacy_Computing_Supplement[] = { 1, 0x1cc00, 0x1cebf, }; /* END of CR_In_Symbols_for_Legacy_Computing_Supplement */ /* PROPERTY: 'In_Znamenny_Musical_Notation': Block */ static const OnigCodePoint CR_In_Znamenny_Musical_Notation[] = { 1, 0x1cf00, 0x1cfcf, }; /* END of CR_In_Znamenny_Musical_Notation */ /* PROPERTY: 'In_Byzantine_Musical_Symbols': Block */ static const OnigCodePoint CR_In_Byzantine_Musical_Symbols[] = { 1, 0x1d000, 0x1d0ff, }; /* END of CR_In_Byzantine_Musical_Symbols */ /* PROPERTY: 'In_Musical_Symbols': Block */ static const OnigCodePoint CR_In_Musical_Symbols[] = { 1, 0x1d100, 0x1d1ff, }; /* END of CR_In_Musical_Symbols */ /* PROPERTY: 'In_Ancient_Greek_Musical_Notation': Block */ static const OnigCodePoint CR_In_Ancient_Greek_Musical_Notation[] = { 1, 0x1d200, 0x1d24f, }; /* END of CR_In_Ancient_Greek_Musical_Notation */ /* PROPERTY: 'In_Kaktovik_Numerals': Block */ static const OnigCodePoint CR_In_Kaktovik_Numerals[] = { 1, 0x1d2c0, 0x1d2df, }; /* END of CR_In_Kaktovik_Numerals */ /* PROPERTY: 'In_Mayan_Numerals': Block */ static const OnigCodePoint CR_In_Mayan_Numerals[] = { 1, 0x1d2e0, 0x1d2ff, }; /* END of CR_In_Mayan_Numerals */ /* PROPERTY: 'In_Tai_Xuan_Jing_Symbols': Block */ static const OnigCodePoint CR_In_Tai_Xuan_Jing_Symbols[] = { 1, 0x1d300, 0x1d35f, }; /* END of CR_In_Tai_Xuan_Jing_Symbols */ /* PROPERTY: 'In_Counting_Rod_Numerals': Block */ static const OnigCodePoint CR_In_Counting_Rod_Numerals[] = { 1, 0x1d360, 0x1d37f, }; /* END of CR_In_Counting_Rod_Numerals */ /* PROPERTY: 'In_Mathematical_Alphanumeric_Symbols': Block */ static const OnigCodePoint CR_In_Mathematical_Alphanumeric_Symbols[] = { 1, 0x1d400, 0x1d7ff, }; /* END of CR_In_Mathematical_Alphanumeric_Symbols */ /* PROPERTY: 'In_Sutton_SignWriting': Block */ static const OnigCodePoint CR_In_Sutton_SignWriting[] = { 1, 0x1d800, 0x1daaf, }; /* END of CR_In_Sutton_SignWriting */ /* PROPERTY: 'In_Latin_Extended_G': Block */ static const OnigCodePoint CR_In_Latin_Extended_G[] = { 1, 0x1df00, 0x1dfff, }; /* END of CR_In_Latin_Extended_G */ /* PROPERTY: 'In_Glagolitic_Supplement': Block */ static const OnigCodePoint CR_In_Glagolitic_Supplement[] = { 1, 0x1e000, 0x1e02f, }; /* END of CR_In_Glagolitic_Supplement */ /* PROPERTY: 'In_Cyrillic_Extended_D': Block */ static const OnigCodePoint CR_In_Cyrillic_Extended_D[] = { 1, 0x1e030, 0x1e08f, }; /* END of CR_In_Cyrillic_Extended_D */ /* PROPERTY: 'In_Nyiakeng_Puachue_Hmong': Block */ static const OnigCodePoint CR_In_Nyiakeng_Puachue_Hmong[] = { 1, 0x1e100, 0x1e14f, }; /* END of CR_In_Nyiakeng_Puachue_Hmong */ /* PROPERTY: 'In_Toto': Block */ static const OnigCodePoint CR_In_Toto[] = { 1, 0x1e290, 0x1e2bf, }; /* END of CR_In_Toto */ /* PROPERTY: 'In_Wancho': Block */ static const OnigCodePoint CR_In_Wancho[] = { 1, 0x1e2c0, 0x1e2ff, }; /* END of CR_In_Wancho */ /* PROPERTY: 'In_Nag_Mundari': Block */ static const OnigCodePoint CR_In_Nag_Mundari[] = { 1, 0x1e4d0, 0x1e4ff, }; /* END of CR_In_Nag_Mundari */ /* PROPERTY: 'In_Ol_Onal': Block */ static const OnigCodePoint CR_In_Ol_Onal[] = { 1, 0x1e5d0, 0x1e5ff, }; /* END of CR_In_Ol_Onal */ /* PROPERTY: 'In_Ethiopic_Extended_B': Block */ static const OnigCodePoint CR_In_Ethiopic_Extended_B[] = { 1, 0x1e7e0, 0x1e7ff, }; /* END of CR_In_Ethiopic_Extended_B */ /* PROPERTY: 'In_Mende_Kikakui': Block */ static const OnigCodePoint CR_In_Mende_Kikakui[] = { 1, 0x1e800, 0x1e8df, }; /* END of CR_In_Mende_Kikakui */ /* PROPERTY: 'In_Adlam': Block */ static const OnigCodePoint CR_In_Adlam[] = { 1, 0x1e900, 0x1e95f, }; /* END of CR_In_Adlam */ /* PROPERTY: 'In_Indic_Siyaq_Numbers': Block */ static const OnigCodePoint CR_In_Indic_Siyaq_Numbers[] = { 1, 0x1ec70, 0x1ecbf, }; /* END of CR_In_Indic_Siyaq_Numbers */ /* PROPERTY: 'In_Ottoman_Siyaq_Numbers': Block */ static const OnigCodePoint CR_In_Ottoman_Siyaq_Numbers[] = { 1, 0x1ed00, 0x1ed4f, }; /* END of CR_In_Ottoman_Siyaq_Numbers */ /* PROPERTY: 'In_Arabic_Mathematical_Alphabetic_Symbols': Block */ static const OnigCodePoint CR_In_Arabic_Mathematical_Alphabetic_Symbols[] = { 1, 0x1ee00, 0x1eeff, }; /* END of CR_In_Arabic_Mathematical_Alphabetic_Symbols */ /* PROPERTY: 'In_Mahjong_Tiles': Block */ static const OnigCodePoint CR_In_Mahjong_Tiles[] = { 1, 0x1f000, 0x1f02f, }; /* END of CR_In_Mahjong_Tiles */ /* PROPERTY: 'In_Domino_Tiles': Block */ static const OnigCodePoint CR_In_Domino_Tiles[] = { 1, 0x1f030, 0x1f09f, }; /* END of CR_In_Domino_Tiles */ /* PROPERTY: 'In_Playing_Cards': Block */ static const OnigCodePoint CR_In_Playing_Cards[] = { 1, 0x1f0a0, 0x1f0ff, }; /* END of CR_In_Playing_Cards */ /* PROPERTY: 'In_Enclosed_Alphanumeric_Supplement': Block */ static const OnigCodePoint CR_In_Enclosed_Alphanumeric_Supplement[] = { 1, 0x1f100, 0x1f1ff, }; /* END of CR_In_Enclosed_Alphanumeric_Supplement */ /* PROPERTY: 'In_Enclosed_Ideographic_Supplement': Block */ static const OnigCodePoint CR_In_Enclosed_Ideographic_Supplement[] = { 1, 0x1f200, 0x1f2ff, }; /* END of CR_In_Enclosed_Ideographic_Supplement */ /* PROPERTY: 'In_Miscellaneous_Symbols_and_Pictographs': Block */ static const OnigCodePoint CR_In_Miscellaneous_Symbols_and_Pictographs[] = { 1, 0x1f300, 0x1f5ff, }; /* END of CR_In_Miscellaneous_Symbols_and_Pictographs */ /* PROPERTY: 'In_Emoticons': Block */ static const OnigCodePoint CR_In_Emoticons[] = { 1, 0x1f600, 0x1f64f, }; /* END of CR_In_Emoticons */ /* PROPERTY: 'In_Ornamental_Dingbats': Block */ static const OnigCodePoint CR_In_Ornamental_Dingbats[] = { 1, 0x1f650, 0x1f67f, }; /* END of CR_In_Ornamental_Dingbats */ /* PROPERTY: 'In_Transport_and_Map_Symbols': Block */ static const OnigCodePoint CR_In_Transport_and_Map_Symbols[] = { 1, 0x1f680, 0x1f6ff, }; /* END of CR_In_Transport_and_Map_Symbols */ /* PROPERTY: 'In_Alchemical_Symbols': Block */ static const OnigCodePoint CR_In_Alchemical_Symbols[] = { 1, 0x1f700, 0x1f77f, }; /* END of CR_In_Alchemical_Symbols */ /* PROPERTY: 'In_Geometric_Shapes_Extended': Block */ static const OnigCodePoint CR_In_Geometric_Shapes_Extended[] = { 1, 0x1f780, 0x1f7ff, }; /* END of CR_In_Geometric_Shapes_Extended */ /* PROPERTY: 'In_Supplemental_Arrows_C': Block */ static const OnigCodePoint CR_In_Supplemental_Arrows_C[] = { 1, 0x1f800, 0x1f8ff, }; /* END of CR_In_Supplemental_Arrows_C */ /* PROPERTY: 'In_Supplemental_Symbols_and_Pictographs': Block */ static const OnigCodePoint CR_In_Supplemental_Symbols_and_Pictographs[] = { 1, 0x1f900, 0x1f9ff, }; /* END of CR_In_Supplemental_Symbols_and_Pictographs */ /* PROPERTY: 'In_Chess_Symbols': Block */ static const OnigCodePoint CR_In_Chess_Symbols[] = { 1, 0x1fa00, 0x1fa6f, }; /* END of CR_In_Chess_Symbols */ /* PROPERTY: 'In_Symbols_and_Pictographs_Extended_A': Block */ static const OnigCodePoint CR_In_Symbols_and_Pictographs_Extended_A[] = { 1, 0x1fa70, 0x1faff, }; /* END of CR_In_Symbols_and_Pictographs_Extended_A */ /* PROPERTY: 'In_Symbols_for_Legacy_Computing': Block */ static const OnigCodePoint CR_In_Symbols_for_Legacy_Computing[] = { 1, 0x1fb00, 0x1fbff, }; /* END of CR_In_Symbols_for_Legacy_Computing */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_B': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_B[] = { 1, 0x20000, 0x2a6df, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_B */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_C': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_C[] = { 1, 0x2a700, 0x2b73f, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_C */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_D': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_D[] = { 1, 0x2b740, 0x2b81f, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_D */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_E': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_E[] = { 1, 0x2b820, 0x2ceaf, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_E */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_F': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_F[] = { 1, 0x2ceb0, 0x2ebef, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_F */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_I': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_I[] = { 1, 0x2ebf0, 0x2ee5f, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_I */ /* PROPERTY: 'In_CJK_Compatibility_Ideographs_Supplement': Block */ static const OnigCodePoint CR_In_CJK_Compatibility_Ideographs_Supplement[] = { 1, 0x2f800, 0x2fa1f, }; /* END of CR_In_CJK_Compatibility_Ideographs_Supplement */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_G': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_G[] = { 1, 0x30000, 0x3134f, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_G */ /* PROPERTY: 'In_CJK_Unified_Ideographs_Extension_H': Block */ static const OnigCodePoint CR_In_CJK_Unified_Ideographs_Extension_H[] = { 1, 0x31350, 0x323af, }; /* END of CR_In_CJK_Unified_Ideographs_Extension_H */ /* PROPERTY: 'In_Tags': Block */ static const OnigCodePoint CR_In_Tags[] = { 1, 0xe0000, 0xe007f, }; /* END of CR_In_Tags */ /* PROPERTY: 'In_Variation_Selectors_Supplement': Block */ static const OnigCodePoint CR_In_Variation_Selectors_Supplement[] = { 1, 0xe0100, 0xe01ef, }; /* END of CR_In_Variation_Selectors_Supplement */ /* PROPERTY: 'In_Supplementary_Private_Use_Area_A': Block */ static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_A[] = { 1, 0xf0000, 0xfffff, }; /* END of CR_In_Supplementary_Private_Use_Area_A */ /* PROPERTY: 'In_Supplementary_Private_Use_Area_B': Block */ static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = { 1, 0x100000, 0x10ffff, }; /* END of CR_In_Supplementary_Private_Use_Area_B */ /* PROPERTY: 'In_No_Block': Block */ static const OnigCodePoint CR_In_No_Block[] = { 51, 0x2fe0, 0x2fef, 0x10200, 0x1027f, 0x103e0, 0x103ff, 0x107c0, 0x107ff, 0x108b0, 0x108df, 0x10940, 0x1097f, 0x10aa0, 0x10abf, 0x10bb0, 0x10bff, 0x10c50, 0x10c7f, 0x10d90, 0x10e5f, 0x11250, 0x1127f, 0x114e0, 0x1157f, 0x11750, 0x117ff, 0x11850, 0x1189f, 0x11960, 0x1199f, 0x11b60, 0x11bbf, 0x11cc0, 0x11cff, 0x11db0, 0x11edf, 0x11f60, 0x11faf, 0x12550, 0x12f8f, 0x14680, 0x160ff, 0x16140, 0x167ff, 0x16b90, 0x16d3f, 0x16d80, 0x16e3f, 0x16ea0, 0x16eff, 0x16fa0, 0x16fdf, 0x18d80, 0x1afef, 0x1b300, 0x1bbff, 0x1bcb0, 0x1cbff, 0x1cec0, 0x1ceff, 0x1cfd0, 0x1cfff, 0x1d250, 0x1d2bf, 0x1d380, 0x1d3ff, 0x1dab0, 0x1deff, 0x1e090, 0x1e0ff, 0x1e150, 0x1e28f, 0x1e300, 0x1e4cf, 0x1e500, 0x1e5cf, 0x1e600, 0x1e7df, 0x1e8e0, 0x1e8ff, 0x1e960, 0x1ec6f, 0x1ecc0, 0x1ecff, 0x1ed50, 0x1edff, 0x1ef00, 0x1efff, 0x1fc00, 0x1ffff, 0x2a6e0, 0x2a6ff, 0x2ee60, 0x2f7ff, 0x2fa20, 0x2ffff, 0x323b0, 0xdffff, 0xe0080, 0xe00ff, 0xe01f0, 0xeffff, }; /* END of CR_In_No_Block */ static const OnigCodePoint* const CodeRanges[] = { CR_NEWLINE, CR_Alpha, CR_Blank, CR_Cntrl, CR_Digit, CR_Graph, CR_Lower, CR_Print, CR_PosixPunct, CR_Space, CR_Upper, CR_XDigit, CR_Word, CR_Alnum, CR_ASCII, CR_ASCII_Hex_Digit, CR_Adlam, CR_Ahom, CR_Alphabetic, CR_Anatolian_Hieroglyphs, CR_Any, CR_Arabic, CR_Armenian, CR_Assigned, CR_Avestan, CR_Balinese, CR_Bamum, CR_Bassa_Vah, CR_Batak, CR_Bengali, CR_Bhaiksuki, CR_Bidi_Control, CR_Bopomofo, CR_Brahmi, CR_Braille, CR_Buginese, CR_Buhid, CR_C, CR_Canadian_Aboriginal, CR_Carian, CR_Case_Ignorable, CR_Cased, CR_Caucasian_Albanian, CR_Cc, CR_Cf, CR_Chakma, CR_Cham, CR_Changes_When_Casefolded, CR_Changes_When_Casemapped, CR_Changes_When_Lowercased, CR_Changes_When_Titlecased, CR_Changes_When_Uppercased, CR_Cherokee, CR_Chorasmian, CR_Cn, CR_Co, CR_Common, CR_Coptic, CR_Cs, CR_Cuneiform, CR_Cypriot, CR_Cypro_Minoan, CR_Cyrillic, CR_Dash, CR_Default_Ignorable_Code_Point, CR_Deprecated, CR_Deseret, CR_Devanagari, CR_Diacritic, CR_Dives_Akuru, CR_Dogra, CR_Duployan, CR_Egyptian_Hieroglyphs, CR_Elbasan, CR_Elymaic, CR_Emoji, CR_Emoji_Component, CR_Emoji_Modifier, CR_Emoji_Modifier_Base, CR_Emoji_Presentation, CR_Ethiopic, CR_Extended_Pictographic, CR_Extender, CR_Garay, CR_Georgian, CR_Glagolitic, CR_Gothic, CR_Grantha, CR_Grapheme_Base, CR_Grapheme_Extend, CR_Grapheme_Link, CR_Greek, CR_Gujarati, CR_Gunjala_Gondi, CR_Gurmukhi, CR_Gurung_Khema, CR_Han, CR_Hangul, CR_Hanifi_Rohingya, CR_Hanunoo, CR_Hatran, CR_Hebrew, CR_Hex_Digit, CR_Hiragana, CR_Hyphen, CR_IDS_Binary_Operator, CR_IDS_Trinary_Operator, CR_IDS_Unary_Operator, CR_ID_Compat_Math_Continue, CR_ID_Compat_Math_Start, CR_ID_Continue, CR_ID_Start, CR_Ideographic, CR_Imperial_Aramaic, CR_InCB, CR_Inherited, CR_Inscriptional_Pahlavi, CR_Inscriptional_Parthian, CR_Javanese, CR_Join_Control, CR_Kaithi, CR_Kannada, CR_Katakana, CR_Kawi, CR_Kayah_Li, CR_Kharoshthi, CR_Khitan_Small_Script, CR_Khmer, CR_Khojki, CR_Khudawadi, CR_Kirat_Rai, CR_L, CR_LC, CR_Lao, CR_Latin, CR_Lepcha, CR_Limbu, CR_Linear_A, CR_Linear_B, CR_Lisu, CR_Ll, CR_Lm, CR_Lo, CR_Logical_Order_Exception, CR_Lowercase, CR_Lt, CR_Lu, CR_Lycian, CR_Lydian, CR_M, CR_Mahajani, CR_Makasar, CR_Malayalam, CR_Mandaic, CR_Manichaean, CR_Marchen, CR_Masaram_Gondi, CR_Math, CR_Mc, CR_Me, CR_Medefaidrin, CR_Meetei_Mayek, CR_Mende_Kikakui, CR_Meroitic_Cursive, CR_Meroitic_Hieroglyphs, CR_Miao, CR_Mn, CR_Modi, CR_Modifier_Combining_Mark, CR_Mongolian, CR_Mro, CR_Multani, CR_Myanmar, CR_N, CR_Nabataean, CR_Nag_Mundari, CR_Nandinagari, CR_Nd, CR_New_Tai_Lue, CR_Newa, CR_Nko, CR_Nl, CR_No, CR_Noncharacter_Code_Point, CR_Nushu, CR_Nyiakeng_Puachue_Hmong, CR_Ogham, CR_Ol_Chiki, CR_Ol_Onal, CR_Old_Hungarian, CR_Old_Italic, CR_Old_North_Arabian, CR_Old_Permic, CR_Old_Persian, CR_Old_Sogdian, CR_Old_South_Arabian, CR_Old_Turkic, CR_Old_Uyghur, CR_Oriya, CR_Osage, CR_Osmanya, CR_Other_Alphabetic, CR_Other_Default_Ignorable_Code_Point, CR_Other_Grapheme_Extend, CR_Other_ID_Continue, CR_Other_ID_Start, CR_Other_Lowercase, CR_Other_Math, CR_Other_Uppercase, CR_P, CR_Pahawh_Hmong, CR_Palmyrene, CR_Pattern_Syntax, CR_Pattern_White_Space, CR_Pau_Cin_Hau, CR_Pc, CR_Pd, CR_Pe, CR_Pf, CR_Phags_Pa, CR_Phoenician, CR_Pi, CR_Po, CR_Prepended_Concatenation_Mark, CR_Ps, CR_Psalter_Pahlavi, CR_Quotation_Mark, CR_Radical, CR_Regional_Indicator, CR_Rejang, CR_Runic, CR_S, CR_Samaritan, CR_Saurashtra, CR_Sc, CR_Sentence_Terminal, CR_Sharada, CR_Shavian, CR_Siddham, CR_SignWriting, CR_Sinhala, CR_Sk, CR_Sm, CR_So, CR_Soft_Dotted, CR_Sogdian, CR_Sora_Sompeng, CR_Soyombo, CR_Sundanese, CR_Sunuwar, CR_Syloti_Nagri, CR_Syriac, CR_Tagalog, CR_Tagbanwa, CR_Tai_Le, CR_Tai_Tham, CR_Tai_Viet, CR_Takri, CR_Tamil, CR_Tangsa, CR_Tangut, CR_Telugu, CR_Terminal_Punctuation, CR_Thaana, CR_Thai, CR_Tibetan, CR_Tifinagh, CR_Tirhuta, CR_Todhri, CR_Toto, CR_Tulu_Tigalari, CR_Ugaritic, CR_Unified_Ideograph, CR_Unknown, CR_Uppercase, CR_Vai, CR_Variation_Selector, CR_Vithkuqi, CR_Wancho, CR_Warang_Citi, CR_White_Space, CR_XID_Continue, CR_XID_Start, CR_Yezidi, CR_Yi, CR_Z, CR_Zanabazar_Square, CR_Zl, CR_Zp, CR_Zs, CR_In_Basic_Latin, CR_In_Latin_1_Supplement, CR_In_Latin_Extended_A, CR_In_Latin_Extended_B, CR_In_IPA_Extensions, CR_In_Spacing_Modifier_Letters, CR_In_Combining_Diacritical_Marks, CR_In_Greek_and_Coptic, CR_In_Cyrillic, CR_In_Cyrillic_Supplement, CR_In_Armenian, CR_In_Hebrew, CR_In_Arabic, CR_In_Syriac, CR_In_Arabic_Supplement, CR_In_Thaana, CR_In_NKo, CR_In_Samaritan, CR_In_Mandaic, CR_In_Syriac_Supplement, CR_In_Arabic_Extended_B, CR_In_Arabic_Extended_A, CR_In_Devanagari, CR_In_Bengali, CR_In_Gurmukhi, CR_In_Gujarati, CR_In_Oriya, CR_In_Tamil, CR_In_Telugu, CR_In_Kannada, CR_In_Malayalam, CR_In_Sinhala, CR_In_Thai, CR_In_Lao, CR_In_Tibetan, CR_In_Myanmar, CR_In_Georgian, CR_In_Hangul_Jamo, CR_In_Ethiopic, CR_In_Ethiopic_Supplement, CR_In_Cherokee, CR_In_Unified_Canadian_Aboriginal_Syllabics, CR_In_Ogham, CR_In_Runic, CR_In_Tagalog, CR_In_Hanunoo, CR_In_Buhid, CR_In_Tagbanwa, CR_In_Khmer, CR_In_Mongolian, CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended, CR_In_Limbu, CR_In_Tai_Le, CR_In_New_Tai_Lue, CR_In_Khmer_Symbols, CR_In_Buginese, CR_In_Tai_Tham, CR_In_Combining_Diacritical_Marks_Extended, CR_In_Balinese, CR_In_Sundanese, CR_In_Batak, CR_In_Lepcha, CR_In_Ol_Chiki, CR_In_Cyrillic_Extended_C, CR_In_Georgian_Extended, CR_In_Sundanese_Supplement, CR_In_Vedic_Extensions, CR_In_Phonetic_Extensions, CR_In_Phonetic_Extensions_Supplement, CR_In_Combining_Diacritical_Marks_Supplement, CR_In_Latin_Extended_Additional, CR_In_Greek_Extended, CR_In_General_Punctuation, CR_In_Superscripts_and_Subscripts, CR_In_Currency_Symbols, CR_In_Combining_Diacritical_Marks_for_Symbols, CR_In_Letterlike_Symbols, CR_In_Number_Forms, CR_In_Arrows, CR_In_Mathematical_Operators, CR_In_Miscellaneous_Technical, CR_In_Control_Pictures, CR_In_Optical_Character_Recognition, CR_In_Enclosed_Alphanumerics, CR_In_Box_Drawing, CR_In_Block_Elements, CR_In_Geometric_Shapes, CR_In_Miscellaneous_Symbols, CR_In_Dingbats, CR_In_Miscellaneous_Mathematical_Symbols_A, CR_In_Supplemental_Arrows_A, CR_In_Braille_Patterns, CR_In_Supplemental_Arrows_B, CR_In_Miscellaneous_Mathematical_Symbols_B, CR_In_Supplemental_Mathematical_Operators, CR_In_Miscellaneous_Symbols_and_Arrows, CR_In_Glagolitic, CR_In_Latin_Extended_C, CR_In_Coptic, CR_In_Georgian_Supplement, CR_In_Tifinagh, CR_In_Ethiopic_Extended, CR_In_Cyrillic_Extended_A, CR_In_Supplemental_Punctuation, CR_In_CJK_Radicals_Supplement, CR_In_Kangxi_Radicals, CR_In_Ideographic_Description_Characters, CR_In_CJK_Symbols_and_Punctuation, CR_In_Hiragana, CR_In_Katakana, CR_In_Bopomofo, CR_In_Hangul_Compatibility_Jamo, CR_In_Kanbun, CR_In_Bopomofo_Extended, CR_In_CJK_Strokes, CR_In_Katakana_Phonetic_Extensions, CR_In_Enclosed_CJK_Letters_and_Months, CR_In_CJK_Compatibility, CR_In_CJK_Unified_Ideographs_Extension_A, CR_In_Yijing_Hexagram_Symbols, CR_In_CJK_Unified_Ideographs, CR_In_Yi_Syllables, CR_In_Yi_Radicals, CR_In_Lisu, CR_In_Vai, CR_In_Cyrillic_Extended_B, CR_In_Bamum, CR_In_Modifier_Tone_Letters, CR_In_Latin_Extended_D, CR_In_Syloti_Nagri, CR_In_Common_Indic_Number_Forms, CR_In_Phags_pa, CR_In_Saurashtra, CR_In_Devanagari_Extended, CR_In_Kayah_Li, CR_In_Rejang, CR_In_Hangul_Jamo_Extended_A, CR_In_Javanese, CR_In_Myanmar_Extended_B, CR_In_Cham, CR_In_Myanmar_Extended_A, CR_In_Tai_Viet, CR_In_Meetei_Mayek_Extensions, CR_In_Ethiopic_Extended_A, CR_In_Latin_Extended_E, CR_In_Cherokee_Supplement, CR_In_Meetei_Mayek, CR_In_Hangul_Syllables, CR_In_Hangul_Jamo_Extended_B, CR_In_High_Surrogates, CR_In_High_Private_Use_Surrogates, CR_In_Low_Surrogates, CR_In_Private_Use_Area, CR_In_CJK_Compatibility_Ideographs, CR_In_Alphabetic_Presentation_Forms, CR_In_Arabic_Presentation_Forms_A, CR_In_Variation_Selectors, CR_In_Vertical_Forms, CR_In_Combining_Half_Marks, CR_In_CJK_Compatibility_Forms, CR_In_Small_Form_Variants, CR_In_Arabic_Presentation_Forms_B, CR_In_Halfwidth_and_Fullwidth_Forms, CR_In_Specials, CR_In_Linear_B_Syllabary, CR_In_Linear_B_Ideograms, CR_In_Aegean_Numbers, CR_In_Ancient_Greek_Numbers, CR_In_Ancient_Symbols, CR_In_Phaistos_Disc, CR_In_Lycian, CR_In_Carian, CR_In_Coptic_Epact_Numbers, CR_In_Old_Italic, CR_In_Gothic, CR_In_Old_Permic, CR_In_Ugaritic, CR_In_Old_Persian, CR_In_Deseret, CR_In_Shavian, CR_In_Osmanya, CR_In_Osage, CR_In_Elbasan, CR_In_Caucasian_Albanian, CR_In_Vithkuqi, CR_In_Todhri, CR_In_Linear_A, CR_In_Latin_Extended_F, CR_In_Cypriot_Syllabary, CR_In_Imperial_Aramaic, CR_In_Palmyrene, CR_In_Nabataean, CR_In_Hatran, CR_In_Phoenician, CR_In_Lydian, CR_In_Meroitic_Hieroglyphs, CR_In_Meroitic_Cursive, CR_In_Kharoshthi, CR_In_Old_South_Arabian, CR_In_Old_North_Arabian, CR_In_Manichaean, CR_In_Avestan, CR_In_Inscriptional_Parthian, CR_In_Inscriptional_Pahlavi, CR_In_Psalter_Pahlavi, CR_In_Old_Turkic, CR_In_Old_Hungarian, CR_In_Hanifi_Rohingya, CR_In_Garay, CR_In_Rumi_Numeral_Symbols, CR_In_Yezidi, CR_In_Arabic_Extended_C, CR_In_Old_Sogdian, CR_In_Sogdian, CR_In_Old_Uyghur, CR_In_Chorasmian, CR_In_Elymaic, CR_In_Brahmi, CR_In_Kaithi, CR_In_Sora_Sompeng, CR_In_Chakma, CR_In_Mahajani, CR_In_Sharada, CR_In_Sinhala_Archaic_Numbers, CR_In_Khojki, CR_In_Multani, CR_In_Khudawadi, CR_In_Grantha, CR_In_Tulu_Tigalari, CR_In_Newa, CR_In_Tirhuta, CR_In_Siddham, CR_In_Modi, CR_In_Mongolian_Supplement, CR_In_Takri, CR_In_Myanmar_Extended_C, CR_In_Ahom, CR_In_Dogra, CR_In_Warang_Citi, CR_In_Dives_Akuru, CR_In_Nandinagari, CR_In_Zanabazar_Square, CR_In_Soyombo, CR_In_Unified_Canadian_Aboriginal_Syllabics_Extended_A, CR_In_Pau_Cin_Hau, CR_In_Devanagari_Extended_A, CR_In_Sunuwar, CR_In_Bhaiksuki, CR_In_Marchen, CR_In_Masaram_Gondi, CR_In_Gunjala_Gondi, CR_In_Makasar, CR_In_Kawi, CR_In_Lisu_Supplement, CR_In_Tamil_Supplement, CR_In_Cuneiform, CR_In_Cuneiform_Numbers_and_Punctuation, CR_In_Early_Dynastic_Cuneiform, CR_In_Cypro_Minoan, CR_In_Egyptian_Hieroglyphs, CR_In_Egyptian_Hieroglyph_Format_Controls, CR_In_Egyptian_Hieroglyphs_Extended_A, CR_In_Anatolian_Hieroglyphs, CR_In_Gurung_Khema, CR_In_Bamum_Supplement, CR_In_Mro, CR_In_Tangsa, CR_In_Bassa_Vah, CR_In_Pahawh_Hmong, CR_In_Kirat_Rai, CR_In_Medefaidrin, CR_In_Miao, CR_In_Ideographic_Symbols_and_Punctuation, CR_In_Tangut, CR_In_Tangut_Components, CR_In_Khitan_Small_Script, CR_In_Tangut_Supplement, CR_In_Kana_Extended_B, CR_In_Kana_Supplement, CR_In_Kana_Extended_A, CR_In_Small_Kana_Extension, CR_In_Nushu, CR_In_Duployan, CR_In_Shorthand_Format_Controls, CR_In_Symbols_for_Legacy_Computing_Supplement, CR_In_Znamenny_Musical_Notation, CR_In_Byzantine_Musical_Symbols, CR_In_Musical_Symbols, CR_In_Ancient_Greek_Musical_Notation, CR_In_Kaktovik_Numerals, CR_In_Mayan_Numerals, CR_In_Tai_Xuan_Jing_Symbols, CR_In_Counting_Rod_Numerals, CR_In_Mathematical_Alphanumeric_Symbols, CR_In_Sutton_SignWriting, CR_In_Latin_Extended_G, CR_In_Glagolitic_Supplement, CR_In_Cyrillic_Extended_D, CR_In_Nyiakeng_Puachue_Hmong, CR_In_Toto, CR_In_Wancho, CR_In_Nag_Mundari, CR_In_Ol_Onal, CR_In_Ethiopic_Extended_B, CR_In_Mende_Kikakui, CR_In_Adlam, CR_In_Indic_Siyaq_Numbers, CR_In_Ottoman_Siyaq_Numbers, CR_In_Arabic_Mathematical_Alphabetic_Symbols, CR_In_Mahjong_Tiles, CR_In_Domino_Tiles, CR_In_Playing_Cards, CR_In_Enclosed_Alphanumeric_Supplement, CR_In_Enclosed_Ideographic_Supplement, CR_In_Miscellaneous_Symbols_and_Pictographs, CR_In_Emoticons, CR_In_Ornamental_Dingbats, CR_In_Transport_and_Map_Symbols, CR_In_Alchemical_Symbols, CR_In_Geometric_Shapes_Extended, CR_In_Supplemental_Arrows_C, CR_In_Supplemental_Symbols_and_Pictographs, CR_In_Chess_Symbols, CR_In_Symbols_and_Pictographs_Extended_A, CR_In_Symbols_for_Legacy_Computing, CR_In_CJK_Unified_Ideographs_Extension_B, CR_In_CJK_Unified_Ideographs_Extension_C, CR_In_CJK_Unified_Ideographs_Extension_D, CR_In_CJK_Unified_Ideographs_Extension_E, CR_In_CJK_Unified_Ideographs_Extension_F, CR_In_CJK_Unified_Ideographs_Extension_I, CR_In_CJK_Compatibility_Ideographs_Supplement, CR_In_CJK_Unified_Ideographs_Extension_G, CR_In_CJK_Unified_Ideographs_Extension_H, CR_In_Tags, CR_In_Variation_Selectors_Supplement, CR_In_Supplementary_Private_Use_Area_A, CR_In_Supplementary_Private_Use_Area_B, CR_In_No_Block, }; #define pool_offset(s) offsetof(struct unicode_prop_name_pool_t, unicode_prop_name_pool_str##s) #define TOTAL_KEYWORDS 886 #define MIN_WORD_LENGTH 1 #define MAX_WORD_LENGTH 45 #define MIN_HASH_VALUE 12 #define MAX_HASH_VALUE 6900 /* maximum key range = 6889, duplicates = 0 */ #ifndef GPERF_DOWNCASE #define GPERF_DOWNCASE 1 static unsigned char gperf_downcase[256] = { 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, 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, 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 }; #endif #ifndef GPERF_CASE_STRNCMP #define GPERF_CASE_STRNCMP 1 static int gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n) { for (; n > 0;) { unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; if (c1 != 0 && c1 == c2) { n--; continue; } return (int)c1 - (int)c2; } return 0; } #endif #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (register const char *str, register size_t len) { static const unsigned short asso_values[] = { 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 0, 1564, 118, 343, 36, 1531, 1146, 1071, 7, 1812, 8, 684, 99, 4, 16, 1399, 824, 47, 173, 241, 486, 2191, 1723, 940, 1648, 9, 0, 24, 6901, 6901, 6901, 6901, 0, 1564, 118, 343, 36, 1531, 1146, 1071, 7, 1812, 8, 684, 99, 4, 16, 1399, 824, 47, 173, 241, 486, 2191, 1723, 940, 1648, 9, 0, 24, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901, 6901 }; register unsigned int hval = (unsigned int )len; switch (hval) { default: hval += asso_values[(unsigned char)str[15]]; /*FALLTHROUGH*/ case 15: case 14: case 13: case 12: hval += asso_values[(unsigned char)str[11]]; /*FALLTHROUGH*/ case 11: case 10: case 9: case 8: case 7: case 6: hval += asso_values[(unsigned char)str[5]]; /*FALLTHROUGH*/ case 5: hval += asso_values[(unsigned char)str[4]]; /*FALLTHROUGH*/ case 4: case 3: hval += asso_values[(unsigned char)str[2]]; /*FALLTHROUGH*/ case 2: hval += asso_values[(unsigned char)str[1]]; /*FALLTHROUGH*/ case 1: hval += asso_values[(unsigned char)str[0]+2]; break; } return hval + asso_values[(unsigned char)str[len - 1]]; } struct unicode_prop_name_pool_t { char unicode_prop_name_pool_str12[sizeof("lana")]; char unicode_prop_name_pool_str16[sizeof("yi")]; char unicode_prop_name_pool_str19[sizeof("lina")]; char unicode_prop_name_pool_str25[sizeof("yiii")]; char unicode_prop_name_pool_str26[sizeof("mn")]; char unicode_prop_name_pool_str28[sizeof("maka")]; char unicode_prop_name_pool_str31[sizeof("mani")]; char unicode_prop_name_pool_str34[sizeof("z")]; char unicode_prop_name_pool_str37[sizeof("inkannada")]; char unicode_prop_name_pool_str38[sizeof("lo")]; char unicode_prop_name_pool_str39[sizeof("lao")]; char unicode_prop_name_pool_str40[sizeof("laoo")]; char unicode_prop_name_pool_str43[sizeof("miao")]; char unicode_prop_name_pool_str46[sizeof("cn")]; char unicode_prop_name_pool_str52[sizeof("ci")]; char unicode_prop_name_pool_str53[sizeof("innko")]; char unicode_prop_name_pool_str55[sizeof("zzzz")]; char unicode_prop_name_pool_str56[sizeof("yezi")]; char unicode_prop_name_pool_str58[sizeof("gara")]; char unicode_prop_name_pool_str62[sizeof("gran")]; char unicode_prop_name_pool_str63[sizeof("pi")]; char unicode_prop_name_pool_str69[sizeof("lineara")]; char unicode_prop_name_pool_str70[sizeof("co")]; char unicode_prop_name_pool_str75[sizeof("mark")]; char unicode_prop_name_pool_str81[sizeof("po")]; char unicode_prop_name_pool_str84[sizeof("inkiratrai")]; char unicode_prop_name_pool_str90[sizeof("me")]; char unicode_prop_name_pool_str93[sizeof("inkharoshthi")]; char unicode_prop_name_pool_str94[sizeof("cari")]; char unicode_prop_name_pool_str95[sizeof("loe")]; char unicode_prop_name_pool_str97[sizeof("carian")]; char unicode_prop_name_pool_str98[sizeof("mro")]; char unicode_prop_name_pool_str99[sizeof("mroo")]; char unicode_prop_name_pool_str102[sizeof("grek")]; char unicode_prop_name_pool_str107[sizeof("kana")]; char unicode_prop_name_pool_str110[sizeof("geor")]; char unicode_prop_name_pool_str111[sizeof("greek")]; char unicode_prop_name_pool_str116[sizeof("m")]; char unicode_prop_name_pool_str119[sizeof("mero")]; char unicode_prop_name_pool_str121[sizeof("pe")]; char unicode_prop_name_pool_str126[sizeof("mendekikakui")]; char unicode_prop_name_pool_str130[sizeof("gonm")]; char unicode_prop_name_pool_str136[sizeof("inosmanya")]; char unicode_prop_name_pool_str142[sizeof("inmanichaean")]; char unicode_prop_name_pool_str146[sizeof("inchakma")]; char unicode_prop_name_pool_str147[sizeof("cakm")]; char unicode_prop_name_pool_str148[sizeof("inmro")]; char unicode_prop_name_pool_str149[sizeof("inmiao")]; char unicode_prop_name_pool_str150[sizeof("meeteimayek")]; char unicode_prop_name_pool_str152[sizeof("mandaic")]; char unicode_prop_name_pool_str155[sizeof("c")]; char unicode_prop_name_pool_str157[sizeof("krai")]; char unicode_prop_name_pool_str161[sizeof("inarmenian")]; char unicode_prop_name_pool_str171[sizeof("inmyanmar")]; char unicode_prop_name_pool_str175[sizeof("inmakasar")]; char unicode_prop_name_pool_str181[sizeof("common")]; char unicode_prop_name_pool_str184[sizeof("qaai")]; char unicode_prop_name_pool_str185[sizeof("marc")]; char unicode_prop_name_pool_str195[sizeof("inrunic")]; char unicode_prop_name_pool_str196[sizeof("incarian")]; char unicode_prop_name_pool_str204[sizeof("lm")]; char unicode_prop_name_pool_str209[sizeof("inkhmer")]; char unicode_prop_name_pool_str213[sizeof("inchorasmian")]; char unicode_prop_name_pool_str215[sizeof("inideographicsymbolsandpunctuation")]; char unicode_prop_name_pool_str217[sizeof("cans")]; char unicode_prop_name_pool_str221[sizeof("merc")]; char unicode_prop_name_pool_str230[sizeof("combiningmark")]; char unicode_prop_name_pool_str232[sizeof("inahom")]; char unicode_prop_name_pool_str233[sizeof("perm")]; char unicode_prop_name_pool_str234[sizeof("inavestan")]; char unicode_prop_name_pool_str238[sizeof("connectorpunctuation")]; char unicode_prop_name_pool_str241[sizeof("insharada")]; char unicode_prop_name_pool_str242[sizeof("lc")]; char unicode_prop_name_pool_str244[sizeof("prependedconcatenationmark")]; char unicode_prop_name_pool_str246[sizeof("incuneiformnumbersandpunctuation")]; char unicode_prop_name_pool_str250[sizeof("inipaextensions")]; char unicode_prop_name_pool_str251[sizeof("makasar")]; char unicode_prop_name_pool_str253[sizeof("latn")]; char unicode_prop_name_pool_str254[sizeof("mc")]; char unicode_prop_name_pool_str256[sizeof("inarrows")]; char unicode_prop_name_pool_str257[sizeof("ri")]; char unicode_prop_name_pool_str258[sizeof("latin")]; char unicode_prop_name_pool_str259[sizeof("incherokee")]; char unicode_prop_name_pool_str261[sizeof("inthaana")]; char unicode_prop_name_pool_str262[sizeof("masaramgondi")]; char unicode_prop_name_pool_str271[sizeof("inkatakana")]; char unicode_prop_name_pool_str272[sizeof("armn")]; char unicode_prop_name_pool_str273[sizeof("inthai")]; char unicode_prop_name_pool_str274[sizeof("cc")]; char unicode_prop_name_pool_str275[sizeof("armi")]; char unicode_prop_name_pool_str280[sizeof("incuneiform")]; char unicode_prop_name_pool_str283[sizeof("inkaithi")]; char unicode_prop_name_pool_str285[sizeof("pc")]; char unicode_prop_name_pool_str287[sizeof("armenian")]; char unicode_prop_name_pool_str289[sizeof("inmarchen")]; char unicode_prop_name_pool_str293[sizeof("qmark")]; char unicode_prop_name_pool_str295[sizeof("qaac")]; char unicode_prop_name_pool_str296[sizeof("initialpunctuation")]; char unicode_prop_name_pool_str298[sizeof("inzanabazarsquare")]; char unicode_prop_name_pool_str299[sizeof("insamaritan")]; char unicode_prop_name_pool_str300[sizeof("lineseparator")]; char unicode_prop_name_pool_str304[sizeof("mtei")]; char unicode_prop_name_pool_str309[sizeof("inmasaramgondi")]; char unicode_prop_name_pool_str311[sizeof("inscriptionalparthian")]; char unicode_prop_name_pool_str312[sizeof("incyrillic")]; char unicode_prop_name_pool_str322[sizeof("intakri")]; char unicode_prop_name_pool_str334[sizeof("incham")]; char unicode_prop_name_pool_str335[sizeof("mcm")]; char unicode_prop_name_pool_str346[sizeof("prti")]; char unicode_prop_name_pool_str356[sizeof("katakana")]; char unicode_prop_name_pool_str358[sizeof("inkhmersymbols")]; char unicode_prop_name_pool_str365[sizeof("insyriac")]; char unicode_prop_name_pool_str366[sizeof("pcm")]; char unicode_prop_name_pool_str367[sizeof("mand")]; char unicode_prop_name_pool_str372[sizeof("zs")]; char unicode_prop_name_pool_str382[sizeof("inkanaextendeda")]; char unicode_prop_name_pool_str384[sizeof("cs")]; char unicode_prop_name_pool_str386[sizeof("modi")]; char unicode_prop_name_pool_str388[sizeof("privateuse")]; char unicode_prop_name_pool_str395[sizeof("ps")]; char unicode_prop_name_pool_str401[sizeof("brai")]; char unicode_prop_name_pool_str403[sizeof("mend")]; char unicode_prop_name_pool_str407[sizeof("ideo")]; char unicode_prop_name_pool_str408[sizeof("yezidi")]; char unicode_prop_name_pool_str410[sizeof("inmyanmarextendeda")]; char unicode_prop_name_pool_str414[sizeof("arabic")]; char unicode_prop_name_pool_str417[sizeof("letter")]; char unicode_prop_name_pool_str426[sizeof("xidcontinue")]; char unicode_prop_name_pool_str428[sizeof("ascii")]; char unicode_prop_name_pool_str430[sizeof("innandinagari")]; char unicode_prop_name_pool_str443[sizeof("inoldnortharabian")]; char unicode_prop_name_pool_str445[sizeof("inmeeteimayek")]; char unicode_prop_name_pool_str450[sizeof("knda")]; char unicode_prop_name_pool_str453[sizeof("kannada")]; char unicode_prop_name_pool_str454[sizeof("intransportandmapsymbols")]; char unicode_prop_name_pool_str456[sizeof("kiratrai")]; char unicode_prop_name_pool_str457[sizeof("inruminumeralsymbols")]; char unicode_prop_name_pool_str458[sizeof("inideographicdescriptioncharacters")]; char unicode_prop_name_pool_str466[sizeof("incjkcompatibilityforms")]; char unicode_prop_name_pool_str470[sizeof("letternumber")]; char unicode_prop_name_pool_str471[sizeof("incjkcompatibilityideographs")]; char unicode_prop_name_pool_str474[sizeof("inmodi")]; char unicode_prop_name_pool_str481[sizeof("xidc")]; char unicode_prop_name_pool_str487[sizeof("inmendekikakui")]; char unicode_prop_name_pool_str488[sizeof("lt")]; char unicode_prop_name_pool_str489[sizeof("inemoticons")]; char unicode_prop_name_pool_str504[sizeof("sk")]; char unicode_prop_name_pool_str507[sizeof("inolditalic")]; char unicode_prop_name_pool_str509[sizeof("brahmi")]; char unicode_prop_name_pool_str513[sizeof("gothic")]; char unicode_prop_name_pool_str514[sizeof("inmedefaidrin")]; char unicode_prop_name_pool_str518[sizeof("psalterpahlavi")]; char unicode_prop_name_pool_str520[sizeof("so")]; char unicode_prop_name_pool_str522[sizeof("inspecials")]; char unicode_prop_name_pool_str524[sizeof("kits")]; char unicode_prop_name_pool_str528[sizeof("inmyanmarextendedc")]; char unicode_prop_name_pool_str532[sizeof("intoto")]; char unicode_prop_name_pool_str536[sizeof("xids")]; char unicode_prop_name_pool_str542[sizeof("inchesssymbols")]; char unicode_prop_name_pool_str549[sizeof("incjkcompatibilityideographssupplement")]; char unicode_prop_name_pool_str550[sizeof("inopticalcharacterrecognition")]; char unicode_prop_name_pool_str553[sizeof("sora")]; char unicode_prop_name_pool_str558[sizeof("inkanasupplement")]; char unicode_prop_name_pool_str564[sizeof("inoldsogdian")]; char unicode_prop_name_pool_str571[sizeof("meroiticcursive")]; char unicode_prop_name_pool_str572[sizeof("inmiscellaneousmathematicalsymbolsa")]; char unicode_prop_name_pool_str577[sizeof("grext")]; char unicode_prop_name_pool_str578[sizeof("patternwhitespace")]; char unicode_prop_name_pool_str579[sizeof("insundanese")]; char unicode_prop_name_pool_str585[sizeof("inmandaic")]; char unicode_prop_name_pool_str588[sizeof("print")]; char unicode_prop_name_pool_str590[sizeof("idc")]; char unicode_prop_name_pool_str596[sizeof("batk")]; char unicode_prop_name_pool_str598[sizeof("inancientsymbols")]; char unicode_prop_name_pool_str605[sizeof("batak")]; char unicode_prop_name_pool_str609[sizeof("intaitham")]; char unicode_prop_name_pool_str612[sizeof("inoldsoutharabian")]; char unicode_prop_name_pool_str631[sizeof("incommonindicnumberforms")]; char unicode_prop_name_pool_str635[sizeof("inznamennymusicalnotation")]; char unicode_prop_name_pool_str636[sizeof("samr")]; char unicode_prop_name_pool_str639[sizeof("patws")]; char unicode_prop_name_pool_str645[sizeof("bamum")]; char unicode_prop_name_pool_str651[sizeof("idsbinaryoperator")]; char unicode_prop_name_pool_str652[sizeof("samaritan")]; char unicode_prop_name_pool_str655[sizeof("pauc")]; char unicode_prop_name_pool_str660[sizeof("s")]; char unicode_prop_name_pool_str669[sizeof("incjkstrokes")]; char unicode_prop_name_pool_str673[sizeof("inugaritic")]; char unicode_prop_name_pool_str674[sizeof("lisu")]; char unicode_prop_name_pool_str683[sizeof("indominotiles")]; char unicode_prop_name_pool_str685[sizeof("idsunaryoperator")]; char unicode_prop_name_pool_str686[sizeof("sm")]; char unicode_prop_name_pool_str689[sizeof("l")]; char unicode_prop_name_pool_str692[sizeof("inancientgreekmusicalnotation")]; char unicode_prop_name_pool_str693[sizeof("bass")]; char unicode_prop_name_pool_str700[sizeof("ids")]; char unicode_prop_name_pool_str707[sizeof("inmodifiertoneletters")]; char unicode_prop_name_pool_str719[sizeof("incontrolpictures")]; char unicode_prop_name_pool_str724[sizeof("sc")]; char unicode_prop_name_pool_str730[sizeof("insaurashtra")]; char unicode_prop_name_pool_str731[sizeof("insunuwar")]; char unicode_prop_name_pool_str733[sizeof("inlao")]; char unicode_prop_name_pool_str735[sizeof("pd")]; char unicode_prop_name_pool_str740[sizeof("inolonal")]; char unicode_prop_name_pool_str741[sizeof("inoldturkic")]; char unicode_prop_name_pool_str745[sizeof("inlineara")]; char unicode_prop_name_pool_str749[sizeof("mongolian")]; char unicode_prop_name_pool_str752[sizeof("inmusicalsymbols")]; char unicode_prop_name_pool_str760[sizeof("idcontinue")]; char unicode_prop_name_pool_str761[sizeof("incaucasianalbanian")]; char unicode_prop_name_pool_str764[sizeof("grlink")]; char unicode_prop_name_pool_str769[sizeof("idst")]; char unicode_prop_name_pool_str782[sizeof("runr")]; char unicode_prop_name_pool_str794[sizeof("kali")]; char unicode_prop_name_pool_str802[sizeof("inadlam")]; char unicode_prop_name_pool_str806[sizeof("inmiscellaneoussymbols")]; char unicode_prop_name_pool_str810[sizeof("control")]; char unicode_prop_name_pool_str814[sizeof("indeseret")]; char unicode_prop_name_pool_str815[sizeof("inmiscellaneoussymbolsandarrows")]; char unicode_prop_name_pool_str819[sizeof("idstart")]; char unicode_prop_name_pool_str820[sizeof("inmiscellaneoussymbolsandpictographs")]; char unicode_prop_name_pool_str833[sizeof("inlycian")]; char unicode_prop_name_pool_str834[sizeof("palm")]; char unicode_prop_name_pool_str844[sizeof("sind")]; char unicode_prop_name_pool_str848[sizeof("onao")]; char unicode_prop_name_pool_str849[sizeof("xidstart")]; char unicode_prop_name_pool_str853[sizeof("inancientgreeknumbers")]; char unicode_prop_name_pool_str854[sizeof("xdigit")]; char unicode_prop_name_pool_str861[sizeof("inmeeteimayekextensions")]; char unicode_prop_name_pool_str867[sizeof("inkhudawadi")]; char unicode_prop_name_pool_str879[sizeof("inspacingmodifierletters")]; char unicode_prop_name_pool_str883[sizeof("oriya")]; char unicode_prop_name_pool_str900[sizeof("cased")]; char unicode_prop_name_pool_str905[sizeof("inmalayalam")]; char unicode_prop_name_pool_str915[sizeof("inolduyghur")]; char unicode_prop_name_pool_str929[sizeof("incountingrodnumerals")]; char unicode_prop_name_pool_str932[sizeof("bamu")]; char unicode_prop_name_pool_str933[sizeof("insmallkanaextension")]; char unicode_prop_name_pool_str934[sizeof("bidic")]; char unicode_prop_name_pool_str937[sizeof("ital")]; char unicode_prop_name_pool_str946[sizeof("inkaktoviknumerals")]; char unicode_prop_name_pool_str948[sizeof("joinc")]; char unicode_prop_name_pool_str952[sizeof("insylotinagri")]; char unicode_prop_name_pool_str957[sizeof("vai")]; char unicode_prop_name_pool_str958[sizeof("vaii")]; char unicode_prop_name_pool_str963[sizeof("inlinearbideograms")]; char unicode_prop_name_pool_str964[sizeof("inlatinextendeda")]; char unicode_prop_name_pool_str966[sizeof("sterm")]; char unicode_prop_name_pool_str967[sizeof("incyrillicsupplement")]; char unicode_prop_name_pool_str972[sizeof("runic")]; char unicode_prop_name_pool_str978[sizeof("lu")]; char unicode_prop_name_pool_str979[sizeof("insiddham")]; char unicode_prop_name_pool_str984[sizeof("quotationmark")]; char unicode_prop_name_pool_str987[sizeof("intaile")]; char unicode_prop_name_pool_str996[sizeof("incherokeesupplement")]; char unicode_prop_name_pool_str1009[sizeof("alnum")]; char unicode_prop_name_pool_str1014[sizeof("idsu")]; char unicode_prop_name_pool_str1015[sizeof("incjkunifiedideographsextensiona")]; char unicode_prop_name_pool_str1022[sizeof("incjkunifiedideographsextensioni")]; char unicode_prop_name_pool_str1023[sizeof("saur")]; char unicode_prop_name_pool_str1024[sizeof("punct")]; char unicode_prop_name_pool_str1025[sizeof("sundanese")]; char unicode_prop_name_pool_str1030[sizeof("guru")]; char unicode_prop_name_pool_str1036[sizeof("inlatinextendede")]; char unicode_prop_name_pool_str1038[sizeof("bali")]; char unicode_prop_name_pool_str1039[sizeof("paucinhau")]; char unicode_prop_name_pool_str1048[sizeof("blank")]; char unicode_prop_name_pool_str1049[sizeof("gurmukhi")]; char unicode_prop_name_pool_str1050[sizeof("intamil")]; char unicode_prop_name_pool_str1051[sizeof("incjkunifiedideographsextensione")]; char unicode_prop_name_pool_str1052[sizeof("inmultani")]; char unicode_prop_name_pool_str1058[sizeof("inlydian")]; char unicode_prop_name_pool_str1074[sizeof("osage")]; char unicode_prop_name_pool_str1081[sizeof("bengali")]; char unicode_prop_name_pool_str1087[sizeof("limbu")]; char unicode_prop_name_pool_str1100[sizeof("osma")]; char unicode_prop_name_pool_str1110[sizeof("zinh")]; char unicode_prop_name_pool_str1111[sizeof("balinese")]; char unicode_prop_name_pool_str1117[sizeof("inhanifirohingya")]; char unicode_prop_name_pool_str1125[sizeof("plrd")]; char unicode_prop_name_pool_str1133[sizeof("incjkunifiedideographsextensionc")]; char unicode_prop_name_pool_str1140[sizeof("inhiragana")]; char unicode_prop_name_pool_str1143[sizeof("canadianaboriginal")]; char unicode_prop_name_pool_str1155[sizeof("saurashtra")]; char unicode_prop_name_pool_str1159[sizeof("phoenician")]; char unicode_prop_name_pool_str1171[sizeof("ingrantha")]; char unicode_prop_name_pool_str1174[sizeof("sd")]; char unicode_prop_name_pool_str1177[sizeof("gong")]; char unicode_prop_name_pool_str1178[sizeof("incjkunifiedideographs")]; char unicode_prop_name_pool_str1181[sizeof("marchen")]; char unicode_prop_name_pool_str1183[sizeof("sidd")]; char unicode_prop_name_pool_str1184[sizeof("odi")]; char unicode_prop_name_pool_str1186[sizeof("mong")]; char unicode_prop_name_pool_str1188[sizeof("sinhala")]; char unicode_prop_name_pool_str1189[sizeof("graphemelink")]; char unicode_prop_name_pool_str1193[sizeof("inearlydynasticcuneiform")]; char unicode_prop_name_pool_str1194[sizeof("cher")]; char unicode_prop_name_pool_str1197[sizeof("kaithi")]; char unicode_prop_name_pool_str1199[sizeof("inmahajani")]; char unicode_prop_name_pool_str1200[sizeof("inlatinextendedc")]; char unicode_prop_name_pool_str1204[sizeof("multani")]; char unicode_prop_name_pool_str1205[sizeof("inogham")]; char unicode_prop_name_pool_str1207[sizeof("gunjalagondi")]; char unicode_prop_name_pool_str1210[sizeof("cham")]; char unicode_prop_name_pool_str1211[sizeof("cherokee")]; char unicode_prop_name_pool_str1212[sizeof("chakma")]; char unicode_prop_name_pool_str1214[sizeof("khojki")]; char unicode_prop_name_pool_str1217[sizeof("inosage")]; char unicode_prop_name_pool_str1221[sizeof("khar")]; char unicode_prop_name_pool_str1223[sizeof("manichaean")]; char unicode_prop_name_pool_str1224[sizeof("georgian")]; char unicode_prop_name_pool_str1226[sizeof("ingeneralpunctuation")]; char unicode_prop_name_pool_str1233[sizeof("inolchiki")]; char unicode_prop_name_pool_str1235[sizeof("ingeorgian")]; char unicode_prop_name_pool_str1245[sizeof("graphemebase")]; char unicode_prop_name_pool_str1248[sizeof("adlm")]; char unicode_prop_name_pool_str1254[sizeof("inethiopic")]; char unicode_prop_name_pool_str1259[sizeof("inkhitansmallscript")]; char unicode_prop_name_pool_str1269[sizeof("insinhala")]; char unicode_prop_name_pool_str1276[sizeof("inmongolian")]; char unicode_prop_name_pool_str1279[sizeof("punctuation")]; char unicode_prop_name_pool_str1280[sizeof("emoji")]; char unicode_prop_name_pool_str1287[sizeof("innagmundari")]; char unicode_prop_name_pool_str1288[sizeof("vs")]; char unicode_prop_name_pool_str1294[sizeof("casedletter")]; char unicode_prop_name_pool_str1296[sizeof("oidc")]; char unicode_prop_name_pool_str1305[sizeof("intamilsupplement")]; char unicode_prop_name_pool_str1308[sizeof("ahom")]; char unicode_prop_name_pool_str1310[sizeof("chorasmian")]; char unicode_prop_name_pool_str1320[sizeof("khmr")]; char unicode_prop_name_pool_str1321[sizeof("ingurmukhi")]; char unicode_prop_name_pool_str1323[sizeof("sund")]; char unicode_prop_name_pool_str1324[sizeof("patternsyntax")]; char unicode_prop_name_pool_str1331[sizeof("chrs")]; char unicode_prop_name_pool_str1332[sizeof("math")]; char unicode_prop_name_pool_str1337[sizeof("inscriptionalpahlavi")]; char unicode_prop_name_pool_str1339[sizeof("goth")]; char unicode_prop_name_pool_str1348[sizeof("adlam")]; char unicode_prop_name_pool_str1351[sizeof("oids")]; char unicode_prop_name_pool_str1358[sizeof("incjkunifiedideographsextensiond")]; char unicode_prop_name_pool_str1368[sizeof("khmer")]; char unicode_prop_name_pool_str1373[sizeof("grantha")]; char unicode_prop_name_pool_str1374[sizeof("ll")]; char unicode_prop_name_pool_str1376[sizeof("kharoshthi")]; char unicode_prop_name_pool_str1380[sizeof("intirhuta")]; char unicode_prop_name_pool_str1383[sizeof("inhatran")]; char unicode_prop_name_pool_str1387[sizeof("inmiscellaneoustechnical")]; char unicode_prop_name_pool_str1392[sizeof("logicalorderexception")]; char unicode_prop_name_pool_str1393[sizeof("radical")]; char unicode_prop_name_pool_str1394[sizeof("zl")]; char unicode_prop_name_pool_str1395[sizeof("insorasompeng")]; char unicode_prop_name_pool_str1404[sizeof("n")]; char unicode_prop_name_pool_str1411[sizeof("intangsa")]; char unicode_prop_name_pool_str1422[sizeof("kthi")]; char unicode_prop_name_pool_str1431[sizeof("mult")]; char unicode_prop_name_pool_str1432[sizeof("nandinagari")]; char unicode_prop_name_pool_str1433[sizeof("no")]; char unicode_prop_name_pool_str1442[sizeof("nko")]; char unicode_prop_name_pool_str1443[sizeof("nkoo")]; char unicode_prop_name_pool_str1444[sizeof("intulutigalari")]; char unicode_prop_name_pool_str1447[sizeof("p")]; char unicode_prop_name_pool_str1463[sizeof("emojimodifier")]; char unicode_prop_name_pool_str1464[sizeof("xpeo")]; char unicode_prop_name_pool_str1465[sizeof("brah")]; char unicode_prop_name_pool_str1466[sizeof("sunu")]; char unicode_prop_name_pool_str1467[sizeof("inoldhungarian")]; char unicode_prop_name_pool_str1483[sizeof("inphoenician")]; char unicode_prop_name_pool_str1486[sizeof("incyrillicextendeda")]; char unicode_prop_name_pool_str1489[sizeof("inherited")]; char unicode_prop_name_pool_str1496[sizeof("intaixuanjingsymbols")]; char unicode_prop_name_pool_str1498[sizeof("ingreekandcoptic")]; char unicode_prop_name_pool_str1512[sizeof("inenclosedideographicsupplement")]; char unicode_prop_name_pool_str1519[sizeof("glagolitic")]; char unicode_prop_name_pool_str1521[sizeof("inmeroitichieroglyphs")]; char unicode_prop_name_pool_str1522[sizeof("bidicontrol")]; char unicode_prop_name_pool_str1525[sizeof("enclosingmark")]; char unicode_prop_name_pool_str1530[sizeof("regionalindicator")]; char unicode_prop_name_pool_str1533[sizeof("beng")]; char unicode_prop_name_pool_str1535[sizeof("inanatolianhieroglyphs")]; char unicode_prop_name_pool_str1536[sizeof("joincontrol")]; char unicode_prop_name_pool_str1539[sizeof("inkangxiradicals")]; char unicode_prop_name_pool_str1541[sizeof("dia")]; char unicode_prop_name_pool_str1542[sizeof("cpmn")]; char unicode_prop_name_pool_str1547[sizeof("di")]; char unicode_prop_name_pool_str1550[sizeof("diak")]; char unicode_prop_name_pool_str1554[sizeof("graphemeextend")]; char unicode_prop_name_pool_str1555[sizeof("indogra")]; char unicode_prop_name_pool_str1557[sizeof("inphaistosdisc")]; char unicode_prop_name_pool_str1561[sizeof("lepc")]; char unicode_prop_name_pool_str1572[sizeof("sinh")]; char unicode_prop_name_pool_str1575[sizeof("shavian")]; char unicode_prop_name_pool_str1576[sizeof("gukh")]; char unicode_prop_name_pool_str1583[sizeof("linb")]; char unicode_prop_name_pool_str1592[sizeof("ingreekextended")]; char unicode_prop_name_pool_str1593[sizeof("incyprominoan")]; char unicode_prop_name_pool_str1595[sizeof("innabataean")]; char unicode_prop_name_pool_str1596[sizeof("zanb")]; char unicode_prop_name_pool_str1598[sizeof("inhanunoo")]; char unicode_prop_name_pool_str1599[sizeof("bhks")]; char unicode_prop_name_pool_str1600[sizeof("inkanbun")]; char unicode_prop_name_pool_str1601[sizeof("inbhaiksuki")]; char unicode_prop_name_pool_str1604[sizeof("incyrillicextendedc")]; char unicode_prop_name_pool_str1608[sizeof("emod")]; char unicode_prop_name_pool_str1611[sizeof("bhaiksuki")]; char unicode_prop_name_pool_str1612[sizeof("xsux")]; char unicode_prop_name_pool_str1622[sizeof("format")]; char unicode_prop_name_pool_str1625[sizeof("inelbasan")]; char unicode_prop_name_pool_str1629[sizeof("emojimodifierbase")]; char unicode_prop_name_pool_str1633[sizeof("linearb")]; char unicode_prop_name_pool_str1638[sizeof("olck")]; char unicode_prop_name_pool_str1643[sizeof("inimperialaramaic")]; char unicode_prop_name_pool_str1650[sizeof("inlatinextendedd")]; char unicode_prop_name_pool_str1651[sizeof("insundanesesupplement")]; char unicode_prop_name_pool_str1652[sizeof("intangut")]; char unicode_prop_name_pool_str1654[sizeof("cntrl")]; char unicode_prop_name_pool_str1655[sizeof("olchiki")]; char unicode_prop_name_pool_str1657[sizeof("inlatinextendedadditional")]; char unicode_prop_name_pool_str1660[sizeof("olower")]; char unicode_prop_name_pool_str1666[sizeof("sogdian")]; char unicode_prop_name_pool_str1668[sizeof("sogo")]; char unicode_prop_name_pool_str1672[sizeof("ingeometricshapes")]; char unicode_prop_name_pool_str1677[sizeof("emojicomponent")]; char unicode_prop_name_pool_str1678[sizeof("limb")]; char unicode_prop_name_pool_str1682[sizeof("intodhri")]; char unicode_prop_name_pool_str1684[sizeof("inkayahli")]; char unicode_prop_name_pool_str1687[sizeof("insogdian")]; char unicode_prop_name_pool_str1688[sizeof("indingbats")]; char unicode_prop_name_pool_str1690[sizeof("inoriya")]; char unicode_prop_name_pool_str1691[sizeof("inyezidi")]; char unicode_prop_name_pool_str1692[sizeof("insinhalaarchaicnumbers")]; char unicode_prop_name_pool_str1696[sizeof("copt")]; char unicode_prop_name_pool_str1697[sizeof("vithkuqi")]; char unicode_prop_name_pool_str1698[sizeof("incb")]; char unicode_prop_name_pool_str1699[sizeof("wara")]; char unicode_prop_name_pool_str1700[sizeof("coptic")]; char unicode_prop_name_pool_str1701[sizeof("gurungkhema")]; char unicode_prop_name_pool_str1702[sizeof("inarabic")]; char unicode_prop_name_pool_str1709[sizeof("ideographic")]; char unicode_prop_name_pool_str1719[sizeof("diacritic")]; char unicode_prop_name_pool_str1727[sizeof("cprt")]; char unicode_prop_name_pool_str1733[sizeof("arab")]; char unicode_prop_name_pool_str1734[sizeof("inenclosedalphanumerics")]; char unicode_prop_name_pool_str1735[sizeof("anatolianhieroglyphs")]; char unicode_prop_name_pool_str1745[sizeof("innewa")]; char unicode_prop_name_pool_str1748[sizeof("asciihexdigit")]; char unicode_prop_name_pool_str1750[sizeof("nand")]; char unicode_prop_name_pool_str1751[sizeof("intags")]; char unicode_prop_name_pool_str1752[sizeof("ininscriptionalparthian")]; char unicode_prop_name_pool_str1753[sizeof("innushu")]; char unicode_prop_name_pool_str1754[sizeof("ininscriptionalpahlavi")]; char unicode_prop_name_pool_str1763[sizeof("inkawi")]; char unicode_prop_name_pool_str1774[sizeof("inkatakanaphoneticextensions")]; char unicode_prop_name_pool_str1775[sizeof("inarabicpresentationformsa")]; char unicode_prop_name_pool_str1776[sizeof("inbasiclatin")]; char unicode_prop_name_pool_str1778[sizeof("bopo")]; char unicode_prop_name_pool_str1781[sizeof("lyci")]; char unicode_prop_name_pool_str1784[sizeof("lycian")]; char unicode_prop_name_pool_str1790[sizeof("inoldpersian")]; char unicode_prop_name_pool_str1792[sizeof("imperialaramaic")]; char unicode_prop_name_pool_str1801[sizeof("braille")]; char unicode_prop_name_pool_str1803[sizeof("ingurungkhema")]; char unicode_prop_name_pool_str1808[sizeof("inwarangciti")]; char unicode_prop_name_pool_str1811[sizeof("inenclosedalphanumericsupplement")]; char unicode_prop_name_pool_str1813[sizeof("phli")]; char unicode_prop_name_pool_str1814[sizeof("mymr")]; char unicode_prop_name_pool_str1817[sizeof("myanmar")]; char unicode_prop_name_pool_str1823[sizeof("han")]; char unicode_prop_name_pool_str1827[sizeof("hani")]; char unicode_prop_name_pool_str1829[sizeof("incyrillicextendedd")]; char unicode_prop_name_pool_str1832[sizeof("inbatak")]; char unicode_prop_name_pool_str1833[sizeof("kawi")]; char unicode_prop_name_pool_str1836[sizeof("hano")]; char unicode_prop_name_pool_str1841[sizeof("glag")]; char unicode_prop_name_pool_str1842[sizeof("lower")]; char unicode_prop_name_pool_str1847[sizeof("inlisu")]; char unicode_prop_name_pool_str1850[sizeof("ingeometricshapesextended")]; char unicode_prop_name_pool_str1859[sizeof("hanunoo")]; char unicode_prop_name_pool_str1863[sizeof("inkhojki")]; char unicode_prop_name_pool_str1866[sizeof("intibetan")]; char unicode_prop_name_pool_str1869[sizeof("grbase")]; char unicode_prop_name_pool_str1870[sizeof("hira")]; char unicode_prop_name_pool_str1874[sizeof("insoyombo")]; char unicode_prop_name_pool_str1880[sizeof("decimalnumber")]; char unicode_prop_name_pool_str1881[sizeof("inwancho")]; char unicode_prop_name_pool_str1889[sizeof("inlisusupplement")]; char unicode_prop_name_pool_str1895[sizeof("sorasompeng")]; char unicode_prop_name_pool_str1896[sizeof("incoptic")]; char unicode_prop_name_pool_str1897[sizeof("bopomofo")]; char unicode_prop_name_pool_str1899[sizeof("inoldpermic")]; char unicode_prop_name_pool_str1907[sizeof("sharada")]; char unicode_prop_name_pool_str1909[sizeof("inethiopicsupplement")]; char unicode_prop_name_pool_str1913[sizeof("incjksymbolsandpunctuation")]; char unicode_prop_name_pool_str1915[sizeof("spacingmark")]; char unicode_prop_name_pool_str1917[sizeof("intelugu")]; char unicode_prop_name_pool_str1922[sizeof("inelymaic")]; char unicode_prop_name_pool_str1930[sizeof("medf")]; char unicode_prop_name_pool_str1933[sizeof("insyriacsupplement")]; char unicode_prop_name_pool_str1934[sizeof("inblockelements")]; char unicode_prop_name_pool_str1936[sizeof("incjkcompatibility")]; char unicode_prop_name_pool_str1941[sizeof("medefaidrin")]; char unicode_prop_name_pool_str1946[sizeof("inkanaextendedb")]; char unicode_prop_name_pool_str1948[sizeof("oldpersian")]; char unicode_prop_name_pool_str1950[sizeof("patsyn")]; char unicode_prop_name_pool_str1951[sizeof("shrd")]; char unicode_prop_name_pool_str1953[sizeof("lowercase")]; char unicode_prop_name_pool_str1954[sizeof("orkh")]; char unicode_prop_name_pool_str1962[sizeof("space")]; char unicode_prop_name_pool_str1964[sizeof("innumberforms")]; char unicode_prop_name_pool_str1965[sizeof("assigned")]; char unicode_prop_name_pool_str1972[sizeof("inarabicextendeda")]; char unicode_prop_name_pool_str1974[sizeof("inmyanmarextendedb")]; char unicode_prop_name_pool_str1977[sizeof("inshorthandformatcontrols")]; char unicode_prop_name_pool_str1980[sizeof("cwcm")]; char unicode_prop_name_pool_str1986[sizeof("bugi")]; char unicode_prop_name_pool_str1992[sizeof("variationselector")]; char unicode_prop_name_pool_str1994[sizeof("inmayannumerals")]; char unicode_prop_name_pool_str1995[sizeof("sogd")]; char unicode_prop_name_pool_str1996[sizeof("dsrt")]; char unicode_prop_name_pool_str2000[sizeof("inbyzantinemusicalsymbols")]; char unicode_prop_name_pool_str2004[sizeof("ingeorgiansupplement")]; char unicode_prop_name_pool_str2006[sizeof("lydi")]; char unicode_prop_name_pool_str2009[sizeof("lydian")]; char unicode_prop_name_pool_str2013[sizeof("siddham")]; char unicode_prop_name_pool_str2018[sizeof("inbraillepatterns")]; char unicode_prop_name_pool_str2024[sizeof("separator")]; char unicode_prop_name_pool_str2027[sizeof("innewtailue")]; char unicode_prop_name_pool_str2049[sizeof("sentenceterminal")]; char unicode_prop_name_pool_str2055[sizeof("inornamentaldingbats")]; char unicode_prop_name_pool_str2058[sizeof("word")]; char unicode_prop_name_pool_str2059[sizeof("buginese")]; char unicode_prop_name_pool_str2061[sizeof("oldpermic")]; char unicode_prop_name_pool_str2065[sizeof("inyiradicals")]; char unicode_prop_name_pool_str2066[sizeof("phnx")]; char unicode_prop_name_pool_str2067[sizeof("hatran")]; char unicode_prop_name_pool_str2071[sizeof("deseret")]; char unicode_prop_name_pool_str2073[sizeof("ogam")]; char unicode_prop_name_pool_str2077[sizeof("insuttonsignwriting")]; char unicode_prop_name_pool_str2085[sizeof("inunifiedcanadianaboriginalsyllabicsextendeda")]; char unicode_prop_name_pool_str2086[sizeof("incjkunifiedideographsextensionh")]; char unicode_prop_name_pool_str2087[sizeof("nd")]; char unicode_prop_name_pool_str2090[sizeof("inarabicextendedc")]; char unicode_prop_name_pool_str2092[sizeof("idsb")]; char unicode_prop_name_pool_str2095[sizeof("caseignorable")]; char unicode_prop_name_pool_str2101[sizeof("sarb")]; char unicode_prop_name_pool_str2104[sizeof("hatr")]; char unicode_prop_name_pool_str2110[sizeof("uideo")]; char unicode_prop_name_pool_str2120[sizeof("number")]; char unicode_prop_name_pool_str2129[sizeof("zanabazarsquare")]; char unicode_prop_name_pool_str2136[sizeof("inmiscellaneousmathematicalsymbolsb")]; char unicode_prop_name_pool_str2161[sizeof("incjkunifiedideographsextensiong")]; char unicode_prop_name_pool_str2163[sizeof("innyiakengpuachuehmong")]; char unicode_prop_name_pool_str2169[sizeof("ahex")]; char unicode_prop_name_pool_str2170[sizeof("soyo")]; char unicode_prop_name_pool_str2172[sizeof("cuneiform")]; char unicode_prop_name_pool_str2173[sizeof("insymbolsforlegacycomputingsupplement")]; char unicode_prop_name_pool_str2180[sizeof("incopticepactnumbers")]; char unicode_prop_name_pool_str2183[sizeof("osge")]; char unicode_prop_name_pool_str2195[sizeof("closepunctuation")]; char unicode_prop_name_pool_str2201[sizeof("graph")]; char unicode_prop_name_pool_str2206[sizeof("alpha")]; char unicode_prop_name_pool_str2211[sizeof("lowercaseletter")]; char unicode_prop_name_pool_str2215[sizeof("modifierletter")]; char unicode_prop_name_pool_str2218[sizeof("takri")]; char unicode_prop_name_pool_str2219[sizeof("olditalic")]; char unicode_prop_name_pool_str2221[sizeof("inlepcha")]; char unicode_prop_name_pool_str2222[sizeof("invai")]; char unicode_prop_name_pool_str2226[sizeof("surrogate")]; char unicode_prop_name_pool_str2234[sizeof("meroitichieroglyphs")]; char unicode_prop_name_pool_str2235[sizeof("other")]; char unicode_prop_name_pool_str2241[sizeof("inpalmyrene")]; char unicode_prop_name_pool_str2244[sizeof("cwt")]; char unicode_prop_name_pool_str2245[sizeof("othernumber")]; char unicode_prop_name_pool_str2247[sizeof("buhd")]; char unicode_prop_name_pool_str2248[sizeof("otheridcontinue")]; char unicode_prop_name_pool_str2249[sizeof("inunifiedcanadianaboriginalsyllabics")]; char unicode_prop_name_pool_str2250[sizeof("takr")]; char unicode_prop_name_pool_str2260[sizeof("unassigned")]; char unicode_prop_name_pool_str2263[sizeof("vith")]; char unicode_prop_name_pool_str2267[sizeof("inbamum")]; char unicode_prop_name_pool_str2268[sizeof("phag")]; char unicode_prop_name_pool_str2275[sizeof("taile")]; char unicode_prop_name_pool_str2277[sizeof("inhanguljamo")]; char unicode_prop_name_pool_str2280[sizeof("caucasianalbanian")]; char unicode_prop_name_pool_str2281[sizeof("innoblock")]; char unicode_prop_name_pool_str2283[sizeof("idstrinaryoperator")]; char unicode_prop_name_pool_str2303[sizeof("syrc")]; char unicode_prop_name_pool_str2306[sizeof("inhanguljamoextendeda")]; char unicode_prop_name_pool_str2313[sizeof("inbalinese")]; char unicode_prop_name_pool_str2352[sizeof("otheralphabetic")]; char unicode_prop_name_pool_str2356[sizeof("gujr")]; char unicode_prop_name_pool_str2361[sizeof("oldhungarian")]; char unicode_prop_name_pool_str2367[sizeof("gujarati")]; char unicode_prop_name_pool_str2372[sizeof("tnsa")]; char unicode_prop_name_pool_str2374[sizeof("tangsa")]; char unicode_prop_name_pool_str2377[sizeof("term")]; char unicode_prop_name_pool_str2380[sizeof("inmongoliansupplement")]; char unicode_prop_name_pool_str2383[sizeof("incombiningdiacriticalmarks")]; char unicode_prop_name_pool_str2389[sizeof("inshavian")]; char unicode_prop_name_pool_str2393[sizeof("incombiningdiacriticalmarksforsymbols")]; char unicode_prop_name_pool_str2396[sizeof("spaceseparator")]; char unicode_prop_name_pool_str2419[sizeof("cyrl")]; char unicode_prop_name_pool_str2423[sizeof("syriac")]; char unicode_prop_name_pool_str2427[sizeof("inunifiedcanadianaboriginalsyllabicsextended")]; char unicode_prop_name_pool_str2428[sizeof("inethiopicextendeda")]; char unicode_prop_name_pool_str2431[sizeof("inmathematicalalphanumericsymbols")]; char unicode_prop_name_pool_str2451[sizeof("mlym")]; char unicode_prop_name_pool_str2452[sizeof("induployan")]; char unicode_prop_name_pool_str2456[sizeof("malayalam")]; char unicode_prop_name_pool_str2461[sizeof("incombiningdiacriticalmarkssupplement")]; char unicode_prop_name_pool_str2464[sizeof("insymbolsandpictographsextendeda")]; char unicode_prop_name_pool_str2468[sizeof("toto")]; char unicode_prop_name_pool_str2469[sizeof("ethi")]; char unicode_prop_name_pool_str2471[sizeof("palmyrene")]; char unicode_prop_name_pool_str2478[sizeof("rohg")]; char unicode_prop_name_pool_str2489[sizeof("taiviet")]; char unicode_prop_name_pool_str2507[sizeof("ougr")]; char unicode_prop_name_pool_str2511[sizeof("oldturkic")]; char unicode_prop_name_pool_str2512[sizeof("inpaucinhau")]; char unicode_prop_name_pool_str2516[sizeof("lepcha")]; char unicode_prop_name_pool_str2523[sizeof("orya")]; char unicode_prop_name_pool_str2532[sizeof("incjkradicalssupplement")]; char unicode_prop_name_pool_str2546[sizeof("incjkunifiedideographsextensionf")]; char unicode_prop_name_pool_str2552[sizeof("inglagolitic")]; char unicode_prop_name_pool_str2554[sizeof("intagalog")]; char unicode_prop_name_pool_str2561[sizeof("incombiningdiacriticalmarksextended")]; char unicode_prop_name_pool_str2566[sizeof("inphagspa")]; char unicode_prop_name_pool_str2571[sizeof("ext")]; char unicode_prop_name_pool_str2572[sizeof("indevanagari")]; char unicode_prop_name_pool_str2579[sizeof("incjkunifiedideographsextensionb")]; char unicode_prop_name_pool_str2585[sizeof("oalpha")]; char unicode_prop_name_pool_str2591[sizeof("buhid")]; char unicode_prop_name_pool_str2596[sizeof("ingothic")]; char unicode_prop_name_pool_str2597[sizeof("avestan")]; char unicode_prop_name_pool_str2601[sizeof("todr")]; char unicode_prop_name_pool_str2610[sizeof("indevanagariextendeda")]; char unicode_prop_name_pool_str2613[sizeof("inottomansiyaqnumbers")]; char unicode_prop_name_pool_str2617[sizeof("todhri")]; char unicode_prop_name_pool_str2638[sizeof("inlatin1supplement")]; char unicode_prop_name_pool_str2648[sizeof("nagm")]; char unicode_prop_name_pool_str2662[sizeof("inbrahmi")]; char unicode_prop_name_pool_str2667[sizeof("terminalpunctuation")]; char unicode_prop_name_pool_str2684[sizeof("otheridstart")]; char unicode_prop_name_pool_str2687[sizeof("nchar")]; char unicode_prop_name_pool_str2695[sizeof("inverticalforms")]; char unicode_prop_name_pool_str2697[sizeof("phagspa")]; char unicode_prop_name_pool_str2698[sizeof("dogra")]; char unicode_prop_name_pool_str2700[sizeof("extpict")]; char unicode_prop_name_pool_str2701[sizeof("intaiviet")]; char unicode_prop_name_pool_str2719[sizeof("otheruppercase")]; char unicode_prop_name_pool_str2727[sizeof("avst")]; char unicode_prop_name_pool_str2729[sizeof("extender")]; char unicode_prop_name_pool_str2734[sizeof("cwu")]; char unicode_prop_name_pool_str2737[sizeof("inphoneticextensions")]; char unicode_prop_name_pool_str2741[sizeof("invariationselectors")]; char unicode_prop_name_pool_str2742[sizeof("inbengali")]; char unicode_prop_name_pool_str2744[sizeof("dogr")]; char unicode_prop_name_pool_str2745[sizeof("softdotted")]; char unicode_prop_name_pool_str2746[sizeof("incurrencysymbols")]; char unicode_prop_name_pool_str2751[sizeof("invedicextensions")]; char unicode_prop_name_pool_str2753[sizeof("sunuwar")]; char unicode_prop_name_pool_str2755[sizeof("osmanya")]; char unicode_prop_name_pool_str2761[sizeof("wancho")]; char unicode_prop_name_pool_str2769[sizeof("nl")]; char unicode_prop_name_pool_str2770[sizeof("inethiopicextended")]; char unicode_prop_name_pool_str2772[sizeof("mathsymbol")]; char unicode_prop_name_pool_str2775[sizeof("inbuginese")]; char unicode_prop_name_pool_str2779[sizeof("dash")]; char unicode_prop_name_pool_str2780[sizeof("inlowsurrogates")]; char unicode_prop_name_pool_str2787[sizeof("ebase")]; char unicode_prop_name_pool_str2815[sizeof("inphoneticextensionssupplement")]; char unicode_prop_name_pool_str2819[sizeof("invariationselectorssupplement")]; char unicode_prop_name_pool_str2824[sizeof("zp")]; char unicode_prop_name_pool_str2826[sizeof("posixpunct")]; char unicode_prop_name_pool_str2835[sizeof("noncharactercodepoint")]; char unicode_prop_name_pool_str2838[sizeof("sylo")]; char unicode_prop_name_pool_str2840[sizeof("nonspacingmark")]; char unicode_prop_name_pool_str2845[sizeof("oupper")]; char unicode_prop_name_pool_str2852[sizeof("inlimbu")]; char unicode_prop_name_pool_str2857[sizeof("wcho")]; char unicode_prop_name_pool_str2860[sizeof("ingaray")]; char unicode_prop_name_pool_str2862[sizeof("warangciti")]; char unicode_prop_name_pool_str2865[sizeof("ingeorgianextended")]; char unicode_prop_name_pool_str2870[sizeof("changeswhencasemapped")]; char unicode_prop_name_pool_str2871[sizeof("currencysymbol")]; char unicode_prop_name_pool_str2872[sizeof("intifinagh")]; char unicode_prop_name_pool_str2879[sizeof("java")]; char unicode_prop_name_pool_str2896[sizeof("titlecaseletter")]; char unicode_prop_name_pool_str2898[sizeof("olonal")]; char unicode_prop_name_pool_str2903[sizeof("mahj")]; char unicode_prop_name_pool_str2904[sizeof("inmeroiticcursive")]; char unicode_prop_name_pool_str2914[sizeof("mahajani")]; char unicode_prop_name_pool_str2915[sizeof("tale")]; char unicode_prop_name_pool_str2917[sizeof("otherlowercase")]; char unicode_prop_name_pool_str2920[sizeof("ugar")]; char unicode_prop_name_pool_str2925[sizeof("otherletter")]; char unicode_prop_name_pool_str2930[sizeof("changeswhentitlecased")]; char unicode_prop_name_pool_str2943[sizeof("epres")]; char unicode_prop_name_pool_str2945[sizeof("emojipresentation")]; char unicode_prop_name_pool_str2946[sizeof("inaegeannumbers")]; char unicode_prop_name_pool_str2949[sizeof("inindicsiyaqnumbers")]; char unicode_prop_name_pool_str2952[sizeof("indevanagariextended")]; char unicode_prop_name_pool_str2959[sizeof("javanese")]; char unicode_prop_name_pool_str2966[sizeof("hang")]; char unicode_prop_name_pool_str2970[sizeof("inletterlikesymbols")]; char unicode_prop_name_pool_str2973[sizeof("intagbanwa")]; char unicode_prop_name_pool_str2975[sizeof("inalphabeticpresentationforms")]; char unicode_prop_name_pool_str2978[sizeof("taml")]; char unicode_prop_name_pool_str2979[sizeof("tirhuta")]; char unicode_prop_name_pool_str2981[sizeof("whitespace")]; char unicode_prop_name_pool_str2987[sizeof("ingujarati")]; char unicode_prop_name_pool_str2992[sizeof("paragraphseparator")]; char unicode_prop_name_pool_str2997[sizeof("intangutcomponents")]; char unicode_prop_name_pool_str2999[sizeof("ingunjalagondi")]; char unicode_prop_name_pool_str3002[sizeof("khoj")]; char unicode_prop_name_pool_str3003[sizeof("inbassavah")]; char unicode_prop_name_pool_str3004[sizeof("inbuhid")]; char unicode_prop_name_pool_str3011[sizeof("khitansmallscript")]; char unicode_prop_name_pool_str3014[sizeof("narb")]; char unicode_prop_name_pool_str3017[sizeof("inbopomofo")]; char unicode_prop_name_pool_str3020[sizeof("hiragana")]; char unicode_prop_name_pool_str3025[sizeof("inrejang")]; char unicode_prop_name_pool_str3027[sizeof("oldsogdian")]; char unicode_prop_name_pool_str3035[sizeof("nushu")]; char unicode_prop_name_pool_str3050[sizeof("incyrillicextendedb")]; char unicode_prop_name_pool_str3051[sizeof("othersymbol")]; char unicode_prop_name_pool_str3052[sizeof("nagmundari")]; char unicode_prop_name_pool_str3053[sizeof("extendedpictographic")]; char unicode_prop_name_pool_str3054[sizeof("otherdefaultignorablecodepoint")]; char unicode_prop_name_pool_str3065[sizeof("hmng")]; char unicode_prop_name_pool_str3068[sizeof("insymbolsforlegacycomputing")]; char unicode_prop_name_pool_str3070[sizeof("omath")]; char unicode_prop_name_pool_str3084[sizeof("sylotinagri")]; char unicode_prop_name_pool_str3086[sizeof("inlinearbsyllabary")]; char unicode_prop_name_pool_str3097[sizeof("intangutsupplement")]; char unicode_prop_name_pool_str3098[sizeof("inarabicmathematicalalphabeticsymbols")]; char unicode_prop_name_pool_str3100[sizeof("cf")]; char unicode_prop_name_pool_str3105[sizeof("inenclosedcjklettersandmonths")]; char unicode_prop_name_pool_str3107[sizeof("inbamumsupplement")]; char unicode_prop_name_pool_str3111[sizeof("pf")]; char unicode_prop_name_pool_str3130[sizeof("cwl")]; char unicode_prop_name_pool_str3133[sizeof("nshu")]; char unicode_prop_name_pool_str3136[sizeof("inmathematicaloperators")]; char unicode_prop_name_pool_str3143[sizeof("inhangulsyllables")]; char unicode_prop_name_pool_str3156[sizeof("incombininghalfmarks")]; char unicode_prop_name_pool_str3162[sizeof("newa")]; char unicode_prop_name_pool_str3169[sizeof("tangut")]; char unicode_prop_name_pool_str3171[sizeof("digit")]; char unicode_prop_name_pool_str3186[sizeof("changeswhenuppercased")]; char unicode_prop_name_pool_str3189[sizeof("finalpunctuation")]; char unicode_prop_name_pool_str3196[sizeof("inpsalterpahlavi")]; char unicode_prop_name_pool_str3205[sizeof("phlp")]; char unicode_prop_name_pool_str3207[sizeof("rjng")]; char unicode_prop_name_pool_str3208[sizeof("nbat")]; char unicode_prop_name_pool_str3210[sizeof("newtailue")]; char unicode_prop_name_pool_str3212[sizeof("newline")]; char unicode_prop_name_pool_str3213[sizeof("cyprominoan")]; char unicode_prop_name_pool_str3217[sizeof("nabataean")]; char unicode_prop_name_pool_str3223[sizeof("insuperscriptsandsubscripts")]; char unicode_prop_name_pool_str3225[sizeof("cyrillic")]; char unicode_prop_name_pool_str3243[sizeof("ugaritic")]; char unicode_prop_name_pool_str3244[sizeof("ogham")]; char unicode_prop_name_pool_str3252[sizeof("insmallformvariants")]; char unicode_prop_name_pool_str3256[sizeof("inlatinextendedg")]; char unicode_prop_name_pool_str3266[sizeof("thaa")]; char unicode_prop_name_pool_str3270[sizeof("inarabicsupplement")]; char unicode_prop_name_pool_str3272[sizeof("thaana")]; char unicode_prop_name_pool_str3273[sizeof("thai")]; char unicode_prop_name_pool_str3284[sizeof("shaw")]; char unicode_prop_name_pool_str3292[sizeof("insupplementalarrowsa")]; char unicode_prop_name_pool_str3293[sizeof("inplayingcards")]; char unicode_prop_name_pool_str3318[sizeof("hmnp")]; char unicode_prop_name_pool_str3320[sizeof("tirh")]; char unicode_prop_name_pool_str3335[sizeof("idcompatmathcontinue")]; char unicode_prop_name_pool_str3339[sizeof("inarabicpresentationformsb")]; char unicode_prop_name_pool_str3343[sizeof("idcompatmathstart")]; char unicode_prop_name_pool_str3345[sizeof("tang")]; char unicode_prop_name_pool_str3349[sizeof("tagbanwa")]; char unicode_prop_name_pool_str3354[sizeof("cypriot")]; char unicode_prop_name_pool_str3355[sizeof("garay")]; char unicode_prop_name_pool_str3362[sizeof("othermath")]; char unicode_prop_name_pool_str3363[sizeof("sgnw")]; char unicode_prop_name_pool_str3365[sizeof("talu")]; char unicode_prop_name_pool_str3375[sizeof("taitham")]; char unicode_prop_name_pool_str3384[sizeof("changeswhenlowercased")]; char unicode_prop_name_pool_str3395[sizeof("khudawadi")]; char unicode_prop_name_pool_str3398[sizeof("elba")]; char unicode_prop_name_pool_str3401[sizeof("telu")]; char unicode_prop_name_pool_str3410[sizeof("insupplementalarrowsc")]; char unicode_prop_name_pool_str3412[sizeof("cwcf")]; char unicode_prop_name_pool_str3416[sizeof("wspace")]; char unicode_prop_name_pool_str3421[sizeof("any")]; char unicode_prop_name_pool_str3432[sizeof("insupplementalmathematicaloperators")]; char unicode_prop_name_pool_str3445[sizeof("ogrext")]; char unicode_prop_name_pool_str3452[sizeof("hung")]; char unicode_prop_name_pool_str3463[sizeof("hebr")]; char unicode_prop_name_pool_str3473[sizeof("deprecated")]; char unicode_prop_name_pool_str3485[sizeof("unknown")]; char unicode_prop_name_pool_str3497[sizeof("oldnortharabian")]; char unicode_prop_name_pool_str3510[sizeof("modifiercombiningmark")]; char unicode_prop_name_pool_str3516[sizeof("kayahli")]; char unicode_prop_name_pool_str3532[sizeof("invithkuqi")]; char unicode_prop_name_pool_str3536[sizeof("inarabicextendedb")]; char unicode_prop_name_pool_str3566[sizeof("indivesakuru")]; char unicode_prop_name_pool_str3578[sizeof("elbasan")]; char unicode_prop_name_pool_str3581[sizeof("elym")]; char unicode_prop_name_pool_str3606[sizeof("otherpunctuation")]; char unicode_prop_name_pool_str3610[sizeof("elymaic")]; char unicode_prop_name_pool_str3623[sizeof("symbol")]; char unicode_prop_name_pool_str3635[sizeof("tulutigalari")]; char unicode_prop_name_pool_str3641[sizeof("inalchemicalsymbols")]; char unicode_prop_name_pool_str3645[sizeof("inpahawhhmong")]; char unicode_prop_name_pool_str3661[sizeof("inprivateusearea")]; char unicode_prop_name_pool_str3663[sizeof("tamil")]; char unicode_prop_name_pool_str3676[sizeof("hangul")]; char unicode_prop_name_pool_str3703[sizeof("inyisyllables")]; char unicode_prop_name_pool_str3731[sizeof("hex")]; char unicode_prop_name_pool_str3739[sizeof("insupplementalpunctuation")]; char unicode_prop_name_pool_str3762[sizeof("deva")]; char unicode_prop_name_pool_str3774[sizeof("inyijinghexagramsymbols")]; char unicode_prop_name_pool_str3776[sizeof("inhighprivateusesurrogates")]; char unicode_prop_name_pool_str3779[sizeof("devanagari")]; char unicode_prop_name_pool_str3786[sizeof("bassavah")]; char unicode_prop_name_pool_str3836[sizeof("soyombo")]; char unicode_prop_name_pool_str3849[sizeof("dashpunctuation")]; char unicode_prop_name_pool_str3865[sizeof("inmahjongtiles")]; char unicode_prop_name_pool_str3870[sizeof("inhanguljamoextendedb")]; char unicode_prop_name_pool_str3893[sizeof("alphabetic")]; char unicode_prop_name_pool_str3903[sizeof("aghb")]; char unicode_prop_name_pool_str3926[sizeof("incypriotsyllabary")]; char unicode_prop_name_pool_str3936[sizeof("oldsoutharabian")]; char unicode_prop_name_pool_str3985[sizeof("inhalfwidthandfullwidthforms")]; char unicode_prop_name_pool_str3992[sizeof("inethiopicextendedb")]; char unicode_prop_name_pool_str3999[sizeof("ethiopic")]; char unicode_prop_name_pool_str4007[sizeof("tibt")]; char unicode_prop_name_pool_str4014[sizeof("tibetan")]; char unicode_prop_name_pool_str4026[sizeof("inlatinextendedf")]; char unicode_prop_name_pool_str4031[sizeof("othergraphemeextend")]; char unicode_prop_name_pool_str4061[sizeof("injavanese")]; char unicode_prop_name_pool_str4068[sizeof("tutg")]; char unicode_prop_name_pool_str4083[sizeof("ecomp")]; char unicode_prop_name_pool_str4084[sizeof("inglagoliticsupplement")]; char unicode_prop_name_pool_str4092[sizeof("inlatinextendedb")]; char unicode_prop_name_pool_str4104[sizeof("dupl")]; char unicode_prop_name_pool_str4175[sizeof("modifiersymbol")]; char unicode_prop_name_pool_str4190[sizeof("hexdigit")]; char unicode_prop_name_pool_str4278[sizeof("inegyptianhieroglyphsextendeda")]; char unicode_prop_name_pool_str4302[sizeof("changeswhencasefolded")]; char unicode_prop_name_pool_str4368[sizeof("dep")]; char unicode_prop_name_pool_str4391[sizeof("rejang")]; char unicode_prop_name_pool_str4398[sizeof("divesakuru")]; char unicode_prop_name_pool_str4404[sizeof("openpunctuation")]; char unicode_prop_name_pool_str4425[sizeof("inhebrew")]; char unicode_prop_name_pool_str4442[sizeof("inegyptianhieroglyphs")]; char unicode_prop_name_pool_str4455[sizeof("inegyptianhieroglyphformatcontrols")]; char unicode_prop_name_pool_str4514[sizeof("hanifirohingya")]; char unicode_prop_name_pool_str4566[sizeof("signwriting")]; char unicode_prop_name_pool_str4617[sizeof("defaultignorablecodepoint")]; char unicode_prop_name_pool_str4620[sizeof("upper")]; char unicode_prop_name_pool_str4627[sizeof("tavt")]; char unicode_prop_name_pool_str4635[sizeof("inbopomofoextended")]; char unicode_prop_name_pool_str4653[sizeof("insupplementaryprivateuseareaa")]; char unicode_prop_name_pool_str4701[sizeof("olduyghur")]; char unicode_prop_name_pool_str4709[sizeof("hluw")]; char unicode_prop_name_pool_str4731[sizeof("uppercase")]; char unicode_prop_name_pool_str4808[sizeof("inhighsurrogates")]; char unicode_prop_name_pool_str4812[sizeof("tifinagh")]; char unicode_prop_name_pool_str4856[sizeof("insupplementalarrowsb")]; char unicode_prop_name_pool_str4876[sizeof("tfng")]; char unicode_prop_name_pool_str4905[sizeof("tagb")]; char unicode_prop_name_pool_str4909[sizeof("hyphen")]; char unicode_prop_name_pool_str4972[sizeof("zyyy")]; char unicode_prop_name_pool_str4989[sizeof("uppercaseletter")]; char unicode_prop_name_pool_str5035[sizeof("telugu")]; char unicode_prop_name_pool_str5069[sizeof("pahawhhmong")]; char unicode_prop_name_pool_str5080[sizeof("insupplementalsymbolsandpictographs")]; char unicode_prop_name_pool_str5081[sizeof("unifiedideograph")]; char unicode_prop_name_pool_str5092[sizeof("duployan")]; char unicode_prop_name_pool_str5163[sizeof("inboxdrawing")]; char unicode_prop_name_pool_str5171[sizeof("tglg")]; char unicode_prop_name_pool_str5190[sizeof("tagalog")]; char unicode_prop_name_pool_str5237[sizeof("inhangulcompatibilityjamo")]; char unicode_prop_name_pool_str5343[sizeof("egyp")]; char unicode_prop_name_pool_str5453[sizeof("nyiakengpuachuehmong")]; char unicode_prop_name_pool_str6075[sizeof("egyptianhieroglyphs")]; char unicode_prop_name_pool_str6217[sizeof("insupplementaryprivateuseareab")]; char unicode_prop_name_pool_str6900[sizeof("hebrew")]; }; static const struct unicode_prop_name_pool_t unicode_prop_name_pool_contents = { "lana", "yi", "lina", "yiii", "mn", "maka", "mani", "z", "inkannada", "lo", "lao", "laoo", "miao", "cn", "ci", "innko", "zzzz", "yezi", "gara", "gran", "pi", "lineara", "co", "mark", "po", "inkiratrai", "me", "inkharoshthi", "cari", "loe", "carian", "mro", "mroo", "grek", "kana", "geor", "greek", "m", "mero", "pe", "mendekikakui", "gonm", "inosmanya", "inmanichaean", "inchakma", "cakm", "inmro", "inmiao", "meeteimayek", "mandaic", "c", "krai", "inarmenian", "inmyanmar", "inmakasar", "common", "qaai", "marc", "inrunic", "incarian", "lm", "inkhmer", "inchorasmian", "inideographicsymbolsandpunctuation", "cans", "merc", "combiningmark", "inahom", "perm", "inavestan", "connectorpunctuation", "insharada", "lc", "prependedconcatenationmark", "incuneiformnumbersandpunctuation", "inipaextensions", "makasar", "latn", "mc", "inarrows", "ri", "latin", "incherokee", "inthaana", "masaramgondi", "inkatakana", "armn", "inthai", "cc", "armi", "incuneiform", "inkaithi", "pc", "armenian", "inmarchen", "qmark", "qaac", "initialpunctuation", "inzanabazarsquare", "insamaritan", "lineseparator", "mtei", "inmasaramgondi", "inscriptionalparthian", "incyrillic", "intakri", "incham", "mcm", "prti", "katakana", "inkhmersymbols", "insyriac", "pcm", "mand", "zs", "inkanaextendeda", "cs", "modi", "privateuse", "ps", "brai", "mend", "ideo", "yezidi", "inmyanmarextendeda", "arabic", "letter", "xidcontinue", "ascii", "innandinagari", "inoldnortharabian", "inmeeteimayek", "knda", "kannada", "intransportandmapsymbols", "kiratrai", "inruminumeralsymbols", "inideographicdescriptioncharacters", "incjkcompatibilityforms", "letternumber", "incjkcompatibilityideographs", "inmodi", "xidc", "inmendekikakui", "lt", "inemoticons", "sk", "inolditalic", "brahmi", "gothic", "inmedefaidrin", "psalterpahlavi", "so", "inspecials", "kits", "inmyanmarextendedc", "intoto", "xids", "inchesssymbols", "incjkcompatibilityideographssupplement", "inopticalcharacterrecognition", "sora", "inkanasupplement", "inoldsogdian", "meroiticcursive", "inmiscellaneousmathematicalsymbolsa", "grext", "patternwhitespace", "insundanese", "inmandaic", "print", "idc", "batk", "inancientsymbols", "batak", "intaitham", "inoldsoutharabian", "incommonindicnumberforms", "inznamennymusicalnotation", "samr", "patws", "bamum", "idsbinaryoperator", "samaritan", "pauc", "s", "incjkstrokes", "inugaritic", "lisu", "indominotiles", "idsunaryoperator", "sm", "l", "inancientgreekmusicalnotation", "bass", "ids", "inmodifiertoneletters", "incontrolpictures", "sc", "insaurashtra", "insunuwar", "inlao", "pd", "inolonal", "inoldturkic", "inlineara", "mongolian", "inmusicalsymbols", "idcontinue", "incaucasianalbanian", "grlink", "idst", "runr", "kali", "inadlam", "inmiscellaneoussymbols", "control", "indeseret", "inmiscellaneoussymbolsandarrows", "idstart", "inmiscellaneoussymbolsandpictographs", "inlycian", "palm", "sind", "onao", "xidstart", "inancientgreeknumbers", "xdigit", "inmeeteimayekextensions", "inkhudawadi", "inspacingmodifierletters", "oriya", "cased", "inmalayalam", "inolduyghur", "incountingrodnumerals", "bamu", "insmallkanaextension", "bidic", "ital", "inkaktoviknumerals", "joinc", "insylotinagri", "vai", "vaii", "inlinearbideograms", "inlatinextendeda", "sterm", "incyrillicsupplement", "runic", "lu", "insiddham", "quotationmark", "intaile", "incherokeesupplement", "alnum", "idsu", "incjkunifiedideographsextensiona", "incjkunifiedideographsextensioni", "saur", "punct", "sundanese", "guru", "inlatinextendede", "bali", "paucinhau", "blank", "gurmukhi", "intamil", "incjkunifiedideographsextensione", "inmultani", "inlydian", "osage", "bengali", "limbu", "osma", "zinh", "balinese", "inhanifirohingya", "plrd", "incjkunifiedideographsextensionc", "inhiragana", "canadianaboriginal", "saurashtra", "phoenician", "ingrantha", "sd", "gong", "incjkunifiedideographs", "marchen", "sidd", "odi", "mong", "sinhala", "graphemelink", "inearlydynasticcuneiform", "cher", "kaithi", "inmahajani", "inlatinextendedc", "multani", "inogham", "gunjalagondi", "cham", "cherokee", "chakma", "khojki", "inosage", "khar", "manichaean", "georgian", "ingeneralpunctuation", "inolchiki", "ingeorgian", "graphemebase", "adlm", "inethiopic", "inkhitansmallscript", "insinhala", "inmongolian", "punctuation", "emoji", "innagmundari", "vs", "casedletter", "oidc", "intamilsupplement", "ahom", "chorasmian", "khmr", "ingurmukhi", "sund", "patternsyntax", "chrs", "math", "inscriptionalpahlavi", "goth", "adlam", "oids", "incjkunifiedideographsextensiond", "khmer", "grantha", "ll", "kharoshthi", "intirhuta", "inhatran", "inmiscellaneoustechnical", "logicalorderexception", "radical", "zl", "insorasompeng", "n", "intangsa", "kthi", "mult", "nandinagari", "no", "nko", "nkoo", "intulutigalari", "p", "emojimodifier", "xpeo", "brah", "sunu", "inoldhungarian", "inphoenician", "incyrillicextendeda", "inherited", "intaixuanjingsymbols", "ingreekandcoptic", "inenclosedideographicsupplement", "glagolitic", "inmeroitichieroglyphs", "bidicontrol", "enclosingmark", "regionalindicator", "beng", "inanatolianhieroglyphs", "joincontrol", "inkangxiradicals", "dia", "cpmn", "di", "diak", "graphemeextend", "indogra", "inphaistosdisc", "lepc", "sinh", "shavian", "gukh", "linb", "ingreekextended", "incyprominoan", "innabataean", "zanb", "inhanunoo", "bhks", "inkanbun", "inbhaiksuki", "incyrillicextendedc", "emod", "bhaiksuki", "xsux", "format", "inelbasan", "emojimodifierbase", "linearb", "olck", "inimperialaramaic", "inlatinextendedd", "insundanesesupplement", "intangut", "cntrl", "olchiki", "inlatinextendedadditional", "olower", "sogdian", "sogo", "ingeometricshapes", "emojicomponent", "limb", "intodhri", "inkayahli", "insogdian", "indingbats", "inoriya", "inyezidi", "insinhalaarchaicnumbers", "copt", "vithkuqi", "incb", "wara", "coptic", "gurungkhema", "inarabic", "ideographic", "diacritic", "cprt", "arab", "inenclosedalphanumerics", "anatolianhieroglyphs", "innewa", "asciihexdigit", "nand", "intags", "ininscriptionalparthian", "innushu", "ininscriptionalpahlavi", "inkawi", "inkatakanaphoneticextensions", "inarabicpresentationformsa", "inbasiclatin", "bopo", "lyci", "lycian", "inoldpersian", "imperialaramaic", "braille", "ingurungkhema", "inwarangciti", "inenclosedalphanumericsupplement", "phli", "mymr", "myanmar", "han", "hani", "incyrillicextendedd", "inbatak", "kawi", "hano", "glag", "lower", "inlisu", "ingeometricshapesextended", "hanunoo", "inkhojki", "intibetan", "grbase", "hira", "insoyombo", "decimalnumber", "inwancho", "inlisusupplement", "sorasompeng", "incoptic", "bopomofo", "inoldpermic", "sharada", "inethiopicsupplement", "incjksymbolsandpunctuation", "spacingmark", "intelugu", "inelymaic", "medf", "insyriacsupplement", "inblockelements", "incjkcompatibility", "medefaidrin", "inkanaextendedb", "oldpersian", "patsyn", "shrd", "lowercase", "orkh", "space", "innumberforms", "assigned", "inarabicextendeda", "inmyanmarextendedb", "inshorthandformatcontrols", "cwcm", "bugi", "variationselector", "inmayannumerals", "sogd", "dsrt", "inbyzantinemusicalsymbols", "ingeorgiansupplement", "lydi", "lydian", "siddham", "inbraillepatterns", "separator", "innewtailue", "sentenceterminal", "inornamentaldingbats", "word", "buginese", "oldpermic", "inyiradicals", "phnx", "hatran", "deseret", "ogam", "insuttonsignwriting", "inunifiedcanadianaboriginalsyllabicsextendeda", "incjkunifiedideographsextensionh", "nd", "inarabicextendedc", "idsb", "caseignorable", "sarb", "hatr", "uideo", "number", "zanabazarsquare", "inmiscellaneousmathematicalsymbolsb", "incjkunifiedideographsextensiong", "innyiakengpuachuehmong", "ahex", "soyo", "cuneiform", "insymbolsforlegacycomputingsupplement", "incopticepactnumbers", "osge", "closepunctuation", "graph", "alpha", "lowercaseletter", "modifierletter", "takri", "olditalic", "inlepcha", "invai", "surrogate", "meroitichieroglyphs", "other", "inpalmyrene", "cwt", "othernumber", "buhd", "otheridcontinue", "inunifiedcanadianaboriginalsyllabics", "takr", "unassigned", "vith", "inbamum", "phag", "taile", "inhanguljamo", "caucasianalbanian", "innoblock", "idstrinaryoperator", "syrc", "inhanguljamoextendeda", "inbalinese", "otheralphabetic", "gujr", "oldhungarian", "gujarati", "tnsa", "tangsa", "term", "inmongoliansupplement", "incombiningdiacriticalmarks", "inshavian", "incombiningdiacriticalmarksforsymbols", "spaceseparator", "cyrl", "syriac", "inunifiedcanadianaboriginalsyllabicsextended", "inethiopicextendeda", "inmathematicalalphanumericsymbols", "mlym", "induployan", "malayalam", "incombiningdiacriticalmarkssupplement", "insymbolsandpictographsextendeda", "toto", "ethi", "palmyrene", "rohg", "taiviet", "ougr", "oldturkic", "inpaucinhau", "lepcha", "orya", "incjkradicalssupplement", "incjkunifiedideographsextensionf", "inglagolitic", "intagalog", "incombiningdiacriticalmarksextended", "inphagspa", "ext", "indevanagari", "incjkunifiedideographsextensionb", "oalpha", "buhid", "ingothic", "avestan", "todr", "indevanagariextendeda", "inottomansiyaqnumbers", "todhri", "inlatin1supplement", "nagm", "inbrahmi", "terminalpunctuation", "otheridstart", "nchar", "inverticalforms", "phagspa", "dogra", "extpict", "intaiviet", "otheruppercase", "avst", "extender", "cwu", "inphoneticextensions", "invariationselectors", "inbengali", "dogr", "softdotted", "incurrencysymbols", "invedicextensions", "sunuwar", "osmanya", "wancho", "nl", "inethiopicextended", "mathsymbol", "inbuginese", "dash", "inlowsurrogates", "ebase", "inphoneticextensionssupplement", "invariationselectorssupplement", "zp", "posixpunct", "noncharactercodepoint", "sylo", "nonspacingmark", "oupper", "inlimbu", "wcho", "ingaray", "warangciti", "ingeorgianextended", "changeswhencasemapped", "currencysymbol", "intifinagh", "java", "titlecaseletter", "olonal", "mahj", "inmeroiticcursive", "mahajani", "tale", "otherlowercase", "ugar", "otherletter", "changeswhentitlecased", "epres", "emojipresentation", "inaegeannumbers", "inindicsiyaqnumbers", "indevanagariextended", "javanese", "hang", "inletterlikesymbols", "intagbanwa", "inalphabeticpresentationforms", "taml", "tirhuta", "whitespace", "ingujarati", "paragraphseparator", "intangutcomponents", "ingunjalagondi", "khoj", "inbassavah", "inbuhid", "khitansmallscript", "narb", "inbopomofo", "hiragana", "inrejang", "oldsogdian", "nushu", "incyrillicextendedb", "othersymbol", "nagmundari", "extendedpictographic", "otherdefaultignorablecodepoint", "hmng", "insymbolsforlegacycomputing", "omath", "sylotinagri", "inlinearbsyllabary", "intangutsupplement", "inarabicmathematicalalphabeticsymbols", "cf", "inenclosedcjklettersandmonths", "inbamumsupplement", "pf", "cwl", "nshu", "inmathematicaloperators", "inhangulsyllables", "incombininghalfmarks", "newa", "tangut", "digit", "changeswhenuppercased", "finalpunctuation", "inpsalterpahlavi", "phlp", "rjng", "nbat", "newtailue", "newline", "cyprominoan", "nabataean", "insuperscriptsandsubscripts", "cyrillic", "ugaritic", "ogham", "insmallformvariants", "inlatinextendedg", "thaa", "inarabicsupplement", "thaana", "thai", "shaw", "insupplementalarrowsa", "inplayingcards", "hmnp", "tirh", "idcompatmathcontinue", "inarabicpresentationformsb", "idcompatmathstart", "tang", "tagbanwa", "cypriot", "garay", "othermath", "sgnw", "talu", "taitham", "changeswhenlowercased", "khudawadi", "elba", "telu", "insupplementalarrowsc", "cwcf", "wspace", "any", "insupplementalmathematicaloperators", "ogrext", "hung", "hebr", "deprecated", "unknown", "oldnortharabian", "modifiercombiningmark", "kayahli", "invithkuqi", "inarabicextendedb", "indivesakuru", "elbasan", "elym", "otherpunctuation", "elymaic", "symbol", "tulutigalari", "inalchemicalsymbols", "inpahawhhmong", "inprivateusearea", "tamil", "hangul", "inyisyllables", "hex", "insupplementalpunctuation", "deva", "inyijinghexagramsymbols", "inhighprivateusesurrogates", "devanagari", "bassavah", "soyombo", "dashpunctuation", "inmahjongtiles", "inhanguljamoextendedb", "alphabetic", "aghb", "incypriotsyllabary", "oldsoutharabian", "inhalfwidthandfullwidthforms", "inethiopicextendedb", "ethiopic", "tibt", "tibetan", "inlatinextendedf", "othergraphemeextend", "injavanese", "tutg", "ecomp", "inglagoliticsupplement", "inlatinextendedb", "dupl", "modifiersymbol", "hexdigit", "inegyptianhieroglyphsextendeda", "changeswhencasefolded", "dep", "rejang", "divesakuru", "openpunctuation", "inhebrew", "inegyptianhieroglyphs", "inegyptianhieroglyphformatcontrols", "hanifirohingya", "signwriting", "defaultignorablecodepoint", "upper", "tavt", "inbopomofoextended", "insupplementaryprivateuseareaa", "olduyghur", "hluw", "uppercase", "inhighsurrogates", "tifinagh", "insupplementalarrowsb", "tfng", "tagb", "hyphen", "zyyy", "uppercaseletter", "telugu", "pahawhhmong", "insupplementalsymbolsandpictographs", "unifiedideograph", "duployan", "inboxdrawing", "tglg", "tagalog", "inhangulcompatibilityjamo", "egyp", "nyiakengpuachuehmong", "egyptianhieroglyphs", "insupplementaryprivateuseareab", "hebrew" }; #define unicode_prop_name_pool ((const char *) &unicode_prop_name_pool_contents) static const struct PoolPropertyNameCtype * unicode_lookup_property_name (register const char *str, register size_t len) { static const struct PoolPropertyNameCtype wordlist[] = { {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(12), 255}, {-1}, {-1}, {-1}, {pool_offset(16), 284}, {-1}, {-1}, {pool_offset(19), 137}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(25), 284}, {pool_offset(26), 166}, {-1}, {pool_offset(28), 151}, {-1}, {-1}, {pool_offset(31), 154}, {-1}, {-1}, {pool_offset(34), 285}, {-1}, {-1}, {pool_offset(37), 319}, {pool_offset(38), 142}, {pool_offset(39), 133}, {pool_offset(40), 133}, {-1}, {-1}, {pool_offset(43), 165}, {-1}, {-1}, {pool_offset(46), 54}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(52), 40}, {pool_offset(53), 306}, {-1}, {pool_offset(55), 273}, {pool_offset(56), 283}, {-1}, {pool_offset(58), 83}, {-1}, {-1}, {-1}, {pool_offset(62), 87}, {pool_offset(63), 221}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(69), 137}, {pool_offset(70), 55}, {-1}, {-1}, {-1}, {-1}, {pool_offset(75), 149}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(81), 222}, {-1}, {-1}, {pool_offset(84), 559}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(90), 159}, {-1}, {-1}, {pool_offset(93), 487}, {pool_offset(94), 39}, {pool_offset(95), 143}, {-1}, {pool_offset(97), 39}, {pool_offset(98), 170}, {pool_offset(99), 170}, {-1}, {-1}, {pool_offset(102), 91}, {-1}, {-1}, {-1}, {-1}, {pool_offset(107), 122}, {-1}, {-1}, {pool_offset(110), 84}, {pool_offset(111), 91}, {-1}, {-1}, {-1}, {-1}, {pool_offset(116), 149}, {-1}, {-1}, {pool_offset(119), 164}, {-1}, {pool_offset(121), 217}, {-1}, {-1}, {-1}, {-1}, {pool_offset(126), 162}, {-1}, {-1}, {-1}, {pool_offset(130), 156}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(136), 470}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(142), 490}, {-1}, {-1}, {-1}, {pool_offset(146), 510}, {pool_offset(147), 45}, {pool_offset(148), 555}, {pool_offset(149), 561}, {pool_offset(150), 161}, {-1}, {pool_offset(152), 153}, {-1}, {-1}, {pool_offset(155), 37}, {-1}, {pool_offset(157), 130}, {-1}, {-1}, {-1}, {pool_offset(161), 300}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(171), 325}, {-1}, {-1}, {-1}, {pool_offset(175), 541}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(181), 56}, {-1}, {-1}, {pool_offset(184), 115}, {pool_offset(185), 155}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(195), 333}, {pool_offset(196), 461}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(204), 141}, {-1}, {-1}, {-1}, {-1}, {pool_offset(209), 338}, {-1}, {-1}, {-1}, {pool_offset(213), 505}, {-1}, {pool_offset(215), 562}, {-1}, {pool_offset(217), 38}, {-1}, {-1}, {-1}, {pool_offset(221), 163}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(230), 149}, {-1}, {pool_offset(232), 526}, {pool_offset(233), 192}, {pool_offset(234), 491}, {-1}, {-1}, {-1}, {pool_offset(238), 215}, {-1}, {-1}, {pool_offset(241), 512}, {pool_offset(242), 132}, {-1}, {pool_offset(244), 223}, {-1}, {pool_offset(246), 546}, {-1}, {-1}, {-1}, {pool_offset(250), 294}, {pool_offset(251), 151}, {-1}, {pool_offset(253), 134}, {pool_offset(254), 158}, {-1}, {pool_offset(256), 368}, {pool_offset(257), 228}, {pool_offset(258), 134}, {pool_offset(259), 330}, {-1}, {pool_offset(261), 305}, {pool_offset(262), 156}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(271), 399}, {pool_offset(272), 22}, {pool_offset(273), 322}, {pool_offset(274), 43}, {pool_offset(275), 113}, {-1}, {-1}, {-1}, {-1}, {pool_offset(280), 545}, {-1}, {-1}, {pool_offset(283), 508}, {-1}, {pool_offset(285), 215}, {-1}, {pool_offset(287), 22}, {-1}, {pool_offset(289), 538}, {-1}, {-1}, {-1}, {pool_offset(293), 226}, {-1}, {pool_offset(295), 57}, {pool_offset(296), 221}, {-1}, {pool_offset(298), 531}, {pool_offset(299), 307}, {pool_offset(300), 287}, {-1}, {-1}, {-1}, {pool_offset(304), 161}, {-1}, {-1}, {-1}, {-1}, {pool_offset(309), 539}, {-1}, {pool_offset(311), 117}, {pool_offset(312), 298}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(322), 524}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(334), 429}, {pool_offset(335), 168}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(346), 117}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(356), 122}, {-1}, {pool_offset(358), 344}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(365), 303}, {pool_offset(366), 223}, {pool_offset(367), 153}, {-1}, {-1}, {-1}, {-1}, {pool_offset(372), 289}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(382), 569}, {-1}, {pool_offset(384), 58}, {-1}, {pool_offset(386), 167}, {-1}, {pool_offset(388), 55}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(395), 224}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(401), 34}, {-1}, {pool_offset(403), 162}, {-1}, {-1}, {-1}, {pool_offset(407), 112}, {pool_offset(408), 283}, {-1}, {pool_offset(410), 430}, {-1}, {-1}, {-1}, {pool_offset(414), 21}, {-1}, {-1}, {pool_offset(417), 131}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(426), 281}, {-1}, {pool_offset(428), 14}, {-1}, {pool_offset(430), 530}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(443), 489}, {-1}, {pool_offset(445), 436}, {-1}, {-1}, {-1}, {-1}, {pool_offset(450), 121}, {-1}, {-1}, {pool_offset(453), 121}, {pool_offset(454), 607}, {-1}, {pool_offset(456), 130}, {pool_offset(457), 499}, {pool_offset(458), 396}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(466), 449}, {-1}, {-1}, {-1}, {pool_offset(470), 181}, {pool_offset(471), 443}, {-1}, {-1}, {pool_offset(474), 522}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(481), 281}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(487), 594}, {pool_offset(488), 145}, {pool_offset(489), 605}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(504), 241}, {-1}, {-1}, {pool_offset(507), 463}, {-1}, {pool_offset(509), 33}, {-1}, {-1}, {-1}, {pool_offset(513), 86}, {pool_offset(514), 560}, {-1}, {-1}, {-1}, {pool_offset(518), 225}, {-1}, {pool_offset(520), 243}, {-1}, {pool_offset(522), 453}, {-1}, {pool_offset(524), 126}, {-1}, {-1}, {-1}, {pool_offset(528), 525}, {-1}, {-1}, {-1}, {pool_offset(532), 589}, {-1}, {-1}, {-1}, {pool_offset(536), 282}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(542), 612}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(549), 621}, {pool_offset(550), 372}, {-1}, {-1}, {pool_offset(553), 246}, {-1}, {-1}, {-1}, {-1}, {pool_offset(558), 568}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(564), 502}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(571), 163}, {pool_offset(572), 379}, {-1}, {-1}, {-1}, {-1}, {pool_offset(577), 89}, {pool_offset(578), 213}, {pool_offset(579), 349}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(585), 308}, {-1}, {-1}, {pool_offset(588), 7}, {-1}, {pool_offset(590), 110}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(596), 28}, {-1}, {pool_offset(598), 458}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(605), 28}, {-1}, {-1}, {-1}, {pool_offset(609), 346}, {-1}, {-1}, {pool_offset(612), 488}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(631), 420}, {-1}, {-1}, {-1}, {pool_offset(635), 575}, {pool_offset(636), 232}, {-1}, {-1}, {pool_offset(639), 213}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(645), 26}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(651), 105}, {pool_offset(652), 232}, {-1}, {-1}, {pool_offset(655), 214}, {-1}, {-1}, {-1}, {-1}, {pool_offset(660), 231}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(669), 404}, {-1}, {-1}, {-1}, {pool_offset(673), 466}, {pool_offset(674), 139}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(683), 600}, {-1}, {pool_offset(685), 107}, {pool_offset(686), 242}, {-1}, {-1}, {pool_offset(689), 131}, {-1}, {-1}, {pool_offset(692), 578}, {pool_offset(693), 27}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(700), 111}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(707), 417}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(719), 371}, {-1}, {-1}, {-1}, {-1}, {pool_offset(724), 234}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(730), 422}, {pool_offset(731), 536}, {-1}, {pool_offset(733), 323}, {-1}, {pool_offset(735), 216}, {-1}, {-1}, {-1}, {-1}, {pool_offset(740), 592}, {pool_offset(741), 495}, {-1}, {-1}, {-1}, {pool_offset(745), 476}, {-1}, {-1}, {-1}, {pool_offset(749), 169}, {-1}, {-1}, {pool_offset(752), 577}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(760), 110}, {pool_offset(761), 473}, {-1}, {-1}, {pool_offset(764), 90}, {-1}, {-1}, {-1}, {-1}, {pool_offset(769), 106}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(782), 230}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(794), 124}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(802), 595}, {-1}, {-1}, {-1}, {pool_offset(806), 377}, {-1}, {-1}, {-1}, {pool_offset(810), 43}, {-1}, {-1}, {-1}, {pool_offset(814), 468}, {pool_offset(815), 385}, {-1}, {-1}, {-1}, {pool_offset(819), 111}, {pool_offset(820), 604}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(833), 460}, {pool_offset(834), 211}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(844), 129}, {-1}, {-1}, {-1}, {pool_offset(848), 188}, {pool_offset(849), 282}, {-1}, {-1}, {-1}, {pool_offset(853), 457}, {pool_offset(854), 11}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(861), 432}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(867), 516}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(879), 295}, {-1}, {-1}, {-1}, {pool_offset(883), 198}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(900), 41}, {-1}, {-1}, {-1}, {-1}, {pool_offset(905), 320}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(915), 504}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(929), 582}, {-1}, {-1}, {pool_offset(932), 26}, {pool_offset(933), 570}, {pool_offset(934), 31}, {-1}, {-1}, {pool_offset(937), 190}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(946), 579}, {-1}, {pool_offset(948), 119}, {-1}, {-1}, {-1}, {pool_offset(952), 419}, {-1}, {-1}, {-1}, {-1}, {pool_offset(957), 275}, {pool_offset(958), 275}, {-1}, {-1}, {-1}, {-1}, {pool_offset(963), 455}, {pool_offset(964), 292}, {-1}, {pool_offset(966), 235}, {pool_offset(967), 299}, {-1}, {-1}, {-1}, {-1}, {pool_offset(972), 230}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(978), 146}, {pool_offset(979), 521}, {-1}, {-1}, {-1}, {-1}, {pool_offset(984), 226}, {-1}, {-1}, {pool_offset(987), 342}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(996), 435}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1009), 13}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1014), 107}, {pool_offset(1015), 408}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1022), 620}, {pool_offset(1023), 233}, {pool_offset(1024), 209}, {pool_offset(1025), 248}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1030), 94}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1036), 434}, {-1}, {pool_offset(1038), 25}, {pool_offset(1039), 214}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1048), 2}, {pool_offset(1049), 94}, {pool_offset(1050), 317}, {pool_offset(1051), 618}, {pool_offset(1052), 515}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1058), 484}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1074), 199}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1081), 29}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1087), 136}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1100), 200}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1110), 115}, {pool_offset(1111), 25}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1117), 497}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1125), 165}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1133), 616}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1140), 398}, {-1}, {-1}, {pool_offset(1143), 38}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1155), 233}, {-1}, {-1}, {-1}, {pool_offset(1159), 220}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1171), 517}, {-1}, {-1}, {pool_offset(1174), 244}, {-1}, {-1}, {pool_offset(1177), 93}, {pool_offset(1178), 410}, {-1}, {-1}, {pool_offset(1181), 155}, {-1}, {pool_offset(1183), 238}, {pool_offset(1184), 202}, {-1}, {pool_offset(1186), 169}, {-1}, {pool_offset(1188), 240}, {pool_offset(1189), 90}, {-1}, {-1}, {-1}, {pool_offset(1193), 547}, {pool_offset(1194), 52}, {-1}, {-1}, {pool_offset(1197), 120}, {-1}, {pool_offset(1199), 511}, {pool_offset(1200), 387}, {-1}, {-1}, {-1}, {pool_offset(1204), 171}, {pool_offset(1205), 332}, {-1}, {pool_offset(1207), 93}, {-1}, {-1}, {pool_offset(1210), 46}, {pool_offset(1211), 52}, {pool_offset(1212), 45}, {-1}, {pool_offset(1214), 128}, {-1}, {-1}, {pool_offset(1217), 471}, {-1}, {-1}, {-1}, {pool_offset(1221), 125}, {-1}, {pool_offset(1223), 154}, {pool_offset(1224), 84}, {-1}, {pool_offset(1226), 362}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1233), 352}, {-1}, {pool_offset(1235), 326}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1245), 88}, {-1}, {-1}, {pool_offset(1248), 16}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1254), 328}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1259), 565}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1269), 321}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1276), 339}, {-1}, {-1}, {pool_offset(1279), 209}, {pool_offset(1280), 75}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1287), 591}, {pool_offset(1288), 276}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1294), 132}, {-1}, {pool_offset(1296), 204}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1305), 544}, {-1}, {-1}, {pool_offset(1308), 17}, {-1}, {pool_offset(1310), 53}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1320), 127}, {pool_offset(1321), 314}, {-1}, {pool_offset(1323), 248}, {pool_offset(1324), 212}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1331), 53}, {pool_offset(1332), 157}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1337), 116}, {-1}, {pool_offset(1339), 86}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1348), 16}, {-1}, {-1}, {pool_offset(1351), 205}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1358), 617}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1368), 127}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1373), 87}, {pool_offset(1374), 140}, {-1}, {pool_offset(1376), 125}, {-1}, {-1}, {-1}, {pool_offset(1380), 520}, {-1}, {-1}, {pool_offset(1383), 482}, {-1}, {-1}, {-1}, {pool_offset(1387), 370}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1392), 143}, {pool_offset(1393), 227}, {pool_offset(1394), 287}, {pool_offset(1395), 509}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1404), 173}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1411), 556}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1422), 120}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1431), 171}, {pool_offset(1432), 176}, {pool_offset(1433), 182}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1442), 180}, {pool_offset(1443), 180}, {pool_offset(1444), 518}, {-1}, {-1}, {pool_offset(1447), 209}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1463), 77}, {pool_offset(1464), 193}, {pool_offset(1465), 33}, {pool_offset(1466), 249}, {pool_offset(1467), 496}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1483), 483}, {-1}, {-1}, {pool_offset(1486), 392}, {-1}, {-1}, {pool_offset(1489), 115}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1496), 581}, {-1}, {pool_offset(1498), 297}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1512), 603}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1519), 85}, {-1}, {pool_offset(1521), 485}, {pool_offset(1522), 31}, {-1}, {-1}, {pool_offset(1525), 159}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1530), 228}, {-1}, {-1}, {pool_offset(1533), 29}, {-1}, {pool_offset(1535), 552}, {pool_offset(1536), 119}, {-1}, {-1}, {pool_offset(1539), 395}, {-1}, {pool_offset(1541), 68}, {pool_offset(1542), 61}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1547), 64}, {-1}, {-1}, {pool_offset(1550), 69}, {-1}, {-1}, {-1}, {pool_offset(1554), 89}, {pool_offset(1555), 527}, {-1}, {pool_offset(1557), 459}, {-1}, {-1}, {-1}, {pool_offset(1561), 135}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1572), 240}, {-1}, {-1}, {pool_offset(1575), 237}, {pool_offset(1576), 95}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1583), 138}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1592), 361}, {pool_offset(1593), 548}, {-1}, {pool_offset(1595), 481}, {pool_offset(1596), 286}, {-1}, {pool_offset(1598), 335}, {pool_offset(1599), 30}, {pool_offset(1600), 402}, {pool_offset(1601), 537}, {-1}, {-1}, {pool_offset(1604), 353}, {-1}, {-1}, {-1}, {pool_offset(1608), 77}, {-1}, {-1}, {pool_offset(1611), 30}, {pool_offset(1612), 59}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1622), 44}, {-1}, {-1}, {pool_offset(1625), 472}, {-1}, {-1}, {-1}, {pool_offset(1629), 78}, {-1}, {-1}, {-1}, {pool_offset(1633), 138}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1638), 187}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1643), 479}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1650), 418}, {pool_offset(1651), 355}, {pool_offset(1652), 563}, {-1}, {pool_offset(1654), 3}, {pool_offset(1655), 187}, {-1}, {pool_offset(1657), 360}, {-1}, {-1}, {pool_offset(1660), 206}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1666), 245}, {-1}, {pool_offset(1668), 194}, {-1}, {-1}, {-1}, {pool_offset(1672), 376}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1677), 76}, {pool_offset(1678), 136}, {-1}, {-1}, {-1}, {pool_offset(1682), 475}, {-1}, {pool_offset(1684), 424}, {-1}, {-1}, {pool_offset(1687), 503}, {pool_offset(1688), 378}, {-1}, {pool_offset(1690), 316}, {pool_offset(1691), 500}, {pool_offset(1692), 513}, {-1}, {-1}, {-1}, {pool_offset(1696), 57}, {pool_offset(1697), 277}, {pool_offset(1698), 114}, {pool_offset(1699), 279}, {pool_offset(1700), 57}, {pool_offset(1701), 95}, {pool_offset(1702), 302}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1709), 112}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1719), 68}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1727), 60}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1733), 21}, {pool_offset(1734), 373}, {pool_offset(1735), 19}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1745), 519}, {-1}, {-1}, {pool_offset(1748), 15}, {-1}, {pool_offset(1750), 176}, {pool_offset(1751), 624}, {pool_offset(1752), 492}, {pool_offset(1753), 571}, {pool_offset(1754), 493}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1763), 542}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1774), 405}, {pool_offset(1775), 445}, {pool_offset(1776), 290}, {-1}, {pool_offset(1778), 32}, {-1}, {-1}, {pool_offset(1781), 147}, {-1}, {-1}, {pool_offset(1784), 147}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1790), 467}, {-1}, {pool_offset(1792), 113}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1801), 34}, {-1}, {pool_offset(1803), 553}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1808), 528}, {-1}, {-1}, {pool_offset(1811), 602}, {-1}, {pool_offset(1813), 116}, {pool_offset(1814), 172}, {-1}, {-1}, {pool_offset(1817), 172}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1823), 96}, {-1}, {-1}, {-1}, {pool_offset(1827), 96}, {-1}, {pool_offset(1829), 587}, {-1}, {-1}, {pool_offset(1832), 350}, {pool_offset(1833), 123}, {-1}, {-1}, {pool_offset(1836), 99}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1841), 85}, {pool_offset(1842), 6}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1847), 413}, {-1}, {-1}, {pool_offset(1850), 609}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1859), 99}, {-1}, {-1}, {-1}, {pool_offset(1863), 514}, {-1}, {-1}, {pool_offset(1866), 324}, {-1}, {-1}, {pool_offset(1869), 88}, {pool_offset(1870), 103}, {-1}, {-1}, {-1}, {pool_offset(1874), 532}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1880), 177}, {pool_offset(1881), 590}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1889), 543}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1895), 246}, {pool_offset(1896), 388}, {pool_offset(1897), 32}, {-1}, {pool_offset(1899), 465}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1907), 236}, {-1}, {pool_offset(1909), 329}, {-1}, {-1}, {-1}, {pool_offset(1913), 397}, {-1}, {pool_offset(1915), 158}, {-1}, {pool_offset(1917), 318}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1922), 506}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1930), 160}, {-1}, {-1}, {pool_offset(1933), 309}, {pool_offset(1934), 375}, {-1}, {pool_offset(1936), 407}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1941), 160}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1946), 567}, {-1}, {pool_offset(1948), 193}, {-1}, {pool_offset(1950), 212}, {pool_offset(1951), 236}, {-1}, {pool_offset(1953), 144}, {pool_offset(1954), 196}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1962), 9}, {-1}, {pool_offset(1964), 367}, {pool_offset(1965), 23}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1972), 311}, {-1}, {pool_offset(1974), 428}, {-1}, {-1}, {pool_offset(1977), 573}, {-1}, {-1}, {pool_offset(1980), 48}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1986), 35}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(1992), 276}, {-1}, {pool_offset(1994), 580}, {pool_offset(1995), 245}, {pool_offset(1996), 66}, {-1}, {-1}, {-1}, {pool_offset(2000), 576}, {-1}, {-1}, {-1}, {pool_offset(2004), 389}, {-1}, {pool_offset(2006), 148}, {-1}, {-1}, {pool_offset(2009), 148}, {-1}, {-1}, {-1}, {pool_offset(2013), 238}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2018), 381}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2024), 285}, {-1}, {-1}, {pool_offset(2027), 343}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2049), 235}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2055), 606}, {-1}, {-1}, {pool_offset(2058), 12}, {pool_offset(2059), 35}, {-1}, {pool_offset(2061), 192}, {-1}, {-1}, {-1}, {pool_offset(2065), 412}, {pool_offset(2066), 220}, {pool_offset(2067), 100}, {-1}, {-1}, {-1}, {pool_offset(2071), 66}, {-1}, {pool_offset(2073), 186}, {-1}, {-1}, {-1}, {pool_offset(2077), 584}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2085), 533}, {pool_offset(2086), 623}, {pool_offset(2087), 177}, {-1}, {-1}, {pool_offset(2090), 501}, {-1}, {pool_offset(2092), 105}, {-1}, {-1}, {pool_offset(2095), 40}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2101), 195}, {-1}, {-1}, {pool_offset(2104), 100}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2110), 272}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2120), 173}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2129), 286}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2136), 383}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2161), 622}, {-1}, {pool_offset(2163), 588}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2169), 15}, {pool_offset(2170), 247}, {-1}, {pool_offset(2172), 59}, {pool_offset(2173), 574}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2180), 462}, {-1}, {-1}, {pool_offset(2183), 199}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2195), 217}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2201), 5}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2206), 1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2211), 140}, {-1}, {-1}, {-1}, {pool_offset(2215), 141}, {-1}, {-1}, {pool_offset(2218), 257}, {pool_offset(2219), 190}, {-1}, {pool_offset(2221), 351}, {pool_offset(2222), 414}, {-1}, {-1}, {-1}, {pool_offset(2226), 58}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2234), 164}, {pool_offset(2235), 37}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2241), 480}, {-1}, {-1}, {pool_offset(2244), 50}, {pool_offset(2245), 182}, {-1}, {pool_offset(2247), 36}, {pool_offset(2248), 204}, {pool_offset(2249), 331}, {pool_offset(2250), 257}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2260), 54}, {-1}, {-1}, {pool_offset(2263), 277}, {-1}, {-1}, {-1}, {pool_offset(2267), 416}, {pool_offset(2268), 219}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2275), 254}, {-1}, {pool_offset(2277), 327}, {-1}, {-1}, {pool_offset(2280), 42}, {pool_offset(2281), 628}, {-1}, {pool_offset(2283), 106}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2303), 251}, {-1}, {-1}, {pool_offset(2306), 426}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2313), 348}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2352), 201}, {-1}, {-1}, {-1}, {pool_offset(2356), 92}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2361), 189}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2367), 92}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2372), 259}, {-1}, {pool_offset(2374), 259}, {-1}, {-1}, {pool_offset(2377), 262}, {-1}, {-1}, {pool_offset(2380), 523}, {-1}, {-1}, {pool_offset(2383), 296}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2389), 469}, {-1}, {-1}, {-1}, {pool_offset(2393), 365}, {-1}, {-1}, {pool_offset(2396), 289}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2419), 62}, {-1}, {-1}, {-1}, {pool_offset(2423), 251}, {-1}, {-1}, {-1}, {pool_offset(2427), 340}, {pool_offset(2428), 433}, {-1}, {-1}, {pool_offset(2431), 583}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2451), 152}, {pool_offset(2452), 572}, {-1}, {-1}, {-1}, {pool_offset(2456), 152}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2461), 359}, {-1}, {-1}, {pool_offset(2464), 613}, {-1}, {-1}, {-1}, {pool_offset(2468), 269}, {pool_offset(2469), 80}, {-1}, {pool_offset(2471), 211}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2478), 98}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2489), 256}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2507), 197}, {-1}, {-1}, {-1}, {pool_offset(2511), 196}, {pool_offset(2512), 534}, {-1}, {-1}, {-1}, {pool_offset(2516), 135}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2523), 198}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2532), 394}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2546), 619}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2552), 386}, {-1}, {pool_offset(2554), 334}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2561), 347}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2566), 421}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2571), 82}, {pool_offset(2572), 312}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2579), 615}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2585), 201}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2591), 36}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2596), 464}, {pool_offset(2597), 24}, {-1}, {-1}, {-1}, {pool_offset(2601), 268}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2610), 535}, {-1}, {-1}, {pool_offset(2613), 597}, {-1}, {-1}, {-1}, {pool_offset(2617), 268}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2638), 291}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2648), 175}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2662), 507}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2667), 262}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2684), 205}, {-1}, {-1}, {pool_offset(2687), 183}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2695), 447}, {-1}, {pool_offset(2697), 219}, {pool_offset(2698), 70}, {-1}, {pool_offset(2700), 81}, {pool_offset(2701), 431}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2719), 208}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2727), 24}, {-1}, {pool_offset(2729), 82}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2734), 51}, {-1}, {-1}, {pool_offset(2737), 357}, {-1}, {-1}, {-1}, {pool_offset(2741), 446}, {pool_offset(2742), 313}, {-1}, {pool_offset(2744), 70}, {pool_offset(2745), 244}, {pool_offset(2746), 364}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2751), 356}, {-1}, {pool_offset(2753), 249}, {-1}, {pool_offset(2755), 200}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2761), 278}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2769), 181}, {pool_offset(2770), 391}, {-1}, {pool_offset(2772), 242}, {-1}, {-1}, {pool_offset(2775), 345}, {-1}, {-1}, {-1}, {pool_offset(2779), 63}, {pool_offset(2780), 441}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2787), 78}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2815), 358}, {-1}, {-1}, {-1}, {pool_offset(2819), 625}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2824), 288}, {-1}, {pool_offset(2826), 8}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2835), 183}, {-1}, {-1}, {pool_offset(2838), 250}, {-1}, {pool_offset(2840), 166}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2845), 208}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2852), 341}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2857), 278}, {-1}, {-1}, {pool_offset(2860), 498}, {-1}, {pool_offset(2862), 279}, {-1}, {-1}, {pool_offset(2865), 354}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2870), 48}, {pool_offset(2871), 234}, {pool_offset(2872), 390}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2879), 118}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2896), 145}, {-1}, {pool_offset(2898), 188}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2903), 150}, {pool_offset(2904), 486}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2914), 150}, {pool_offset(2915), 254}, {-1}, {pool_offset(2917), 206}, {-1}, {-1}, {pool_offset(2920), 271}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2925), 142}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2930), 50}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2943), 79}, {-1}, {pool_offset(2945), 79}, {pool_offset(2946), 456}, {-1}, {-1}, {pool_offset(2949), 596}, {-1}, {-1}, {pool_offset(2952), 423}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2959), 118}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2966), 97}, {-1}, {-1}, {-1}, {pool_offset(2970), 366}, {-1}, {-1}, {pool_offset(2973), 337}, {-1}, {pool_offset(2975), 444}, {-1}, {-1}, {pool_offset(2978), 258}, {pool_offset(2979), 267}, {-1}, {pool_offset(2981), 280}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2987), 315}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2992), 288}, {-1}, {-1}, {-1}, {-1}, {pool_offset(2997), 564}, {-1}, {pool_offset(2999), 540}, {-1}, {-1}, {pool_offset(3002), 128}, {pool_offset(3003), 557}, {pool_offset(3004), 336}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3011), 126}, {-1}, {-1}, {pool_offset(3014), 191}, {-1}, {-1}, {pool_offset(3017), 400}, {-1}, {-1}, {pool_offset(3020), 103}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3025), 425}, {-1}, {pool_offset(3027), 194}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3035), 184}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3050), 415}, {pool_offset(3051), 243}, {pool_offset(3052), 175}, {pool_offset(3053), 81}, {pool_offset(3054), 202}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3065), 210}, {-1}, {-1}, {pool_offset(3068), 614}, {-1}, {pool_offset(3070), 207}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3084), 250}, {-1}, {pool_offset(3086), 454}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3097), 566}, {pool_offset(3098), 598}, {-1}, {pool_offset(3100), 44}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3105), 406}, {-1}, {pool_offset(3107), 554}, {-1}, {-1}, {-1}, {pool_offset(3111), 218}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3130), 49}, {-1}, {-1}, {pool_offset(3133), 184}, {-1}, {-1}, {pool_offset(3136), 369}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3143), 437}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3156), 448}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3162), 179}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3169), 260}, {-1}, {pool_offset(3171), 4}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3186), 51}, {-1}, {-1}, {pool_offset(3189), 218}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3196), 494}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3205), 225}, {-1}, {pool_offset(3207), 229}, {pool_offset(3208), 174}, {-1}, {pool_offset(3210), 178}, {-1}, {pool_offset(3212), 0}, {pool_offset(3213), 61}, {-1}, {-1}, {-1}, {pool_offset(3217), 174}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3223), 363}, {-1}, {pool_offset(3225), 62}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3243), 271}, {pool_offset(3244), 186}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3252), 450}, {-1}, {-1}, {-1}, {pool_offset(3256), 585}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3266), 263}, {-1}, {-1}, {-1}, {pool_offset(3270), 304}, {-1}, {pool_offset(3272), 263}, {pool_offset(3273), 264}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3284), 237}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3292), 380}, {pool_offset(3293), 601}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3318), 185}, {-1}, {pool_offset(3320), 267}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3335), 108}, {-1}, {-1}, {-1}, {pool_offset(3339), 451}, {-1}, {-1}, {-1}, {pool_offset(3343), 109}, {-1}, {pool_offset(3345), 260}, {-1}, {-1}, {-1}, {pool_offset(3349), 253}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3354), 60}, {pool_offset(3355), 83}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3362), 207}, {pool_offset(3363), 239}, {-1}, {pool_offset(3365), 178}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3375), 255}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3384), 49}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3395), 129}, {-1}, {-1}, {pool_offset(3398), 73}, {-1}, {-1}, {pool_offset(3401), 261}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3410), 610}, {-1}, {pool_offset(3412), 47}, {-1}, {-1}, {-1}, {pool_offset(3416), 280}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3421), 20}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3432), 384}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3445), 203}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3452), 189}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3463), 101}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3473), 65}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3485), 273}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3497), 191}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3510), 168}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3516), 124}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3532), 474}, {-1}, {-1}, {-1}, {pool_offset(3536), 310}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3566), 529}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3578), 73}, {-1}, {-1}, {pool_offset(3581), 74}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3606), 222}, {-1}, {-1}, {-1}, {pool_offset(3610), 74}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3623), 231}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3635), 270}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3641), 608}, {-1}, {-1}, {-1}, {pool_offset(3645), 558}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3661), 442}, {-1}, {pool_offset(3663), 258}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3676), 97}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3703), 411}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3731), 102}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3739), 393}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3762), 67}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3774), 409}, {-1}, {pool_offset(3776), 440}, {-1}, {-1}, {pool_offset(3779), 67}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3786), 27}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3836), 247}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3849), 216}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3865), 599}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3870), 438}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3893), 18}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3903), 42}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3926), 478}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3936), 195}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3985), 452}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3992), 593}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(3999), 80}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4007), 265}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4014), 265}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4026), 477}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4031), 203}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4061), 427}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4068), 270}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4083), 76}, {pool_offset(4084), 586}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4092), 293}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4104), 71}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4175), 241}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4190), 102}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4278), 551}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4302), 47}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4368), 65}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4391), 229}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4398), 69}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4404), 224}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4425), 301}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4442), 549}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4455), 550}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4514), 98}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4566), 239}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4617), 64}, {-1}, {-1}, {pool_offset(4620), 10}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4627), 256}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4635), 403}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4653), 626}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4701), 197}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4709), 19}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4731), 274}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4808), 439}, {-1}, {-1}, {-1}, {pool_offset(4812), 266}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4856), 382}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4876), 266}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4905), 253}, {-1}, {-1}, {-1}, {pool_offset(4909), 104}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4972), 56}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(4989), 146}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5035), 261}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5069), 210}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5080), 611}, {pool_offset(5081), 272}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5092), 71}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5163), 374}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5171), 252}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5190), 252}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5237), 401}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5343), 72}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5453), 185}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(6075), 72}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(6217), 627}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(6900), 101} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = wordlist[key].name; if (o >= 0) { register const char *s = o + unicode_prop_name_pool; if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0') return &wordlist[key]; } } } return 0; } #define UNICODE_PROPERTY_VERSION 160000 #define UNICODE_EMOJI_VERSION 1600 #define PROPERTY_NAME_MAX_SIZE 61 #define CODE_RANGES_NUM 629 #define PROP_INDEX_NEWLINE 0 #define PROP_INDEX_ALPHA 1 #define PROP_INDEX_BLANK 2 #define PROP_INDEX_CNTRL 3 #define PROP_INDEX_DIGIT 4 #define PROP_INDEX_GRAPH 5 #define PROP_INDEX_LOWER 6 #define PROP_INDEX_PRINT 7 #define PROP_INDEX_POSIXPUNCT 8 #define PROP_INDEX_SPACE 9 #define PROP_INDEX_UPPER 10 #define PROP_INDEX_XDIGIT 11 #define PROP_INDEX_WORD 12 #define PROP_INDEX_ALNUM 13 #define PROP_INDEX_ASCII 14 #define PROP_INDEX_ASCIIHEXDIGIT 15 #define PROP_INDEX_AHEX 15 #define PROP_INDEX_ADLAM 16 #define PROP_INDEX_ADLM 16 #define PROP_INDEX_AHOM 17 #define PROP_INDEX_ALPHABETIC 18 #define PROP_INDEX_ANATOLIANHIEROGLYPHS 19 #define PROP_INDEX_HLUW 19 #define PROP_INDEX_ANY 20 #define PROP_INDEX_ARABIC 21 #define PROP_INDEX_ARAB 21 #define PROP_INDEX_ARMENIAN 22 #define PROP_INDEX_ARMN 22 #define PROP_INDEX_ASSIGNED 23 #define PROP_INDEX_AVESTAN 24 #define PROP_INDEX_AVST 24 #define PROP_INDEX_BALINESE 25 #define PROP_INDEX_BALI 25 #define PROP_INDEX_BAMUM 26 #define PROP_INDEX_BAMU 26 #define PROP_INDEX_BASSAVAH 27 #define PROP_INDEX_BASS 27 #define PROP_INDEX_BATAK 28 #define PROP_INDEX_BATK 28 #define PROP_INDEX_BENGALI 29 #define PROP_INDEX_BENG 29 #define PROP_INDEX_BHAIKSUKI 30 #define PROP_INDEX_BHKS 30 #define PROP_INDEX_BIDICONTROL 31 #define PROP_INDEX_BIDIC 31 #define PROP_INDEX_BOPOMOFO 32 #define PROP_INDEX_BOPO 32 #define PROP_INDEX_BRAHMI 33 #define PROP_INDEX_BRAH 33 #define PROP_INDEX_BRAILLE 34 #define PROP_INDEX_BRAI 34 #define PROP_INDEX_BUGINESE 35 #define PROP_INDEX_BUGI 35 #define PROP_INDEX_BUHID 36 #define PROP_INDEX_BUHD 36 #define PROP_INDEX_C 37 #define PROP_INDEX_OTHER 37 #define PROP_INDEX_CANADIANABORIGINAL 38 #define PROP_INDEX_CANS 38 #define PROP_INDEX_CARIAN 39 #define PROP_INDEX_CARI 39 #define PROP_INDEX_CASEIGNORABLE 40 #define PROP_INDEX_CI 40 #define PROP_INDEX_CASED 41 #define PROP_INDEX_CAUCASIANALBANIAN 42 #define PROP_INDEX_AGHB 42 #define PROP_INDEX_CC 43 #define PROP_INDEX_CONTROL 43 #define PROP_INDEX_CF 44 #define PROP_INDEX_FORMAT 44 #define PROP_INDEX_CHAKMA 45 #define PROP_INDEX_CAKM 45 #define PROP_INDEX_CHAM 46 #define PROP_INDEX_CHANGESWHENCASEFOLDED 47 #define PROP_INDEX_CWCF 47 #define PROP_INDEX_CHANGESWHENCASEMAPPED 48 #define PROP_INDEX_CWCM 48 #define PROP_INDEX_CHANGESWHENLOWERCASED 49 #define PROP_INDEX_CWL 49 #define PROP_INDEX_CHANGESWHENTITLECASED 50 #define PROP_INDEX_CWT 50 #define PROP_INDEX_CHANGESWHENUPPERCASED 51 #define PROP_INDEX_CWU 51 #define PROP_INDEX_CHEROKEE 52 #define PROP_INDEX_CHER 52 #define PROP_INDEX_CHORASMIAN 53 #define PROP_INDEX_CHRS 53 #define PROP_INDEX_CN 54 #define PROP_INDEX_UNASSIGNED 54 #define PROP_INDEX_CO 55 #define PROP_INDEX_PRIVATEUSE 55 #define PROP_INDEX_COMMON 56 #define PROP_INDEX_ZYYY 56 #define PROP_INDEX_COPTIC 57 #define PROP_INDEX_COPT 57 #define PROP_INDEX_QAAC 57 #define PROP_INDEX_CS 58 #define PROP_INDEX_SURROGATE 58 #define PROP_INDEX_CUNEIFORM 59 #define PROP_INDEX_XSUX 59 #define PROP_INDEX_CYPRIOT 60 #define PROP_INDEX_CPRT 60 #define PROP_INDEX_CYPROMINOAN 61 #define PROP_INDEX_CPMN 61 #define PROP_INDEX_CYRILLIC 62 #define PROP_INDEX_CYRL 62 #define PROP_INDEX_DASH 63 #define PROP_INDEX_DEFAULTIGNORABLECODEPOINT 64 #define PROP_INDEX_DI 64 #define PROP_INDEX_DEPRECATED 65 #define PROP_INDEX_DEP 65 #define PROP_INDEX_DESERET 66 #define PROP_INDEX_DSRT 66 #define PROP_INDEX_DEVANAGARI 67 #define PROP_INDEX_DEVA 67 #define PROP_INDEX_DIACRITIC 68 #define PROP_INDEX_DIA 68 #define PROP_INDEX_DIVESAKURU 69 #define PROP_INDEX_DIAK 69 #define PROP_INDEX_DOGRA 70 #define PROP_INDEX_DOGR 70 #define PROP_INDEX_DUPLOYAN 71 #define PROP_INDEX_DUPL 71 #define PROP_INDEX_EGYPTIANHIEROGLYPHS 72 #define PROP_INDEX_EGYP 72 #define PROP_INDEX_ELBASAN 73 #define PROP_INDEX_ELBA 73 #define PROP_INDEX_ELYMAIC 74 #define PROP_INDEX_ELYM 74 #define PROP_INDEX_EMOJI 75 #define PROP_INDEX_EMOJICOMPONENT 76 #define PROP_INDEX_ECOMP 76 #define PROP_INDEX_EMOJIMODIFIER 77 #define PROP_INDEX_EMOD 77 #define PROP_INDEX_EMOJIMODIFIERBASE 78 #define PROP_INDEX_EBASE 78 #define PROP_INDEX_EMOJIPRESENTATION 79 #define PROP_INDEX_EPRES 79 #define PROP_INDEX_ETHIOPIC 80 #define PROP_INDEX_ETHI 80 #define PROP_INDEX_EXTENDEDPICTOGRAPHIC 81 #define PROP_INDEX_EXTPICT 81 #define PROP_INDEX_EXTENDER 82 #define PROP_INDEX_EXT 82 #define PROP_INDEX_GARAY 83 #define PROP_INDEX_GARA 83 #define PROP_INDEX_GEORGIAN 84 #define PROP_INDEX_GEOR 84 #define PROP_INDEX_GLAGOLITIC 85 #define PROP_INDEX_GLAG 85 #define PROP_INDEX_GOTHIC 86 #define PROP_INDEX_GOTH 86 #define PROP_INDEX_GRANTHA 87 #define PROP_INDEX_GRAN 87 #define PROP_INDEX_GRAPHEMEBASE 88 #define PROP_INDEX_GRBASE 88 #define PROP_INDEX_GRAPHEMEEXTEND 89 #define PROP_INDEX_GREXT 89 #define PROP_INDEX_GRAPHEMELINK 90 #define PROP_INDEX_GRLINK 90 #define PROP_INDEX_GREEK 91 #define PROP_INDEX_GREK 91 #define PROP_INDEX_GUJARATI 92 #define PROP_INDEX_GUJR 92 #define PROP_INDEX_GUNJALAGONDI 93 #define PROP_INDEX_GONG 93 #define PROP_INDEX_GURMUKHI 94 #define PROP_INDEX_GURU 94 #define PROP_INDEX_GURUNGKHEMA 95 #define PROP_INDEX_GUKH 95 #define PROP_INDEX_HAN 96 #define PROP_INDEX_HANI 96 #define PROP_INDEX_HANGUL 97 #define PROP_INDEX_HANG 97 #define PROP_INDEX_HANIFIROHINGYA 98 #define PROP_INDEX_ROHG 98 #define PROP_INDEX_HANUNOO 99 #define PROP_INDEX_HANO 99 #define PROP_INDEX_HATRAN 100 #define PROP_INDEX_HATR 100 #define PROP_INDEX_HEBREW 101 #define PROP_INDEX_HEBR 101 #define PROP_INDEX_HEXDIGIT 102 #define PROP_INDEX_HEX 102 #define PROP_INDEX_HIRAGANA 103 #define PROP_INDEX_HIRA 103 #define PROP_INDEX_HYPHEN 104 #define PROP_INDEX_IDSBINARYOPERATOR 105 #define PROP_INDEX_IDSB 105 #define PROP_INDEX_IDSTRINARYOPERATOR 106 #define PROP_INDEX_IDST 106 #define PROP_INDEX_IDSUNARYOPERATOR 107 #define PROP_INDEX_IDSU 107 #define PROP_INDEX_IDCOMPATMATHCONTINUE 108 #define PROP_INDEX_IDCOMPATMATHSTART 109 #define PROP_INDEX_IDCONTINUE 110 #define PROP_INDEX_IDC 110 #define PROP_INDEX_IDSTART 111 #define PROP_INDEX_IDS 111 #define PROP_INDEX_IDEOGRAPHIC 112 #define PROP_INDEX_IDEO 112 #define PROP_INDEX_IMPERIALARAMAIC 113 #define PROP_INDEX_ARMI 113 #define PROP_INDEX_INCB 114 #define PROP_INDEX_INHERITED 115 #define PROP_INDEX_QAAI 115 #define PROP_INDEX_ZINH 115 #define PROP_INDEX_INSCRIPTIONALPAHLAVI 116 #define PROP_INDEX_PHLI 116 #define PROP_INDEX_INSCRIPTIONALPARTHIAN 117 #define PROP_INDEX_PRTI 117 #define PROP_INDEX_JAVANESE 118 #define PROP_INDEX_JAVA 118 #define PROP_INDEX_JOINCONTROL 119 #define PROP_INDEX_JOINC 119 #define PROP_INDEX_KAITHI 120 #define PROP_INDEX_KTHI 120 #define PROP_INDEX_KANNADA 121 #define PROP_INDEX_KNDA 121 #define PROP_INDEX_KATAKANA 122 #define PROP_INDEX_KANA 122 #define PROP_INDEX_KAWI 123 #define PROP_INDEX_KAYAHLI 124 #define PROP_INDEX_KALI 124 #define PROP_INDEX_KHAROSHTHI 125 #define PROP_INDEX_KHAR 125 #define PROP_INDEX_KHITANSMALLSCRIPT 126 #define PROP_INDEX_KITS 126 #define PROP_INDEX_KHMER 127 #define PROP_INDEX_KHMR 127 #define PROP_INDEX_KHOJKI 128 #define PROP_INDEX_KHOJ 128 #define PROP_INDEX_KHUDAWADI 129 #define PROP_INDEX_SIND 129 #define PROP_INDEX_KIRATRAI 130 #define PROP_INDEX_KRAI 130 #define PROP_INDEX_L 131 #define PROP_INDEX_LETTER 131 #define PROP_INDEX_LC 132 #define PROP_INDEX_CASEDLETTER 132 #define PROP_INDEX_LAO 133 #define PROP_INDEX_LAOO 133 #define PROP_INDEX_LATIN 134 #define PROP_INDEX_LATN 134 #define PROP_INDEX_LEPCHA 135 #define PROP_INDEX_LEPC 135 #define PROP_INDEX_LIMBU 136 #define PROP_INDEX_LIMB 136 #define PROP_INDEX_LINEARA 137 #define PROP_INDEX_LINA 137 #define PROP_INDEX_LINEARB 138 #define PROP_INDEX_LINB 138 #define PROP_INDEX_LISU 139 #define PROP_INDEX_LL 140 #define PROP_INDEX_LOWERCASELETTER 140 #define PROP_INDEX_LM 141 #define PROP_INDEX_MODIFIERLETTER 141 #define PROP_INDEX_LO 142 #define PROP_INDEX_OTHERLETTER 142 #define PROP_INDEX_LOGICALORDEREXCEPTION 143 #define PROP_INDEX_LOE 143 #define PROP_INDEX_LOWERCASE 144 #define PROP_INDEX_LT 145 #define PROP_INDEX_TITLECASELETTER 145 #define PROP_INDEX_LU 146 #define PROP_INDEX_UPPERCASELETTER 146 #define PROP_INDEX_LYCIAN 147 #define PROP_INDEX_LYCI 147 #define PROP_INDEX_LYDIAN 148 #define PROP_INDEX_LYDI 148 #define PROP_INDEX_M 149 #define PROP_INDEX_COMBININGMARK 149 #define PROP_INDEX_MARK 149 #define PROP_INDEX_MAHAJANI 150 #define PROP_INDEX_MAHJ 150 #define PROP_INDEX_MAKASAR 151 #define PROP_INDEX_MAKA 151 #define PROP_INDEX_MALAYALAM 152 #define PROP_INDEX_MLYM 152 #define PROP_INDEX_MANDAIC 153 #define PROP_INDEX_MAND 153 #define PROP_INDEX_MANICHAEAN 154 #define PROP_INDEX_MANI 154 #define PROP_INDEX_MARCHEN 155 #define PROP_INDEX_MARC 155 #define PROP_INDEX_MASARAMGONDI 156 #define PROP_INDEX_GONM 156 #define PROP_INDEX_MATH 157 #define PROP_INDEX_MC 158 #define PROP_INDEX_SPACINGMARK 158 #define PROP_INDEX_ME 159 #define PROP_INDEX_ENCLOSINGMARK 159 #define PROP_INDEX_MEDEFAIDRIN 160 #define PROP_INDEX_MEDF 160 #define PROP_INDEX_MEETEIMAYEK 161 #define PROP_INDEX_MTEI 161 #define PROP_INDEX_MENDEKIKAKUI 162 #define PROP_INDEX_MEND 162 #define PROP_INDEX_MEROITICCURSIVE 163 #define PROP_INDEX_MERC 163 #define PROP_INDEX_MEROITICHIEROGLYPHS 164 #define PROP_INDEX_MERO 164 #define PROP_INDEX_MIAO 165 #define PROP_INDEX_PLRD 165 #define PROP_INDEX_MN 166 #define PROP_INDEX_NONSPACINGMARK 166 #define PROP_INDEX_MODI 167 #define PROP_INDEX_MODIFIERCOMBININGMARK 168 #define PROP_INDEX_MCM 168 #define PROP_INDEX_MONGOLIAN 169 #define PROP_INDEX_MONG 169 #define PROP_INDEX_MRO 170 #define PROP_INDEX_MROO 170 #define PROP_INDEX_MULTANI 171 #define PROP_INDEX_MULT 171 #define PROP_INDEX_MYANMAR 172 #define PROP_INDEX_MYMR 172 #define PROP_INDEX_N 173 #define PROP_INDEX_NUMBER 173 #define PROP_INDEX_NABATAEAN 174 #define PROP_INDEX_NBAT 174 #define PROP_INDEX_NAGMUNDARI 175 #define PROP_INDEX_NAGM 175 #define PROP_INDEX_NANDINAGARI 176 #define PROP_INDEX_NAND 176 #define PROP_INDEX_ND 177 #define PROP_INDEX_DECIMALNUMBER 177 #define PROP_INDEX_NEWTAILUE 178 #define PROP_INDEX_TALU 178 #define PROP_INDEX_NEWA 179 #define PROP_INDEX_NKO 180 #define PROP_INDEX_NKOO 180 #define PROP_INDEX_NL 181 #define PROP_INDEX_LETTERNUMBER 181 #define PROP_INDEX_NO 182 #define PROP_INDEX_OTHERNUMBER 182 #define PROP_INDEX_NONCHARACTERCODEPOINT 183 #define PROP_INDEX_NCHAR 183 #define PROP_INDEX_NUSHU 184 #define PROP_INDEX_NSHU 184 #define PROP_INDEX_NYIAKENGPUACHUEHMONG 185 #define PROP_INDEX_HMNP 185 #define PROP_INDEX_OGHAM 186 #define PROP_INDEX_OGAM 186 #define PROP_INDEX_OLCHIKI 187 #define PROP_INDEX_OLCK 187 #define PROP_INDEX_OLONAL 188 #define PROP_INDEX_ONAO 188 #define PROP_INDEX_OLDHUNGARIAN 189 #define PROP_INDEX_HUNG 189 #define PROP_INDEX_OLDITALIC 190 #define PROP_INDEX_ITAL 190 #define PROP_INDEX_OLDNORTHARABIAN 191 #define PROP_INDEX_NARB 191 #define PROP_INDEX_OLDPERMIC 192 #define PROP_INDEX_PERM 192 #define PROP_INDEX_OLDPERSIAN 193 #define PROP_INDEX_XPEO 193 #define PROP_INDEX_OLDSOGDIAN 194 #define PROP_INDEX_SOGO 194 #define PROP_INDEX_OLDSOUTHARABIAN 195 #define PROP_INDEX_SARB 195 #define PROP_INDEX_OLDTURKIC 196 #define PROP_INDEX_ORKH 196 #define PROP_INDEX_OLDUYGHUR 197 #define PROP_INDEX_OUGR 197 #define PROP_INDEX_ORIYA 198 #define PROP_INDEX_ORYA 198 #define PROP_INDEX_OSAGE 199 #define PROP_INDEX_OSGE 199 #define PROP_INDEX_OSMANYA 200 #define PROP_INDEX_OSMA 200 #define PROP_INDEX_OTHERALPHABETIC 201 #define PROP_INDEX_OALPHA 201 #define PROP_INDEX_OTHERDEFAULTIGNORABLECODEPOINT 202 #define PROP_INDEX_ODI 202 #define PROP_INDEX_OTHERGRAPHEMEEXTEND 203 #define PROP_INDEX_OGREXT 203 #define PROP_INDEX_OTHERIDCONTINUE 204 #define PROP_INDEX_OIDC 204 #define PROP_INDEX_OTHERIDSTART 205 #define PROP_INDEX_OIDS 205 #define PROP_INDEX_OTHERLOWERCASE 206 #define PROP_INDEX_OLOWER 206 #define PROP_INDEX_OTHERMATH 207 #define PROP_INDEX_OMATH 207 #define PROP_INDEX_OTHERUPPERCASE 208 #define PROP_INDEX_OUPPER 208 #define PROP_INDEX_P 209 #define PROP_INDEX_PUNCT 209 #define PROP_INDEX_PUNCTUATION 209 #define PROP_INDEX_PAHAWHHMONG 210 #define PROP_INDEX_HMNG 210 #define PROP_INDEX_PALMYRENE 211 #define PROP_INDEX_PALM 211 #define PROP_INDEX_PATTERNSYNTAX 212 #define PROP_INDEX_PATSYN 212 #define PROP_INDEX_PATTERNWHITESPACE 213 #define PROP_INDEX_PATWS 213 #define PROP_INDEX_PAUCINHAU 214 #define PROP_INDEX_PAUC 214 #define PROP_INDEX_PC 215 #define PROP_INDEX_CONNECTORPUNCTUATION 215 #define PROP_INDEX_PD 216 #define PROP_INDEX_DASHPUNCTUATION 216 #define PROP_INDEX_PE 217 #define PROP_INDEX_CLOSEPUNCTUATION 217 #define PROP_INDEX_PF 218 #define PROP_INDEX_FINALPUNCTUATION 218 #define PROP_INDEX_PHAGSPA 219 #define PROP_INDEX_PHAG 219 #define PROP_INDEX_PHOENICIAN 220 #define PROP_INDEX_PHNX 220 #define PROP_INDEX_PI 221 #define PROP_INDEX_INITIALPUNCTUATION 221 #define PROP_INDEX_PO 222 #define PROP_INDEX_OTHERPUNCTUATION 222 #define PROP_INDEX_PREPENDEDCONCATENATIONMARK 223 #define PROP_INDEX_PCM 223 #define PROP_INDEX_PS 224 #define PROP_INDEX_OPENPUNCTUATION 224 #define PROP_INDEX_PSALTERPAHLAVI 225 #define PROP_INDEX_PHLP 225 #define PROP_INDEX_QUOTATIONMARK 226 #define PROP_INDEX_QMARK 226 #define PROP_INDEX_RADICAL 227 #define PROP_INDEX_REGIONALINDICATOR 228 #define PROP_INDEX_RI 228 #define PROP_INDEX_REJANG 229 #define PROP_INDEX_RJNG 229 #define PROP_INDEX_RUNIC 230 #define PROP_INDEX_RUNR 230 #define PROP_INDEX_S 231 #define PROP_INDEX_SYMBOL 231 #define PROP_INDEX_SAMARITAN 232 #define PROP_INDEX_SAMR 232 #define PROP_INDEX_SAURASHTRA 233 #define PROP_INDEX_SAUR 233 #define PROP_INDEX_SC 234 #define PROP_INDEX_CURRENCYSYMBOL 234 #define PROP_INDEX_SENTENCETERMINAL 235 #define PROP_INDEX_STERM 235 #define PROP_INDEX_SHARADA 236 #define PROP_INDEX_SHRD 236 #define PROP_INDEX_SHAVIAN 237 #define PROP_INDEX_SHAW 237 #define PROP_INDEX_SIDDHAM 238 #define PROP_INDEX_SIDD 238 #define PROP_INDEX_SIGNWRITING 239 #define PROP_INDEX_SGNW 239 #define PROP_INDEX_SINHALA 240 #define PROP_INDEX_SINH 240 #define PROP_INDEX_SK 241 #define PROP_INDEX_MODIFIERSYMBOL 241 #define PROP_INDEX_SM 242 #define PROP_INDEX_MATHSYMBOL 242 #define PROP_INDEX_SO 243 #define PROP_INDEX_OTHERSYMBOL 243 #define PROP_INDEX_SOFTDOTTED 244 #define PROP_INDEX_SD 244 #define PROP_INDEX_SOGDIAN 245 #define PROP_INDEX_SOGD 245 #define PROP_INDEX_SORASOMPENG 246 #define PROP_INDEX_SORA 246 #define PROP_INDEX_SOYOMBO 247 #define PROP_INDEX_SOYO 247 #define PROP_INDEX_SUNDANESE 248 #define PROP_INDEX_SUND 248 #define PROP_INDEX_SUNUWAR 249 #define PROP_INDEX_SUNU 249 #define PROP_INDEX_SYLOTINAGRI 250 #define PROP_INDEX_SYLO 250 #define PROP_INDEX_SYRIAC 251 #define PROP_INDEX_SYRC 251 #define PROP_INDEX_TAGALOG 252 #define PROP_INDEX_TGLG 252 #define PROP_INDEX_TAGBANWA 253 #define PROP_INDEX_TAGB 253 #define PROP_INDEX_TAILE 254 #define PROP_INDEX_TALE 254 #define PROP_INDEX_TAITHAM 255 #define PROP_INDEX_LANA 255 #define PROP_INDEX_TAIVIET 256 #define PROP_INDEX_TAVT 256 #define PROP_INDEX_TAKRI 257 #define PROP_INDEX_TAKR 257 #define PROP_INDEX_TAMIL 258 #define PROP_INDEX_TAML 258 #define PROP_INDEX_TANGSA 259 #define PROP_INDEX_TNSA 259 #define PROP_INDEX_TANGUT 260 #define PROP_INDEX_TANG 260 #define PROP_INDEX_TELUGU 261 #define PROP_INDEX_TELU 261 #define PROP_INDEX_TERMINALPUNCTUATION 262 #define PROP_INDEX_TERM 262 #define PROP_INDEX_THAANA 263 #define PROP_INDEX_THAA 263 #define PROP_INDEX_THAI 264 #define PROP_INDEX_TIBETAN 265 #define PROP_INDEX_TIBT 265 #define PROP_INDEX_TIFINAGH 266 #define PROP_INDEX_TFNG 266 #define PROP_INDEX_TIRHUTA 267 #define PROP_INDEX_TIRH 267 #define PROP_INDEX_TODHRI 268 #define PROP_INDEX_TODR 268 #define PROP_INDEX_TOTO 269 #define PROP_INDEX_TULUTIGALARI 270 #define PROP_INDEX_TUTG 270 #define PROP_INDEX_UGARITIC 271 #define PROP_INDEX_UGAR 271 #define PROP_INDEX_UNIFIEDIDEOGRAPH 272 #define PROP_INDEX_UIDEO 272 #define PROP_INDEX_UNKNOWN 273 #define PROP_INDEX_ZZZZ 273 #define PROP_INDEX_UPPERCASE 274 #define PROP_INDEX_VAI 275 #define PROP_INDEX_VAII 275 #define PROP_INDEX_VARIATIONSELECTOR 276 #define PROP_INDEX_VS 276 #define PROP_INDEX_VITHKUQI 277 #define PROP_INDEX_VITH 277 #define PROP_INDEX_WANCHO 278 #define PROP_INDEX_WCHO 278 #define PROP_INDEX_WARANGCITI 279 #define PROP_INDEX_WARA 279 #define PROP_INDEX_WHITESPACE 280 #define PROP_INDEX_WSPACE 280 #define PROP_INDEX_XIDCONTINUE 281 #define PROP_INDEX_XIDC 281 #define PROP_INDEX_XIDSTART 282 #define PROP_INDEX_XIDS 282 #define PROP_INDEX_YEZIDI 283 #define PROP_INDEX_YEZI 283 #define PROP_INDEX_YI 284 #define PROP_INDEX_YIII 284 #define PROP_INDEX_Z 285 #define PROP_INDEX_SEPARATOR 285 #define PROP_INDEX_ZANABAZARSQUARE 286 #define PROP_INDEX_ZANB 286 #define PROP_INDEX_ZL 287 #define PROP_INDEX_LINESEPARATOR 287 #define PROP_INDEX_ZP 288 #define PROP_INDEX_PARAGRAPHSEPARATOR 288 #define PROP_INDEX_ZS 289 #define PROP_INDEX_SPACESEPARATOR 289 #define PROP_INDEX_INBASICLATIN 290 #define PROP_INDEX_INLATIN1SUPPLEMENT 291 #define PROP_INDEX_INLATINEXTENDEDA 292 #define PROP_INDEX_INLATINEXTENDEDB 293 #define PROP_INDEX_INIPAEXTENSIONS 294 #define PROP_INDEX_INSPACINGMODIFIERLETTERS 295 #define PROP_INDEX_INCOMBININGDIACRITICALMARKS 296 #define PROP_INDEX_INGREEKANDCOPTIC 297 #define PROP_INDEX_INCYRILLIC 298 #define PROP_INDEX_INCYRILLICSUPPLEMENT 299 #define PROP_INDEX_INARMENIAN 300 #define PROP_INDEX_INHEBREW 301 #define PROP_INDEX_INARABIC 302 #define PROP_INDEX_INSYRIAC 303 #define PROP_INDEX_INARABICSUPPLEMENT 304 #define PROP_INDEX_INTHAANA 305 #define PROP_INDEX_INNKO 306 #define PROP_INDEX_INSAMARITAN 307 #define PROP_INDEX_INMANDAIC 308 #define PROP_INDEX_INSYRIACSUPPLEMENT 309 #define PROP_INDEX_INARABICEXTENDEDB 310 #define PROP_INDEX_INARABICEXTENDEDA 311 #define PROP_INDEX_INDEVANAGARI 312 #define PROP_INDEX_INBENGALI 313 #define PROP_INDEX_INGURMUKHI 314 #define PROP_INDEX_INGUJARATI 315 #define PROP_INDEX_INORIYA 316 #define PROP_INDEX_INTAMIL 317 #define PROP_INDEX_INTELUGU 318 #define PROP_INDEX_INKANNADA 319 #define PROP_INDEX_INMALAYALAM 320 #define PROP_INDEX_INSINHALA 321 #define PROP_INDEX_INTHAI 322 #define PROP_INDEX_INLAO 323 #define PROP_INDEX_INTIBETAN 324 #define PROP_INDEX_INMYANMAR 325 #define PROP_INDEX_INGEORGIAN 326 #define PROP_INDEX_INHANGULJAMO 327 #define PROP_INDEX_INETHIOPIC 328 #define PROP_INDEX_INETHIOPICSUPPLEMENT 329 #define PROP_INDEX_INCHEROKEE 330 #define PROP_INDEX_INUNIFIEDCANADIANABORIGINALSYLLABICS 331 #define PROP_INDEX_INOGHAM 332 #define PROP_INDEX_INRUNIC 333 #define PROP_INDEX_INTAGALOG 334 #define PROP_INDEX_INHANUNOO 335 #define PROP_INDEX_INBUHID 336 #define PROP_INDEX_INTAGBANWA 337 #define PROP_INDEX_INKHMER 338 #define PROP_INDEX_INMONGOLIAN 339 #define PROP_INDEX_INUNIFIEDCANADIANABORIGINALSYLLABICSEXTENDED 340 #define PROP_INDEX_INLIMBU 341 #define PROP_INDEX_INTAILE 342 #define PROP_INDEX_INNEWTAILUE 343 #define PROP_INDEX_INKHMERSYMBOLS 344 #define PROP_INDEX_INBUGINESE 345 #define PROP_INDEX_INTAITHAM 346 #define PROP_INDEX_INCOMBININGDIACRITICALMARKSEXTENDED 347 #define PROP_INDEX_INBALINESE 348 #define PROP_INDEX_INSUNDANESE 349 #define PROP_INDEX_INBATAK 350 #define PROP_INDEX_INLEPCHA 351 #define PROP_INDEX_INOLCHIKI 352 #define PROP_INDEX_INCYRILLICEXTENDEDC 353 #define PROP_INDEX_INGEORGIANEXTENDED 354 #define PROP_INDEX_INSUNDANESESUPPLEMENT 355 #define PROP_INDEX_INVEDICEXTENSIONS 356 #define PROP_INDEX_INPHONETICEXTENSIONS 357 #define PROP_INDEX_INPHONETICEXTENSIONSSUPPLEMENT 358 #define PROP_INDEX_INCOMBININGDIACRITICALMARKSSUPPLEMENT 359 #define PROP_INDEX_INLATINEXTENDEDADDITIONAL 360 #define PROP_INDEX_INGREEKEXTENDED 361 #define PROP_INDEX_INGENERALPUNCTUATION 362 #define PROP_INDEX_INSUPERSCRIPTSANDSUBSCRIPTS 363 #define PROP_INDEX_INCURRENCYSYMBOLS 364 #define PROP_INDEX_INCOMBININGDIACRITICALMARKSFORSYMBOLS 365 #define PROP_INDEX_INLETTERLIKESYMBOLS 366 #define PROP_INDEX_INNUMBERFORMS 367 #define PROP_INDEX_INARROWS 368 #define PROP_INDEX_INMATHEMATICALOPERATORS 369 #define PROP_INDEX_INMISCELLANEOUSTECHNICAL 370 #define PROP_INDEX_INCONTROLPICTURES 371 #define PROP_INDEX_INOPTICALCHARACTERRECOGNITION 372 #define PROP_INDEX_INENCLOSEDALPHANUMERICS 373 #define PROP_INDEX_INBOXDRAWING 374 #define PROP_INDEX_INBLOCKELEMENTS 375 #define PROP_INDEX_INGEOMETRICSHAPES 376 #define PROP_INDEX_INMISCELLANEOUSSYMBOLS 377 #define PROP_INDEX_INDINGBATS 378 #define PROP_INDEX_INMISCELLANEOUSMATHEMATICALSYMBOLSA 379 #define PROP_INDEX_INSUPPLEMENTALARROWSA 380 #define PROP_INDEX_INBRAILLEPATTERNS 381 #define PROP_INDEX_INSUPPLEMENTALARROWSB 382 #define PROP_INDEX_INMISCELLANEOUSMATHEMATICALSYMBOLSB 383 #define PROP_INDEX_INSUPPLEMENTALMATHEMATICALOPERATORS 384 #define PROP_INDEX_INMISCELLANEOUSSYMBOLSANDARROWS 385 #define PROP_INDEX_INGLAGOLITIC 386 #define PROP_INDEX_INLATINEXTENDEDC 387 #define PROP_INDEX_INCOPTIC 388 #define PROP_INDEX_INGEORGIANSUPPLEMENT 389 #define PROP_INDEX_INTIFINAGH 390 #define PROP_INDEX_INETHIOPICEXTENDED 391 #define PROP_INDEX_INCYRILLICEXTENDEDA 392 #define PROP_INDEX_INSUPPLEMENTALPUNCTUATION 393 #define PROP_INDEX_INCJKRADICALSSUPPLEMENT 394 #define PROP_INDEX_INKANGXIRADICALS 395 #define PROP_INDEX_INIDEOGRAPHICDESCRIPTIONCHARACTERS 396 #define PROP_INDEX_INCJKSYMBOLSANDPUNCTUATION 397 #define PROP_INDEX_INHIRAGANA 398 #define PROP_INDEX_INKATAKANA 399 #define PROP_INDEX_INBOPOMOFO 400 #define PROP_INDEX_INHANGULCOMPATIBILITYJAMO 401 #define PROP_INDEX_INKANBUN 402 #define PROP_INDEX_INBOPOMOFOEXTENDED 403 #define PROP_INDEX_INCJKSTROKES 404 #define PROP_INDEX_INKATAKANAPHONETICEXTENSIONS 405 #define PROP_INDEX_INENCLOSEDCJKLETTERSANDMONTHS 406 #define PROP_INDEX_INCJKCOMPATIBILITY 407 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONA 408 #define PROP_INDEX_INYIJINGHEXAGRAMSYMBOLS 409 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHS 410 #define PROP_INDEX_INYISYLLABLES 411 #define PROP_INDEX_INYIRADICALS 412 #define PROP_INDEX_INLISU 413 #define PROP_INDEX_INVAI 414 #define PROP_INDEX_INCYRILLICEXTENDEDB 415 #define PROP_INDEX_INBAMUM 416 #define PROP_INDEX_INMODIFIERTONELETTERS 417 #define PROP_INDEX_INLATINEXTENDEDD 418 #define PROP_INDEX_INSYLOTINAGRI 419 #define PROP_INDEX_INCOMMONINDICNUMBERFORMS 420 #define PROP_INDEX_INPHAGSPA 421 #define PROP_INDEX_INSAURASHTRA 422 #define PROP_INDEX_INDEVANAGARIEXTENDED 423 #define PROP_INDEX_INKAYAHLI 424 #define PROP_INDEX_INREJANG 425 #define PROP_INDEX_INHANGULJAMOEXTENDEDA 426 #define PROP_INDEX_INJAVANESE 427 #define PROP_INDEX_INMYANMAREXTENDEDB 428 #define PROP_INDEX_INCHAM 429 #define PROP_INDEX_INMYANMAREXTENDEDA 430 #define PROP_INDEX_INTAIVIET 431 #define PROP_INDEX_INMEETEIMAYEKEXTENSIONS 432 #define PROP_INDEX_INETHIOPICEXTENDEDA 433 #define PROP_INDEX_INLATINEXTENDEDE 434 #define PROP_INDEX_INCHEROKEESUPPLEMENT 435 #define PROP_INDEX_INMEETEIMAYEK 436 #define PROP_INDEX_INHANGULSYLLABLES 437 #define PROP_INDEX_INHANGULJAMOEXTENDEDB 438 #define PROP_INDEX_INHIGHSURROGATES 439 #define PROP_INDEX_INHIGHPRIVATEUSESURROGATES 440 #define PROP_INDEX_INLOWSURROGATES 441 #define PROP_INDEX_INPRIVATEUSEAREA 442 #define PROP_INDEX_INCJKCOMPATIBILITYIDEOGRAPHS 443 #define PROP_INDEX_INALPHABETICPRESENTATIONFORMS 444 #define PROP_INDEX_INARABICPRESENTATIONFORMSA 445 #define PROP_INDEX_INVARIATIONSELECTORS 446 #define PROP_INDEX_INVERTICALFORMS 447 #define PROP_INDEX_INCOMBININGHALFMARKS 448 #define PROP_INDEX_INCJKCOMPATIBILITYFORMS 449 #define PROP_INDEX_INSMALLFORMVARIANTS 450 #define PROP_INDEX_INARABICPRESENTATIONFORMSB 451 #define PROP_INDEX_INHALFWIDTHANDFULLWIDTHFORMS 452 #define PROP_INDEX_INSPECIALS 453 #define PROP_INDEX_INLINEARBSYLLABARY 454 #define PROP_INDEX_INLINEARBIDEOGRAMS 455 #define PROP_INDEX_INAEGEANNUMBERS 456 #define PROP_INDEX_INANCIENTGREEKNUMBERS 457 #define PROP_INDEX_INANCIENTSYMBOLS 458 #define PROP_INDEX_INPHAISTOSDISC 459 #define PROP_INDEX_INLYCIAN 460 #define PROP_INDEX_INCARIAN 461 #define PROP_INDEX_INCOPTICEPACTNUMBERS 462 #define PROP_INDEX_INOLDITALIC 463 #define PROP_INDEX_INGOTHIC 464 #define PROP_INDEX_INOLDPERMIC 465 #define PROP_INDEX_INUGARITIC 466 #define PROP_INDEX_INOLDPERSIAN 467 #define PROP_INDEX_INDESERET 468 #define PROP_INDEX_INSHAVIAN 469 #define PROP_INDEX_INOSMANYA 470 #define PROP_INDEX_INOSAGE 471 #define PROP_INDEX_INELBASAN 472 #define PROP_INDEX_INCAUCASIANALBANIAN 473 #define PROP_INDEX_INVITHKUQI 474 #define PROP_INDEX_INTODHRI 475 #define PROP_INDEX_INLINEARA 476 #define PROP_INDEX_INLATINEXTENDEDF 477 #define PROP_INDEX_INCYPRIOTSYLLABARY 478 #define PROP_INDEX_INIMPERIALARAMAIC 479 #define PROP_INDEX_INPALMYRENE 480 #define PROP_INDEX_INNABATAEAN 481 #define PROP_INDEX_INHATRAN 482 #define PROP_INDEX_INPHOENICIAN 483 #define PROP_INDEX_INLYDIAN 484 #define PROP_INDEX_INMEROITICHIEROGLYPHS 485 #define PROP_INDEX_INMEROITICCURSIVE 486 #define PROP_INDEX_INKHAROSHTHI 487 #define PROP_INDEX_INOLDSOUTHARABIAN 488 #define PROP_INDEX_INOLDNORTHARABIAN 489 #define PROP_INDEX_INMANICHAEAN 490 #define PROP_INDEX_INAVESTAN 491 #define PROP_INDEX_ININSCRIPTIONALPARTHIAN 492 #define PROP_INDEX_ININSCRIPTIONALPAHLAVI 493 #define PROP_INDEX_INPSALTERPAHLAVI 494 #define PROP_INDEX_INOLDTURKIC 495 #define PROP_INDEX_INOLDHUNGARIAN 496 #define PROP_INDEX_INHANIFIROHINGYA 497 #define PROP_INDEX_INGARAY 498 #define PROP_INDEX_INRUMINUMERALSYMBOLS 499 #define PROP_INDEX_INYEZIDI 500 #define PROP_INDEX_INARABICEXTENDEDC 501 #define PROP_INDEX_INOLDSOGDIAN 502 #define PROP_INDEX_INSOGDIAN 503 #define PROP_INDEX_INOLDUYGHUR 504 #define PROP_INDEX_INCHORASMIAN 505 #define PROP_INDEX_INELYMAIC 506 #define PROP_INDEX_INBRAHMI 507 #define PROP_INDEX_INKAITHI 508 #define PROP_INDEX_INSORASOMPENG 509 #define PROP_INDEX_INCHAKMA 510 #define PROP_INDEX_INMAHAJANI 511 #define PROP_INDEX_INSHARADA 512 #define PROP_INDEX_INSINHALAARCHAICNUMBERS 513 #define PROP_INDEX_INKHOJKI 514 #define PROP_INDEX_INMULTANI 515 #define PROP_INDEX_INKHUDAWADI 516 #define PROP_INDEX_INGRANTHA 517 #define PROP_INDEX_INTULUTIGALARI 518 #define PROP_INDEX_INNEWA 519 #define PROP_INDEX_INTIRHUTA 520 #define PROP_INDEX_INSIDDHAM 521 #define PROP_INDEX_INMODI 522 #define PROP_INDEX_INMONGOLIANSUPPLEMENT 523 #define PROP_INDEX_INTAKRI 524 #define PROP_INDEX_INMYANMAREXTENDEDC 525 #define PROP_INDEX_INAHOM 526 #define PROP_INDEX_INDOGRA 527 #define PROP_INDEX_INWARANGCITI 528 #define PROP_INDEX_INDIVESAKURU 529 #define PROP_INDEX_INNANDINAGARI 530 #define PROP_INDEX_INZANABAZARSQUARE 531 #define PROP_INDEX_INSOYOMBO 532 #define PROP_INDEX_INUNIFIEDCANADIANABORIGINALSYLLABICSEXTENDEDA 533 #define PROP_INDEX_INPAUCINHAU 534 #define PROP_INDEX_INDEVANAGARIEXTENDEDA 535 #define PROP_INDEX_INSUNUWAR 536 #define PROP_INDEX_INBHAIKSUKI 537 #define PROP_INDEX_INMARCHEN 538 #define PROP_INDEX_INMASARAMGONDI 539 #define PROP_INDEX_INGUNJALAGONDI 540 #define PROP_INDEX_INMAKASAR 541 #define PROP_INDEX_INKAWI 542 #define PROP_INDEX_INLISUSUPPLEMENT 543 #define PROP_INDEX_INTAMILSUPPLEMENT 544 #define PROP_INDEX_INCUNEIFORM 545 #define PROP_INDEX_INCUNEIFORMNUMBERSANDPUNCTUATION 546 #define PROP_INDEX_INEARLYDYNASTICCUNEIFORM 547 #define PROP_INDEX_INCYPROMINOAN 548 #define PROP_INDEX_INEGYPTIANHIEROGLYPHS 549 #define PROP_INDEX_INEGYPTIANHIEROGLYPHFORMATCONTROLS 550 #define PROP_INDEX_INEGYPTIANHIEROGLYPHSEXTENDEDA 551 #define PROP_INDEX_INANATOLIANHIEROGLYPHS 552 #define PROP_INDEX_INGURUNGKHEMA 553 #define PROP_INDEX_INBAMUMSUPPLEMENT 554 #define PROP_INDEX_INMRO 555 #define PROP_INDEX_INTANGSA 556 #define PROP_INDEX_INBASSAVAH 557 #define PROP_INDEX_INPAHAWHHMONG 558 #define PROP_INDEX_INKIRATRAI 559 #define PROP_INDEX_INMEDEFAIDRIN 560 #define PROP_INDEX_INMIAO 561 #define PROP_INDEX_INIDEOGRAPHICSYMBOLSANDPUNCTUATION 562 #define PROP_INDEX_INTANGUT 563 #define PROP_INDEX_INTANGUTCOMPONENTS 564 #define PROP_INDEX_INKHITANSMALLSCRIPT 565 #define PROP_INDEX_INTANGUTSUPPLEMENT 566 #define PROP_INDEX_INKANAEXTENDEDB 567 #define PROP_INDEX_INKANASUPPLEMENT 568 #define PROP_INDEX_INKANAEXTENDEDA 569 #define PROP_INDEX_INSMALLKANAEXTENSION 570 #define PROP_INDEX_INNUSHU 571 #define PROP_INDEX_INDUPLOYAN 572 #define PROP_INDEX_INSHORTHANDFORMATCONTROLS 573 #define PROP_INDEX_INSYMBOLSFORLEGACYCOMPUTINGSUPPLEMENT 574 #define PROP_INDEX_INZNAMENNYMUSICALNOTATION 575 #define PROP_INDEX_INBYZANTINEMUSICALSYMBOLS 576 #define PROP_INDEX_INMUSICALSYMBOLS 577 #define PROP_INDEX_INANCIENTGREEKMUSICALNOTATION 578 #define PROP_INDEX_INKAKTOVIKNUMERALS 579 #define PROP_INDEX_INMAYANNUMERALS 580 #define PROP_INDEX_INTAIXUANJINGSYMBOLS 581 #define PROP_INDEX_INCOUNTINGRODNUMERALS 582 #define PROP_INDEX_INMATHEMATICALALPHANUMERICSYMBOLS 583 #define PROP_INDEX_INSUTTONSIGNWRITING 584 #define PROP_INDEX_INLATINEXTENDEDG 585 #define PROP_INDEX_INGLAGOLITICSUPPLEMENT 586 #define PROP_INDEX_INCYRILLICEXTENDEDD 587 #define PROP_INDEX_INNYIAKENGPUACHUEHMONG 588 #define PROP_INDEX_INTOTO 589 #define PROP_INDEX_INWANCHO 590 #define PROP_INDEX_INNAGMUNDARI 591 #define PROP_INDEX_INOLONAL 592 #define PROP_INDEX_INETHIOPICEXTENDEDB 593 #define PROP_INDEX_INMENDEKIKAKUI 594 #define PROP_INDEX_INADLAM 595 #define PROP_INDEX_ININDICSIYAQNUMBERS 596 #define PROP_INDEX_INOTTOMANSIYAQNUMBERS 597 #define PROP_INDEX_INARABICMATHEMATICALALPHABETICSYMBOLS 598 #define PROP_INDEX_INMAHJONGTILES 599 #define PROP_INDEX_INDOMINOTILES 600 #define PROP_INDEX_INPLAYINGCARDS 601 #define PROP_INDEX_INENCLOSEDALPHANUMERICSUPPLEMENT 602 #define PROP_INDEX_INENCLOSEDIDEOGRAPHICSUPPLEMENT 603 #define PROP_INDEX_INMISCELLANEOUSSYMBOLSANDPICTOGRAPHS 604 #define PROP_INDEX_INEMOTICONS 605 #define PROP_INDEX_INORNAMENTALDINGBATS 606 #define PROP_INDEX_INTRANSPORTANDMAPSYMBOLS 607 #define PROP_INDEX_INALCHEMICALSYMBOLS 608 #define PROP_INDEX_INGEOMETRICSHAPESEXTENDED 609 #define PROP_INDEX_INSUPPLEMENTALARROWSC 610 #define PROP_INDEX_INSUPPLEMENTALSYMBOLSANDPICTOGRAPHS 611 #define PROP_INDEX_INCHESSSYMBOLS 612 #define PROP_INDEX_INSYMBOLSANDPICTOGRAPHSEXTENDEDA 613 #define PROP_INDEX_INSYMBOLSFORLEGACYCOMPUTING 614 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONB 615 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONC 616 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIOND 617 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONE 618 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONF 619 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONI 620 #define PROP_INDEX_INCJKCOMPATIBILITYIDEOGRAPHSSUPPLEMENT 621 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONG 622 #define PROP_INDEX_INCJKUNIFIEDIDEOGRAPHSEXTENSIONH 623 #define PROP_INDEX_INTAGS 624 #define PROP_INDEX_INVARIATIONSELECTORSSUPPLEMENT 625 #define PROP_INDEX_INSUPPLEMENTARYPRIVATEUSEAREAA 626 #define PROP_INDEX_INSUPPLEMENTARYPRIVATEUSEAREAB 627 #define PROP_INDEX_INNOBLOCK 628 jq-1.8.2/vendor/oniguruma/src/koi8_r.c0000644000175100017510000002064615215513537013267 /********************************************************************** koi8_r.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_KOI8_R_TO_LOWER_CASE(c) EncKOI8_R_ToLowerCaseTable[c] #define ENC_IS_KOI8_R_CTYPE(code,ctype) \ ((EncKOI8_R_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncKOI8_R_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\243', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337' }; static const unsigned short EncKOI8_R_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0284, 0x00a0, 0x00a0, 0x10a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2 }; static int koi8_r_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_KOI8_R_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int koi8_r_is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_KOI8_R_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa3, 0xb3 }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe }, { 0xdf, 0xff } }; static int koi8_r_apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, f, arg); } static int koi8_r_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, p, end, items); } OnigEncodingType OnigEncodingKOI8_R = { onigenc_single_byte_mbc_enc_len, "KOI8-R", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, koi8_r_mbc_case_fold, koi8_r_apply_all_case_fold, koi8_r_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, koi8_r_is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/iso8859_3.c0000644000175100017510000002102715215513537013440 /********************************************************************** iso8859_3.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_3_TO_LOWER_CASE(c) EncISO_8859_3_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_3_CTYPE(code,ctype) \ ((EncISO_8859_3_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_3_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\261', '\242', '\243', '\244', '\245', '\266', '\247', '\250', '\271', '\272', '\273', '\274', '\255', '\256', '\277', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\340', '\341', '\342', '\303', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\320', '\361', '\362', '\363', '\364', '\365', '\366', '\327', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_3_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x0000, 0x34a2, 0x00a0, 0x30e2, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x30e2, 0x01a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x11a0, 0x0000, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x0000, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x0000, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0000, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0000, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_3_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_3_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa1, 0xb1 }, { 0xa6, 0xb6 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xaf, 0xbf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_3 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-3", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/euc_tw.c0000644000175100017510000001311415215513537013352 /********************************************************************** euc_tw.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" static const int EncLen_EUCTW[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; static int euctw_mbc_enc_len(const UChar* p) { return EncLen_EUCTW[*p]; } static int euctw_code_to_mbclen(OnigCodePoint code) { if ((code & 0xff000000) != 0) { if (EncLen_EUCTW[(int )(code >> 24) & 0xff] == 4) return 4; } else if ((code & 0xff0000) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE; else if ((code & 0xff00) != 0) { if (EncLen_EUCTW[(int )(code >> 8) & 0xff] == 2) return 2; } else { if (EncLen_EUCTW[(int )(code & 0xff)] == 1) return 1; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { while (p < end) { if (*p < 0x80) { p++; } else if (*p < 0xa1) { if (*p == 0x8e) { p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p > 0xb0) return FALSE; p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p == 0xff) return FALSE; p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p == 0xff) return FALSE; p++; } else return FALSE; } else if (*p < 0xff) { p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p == 0xff) return FALSE; p++; } else return FALSE; } return TRUE; } static OnigCodePoint euctw_mbc_to_code(const UChar* p, const UChar* end) { return onigenc_mbn_mbc_to_code(ONIG_ENCODING_EUC_TW, p, end); } static int euctw_code_to_mbc(OnigCodePoint code, UChar *buf) { return onigenc_mb4_code_to_mbc(ONIG_ENCODING_EUC_TW, code, buf); } static int euctw_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* lower) { return onigenc_mbn_mbc_case_fold(ONIG_ENCODING_EUC_TW, flag, pp, end, lower); } static int euctw_is_code_ctype(OnigCodePoint code, unsigned int ctype) { return onigenc_mb4_is_code_ctype(ONIG_ENCODING_EUC_TW, code, ctype); } #define euctw_islead(c) ((UChar )((c) - 0xa1) > 0xfe - 0xa1) static UChar* euctw_left_adjust_char_head(const UChar* start, const UChar* s) { /* Assumed in this encoding, mb-trail bytes don't mix with single bytes. */ const UChar *p; int len; if (s <= start) return (UChar* )s; p = s; while (!euctw_islead(*p) && p > start) p--; len = enclen(ONIG_ENCODING_EUC_TW, p); if (p + len > s) return (UChar* )p; p += len; return (UChar* )(p + ((s - p) & ~1)); } static int euctw_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED) { const UChar c = *s; if (c <= 0x7e) return TRUE; else return FALSE; } OnigEncodingType OnigEncodingEUC_TW = { euctw_mbc_enc_len, "EUC-TW", /* name */ 4, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, euctw_mbc_to_code, euctw_code_to_mbclen, euctw_code_to_mbc, euctw_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, euctw_is_code_ctype, onigenc_not_support_get_ctype_code_range, euctw_left_adjust_char_head, euctw_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/unicode_unfold_key.c0000644000175100017510000016711115215513537015740 /* This file was converted by gperf_unfold_key_conv.py from gperf output file. */ /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1,0 -N onigenc_unicode_unfold_key unicode_unfold_key.gperf */ /* Computed positions: -k'1-3' */ /* This gperf source file was generated by make_unicode_fold_data.py */ /*- * Copyright (c) 2017-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #define TOTAL_KEYWORDS 1557 #define MIN_WORD_LENGTH 3 #define MAX_WORD_LENGTH 3 #define MIN_HASH_VALUE 8 #define MAX_HASH_VALUE 2248 /* maximum key range = 2241, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif /*ARGSUSED*/ static unsigned int hash(OnigCodePoint codes[]) { static const unsigned short asso_values[] = { 9, 7, 4, 52, 130, 1, 169, 2249, 2249, 2249, 2249, 2249, 2249, 21, 155, 2249, 2249, 78, 2249, 2249, 100, 2249, 2249, 2249, 2249, 84, 2249, 2249, 2249, 8, 2249, 2, 3, 2249, 834, 718, 1614, 141, 1598, 712, 1570, 694, 1668, 706, 1606, 0, 1593, 680, 1584, 651, 1579, 1006, 1665, 1000, 1560, 688, 1553, 410, 1539, 645, 1545, 639, 1530, 633, 269, 988, 1662, 966, 1122, 817, 1647, 751, 994, 743, 379, 789, 1657, 261, 959, 783, 1651, 771, 599, 826, 381, 1151, 286, 1521, 206, 1516, 68, 1511, 915, 1431, 1607, 1640, 697, 671, 1531, 1507, 1434, 1420, 1367, 1257, 1387, 1243, 717, 920, 1125, 613, 1363, 331, 178, 909, 774, 843, 1451, 829, 1422, 822, 1026, 724, 510, 1239, 754, 1222, 1324, 1413, 1072, 1409, 764, 949, 316, 473, 384, 27, 169, 1405, 63, 1206, 888, 1197, 879, 1189, 873, 386, 371, 1161, 903, 1139, 807, 347, 613, 1398, 272, 197, 1633, 1449, 279, 1180, 1, 1383, 286, 510, 1374, 490, 228, 15, 5, 398, 1130, 595, 6, 464, 363, 574, 566, 457, 1228, 35, 1112, 357, 1357, 324, 1330, 240, 158, 220, 1348, 432, 1340, 548, 1326, 539, 1318, 97, 1106, 127, 1105, 85, 1098, 76, 902, 211, 500, 189, 848, 118, 760, 106, 1088, 151, 866, 56, 895, 419, 584, 315, 856, 66, 1048, 303, 1290, 295, 1275, 274, 1257, 805, 657, 443, 1312, 531, 1081, 1074, 253, 1065, 1311, 482, 1056, 561, 1301, 1508, 1433, 1043, 1520, 1285, 929, 1634, 392, 1034, 183, 1022, 42, 1014, 246, 1275, 26, 1266, 76, 1502, 2249, 604, 70, 1497, 2249, 1491, 50, 1487, 41, 1478, 342, 1471, 26, 1251, 2249, 666, 88, 1465, 19, 1460, 46, 1627, 44, 1621, 207, 1443, 13, 1096, 17, 427, 9 }; return asso_values[(unsigned char)onig_codes_byte_at(codes, 2)+35] + asso_values[(unsigned char)onig_codes_byte_at(codes, 1)+1] + asso_values[(unsigned char)onig_codes_byte_at(codes, 0)]; } const struct ByUnfoldKey * onigenc_unicode_unfold_key(OnigCodePoint code) { static const struct ByUnfoldKey wordlist[] = { {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1040a, 3480, 1}, {0x2c0a, 2615, 1}, {0x040a, 1035, 1}, {0x1e0a, 1891, 1}, {0x1f0a, 2252, 1}, {0x010a, 186, 1}, {0x017d, 351, 1}, {0xa77d, 1867, 1}, {0xab7d, 1645, 1}, {0x1f85, 154, 2}, {0x1f89, 134, 2}, {0x0189, 622, 1}, {0xab85, 1669, 1}, {0xab89, 1681, 1}, {0x1c85, 960, 1}, {0x1c89, 1864, 1}, {0x2c84, 2759, 1}, {0x1ffb, 2429, 1}, {0x1e84, 2075, 1}, {0x1f84, 149, 2}, {0x0184, 360, 1}, {0xa784, 3273, 1}, {0xab84, 1666, 1}, {0x1ff3, 96, 2}, {0x1c84, 960, 1}, {0x10c85, 3798, 1}, {0x10c89, 3810, 1}, {0x2ced, 2906, 1}, {0x2c64, 682, 1}, {0x0464, 1060, 1}, {0x1e64, 2027, 1}, {0xa684, 3108, 1}, {0x0164, 315, 1}, {0xa764, 3240, 1}, {0x00dd, 162, 1}, {0x10c84, 3795, 1}, {0x2c90, 2777, 1}, {0x0490, 1114, 1}, {0x1e90, 2093, 1}, {0x1f90, 169, 2}, {0x0190, 631, 1}, {0xa790, 3282, 1}, {0xab90, 1702, 1}, {0xa664, 3087, 1}, {0x1c90, 1468, 1}, {0x1fe9, 2447, 1}, {0x1fd9, 2441, 1}, {0x01d9, 450, 1}, {0x1ff7, 67, 3}, {0x01f7, 417, 1}, {0x00d9, 150, 1}, {0xa690, 3126, 1}, {0xa7f5, 3366, 1}, {0x020a, 520, 1}, {0x1fe7, 47, 3}, {0x10c90, 3831, 1}, {0x104b2, 3576, 1}, {0x2cb2, 2828, 1}, {0x04b2, 1165, 1}, {0x1eb2, 2129, 1}, {0x1fb2, 249, 2}, {0x01b2, 706, 1}, {0xa7b2, 715, 1}, {0xabb2, 1804, 1}, {0x2c67, 2738, 1}, {0x1cb2, 1570, 1}, {0x104b8, 3594, 1}, {0x2cb8, 2837, 1}, {0x04b8, 1174, 1}, {0x1eb8, 2138, 1}, {0x1fb8, 2432, 1}, {0x01b8, 411, 1}, {0xa7b8, 3327, 1}, {0xabb8, 1822, 1}, {0x1fe3, 41, 3}, {0x1cb8, 1588, 1}, {0x10cb2, 3933, 1}, {0x2ca6, 2810, 1}, {0x04a6, 1147, 1}, {0x1ea6, 2111, 1}, {0x1fa6, 239, 2}, {0x01a6, 685, 1}, {0xa7a6, 3315, 1}, {0xaba6, 1768, 1}, {0x00df, 24, 2}, {0x1ca6, 1534, 1}, {0x2ca4, 2807, 1}, {0x04a4, 1144, 1}, {0x1ea4, 2108, 1}, {0x1fa4, 229, 2}, {0x01a4, 393, 1}, {0xa7a4, 3312, 1}, {0xaba4, 1762, 1}, {0x01f1, 486, 1}, {0x1ca4, 1528, 1}, {0xff37, 3438, 1}, {0x10ca6, 3897, 1}, {0xffffffff, -1, 0}, {0x2ca0, 2801, 1}, {0x04a0, 1138, 1}, {0x1ea0, 2102, 1}, {0x1fa0, 209, 2}, {0x01a0, 387, 1}, {0xa7a0, 3306, 1}, {0xaba0, 1750, 1}, {0x10ca4, 3891, 1}, {0x1ca0, 1516, 1}, {0x2cae, 2822, 1}, {0x04ae, 1159, 1}, {0x1eae, 2123, 1}, {0x1fae, 239, 2}, {0x01ae, 697, 1}, {0xa7ae, 661, 1}, {0xabae, 1792, 1}, {0x13fb, 1855, 1}, {0x1cae, 1558, 1}, {0xffffffff, -1, 0}, {0x10ca0, 3879, 1}, {0x13fd, 1861, 1}, {0x2cac, 2819, 1}, {0x04ac, 1156, 1}, {0x1eac, 2120, 1}, {0x1fac, 229, 2}, {0x01ac, 399, 1}, {0xa7ac, 640, 1}, {0xabac, 1786, 1}, {0x10cae, 3921, 1}, {0x1cac, 1552, 1}, {0x2ca2, 2804, 1}, {0x04a2, 1141, 1}, {0x1ea2, 2105, 1}, {0x1fa2, 219, 2}, {0x01a2, 390, 1}, {0xa7a2, 3309, 1}, {0xaba2, 1756, 1}, {0x10b2, 2966, 1}, {0x1ca2, 1522, 1}, {0x0389, 745, 1}, {0x10cac, 3915, 1}, {0x118b2, 4056, 1}, {0x03ff, 736, 1}, {0x10402, 3456, 1}, {0x2c02, 2591, 1}, {0x0402, 1011, 1}, {0x1e02, 1879, 1}, {0x10b8, 2984, 1}, {0x0102, 174, 1}, {0x10ca2, 3885, 1}, {0x03fd, 730, 1}, {0x118b8, 4074, 1}, {0xffffffff, -1, 0}, {0x104b0, 3570, 1}, {0x2cb0, 2825, 1}, {0x04b0, 1162, 1}, {0x1eb0, 2126, 1}, {0x10a6, 2930, 1}, {0xffffffff, -1, 0}, {0xa7b0, 718, 1}, {0xabb0, 1798, 1}, {0x118a6, 4020, 1}, {0x1cb0, 1564, 1}, {0x1e97, 34, 2}, {0x1f97, 204, 2}, {0x0197, 655, 1}, {0x10a4, 2924, 1}, {0xab97, 1723, 1}, {0x0390, 25, 3}, {0x1c97, 1489, 1}, {0x118a4, 4014, 1}, {0x1057d, 3714, 1}, {0x050a, 1297, 1}, {0x10cb0, 3927, 1}, {0xffffffff, -1, 0}, {0x10585, 3738, 1}, {0x10589, 3750, 1}, {0x03f7, 896, 1}, {0x10a0, 2912, 1}, {0x03f5, 764, 1}, {0x10c97, 3852, 1}, {0xffffffff, -1, 0}, {0x118a0, 4002, 1}, {0x10d64, 3996, 1}, {0x1f4d, 2351, 1}, {0x10584, 3735, 1}, {0xfb02, 12, 2}, {0x10ae, 2954, 1}, {0x004d, 34, 1}, {0x1fd7, 31, 3}, {0x01d7, 447, 1}, {0x118ae, 4044, 1}, {0x2caa, 2816, 1}, {0x04aa, 1153, 1}, {0x1eaa, 2117, 1}, {0x1faa, 219, 2}, {0x0202, 508, 1}, {0xa7aa, 652, 1}, {0xabaa, 1780, 1}, {0x10ac, 2948, 1}, {0x1caa, 1546, 1}, {0x0478, 1090, 1}, {0x1e78, 2057, 1}, {0x118ac, 4038, 1}, {0x0178, 168, 1}, {0x10590, 3768, 1}, {0xab78, 1630, 1}, {0xffffffff, -1, 0}, {0x10a2, 2918, 1}, {0x03a6, 822, 1}, {0x24b8, 2513, 1}, {0x10caa, 3909, 1}, {0x118a2, 4008, 1}, {0x1ff9, 2417, 1}, {0x2ca8, 2813, 1}, {0x04a8, 1150, 1}, {0x1ea8, 2114, 1}, {0x1fa8, 209, 2}, {0x03a4, 816, 1}, {0xa7a8, 3318, 1}, {0xaba8, 1774, 1}, {0x03f1, 808, 1}, {0x1ca8, 1540, 1}, {0x2c98, 2789, 1}, {0x0498, 1126, 1}, {0x1e98, 38, 2}, {0x1f98, 169, 2}, {0x0198, 375, 1}, {0xa798, 3294, 1}, {0xab98, 1726, 1}, {0x03a0, 804, 1}, {0x1c98, 1492, 1}, {0x10b0, 2960, 1}, {0x10ca8, 3903, 1}, {0x1f83, 144, 2}, {0xff35, 3432, 1}, {0x118b0, 4050, 1}, {0xab83, 1663, 1}, {0xa698, 3138, 1}, {0x1c83, 956, 1}, {0x0537, 1372, 1}, {0xffffffff, -1, 0}, {0x10c98, 3855, 1}, {0x2c96, 2786, 1}, {0x0496, 1123, 1}, {0x1e96, 16, 2}, {0x1f96, 199, 2}, {0x0196, 658, 1}, {0xa796, 3291, 1}, {0xab96, 1720, 1}, {0x10c83, 3792, 1}, {0x1c96, 1486, 1}, {0x1fdb, 2411, 1}, {0x01db, 453, 1}, {0x1e90a, 4224, 1}, {0x104c7, 3639, 1}, {0x00db, 156, 1}, {0x04c7, 1195, 1}, {0xa696, 3135, 1}, {0x1fc7, 15, 3}, {0x01c7, 424, 1}, {0xa7c7, 3345, 1}, {0x10c96, 3849, 1}, {0x00c7, 99, 1}, {0x2c2a, 2711, 1}, {0x042a, 986, 1}, {0x1e2a, 1939, 1}, {0x1f2a, 2294, 1}, {0x012a, 234, 1}, {0xa72a, 3156, 1}, {0x10aa, 2942, 1}, {0x1041d, 3537, 1}, {0x2c1d, 2672, 1}, {0x041d, 943, 1}, {0x118aa, 4032, 1}, {0x1f1d, 2285, 1}, {0x104be, 3612, 1}, {0x2cbe, 2846, 1}, {0x04be, 1183, 1}, {0x1ebe, 2147, 1}, {0x1fbe, 779, 1}, {0xab77, 1627, 1}, {0xa7be, 3336, 1}, {0xabbe, 1840, 1}, {0x03b0, 41, 3}, {0x1cbe, 1600, 1}, {0x017b, 348, 1}, {0xa77b, 3261, 1}, {0xab7b, 1639, 1}, {0x2c7f, 586, 1}, {0xff2a, 3399, 1}, {0x0397, 771, 1}, {0x10a8, 2936, 1}, {0x017f, 52, 1}, {0xffffffff, -1, 0}, {0xab7f, 1651, 1}, {0x118a8, 4026, 1}, {0x104bc, 3606, 1}, {0x2cbc, 2843, 1}, {0x04bc, 1180, 1}, {0x1ebc, 2144, 1}, {0x1fbc, 62, 2}, {0x01bc, 414, 1}, {0xa7bc, 3333, 1}, {0xabbc, 1834, 1}, {0x104ba, 3600, 1}, {0x2cba, 2840, 1}, {0x04ba, 1177, 1}, {0x1eba, 2141, 1}, {0x1fba, 2390, 1}, {0x13f9, 1849, 1}, {0xa7ba, 3330, 1}, {0xabba, 1828, 1}, {0x0502, 1285, 1}, {0x1cba, 1594, 1}, {0xff33, 3426, 1}, {0x022a, 565, 1}, {0x104b6, 3588, 1}, {0x2cb6, 2834, 1}, {0x04b6, 1171, 1}, {0x1eb6, 2135, 1}, {0x1fb6, 58, 2}, {0x03aa, 836, 1}, {0xa7b6, 3324, 1}, {0xabb6, 1816, 1}, {0x10d65, 3999, 1}, {0x1cb6, 1582, 1}, {0x2c94, 2783, 1}, {0x0494, 1120, 1}, {0x1e94, 2099, 1}, {0x1f94, 189, 2}, {0x0194, 643, 1}, {0xffffffff, -1, 0}, {0xab94, 1714, 1}, {0x10c7, 3026, 1}, {0x1c94, 1480, 1}, {0x1e4c, 1990, 1}, {0x1f4c, 2348, 1}, {0x014c, 279, 1}, {0xa74c, 3204, 1}, {0x03f9, 890, 1}, {0x004c, 31, 1}, {0xa694, 3132, 1}, {0xffffffff, -1, 0}, {0x03a8, 829, 1}, {0x2ceb, 2903, 1}, {0x10c94, 3843, 1}, {0xffffffff, -1, 0}, {0x1feb, 2423, 1}, {0xa64c, 3051, 1}, {0x054d, 1438, 1}, {0x0474, 1084, 1}, {0x1e74, 2051, 1}, {0x0398, 774, 1}, {0x0174, 339, 1}, {0x10be, 3002, 1}, {0xab74, 1618, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x118be, 4092, 1}, {0x2c92, 2780, 1}, {0x0492, 1117, 1}, {0x1e92, 2096, 1}, {0x1f92, 179, 2}, {0xffffffff, -1, 0}, {0xa792, 3285, 1}, {0xab92, 1708, 1}, {0x10578, 3702, 1}, {0x1c92, 1474, 1}, {0x1f8b, 144, 2}, {0x018b, 366, 1}, {0xa78b, 3279, 1}, {0xab8b, 1687, 1}, {0x0396, 768, 1}, {0x2c6f, 607, 1}, {0xa692, 3129, 1}, {0x10bc, 2996, 1}, {0x1f6f, 2387, 1}, {0x0535, 1366, 1}, {0x10c92, 3837, 1}, {0x118bc, 4086, 1}, {0x10427, 3567, 1}, {0x2c27, 2702, 1}, {0x0427, 977, 1}, {0x10ba, 2990, 1}, {0x10c8b, 3816, 1}, {0x024c, 601, 1}, {0x2c63, 1870, 1}, {0x118ba, 4080, 1}, {0x2c6e, 673, 1}, {0x046e, 1075, 1}, {0x1e6e, 2042, 1}, {0x1f6e, 2384, 1}, {0x016e, 330, 1}, {0xa76e, 3255, 1}, {0x1e902, 4200, 1}, {0x10b6, 2978, 1}, {0x24c7, 2558, 1}, {0x10583, 3732, 1}, {0x01d5, 444, 1}, {0x118b6, 4068, 1}, {0x2c86, 2762, 1}, {0x00d5, 141, 1}, {0x1e86, 2078, 1}, {0x1f86, 159, 2}, {0x0186, 619, 1}, {0xa786, 3276, 1}, {0xab86, 1672, 1}, {0xff27, 3390, 1}, {0x1c86, 986, 1}, {0xff31, 3420, 1}, {0xffffffff, -1, 0}, {0x10416, 3516, 1}, {0x2c16, 2651, 1}, {0x0416, 922, 1}, {0x1e16, 1909, 1}, {0xa686, 3111, 1}, {0x0116, 204, 1}, {0x24be, 2531, 1}, {0x037f, 893, 1}, {0x10c86, 3801, 1}, {0x104b4, 3582, 1}, {0x2cb4, 2831, 1}, {0x04b4, 1168, 1}, {0x1eb4, 2132, 1}, {0x1fb4, 50, 2}, {0xffffffff, -1, 0}, {0xa7b4, 3321, 1}, {0xabb4, 1810, 1}, {0xffffffff, -1, 0}, {0x1cb4, 1576, 1}, {0x04fe, 1279, 1}, {0x1efe, 2243, 1}, {0x052a, 1345, 1}, {0x01fe, 502, 1}, {0x2c9a, 2792, 1}, {0x049a, 1129, 1}, {0x1e9a, 0, 2}, {0x1f9a, 179, 2}, {0x24bc, 2525, 1}, {0xa79a, 3297, 1}, {0xab9a, 1732, 1}, {0x10577, 3699, 1}, {0x1c9a, 1498, 1}, {0xffffffff, -1, 0}, {0x104c2, 3624, 1}, {0x2cc2, 2852, 1}, {0x24ba, 2519, 1}, {0x1ec2, 2153, 1}, {0x1fc2, 253, 2}, {0xa69a, 3141, 1}, {0xa7c2, 3342, 1}, {0xffffffff, -1, 0}, {0x00c2, 83, 1}, {0x10c9a, 3861, 1}, {0xfb16, 125, 2}, {0x1057f, 3720, 1}, {0x0394, 761, 1}, {0x0533, 1360, 1}, {0x24b6, 2507, 1}, {0x2c8e, 2774, 1}, {0x048e, 1111, 1}, {0x1e8e, 2090, 1}, {0x1f8e, 159, 2}, {0x018e, 456, 1}, {0x0216, 538, 1}, {0xab8e, 1696, 1}, {0x2c8a, 2768, 1}, {0x048a, 1105, 1}, {0x1e8a, 2084, 1}, {0x1f8a, 139, 2}, {0x018a, 625, 1}, {0x10d61, 3987, 1}, {0xab8a, 1684, 1}, {0xffffffff, -1, 0}, {0xa68e, 3123, 1}, {0x2c62, 664, 1}, {0x0462, 1056, 1}, {0x1e62, 2024, 1}, {0x10c8e, 3825, 1}, {0x0162, 312, 1}, {0xa762, 3237, 1}, {0xa68a, 3117, 1}, {0xffffffff, -1, 0}, {0x104ca, 3648, 1}, {0x2cca, 2864, 1}, {0x10c8a, 3813, 1}, {0x1eca, 2165, 1}, {0x1fca, 2402, 1}, {0x01ca, 428, 1}, {0x0392, 754, 1}, {0xa662, 3084, 1}, {0x00ca, 108, 1}, {0x2c82, 2756, 1}, {0x10594, 3777, 1}, {0x1e82, 2072, 1}, {0x1f82, 139, 2}, {0x0182, 357, 1}, {0xa782, 3270, 1}, {0xab82, 1660, 1}, {0x10b4, 2972, 1}, {0x1c82, 946, 1}, {0xffffffff, -1, 0}, {0x054c, 1435, 1}, {0x118b4, 4062, 1}, {0xffffffff, -1, 0}, {0x1fa9, 214, 2}, {0x01a9, 691, 1}, {0xa682, 3105, 1}, {0xaba9, 1777, 1}, {0x16e4d, 4137, 1}, {0x1ca9, 1543, 1}, {0x10c82, 3789, 1}, {0x2c80, 2753, 1}, {0x0480, 1102, 1}, {0x1e80, 2069, 1}, {0x1f80, 129, 2}, {0x10574, 3690, 1}, {0xa780, 3267, 1}, {0xab80, 1654, 1}, {0x0057, 65, 1}, {0x1c80, 908, 1}, {0x10ca9, 3906, 1}, {0x1e91d, 4281, 1}, {0x10c2, 3014, 1}, {0x03d5, 822, 1}, {0xffffffff, -1, 0}, {0x10592, 3774, 1}, {0xa680, 3102, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x0386, 739, 1}, {0x10c80, 3783, 1}, {0x104c4, 3630, 1}, {0x2cc4, 2855, 1}, {0xffffffff, -1, 0}, {0x1ec4, 2156, 1}, {0x1fc4, 54, 2}, {0x01c4, 420, 1}, {0xa7c4, 3288, 1}, {0x10d63, 3993, 1}, {0x00c4, 89, 1}, {0x2c9e, 2798, 1}, {0x049e, 1135, 1}, {0x1e9e, 24, 2}, {0x1f9e, 199, 2}, {0xffffffff, -1, 0}, {0xa79e, 3303, 1}, {0xab9e, 1744, 1}, {0xffffffff, -1, 0}, {0x1c9e, 1510, 1}, {0x2c9c, 2795, 1}, {0x049c, 1132, 1}, {0x0531, 1354, 1}, {0x1f9c, 189, 2}, {0x019c, 670, 1}, {0xa79c, 3300, 1}, {0xab9c, 1738, 1}, {0xffffffff, -1, 0}, {0x1c9c, 1504, 1}, {0x03fe, 733, 1}, {0x10c9e, 3873, 1}, {0xffffffff, -1, 0}, {0x104cc, 3654, 1}, {0x2ccc, 2867, 1}, {0x039a, 784, 1}, {0x1ecc, 2168, 1}, {0x1fcc, 71, 2}, {0x10586, 3741, 1}, {0xa7cc, 3351, 1}, {0x10c9c, 3867, 1}, {0x00cc, 114, 1}, {0x1f8d, 154, 2}, {0xffffffff, -1, 0}, {0xa78d, 649, 1}, {0xab8d, 1693, 1}, {0x03c2, 812, 1}, {0x2c8c, 2771, 1}, {0x048c, 1108, 1}, {0x1e8c, 2087, 1}, {0x1f8c, 149, 2}, {0x10a9, 2939, 1}, {0x0516, 1315, 1}, {0xab8c, 1690, 1}, {0xffffffff, -1, 0}, {0x118a9, 4029, 1}, {0x104b5, 3585, 1}, {0x24c2, 2543, 1}, {0x10c8d, 3822, 1}, {0xffffffff, -1, 0}, {0x038e, 845, 1}, {0x01b5, 408, 1}, {0xa68c, 3120, 1}, {0xabb5, 1813, 1}, {0x00b5, 791, 1}, {0x1cb5, 1579, 1}, {0x10c8c, 3819, 1}, {0x038a, 748, 1}, {0x2c88, 2765, 1}, {0xffffffff, -1, 0}, {0x1e88, 2081, 1}, {0x1f88, 129, 2}, {0x2c2f, 2726, 1}, {0x042f, 1002, 1}, {0xab88, 1678, 1}, {0x1f2f, 2309, 1}, {0x1c88, 3047, 1}, {0x2ce2, 2900, 1}, {0x04e2, 1237, 1}, {0x1ee2, 2201, 1}, {0x1fe2, 36, 3}, {0x01e2, 465, 1}, {0x10c4, 3020, 1}, {0xa688, 3114, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x2c75, 2750, 1}, {0x10c88, 3807, 1}, {0x1e4a, 1987, 1}, {0x1f4a, 2342, 1}, {0x014a, 276, 1}, {0xa74a, 3201, 1}, {0xab75, 1621, 1}, {0x004a, 24, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x24ca, 2567, 1}, {0x1058e, 3762, 1}, {0xff2f, 3414, 1}, {0x10d62, 3990, 1}, {0xffffffff, -1, 0}, {0xa64a, 3047, 1}, {0xffffffff, -1, 0}, {0x03a9, 832, 1}, {0x1058a, 3753, 1}, {0x1041c, 3534, 1}, {0x2c1c, 2669, 1}, {0x041c, 940, 1}, {0x1e1c, 1918, 1}, {0x1f1c, 2282, 1}, {0x011c, 213, 1}, {0x1041a, 3528, 1}, {0x2c1a, 2663, 1}, {0x041a, 934, 1}, {0x1e1a, 1915, 1}, {0x1f1a, 2276, 1}, {0x011a, 210, 1}, {0x10418, 3522, 1}, {0x2c18, 2657, 1}, {0x0418, 928, 1}, {0x1e18, 1912, 1}, {0x1f18, 2270, 1}, {0x0118, 207, 1}, {0x1040e, 3492, 1}, {0x2c0e, 2627, 1}, {0x040e, 1047, 1}, {0x1e0e, 1897, 1}, {0x1f0e, 2264, 1}, {0x010e, 192, 1}, {0x104c1, 3621, 1}, {0x10582, 3729, 1}, {0x04c1, 1186, 1}, {0xffffffff, -1, 0}, {0x16e4c, 4134, 1}, {0x1e916, 4260, 1}, {0x10b5, 2975, 1}, {0x10d57, 3957, 1}, {0x00c1, 80, 1}, {0x024a, 598, 1}, {0x118b5, 4065, 1}, {0x04f0, 1258, 1}, {0x1ef0, 2222, 1}, {0x039e, 798, 1}, {0x01f0, 20, 2}, {0xffffffff, -1, 0}, {0x24c4, 2549, 1}, {0x1e3e, 1969, 1}, {0x1f3e, 2330, 1}, {0xffffffff, -1, 0}, {0xa73e, 3183, 1}, {0x10580, 3723, 1}, {0x039c, 791, 1}, {0x1040c, 3486, 1}, {0x2c0c, 2621, 1}, {0x040c, 1041, 1}, {0x1e0c, 1894, 1}, {0x1f0c, 2258, 1}, {0x010c, 189, 1}, {0x021c, 547, 1}, {0xffffffff, -1, 0}, {0x10414, 3510, 1}, {0x2c14, 2645, 1}, {0x0414, 915, 1}, {0x1e14, 1906, 1}, {0x021a, 544, 1}, {0x0114, 201, 1}, {0x10406, 3468, 1}, {0x2c06, 2603, 1}, {0x0406, 1023, 1}, {0x1e06, 1885, 1}, {0x0218, 541, 1}, {0x0106, 180, 1}, {0xffffffff, -1, 0}, {0x1f3d, 2327, 1}, {0x013d, 258, 1}, {0x24cc, 2573, 1}, {0x020e, 526, 1}, {0x038c, 842, 1}, {0x10408, 3474, 1}, {0x2c08, 2609, 1}, {0x0408, 1029, 1}, {0x1e08, 1888, 1}, {0x1f08, 2246, 1}, {0x0108, 183, 1}, {0x10404, 3462, 1}, {0x2c04, 2597, 1}, {0x0404, 1017, 1}, {0x1e04, 1882, 1}, {0xffffffff, -1, 0}, {0x0104, 177, 1}, {0x10400, 3450, 1}, {0x2c00, 2585, 1}, {0x0400, 1005, 1}, {0x1e00, 1876, 1}, {0x0147, 273, 1}, {0x0100, 171, 1}, {0x023e, 2735, 1}, {0x0047, 18, 1}, {0x0388, 742, 1}, {0x1e56, 2005, 1}, {0x1f56, 62, 3}, {0x0156, 294, 1}, {0xa756, 3219, 1}, {0xfb14, 109, 2}, {0x0056, 62, 1}, {0x020c, 523, 1}, {0x1058d, 3759, 1}, {0x03e2, 869, 1}, {0x10c1, 3011, 1}, {0xfb06, 29, 2}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xa656, 3066, 1}, {0x0214, 535, 1}, {0x1058c, 3756, 1}, {0x10426, 3564, 1}, {0x2c26, 2699, 1}, {0x0426, 974, 1}, {0x1e26, 1933, 1}, {0x0206, 514, 1}, {0x0126, 228, 1}, {0xa726, 3150, 1}, {0x023d, 378, 1}, {0x10424, 3558, 1}, {0x2c24, 2693, 1}, {0x0424, 968, 1}, {0x1e24, 1930, 1}, {0xfb04, 5, 3}, {0x0124, 225, 1}, {0xa724, 3147, 1}, {0x1f59, 2354, 1}, {0x0208, 517, 1}, {0xffffffff, -1, 0}, {0xfb00, 4, 2}, {0x0059, 71, 1}, {0x10588, 3747, 1}, {0x1fad, 234, 2}, {0x0204, 511, 1}, {0xa7ad, 667, 1}, {0xabad, 1789, 1}, {0x1f5f, 2363, 1}, {0x1cad, 1555, 1}, {0xff26, 3387, 1}, {0x0200, 505, 1}, {0x2c2e, 2723, 1}, {0x042e, 999, 1}, {0x1e2e, 1945, 1}, {0x1f2e, 2306, 1}, {0x012e, 240, 1}, {0xa72e, 3162, 1}, {0xff24, 3381, 1}, {0xffffffff, -1, 0}, {0x10cad, 3918, 1}, {0x10575, 3693, 1}, {0x004f, 40, 1}, {0x054a, 1429, 1}, {0x2c2c, 2717, 1}, {0x042c, 993, 1}, {0x1e2c, 1942, 1}, {0x1f2c, 2300, 1}, {0x012c, 237, 1}, {0xa72c, 3159, 1}, {0x2c28, 2705, 1}, {0x0428, 980, 1}, {0x1e28, 1936, 1}, {0x1f28, 2288, 1}, {0x0128, 231, 1}, {0xa728, 3153, 1}, {0x0226, 559, 1}, {0x03f0, 784, 1}, {0xff2e, 3411, 1}, {0x24c1, 2540, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x051c, 1324, 1}, {0x0224, 556, 1}, {0x104c0, 3618, 1}, {0x2cc0, 2849, 1}, {0x04c0, 1207, 1}, {0x1ec0, 2150, 1}, {0x051a, 1321, 1}, {0xff2c, 3405, 1}, {0xa7c0, 3339, 1}, {0xffffffff, -1, 0}, {0x00c0, 77, 1}, {0xab73, 1615, 1}, {0x0518, 1318, 1}, {0xff28, 3393, 1}, {0x10422, 3552, 1}, {0x2c22, 2687, 1}, {0x0422, 960, 1}, {0x1e22, 1927, 1}, {0x050e, 1303, 1}, {0x0122, 222, 1}, {0xa722, 3144, 1}, {0x022e, 571, 1}, {0x1e54, 2002, 1}, {0x1f54, 57, 3}, {0x0154, 291, 1}, {0xa754, 3216, 1}, {0x1e30, 1948, 1}, {0x0054, 56, 1}, {0x0130, 261, 2}, {0x1e52, 1999, 1}, {0x1f52, 52, 3}, {0x0152, 288, 1}, {0xa752, 3213, 1}, {0x022c, 568, 1}, {0x0052, 49, 1}, {0xa654, 3063, 1}, {0x10ad, 2951, 1}, {0x16e57, 4167, 1}, {0x053e, 1393, 1}, {0x0228, 562, 1}, {0x118ad, 4041, 1}, {0xff22, 3375, 1}, {0xa652, 3060, 1}, {0x1e50, 1996, 1}, {0x1f50, 84, 2}, {0x0150, 285, 1}, {0xa750, 3210, 1}, {0x050c, 1300, 1}, {0x0050, 43, 1}, {0x1fab, 224, 2}, {0xff30, 3417, 1}, {0xa7ab, 634, 1}, {0xabab, 1783, 1}, {0x104b7, 3591, 1}, {0x1cab, 1549, 1}, {0x0514, 1312, 1}, {0xa650, 3057, 1}, {0x1fb7, 10, 3}, {0x01b7, 712, 1}, {0x2164, 2468, 1}, {0xabb7, 1819, 1}, {0x0506, 1291, 1}, {0x1cb7, 1585, 1}, {0x104b1, 3573, 1}, {0x053d, 1390, 1}, {0x10cab, 3912, 1}, {0xffffffff, -1, 0}, {0x0222, 553, 1}, {0x01b1, 703, 1}, {0xa7b1, 694, 1}, {0xabb1, 1801, 1}, {0x2c6d, 610, 1}, {0x1cb1, 1567, 1}, {0x0508, 1294, 1}, {0x1f6d, 2381, 1}, {0x10d56, 3954, 1}, {0x0230, 574, 1}, {0x2c6b, 2744, 1}, {0xffffffff, -1, 0}, {0x0504, 1288, 1}, {0x1f6b, 2375, 1}, {0x10c0, 3008, 1}, {0x1e91c, 4278, 1}, {0x10cb1, 3930, 1}, {0x0547, 1420, 1}, {0x0500, 1282, 1}, {0x2c69, 2741, 1}, {0xffffffff, -1, 0}, {0x1e91a, 4272, 1}, {0x1f69, 2369, 1}, {0xffffffff, -1, 0}, {0x0556, 1465, 1}, {0x104b3, 3579, 1}, {0xffffffff, -1, 0}, {0x1e918, 4266, 1}, {0x2167, 2477, 1}, {0x1fb3, 62, 2}, {0x01b3, 405, 1}, {0xa7b3, 3369, 1}, {0xabb3, 1807, 1}, {0x1e90e, 4236, 1}, {0x1cb3, 1573, 1}, {0xffffffff, -1, 0}, {0x1fa7, 244, 2}, {0x01a7, 396, 1}, {0x10d59, 3963, 1}, {0xaba7, 1771, 1}, {0xab71, 1609, 1}, {0x1ca7, 1537, 1}, {0x1e4e, 1993, 1}, {0x0526, 1339, 1}, {0x014e, 282, 1}, {0xa74e, 3207, 1}, {0xffffffff, -1, 0}, {0x004e, 37, 1}, {0x10d5f, 3981, 1}, {0x1f39, 2315, 1}, {0x0139, 252, 1}, {0x0524, 1336, 1}, {0x10ca7, 3900, 1}, {0x1e48, 1984, 1}, {0x1f48, 2336, 1}, {0xa64e, 3054, 1}, {0xa748, 3198, 1}, {0x10ab, 2945, 1}, {0x0048, 21, 1}, {0x104d3, 3675, 1}, {0xffffffff, -1, 0}, {0x118ab, 4035, 1}, {0x1e90c, 4230, 1}, {0x1fd3, 25, 3}, {0x01d3, 441, 1}, {0x10b7, 2981, 1}, {0xa648, 3044, 1}, {0x00d3, 135, 1}, {0xffffffff, -1, 0}, {0x118b7, 4071, 1}, {0x1e914, 4254, 1}, {0x052e, 1351, 1}, {0xff39, 3444, 1}, {0x16e4a, 4128, 1}, {0x054f, 1444, 1}, {0x10b1, 2963, 1}, {0x1e906, 4212, 1}, {0x24c0, 2537, 1}, {0xffffffff, -1, 0}, {0x118b1, 4053, 1}, {0x2c60, 2729, 1}, {0x0460, 1053, 1}, {0x1e60, 2020, 1}, {0x052c, 1348, 1}, {0x0160, 309, 1}, {0xa760, 3234, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e908, 4218, 1}, {0x0528, 1342, 1}, {0x2c2b, 2714, 1}, {0x042b, 990, 1}, {0x024e, 604, 1}, {0x1f2b, 2297, 1}, {0x1e904, 4206, 1}, {0xa660, 3081, 1}, {0x10420, 3546, 1}, {0x2c20, 2681, 1}, {0x0420, 953, 1}, {0x1e20, 1924, 1}, {0x1e900, 4194, 1}, {0x0120, 219, 1}, {0xffffffff, -1, 0}, {0x0248, 595, 1}, {0x10b3, 2969, 1}, {0x10573, 3687, 1}, {0x10d54, 3948, 1}, {0xffffffff, -1, 0}, {0x118b3, 4059, 1}, {0x03ab, 839, 1}, {0xffffffff, -1, 0}, {0x10a7, 2933, 1}, {0xffffffff, -1, 0}, {0x10d52, 3942, 1}, {0xffffffff, -1, 0}, {0x118a7, 4023, 1}, {0xff2b, 3402, 1}, {0x0522, 1333, 1}, {0x1041e, 3540, 1}, {0x2c1e, 2675, 1}, {0x041e, 946, 1}, {0x1e1e, 1921, 1}, {0x0554, 1459, 1}, {0x011e, 216, 1}, {0x10425, 3561, 1}, {0x2c25, 2696, 1}, {0x0425, 971, 1}, {0x10d50, 3936, 1}, {0x24b7, 2510, 1}, {0x0552, 1453, 1}, {0x10412, 3504, 1}, {0x2c12, 2639, 1}, {0x0412, 908, 1}, {0x1e12, 1903, 1}, {0x2165, 2471, 1}, {0x0112, 198, 1}, {0x10410, 3498, 1}, {0x2c10, 2633, 1}, {0x0410, 902, 1}, {0x1e10, 1900, 1}, {0xffffffff, -1, 0}, {0x0110, 195, 1}, {0xffffffff, -1, 0}, {0x0550, 1447, 1}, {0xffffffff, -1, 0}, {0x2cda, 2888, 1}, {0x04da, 1225, 1}, {0x1eda, 2189, 1}, {0x1fda, 2408, 1}, {0x0220, 384, 1}, {0xa7da, 3363, 1}, {0xff25, 3384, 1}, {0x00da, 153, 1}, {0x2cd8, 2885, 1}, {0x04d8, 1222, 1}, {0x1ed8, 2186, 1}, {0x1fd8, 2438, 1}, {0xffffffff, -1, 0}, {0xa7d8, 3360, 1}, {0xffffffff, -1, 0}, {0x00d8, 147, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x03a7, 826, 1}, {0x0055, 59, 1}, {0x2cd6, 2882, 1}, {0x04d6, 1219, 1}, {0x1ed6, 2183, 1}, {0x1fd6, 76, 2}, {0xffffffff, -1, 0}, {0xa7d6, 3357, 1}, {0x021e, 550, 1}, {0x00d6, 144, 1}, {0x104d0, 3666, 1}, {0x2cd0, 2873, 1}, {0x04d0, 1210, 1}, {0x1ed0, 2174, 1}, {0x16e47, 4119, 1}, {0x104b9, 3597, 1}, {0xa7d0, 3354, 1}, {0xffffffff, -1, 0}, {0x00d0, 126, 1}, {0x1fb9, 2435, 1}, {0x0212, 532, 1}, {0x16e56, 4164, 1}, {0xabb9, 1825, 1}, {0x104cb, 3651, 1}, {0x1cb9, 1591, 1}, {0x04cb, 1201, 1}, {0x0210, 529, 1}, {0x1fcb, 2405, 1}, {0x01cb, 428, 1}, {0xa7cb, 646, 1}, {0x2183, 2504, 1}, {0x00cb, 111, 1}, {0x104c8, 3642, 1}, {0x2cc8, 2861, 1}, {0xffffffff, -1, 0}, {0x1ec8, 2162, 1}, {0x1fc8, 2396, 1}, {0x01c8, 424, 1}, {0x10571, 3681, 1}, {0xffffffff, -1, 0}, {0x00c8, 102, 1}, {0x104c6, 3636, 1}, {0x2cc6, 2858, 1}, {0x1f5d, 2360, 1}, {0x1ec6, 2159, 1}, {0x1fc6, 67, 2}, {0x054e, 1441, 1}, {0xa7c6, 1873, 1}, {0x104c5, 3633, 1}, {0x00c6, 96, 1}, {0x04c5, 1192, 1}, {0x16e59, 4173, 1}, {0x0539, 1378, 1}, {0x01c5, 420, 1}, {0xa7c5, 688, 1}, {0xffffffff, -1, 0}, {0x00c5, 92, 1}, {0x0548, 1423, 1}, {0xffffffff, -1, 0}, {0x1faf, 244, 2}, {0x01af, 402, 1}, {0x16e5f, 4191, 1}, {0xabaf, 1795, 1}, {0x212a, 27, 1}, {0x1caf, 1561, 1}, {0x04fc, 1276, 1}, {0x1efc, 2240, 1}, {0x1ffc, 96, 2}, {0x01fc, 499, 1}, {0x1fa5, 234, 2}, {0x10d60, 3984, 1}, {0x16e4f, 4143, 1}, {0xaba5, 1765, 1}, {0xffffffff, -1, 0}, {0x1ca5, 1531, 1}, {0x10caf, 3924, 1}, {0x1fa3, 224, 2}, {0x1fa1, 214, 2}, {0xffffffff, -1, 0}, {0xaba3, 1759, 1}, {0xaba1, 1753, 1}, {0x1ca3, 1525, 1}, {0x1ca1, 1519, 1}, {0x1f91, 174, 2}, {0x0191, 369, 1}, {0x10ca5, 3894, 1}, {0xab91, 1705, 1}, {0xffffffff, -1, 0}, {0x1c91, 1471, 1}, {0x10421, 3549, 1}, {0x2c21, 2684, 1}, {0x0421, 956, 1}, {0x10ca3, 3888, 1}, {0x10ca1, 3882, 1}, {0x10b9, 2987, 1}, {0xffffffff, -1, 0}, {0x1f49, 2339, 1}, {0x0149, 46, 2}, {0x118b9, 4077, 1}, {0x10c91, 3834, 1}, {0x0049, 4296, 1}, {0x1f87, 164, 2}, {0x0187, 363, 1}, {0x0520, 1330, 1}, {0xab87, 1675, 1}, {0xffffffff, -1, 0}, {0x1c87, 1056, 1}, {0x2c72, 2747, 1}, {0x0472, 1081, 1}, {0x1e72, 2048, 1}, {0xffffffff, -1, 0}, {0x0172, 336, 1}, {0x03da, 857, 1}, {0xab72, 1612, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xff21, 3372, 1}, {0x10c87, 3804, 1}, {0x2161, 2459, 1}, {0x16e54, 4158, 1}, {0x03d8, 854, 1}, {0x1e32, 1951, 1}, {0xffffffff, -1, 0}, {0x0132, 243, 1}, {0xa732, 3165, 1}, {0x051e, 1327, 1}, {0x16e52, 4152, 1}, {0x10c5, 3023, 1}, {0xffffffff, -1, 0}, {0x2c70, 613, 1}, {0x0470, 1078, 1}, {0x1e70, 2045, 1}, {0x03d6, 804, 1}, {0x0170, 333, 1}, {0x10af, 2957, 1}, {0xab70, 1606, 1}, {0xffffffff, -1, 0}, {0x0512, 1309, 1}, {0x118af, 4047, 1}, {0xffffffff, -1, 0}, {0x16e50, 4146, 1}, {0x03d0, 754, 1}, {0xffffffff, -1, 0}, {0x0510, 1306, 1}, {0x10a5, 2927, 1}, {0xff32, 3423, 1}, {0xffffffff, -1, 0}, {0x10d55, 3951, 1}, {0x118a5, 4017, 1}, {0x047c, 1096, 1}, {0x1e7c, 2063, 1}, {0x10a3, 2921, 1}, {0x10a1, 2915, 1}, {0xffffffff, -1, 0}, {0xab7c, 1642, 1}, {0x118a3, 4011, 1}, {0x118a1, 4005, 1}, {0x24b9, 2516, 1}, {0x046c, 1072, 1}, {0x1e6c, 2039, 1}, {0x1f6c, 2378, 1}, {0x016c, 327, 1}, {0xa76c, 3252, 1}, {0x0555, 1462, 1}, {0x13fc, 1858, 1}, {0x24cb, 2570, 1}, {0x046a, 1069, 1}, {0x1e6a, 2036, 1}, {0x1f6a, 2372, 1}, {0x016a, 324, 1}, {0xa76a, 3249, 1}, {0x0232, 577, 1}, {0xa66c, 3099, 1}, {0x216f, 2501, 1}, {0x24c8, 2561, 1}, {0x0468, 1066, 1}, {0x1e68, 2033, 1}, {0x1f68, 2366, 1}, {0x0168, 321, 1}, {0xa768, 3246, 1}, {0xa66a, 3096, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x24c6, 2555, 1}, {0xffffffff, -1, 0}, {0x1e920, 4290, 1}, {0x2163, 2465, 1}, {0xffffffff, -1, 0}, {0x216e, 2498, 1}, {0xa668, 3093, 1}, {0x24c5, 2552, 1}, {0xffffffff, -1, 0}, {0x1e5a, 2011, 1}, {0x10d5d, 3975, 1}, {0x015a, 300, 1}, {0xa75a, 3225, 1}, {0x03a5, 819, 1}, {0x005a, 74, 1}, {0xffffffff, -1, 0}, {0x1f8f, 164, 2}, {0x018f, 628, 1}, {0xffffffff, -1, 0}, {0xab8f, 1699, 1}, {0x03a3, 812, 1}, {0x03a1, 808, 1}, {0xa65a, 3072, 1}, {0x16e4e, 4140, 1}, {0x1e91e, 4284, 1}, {0xffffffff, -1, 0}, {0x1e58, 2008, 1}, {0x0391, 751, 1}, {0x0158, 297, 1}, {0xa758, 3222, 1}, {0x1e46, 1981, 1}, {0x0058, 68, 1}, {0x10c8f, 3828, 1}, {0xa746, 3195, 1}, {0x16e48, 4122, 1}, {0x0046, 15, 1}, {0x1e912, 4248, 1}, {0x04ee, 1255, 1}, {0x1eee, 2219, 1}, {0xa658, 3069, 1}, {0x01ee, 483, 1}, {0x104bf, 3615, 1}, {0x1e910, 4242, 1}, {0xa646, 3041, 1}, {0x1e44, 1978, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xa744, 3192, 1}, {0xabbf, 1843, 1}, {0x0044, 9, 1}, {0x1cbf, 1603, 1}, {0x2cde, 2894, 1}, {0x04de, 1231, 1}, {0x1ede, 2195, 1}, {0x0372, 724, 1}, {0x01de, 459, 1}, {0xffffffff, -1, 0}, {0xa644, 3038, 1}, {0x00de, 165, 1}, {0x104bd, 3609, 1}, {0x2cdc, 2891, 1}, {0x04dc, 1228, 1}, {0x1edc, 2192, 1}, {0xffffffff, -1, 0}, {0x10591, 3771, 1}, {0xa7dc, 381, 1}, {0xabbd, 1837, 1}, {0x00dc, 159, 1}, {0x1cbd, 1597, 1}, {0x104d2, 3672, 1}, {0x2cd2, 2876, 1}, {0x04d2, 1213, 1}, {0x1ed2, 2177, 1}, {0x1fd2, 20, 3}, {0x104bb, 3603, 1}, {0xffffffff, -1, 0}, {0x0370, 721, 1}, {0x00d2, 132, 1}, {0x1fbb, 2393, 1}, {0x0549, 1426, 1}, {0x0246, 592, 1}, {0xabbb, 1831, 1}, {0x10587, 3744, 1}, {0xffffffff, -1, 0}, {0x0587, 105, 2}, {0x104cd, 3657, 1}, {0xffffffff, -1, 0}, {0x04cd, 1204, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x01cd, 432, 1}, {0x10572, 3684, 1}, {0x2162, 2462, 1}, {0x00cd, 117, 1}, {0x0244, 700, 1}, {0x104c9, 3645, 1}, {0x104c3, 3627, 1}, {0x04c9, 1198, 1}, {0x04c3, 1189, 1}, {0x1fc9, 2399, 1}, {0x1fc3, 71, 2}, {0xa7c9, 3348, 1}, {0xffffffff, -1, 0}, {0x00c9, 105, 1}, {0x00c3, 86, 1}, {0x0532, 1357, 1}, {0x1f9f, 204, 2}, {0x019f, 679, 1}, {0xffffffff, -1, 0}, {0xab9f, 1747, 1}, {0xffffffff, -1, 0}, {0x1c9f, 1513, 1}, {0x1f5b, 2357, 1}, {0x10570, 3678, 1}, {0x1f9d, 194, 2}, {0x019d, 676, 1}, {0xffffffff, -1, 0}, {0xab9d, 1741, 1}, {0x1f95, 194, 2}, {0x1c9d, 1507, 1}, {0x10bf, 3005, 1}, {0xab95, 1717, 1}, {0x10c9f, 3876, 1}, {0x1c95, 1483, 1}, {0x118bf, 4095, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e9b, 2020, 1}, {0x1f9b, 184, 2}, {0xffffffff, -1, 0}, {0x10c9d, 3870, 1}, {0xab9b, 1735, 1}, {0x1057c, 3711, 1}, {0x1c9b, 1501, 1}, {0x10c95, 3846, 1}, {0x1e99, 42, 2}, {0x1f99, 174, 2}, {0xffffffff, -1, 0}, {0x10bd, 2999, 1}, {0xab99, 1729, 1}, {0x16e55, 4161, 1}, {0x1c99, 1495, 1}, {0x118bd, 4089, 1}, {0x038f, 848, 1}, {0x10c9b, 3864, 1}, {0x1f93, 184, 2}, {0x0193, 637, 1}, {0xffffffff, -1, 0}, {0xab93, 1711, 1}, {0xffffffff, -1, 0}, {0x1c93, 1477, 1}, {0x1f4b, 2345, 1}, {0x10c99, 3858, 1}, {0x10bb, 2993, 1}, {0xffffffff, -1, 0}, {0x004b, 27, 1}, {0x0143, 267, 1}, {0x118bb, 4083, 1}, {0x1e921, 4293, 1}, {0x0043, 6, 1}, {0x10d5a, 3966, 1}, {0x10c93, 3840, 1}, {0x1f81, 134, 2}, {0x0181, 616, 1}, {0x10cd, 3029, 1}, {0xab81, 1657, 1}, {0x03ee, 887, 1}, {0x1c81, 915, 1}, {0x2c7e, 583, 1}, {0x047e, 1099, 1}, {0x1e7e, 2066, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xa77e, 3264, 1}, {0xab7e, 1648, 1}, {0x10c3, 3017, 1}, {0x0145, 270, 1}, {0x10d58, 3960, 1}, {0x10c81, 3786, 1}, {0x0045, 12, 1}, {0x1058f, 3765, 1}, {0x03de, 863, 1}, {0xffffffff, -1, 0}, {0x24bf, 2534, 1}, {0x0476, 1087, 1}, {0x1e76, 2054, 1}, {0x16e5d, 4185, 1}, {0x0176, 342, 1}, {0xffffffff, -1, 0}, {0xab76, 1624, 1}, {0x03dc, 860, 1}, {0x0466, 1063, 1}, {0x1e66, 2030, 1}, {0xffffffff, -1, 0}, {0x0166, 318, 1}, {0xa766, 3243, 1}, {0x1e5e, 2017, 1}, {0x0546, 1417, 1}, {0x015e, 306, 1}, {0xa75e, 3231, 1}, {0x1e5c, 2014, 1}, {0x24bd, 2528, 1}, {0x015c, 303, 1}, {0xa75c, 3228, 1}, {0x0243, 354, 1}, {0xa666, 3090, 1}, {0xffffffff, -1, 0}, {0x1e42, 1975, 1}, {0xffffffff, -1, 0}, {0xa65e, 3078, 1}, {0xa742, 3189, 1}, {0x0544, 1411, 1}, {0x0042, 3, 1}, {0xa65c, 3075, 1}, {0x0053, 52, 1}, {0xffffffff, -1, 0}, {0x24bb, 2522, 1}, {0x104cf, 3663, 1}, {0x1e3a, 1963, 1}, {0x1f3a, 2318, 1}, {0xa642, 3035, 1}, {0xa73a, 3177, 1}, {0x01cf, 435, 1}, {0x0141, 264, 1}, {0x0245, 709, 1}, {0x00cf, 123, 1}, {0x0041, 0, 1}, {0x24cd, 2576, 1}, {0xffffffff, -1, 0}, {0x04fa, 1273, 1}, {0x1efa, 2237, 1}, {0x1ffa, 2426, 1}, {0x01fa, 496, 1}, {0x039f, 801, 1}, {0xffffffff, -1, 0}, {0x047a, 1093, 1}, {0x1e7a, 2060, 1}, {0x24c9, 2564, 1}, {0x24c3, 2546, 1}, {0x16e49, 4125, 1}, {0xab7a, 1636, 1}, {0x039d, 795, 1}, {0xff3a, 3447, 1}, {0x0051, 46, 1}, {0xffffffff, -1, 0}, {0x0395, 764, 1}, {0x04f4, 1264, 1}, {0x1ef4, 2228, 1}, {0x1ff4, 101, 2}, {0x01f4, 490, 1}, {0x2cf2, 2909, 1}, {0x04f2, 1261, 1}, {0x1ef2, 2225, 1}, {0x1ff2, 257, 2}, {0x01f2, 486, 1}, {0x039b, 788, 1}, {0xffffffff, -1, 0}, {0x04ec, 1252, 1}, {0x1eec, 2216, 1}, {0x1fec, 2450, 1}, {0x01ec, 480, 1}, {0xffffffff, -1, 0}, {0x10d5b, 3969, 1}, {0x0399, 779, 1}, {0x04ea, 1249, 1}, {0x1eea, 2213, 1}, {0x1fea, 2420, 1}, {0x01ea, 477, 1}, {0x023a, 2732, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x0241, 589, 1}, {0x0393, 758, 1}, {0x04e8, 1246, 1}, {0x1ee8, 2210, 1}, {0x1fe8, 2444, 1}, {0x01e8, 474, 1}, {0x04e6, 1243, 1}, {0x1ee6, 2207, 1}, {0x1fe6, 88, 2}, {0x01e6, 471, 1}, {0xffffffff, -1, 0}, {0x10595, 3780, 1}, {0x04e4, 1240, 1}, {0x1ee4, 2204, 1}, {0x1fe4, 80, 2}, {0x01e4, 468, 1}, {0x2ce0, 2897, 1}, {0x04e0, 1234, 1}, {0x1ee0, 2198, 1}, {0xffffffff, -1, 0}, {0x01e0, 462, 1}, {0x104ce, 3660, 1}, {0x2cce, 2870, 1}, {0x1e40, 1972, 1}, {0x1ece, 2171, 1}, {0xffffffff, -1, 0}, {0xa740, 3186, 1}, {0x1e38, 1960, 1}, {0x1f38, 2312, 1}, {0x00ce, 120, 1}, {0xa738, 3174, 1}, {0x0345, 779, 1}, {0x1e36, 1957, 1}, {0x104d1, 3669, 1}, {0x0136, 249, 1}, {0xa736, 3171, 1}, {0xa640, 3032, 1}, {0x1e34, 1954, 1}, {0x01d1, 438, 1}, {0x0134, 246, 1}, {0xa734, 3168, 1}, {0x00d1, 129, 1}, {0x0376, 727, 1}, {0x1041b, 3531, 1}, {0x2c1b, 2666, 1}, {0x041b, 937, 1}, {0x054b, 1432, 1}, {0x1f1b, 2279, 1}, {0x1f3f, 2333, 1}, {0x013f, 261, 1}, {0x0543, 1408, 1}, {0xff38, 3441, 1}, {0x10417, 3519, 1}, {0x2c17, 2654, 1}, {0x0417, 925, 1}, {0x10581, 3726, 1}, {0xff36, 3435, 1}, {0x13fa, 1852, 1}, {0x10419, 3525, 1}, {0x2c19, 2660, 1}, {0x0419, 931, 1}, {0xff34, 3429, 1}, {0x1f19, 2273, 1}, {0xffffffff, -1, 0}, {0x1057e, 3717, 1}, {0x16e5a, 4176, 1}, {0x10415, 3513, 1}, {0x2c15, 2648, 1}, {0x0415, 919, 1}, {0xffffffff, -1, 0}, {0x0545, 1414, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x10413, 3507, 1}, {0x2c13, 2642, 1}, {0x0413, 912, 1}, {0x10d5e, 3978, 1}, {0x03cf, 851, 1}, {0xffffffff, -1, 0}, {0x10576, 3696, 1}, {0x10d5c, 3972, 1}, {0xffffffff, -1, 0}, {0x16e58, 4170, 1}, {0x10405, 3465, 1}, {0x2c05, 2600, 1}, {0x0405, 1020, 1}, {0x16e46, 4116, 1}, {0x03fa, 899, 1}, {0x24cf, 2582, 1}, {0x10d53, 3945, 1}, {0xffffffff, -1, 0}, {0x2126, 832, 1}, {0x1040f, 3495, 1}, {0x2c0f, 2630, 1}, {0x040f, 1050, 1}, {0xfb17, 117, 2}, {0x1f0f, 2267, 1}, {0x1040d, 3489, 1}, {0x2c0d, 2624, 1}, {0x040d, 1044, 1}, {0x16e44, 4110, 1}, {0x1f0d, 2261, 1}, {0xffffffff, -1, 0}, {0x0542, 1405, 1}, {0x03f4, 774, 1}, {0x0553, 1456, 1}, {0x1040b, 3483, 1}, {0x2c0b, 2618, 1}, {0x040b, 1038, 1}, {0xfb15, 113, 2}, {0x1f0b, 2255, 1}, {0x10403, 3459, 1}, {0x2c03, 2594, 1}, {0x0403, 1014, 1}, {0x053a, 1381, 1}, {0x03ec, 884, 1}, {0xfb13, 121, 2}, {0x0541, 1402, 1}, {0x10d51, 3939, 1}, {0x10409, 3477, 1}, {0x2c09, 2612, 1}, {0x0409, 1032, 1}, {0x03ea, 881, 1}, {0x1f09, 2249, 1}, {0x1f3b, 2321, 1}, {0x013b, 255, 1}, {0xfb05, 29, 2}, {0x10401, 3453, 1}, {0x2c01, 2588, 1}, {0x0401, 1008, 1}, {0x1057a, 3708, 1}, {0x03e8, 878, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x0551, 1450, 1}, {0x03e6, 875, 1}, {0x04f8, 1270, 1}, {0x1ef8, 2234, 1}, {0x1ff8, 2414, 1}, {0x01f8, 493, 1}, {0xffffffff, -1, 0}, {0x03e4, 872, 1}, {0x04f6, 1267, 1}, {0x1ef6, 2231, 1}, {0x1ff6, 92, 2}, {0x01f6, 372, 1}, {0x03e0, 866, 1}, {0xffffffff, -1, 0}, {0x2cd4, 2879, 1}, {0x04d4, 1216, 1}, {0x1ed4, 2180, 1}, {0x0179, 345, 1}, {0xa779, 3258, 1}, {0xab79, 1633, 1}, {0xfb03, 0, 3}, {0x00d4, 138, 1}, {0x1e3c, 1966, 1}, {0x1f3c, 2324, 1}, {0xffffffff, -1, 0}, {0xa73c, 3180, 1}, {0x10423, 3555, 1}, {0x2c23, 2690, 1}, {0x0423, 965, 1}, {0x24ce, 2579, 1}, {0x03d1, 774, 1}, {0x2c2d, 2720, 1}, {0x042d, 996, 1}, {0x16e5b, 4179, 1}, {0x1f2d, 2303, 1}, {0xffffffff, -1, 0}, {0xfb01, 8, 2}, {0x2c29, 2708, 1}, {0x0429, 983, 1}, {0x023b, 580, 1}, {0x1f29, 2291, 1}, {0x1041f, 3543, 1}, {0x2c1f, 2678, 1}, {0x041f, 950, 1}, {0x10411, 3501, 1}, {0x2c11, 2636, 1}, {0x0411, 905, 1}, {0x10407, 3471, 1}, {0x2c07, 2606, 1}, {0x0407, 1026, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xff23, 3378, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x0540, 1399, 1}, {0xff2d, 3408, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x0538, 1375, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xff29, 3396, 1}, {0xffffffff, -1, 0}, {0x0536, 1369, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x0534, 1363, 1}, {0xffffffff, -1, 0}, {0x16e4b, 4131, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x16e43, 4107, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x053f, 1396, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x216d, 2495, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x216b, 2489, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x16e45, 4113, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x13f8, 1846, 1}, {0x2169, 2483, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x16e5e, 4188, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x16e5c, 4182, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x16e42, 4104, 1}, {0xffffffff, -1, 0}, {0x16e53, 4155, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x16e41, 4101, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x053b, 1384, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x16e51, 4149, 1}, {0x1e91b, 4275, 1}, {0xffffffff, -1, 0}, {0x2160, 2456, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e917, 4263, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x212b, 92, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e919, 4269, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x10579, 3705, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e915, 4257, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x053c, 1387, 1}, {0xffffffff, -1, 0}, {0x1e913, 4251, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e905, 4209, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e90f, 4239, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e90d, 4233, 1}, {0x16e40, 4098, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e90b, 4227, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e903, 4203, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e909, 4221, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e901, 4197, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e91f, 4287, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e911, 4245, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x1e907, 4215, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x2132, 2453, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x216c, 2492, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x216a, 2486, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x2168, 2480, 1}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0xffffffff, -1, 0}, {0x2166, 2474, 1} }; { int key = hash(&code); if (key <= MAX_HASH_VALUE) { OnigCodePoint gcode = wordlist[key].code; if (code == gcode && wordlist[key].index >= 0) return &wordlist[key]; } } return 0; } jq-1.8.2/vendor/oniguruma/src/utf8.c0000644000175100017510000001752515215513537012764 /********************************************************************** utf8.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" /* U+0000 - U+10FFFF */ #define USE_RFC3629_RANGE /* #define USE_INVALID_CODE_SCHEME */ #ifdef USE_INVALID_CODE_SCHEME /* virtual codepoint values for invalid encoding byte 0xfe and 0xff */ #define INVALID_CODE_FE 0xfffffffe #define INVALID_CODE_FF 0xffffffff #define VALID_CODE_LIMIT 0x7fffffff #endif #define utf8_islead(c) ((UChar )((c) & 0xc0) != 0x80) #define utf8_istail(c) ((UChar )((c) & 0xc0) == 0x80) static const int EncLen_UTF8[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, #ifdef USE_RFC3629_RANGE 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 #else 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1 #endif }; static int mbc_enc_len(const UChar* p) { return EncLen_UTF8[*p]; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { int i, len; while (p < end) { if (! utf8_islead(*p)) return FALSE; len = mbc_enc_len(p++); if (len > 1) { for (i = 1; i < len; i++) { if (p == end) return FALSE; if (! utf8_istail(*p++)) return FALSE; } } } return TRUE; } static OnigCodePoint mbc_to_code(const UChar* p, const UChar* end) { int c, len; OnigCodePoint n; len = mbc_enc_len(p); if (len > (int )(end - p)) len = (int )(end - p); c = *p++; if (len > 1) { len--; n = c & ((1 << (6 - len)) - 1); while (len--) { c = *p++; n = (n << 6) | (c & ((1 << 6) - 1)); } return n; } else { #ifdef USE_INVALID_CODE_SCHEME if (c > 0xfd) { return ((c == 0xfe) ? INVALID_CODE_FE : INVALID_CODE_FF); } #endif return (OnigCodePoint )c; } } static int code_to_mbclen(OnigCodePoint code) { if ((code & 0xffffff80) == 0) return 1; else if ((code & 0xfffff800) == 0) return 2; else if ((code & 0xffff0000) == 0) return 3; else if ((code & 0xffe00000) == 0) return 4; #ifndef USE_RFC3629_RANGE else if ((code & 0xfc000000) == 0) return 5; else if ((code & 0x80000000) == 0) return 6; #endif #ifdef USE_INVALID_CODE_SCHEME else if (code == INVALID_CODE_FE) return 1; else if (code == INVALID_CODE_FF) return 1; #endif else return ONIGERR_INVALID_CODE_POINT_VALUE; } static int code_to_mbc(OnigCodePoint code, UChar *buf) { #define UTF8_TRAILS(code, shift) (UChar )((((code) >> (shift)) & 0x3f) | 0x80) #define UTF8_TRAIL0(code) (UChar )(((code) & 0x3f) | 0x80) if ((code & 0xffffff80) == 0) { *buf = (UChar )code; return 1; } else { UChar *p = buf; if ((code & 0xfffff800) == 0) { *p++ = (UChar )(((code>>6)& 0x1f) | 0xc0); } else if ((code & 0xffff0000) == 0) { *p++ = (UChar )(((code>>12) & 0x0f) | 0xe0); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0xffe00000) == 0) { *p++ = (UChar )(((code>>18) & 0x07) | 0xf0); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } #ifndef USE_RFC3629_RANGE else if ((code & 0xfc000000) == 0) { *p++ = (UChar )(((code>>24) & 0x03) | 0xf8); *p++ = UTF8_TRAILS(code, 18); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0x80000000) == 0) { *p++ = (UChar )(((code>>30) & 0x01) | 0xfc); *p++ = UTF8_TRAILS(code, 24); *p++ = UTF8_TRAILS(code, 18); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } #endif #ifdef USE_INVALID_CODE_SCHEME else if (code == INVALID_CODE_FE) { *p = 0xfe; return 1; } else if (code == INVALID_CODE_FF) { *p = 0xff; return 1; } #endif else { return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE; } *p++ = UTF8_TRAIL0(code); return (int )(p - buf); } } static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold) { const UChar* p = *pp; if (ONIGENC_IS_MBC_ASCII(p)) { #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (*p == 0x49) { *fold++ = 0xc4; *fold = 0xb1; (*pp)++; return 2; } } #endif *fold = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p); (*pp)++; return 1; /* return byte length of converted char to lower */ } else { return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF8, flag, pp, end, fold); } } static int get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[]) { *sb_out = 0x80; return onigenc_unicode_ctype_code_range(ctype, ranges); } static UChar* left_adjust_char_head(const UChar* start, const UChar* s) { const UChar *p; if (s <= start) return (UChar* )s; p = s; while (!utf8_islead(*p) && p > start) p--; return (UChar* )p; } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF8, flag, p, end, items); } OnigEncodingType OnigEncodingUTF8 = { mbc_enc_len, "UTF-8", /* name */ #ifdef USE_RFC3629_RANGE 4, /* max enc length */ #else 6, #endif 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, mbc_to_code, code_to_mbclen, code_to_mbc, mbc_case_fold, onigenc_unicode_apply_all_case_fold, get_case_fold_codes_by_str, onigenc_unicode_property_name_to_ctype, onigenc_unicode_is_code_ctype, get_ctype_code_range, left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_1_OR_0, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/iso8859_15.c0000644000175100017510000002110615215513537013521 /********************************************************************** iso8859_15.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_15_TO_LOWER_CASE(c) EncISO_8859_15_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_15_CTYPE(code,ctype) \ ((EncISO_8859_15_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_15_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\250', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\270', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\275', '\275', '\377', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_15_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x34a2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x34a2, 0x30e2, 0x00a0, 0x01a0, 0x30e2, 0x10a0, 0x30e2, 0x01a0, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_15_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; /* return byte length of converted char to lower */ } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_15_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa6, 0xa8 }, { 0xb4, 0xb8 }, { 0xbc, 0xbd }, { 0xbe, 0xff }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_15 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-15", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/config.h.windows.in0000644000175100017510000000254515215513537015442 #if defined(__MINGW32__) || _MSC_VER >= 1600 #define HAVE_STDINT_H 1 #endif #if defined(__MINGW32__) || _MSC_VER >= 1800 #define HAVE_INTTYPES_H 1 #endif #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_MEMORY_H 1 #define HAVE_OFF_T 1 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 #define SIZEOF_LONG_LONG 8 #define SIZEOF___INT64 8 #define SIZEOF_OFF_T 4 #ifdef _WIN64 #define SIZEOF_VOIDP 8 #define SIZEOF_SIZE_T 8 #else #define SIZEOF_VOIDP 4 #define SIZEOF_SIZE_T 4 #endif #define SIZEOF_FLOAT 4 #define SIZEOF_DOUBLE 8 #define TOKEN_PASTE(x,y) x##y #ifndef NORETURN #if _MSC_VER > 1100 #define NORETURN(x) __declspec(noreturn) x #else #define NORETURN(x) x #endif #endif #define HAVE_DECL_SYS_NERR 1 #define HAVE_FCNTL_H 1 #define HAVE_SYS_UTIME_H 1 #define HAVE_MEMORY_H 1 #define uid_t int #define gid_t int #define GETGROUPS_T int #define HAVE_ALLOCA 1 #define HAVE_DUP2 1 #define HAVE_MKDIR 1 #define HAVE_FLOCK 1 #define HAVE_FINITE 1 #define HAVE_HYPOT 1 #define HAVE_WAITPID 1 #define HAVE_CHSIZE 1 #define HAVE_TIMES 1 #define HAVE_TELLDIR 1 #define HAVE_SEEKDIR 1 #define HAVE_EXECVE 1 #define HAVE_DAYLIGHT 1 #define SETPGRP_VOID 1 #define inline __inline #define NEED_IO_SEEK_BETWEEN_RW 1 #define RSHIFT(x,y) ((x)>>(int)y) #define FILE_COUNT _cnt #define FILE_READPTR _ptr #define DEFAULT_KCODE KCODE_NONE #define DLEXT ".so" #define DLEXT2 ".dll" jq-1.8.2/vendor/oniguruma/src/regcomp.c0000644000175100017510000061061015215513537013524 /********************************************************************** regcomp.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regparse.h" #define OPS_INIT_SIZE 8 #define ND_IS_REAL_IGNORECASE(node) \ (ND_IS_IGNORECASE(node) && !ND_STRING_IS_CRUDE(node)) typedef struct { OnigLen min; OnigLen max; } MinMaxLen; typedef struct { OnigLen min; OnigLen max; int min_is_sure; } MinMaxCharLen; OnigCaseFoldType OnigDefaultCaseFoldFlag = ONIGENC_CASE_FOLD_MIN; static OnigLen node_min_byte_len(Node* node, ParseEnv* env); static int ops_init(regex_t* reg, int init_alloc_size) { Operation* p; size_t size; if (init_alloc_size <= 0) return ONIGERR_PARSER_BUG; size = sizeof(Operation) * init_alloc_size; p = (Operation* )xrealloc(reg->ops, size); CHECK_NULL_RETURN_MEMERR(p); reg->ops = p; #ifdef USE_DIRECT_THREADED_CODE { enum OpCode* cp; size = sizeof(enum OpCode) * init_alloc_size; cp = (enum OpCode* )xrealloc(reg->ocs, size); CHECK_NULL_RETURN_MEMERR(cp); reg->ocs = cp; } #endif reg->ops_curr = 0; /* !!! not yet done ops_new() */ reg->ops_alloc = init_alloc_size; reg->ops_used = 0; return ONIG_NORMAL; } static int ops_resize(regex_t* reg, int n) { #ifdef USE_DIRECT_THREADED_CODE enum OpCode* cp; #endif Operation* p; size_t size; if (n == reg->ops_alloc) return ONIG_NORMAL; if (n <= 0) return ONIGERR_PARSER_BUG; size = sizeof(Operation) * n; p = (Operation* )xrealloc(reg->ops, size); CHECK_NULL_RETURN_MEMERR(p); reg->ops = p; #ifdef USE_DIRECT_THREADED_CODE size = sizeof(enum OpCode) * n; cp = (enum OpCode* )xrealloc(reg->ocs, size); CHECK_NULL_RETURN_MEMERR(cp); reg->ocs = cp; #endif reg->ops_alloc = n; if (reg->ops_used == 0) reg->ops_curr = 0; else reg->ops_curr = reg->ops + (reg->ops_used - 1); return ONIG_NORMAL; } static int ops_new(regex_t* reg) { if (reg->ops_used >= reg->ops_alloc) { int r = ops_resize(reg, reg->ops_alloc << 1); if (r != ONIG_NORMAL) return r; } reg->ops_curr = reg->ops + reg->ops_used; reg->ops_used++; xmemset(reg->ops_curr, 0, sizeof(Operation)); return ONIG_NORMAL; } static int is_in_string_pool(regex_t* reg, UChar* s) { return (s >= reg->string_pool && s < reg->string_pool_end); } static void ops_free(regex_t* reg) { int i; if (IS_NULL(reg->ops)) return ; for (i = 0; i < (int )reg->ops_used; i++) { enum OpCode opcode; Operation* op; op = reg->ops + i; #ifdef USE_DIRECT_THREADED_CODE opcode = *(reg->ocs + i); #else opcode = op->opcode; #endif switch (opcode) { case OP_STR_MBN: if (! is_in_string_pool(reg, op->exact_len_n.s)) xfree(op->exact_len_n.s); break; case OP_STR_N: case OP_STR_MB2N: case OP_STR_MB3N: if (! is_in_string_pool(reg, op->exact_n.s)) xfree(op->exact_n.s); break; case OP_STR_1: case OP_STR_2: case OP_STR_3: case OP_STR_4: case OP_STR_5: case OP_STR_MB2N1: case OP_STR_MB2N2: case OP_STR_MB2N3: break; case OP_CCLASS_NOT: case OP_CCLASS: xfree(op->cclass.bsp); break; case OP_CCLASS_MB_NOT: case OP_CCLASS_MB: xfree(op->cclass_mb.mb); break; case OP_CCLASS_MIX_NOT: case OP_CCLASS_MIX: xfree(op->cclass_mix.mb); xfree(op->cclass_mix.bsp); break; case OP_BACKREF1: case OP_BACKREF2: case OP_BACKREF_N: case OP_BACKREF_N_IC: break; case OP_BACKREF_MULTI: case OP_BACKREF_MULTI_IC: case OP_BACKREF_CHECK: #ifdef USE_BACKREF_WITH_LEVEL case OP_BACKREF_WITH_LEVEL: case OP_BACKREF_WITH_LEVEL_IC: case OP_BACKREF_CHECK_WITH_LEVEL: #endif if (op->backref_general.num != 1) xfree(op->backref_general.ns); break; default: break; } } xfree(reg->ops); #ifdef USE_DIRECT_THREADED_CODE xfree(reg->ocs); reg->ocs = 0; #endif reg->ops = 0; reg->ops_curr = 0; reg->ops_alloc = 0; reg->ops_used = 0; } static int ops_calc_size_of_string_pool(regex_t* reg) { int i; int total; if (IS_NULL(reg->ops)) return 0; total = 0; for (i = 0; i < (int )reg->ops_used; i++) { enum OpCode opcode; Operation* op; op = reg->ops + i; #ifdef USE_DIRECT_THREADED_CODE opcode = *(reg->ocs + i); #else opcode = op->opcode; #endif switch (opcode) { case OP_STR_MBN: total += op->exact_len_n.len * op->exact_len_n.n; break; case OP_STR_N: case OP_STR_MB2N: total += op->exact_n.n * 2; break; case OP_STR_MB3N: total += op->exact_n.n * 3; break; default: break; } } return total; } static int ops_make_string_pool(regex_t* reg) { int i; int len; int size; UChar* pool; UChar* curr; size = ops_calc_size_of_string_pool(reg); if (size <= 0) { return 0; } curr = pool = (UChar* )xmalloc((size_t )size); CHECK_NULL_RETURN_MEMERR(pool); for (i = 0; i < (int )reg->ops_used; i++) { enum OpCode opcode; Operation* op; op = reg->ops + i; #ifdef USE_DIRECT_THREADED_CODE opcode = *(reg->ocs + i); #else opcode = op->opcode; #endif switch (opcode) { case OP_STR_MBN: len = op->exact_len_n.len * op->exact_len_n.n; xmemcpy(curr, op->exact_len_n.s, len); xfree(op->exact_len_n.s); op->exact_len_n.s = curr; curr += len; break; case OP_STR_N: len = op->exact_n.n; copy: xmemcpy(curr, op->exact_n.s, len); xfree(op->exact_n.s); op->exact_n.s = curr; curr += len; break; case OP_STR_MB2N: len = op->exact_n.n * 2; goto copy; break; case OP_STR_MB3N: len = op->exact_n.n * 3; goto copy; break; default: break; } } reg->string_pool = pool; reg->string_pool_end = pool + size; return 0; } extern OnigCaseFoldType onig_get_default_case_fold_flag(void) { return OnigDefaultCaseFoldFlag; } extern int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag) { OnigDefaultCaseFoldFlag = case_fold_flag; return 0; } static int len_multiply_cmp(OnigLen x, int y, OnigLen v) { if (x == 0 || y == 0) return -1; if (x < INFINITE_LEN / y) { OnigLen xy = x * (OnigLen )y; if (xy > v) return 1; else { if (xy == v) return 0; else return -1; } } else return v == INFINITE_LEN ? 0 : 1; } extern int onig_positive_int_multiply(int x, int y) { if (x == 0 || y == 0) return 0; if (x < ONIG_INT_MAX / y) return x * y; else return -1; } static void node_swap(Node* a, Node* b) { Node c; c = *a; *a = *b; *b = c; if (ND_TYPE(a) == ND_STRING) { StrNode* sn = STR_(a); if (sn->capacity == 0) { int len = (int )(sn->end - sn->s); sn->s = sn->buf; sn->end = sn->s + len; } } if (ND_TYPE(b) == ND_STRING) { StrNode* sn = STR_(b); if (sn->capacity == 0) { int len = (int )(sn->end - sn->s); sn->s = sn->buf; sn->end = sn->s + len; } } } static int node_list_len(Node* list) { int len; len = 1; while (IS_NOT_NULL(ND_CDR(list))) { list = ND_CDR(list); len++; } return len; } static Node* node_list_add(Node* list, Node* x) { Node *n; n = onig_node_new_list(x, NULL); if (IS_NULL(n)) return NULL_NODE; if (IS_NOT_NULL(list)) { while (IS_NOT_NULL(ND_CDR(list))) list = ND_CDR(list); ND_CDR(list) = n; } return n; } static int node_str_node_cat(Node* node, Node* add) { int r; if (ND_STATUS(node) != ND_STATUS(add)) return ONIGERR_TYPE_BUG; if (STR_(node)->flag != STR_(add)->flag) return ONIGERR_TYPE_BUG; r = onig_node_str_cat(node, STR_(add)->s, STR_(add)->end); if (r != 0) return r; return 0; } static void node_conv_to_str_node(Node* node, Node* ref_node) { xmemset(node, 0, sizeof(*node)); ND_SET_TYPE(node, ND_STRING); ND_STATUS(node) = ND_STATUS(ref_node); STR_(node)->flag = STR_(ref_node)->flag; STR_(node)->s = STR_(node)->buf; STR_(node)->end = STR_(node)->buf; STR_(node)->capacity = 0; } static OnigLen distance_add(OnigLen d1, OnigLen d2) { if (d1 == INFINITE_LEN || d2 == INFINITE_LEN) return INFINITE_LEN; else { if (d1 <= INFINITE_LEN - d2) return d1 + d2; else return INFINITE_LEN; } } static OnigLen distance_multiply(OnigLen d, int m) { if (m == 0) return 0; if (d < INFINITE_LEN / m) return d * m; else return INFINITE_LEN; } static int bitset_is_empty(BitSetRef bs) { int i; for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { if (bs[i] != 0) return 0; } return 1; } #ifdef USE_CALL static int unset_addr_list_init(UnsetAddrList* list, int size) { UnsetAddr* p = (UnsetAddr* )xmalloc(sizeof(UnsetAddr)* size); CHECK_NULL_RETURN_MEMERR(p); list->num = 0; list->alloc = size; list->us = p; return 0; } static void unset_addr_list_end(UnsetAddrList* list) { if (IS_NOT_NULL(list->us)) xfree(list->us); } static int unset_addr_list_add(UnsetAddrList* list, int offset, struct _Node* node) { UnsetAddr* p; int size; if (list->num >= list->alloc) { size = list->alloc * 2; p = (UnsetAddr* )xrealloc(list->us, sizeof(UnsetAddr) * size); CHECK_NULL_RETURN_MEMERR(p); list->alloc = size; list->us = p; } list->us[list->num].offset = offset; list->us[list->num].target = node; list->num++; return 0; } #endif /* USE_CALL */ enum CharLenReturnType { CHAR_LEN_NORMAL = 0, /* fixed or variable */ CHAR_LEN_TOP_ALT_FIXED = 1 }; static int mmcl_fixed(MinMaxCharLen* c) { return (c->min == c->max && c->min != INFINITE_LEN); } static void mmcl_set(MinMaxCharLen* l, OnigLen len) { l->min = len; l->max = len; l->min_is_sure = TRUE; } static void mmcl_set_min_max(MinMaxCharLen* l, OnigLen min, OnigLen max, int min_is_sure) { l->min = min; l->max = max; l->min_is_sure = min_is_sure; } static void mmcl_add(MinMaxCharLen* to, MinMaxCharLen* add) { to->min = distance_add(to->min, add->min); to->max = distance_add(to->max, add->max); to->min_is_sure = add->min_is_sure != FALSE && to->min_is_sure != FALSE; } static void mmcl_multiply(MinMaxCharLen* to, int m) { to->min = distance_multiply(to->min, m); to->max = distance_multiply(to->max, m); } static void mmcl_repeat_range_multiply(MinMaxCharLen* to, int mlow, int mhigh) { to->min = distance_multiply(to->min, mlow); if (IS_INFINITE_REPEAT(mhigh)) to->max = INFINITE_LEN; else to->max = distance_multiply(to->max, mhigh); } static void mmcl_alt_merge(MinMaxCharLen* to, MinMaxCharLen* alt) { if (to->min > alt->min) { to->min = alt->min; to->min_is_sure = alt->min_is_sure; } else if (to->min == alt->min) { if (alt->min_is_sure != FALSE) to->min_is_sure = TRUE; } if (to->max < alt->max) to->max = alt->max; } #ifndef ONIG_DONT_OPTIMIZE static int mml_is_equal(MinMaxLen* a, MinMaxLen* b) { return a->min == b->min && a->max == b->max; } static void mml_set_min_max(MinMaxLen* l, OnigLen min, OnigLen max) { l->min = min; l->max = max; } static void mml_clear(MinMaxLen* l) { l->min = l->max = 0; } static void mml_copy(MinMaxLen* to, MinMaxLen* from) { to->min = from->min; to->max = from->max; } static void mml_add(MinMaxLen* to, MinMaxLen* add) { to->min = distance_add(to->min, add->min); to->max = distance_add(to->max, add->max); } static void mml_alt_merge(MinMaxLen* to, MinMaxLen* alt) { if (to->min > alt->min) to->min = alt->min; if (to->max < alt->max) to->max = alt->max; } #endif /* fixed size pattern node only */ static int node_char_len1(Node* node, regex_t* reg, MinMaxCharLen* ci, ParseEnv* env, int level) { MinMaxCharLen tci; int r = CHAR_LEN_NORMAL; level++; switch (ND_TYPE(node)) { case ND_LIST: { int first = TRUE; do { r = node_char_len1(ND_CAR(node), reg, &tci, env, level); if (r < 0) break; if (first == TRUE) { *ci = tci; first = FALSE; } else mmcl_add(ci, &tci); } while (IS_NOT_NULL(node = ND_CDR(node))); } break; case ND_ALT: { int fixed; r = node_char_len1(ND_CAR(node), reg, ci, env, level); if (r < 0) break; fixed = TRUE; while (IS_NOT_NULL(node = ND_CDR(node))) { r = node_char_len1(ND_CAR(node), reg, &tci, env, level); if (r < 0) break; if (! mmcl_fixed(&tci)) fixed = FALSE; mmcl_alt_merge(ci, &tci); } if (r < 0) break; r = CHAR_LEN_NORMAL; if (mmcl_fixed(ci)) break; if (fixed == TRUE && level == 1) { r = CHAR_LEN_TOP_ALT_FIXED; } } break; case ND_STRING: { OnigLen clen; StrNode* sn = STR_(node); UChar *s = sn->s; if (ND_IS_REAL_IGNORECASE(node) && CASE_FOLD_IS_NOT_ASCII_ONLY(env->case_fold_flag)) { /* Such a case is possible. ex. /(?i)(?<=\1)(a)/ Backref node refer to capture group, but it doesn't tune yet. */ r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; break; } clen = 0; while (s < sn->end) { s += enclen(reg->enc, s); clen = distance_add(clen, 1); } mmcl_set(ci, clen); } break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->lower == qn->upper) { if (qn->upper == 0) { mmcl_set(ci, 0); } else { r = node_char_len1(ND_BODY(node), reg, ci, env, level); if (r < 0) break; mmcl_multiply(ci, qn->lower); } } else { r = node_char_len1(ND_BODY(node), reg, ci, env, level); if (r < 0) break; mmcl_repeat_range_multiply(ci, qn->lower, qn->upper); } } break; #ifdef USE_CALL case ND_CALL: if (ND_IS_RECURSION(node)) mmcl_set_min_max(ci, 0, INFINITE_LEN, FALSE); else r = node_char_len1(ND_BODY(node), reg, ci, env, level); break; #endif case ND_CTYPE: case ND_CCLASS: mmcl_set(ci, 1); break; case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_MEMORY: if (ND_IS_FIXED_CLEN(node)) { mmcl_set_min_max(ci, en->min_char_len, en->max_char_len, ND_IS_FIXED_CLEN_MIN_SURE(node)); } else { if (ND_IS_MARK1(node)) { mmcl_set_min_max(ci, 0, INFINITE_LEN, FALSE); } else { ND_STATUS_ADD(node, MARK1); r = node_char_len1(ND_BODY(node), reg, ci, env, level); ND_STATUS_REMOVE(node, MARK1); if (r < 0) break; en->min_char_len = ci->min; en->max_char_len = ci->max; ND_STATUS_ADD(node, FIXED_CLEN); if (ci->min_is_sure != FALSE) ND_STATUS_ADD(node, FIXED_CLEN_MIN_SURE); } } /* can't optimize look-behind if capture exists. */ ci->min_is_sure = FALSE; break; case BAG_OPTION: case BAG_STOP_BACKTRACK: r = node_char_len1(ND_BODY(node), reg, ci, env, level); break; case BAG_IF_ELSE: { MinMaxCharLen eci; r = node_char_len1(ND_BODY(node), reg, ci, env, level); if (r < 0) break; if (IS_NOT_NULL(en->te.Then)) { r = node_char_len1(en->te.Then, reg, &tci, env, level); if (r < 0) break; mmcl_add(ci, &tci); } if (IS_NOT_NULL(en->te.Else)) { r = node_char_len1(en->te.Else, reg, &eci, env, level); if (r < 0) break; } else { mmcl_set(&eci, 0); } mmcl_alt_merge(ci, &eci); } break; default: /* never come here */ r = ONIGERR_PARSER_BUG; break; } } break; case ND_GIMMICK: mmcl_set(ci, 0); break; case ND_ANCHOR: zero: mmcl_set(ci, 0); /* can't optimize look-behind if anchor exists. */ ci->min_is_sure = FALSE; break; case ND_BACKREF: if (ND_IS_CHECKER(node)) goto zero; if (ND_IS_RECURSION(node)) { #ifdef USE_BACKREF_WITH_LEVEL if (ND_IS_NEST_LEVEL(node)) { mmcl_set_min_max(ci, 0, INFINITE_LEN, FALSE); break; } #endif mmcl_set_min_max(ci, 0, 0, FALSE); break; } { int i; int* backs; MemEnv* mem_env = PARSEENV_MEMENV(env); BackRefNode* br = BACKREF_(node); backs = BACKREFS_P(br); r = node_char_len1(mem_env[backs[0]].mem_node, reg, ci, env, level); if (r < 0) break; if (! mmcl_fixed(ci)) ci->min_is_sure = FALSE; for (i = 1; i < br->back_num; i++) { r = node_char_len1(mem_env[backs[i]].mem_node, reg, &tci, env, level); if (r < 0) break; if (! mmcl_fixed(&tci)) tci.min_is_sure = FALSE; mmcl_alt_merge(ci, &tci); } } break; default: /* never come here */ r = ONIGERR_PARSER_BUG; break; } return r; } static int node_char_len(Node* node, regex_t* reg, MinMaxCharLen* ci, ParseEnv* env) { return node_char_len1(node, reg, ci, env, 0); } static int add_op(regex_t* reg, int opcode) { int r; r = ops_new(reg); if (r != ONIG_NORMAL) return r; #ifdef USE_DIRECT_THREADED_CODE *(reg->ocs + (reg->ops_curr - reg->ops)) = opcode; #else reg->ops_curr->opcode = opcode; #endif return 0; } static int compile_length_tree(Node* node, regex_t* reg, ParseEnv* env); static int compile_tree(Node* node, regex_t* reg, ParseEnv* env); #define IS_NEED_STR_LEN_OP(op) \ ((op) == OP_STR_N || (op) == OP_STR_MB2N ||\ (op) == OP_STR_MB3N || (op) == OP_STR_MBN) static int select_str_opcode(int mb_len, int str_len) { int op; switch (mb_len) { case 1: switch (str_len) { case 1: op = OP_STR_1; break; case 2: op = OP_STR_2; break; case 3: op = OP_STR_3; break; case 4: op = OP_STR_4; break; case 5: op = OP_STR_5; break; default: op = OP_STR_N; break; } break; case 2: switch (str_len) { case 1: op = OP_STR_MB2N1; break; case 2: op = OP_STR_MB2N2; break; case 3: op = OP_STR_MB2N3; break; default: op = OP_STR_MB2N; break; } break; case 3: op = OP_STR_MB3N; break; default: op = OP_STR_MBN; break; } return op; } static int is_strict_real_node(Node* node) { switch (ND_TYPE(node)) { case ND_STRING: { StrNode* sn = STR_(node); return (sn->end != sn->s); } break; case ND_CCLASS: case ND_CTYPE: return 1; break; default: return 0; break; } } static int compile_quant_body_with_empty_check(QuantNode* qn, regex_t* reg, ParseEnv* env) { int r; int saved_num_empty_check; int emptiness; Node* body; body = ND_BODY((Node* )qn); emptiness = qn->emptiness; saved_num_empty_check = reg->num_empty_check; if (emptiness != BODY_IS_NOT_EMPTY) { r = add_op(reg, OP_EMPTY_CHECK_START); if (r != 0) return r; COP(reg)->empty_check_start.mem = reg->num_empty_check; /* NULL CHECK ID */ reg->num_empty_check++; } r = compile_tree(body, reg, env); if (r != 0) return r; if (emptiness != BODY_IS_NOT_EMPTY) { if (emptiness == BODY_MAY_BE_EMPTY) r = add_op(reg, OP_EMPTY_CHECK_END); else if (emptiness == BODY_MAY_BE_EMPTY_MEM) { if (ND_IS_EMPTY_STATUS_CHECK(qn) != 0 && qn->empty_status_mem != 0) { r = add_op(reg, OP_EMPTY_CHECK_END_MEMST); if (r != 0) return r; COP(reg)->empty_check_end.empty_status_mem = qn->empty_status_mem; } else r = add_op(reg, OP_EMPTY_CHECK_END); } #ifdef USE_CALL else if (emptiness == BODY_MAY_BE_EMPTY_REC) { r = add_op(reg, OP_EMPTY_CHECK_END_MEMST_PUSH); if (r != 0) return r; COP(reg)->empty_check_end.empty_status_mem = qn->empty_status_mem; } #endif if (r != 0) return r; COP(reg)->empty_check_end.mem = saved_num_empty_check; /* NULL CHECK ID */ } return r; } #ifdef USE_CALL static int compile_call(CallNode* node, regex_t* reg, ParseEnv* env) { int r; int offset; r = add_op(reg, OP_CALL); if (r != 0) return r; COP(reg)->call.addr = 0; /* dummy addr. */ #ifdef ONIG_DEBUG_MATCH_COUNTER COP(reg)->call.called_mem = node->called_gnum; #endif offset = COP_CURR_OFFSET_BYTES(reg, call.addr); r = unset_addr_list_add(env->unset_addr_list, offset, ND_CALL_BODY(node)); return r; } #endif static int compile_tree_n_times(Node* node, int n, regex_t* reg, ParseEnv* env) { int i, r; for (i = 0; i < n; i++) { r = compile_tree(node, reg, env); if (r != 0) return r; } return 0; } static int add_compile_string_length(UChar* s ARG_UNUSED, int mb_len, int str_len, regex_t* reg ARG_UNUSED) { return 1; } static int add_compile_string(UChar* s, int mb_len, int str_len, regex_t* reg) { int op; int r; int byte_len; UChar* p; UChar* end; op = select_str_opcode(mb_len, str_len); r = add_op(reg, op); if (r != 0) return r; byte_len = mb_len * str_len; end = s + byte_len; if (op == OP_STR_MBN) { p = onigenc_strdup(reg->enc, s, end); CHECK_NULL_RETURN_MEMERR(p); COP(reg)->exact_len_n.len = mb_len; COP(reg)->exact_len_n.n = str_len; COP(reg)->exact_len_n.s = p; } else if (IS_NEED_STR_LEN_OP(op)) { p = onigenc_strdup(reg->enc, s, end); CHECK_NULL_RETURN_MEMERR(p); COP(reg)->exact_n.n = str_len; COP(reg)->exact_n.s = p; } else { xmemset(COP(reg)->exact.s, 0, sizeof(COP(reg)->exact.s)); xmemcpy(COP(reg)->exact.s, s, (size_t )byte_len); } return 0; } static int compile_length_string_node(Node* node, regex_t* reg) { int rlen, r, len, prev_len, slen; UChar *p, *prev; StrNode* sn; OnigEncoding enc = reg->enc; sn = STR_(node); if (sn->end <= sn->s) return 0; p = prev = sn->s; prev_len = enclen(enc, p); p += prev_len; slen = 1; rlen = 0; for (; p < sn->end; ) { len = enclen(enc, p); if (len == prev_len) { slen++; } else { r = add_compile_string_length(prev, prev_len, slen, reg); rlen += r; prev = p; slen = 1; prev_len = len; } p += len; } r = add_compile_string_length(prev, prev_len, slen, reg); rlen += r; return rlen; } static int compile_length_string_crude_node(StrNode* sn, regex_t* reg) { if (sn->end <= sn->s) return 0; return add_compile_string_length(sn->s, 1 /* sb */, (int )(sn->end - sn->s), reg); } static int compile_string_node(Node* node, regex_t* reg) { int r, len, prev_len, slen; UChar *p, *prev, *end; StrNode* sn; OnigEncoding enc = reg->enc; sn = STR_(node); if (sn->end <= sn->s) return 0; end = sn->end; p = prev = sn->s; prev_len = enclen(enc, p); p += prev_len; slen = 1; for (; p < end; ) { len = enclen(enc, p); if (len == prev_len) { slen++; } else { r = add_compile_string(prev, prev_len, slen, reg); if (r != 0) return r; prev = p; slen = 1; prev_len = len; } p += len; } return add_compile_string(prev, prev_len, slen, reg); } static int compile_string_crude_node(StrNode* sn, regex_t* reg) { if (sn->end <= sn->s) return 0; return add_compile_string(sn->s, 1 /* sb */, (int )(sn->end - sn->s), reg); } static void* set_multi_byte_cclass(BBuf* mbuf, regex_t* reg) { size_t len; void* p; len = (size_t )mbuf->used; p = xmalloc(len); if (IS_NULL(p)) return NULL; xmemcpy(p, mbuf->p, len); return p; } static int compile_length_cclass_node(CClassNode* cc, regex_t* reg) { return 1; } static int compile_cclass_node(CClassNode* cc, regex_t* reg) { int r; if (IS_NULL(cc->mbuf)) { r = add_op(reg, IS_NCCLASS_NOT(cc) ? OP_CCLASS_NOT : OP_CCLASS); if (r != 0) return r; COP(reg)->cclass.bsp = xmalloc(SIZE_BITSET); CHECK_NULL_RETURN_MEMERR(COP(reg)->cclass.bsp); xmemcpy(COP(reg)->cclass.bsp, cc->bs, SIZE_BITSET); } else { void* p; if (ONIGENC_MBC_MINLEN(reg->enc) > 1 || bitset_is_empty(cc->bs)) { r = add_op(reg, IS_NCCLASS_NOT(cc) ? OP_CCLASS_MB_NOT : OP_CCLASS_MB); if (r != 0) return r; p = set_multi_byte_cclass(cc->mbuf, reg); CHECK_NULL_RETURN_MEMERR(p); COP(reg)->cclass_mb.mb = p; } else { r = add_op(reg, IS_NCCLASS_NOT(cc) ? OP_CCLASS_MIX_NOT : OP_CCLASS_MIX); if (r != 0) return r; COP(reg)->cclass_mix.bsp = xmalloc(SIZE_BITSET); CHECK_NULL_RETURN_MEMERR(COP(reg)->cclass_mix.bsp); xmemcpy(COP(reg)->cclass_mix.bsp, cc->bs, SIZE_BITSET); p = set_multi_byte_cclass(cc->mbuf, reg); CHECK_NULL_RETURN_MEMERR(p); COP(reg)->cclass_mix.mb = p; } } return 0; } static void set_addr_in_repeat_range(regex_t* reg) { int i; for (i = 0; i < reg->num_repeat; i++) { RepeatRange* p = reg->repeat_range + i; int offset = p->u.offset; p->u.pcode = reg->ops + offset; } } static int entry_repeat_range(regex_t* reg, int id, int lower, int upper, int ops_index) { #define REPEAT_RANGE_ALLOC 4 RepeatRange* p; if (reg->repeat_range_alloc == 0) { p = (RepeatRange* )xmalloc(sizeof(RepeatRange) * REPEAT_RANGE_ALLOC); CHECK_NULL_RETURN_MEMERR(p); reg->repeat_range = p; reg->repeat_range_alloc = REPEAT_RANGE_ALLOC; } else if (reg->repeat_range_alloc <= id) { int n; n = reg->repeat_range_alloc + REPEAT_RANGE_ALLOC; p = (RepeatRange* )xrealloc(reg->repeat_range, sizeof(RepeatRange) * n); CHECK_NULL_RETURN_MEMERR(p); reg->repeat_range = p; reg->repeat_range_alloc = n; } else { p = reg->repeat_range; } p[id].lower = lower; p[id].upper = (IS_INFINITE_REPEAT(upper) ? 0x7fffffff : upper); p[id].u.offset = ops_index; return 0; } static int compile_range_repeat_node(QuantNode* qn, int target_len, int emptiness, regex_t* reg, ParseEnv* env) { int r; int num_repeat = reg->num_repeat++; r = add_op(reg, qn->greedy ? OP_REPEAT : OP_REPEAT_NG); if (r != 0) return r; COP(reg)->repeat.id = num_repeat; COP(reg)->repeat.addr = SIZE_INC + target_len + OPSIZE_REPEAT_INC; r = entry_repeat_range(reg, num_repeat, qn->lower, qn->upper, COP_CURR_OFFSET(reg) + OPSIZE_REPEAT); if (r != 0) return r; r = compile_quant_body_with_empty_check(qn, reg, env); if (r != 0) return r; r = add_op(reg, qn->greedy ? OP_REPEAT_INC : OP_REPEAT_INC_NG); if (r != 0) return r; COP(reg)->repeat_inc.id = num_repeat; return r; } static int is_anychar_infinite_greedy(QuantNode* qn) { if (qn->greedy && IS_INFINITE_REPEAT(qn->upper) && ND_IS_ANYCHAR(ND_QUANT_BODY(qn))) return 1; else return 0; } #define QUANTIFIER_EXPAND_LIMIT_SIZE 10 #define CKN_ON (ckn > 0) static int compile_length_quantifier_node(QuantNode* qn, regex_t* reg, ParseEnv* env) { int len, mod_tlen; int infinite = IS_INFINITE_REPEAT(qn->upper); enum BodyEmptyType emptiness = qn->emptiness; int tlen = compile_length_tree(ND_QUANT_BODY(qn), reg, env); if (tlen < 0) return tlen; if (tlen == 0) return 0; /* anychar repeat */ if (is_anychar_infinite_greedy(qn)) { if (qn->lower <= 1 || len_multiply_cmp((OnigLen )tlen, qn->lower, QUANTIFIER_EXPAND_LIMIT_SIZE) <= 0) { if (IS_NOT_NULL(qn->next_head_exact)) return OPSIZE_ANYCHAR_STAR_PEEK_NEXT + tlen * qn->lower; else return OPSIZE_ANYCHAR_STAR + tlen * qn->lower; } } mod_tlen = tlen; if (emptiness != BODY_IS_NOT_EMPTY) mod_tlen += OPSIZE_EMPTY_CHECK_START + OPSIZE_EMPTY_CHECK_END; if (infinite && (qn->lower <= 1 || len_multiply_cmp(tlen, qn->lower, QUANTIFIER_EXPAND_LIMIT_SIZE) <= 0)) { if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) { len = OPSIZE_JUMP; } else { len = tlen * qn->lower; } if (qn->greedy) { #ifdef USE_OP_PUSH_OR_JUMP_EXACT if (IS_NOT_NULL(qn->head_exact)) len += OPSIZE_PUSH_OR_JUMP_EXACT1 + mod_tlen + OPSIZE_JUMP; else #endif if (IS_NOT_NULL(qn->next_head_exact)) len += OPSIZE_PUSH_IF_PEEK_NEXT + mod_tlen + OPSIZE_JUMP; else len += OPSIZE_PUSH + mod_tlen + OPSIZE_JUMP; } else len += OPSIZE_JUMP + mod_tlen + OPSIZE_PUSH; } else if (qn->upper == 0) { if (qn->include_referred != 0) { /* /(?..){0}/ */ len = OPSIZE_JUMP + tlen; } else len = 0; } else if (!infinite && qn->greedy && (qn->upper == 1 || len_multiply_cmp((OnigLen )tlen + OPSIZE_PUSH, qn->upper, QUANTIFIER_EXPAND_LIMIT_SIZE) <= 0)) { len = tlen * qn->lower; len += (OPSIZE_PUSH + tlen) * (qn->upper - qn->lower); } else if (!qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ len = OPSIZE_PUSH + OPSIZE_JUMP + tlen; } else { len = OPSIZE_REPEAT_INC + mod_tlen + OPSIZE_REPEAT; } return len; } static int compile_quantifier_node(QuantNode* qn, regex_t* reg, ParseEnv* env) { int i, r, mod_tlen; int infinite = IS_INFINITE_REPEAT(qn->upper); enum BodyEmptyType emptiness = qn->emptiness; int tlen = compile_length_tree(ND_QUANT_BODY(qn), reg, env); if (tlen < 0) return tlen; if (tlen == 0) return 0; if (is_anychar_infinite_greedy(qn) && (qn->lower <= 1 || len_multiply_cmp((OnigLen )tlen, qn->lower, QUANTIFIER_EXPAND_LIMIT_SIZE) <= 0)) { r = compile_tree_n_times(ND_QUANT_BODY(qn), qn->lower, reg, env); if (r != 0) return r; if (IS_NOT_NULL(qn->next_head_exact)) { r = add_op(reg, ND_IS_MULTILINE(ND_QUANT_BODY(qn)) ? OP_ANYCHAR_ML_STAR_PEEK_NEXT : OP_ANYCHAR_STAR_PEEK_NEXT); if (r != 0) return r; COP(reg)->anychar_star_peek_next.c = STR_(qn->next_head_exact)->s[0]; return 0; } else { r = add_op(reg, ND_IS_MULTILINE(ND_QUANT_BODY(qn)) ? OP_ANYCHAR_ML_STAR : OP_ANYCHAR_STAR); return r; } } mod_tlen = tlen; if (emptiness != BODY_IS_NOT_EMPTY) mod_tlen += OPSIZE_EMPTY_CHECK_START + OPSIZE_EMPTY_CHECK_END; if (infinite && (qn->lower <= 1 || len_multiply_cmp((OnigLen )tlen, qn->lower, QUANTIFIER_EXPAND_LIMIT_SIZE) <= 0)) { int addr; if (qn->lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) { r = add_op(reg, OP_JUMP); if (r != 0) return r; if (qn->greedy) { #ifdef USE_OP_PUSH_OR_JUMP_EXACT if (IS_NOT_NULL(qn->head_exact)) COP(reg)->jump.addr = OPSIZE_PUSH_OR_JUMP_EXACT1 + SIZE_INC; else #endif if (IS_NOT_NULL(qn->next_head_exact)) COP(reg)->jump.addr = OPSIZE_PUSH_IF_PEEK_NEXT + SIZE_INC; else COP(reg)->jump.addr = OPSIZE_PUSH + SIZE_INC; } else { COP(reg)->jump.addr = OPSIZE_JUMP + SIZE_INC; } } else { r = compile_tree_n_times(ND_QUANT_BODY(qn), qn->lower, reg, env); if (r != 0) return r; } if (qn->greedy) { #ifdef USE_OP_PUSH_OR_JUMP_EXACT if (IS_NOT_NULL(qn->head_exact)) { r = add_op(reg, OP_PUSH_OR_JUMP_EXACT1); if (r != 0) return r; COP(reg)->push_or_jump_exact1.addr = SIZE_INC + mod_tlen + OPSIZE_JUMP; COP(reg)->push_or_jump_exact1.c = STR_(qn->head_exact)->s[0]; r = compile_quant_body_with_empty_check(qn, reg, env); if (r != 0) return r; addr = -(mod_tlen + (int )OPSIZE_PUSH_OR_JUMP_EXACT1); } else #endif if (IS_NOT_NULL(qn->next_head_exact)) { r = add_op(reg, OP_PUSH_IF_PEEK_NEXT); if (r != 0) return r; COP(reg)->push_if_peek_next.addr = SIZE_INC + mod_tlen + OPSIZE_JUMP; COP(reg)->push_if_peek_next.c = STR_(qn->next_head_exact)->s[0]; r = compile_quant_body_with_empty_check(qn, reg, env); if (r != 0) return r; addr = -(mod_tlen + (int )OPSIZE_PUSH_IF_PEEK_NEXT); } else { r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + mod_tlen + OPSIZE_JUMP; r = compile_quant_body_with_empty_check(qn, reg, env); if (r != 0) return r; addr = -(mod_tlen + (int )OPSIZE_PUSH); } r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = addr; } else { r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = mod_tlen + SIZE_INC; r = compile_quant_body_with_empty_check(qn, reg, env); if (r != 0) return r; r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = -mod_tlen; } } else if (qn->upper == 0) { if (qn->include_referred != 0) { /* /(?..){0}/ */ r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = tlen + SIZE_INC; r = compile_tree(ND_QUANT_BODY(qn), reg, env); } else { /* Nothing output */ r = 0; } } else if (! infinite && qn->greedy && (qn->upper == 1 || len_multiply_cmp((OnigLen )tlen + OPSIZE_PUSH, qn->upper, QUANTIFIER_EXPAND_LIMIT_SIZE) <= 0)) { int n = qn->upper - qn->lower; r = compile_tree_n_times(ND_QUANT_BODY(qn), qn->lower, reg, env); if (r != 0) return r; for (i = 0; i < n; i++) { int v = onig_positive_int_multiply(n - i, tlen + OPSIZE_PUSH); if (v < 0) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = v; r = compile_tree(ND_QUANT_BODY(qn), reg, env); if (r != 0) return r; } } else if (! qn->greedy && qn->upper == 1 && qn->lower == 0) { /* '??' */ r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + OPSIZE_JUMP; r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = tlen + SIZE_INC; r = compile_tree(ND_QUANT_BODY(qn), reg, env); } else { r = compile_range_repeat_node(qn, mod_tlen, emptiness, reg, env); } return r; } static int compile_length_option_node(BagNode* node, regex_t* reg, ParseEnv* env) { int tlen; tlen = compile_length_tree(ND_BAG_BODY(node), reg, env); return tlen; } static int compile_option_node(BagNode* node, regex_t* reg, ParseEnv* env) { int r; r = compile_tree(ND_BAG_BODY(node), reg, env); return r; } static int compile_length_bag_node(BagNode* node, regex_t* reg, ParseEnv* env) { int len; int tlen; if (node->type == BAG_OPTION) return compile_length_option_node(node, reg, env); if (ND_BAG_BODY(node)) { tlen = compile_length_tree(ND_BAG_BODY(node), reg, env); if (tlen < 0) return tlen; } else tlen = 0; switch (node->type) { case BAG_MEMORY: #ifdef USE_CALL if (node->m.regnum == 0 && ND_IS_CALLED(node)) { len = tlen + OPSIZE_CALL + OPSIZE_JUMP + OPSIZE_RETURN; return len; } if (ND_IS_CALLED(node)) { len = OPSIZE_MEM_START_PUSH + tlen + OPSIZE_CALL + OPSIZE_JUMP + OPSIZE_RETURN; if (MEM_STATUS_AT0(reg->push_mem_end, node->m.regnum)) len += (ND_IS_RECURSION(node) ? OPSIZE_MEM_END_PUSH_REC : OPSIZE_MEM_END_PUSH); else len += (ND_IS_RECURSION(node) ? OPSIZE_MEM_END_REC : OPSIZE_MEM_END); } else if (ND_IS_RECURSION(node)) { len = OPSIZE_MEM_START_PUSH; len += tlen + (MEM_STATUS_AT0(reg->push_mem_end, node->m.regnum) ? OPSIZE_MEM_END_PUSH_REC : OPSIZE_MEM_END_REC); } else #endif { if (MEM_STATUS_AT0(reg->push_mem_start, node->m.regnum)) len = OPSIZE_MEM_START_PUSH; else len = OPSIZE_MEM_START; len += tlen + (MEM_STATUS_AT0(reg->push_mem_end, node->m.regnum) ? OPSIZE_MEM_END_PUSH : OPSIZE_MEM_END); } break; case BAG_STOP_BACKTRACK: if (ND_IS_STRICT_REAL_REPEAT(node)) { int v; QuantNode* qn; qn = QUANT_(ND_BAG_BODY(node)); tlen = compile_length_tree(ND_QUANT_BODY(qn), reg, env); if (tlen < 0) return tlen; v = onig_positive_int_multiply(qn->lower, tlen); if (v < 0) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; len = v + OPSIZE_PUSH + tlen + OPSIZE_POP + OPSIZE_JUMP; } else { len = OPSIZE_MARK + tlen + OPSIZE_CUT_TO_MARK; } break; case BAG_IF_ELSE: { Node* cond = ND_BAG_BODY(node); Node* Then = node->te.Then; Node* Else = node->te.Else; len = compile_length_tree(cond, reg, env); if (len < 0) return len; len += OPSIZE_PUSH + OPSIZE_MARK + OPSIZE_CUT_TO_MARK; if (IS_NOT_NULL(Then)) { tlen = compile_length_tree(Then, reg, env); if (tlen < 0) return tlen; len += tlen; } len += OPSIZE_JUMP + OPSIZE_CUT_TO_MARK; if (IS_NOT_NULL(Else)) { tlen = compile_length_tree(Else, reg, env); if (tlen < 0) return tlen; len += tlen; } } break; case BAG_OPTION: /* never come here, but set for escape warning */ len = 0; break; default: return ONIGERR_TYPE_BUG; break; } return len; } static int compile_bag_memory_node(BagNode* node, regex_t* reg, ParseEnv* env) { int r; #ifdef USE_CALL if (ND_IS_CALLED(node)) { int len; r = add_op(reg, OP_CALL); if (r != 0) return r; node->m.called_addr = COP_CURR_OFFSET(reg) + 1 + OPSIZE_JUMP; ND_STATUS_ADD(node, FIXED_ADDR); COP(reg)->call.addr = (int )node->m.called_addr; if (node->m.regnum == 0) { len = compile_length_tree(ND_BAG_BODY(node), reg, env); len += OPSIZE_RETURN; r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = len + SIZE_INC; r = compile_tree(ND_BAG_BODY(node), reg, env); if (r != 0) return r; r = add_op(reg, OP_RETURN); return r; } else { len = compile_length_tree(ND_BAG_BODY(node), reg, env); len += (OPSIZE_MEM_START_PUSH + OPSIZE_RETURN); if (MEM_STATUS_AT0(reg->push_mem_end, node->m.regnum)) len += (ND_IS_RECURSION(node) ? OPSIZE_MEM_END_PUSH_REC : OPSIZE_MEM_END_PUSH); else len += (ND_IS_RECURSION(node) ? OPSIZE_MEM_END_REC : OPSIZE_MEM_END); r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = len + SIZE_INC; } } #endif if (MEM_STATUS_AT0(reg->push_mem_start, node->m.regnum)) r = add_op(reg, OP_MEM_START_PUSH); else r = add_op(reg, OP_MEM_START); if (r != 0) return r; COP(reg)->memory_start.num = node->m.regnum; r = compile_tree(ND_BAG_BODY(node), reg, env); if (r != 0) return r; #ifdef USE_CALL if (MEM_STATUS_AT0(reg->push_mem_end, node->m.regnum)) r = add_op(reg, (ND_IS_RECURSION(node) ? OP_MEM_END_PUSH_REC : OP_MEM_END_PUSH)); else r = add_op(reg, (ND_IS_RECURSION(node) ? OP_MEM_END_REC : OP_MEM_END)); if (r != 0) return r; COP(reg)->memory_end.num = node->m.regnum; if (ND_IS_CALLED(node)) { r = add_op(reg, OP_RETURN); } #else if (MEM_STATUS_AT0(reg->push_mem_end, node->m.regnum)) r = add_op(reg, OP_MEM_END_PUSH); else r = add_op(reg, OP_MEM_END); if (r != 0) return r; COP(reg)->memory_end.num = node->m.regnum; #endif return r; } static int compile_bag_node(BagNode* node, regex_t* reg, ParseEnv* env) { int r, len; switch (node->type) { case BAG_MEMORY: r = compile_bag_memory_node(node, reg, env); break; case BAG_OPTION: r = compile_option_node(node, reg, env); break; case BAG_STOP_BACKTRACK: if (ND_IS_STRICT_REAL_REPEAT(node)) { QuantNode* qn = QUANT_(ND_BAG_BODY(node)); r = compile_tree_n_times(ND_QUANT_BODY(qn), qn->lower, reg, env); if (r != 0) return r; len = compile_length_tree(ND_QUANT_BODY(qn), reg, env); if (len < 0) return len; r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + len + OPSIZE_POP + OPSIZE_JUMP; r = compile_tree(ND_QUANT_BODY(qn), reg, env); if (r != 0) return r; r = add_op(reg, OP_POP); if (r != 0) return r; r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = -((int )OPSIZE_PUSH + len + (int )OPSIZE_POP); } else { MemNumType mid; ID_ENTRY(env, mid); r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid; COP(reg)->mark.save_pos = 0; r = compile_tree(ND_BAG_BODY(node), reg, env); if (r != 0) return r; r = add_op(reg, OP_CUT_TO_MARK); if (r != 0) return r; COP(reg)->cut_to_mark.id = mid; COP(reg)->cut_to_mark.restore_pos = 0; } break; case BAG_IF_ELSE: { int cond_len, then_len, else_len, jump_len; MemNumType mid; Node* cond = ND_BAG_BODY(node); Node* Then = node->te.Then; Node* Else = node->te.Else; ID_ENTRY(env, mid); r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid; COP(reg)->mark.save_pos = 0; cond_len = compile_length_tree(cond, reg, env); if (cond_len < 0) return cond_len; if (IS_NOT_NULL(Then)) { then_len = compile_length_tree(Then, reg, env); if (then_len < 0) return then_len; } else then_len = 0; jump_len = cond_len + then_len + OPSIZE_CUT_TO_MARK + OPSIZE_JUMP; r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + jump_len; r = compile_tree(cond, reg, env); if (r != 0) return r; r = add_op(reg, OP_CUT_TO_MARK); if (r != 0) return r; COP(reg)->cut_to_mark.id = mid; COP(reg)->cut_to_mark.restore_pos = 0; if (IS_NOT_NULL(Then)) { r = compile_tree(Then, reg, env); if (r != 0) return r; } if (IS_NOT_NULL(Else)) { else_len = compile_length_tree(Else, reg, env); if (else_len < 0) return else_len; } else else_len = 0; r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = OPSIZE_CUT_TO_MARK + else_len + SIZE_INC; r = add_op(reg, OP_CUT_TO_MARK); if (r != 0) return r; COP(reg)->cut_to_mark.id = mid; COP(reg)->cut_to_mark.restore_pos = 0; if (IS_NOT_NULL(Else)) { r = compile_tree(Else, reg, env); } } break; default: return ONIGERR_TYPE_BUG; break; } return r; } static int compile_length_anchor_node(AnchorNode* node, regex_t* reg, ParseEnv* env) { int len; int tlen = 0; if (IS_NOT_NULL(ND_ANCHOR_BODY(node))) { tlen = compile_length_tree(ND_ANCHOR_BODY(node), reg, env); if (tlen < 0) return tlen; } switch (node->type) { case ANCR_PREC_READ: len = OPSIZE_MARK + tlen + OPSIZE_CUT_TO_MARK; break; case ANCR_PREC_READ_NOT: len = OPSIZE_PUSH + OPSIZE_MARK + tlen + OPSIZE_POP_TO_MARK + OPSIZE_POP + OPSIZE_FAIL; break; case ANCR_LOOK_BEHIND: if (node->char_min_len == node->char_max_len) len = OPSIZE_MARK + OPSIZE_STEP_BACK_START + tlen + OPSIZE_CUT_TO_MARK; else { len = OPSIZE_SAVE_VAL + OPSIZE_UPDATE_VAR + OPSIZE_MARK + OPSIZE_PUSH + OPSIZE_UPDATE_VAR + OPSIZE_FAIL + OPSIZE_JUMP + OPSIZE_STEP_BACK_START + OPSIZE_STEP_BACK_NEXT + tlen + OPSIZE_CHECK_POSITION + OPSIZE_CUT_TO_MARK + OPSIZE_UPDATE_VAR; if (IS_NOT_NULL(node->lead_node)) { int llen = compile_length_tree(node->lead_node, reg, env); if (llen < 0) return llen; len += OPSIZE_MOVE + llen; } if ((env->flags & PE_FLAG_HAS_ABSENT_STOPPER) != 0) len += OPSIZE_SAVE_VAL + OPSIZE_UPDATE_VAR; } break; case ANCR_LOOK_BEHIND_NOT: if (node->char_min_len == node->char_max_len) len = OPSIZE_MARK + OPSIZE_PUSH + OPSIZE_STEP_BACK_START + tlen + OPSIZE_POP_TO_MARK + OPSIZE_FAIL + OPSIZE_POP; else { len = OPSIZE_SAVE_VAL + OPSIZE_UPDATE_VAR + OPSIZE_MARK + OPSIZE_PUSH + OPSIZE_STEP_BACK_START + OPSIZE_STEP_BACK_NEXT + tlen + OPSIZE_CHECK_POSITION + OPSIZE_POP_TO_MARK + OPSIZE_UPDATE_VAR + OPSIZE_POP + OPSIZE_FAIL + OPSIZE_UPDATE_VAR + OPSIZE_POP + OPSIZE_POP; if (IS_NOT_NULL(node->lead_node)) { int llen = compile_length_tree(node->lead_node, reg, env); if (llen < 0) return llen; len += OPSIZE_MOVE + llen; } if ((env->flags & PE_FLAG_HAS_ABSENT_STOPPER) != 0) len += OPSIZE_SAVE_VAL + OPSIZE_UPDATE_VAR; } break; case ANCR_WORD_BOUNDARY: case ANCR_NO_WORD_BOUNDARY: #ifdef USE_WORD_BEGIN_END case ANCR_WORD_BEGIN: case ANCR_WORD_END: #endif len = OPSIZE_WORD_BOUNDARY; break; case ANCR_TEXT_SEGMENT_BOUNDARY: case ANCR_NO_TEXT_SEGMENT_BOUNDARY: len = SIZE_OPCODE; break; default: len = SIZE_OPCODE; break; } return len; } static int compile_anchor_look_behind_node(AnchorNode* node, regex_t* reg, ParseEnv* env) { int r; if (node->char_min_len == node->char_max_len) { MemNumType mid; ID_ENTRY(env, mid); r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid; COP(reg)->mark.save_pos = FALSE; r = add_op(reg, OP_STEP_BACK_START); if (r != 0) return r; COP(reg)->step_back_start.initial = node->char_min_len; COP(reg)->step_back_start.remaining = 0; COP(reg)->step_back_start.addr = 1; r = compile_tree(ND_ANCHOR_BODY(node), reg, env); if (r != 0) return r; r = add_op(reg, OP_CUT_TO_MARK); if (r != 0) return r; COP(reg)->cut_to_mark.id = mid; COP(reg)->cut_to_mark.restore_pos = FALSE; } else { OnigLen diff; MemNumType mid1, mid2; MemNumType mid3 = 0; /* ignore uninitialized warning */ if (IS_NOT_NULL(node->lead_node)) { MinMaxCharLen ci; r = node_char_len(node->lead_node, reg, &ci, env); if (r < 0) return r; r = add_op(reg, OP_MOVE); if (r != 0) return r; COP(reg)->move.n = -((RelPositionType )ci.min); r = compile_tree(node->lead_node, reg, env); if (r != 0) return r; } ID_ENTRY(env, mid1); r = add_op(reg, OP_SAVE_VAL); if (r != 0) return r; COP(reg)->save_val.type = SAVE_RIGHT_RANGE; COP(reg)->save_val.id = mid1; r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_TO_S; ID_ENTRY(env, mid2); r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid2; COP(reg)->mark.save_pos = FALSE; r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + OPSIZE_JUMP; r = add_op(reg, OP_JUMP); if (r != 0) return r; COP(reg)->jump.addr = SIZE_INC + OPSIZE_UPDATE_VAR + OPSIZE_FAIL; r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_FROM_STACK; COP(reg)->update_var.id = mid1; COP(reg)->update_var.clear = FALSE; r = add_op(reg, OP_FAIL); if (r != 0) return r; if ((env->flags & PE_FLAG_HAS_ABSENT_STOPPER) != 0) { ID_ENTRY(env, mid3); r = add_op(reg, OP_SAVE_VAL); if (r != 0) return r; COP(reg)->save_val.type = SAVE_RIGHT_RANGE; COP(reg)->save_val.id = mid3; } r = add_op(reg, OP_STEP_BACK_START); if (r != 0) return r; if (node->char_max_len != INFINITE_LEN) diff = node->char_max_len - node->char_min_len; else diff = INFINITE_LEN; COP(reg)->step_back_start.initial = node->char_min_len; COP(reg)->step_back_start.remaining = diff; COP(reg)->step_back_start.addr = 2; r = add_op(reg, OP_STEP_BACK_NEXT); if (r != 0) return r; r = compile_tree(ND_ANCHOR_BODY(node), reg, env); if (r != 0) return r; if ((env->flags & PE_FLAG_HAS_ABSENT_STOPPER) != 0) { r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_FROM_STACK; COP(reg)->update_var.id = mid3; COP(reg)->update_var.clear = FALSE; } r = add_op(reg, OP_CHECK_POSITION); if (r != 0) return r; COP(reg)->check_position.type = CHECK_POSITION_CURRENT_RIGHT_RANGE; r = add_op(reg, OP_CUT_TO_MARK); if (r != 0) return r; COP(reg)->cut_to_mark.id = mid2; COP(reg)->cut_to_mark.restore_pos = FALSE; r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_FROM_STACK; COP(reg)->update_var.id = mid1; COP(reg)->update_var.clear = TRUE; } return r; } static int compile_anchor_look_behind_not_node(AnchorNode* node, regex_t* reg, ParseEnv* env) { int r; int len; len = compile_length_tree(ND_ANCHOR_BODY(node), reg, env); if (node->char_min_len == node->char_max_len) { MemNumType mid; ID_ENTRY(env, mid); r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid; COP(reg)->mark.save_pos = FALSE; r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + OPSIZE_STEP_BACK_START + len + OPSIZE_POP_TO_MARK + OPSIZE_FAIL; r = add_op(reg, OP_STEP_BACK_START); if (r != 0) return r; COP(reg)->step_back_start.initial = node->char_min_len; COP(reg)->step_back_start.remaining = 0; COP(reg)->step_back_start.addr = 1; r = compile_tree(ND_ANCHOR_BODY(node), reg, env); if (r != 0) return r; r = add_op(reg, OP_POP_TO_MARK); if (r != 0) return r; COP(reg)->pop_to_mark.id = mid; r = add_op(reg, OP_FAIL); if (r != 0) return r; r = add_op(reg, OP_POP); } else { OnigLen diff; MemNumType mid1, mid2; MemNumType mid3 = 0; /* ignore uninitialized warning */ ID_ENTRY(env, mid1); r = add_op(reg, OP_SAVE_VAL); if (r != 0) return r; COP(reg)->save_val.type = SAVE_RIGHT_RANGE; COP(reg)->save_val.id = mid1; r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_TO_S; ID_ENTRY(env, mid2); r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid2; COP(reg)->mark.save_pos = FALSE; r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + OPSIZE_STEP_BACK_START + OPSIZE_STEP_BACK_NEXT + len + OPSIZE_CHECK_POSITION + OPSIZE_POP_TO_MARK + OPSIZE_UPDATE_VAR + OPSIZE_POP + OPSIZE_FAIL; if ((env->flags & PE_FLAG_HAS_ABSENT_STOPPER) != 0) COP(reg)->push.addr += OPSIZE_SAVE_VAL + OPSIZE_UPDATE_VAR; if (IS_NOT_NULL(node->lead_node)) { int clen; MinMaxCharLen ci; clen = compile_length_tree(node->lead_node, reg, env); COP(reg)->push.addr += OPSIZE_MOVE + clen; r = node_char_len(node->lead_node, reg, &ci, env); if (r < 0) return r; r = add_op(reg, OP_MOVE); if (r != 0) return r; COP(reg)->move.n = -((RelPositionType )ci.min); r = compile_tree(node->lead_node, reg, env); if (r != 0) return r; } if ((env->flags & PE_FLAG_HAS_ABSENT_STOPPER) != 0) { ID_ENTRY(env, mid3); r = add_op(reg, OP_SAVE_VAL); if (r != 0) return r; COP(reg)->save_val.type = SAVE_RIGHT_RANGE; COP(reg)->save_val.id = mid3; } r = add_op(reg, OP_STEP_BACK_START); if (r != 0) return r; if (node->char_max_len != INFINITE_LEN) diff = node->char_max_len - node->char_min_len; else diff = INFINITE_LEN; COP(reg)->step_back_start.initial = node->char_min_len; COP(reg)->step_back_start.remaining = diff; COP(reg)->step_back_start.addr = 2; r = add_op(reg, OP_STEP_BACK_NEXT); if (r != 0) return r; r = compile_tree(ND_ANCHOR_BODY(node), reg, env); if (r != 0) return r; if ((env->flags & PE_FLAG_HAS_ABSENT_STOPPER) != 0) { r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_FROM_STACK; COP(reg)->update_var.id = mid3; COP(reg)->update_var.clear = FALSE; } r = add_op(reg, OP_CHECK_POSITION); if (r != 0) return r; COP(reg)->check_position.type = CHECK_POSITION_CURRENT_RIGHT_RANGE; r = add_op(reg, OP_POP_TO_MARK); if (r != 0) return r; COP(reg)->pop_to_mark.id = mid2; r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_FROM_STACK; COP(reg)->update_var.id = mid1; COP(reg)->update_var.clear = FALSE; r = add_op(reg, OP_POP); /* pop save val */ if (r != 0) return r; r = add_op(reg, OP_FAIL); if (r != 0) return r; r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = UPDATE_VAR_RIGHT_RANGE_FROM_STACK; COP(reg)->update_var.id = mid1; COP(reg)->update_var.clear = FALSE; r = add_op(reg, OP_POP); /* pop mark */ if (r != 0) return r; r = add_op(reg, OP_POP); /* pop save val */ } return r; } static int compile_anchor_node(AnchorNode* node, regex_t* reg, ParseEnv* env) { int r, len; enum OpCode op; MemNumType mid; switch (node->type) { case ANCR_BEGIN_BUF: r = add_op(reg, OP_BEGIN_BUF); break; case ANCR_END_BUF: r = add_op(reg, OP_END_BUF); break; case ANCR_BEGIN_LINE: r = add_op(reg, OP_BEGIN_LINE); break; case ANCR_END_LINE: r = add_op(reg, OP_END_LINE); break; case ANCR_SEMI_END_BUF: r = add_op(reg, OP_SEMI_END_BUF); break; case ANCR_BEGIN_POSITION: r = add_op(reg, OP_CHECK_POSITION); if (r != 0) return r; COP(reg)->check_position.type = CHECK_POSITION_SEARCH_START; break; case ANCR_WORD_BOUNDARY: op = OP_WORD_BOUNDARY; word: r = add_op(reg, op); if (r != 0) return r; COP(reg)->word_boundary.mode = (ModeType )node->ascii_mode; break; case ANCR_NO_WORD_BOUNDARY: op = OP_NO_WORD_BOUNDARY; goto word; break; #ifdef USE_WORD_BEGIN_END case ANCR_WORD_BEGIN: op = OP_WORD_BEGIN; goto word; break; case ANCR_WORD_END: op = OP_WORD_END; goto word; break; #endif case ANCR_TEXT_SEGMENT_BOUNDARY: case ANCR_NO_TEXT_SEGMENT_BOUNDARY: { enum TextSegmentBoundaryType type; r = add_op(reg, OP_TEXT_SEGMENT_BOUNDARY); if (r != 0) return r; type = EXTENDED_GRAPHEME_CLUSTER_BOUNDARY; #ifdef USE_UNICODE_WORD_BREAK if (ND_IS_TEXT_SEGMENT_WORD(node)) type = WORD_BOUNDARY; #endif COP(reg)->text_segment_boundary.type = type; COP(reg)->text_segment_boundary.not = (node->type == ANCR_NO_TEXT_SEGMENT_BOUNDARY ? 1 : 0); } break; case ANCR_PREC_READ: { ID_ENTRY(env, mid); r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid; COP(reg)->mark.save_pos = TRUE; r = compile_tree(ND_ANCHOR_BODY(node), reg, env); if (r != 0) return r; r = add_op(reg, OP_CUT_TO_MARK); if (r != 0) return r; COP(reg)->cut_to_mark.id = mid; COP(reg)->cut_to_mark.restore_pos = TRUE; } break; case ANCR_PREC_READ_NOT: { len = compile_length_tree(ND_ANCHOR_BODY(node), reg, env); if (len < 0) return len; ID_ENTRY(env, mid); r = add_op(reg, OP_PUSH); if (r != 0) return r; COP(reg)->push.addr = SIZE_INC + OPSIZE_MARK + len + OPSIZE_POP_TO_MARK + OPSIZE_POP + OPSIZE_FAIL; r = add_op(reg, OP_MARK); if (r != 0) return r; COP(reg)->mark.id = mid; COP(reg)->mark.save_pos = FALSE; r = compile_tree(ND_ANCHOR_BODY(node), reg, env); if (r != 0) return r; r = add_op(reg, OP_POP_TO_MARK); if (r != 0) return r; COP(reg)->pop_to_mark.id = mid; r = add_op(reg, OP_POP); if (r != 0) return r; r = add_op(reg, OP_FAIL); } break; case ANCR_LOOK_BEHIND: r = compile_anchor_look_behind_node(node, reg, env); break; case ANCR_LOOK_BEHIND_NOT: r = compile_anchor_look_behind_not_node(node, reg, env); break; default: return ONIGERR_TYPE_BUG; break; } return r; } static int compile_gimmick_node(GimmickNode* node, regex_t* reg) { int r = 0; switch (node->type) { case GIMMICK_FAIL: r = add_op(reg, OP_FAIL); break; case GIMMICK_SAVE: r = add_op(reg, OP_SAVE_VAL); if (r != 0) return r; COP(reg)->save_val.type = node->detail_type; COP(reg)->save_val.id = node->id; break; case GIMMICK_UPDATE_VAR: r = add_op(reg, OP_UPDATE_VAR); if (r != 0) return r; COP(reg)->update_var.type = node->detail_type; COP(reg)->update_var.id = node->id; COP(reg)->update_var.clear = FALSE; break; #ifdef USE_CALLOUT case GIMMICK_CALLOUT: switch (node->detail_type) { case ONIG_CALLOUT_OF_CONTENTS: case ONIG_CALLOUT_OF_NAME: { if (node->detail_type == ONIG_CALLOUT_OF_NAME) { r = add_op(reg, OP_CALLOUT_NAME); if (r != 0) return r; COP(reg)->callout_name.id = node->id; COP(reg)->callout_name.num = node->num; } else { r = add_op(reg, OP_CALLOUT_CONTENTS); if (r != 0) return r; COP(reg)->callout_contents.num = node->num; } } break; default: r = ONIGERR_TYPE_BUG; break; } #endif } return r; } static int compile_length_gimmick_node(GimmickNode* node, regex_t* reg) { int len; switch (node->type) { case GIMMICK_FAIL: len = OPSIZE_FAIL; break; case GIMMICK_SAVE: len = OPSIZE_SAVE_VAL; break; case GIMMICK_UPDATE_VAR: len = OPSIZE_UPDATE_VAR; break; #ifdef USE_CALLOUT case GIMMICK_CALLOUT: switch (node->detail_type) { case ONIG_CALLOUT_OF_CONTENTS: len = OPSIZE_CALLOUT_CONTENTS; break; case ONIG_CALLOUT_OF_NAME: len = OPSIZE_CALLOUT_NAME; break; default: len = ONIGERR_TYPE_BUG; break; } break; #endif default: return ONIGERR_TYPE_BUG; break; } return len; } static int compile_length_tree(Node* node, regex_t* reg, ParseEnv* env) { int len, r; switch (ND_TYPE(node)) { case ND_LIST: len = 0; do { r = compile_length_tree(ND_CAR(node), reg, env); if (r < 0) return r; len += r; } while (IS_NOT_NULL(node = ND_CDR(node))); r = len; break; case ND_ALT: { int n; n = r = 0; do { r += compile_length_tree(ND_CAR(node), reg, env); n++; } while (IS_NOT_NULL(node = ND_CDR(node))); r += (OPSIZE_PUSH + OPSIZE_JUMP) * (n - 1); } break; case ND_STRING: if (ND_STRING_IS_CRUDE(node)) r = compile_length_string_crude_node(STR_(node), reg); else r = compile_length_string_node(node, reg); break; case ND_CCLASS: r = compile_length_cclass_node(CCLASS_(node), reg); break; case ND_CTYPE: r = SIZE_OPCODE; break; case ND_BACKREF: r = OPSIZE_BACKREF; break; #ifdef USE_CALL case ND_CALL: r = OPSIZE_CALL; break; #endif case ND_QUANT: r = compile_length_quantifier_node(QUANT_(node), reg, env); break; case ND_BAG: r = compile_length_bag_node(BAG_(node), reg, env); break; case ND_ANCHOR: r = compile_length_anchor_node(ANCHOR_(node), reg, env); break; case ND_GIMMICK: r = compile_length_gimmick_node(GIMMICK_(node), reg); break; default: return ONIGERR_TYPE_BUG; break; } return r; } static int compile_tree(Node* node, regex_t* reg, ParseEnv* env) { int n, len, pos, r = 0; switch (ND_TYPE(node)) { case ND_LIST: do { r = compile_tree(ND_CAR(node), reg, env); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ALT: { Node* x = node; len = 0; do { len += compile_length_tree(ND_CAR(x), reg, env); if (IS_NOT_NULL(ND_CDR(x))) { len += OPSIZE_PUSH + OPSIZE_JUMP; } } while (IS_NOT_NULL(x = ND_CDR(x))); pos = COP_CURR_OFFSET(reg) + 1 + len; /* goal position */ do { len = compile_length_tree(ND_CAR(node), reg, env); if (IS_NOT_NULL(ND_CDR(node))) { enum OpCode push = ND_IS_SUPER(node) ? OP_PUSH_SUPER : OP_PUSH; r = add_op(reg, push); if (r != 0) break; COP(reg)->push.addr = SIZE_INC + len + OPSIZE_JUMP; } r = compile_tree(ND_CAR(node), reg, env); if (r != 0) break; if (IS_NOT_NULL(ND_CDR(node))) { len = pos - (COP_CURR_OFFSET(reg) + 1); r = add_op(reg, OP_JUMP); if (r != 0) break; COP(reg)->jump.addr = len; } } while (IS_NOT_NULL(node = ND_CDR(node))); } break; case ND_STRING: if (ND_STRING_IS_CRUDE(node)) r = compile_string_crude_node(STR_(node), reg); else r = compile_string_node(node, reg); break; case ND_CCLASS: r = compile_cclass_node(CCLASS_(node), reg); break; case ND_CTYPE: { int op; switch (CTYPE_(node)->ctype) { case CTYPE_ANYCHAR: r = add_op(reg, ND_IS_MULTILINE(node) ? OP_ANYCHAR_ML : OP_ANYCHAR); break; case ONIGENC_CTYPE_WORD: if (CTYPE_(node)->ascii_mode == 0) { op = CTYPE_(node)->not != 0 ? OP_NO_WORD : OP_WORD; } else { op = CTYPE_(node)->not != 0 ? OP_NO_WORD_ASCII : OP_WORD_ASCII; } r = add_op(reg, op); break; default: return ONIGERR_TYPE_BUG; break; } } break; case ND_BACKREF: { BackRefNode* br = BACKREF_(node); if (ND_IS_CHECKER(node)) { #ifdef USE_BACKREF_WITH_LEVEL if (ND_IS_NEST_LEVEL(node)) { r = add_op(reg, OP_BACKREF_CHECK_WITH_LEVEL); if (r != 0) return r; COP(reg)->backref_general.nest_level = br->nest_level; } else #endif { r = add_op(reg, OP_BACKREF_CHECK); if (r != 0) return r; } goto add_bacref_mems; } else { #ifdef USE_BACKREF_WITH_LEVEL if (ND_IS_NEST_LEVEL(node)) { if (ND_IS_IGNORECASE(node)) r = add_op(reg, OP_BACKREF_WITH_LEVEL_IC); else r = add_op(reg, OP_BACKREF_WITH_LEVEL); if (r != 0) return r; COP(reg)->backref_general.nest_level = br->nest_level; goto add_bacref_mems; } else #endif if (br->back_num == 1) { n = br->back_static[0]; if (ND_IS_IGNORECASE(node)) { r = add_op(reg, OP_BACKREF_N_IC); if (r != 0) return r; COP(reg)->backref_n.n1 = n; } else { switch (n) { case 1: r = add_op(reg, OP_BACKREF1); break; case 2: r = add_op(reg, OP_BACKREF2); break; default: r = add_op(reg, OP_BACKREF_N); if (r != 0) return r; COP(reg)->backref_n.n1 = n; break; } } } else { int num; int* p; r = add_op(reg, ND_IS_IGNORECASE(node) ? OP_BACKREF_MULTI_IC : OP_BACKREF_MULTI); if (r != 0) return r; add_bacref_mems: num = br->back_num; COP(reg)->backref_general.num = num; if (num == 1) { COP(reg)->backref_general.n1 = br->back_static[0]; } else { int i, j; MemNumType* ns; ns = xmalloc(sizeof(MemNumType) * num); CHECK_NULL_RETURN_MEMERR(ns); COP(reg)->backref_general.ns = ns; p = BACKREFS_P(br); for (i = num - 1, j = 0; i >= 0; i--, j++) { ns[j] = p[i]; } } } } } break; #ifdef USE_CALL case ND_CALL: r = compile_call(CALL_(node), reg, env); break; #endif case ND_QUANT: r = compile_quantifier_node(QUANT_(node), reg, env); break; case ND_BAG: r = compile_bag_node(BAG_(node), reg, env); break; case ND_ANCHOR: r = compile_anchor_node(ANCHOR_(node), reg, env); break; case ND_GIMMICK: r = compile_gimmick_node(GIMMICK_(node), reg); break; default: #ifdef ONIG_DEBUG fprintf(DBGFP, "compile_tree: undefined node type %d\n", ND_TYPE(node)); #endif break; } return r; } static int make_named_capture_number_map(Node** plink, GroupNumMap* map, int* counter) { int r; Node* node = *plink; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = make_named_capture_number_map(&(ND_CAR(node)), map, counter); } while (r >= 0 && IS_NOT_NULL(node = ND_CDR(node))); if (r < 0) return r; break; case ND_QUANT: { Node** ptarget = &(ND_BODY(node)); r = make_named_capture_number_map(ptarget, map, counter); if (r < 0) return r; if (r == 1 && ND_TYPE(*ptarget) == ND_QUANT) { return onig_reduce_nested_quantifier(node); } } break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_NAMED_GROUP(node)) { (*counter)++; map[en->m.regnum].new_val = *counter; en->m.regnum = *counter; r = make_named_capture_number_map(&(ND_BODY(node)), map, counter); if (r < 0) return r; } else { *plink = ND_BODY(node); ND_BODY(node) = NULL_NODE; onig_node_free(node); r = make_named_capture_number_map(plink, map, counter); if (r < 0) return r; return 1; } } else if (en->type == BAG_IF_ELSE) { r = make_named_capture_number_map(&(ND_BAG_BODY(en)), map, counter); if (r < 0) return r; if (IS_NOT_NULL(en->te.Then)) { r = make_named_capture_number_map(&(en->te.Then), map, counter); if (r < 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = make_named_capture_number_map(&(en->te.Else), map, counter); if (r < 0) return r; } } else { r = make_named_capture_number_map(&(ND_BODY(node)), map, counter); if (r < 0) return r; } } break; case ND_ANCHOR: if (IS_NOT_NULL(ND_BODY(node))) { r = make_named_capture_number_map(&(ND_BODY(node)), map, counter); if (r < 0) return r; } break; default: break; } return 0; } static int renumber_backref_node(Node* node, GroupNumMap* map) { int i, pos, n, old_num; int *backs; BackRefNode* bn = BACKREF_(node); if (! ND_IS_BY_NAME(node)) return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED; old_num = bn->back_num; if (IS_NULL(bn->back_dynamic)) backs = bn->back_static; else backs = bn->back_dynamic; for (i = 0, pos = 0; i < old_num; i++) { n = map[backs[i]].new_val; if (n > 0) { backs[pos] = n; pos++; } } bn->back_num = pos; return 0; } static int renumber_backref_traverse(Node* node, GroupNumMap* map) { int r = 0; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = renumber_backref_traverse(ND_CAR(node), map); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: r = renumber_backref_traverse(ND_BODY(node), map); break; case ND_BAG: { BagNode* en = BAG_(node); r = renumber_backref_traverse(ND_BODY(node), map); if (r != 0) return r; if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = renumber_backref_traverse(en->te.Then, map); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = renumber_backref_traverse(en->te.Else, map); if (r != 0) return r; } } } break; case ND_BACKREF: r = renumber_backref_node(node, map); break; case ND_ANCHOR: if (IS_NOT_NULL(ND_BODY(node))) r = renumber_backref_traverse(ND_BODY(node), map); break; default: break; } return r; } static int numbered_ref_check(Node* node) { int r = 0; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = numbered_ref_check(ND_CAR(node)); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ANCHOR: if (IS_NULL(ND_BODY(node))) break; /* fall */ case ND_QUANT: r = numbered_ref_check(ND_BODY(node)); break; case ND_BAG: { BagNode* en = BAG_(node); r = numbered_ref_check(ND_BODY(node)); if (r != 0) return r; if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = numbered_ref_check(en->te.Then); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = numbered_ref_check(en->te.Else); if (r != 0) return r; } } } break; case ND_BACKREF: if (! ND_IS_BY_NAME(node)) return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED; break; default: break; } return r; } static int disable_noname_group_capture(Node** root, regex_t* reg, ParseEnv* env) { int r, i, pos, counter; MemStatusType loc; GroupNumMap* map; map = (GroupNumMap* )xalloca(sizeof(GroupNumMap) * (env->num_mem + 1)); CHECK_NULL_RETURN_MEMERR(map); for (i = 1; i <= env->num_mem; i++) { map[i].new_val = 0; } counter = 0; r = make_named_capture_number_map(root, map, &counter); if (r < 0) return r; r = renumber_backref_traverse(*root, map); if (r != 0) return r; for (i = 1, pos = 1; i <= env->num_mem; i++) { if (map[i].new_val > 0) { PARSEENV_MEMENV(env)[pos] = PARSEENV_MEMENV(env)[i]; pos++; } } loc = env->cap_history; MEM_STATUS_CLEAR(env->cap_history); for (i = 1; i <= ONIG_MAX_CAPTURE_HISTORY_GROUP; i++) { if (MEM_STATUS_AT(loc, i)) { MEM_STATUS_ON_SIMPLE(env->cap_history, map[i].new_val); } } env->num_mem = env->num_named; reg->num_mem = env->num_named; return onig_renumber_name_table(reg, map); } #ifdef USE_CALL static int fix_unset_addr_list(UnsetAddrList* uslist, regex_t* reg) { int i, offset; BagNode* en; AbsAddrType addr; AbsAddrType* paddr; for (i = 0; i < uslist->num; i++) { if (! ND_IS_FIXED_ADDR(uslist->us[i].target)) { if (ND_IS_CALLED(uslist->us[i].target)) return ONIGERR_PARSER_BUG; else { /* CASE: called node doesn't have called address. ex. /((|a\g<1>)(.){0}){0}\g<3>/ group-1 doesn't called, but compiled into bytecodes, because group-3 is referred from outside. */ continue; } } en = BAG_(uslist->us[i].target); addr = en->m.called_addr; offset = uslist->us[i].offset; paddr = (AbsAddrType* )((char* )reg->ops + offset); *paddr = addr; } return 0; } #endif /* x is not included y ==> 1 : 0 */ static int is_exclusive(Node* x, Node* y, regex_t* reg) { int i, len; OnigCodePoint code; UChar *p; NodeType ytype; retry: ytype = ND_TYPE(y); switch (ND_TYPE(x)) { case ND_CTYPE: { if (CTYPE_(x)->ctype == CTYPE_ANYCHAR || CTYPE_(y)->ctype == CTYPE_ANYCHAR) break; switch (ytype) { case ND_CTYPE: if (CTYPE_(y)->ctype == CTYPE_(x)->ctype && CTYPE_(y)->not != CTYPE_(x)->not && CTYPE_(y)->ascii_mode == CTYPE_(x)->ascii_mode) return 1; else return 0; break; case ND_CCLASS: swap: { Node* tmp; tmp = x; x = y; y = tmp; goto retry; } break; case ND_STRING: goto swap; break; default: break; } } break; case ND_CCLASS: { int range; CClassNode* xc = CCLASS_(x); switch (ytype) { case ND_CTYPE: switch (CTYPE_(y)->ctype) { case CTYPE_ANYCHAR: return 0; break; case ONIGENC_CTYPE_WORD: if (CTYPE_(y)->not == 0) { if (IS_NULL(xc->mbuf) && !IS_NCCLASS_NOT(xc)) { range = CTYPE_(y)->ascii_mode != 0 ? 128 : SINGLE_BYTE_SIZE; for (i = 0; i < range; i++) { if (BITSET_AT(xc->bs, i)) { if (ONIGENC_IS_CODE_WORD(reg->enc, i)) return 0; } } return 1; } return 0; } else { if (IS_NOT_NULL(xc->mbuf)) return 0; if (IS_NCCLASS_NOT(xc)) return 0; range = CTYPE_(y)->ascii_mode != 0 ? 128 : SINGLE_BYTE_SIZE; for (i = 0; i < range; i++) { if (! ONIGENC_IS_CODE_WORD(reg->enc, i)) { if (BITSET_AT(xc->bs, i)) return 0; } } for (i = range; i < SINGLE_BYTE_SIZE; i++) { if (BITSET_AT(xc->bs, i)) return 0; } return 1; } break; default: break; } break; case ND_CCLASS: { int v; CClassNode* yc = CCLASS_(y); for (i = 0; i < SINGLE_BYTE_SIZE; i++) { v = BITSET_AT(xc->bs, i); if ((v != 0 && !IS_NCCLASS_NOT(xc)) || (v == 0 && IS_NCCLASS_NOT(xc))) { v = BITSET_AT(yc->bs, i); if ((v != 0 && !IS_NCCLASS_NOT(yc)) || (v == 0 && IS_NCCLASS_NOT(yc))) return 0; } } if ((IS_NULL(xc->mbuf) && !IS_NCCLASS_NOT(xc)) || (IS_NULL(yc->mbuf) && !IS_NCCLASS_NOT(yc))) return 1; return 0; } break; case ND_STRING: goto swap; break; default: break; } } break; case ND_STRING: { StrNode* xs = STR_(x); if (ND_STRING_LEN(x) == 0) break; switch (ytype) { case ND_CTYPE: switch (CTYPE_(y)->ctype) { case CTYPE_ANYCHAR: break; case ONIGENC_CTYPE_WORD: if (CTYPE_(y)->ascii_mode == 0) { if (ONIGENC_IS_MBC_WORD(reg->enc, xs->s, xs->end)) return CTYPE_(y)->not; else return !(CTYPE_(y)->not); } else { if (ONIGENC_IS_MBC_WORD_ASCII(reg->enc, xs->s, xs->end)) return CTYPE_(y)->not; else return !(CTYPE_(y)->not); } break; default: break; } break; case ND_CCLASS: { CClassNode* cc = CCLASS_(y); code = ONIGENC_MBC_TO_CODE(reg->enc, xs->s, xs->s + ONIGENC_MBC_MAXLEN(reg->enc)); return onig_is_code_in_cc(reg->enc, code, cc) == 0; } break; case ND_STRING: { UChar *q; StrNode* ys = STR_(y); len = ND_STRING_LEN(x); if (len > ND_STRING_LEN(y)) len = ND_STRING_LEN(y); for (i = 0, p = ys->s, q = xs->s; i < len; i++, p++, q++) { if (*p != *q) return 1; } } break; default: break; } } break; default: break; } return 0; } static Node* get_tree_head_literal(Node* node, int exact, regex_t* reg) { Node* n = NULL_NODE; switch (ND_TYPE(node)) { case ND_BACKREF: case ND_ALT: #ifdef USE_CALL case ND_CALL: #endif break; case ND_CTYPE: if (CTYPE_(node)->ctype == CTYPE_ANYCHAR) break; /* fall */ case ND_CCLASS: if (exact == 0) { n = node; } break; case ND_LIST: n = get_tree_head_literal(ND_CAR(node), exact, reg); break; case ND_STRING: { StrNode* sn = STR_(node); if (sn->end <= sn->s) break; if (exact == 0 || !ND_IS_REAL_IGNORECASE(node)) { n = node; } } break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->lower > 0) { if (IS_NOT_NULL(qn->head_exact)) n = qn->head_exact; else n = get_tree_head_literal(ND_BODY(node), exact, reg); } } break; case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_OPTION: case BAG_MEMORY: case BAG_STOP_BACKTRACK: n = get_tree_head_literal(ND_BODY(node), exact, reg); break; default: break; } } break; case ND_ANCHOR: if (ANCHOR_(node)->type == ANCR_PREC_READ) n = get_tree_head_literal(ND_BODY(node), exact, reg); break; case ND_GIMMICK: default: break; } return n; } enum GetValue { GET_VALUE_NONE = -1, GET_VALUE_IGNORE = 0, GET_VALUE_FOUND = 1 }; #define MAX_NEST_LEVEL_GET_TREE_TAIL_LITERAL 16 static int get_tree_tail_literal(Node* node, Node** rnode, regex_t* reg, int nest_level) { int r; nest_level++; if (nest_level >= MAX_NEST_LEVEL_GET_TREE_TAIL_LITERAL) { return GET_VALUE_NONE; } switch (ND_TYPE(node)) { case ND_LIST: if (IS_NULL(ND_CDR(node))) { r = get_tree_tail_literal(ND_CAR(node), rnode, reg, nest_level); } else { r = get_tree_tail_literal(ND_CDR(node), rnode, reg, nest_level); if (r == GET_VALUE_IGNORE) { r = get_tree_tail_literal(ND_CAR(node), rnode, reg, nest_level); } } break; #ifdef USE_CALL case ND_CALL: r = get_tree_tail_literal(ND_BODY(node), rnode, reg, nest_level); break; #endif case ND_CTYPE: if (CTYPE_(node)->ctype == CTYPE_ANYCHAR) { r = GET_VALUE_NONE; break; } /* fall */ case ND_CCLASS: *rnode = node; r = GET_VALUE_FOUND; break; case ND_STRING: { StrNode* sn = STR_(node); if (sn->end <= sn->s) { r = GET_VALUE_IGNORE; break; } if (ND_IS_REAL_IGNORECASE(node)) { r = GET_VALUE_NONE; break; } *rnode = node; r = GET_VALUE_FOUND; } break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->lower != 0) { r = get_tree_tail_literal(ND_BODY(node), rnode, reg, nest_level); } else r = GET_VALUE_NONE; } break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_MARK1(node)) r = GET_VALUE_NONE; else { ND_STATUS_ADD(node, MARK1); r = get_tree_tail_literal(ND_BODY(node), rnode, reg, nest_level); ND_STATUS_REMOVE(node, MARK1); } } else { r = get_tree_tail_literal(ND_BODY(node), rnode, reg, nest_level); } } break; case ND_ANCHOR: case ND_GIMMICK: r = GET_VALUE_IGNORE; break; case ND_ALT: case ND_BACKREF: default: r = GET_VALUE_NONE; break; } return r; } static int check_called_node_in_look_behind(Node* node, int not) { int r; r = 0; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = check_called_node_in_look_behind(ND_CAR(node), not); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: r = check_called_node_in_look_behind(ND_BODY(node), not); break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_MARK1(node)) return 0; else { ND_STATUS_ADD(node, MARK1); r = check_called_node_in_look_behind(ND_BODY(node), not); ND_STATUS_REMOVE(node, MARK1); } } else { r = check_called_node_in_look_behind(ND_BODY(node), not); if (r == 0 && en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = check_called_node_in_look_behind(en->te.Then, not); if (r != 0) break; } if (IS_NOT_NULL(en->te.Else)) { r = check_called_node_in_look_behind(en->te.Else, not); } } } } break; case ND_ANCHOR: if (IS_NOT_NULL(ND_BODY(node))) r = check_called_node_in_look_behind(ND_BODY(node), not); break; case ND_GIMMICK: if (ND_IS_ABSENT_WITH_SIDE_EFFECTS(node) != 0) return 1; break; default: break; } return r; } /* allowed node types in look-behind */ #define ALLOWED_TYPE_IN_LB \ ( ND_BIT_LIST | ND_BIT_ALT | ND_BIT_STRING | ND_BIT_CCLASS \ | ND_BIT_CTYPE | ND_BIT_ANCHOR | ND_BIT_BAG | ND_BIT_QUANT \ | ND_BIT_CALL | ND_BIT_BACKREF | ND_BIT_GIMMICK) #define ALLOWED_BAG_IN_LB ( 1<type) & bag_mask[not]) == 0) return 1; r = check_node_in_look_behind(ND_BODY(node), not, used); if (r != 0) break; if (en->type == BAG_MEMORY) { if (ND_IS_BACKREF(node) || ND_IS_CALLED(node) || ND_IS_REFERENCED(node)) *used = TRUE; } else if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = check_node_in_look_behind(en->te.Then, not, used); if (r != 0) break; } if (IS_NOT_NULL(en->te.Else)) { r = check_node_in_look_behind(en->te.Else, not, used); } } } break; case ND_ANCHOR: type = ANCHOR_(node)->type; if ((type & anchor_mask[not]) == 0) return 1; if (IS_NOT_NULL(ND_BODY(node))) r = check_node_in_look_behind(ND_BODY(node), not, used); break; case ND_GIMMICK: if (ND_IS_ABSENT_WITH_SIDE_EFFECTS(node) != 0) return 1; { GimmickNode* g = GIMMICK_(node); if (g->type == GIMMICK_SAVE && g->detail_type == SAVE_KEEP) *used = TRUE; } break; case ND_CALL: if (ND_IS_RECURSION(node)) { /* fix: Issue 38040 in oss-fuzz */ /* This node should be removed before recursive call check. */ *used = TRUE; } else r = check_called_node_in_look_behind(ND_BODY(node), not); break; default: break; } return r; } static OnigLen node_min_byte_len(Node* node, ParseEnv* env) { OnigLen len; OnigLen tmin; len = 0; switch (ND_TYPE(node)) { case ND_BACKREF: if (! ND_IS_CHECKER(node)) { int i; int* backs; MemEnv* mem_env = PARSEENV_MEMENV(env); BackRefNode* br = BACKREF_(node); if (ND_IS_RECURSION(node)) break; backs = BACKREFS_P(br); len = node_min_byte_len(mem_env[backs[0]].mem_node, env); for (i = 1; i < br->back_num; i++) { tmin = node_min_byte_len(mem_env[backs[i]].mem_node, env); if (len > tmin) len = tmin; } } break; #ifdef USE_CALL case ND_CALL: { Node* t = ND_BODY(node); if (ND_IS_FIXED_MIN(t)) len = BAG_(t)->min_len; else len = node_min_byte_len(t, env); } break; #endif case ND_LIST: do { tmin = node_min_byte_len(ND_CAR(node), env); len = distance_add(len, tmin); } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ALT: { Node *x, *y; y = node; do { x = ND_CAR(y); tmin = node_min_byte_len(x, env); if (y == node) len = tmin; else if (len > tmin) len = tmin; } while (IS_NOT_NULL(y = ND_CDR(y))); } break; case ND_STRING: { StrNode* sn = STR_(node); len = (int )(sn->end - sn->s); } break; case ND_CTYPE: case ND_CCLASS: len = ONIGENC_MBC_MINLEN(env->enc); break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->lower > 0) { len = node_min_byte_len(ND_BODY(node), env); len = distance_multiply(len, qn->lower); } } break; case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_MEMORY: if (ND_IS_FIXED_MIN(node)) len = en->min_len; else { if (ND_IS_MARK1(node)) len = 0; /* recursive */ else { ND_STATUS_ADD(node, MARK1); len = node_min_byte_len(ND_BODY(node), env); ND_STATUS_REMOVE(node, MARK1); en->min_len = len; ND_STATUS_ADD(node, FIXED_MIN); } } break; case BAG_OPTION: case BAG_STOP_BACKTRACK: len = node_min_byte_len(ND_BODY(node), env); break; case BAG_IF_ELSE: { OnigLen elen; len = node_min_byte_len(ND_BODY(node), env); if (IS_NOT_NULL(en->te.Then)) len += node_min_byte_len(en->te.Then, env); if (IS_NOT_NULL(en->te.Else)) elen = node_min_byte_len(en->te.Else, env); else elen = 0; if (elen < len) len = elen; } break; } } break; case ND_GIMMICK: { GimmickNode* g = GIMMICK_(node); if (g->type == GIMMICK_FAIL) { len = INFINITE_LEN; break; } } /* fall */ case ND_ANCHOR: default: break; } return len; } static int check_backrefs(Node* node, ParseEnv* env) { int r; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = check_backrefs(ND_CAR(node), env); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ANCHOR: if (! ANCHOR_HAS_BODY(ANCHOR_(node))) { r = 0; break; } /* fall */ case ND_QUANT: r = check_backrefs(ND_BODY(node), env); break; case ND_BAG: r = check_backrefs(ND_BODY(node), env); { BagNode* en = BAG_(node); if (en->type == BAG_IF_ELSE) { if (r != 0) return r; if (IS_NOT_NULL(en->te.Then)) { r = check_backrefs(en->te.Then, env); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = check_backrefs(en->te.Else, env); } } } break; case ND_BACKREF: { int i; BackRefNode* br = BACKREF_(node); int* backs = BACKREFS_P(br); MemEnv* mem_env = PARSEENV_MEMENV(env); for (i = 0; i < br->back_num; i++) { if (backs[i] > env->num_mem) return ONIGERR_INVALID_BACKREF; ND_STATUS_ADD(mem_env[backs[i]].mem_node, BACKREF); } r = 0; } break; default: r = 0; break; } return r; } static int set_empty_repeat_node_trav(Node* node, Node* empty, ParseEnv* env) { int r; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = set_empty_repeat_node_trav(ND_CAR(node), empty, env); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ANCHOR: { AnchorNode* an = ANCHOR_(node); if (! ANCHOR_HAS_BODY(an)) { r = 0; break; } switch (an->type) { case ANCR_PREC_READ: case ANCR_LOOK_BEHIND: empty = NULL_NODE; break; default: break; } r = set_empty_repeat_node_trav(ND_BODY(node), empty, env); } break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->emptiness != BODY_IS_NOT_EMPTY) empty = node; r = set_empty_repeat_node_trav(ND_BODY(node), empty, env); } break; case ND_BAG: if (IS_NOT_NULL(ND_BODY(node))) { r = set_empty_repeat_node_trav(ND_BODY(node), empty, env); if (r != 0) return r; } { BagNode* en = BAG_(node); r = 0; if (en->type == BAG_MEMORY) { if (ND_IS_BACKREF(node)) { if (IS_NOT_NULL(empty)) PARSEENV_MEMENV(env)[en->m.regnum].empty_repeat_node = empty; } } else if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = set_empty_repeat_node_trav(en->te.Then, empty, env); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = set_empty_repeat_node_trav(en->te.Else, empty, env); } } } break; default: r = 0; break; } return r; } static int is_ancestor_node(Node* node, Node* me) { Node* parent; while ((parent = ND_PARENT(me)) != NULL_NODE) { if (parent == node) return 1; me = parent; } return 0; } static void set_empty_status_check_trav(Node* node, ParseEnv* env) { switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { set_empty_status_check_trav(ND_CAR(node), env); } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ANCHOR: { AnchorNode* an = ANCHOR_(node); if (! ANCHOR_HAS_BODY(an)) break; set_empty_status_check_trav(ND_BODY(node), env); } break; case ND_QUANT: set_empty_status_check_trav(ND_BODY(node), env); break; case ND_BAG: if (IS_NOT_NULL(ND_BODY(node))) set_empty_status_check_trav(ND_BODY(node), env); { BagNode* en = BAG_(node); if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { set_empty_status_check_trav(en->te.Then, env); } if (IS_NOT_NULL(en->te.Else)) { set_empty_status_check_trav(en->te.Else, env); } } } break; case ND_BACKREF: { int i; int* backs; MemEnv* mem_env = PARSEENV_MEMENV(env); BackRefNode* br = BACKREF_(node); backs = BACKREFS_P(br); for (i = 0; i < br->back_num; i++) { Node* ernode = mem_env[backs[i]].empty_repeat_node; if (IS_NOT_NULL(ernode)) { if (! is_ancestor_node(ernode, node)) { MEM_STATUS_LIMIT_ON(QUANT_(ernode)->empty_status_mem, backs[i]); ND_STATUS_ADD(ernode, EMPTY_STATUS_CHECK); ND_STATUS_ADD(mem_env[backs[i]].mem_node, EMPTY_STATUS_CHECK); } } } } break; default: break; } } static void set_parent_node_trav(Node* node, Node* parent) { ND_PARENT(node) = parent; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { set_parent_node_trav(ND_CAR(node), node); } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ANCHOR: if (! ANCHOR_HAS_BODY(ANCHOR_(node))) break; set_parent_node_trav(ND_BODY(node), node); break; case ND_QUANT: set_parent_node_trav(ND_BODY(node), node); break; case ND_BAG: if (IS_NOT_NULL(ND_BODY(node))) set_parent_node_trav(ND_BODY(node), node); { BagNode* en = BAG_(node); if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) set_parent_node_trav(en->te.Then, node); if (IS_NOT_NULL(en->te.Else)) { set_parent_node_trav(en->te.Else, node); } } } break; default: break; } } #ifdef USE_CALL #define RECURSION_EXIST (1<<0) #define RECURSION_MUST (1<<1) #define RECURSION_INFINITE (1<<2) static int infinite_recursive_call_check(Node* node, ParseEnv* env, int head) { int ret; int r = 0; switch (ND_TYPE(node)) { case ND_LIST: { Node *x; OnigLen min; x = node; do { ret = infinite_recursive_call_check(ND_CAR(x), env, head); if (ret < 0 || (ret & RECURSION_INFINITE) != 0) return ret; r |= ret; if (head != 0) { min = node_min_byte_len(ND_CAR(x), env); if (min != 0) head = 0; } } while (IS_NOT_NULL(x = ND_CDR(x))); } break; case ND_ALT: { int must; must = RECURSION_MUST; do { ret = infinite_recursive_call_check(ND_CAR(node), env, head); if (ret < 0 || (ret & RECURSION_INFINITE) != 0) return ret; r |= (ret & RECURSION_EXIST); must &= ret; } while (IS_NOT_NULL(node = ND_CDR(node))); r |= must; } break; case ND_QUANT: if (QUANT_(node)->upper == 0) break; r = infinite_recursive_call_check(ND_BODY(node), env, head); if (r < 0) return r; if ((r & RECURSION_MUST) != 0) { if (QUANT_(node)->lower == 0) r &= ~RECURSION_MUST; } break; case ND_ANCHOR: if (! ANCHOR_HAS_BODY(ANCHOR_(node))) break; /* fall */ case ND_CALL: r = infinite_recursive_call_check(ND_BODY(node), env, head); break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_MARK2(node)) return 0; else if (ND_IS_MARK1(node)) return (head == 0 ? RECURSION_EXIST | RECURSION_MUST : RECURSION_EXIST | RECURSION_MUST | RECURSION_INFINITE); else { ND_STATUS_ADD(node, MARK2); r = infinite_recursive_call_check(ND_BODY(node), env, head); ND_STATUS_REMOVE(node, MARK2); } } else if (en->type == BAG_IF_ELSE) { int eret; ret = infinite_recursive_call_check(ND_BODY(node), env, head); if (ret < 0 || (ret & RECURSION_INFINITE) != 0) return ret; r |= ret; if (IS_NOT_NULL(en->te.Then)) { OnigLen min; if (head != 0) { min = node_min_byte_len(ND_BODY(node), env); } else min = 0; ret = infinite_recursive_call_check(en->te.Then, env, min != 0 ? 0:head); if (ret < 0 || (ret & RECURSION_INFINITE) != 0) return ret; r |= ret; } if (IS_NOT_NULL(en->te.Else)) { eret = infinite_recursive_call_check(en->te.Else, env, head); if (eret < 0 || (eret & RECURSION_INFINITE) != 0) return eret; r |= (eret & RECURSION_EXIST); if ((eret & RECURSION_MUST) == 0) r &= ~RECURSION_MUST; } else { r &= ~RECURSION_MUST; } } else { r = infinite_recursive_call_check(ND_BODY(node), env, head); } } break; default: break; } return r; } static int infinite_recursive_call_check_trav(Node* node, ParseEnv* env) { int r; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = infinite_recursive_call_check_trav(ND_CAR(node), env); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ANCHOR: if (! ANCHOR_HAS_BODY(ANCHOR_(node))) { r = 0; break; } /* fall */ case ND_QUANT: r = infinite_recursive_call_check_trav(ND_BODY(node), env); break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_RECURSION(node) && ND_IS_CALLED(node)) { int ret; ND_STATUS_ADD(node, MARK1); ret = infinite_recursive_call_check(ND_BODY(node), env, 1); if (ret < 0) return ret; else if ((ret & (RECURSION_MUST | RECURSION_INFINITE)) != 0) return ONIGERR_NEVER_ENDING_RECURSION; ND_STATUS_REMOVE(node, MARK1); } } else if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = infinite_recursive_call_check_trav(en->te.Then, env); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = infinite_recursive_call_check_trav(en->te.Else, env); if (r != 0) return r; } } } r = infinite_recursive_call_check_trav(ND_BODY(node), env); break; default: r = 0; break; } return r; } static int recursive_call_check(Node* node) { int r; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: r = 0; do { r |= recursive_call_check(ND_CAR(node)); } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ANCHOR: if (! ANCHOR_HAS_BODY(ANCHOR_(node))) { r = 0; break; } /* fall */ case ND_QUANT: r = recursive_call_check(ND_BODY(node)); break; case ND_CALL: r = recursive_call_check(ND_BODY(node)); if (r != 0) { if (ND_IS_MARK1(ND_BODY(node))) ND_STATUS_ADD(node, RECURSION); } break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_MARK2(node)) return 0; else if (ND_IS_MARK1(node)) return 1; /* recursion */ else { ND_STATUS_ADD(node, MARK2); r = recursive_call_check(ND_BODY(node)); ND_STATUS_REMOVE(node, MARK2); } } else if (en->type == BAG_IF_ELSE) { r = 0; if (IS_NOT_NULL(en->te.Then)) { r |= recursive_call_check(en->te.Then); } if (IS_NOT_NULL(en->te.Else)) { r |= recursive_call_check(en->te.Else); } r |= recursive_call_check(ND_BODY(node)); } else { r = recursive_call_check(ND_BODY(node)); } } break; default: r = 0; break; } return r; } #define IN_RECURSION (1<<0) #define FOUND_CALLED_NODE 1 static int recursive_call_check_trav(Node* node, ParseEnv* env, int state) { int r = 0; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: { int ret; do { ret = recursive_call_check_trav(ND_CAR(node), env, state); if (ret == FOUND_CALLED_NODE) r = FOUND_CALLED_NODE; else if (ret < 0) return ret; } while (IS_NOT_NULL(node = ND_CDR(node))); } break; case ND_QUANT: r = recursive_call_check_trav(ND_BODY(node), env, state); if (QUANT_(node)->upper == 0) { if (r == FOUND_CALLED_NODE) QUANT_(node)->include_referred = 1; } break; case ND_ANCHOR: { AnchorNode* an = ANCHOR_(node); if (ANCHOR_HAS_BODY(an)) r = recursive_call_check_trav(ND_ANCHOR_BODY(an), env, state); } break; case ND_BAG: { int ret; int state1; BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_CALLED(node)) { r = FOUND_CALLED_NODE; goto check_recursion; } else if ((state & IN_RECURSION) != 0) { check_recursion: if (! ND_IS_RECURSION(node)) { ND_STATUS_ADD(node, MARK1); ret = recursive_call_check(ND_BODY(node)); if (ret != 0) { ND_STATUS_ADD(node, RECURSION); MEM_STATUS_ON(env->backtrack_mem, en->m.regnum); } ND_STATUS_REMOVE(node, MARK1); } } } state1 = state; if (ND_IS_RECURSION(node)) state1 |= IN_RECURSION; ret = recursive_call_check_trav(ND_BODY(node), env, state1); if (ret == FOUND_CALLED_NODE) r = FOUND_CALLED_NODE; if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { ret = recursive_call_check_trav(en->te.Then, env, state1); if (ret == FOUND_CALLED_NODE) r = FOUND_CALLED_NODE; } if (IS_NOT_NULL(en->te.Else)) { ret = recursive_call_check_trav(en->te.Else, env, state1); if (ret == FOUND_CALLED_NODE) r = FOUND_CALLED_NODE; } } } break; default: break; } return r; } #endif static void remove_from_list(Node* prev, Node* a) { if (ND_CDR(prev) != a) return ; ND_CDR(prev) = ND_CDR(a); ND_CDR(a) = NULL_NODE; } static int reduce_string_list(Node* node, OnigEncoding enc) { int r = 0; switch (ND_TYPE(node)) { case ND_LIST: { Node* prev; Node* curr; Node* prev_node; Node* next_node; prev = NULL_NODE; do { next_node = ND_CDR(node); curr = ND_CAR(node); if (ND_TYPE(curr) == ND_STRING) { if (IS_NULL(prev) || STR_(curr)->flag != STR_(prev)->flag || ND_STATUS(curr) != ND_STATUS(prev)) { prev = curr; prev_node = node; } else { r = node_str_node_cat(prev, curr); if (r != 0) return r; remove_from_list(prev_node, node); onig_node_free(node); } } else { if (IS_NOT_NULL(prev)) { #ifdef USE_CHECK_VALIDITY_OF_STRING_IN_TREE StrNode* sn = STR_(prev); if (! ONIGENC_IS_VALID_MBC_STRING(enc, sn->s, sn->end)) return ONIGERR_INVALID_WIDE_CHAR_VALUE; #endif prev = NULL_NODE; } r = reduce_string_list(curr, enc); if (r != 0) return r; prev_node = node; } node = next_node; } while (r == 0 && IS_NOT_NULL(node)); #ifdef USE_CHECK_VALIDITY_OF_STRING_IN_TREE if (IS_NOT_NULL(prev)) { StrNode* sn = STR_(prev); if (! ONIGENC_IS_VALID_MBC_STRING(enc, sn->s, sn->end)) return ONIGERR_INVALID_WIDE_CHAR_VALUE; } #endif } break; case ND_ALT: do { r = reduce_string_list(ND_CAR(node), enc); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; #ifdef USE_CHECK_VALIDITY_OF_STRING_IN_TREE case ND_STRING: { StrNode* sn = STR_(node); if (! ONIGENC_IS_VALID_MBC_STRING(enc, sn->s, sn->end)) return ONIGERR_INVALID_WIDE_CHAR_VALUE; } break; #endif case ND_ANCHOR: if (IS_NULL(ND_BODY(node))) break; /* fall */ case ND_QUANT: r = reduce_string_list(ND_BODY(node), enc); break; case ND_BAG: { BagNode* en = BAG_(node); r = reduce_string_list(ND_BODY(node), enc); if (r != 0) return r; if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = reduce_string_list(en->te.Then, enc); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = reduce_string_list(en->te.Else, enc); if (r != 0) return r; } } } break; default: break; } return r; } #define IN_ALT (1<<0) #define IN_NOT (1<<1) #define IN_REAL_REPEAT (1<<2) #define IN_VAR_REPEAT (1<<3) #define IN_ZERO_REPEAT (1<<4) #define IN_MULTI_ENTRY (1<<5) #define IN_PREC_READ (1<<6) #define IN_LOOK_BEHIND (1<<7) #define IN_PEEK (1<<8) /* divide different length alternatives in look-behind. (?<=A|B) ==> (?<=A)|(?<=B) (? (?type; head = ND_ANCHOR_BODY(an); np = ND_CAR(head); node_swap(node, head); ND_CAR(node) = head; ND_BODY(head) = np; np = node; while (IS_NOT_NULL(np = ND_CDR(np))) { r = onig_node_copy(&insert_node, head); if (r != 0) return r; CHECK_NULL_RETURN_MEMERR(insert_node); ND_BODY(insert_node) = ND_CAR(np); ND_CAR(np) = insert_node; } if (anc_type == ANCR_LOOK_BEHIND_NOT) { np = node; do { ND_SET_TYPE(np, ND_LIST); /* alt -> list */ } while (IS_NOT_NULL(np = ND_CDR(np))); } return 0; } static int node_reduce_in_look_behind(Node* node) { NodeType type; Node* body; if (ND_TYPE(node) != ND_QUANT) return 0; body = ND_BODY(node); type = ND_TYPE(body); if (type == ND_STRING || type == ND_CTYPE || type == ND_CCLASS || type == ND_BACKREF) { QuantNode* qn = QUANT_(node); qn->upper = qn->lower; if (qn->upper == 0) return 1; /* removed */ } return 0; } static int list_reduce_in_look_behind(Node* node) { int r; switch (ND_TYPE(node)) { case ND_QUANT: r = node_reduce_in_look_behind(node); if (r > 0) r = 0; break; case ND_LIST: do { r = node_reduce_in_look_behind(ND_CAR(node)); if (r <= 0) break; } while (IS_NOT_NULL(node = ND_CDR(node))); break; default: r = 0; break; } return r; } static int alt_reduce_in_look_behind(Node* node, regex_t* reg, ParseEnv* env) { int r; switch (ND_TYPE(node)) { case ND_ALT: do { r = list_reduce_in_look_behind(ND_CAR(node)); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; default: r = list_reduce_in_look_behind(node); break; } return r; } static int tune_tree(Node* node, regex_t* reg, int state, ParseEnv* env); static int tune_look_behind(Node* node, regex_t* reg, int state, ParseEnv* env) { int r; int state1; int used; MinMaxCharLen ci; Node* body; AnchorNode* an = ANCHOR_(node); used = FALSE; r = check_node_in_look_behind(ND_ANCHOR_BODY(an), an->type == ANCR_LOOK_BEHIND_NOT ? 1 : 0, &used); if (r < 0) return r; if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; if (an->type == ANCR_LOOK_BEHIND_NOT) state1 = state | IN_NOT | IN_LOOK_BEHIND; else state1 = state | IN_LOOK_BEHIND; body = ND_ANCHOR_BODY(an); /* Execute tune_tree(body) before call node_char_len(). Because case-fold expansion must be done before node_char_len(). */ r = tune_tree(body, reg, state1, env); if (r != 0) return r; r = alt_reduce_in_look_behind(body, reg, env); if (r != 0) return r; r = node_char_len(body, reg, &ci, env); if (r >= 0) { /* #177: overflow in onigenc_step_back() */ if ((ci.max != INFINITE_LEN && ci.max > LOOK_BEHIND_MAX_CHAR_LEN) || ci.min > LOOK_BEHIND_MAX_CHAR_LEN) { return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; } if (ci.min == 0 && ci.min_is_sure != FALSE && used == FALSE) { if (an->type == ANCR_LOOK_BEHIND_NOT) r = onig_node_reset_fail(node); else r = onig_node_reset_empty(node); return r; } if (r == CHAR_LEN_TOP_ALT_FIXED) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND)) { r = divide_look_behind_alternatives(node); if (r == 0) r = tune_tree(node, reg, state, env); } else if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND)) goto normal; else r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; } else { /* CHAR_LEN_NORMAL */ normal: if (ci.min == INFINITE_LEN) { r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; } else { if (ci.min != ci.max && ! IS_SYNTAX_BV(env->syntax, ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND)) { r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN; } else { Node* tail; /* check lead_node is already set by double call after divide_look_behind_alternatives() */ if (IS_NULL(an->lead_node)) { an->char_min_len = ci.min; an->char_max_len = ci.max; r = get_tree_tail_literal(body, &tail, reg, 0); if (r == GET_VALUE_FOUND) { r = onig_node_copy(&(an->lead_node), tail); if (r != 0) return r; } } r = ONIG_NORMAL; } } } } return r; } static int tune_next(Node* node, Node* next_node, regex_t* reg) { int called; NodeType type; called = FALSE; retry: type = ND_TYPE(node); if (type == ND_QUANT) { QuantNode* qn = QUANT_(node); if (qn->greedy && IS_INFINITE_REPEAT(qn->upper)) { #ifdef USE_QUANT_PEEK_NEXT if (called == FALSE) { Node* n = get_tree_head_literal(next_node, 1, reg); /* '\0': for UTF-16BE etc... */ if (IS_NOT_NULL(n) && STR_(n)->s[0] != '\0') { qn->next_head_exact = n; } } #endif /* automatic posseivation a*b ==> (?>a*)b */ if (qn->lower <= 1) { if (is_strict_real_node(ND_BODY(node))) { Node *x, *y; x = get_tree_head_literal(ND_BODY(node), 0, reg); if (IS_NOT_NULL(x)) { y = get_tree_head_literal(next_node, 0, reg); if (IS_NOT_NULL(y) && is_exclusive(x, y, reg)) { Node* en = onig_node_new_bag(BAG_STOP_BACKTRACK); CHECK_NULL_RETURN_MEMERR(en); ND_STATUS_ADD(en, STRICT_REAL_REPEAT); node_swap(node, en); ND_BODY(node) = en; } } } } } } else if (type == ND_BAG) { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_CALLED(node)) called = TRUE; node = ND_BODY(node); goto retry; } } return 0; } static int is_all_code_len_1_items(int n, OnigCaseFoldCodeItem items[]) { int i; for (i = 0; i < n; i++) { OnigCaseFoldCodeItem* item = items + i; if (item->code_len != 1) return 0; } return 1; } static int get_min_max_byte_len_case_fold_items(int n, OnigCaseFoldCodeItem items[], OnigLen* rmin, OnigLen* rmax) { int i; OnigLen len, minlen, maxlen; minlen = INFINITE_LEN; maxlen = 0; for (i = 0; i < n; i++) { OnigCaseFoldCodeItem* item = items + i; len = item->byte_len; if (len < minlen) minlen = len; if (len > maxlen) maxlen = len; } *rmin = minlen; *rmax = maxlen; return 0; } static int make_code_list_to_string(Node** rnode, OnigEncoding enc, int n, OnigCodePoint codes[]) { int r, i, len; Node* node; UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN]; *rnode = NULL_NODE; node = onig_node_new_str(NULL, NULL); CHECK_NULL_RETURN_MEMERR(node); for (i = 0; i < n; i++) { len = ONIGENC_CODE_TO_MBC(enc, codes[i], buf); if (len < 0) { r = len; goto err; } r = onig_node_str_cat(node, buf, buf + len); if (r != 0) goto err; } *rnode = node; return 0; err: onig_node_free(node); return r; } static int unravel_cf_node_add(Node** rlist, Node* add) { Node *list; list = *rlist; if (IS_NULL(list)) { list = onig_node_new_list(add, NULL); CHECK_NULL_RETURN_MEMERR(list); *rlist = list; } else { Node* r = node_list_add(list, add); CHECK_NULL_RETURN_MEMERR(r); } return 0; } static int unravel_cf_string_add(Node** rlist, Node** rsn, UChar* s, UChar* end, unsigned int flag) { int r; Node *sn, *list; list = *rlist; sn = *rsn; if (IS_NOT_NULL(sn) && STR_(sn)->flag == flag) { r = onig_node_str_cat(sn, s, end); } else { sn = onig_node_new_str(s, end); CHECK_NULL_RETURN_MEMERR(sn); STR_(sn)->flag = flag; r = unravel_cf_node_add(&list, sn); } if (r == 0) { *rlist = list; *rsn = sn; } return r; } static int unravel_cf_string_alt_or_cc_add(Node** rlist, int n, OnigCaseFoldCodeItem items[], OnigEncoding enc, OnigCaseFoldType case_fold_flag, UChar* s, UChar* end) { int r, i; Node* node; if (is_all_code_len_1_items(n, items)) { OnigCodePoint codes[14];/* least ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM + 1 */ codes[0] = ONIGENC_MBC_TO_CODE(enc, s, end); for (i = 0; i < n; i++) { OnigCaseFoldCodeItem* item = items + i; codes[i+1] = item->code[0]; } r = onig_new_cclass_with_code_list(&node, enc, n + 1, codes); if (r != 0) return r; } else { Node *snode, *alt, *curr; snode = onig_node_new_str(s, end); CHECK_NULL_RETURN_MEMERR(snode); node = curr = onig_node_new_alt(snode, NULL_NODE); if (IS_NULL(curr)) { onig_node_free(snode); return ONIGERR_MEMORY; } r = 0; for (i = 0; i < n; i++) { OnigCaseFoldCodeItem* item = items + i; r = make_code_list_to_string(&snode, enc, item->code_len, item->code); if (r != 0) { onig_node_free(node); return r; } alt = onig_node_new_alt(snode, NULL_NODE); if (IS_NULL(alt)) { onig_node_free(snode); onig_node_free(node); return ONIGERR_MEMORY; } ND_CDR(curr) = alt; curr = alt; } } r = unravel_cf_node_add(rlist, node); if (r != 0) onig_node_free(node); return r; } static int unravel_cf_look_behind_add(Node** rlist, Node** rsn, int n, OnigCaseFoldCodeItem items[], OnigEncoding enc, UChar* s, OnigLen one_len) { int r, i, found; found = FALSE; for (i = 0; i < n; i++) { OnigCaseFoldCodeItem* item = items + i; if (item->byte_len == one_len) { if (item->code_len == 1) { found = TRUE; break; } } } if (found == FALSE) { r = unravel_cf_string_add(rlist, rsn, s, s + one_len, 0 /* flag */); } else { Node* node; OnigCodePoint codes[14];/* least ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM + 1 */ found = 0; codes[found++] = ONIGENC_MBC_TO_CODE(enc, s, s + one_len); for (i = 0; i < n; i++) { OnigCaseFoldCodeItem* item = items + i; if (item->byte_len == one_len) { if (item->code_len == 1) { codes[found++] = item->code[0]; } } } r = onig_new_cclass_with_code_list(&node, enc, found, codes); if (r != 0) return r; r = unravel_cf_node_add(rlist, node); if (r != 0) onig_node_free(node); *rsn = NULL_NODE; } return r; } static int unravel_case_fold_string(Node* node, regex_t* reg, int state) { int r, n, in_look_behind; OnigLen min_len, max_len, one_len; UChar *start, *end, *p, *q; StrNode* snode; Node *sn, *list; OnigEncoding enc; OnigCaseFoldCodeItem items[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM]; if (ND_STRING_IS_CASE_EXPANDED(node)) return 0; ND_STATUS_REMOVE(node, IGNORECASE); snode = STR_(node); start = snode->s; end = snode->end; if (start >= end) return 0; in_look_behind = (state & IN_LOOK_BEHIND) != 0; enc = reg->enc; list = sn = NULL_NODE; p = start; while (p < end) { n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag, p, end, items); if (n < 0) { r = n; goto err; } one_len = (OnigLen )enclen(enc, p); if (n == 0) { q = p + one_len; if (q > end) q = end; r = unravel_cf_string_add(&list, &sn, p, q, 0 /* flag */); if (r != 0) goto err; } else { if (in_look_behind != 0) { q = p + one_len; if (items[0].byte_len != one_len) { r = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag, p, q, items); if (r < 0) goto err; n = r; } r = unravel_cf_look_behind_add(&list, &sn, n, items, enc, p, one_len); if (r != 0) goto err; } else { get_min_max_byte_len_case_fold_items(n, items, &min_len, &max_len); if (min_len != max_len) { r = ONIGERR_PARSER_BUG; goto err; } q = p + max_len; r = unravel_cf_string_alt_or_cc_add(&list, n, items, enc, reg->case_fold_flag, p, q); if (r != 0) goto err; sn = NULL_NODE; } } p = q; } if (IS_NOT_NULL(list)) { if (node_list_len(list) == 1) { node_swap(node, ND_CAR(list)); } else { node_swap(node, list); } onig_node_free(list); } else { node_swap(node, sn); onig_node_free(sn); } return 0; err: if (IS_NOT_NULL(list)) onig_node_free(list); else if (IS_NOT_NULL(sn)) onig_node_free(sn); return r; } #ifdef USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT static enum BodyEmptyType quantifiers_memory_node_info(Node* node) { int r = BODY_MAY_BE_EMPTY; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: { int v; do { v = quantifiers_memory_node_info(ND_CAR(node)); if (v > r) r = v; } while (IS_NOT_NULL(node = ND_CDR(node))); } break; #ifdef USE_CALL case ND_CALL: if (ND_IS_RECURSION(node)) { return BODY_MAY_BE_EMPTY_REC; /* tiny version */ } else r = quantifiers_memory_node_info(ND_BODY(node)); break; #endif case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->upper != 0) { r = quantifiers_memory_node_info(ND_BODY(node)); } } break; case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_MEMORY: if (ND_IS_RECURSION(node)) { return BODY_MAY_BE_EMPTY_REC; } return BODY_MAY_BE_EMPTY_MEM; break; case BAG_OPTION: case BAG_STOP_BACKTRACK: r = quantifiers_memory_node_info(ND_BODY(node)); break; case BAG_IF_ELSE: { int v; r = quantifiers_memory_node_info(ND_BODY(node)); if (IS_NOT_NULL(en->te.Then)) { v = quantifiers_memory_node_info(en->te.Then); if (v > r) r = v; } if (IS_NOT_NULL(en->te.Else)) { v = quantifiers_memory_node_info(en->te.Else); if (v > r) r = v; } } break; } } break; case ND_BACKREF: case ND_STRING: case ND_CTYPE: case ND_CCLASS: case ND_ANCHOR: case ND_GIMMICK: default: break; } return r; } #endif /* USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT */ #ifdef USE_CALL #ifdef __GNUC__ __inline #endif static int check_call_reference(CallNode* cn, ParseEnv* env, int state) { MemEnv* mem_env = PARSEENV_MEMENV(env); if (cn->by_number != 0) { int gnum = cn->called_gnum; if (env->num_named > 0 && IS_SYNTAX_BV(env->syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) && ! OPTON_CAPTURE_GROUP(env->options)) { return ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED; } if (gnum > env->num_mem) { onig_scan_env_set_error_string(env, ONIGERR_UNDEFINED_GROUP_REFERENCE, cn->name, cn->name_end); return ONIGERR_UNDEFINED_GROUP_REFERENCE; } set_call_attr: ND_CALL_BODY(cn) = mem_env[cn->called_gnum].mem_node; if (IS_NULL(ND_CALL_BODY(cn))) { onig_scan_env_set_error_string(env, ONIGERR_UNDEFINED_NAME_REFERENCE, cn->name, cn->name_end); return ONIGERR_UNDEFINED_NAME_REFERENCE; } ND_STATUS_ADD(ND_CALL_BODY(cn), REFERENCED); } else { int *refs; int n = onig_name_to_group_numbers(env->reg, cn->name, cn->name_end, &refs); if (n <= 0) { onig_scan_env_set_error_string(env, ONIGERR_UNDEFINED_NAME_REFERENCE, cn->name, cn->name_end); return ONIGERR_UNDEFINED_NAME_REFERENCE; } else if (n > 1) { onig_scan_env_set_error_string(env, ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL, cn->name, cn->name_end); return ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL; } else { cn->called_gnum = refs[0]; goto set_call_attr; } } return 0; } #ifdef USE_WHOLE_OPTIONS static int check_whole_options_position(Node* node /* root */, ParseEnv* env) { int is_list; is_list = FALSE; #ifdef USE_CALL if ((env->flags & PE_FLAG_HAS_CALL_ZERO) != 0) { node = ND_BODY(node); } #endif start: switch (ND_TYPE(node)) { case ND_LIST: if (IS_NOT_NULL(ND_CDR(node))) is_list = TRUE; node = ND_CAR(node); goto start; break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_OPTION) { if (ND_IS_WHOLE_OPTIONS(node)) { if (is_list == TRUE && IS_NOT_NULL(ND_BODY(node))) break; return 0; } } } break; default: break; } return ONIGERR_INVALID_GROUP_OPTION; } #endif static void tune_call2_call(Node* node) { switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { tune_call2_call(ND_CAR(node)); } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: tune_call2_call(ND_BODY(node)); break; case ND_ANCHOR: if (ANCHOR_HAS_BODY(ANCHOR_(node))) tune_call2_call(ND_BODY(node)); break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (! ND_IS_MARK1(node)) { ND_STATUS_ADD(node, MARK1); tune_call2_call(ND_BODY(node)); ND_STATUS_REMOVE(node, MARK1); } } else if (en->type == BAG_IF_ELSE) { tune_call2_call(ND_BODY(node)); if (IS_NOT_NULL(en->te.Then)) tune_call2_call(en->te.Then); if (IS_NOT_NULL(en->te.Else)) tune_call2_call(en->te.Else); } else { tune_call2_call(ND_BODY(node)); } } break; case ND_CALL: if (! ND_IS_MARK1(node)) { ND_STATUS_ADD(node, MARK1); { CallNode* cn = CALL_(node); Node* called = ND_CALL_BODY(cn); cn->entry_count++; ND_STATUS_ADD(called, CALLED); BAG_(called)->m.entry_count++; tune_call2_call(called); } ND_STATUS_REMOVE(node, MARK1); } break; default: break; } } static int tune_call(Node* node, ParseEnv* env, int state) { int r; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = tune_call(ND_CAR(node), env, state); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: if (QUANT_(node)->upper == 0) state |= IN_ZERO_REPEAT; r = tune_call(ND_BODY(node), env, state); break; case ND_ANCHOR: if (ANCHOR_HAS_BODY(ANCHOR_(node))) r = tune_call(ND_BODY(node), env, state); else r = 0; break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if ((state & IN_ZERO_REPEAT) != 0) { ND_STATUS_ADD(node, IN_ZERO_REPEAT); BAG_(node)->m.entry_count--; } r = tune_call(ND_BODY(node), env, state); } else if (en->type == BAG_IF_ELSE) { r = tune_call(ND_BODY(node), env, state); if (r != 0) return r; if (IS_NOT_NULL(en->te.Then)) { r = tune_call(en->te.Then, env, state); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) r = tune_call(en->te.Else, env, state); } else r = tune_call(ND_BODY(node), env, state); } break; case ND_CALL: if ((state & IN_ZERO_REPEAT) != 0) { ND_STATUS_ADD(node, IN_ZERO_REPEAT); CALL_(node)->entry_count--; } r = check_call_reference(CALL_(node), env, state); break; default: r = 0; break; } return r; } static int tune_call2(Node* node) { int r = 0; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = tune_call2(ND_CAR(node)); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: if (QUANT_(node)->upper != 0) r = tune_call2(ND_BODY(node)); break; case ND_ANCHOR: if (ANCHOR_HAS_BODY(ANCHOR_(node))) r = tune_call2(ND_BODY(node)); break; case ND_BAG: if (! ND_IS_IN_ZERO_REPEAT(node)) r = tune_call2(ND_BODY(node)); { BagNode* en = BAG_(node); if (r != 0) return r; if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = tune_call2(en->te.Then); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) r = tune_call2(en->te.Else); } } break; case ND_CALL: if (! ND_IS_IN_ZERO_REPEAT(node)) { tune_call2_call(node); } break; default: break; } return r; } static void tune_called_state_call(Node* node, int state) { switch (ND_TYPE(node)) { case ND_ALT: state |= IN_ALT; /* fall */ case ND_LIST: do { tune_called_state_call(ND_CAR(node), state); } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (IS_INFINITE_REPEAT(qn->upper) || qn->upper >= 2) state |= IN_REAL_REPEAT; if (qn->lower != qn->upper) state |= IN_VAR_REPEAT; if ((state & IN_PEEK) != 0) ND_STATUS_ADD(node, INPEEK); tune_called_state_call(ND_QUANT_BODY(qn), state); } break; case ND_ANCHOR: { AnchorNode* an = ANCHOR_(node); switch (an->type) { case ANCR_PREC_READ_NOT: case ANCR_LOOK_BEHIND_NOT: state |= (IN_NOT | IN_PEEK); tune_called_state_call(ND_ANCHOR_BODY(an), state); break; case ANCR_PREC_READ: case ANCR_LOOK_BEHIND: state |= IN_PEEK; tune_called_state_call(ND_ANCHOR_BODY(an), state); break; default: break; } } break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_MEMORY) { if (ND_IS_MARK1(node)) { if ((~en->m.called_state & state) != 0) { en->m.called_state |= state; tune_called_state_call(ND_BODY(node), state); } } else { ND_STATUS_ADD(node, MARK1); en->m.called_state |= state; tune_called_state_call(ND_BODY(node), state); ND_STATUS_REMOVE(node, MARK1); } } else if (en->type == BAG_IF_ELSE) { state |= IN_ALT; tune_called_state_call(ND_BODY(node), state); if (IS_NOT_NULL(en->te.Then)) { tune_called_state_call(en->te.Then, state); } if (IS_NOT_NULL(en->te.Else)) tune_called_state_call(en->te.Else, state); } else { tune_called_state_call(ND_BODY(node), state); } } break; case ND_CALL: if ((state & IN_PEEK) != 0) ND_STATUS_ADD(node, INPEEK); if ((state & IN_REAL_REPEAT) != 0) ND_STATUS_ADD(node, IN_REAL_REPEAT); tune_called_state_call(ND_BODY(node), state); break; default: break; } } static void tune_called_state(Node* node, int state) { switch (ND_TYPE(node)) { case ND_ALT: state |= IN_ALT; /* fall */ case ND_LIST: do { tune_called_state(ND_CAR(node), state); } while (IS_NOT_NULL(node = ND_CDR(node))); break; #ifdef USE_CALL case ND_CALL: if ((state & IN_PEEK) != 0) ND_STATUS_ADD(node, INPEEK); if ((state & IN_REAL_REPEAT) != 0) ND_STATUS_ADD(node, IN_REAL_REPEAT); tune_called_state_call(node, state); break; #endif case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_MEMORY: if (en->m.entry_count > 1) state |= IN_MULTI_ENTRY; en->m.called_state |= state; /* fall */ case BAG_OPTION: case BAG_STOP_BACKTRACK: tune_called_state(ND_BODY(node), state); break; case BAG_IF_ELSE: state |= IN_ALT; tune_called_state(ND_BODY(node), state); if (IS_NOT_NULL(en->te.Then)) tune_called_state(en->te.Then, state); if (IS_NOT_NULL(en->te.Else)) tune_called_state(en->te.Else, state); break; } } break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (IS_INFINITE_REPEAT(qn->upper) || qn->upper >= 2) state |= IN_REAL_REPEAT; if (qn->lower != qn->upper) state |= IN_VAR_REPEAT; if ((state & IN_PEEK) != 0) ND_STATUS_ADD(node, INPEEK); tune_called_state(ND_QUANT_BODY(qn), state); } break; case ND_ANCHOR: { AnchorNode* an = ANCHOR_(node); switch (an->type) { case ANCR_PREC_READ_NOT: case ANCR_LOOK_BEHIND_NOT: state |= (IN_NOT | IN_PEEK); tune_called_state(ND_ANCHOR_BODY(an), state); break; case ANCR_PREC_READ: case ANCR_LOOK_BEHIND: state |= IN_PEEK; tune_called_state(ND_ANCHOR_BODY(an), state); break; default: break; } } break; case ND_BACKREF: case ND_STRING: case ND_CTYPE: case ND_CCLASS: case ND_GIMMICK: default: break; } } #endif /* USE_CALL */ #ifdef __GNUC__ __inline #endif static int tune_anchor(Node* node, regex_t* reg, int state, ParseEnv* env) { int r; AnchorNode* an = ANCHOR_(node); switch (an->type) { case ANCR_PREC_READ: r = tune_tree(ND_ANCHOR_BODY(an), reg, (state | IN_PREC_READ), env); break; case ANCR_PREC_READ_NOT: r = tune_tree(ND_ANCHOR_BODY(an), reg, (state | IN_PREC_READ | IN_NOT), env); break; case ANCR_LOOK_BEHIND: case ANCR_LOOK_BEHIND_NOT: r = tune_look_behind(node, reg, state, env); break; default: r = 0; break; } return r; } #ifdef __GNUC__ __inline #endif static int tune_quant(Node* node, regex_t* reg, int state, ParseEnv* env) { int r; QuantNode* qn = QUANT_(node); Node* body = ND_BODY(node); if ((state & IN_REAL_REPEAT) != 0) { ND_STATUS_ADD(node, IN_REAL_REPEAT); } if ((state & IN_MULTI_ENTRY) != 0) { ND_STATUS_ADD(node, IN_MULTI_ENTRY); } if (IS_INFINITE_REPEAT(qn->upper) || qn->upper >= 1) { OnigLen d = node_min_byte_len(body, env); if (d == 0) { #ifdef USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT qn->emptiness = quantifiers_memory_node_info(body); #else qn->emptiness = BODY_MAY_BE_EMPTY; #endif } } if (IS_INFINITE_REPEAT(qn->upper) || qn->upper >= 2) state |= IN_REAL_REPEAT; if (qn->lower != qn->upper) state |= IN_VAR_REPEAT; r = tune_tree(body, reg, state, env); if (r != 0) return r; /* expand string */ #define EXPAND_STRING_MAX_LENGTH 100 if (ND_TYPE(body) == ND_STRING) { if (!IS_INFINITE_REPEAT(qn->lower) && qn->lower == qn->upper && qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) { int len = ND_STRING_LEN(body); if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) { int i, n = qn->lower; node_conv_to_str_node(node, body); for (i = 0; i < n; i++) { r = node_str_node_cat(node, body); if (r != 0) return r; } onig_node_free(body); return r; } } } if (qn->greedy && (qn->emptiness == BODY_IS_NOT_EMPTY)) { if (ND_TYPE(body) == ND_QUANT) { QuantNode* tqn = QUANT_(body); if (IS_NOT_NULL(tqn->head_exact)) { qn->head_exact = tqn->head_exact; tqn->head_exact = NULL; } } else { qn->head_exact = get_tree_head_literal(ND_BODY(node), 1, reg); } } return r; } /* tune_tree does the following work. 1. check empty loop. (set qn->emptiness) 2. expand ignore-case in char class. 3. set memory status bit flags. (reg->mem_stats) 4. set qn->head_exact for [push, exact] -> [push_or_jump_exact1, exact]. 5. find invalid patterns in look-behind. 6. expand repeated string. */ static int tune_tree(Node* node, regex_t* reg, int state, ParseEnv* env) { int r = 0; switch (ND_TYPE(node)) { case ND_LIST: { Node* prev = NULL_NODE; do { r = tune_tree(ND_CAR(node), reg, state, env); if (IS_NOT_NULL(prev) && r == 0) { r = tune_next(prev, ND_CAR(node), reg); } prev = ND_CAR(node); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); } break; case ND_ALT: do { r = tune_tree(ND_CAR(node), reg, (state | IN_ALT), env); } while (r == 0 && IS_NOT_NULL(node = ND_CDR(node))); break; case ND_STRING: if (ND_IS_REAL_IGNORECASE(node)) { r = unravel_case_fold_string(node, reg, state); } break; case ND_BACKREF: { int i; int* p; BackRefNode* br = BACKREF_(node); p = BACKREFS_P(br); for (i = 0; i < br->back_num; i++) { if (p[i] > env->num_mem) return ONIGERR_INVALID_BACKREF; MEM_STATUS_ON(env->backrefed_mem, p[i]); #if 0 #ifdef USE_BACKREF_WITH_LEVEL if (ND_IS_NEST_LEVEL(node)) { MEM_STATUS_ON(env->backtrack_mem, p[i]); } #endif #else /* More precisely, it should be checked whether alt/repeat exists before the subject capture node, and then this backreference position exists before (or in) the capture node. */ MEM_STATUS_ON(env->backtrack_mem, p[i]); #endif } } break; case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_OPTION: { OnigOptionType options = reg->options; reg->options = BAG_(node)->o.options; r = tune_tree(ND_BODY(node), reg, state, env); reg->options = options; } break; case BAG_MEMORY: #ifdef USE_CALL state |= en->m.called_state; #endif if ((state & (IN_ALT | IN_NOT | IN_VAR_REPEAT | IN_MULTI_ENTRY)) != 0 || ND_IS_RECURSION(node)) { MEM_STATUS_ON(env->backtrack_mem, en->m.regnum); } r = tune_tree(ND_BODY(node), reg, state, env); break; case BAG_STOP_BACKTRACK: { Node* target = ND_BODY(node); r = tune_tree(target, reg, state, env); if (ND_TYPE(target) == ND_QUANT) { QuantNode* tqn = QUANT_(target); if (IS_INFINITE_REPEAT(tqn->upper) && tqn->lower <= 1 && tqn->greedy != 0) { /* (?>a*), a*+ etc... */ if (is_strict_real_node(ND_BODY(target))) ND_STATUS_ADD(node, STRICT_REAL_REPEAT); } } } break; case BAG_IF_ELSE: r = tune_tree(ND_BODY(node), reg, (state | IN_ALT), env); if (r != 0) return r; if (IS_NOT_NULL(en->te.Then)) { r = tune_tree(en->te.Then, reg, (state | IN_ALT), env); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) r = tune_tree(en->te.Else, reg, (state | IN_ALT), env); break; } } break; case ND_QUANT: if ((state & (IN_PREC_READ | IN_LOOK_BEHIND)) != 0) ND_STATUS_ADD(node, INPEEK); r = tune_quant(node, reg, state, env); break; case ND_ANCHOR: r = tune_anchor(node, reg, state, env); break; #ifdef USE_CALL case ND_CALL: #endif case ND_CTYPE: case ND_CCLASS: case ND_GIMMICK: default: break; } return r; } #ifndef ONIG_DONT_OPTIMIZE static int set_sunday_quick_search_or_bmh_skip_table(regex_t* reg, int case_expand, UChar* s, UChar* end, UChar skip[], int* roffset) { int i, j, k, len, offset; int n, clen; UChar* p; OnigEncoding enc; OnigCaseFoldCodeItem items[ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM]; UChar buf[ONIGENC_MBC_CASE_FOLD_MAXLEN]; enc = reg->enc; offset = ENC_GET_SKIP_OFFSET(enc); if (offset == ENC_SKIP_OFFSET_1_OR_0) { UChar* p = s; while (1) { len = enclen(enc, p); if (p + len >= end) { if (len == 1) offset = 1; else offset = 0; break; } p += len; } } len = (int )(end - s); if (len + offset >= UCHAR_MAX) return ONIGERR_PARSER_BUG; *roffset = offset; for (i = 0; i < CHAR_MAP_SIZE; i++) { skip[i] = (UChar )(len + offset); } for (p = s; p < end; ) { int z; clen = enclen(enc, p); if (p + clen > end) clen = (int )(end - p); len = (int )(end - p); for (j = 0; j < clen; j++) { z = len - j + (offset - 1); if (z <= 0) break; skip[p[j]] = z; } if (case_expand != 0) { n = ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc, reg->case_fold_flag, p, end, items); for (k = 0; k < n; k++) { ONIGENC_CODE_TO_MBC(enc, items[k].code[0], buf); for (j = 0; j < clen; j++) { z = len - j + (offset - 1); if (z <= 0) break; if (skip[buf[j]] > z) skip[buf[j]] = z; } } } p += clen; } return 0; } #endif #define OPT_EXACT_MAXLEN 24 #if OPT_EXACT_MAXLEN >= UCHAR_MAX #error Too big OPT_EXACT_MAXLEN #endif typedef struct { MinMaxLen mm; OnigEncoding enc; OnigCaseFoldType case_fold_flag; ParseEnv* scan_env; } OptEnv; typedef struct { int left; int right; } OptAnc; typedef struct { MinMaxLen mm; /* position */ OptAnc anc; int reach_end; int len; UChar s[OPT_EXACT_MAXLEN]; } OptStr; typedef struct { MinMaxLen mm; /* position */ OptAnc anc; int value; /* weighted value */ UChar map[CHAR_MAP_SIZE]; } OptMap; typedef struct { MinMaxLen len; OptAnc anc; OptStr sb; /* boundary */ OptStr sm; /* middle */ OptStr spr; /* prec read (?=...) */ OptMap map; /* boundary */ } OptNode; #ifndef ONIG_DONT_OPTIMIZE static int map_position_value(OnigEncoding enc, int i) { static const short int Vals[] = { 5, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 4, 7, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 5, 5, 5, 5, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 1 }; if (i < (int )(sizeof(Vals)/sizeof(Vals[0]))) { if (i == 0 && ONIGENC_MBC_MINLEN(enc) > 1) return 20; else return (int )Vals[i]; } else return 4; /* Take it easy. */ } static int distance_value(MinMaxLen* mm) { /* 1000 / (min-max-dist + 1) */ static const short int dist_vals[] = { 1000, 500, 333, 250, 200, 167, 143, 125, 111, 100, 91, 83, 77, 71, 67, 63, 59, 56, 53, 50, 48, 45, 43, 42, 40, 38, 37, 36, 34, 33, 32, 31, 30, 29, 29, 28, 27, 26, 26, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, 16, 16, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10 }; OnigLen d; if (mm->max == INFINITE_LEN) return 0; d = mm->max - mm->min; if (d < (OnigLen )(sizeof(dist_vals)/sizeof(dist_vals[0]))) /* return dist_vals[d] * 16 / (mm->min + 12); */ return (int )dist_vals[d]; else return 1; } static int comp_distance_value(MinMaxLen* d1, MinMaxLen* d2, int v1, int v2) { if (v2 <= 0) return -1; if (v1 <= 0) return 1; v1 *= distance_value(d1); v2 *= distance_value(d2); if (v2 > v1) return 1; if (v2 < v1) return -1; if (d2->min < d1->min) return 1; if (d2->min > d1->min) return -1; return 0; } static void copy_opt_env(OptEnv* to, OptEnv* from) { *to = *from; } static void clear_opt_anc_info(OptAnc* a) { a->left = 0; a->right = 0; } static void copy_opt_anc_info(OptAnc* to, OptAnc* from) { *to = *from; } static void concat_opt_anc_info(OptAnc* to, OptAnc* left, OptAnc* right, OnigLen left_len, OnigLen right_len) { clear_opt_anc_info(to); to->left = left->left; if (left_len == 0) { to->left |= right->left; } to->right = right->right; if (right_len == 0) { to->right |= left->right; } else { to->right |= (left->right & ANCR_PREC_READ_NOT); } } static int is_left(int a) { if (a == ANCR_END_BUF || a == ANCR_SEMI_END_BUF || a == ANCR_END_LINE || a == ANCR_PREC_READ || a == ANCR_PREC_READ_NOT) return 0; return 1; } static int is_set_opt_anc_info(OptAnc* to, int anc) { if ((to->left & anc) != 0) return 1; return ((to->right & anc) != 0 ? 1 : 0); } static void add_opt_anc_info(OptAnc* to, int anc) { if (is_left(anc)) to->left |= anc; else to->right |= anc; } static void remove_opt_anc_info(OptAnc* to, int anc) { if (is_left(anc)) to->left &= ~anc; else to->right &= ~anc; } static void alt_merge_opt_anc_info(OptAnc* to, OptAnc* add) { to->left &= add->left; to->right &= add->right; } static int is_full_opt_exact(OptStr* e) { return e->len >= OPT_EXACT_MAXLEN; } static void clear_opt_exact(OptStr* e) { mml_clear(&e->mm); clear_opt_anc_info(&e->anc); e->reach_end = 0; e->len = 0; e->s[0] = '\0'; } static void copy_opt_exact(OptStr* to, OptStr* from) { *to = *from; } static int concat_opt_exact(OptStr* to, OptStr* add, OnigEncoding enc) { int i, j, len, r; UChar *p, *end; OptAnc tanc; r = 0; p = add->s; end = p + add->len; for (i = to->len; p < end; ) { len = enclen(enc, p); if (i + len > OPT_EXACT_MAXLEN) { r = 1; /* 1:full */ break; } for (j = 0; j < len && p < end; j++) { /* coverity[overrun-local] */ to->s[i++] = *p++; } } to->len = i; to->reach_end = (p == end ? add->reach_end : 0); concat_opt_anc_info(&tanc, &to->anc, &add->anc, 1, 1); if (! to->reach_end) tanc.right = 0; copy_opt_anc_info(&to->anc, &tanc); return r; } static void concat_opt_exact_str(OptStr* to, UChar* s, UChar* end, OnigEncoding enc) { int i, j, len; UChar *p; for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) { len = enclen(enc, p); if (i + len > OPT_EXACT_MAXLEN) break; for (j = 0; j < len && p < end; j++) { /* coverity[overrun-local] */ to->s[i++] = *p++; } } to->len = i; if (p >= end) to->reach_end = 1; } static void alt_merge_opt_exact(OptStr* to, OptStr* add, OptEnv* env) { int i, j, len; if (add->len == 0 || to->len == 0) { clear_opt_exact(to); return ; } if (! mml_is_equal(&to->mm, &add->mm)) { clear_opt_exact(to); return ; } for (i = 0; i < to->len && i < add->len; ) { if (to->s[i] != add->s[i]) break; len = enclen(env->enc, to->s + i); for (j = 1; j < len; j++) { if (to->s[i+j] != add->s[i+j]) break; } if (j < len) break; i += len; } if (! add->reach_end || i < add->len || i < to->len) { to->reach_end = 0; } to->len = i; alt_merge_opt_anc_info(&to->anc, &add->anc); if (! to->reach_end) to->anc.right = 0; } static void select_opt_exact(OnigEncoding enc, OptStr* now, OptStr* alt) { int vn, va; vn = now->len; va = alt->len; if (va == 0) { return ; } else if (vn == 0) { copy_opt_exact(now, alt); return ; } else if (vn <= 2 && va <= 2) { /* ByteValTable[x] is big value --> low price */ va = map_position_value(enc, now->s[0]); vn = map_position_value(enc, alt->s[0]); if (now->len > 1) vn += 5; if (alt->len > 1) va += 5; } vn *= 2; va *= 2; if (comp_distance_value(&now->mm, &alt->mm, vn, va) > 0) copy_opt_exact(now, alt); } static void clear_opt_map(OptMap* map) { static const OptMap clean_info = { {0, 0}, {0, 0}, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; xmemcpy(map, &clean_info, sizeof(OptMap)); } static void copy_opt_map(OptMap* to, OptMap* from) { *to = *from; } static void add_char_opt_map(OptMap* m, UChar c, OnigEncoding enc) { if (m->map[c] == 0) { m->map[c] = 1; m->value += map_position_value(enc, c); } } static void select_opt_map(OptMap* now, OptMap* alt) { static int z = 1<<15; /* 32768: something big value */ int vn, va; if (alt->value == 0) return ; if (now->value == 0) { copy_opt_map(now, alt); return ; } vn = z / now->value; va = z / alt->value; if (comp_distance_value(&now->mm, &alt->mm, vn, va) > 0) copy_opt_map(now, alt); } static int comp_opt_exact_or_map(OptStr* e, OptMap* m) { #define COMP_EM_BASE 20 int ae, am; int case_value; if (m->value <= 0) return -1; case_value = 3; ae = COMP_EM_BASE * e->len * case_value; am = COMP_EM_BASE * 5 * 2 / m->value; return comp_distance_value(&e->mm, &m->mm, ae, am); } static void alt_merge_opt_map(OnigEncoding enc, OptMap* to, OptMap* add) { int i, val; /* if (! mml_is_equal(&to->mm, &add->mm)) return ; */ if (to->value == 0) return ; if (add->value == 0 || to->mm.max < add->mm.min) { clear_opt_map(to); return ; } mml_alt_merge(&to->mm, &add->mm); val = 0; for (i = 0; i < CHAR_MAP_SIZE; i++) { if (add->map[i]) to->map[i] = 1; if (to->map[i]) val += map_position_value(enc, i); } to->value = val; alt_merge_opt_anc_info(&to->anc, &add->anc); } static void set_bound_node_opt_info(OptNode* opt, MinMaxLen* plen) { mml_copy(&(opt->sb.mm), plen); mml_copy(&(opt->spr.mm), plen); mml_copy(&(opt->map.mm), plen); } static void clear_node_opt_info(OptNode* opt) { mml_clear(&opt->len); clear_opt_anc_info(&opt->anc); clear_opt_exact(&opt->sb); clear_opt_exact(&opt->sm); clear_opt_exact(&opt->spr); clear_opt_map(&opt->map); } static void copy_node_opt_info(OptNode* to, OptNode* from) { *to = *from; } static void concat_left_node_opt_info(OnigEncoding enc, OptNode* to, OptNode* add) { int sb_reach, sm_reach; OptAnc tanc; concat_opt_anc_info(&tanc, &to->anc, &add->anc, to->len.max, add->len.max); copy_opt_anc_info(&to->anc, &tanc); if (add->sb.len > 0 && to->len.max == 0) { concat_opt_anc_info(&tanc, &to->anc, &add->sb.anc, to->len.max, add->len.max); copy_opt_anc_info(&add->sb.anc, &tanc); } if (add->map.value > 0 && to->len.max == 0) { if (add->map.mm.max == 0) add->map.anc.left |= to->anc.left; } sb_reach = to->sb.reach_end; sm_reach = to->sm.reach_end; if (add->len.max != 0) to->sb.reach_end = to->sm.reach_end = 0; if (add->sb.len > 0) { if (sb_reach) { concat_opt_exact(&to->sb, &add->sb, enc); clear_opt_exact(&add->sb); } else if (sm_reach) { concat_opt_exact(&to->sm, &add->sb, enc); clear_opt_exact(&add->sb); } } select_opt_exact(enc, &to->sm, &add->sb); select_opt_exact(enc, &to->sm, &add->sm); if (to->spr.len > 0) { if (add->len.max > 0) { if (to->spr.mm.max == 0) select_opt_exact(enc, &to->sb, &to->spr); else select_opt_exact(enc, &to->sm, &to->spr); } } else if (add->spr.len > 0) { copy_opt_exact(&to->spr, &add->spr); } select_opt_map(&to->map, &add->map); mml_add(&to->len, &add->len); } static void alt_merge_node_opt_info(OptNode* to, OptNode* add, OptEnv* env) { alt_merge_opt_anc_info(&to->anc, &add->anc); alt_merge_opt_exact(&to->sb, &add->sb, env); alt_merge_opt_exact(&to->sm, &add->sm, env); alt_merge_opt_exact(&to->spr, &add->spr, env); alt_merge_opt_map(env->enc, &to->map, &add->map); mml_alt_merge(&to->len, &add->len); } static OnigLen node_max_byte_len(Node* node, ParseEnv* env) { OnigLen len; OnigLen tmax; len = 0; switch (ND_TYPE(node)) { case ND_LIST: do { tmax = node_max_byte_len(ND_CAR(node), env); len = distance_add(len, tmax); } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_ALT: do { tmax = node_max_byte_len(ND_CAR(node), env); if (len < tmax) len = tmax; } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_STRING: { StrNode* sn = STR_(node); len = (OnigLen )(sn->end - sn->s); } break; case ND_CTYPE: case ND_CCLASS: len = ONIGENC_MBC_MAXLEN_DIST(env->enc); break; case ND_BACKREF: if (! ND_IS_CHECKER(node)) { int i; int* backs; MemEnv* mem_env = PARSEENV_MEMENV(env); BackRefNode* br = BACKREF_(node); if (ND_IS_RECURSION(node)) { #ifdef USE_BACKREF_WITH_LEVEL if (ND_IS_NEST_LEVEL(node)) { len = INFINITE_LEN; } #endif break; } backs = BACKREFS_P(br); for (i = 0; i < br->back_num; i++) { tmax = node_max_byte_len(mem_env[backs[i]].mem_node, env); if (len < tmax) len = tmax; } } break; #ifdef USE_CALL case ND_CALL: if (! ND_IS_RECURSION(node)) len = node_max_byte_len(ND_BODY(node), env); else len = INFINITE_LEN; break; #endif case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->upper != 0) { len = node_max_byte_len(ND_BODY(node), env); if (len != 0) { if (! IS_INFINITE_REPEAT(qn->upper)) len = distance_multiply(len, qn->upper); else len = INFINITE_LEN; } } } break; case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_MEMORY: if (ND_IS_FIXED_MAX(node)) len = en->max_len; else { if (ND_IS_MARK1(node)) len = INFINITE_LEN; else { ND_STATUS_ADD(node, MARK1); len = node_max_byte_len(ND_BODY(node), env); ND_STATUS_REMOVE(node, MARK1); en->max_len = len; ND_STATUS_ADD(node, FIXED_MAX); } } break; case BAG_OPTION: case BAG_STOP_BACKTRACK: len = node_max_byte_len(ND_BODY(node), env); break; case BAG_IF_ELSE: { OnigLen tlen, elen; len = node_max_byte_len(ND_BODY(node), env); if (IS_NOT_NULL(en->te.Then)) { tlen = node_max_byte_len(en->te.Then, env); len = distance_add(len, tlen); } if (IS_NOT_NULL(en->te.Else)) elen = node_max_byte_len(en->te.Else, env); else elen = 0; if (elen > len) len = elen; } break; } } break; case ND_ANCHOR: case ND_GIMMICK: default: break; } return len; } #define MAX_ND_OPT_INFO_REF_COUNT 5 static int optimize_nodes(Node* node, OptNode* opt, OptEnv* env) { int i; int r; OptNode xo; OnigEncoding enc; r = 0; enc = env->enc; clear_node_opt_info(opt); set_bound_node_opt_info(opt, &env->mm); switch (ND_TYPE(node)) { case ND_LIST: { OptEnv nenv; Node* nd = node; copy_opt_env(&nenv, env); do { r = optimize_nodes(ND_CAR(nd), &xo, &nenv); if (r == 0) { mml_add(&nenv.mm, &xo.len); concat_left_node_opt_info(enc, opt, &xo); } } while (r == 0 && IS_NOT_NULL(nd = ND_CDR(nd))); } break; case ND_ALT: { Node* nd = node; do { r = optimize_nodes(ND_CAR(nd), &xo, env); if (r == 0) { if (nd == node) copy_node_opt_info(opt, &xo); else alt_merge_node_opt_info(opt, &xo, env); } } while ((r == 0) && IS_NOT_NULL(nd = ND_CDR(nd))); } break; case ND_STRING: { StrNode* sn = STR_(node); int slen = (int )(sn->end - sn->s); concat_opt_exact_str(&opt->sb, sn->s, sn->end, enc); if (slen > 0) { add_char_opt_map(&opt->map, *(sn->s), enc); } mml_set_min_max(&opt->len, slen, slen); } break; case ND_CCLASS: { int z; CClassNode* cc = CCLASS_(node); /* no need to check ignore case. (set in tune_tree()) */ if (IS_NOT_NULL(cc->mbuf) || IS_NCCLASS_NOT(cc)) { OnigLen min = ONIGENC_MBC_MINLEN(enc); OnigLen max = ONIGENC_MBC_MAXLEN_DIST(enc); mml_set_min_max(&opt->len, min, max); } else { for (i = 0; i < SINGLE_BYTE_SIZE; i++) { z = BITSET_AT(cc->bs, i); if ((z && ! IS_NCCLASS_NOT(cc)) || (! z && IS_NCCLASS_NOT(cc))) { add_char_opt_map(&opt->map, (UChar )i, enc); } } mml_set_min_max(&opt->len, 1, 1); } } break; case ND_CTYPE: { int min, max; int range; max = ONIGENC_MBC_MAXLEN_DIST(enc); if (max == 1) { min = 1; switch (CTYPE_(node)->ctype) { case CTYPE_ANYCHAR: break; case ONIGENC_CTYPE_WORD: range = CTYPE_(node)->ascii_mode != 0 ? 128 : SINGLE_BYTE_SIZE; if (CTYPE_(node)->not != 0) { for (i = 0; i < range; i++) { if (! ONIGENC_IS_CODE_WORD(enc, i)) { add_char_opt_map(&opt->map, (UChar )i, enc); } } for (i = range; i < SINGLE_BYTE_SIZE; i++) { add_char_opt_map(&opt->map, (UChar )i, enc); } } else { for (i = 0; i < range; i++) { if (ONIGENC_IS_CODE_WORD(enc, i)) { add_char_opt_map(&opt->map, (UChar )i, enc); } } } break; } } else { min = ONIGENC_MBC_MINLEN(enc); } mml_set_min_max(&opt->len, min, max); } break; case ND_ANCHOR: switch (ANCHOR_(node)->type) { case ANCR_BEGIN_BUF: case ANCR_BEGIN_POSITION: case ANCR_BEGIN_LINE: case ANCR_END_BUF: case ANCR_SEMI_END_BUF: case ANCR_END_LINE: case ANCR_PREC_READ_NOT: case ANCR_LOOK_BEHIND: add_opt_anc_info(&opt->anc, ANCHOR_(node)->type); break; case ANCR_PREC_READ: { r = optimize_nodes(ND_BODY(node), &xo, env); if (r == 0) { if (xo.sb.len > 0) copy_opt_exact(&opt->spr, &xo.sb); else if (xo.sm.len > 0) copy_opt_exact(&opt->spr, &xo.sm); opt->spr.reach_end = 0; if (xo.map.value > 0) copy_opt_map(&opt->map, &xo.map); } } break; case ANCR_LOOK_BEHIND_NOT: break; } break; case ND_BACKREF: if (! ND_IS_CHECKER(node)) { OnigLen min, max; min = node_min_byte_len(node, env->scan_env); max = node_max_byte_len(node, env->scan_env); mml_set_min_max(&opt->len, min, max); } break; #ifdef USE_CALL case ND_CALL: if (ND_IS_RECURSION(node)) mml_set_min_max(&opt->len, 0, INFINITE_LEN); else { r = optimize_nodes(ND_BODY(node), opt, env); } break; #endif case ND_QUANT: { OnigLen min, max; QuantNode* qn = QUANT_(node); /* Issue #175 ex. /\g<1>{0}(?<=|())/ Empty and unused nodes in look-behind is removed in tune_look_behind(). Called group nodes are assigned to be not called if the caller side is inside of zero-repetition. As a result, the nodes are considered unused. */ if (qn->upper == 0) { mml_set_min_max(&opt->len, 0, 0); break; } r = optimize_nodes(ND_BODY(node), &xo, env); if (r != 0) break; if (qn->lower > 0) { copy_node_opt_info(opt, &xo); if (xo.sb.len > 0) { if (xo.sb.reach_end) { for (i = 2; i <= qn->lower && ! is_full_opt_exact(&opt->sb); i++) { int rc = concat_opt_exact(&opt->sb, &xo.sb, enc); if (rc > 0) break; } if (i < qn->lower) opt->sb.reach_end = 0; } } if (qn->lower != qn->upper) { opt->sb.reach_end = 0; opt->sm.reach_end = 0; } if (qn->lower > 1) opt->sm.reach_end = 0; } if (IS_INFINITE_REPEAT(qn->upper)) { if (env->mm.max == 0 && ND_IS_ANYCHAR(ND_BODY(node)) && qn->greedy != 0) { if (ND_IS_MULTILINE(ND_QUANT_BODY(qn))) add_opt_anc_info(&opt->anc, ANCR_ANYCHAR_INF_ML); else add_opt_anc_info(&opt->anc, ANCR_ANYCHAR_INF); } max = (xo.len.max > 0 ? INFINITE_LEN : 0); } else { max = distance_multiply(xo.len.max, qn->upper); } min = distance_multiply(xo.len.min, qn->lower); mml_set_min_max(&opt->len, min, max); } break; case ND_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_STOP_BACKTRACK: case BAG_OPTION: r = optimize_nodes(ND_BODY(node), opt, env); break; case BAG_MEMORY: #ifdef USE_CALL en->opt_count++; if (en->opt_count > MAX_ND_OPT_INFO_REF_COUNT) { OnigLen min, max; min = 0; max = INFINITE_LEN; if (ND_IS_FIXED_MIN(node)) min = en->min_len; if (ND_IS_FIXED_MAX(node)) max = en->max_len; mml_set_min_max(&opt->len, min, max); } else #endif { r = optimize_nodes(ND_BODY(node), opt, env); if (is_set_opt_anc_info(&opt->anc, ANCR_ANYCHAR_INF_MASK)) { if (MEM_STATUS_AT0(env->scan_env->backrefed_mem, en->m.regnum)) remove_opt_anc_info(&opt->anc, ANCR_ANYCHAR_INF_MASK); } } break; case BAG_IF_ELSE: { OptEnv nenv; if (IS_NOT_NULL(en->te.Else)) { copy_opt_env(&nenv, env); r = optimize_nodes(ND_BAG_BODY(en), &xo, &nenv); if (r == 0) { mml_add(&nenv.mm, &xo.len); concat_left_node_opt_info(enc, opt, &xo); if (IS_NOT_NULL(en->te.Then)) { r = optimize_nodes(en->te.Then, &xo, &nenv); if (r == 0) { concat_left_node_opt_info(enc, opt, &xo); } } r = optimize_nodes(en->te.Else, &xo, env); if (r == 0) alt_merge_node_opt_info(opt, &xo, env); } } } break; } } break; case ND_GIMMICK: break; default: #ifdef ONIG_DEBUG fprintf(DBGFP, "optimize_nodes: undefined node type %d\n", ND_TYPE(node)); #endif r = ONIGERR_TYPE_BUG; break; } return r; } static int set_optimize_exact(regex_t* reg, OptStr* e) { int r; int allow_reverse; if (e->len == 0) return 0; reg->exact = (UChar* )xmalloc(e->len); CHECK_NULL_RETURN_MEMERR(reg->exact); xmemcpy(reg->exact, e->s, e->len); reg->exact_end = reg->exact + e->len; allow_reverse = ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end); if (e->len >= 2 || (e->len >= 1 && allow_reverse)) { r = set_sunday_quick_search_or_bmh_skip_table(reg, 0, reg->exact, reg->exact_end, reg->map, &(reg->map_offset)); if (r != 0) return r; reg->optimize = (allow_reverse != 0 ? OPTIMIZE_STR_FAST : OPTIMIZE_STR_FAST_STEP_FORWARD); } else { reg->optimize = OPTIMIZE_STR; } reg->dist_min = e->mm.min; reg->dist_max = e->mm.max; if (reg->dist_min != INFINITE_LEN) { int n = (int )(reg->exact_end - reg->exact); reg->threshold_len = reg->dist_min + n; } return 0; } static void set_optimize_map(regex_t* reg, OptMap* m) { int i; for (i = 0; i < CHAR_MAP_SIZE; i++) reg->map[i] = m->map[i]; reg->optimize = OPTIMIZE_MAP; reg->dist_min = m->mm.min; reg->dist_max = m->mm.max; if (reg->dist_min != INFINITE_LEN) { reg->threshold_len = reg->dist_min + ONIGENC_MBC_MINLEN(reg->enc); } } static void set_sub_anchor(regex_t* reg, OptAnc* anc) { reg->sub_anchor |= anc->left & ANCR_BEGIN_LINE; reg->sub_anchor |= anc->right & ANCR_END_LINE; } #if defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) static void print_optimize_info(FILE* f, regex_t* reg); #endif static int set_optimize_info_from_tree(Node* node, regex_t* reg, ParseEnv* scan_env) { int r; OptNode opt; OptEnv env; env.enc = reg->enc; env.case_fold_flag = reg->case_fold_flag; env.scan_env = scan_env; mml_clear(&env.mm); r = optimize_nodes(node, &opt, &env); if (r != 0) return r; reg->anchor = opt.anc.left & (ANCR_BEGIN_BUF | ANCR_BEGIN_POSITION | ANCR_ANYCHAR_INF | ANCR_ANYCHAR_INF_ML | ANCR_LOOK_BEHIND); if ((opt.anc.left & (ANCR_LOOK_BEHIND | ANCR_PREC_READ_NOT)) != 0) reg->anchor &= ~ANCR_ANYCHAR_INF_ML; reg->anchor |= opt.anc.right & (ANCR_END_BUF | ANCR_SEMI_END_BUF | ANCR_PREC_READ_NOT); if (reg->anchor & (ANCR_END_BUF | ANCR_SEMI_END_BUF)) { reg->anc_dist_min = opt.len.min; reg->anc_dist_max = opt.len.max; } if (opt.sb.len > 0 || opt.sm.len > 0) { select_opt_exact(reg->enc, &opt.sb, &opt.sm); if (opt.map.value > 0 && comp_opt_exact_or_map(&opt.sb, &opt.map) > 0) { goto set_map; } else { r = set_optimize_exact(reg, &opt.sb); set_sub_anchor(reg, &opt.sb.anc); } } else if (opt.map.value > 0) { set_map: set_optimize_map(reg, &opt.map); set_sub_anchor(reg, &opt.map.anc); } else { reg->sub_anchor |= opt.anc.left & ANCR_BEGIN_LINE; if (opt.len.max == 0) reg->sub_anchor |= opt.anc.right & ANCR_END_LINE; } #if defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) print_optimize_info(DBGFP, reg); #endif return r; } #endif /* ONIG_DONT_OPTIMIZE */ static void clear_optimize_info(regex_t* reg) { reg->optimize = OPTIMIZE_NONE; reg->anchor = 0; reg->anc_dist_min = 0; reg->anc_dist_max = 0; reg->sub_anchor = 0; reg->exact_end = (UChar* )NULL; reg->map_offset = 0; reg->threshold_len = 0; if (IS_NOT_NULL(reg->exact)) { xfree(reg->exact); reg->exact = (UChar* )NULL; } } #if defined(ONIG_DEBUG_PARSE) || defined(ONIG_DEBUG_MATCH) || \ defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) static void print_enc_string(FILE* fp, OnigEncoding enc, const UChar *s, const UChar *end) { if (ONIGENC_MBC_MINLEN(enc) > 1) { const UChar *p; OnigCodePoint code; p = s; while (p < end) { code = ONIGENC_MBC_TO_CODE(enc, p, end); if (code >= 0x80) { fprintf(fp, " 0x%04x ", (int )code); } else { fputc((int )code, fp); } p += enclen(enc, p); } } else { while (s < end) { if (ONIGENC_MBC_MAXLEN(enc) == 1) { if (*s >= 0x80) { fprintf(fp, "\\x%02x", (unsigned int )*s); } else { fputc((int )*s, fp); } } else { /* for UTF-8 */ fputc((int )*s, fp); } s++; } } } static void print_options(FILE* fp, OnigOptionType o) { if ((o & ONIG_OPTION_IGNORECASE) != 0) fprintf(fp, " IGNORECASE"); if ((o & ONIG_OPTION_EXTEND) != 0) fprintf(fp, " EXTEND"); if ((o & ONIG_OPTION_MULTILINE) != 0) fprintf(fp, " MULTILINE"); if ((o & ONIG_OPTION_SINGLELINE) != 0) fprintf(fp, " SINGLELINE"); if ((o & ONIG_OPTION_FIND_LONGEST) != 0) fprintf(fp, " FIND_LONGEST"); if ((o & ONIG_OPTION_FIND_NOT_EMPTY) != 0) fprintf(fp, " FIND_NOT_EMPTY"); if ((o & ONIG_OPTION_NEGATE_SINGLELINE) != 0) fprintf(fp, " NEGATE_SINGLELINE"); if ((o & ONIG_OPTION_DONT_CAPTURE_GROUP) != 0) fprintf(fp, " DONT_CAPTURE_GROUP"); if ((o & ONIG_OPTION_CAPTURE_GROUP) != 0) fprintf(fp, " CAPTURE_GROUP"); if ((o & ONIG_OPTION_NOTBOL) != 0) fprintf(fp, " NOTBOL"); if ((o & ONIG_OPTION_NOTEOL) != 0) fprintf(fp, " NOTEOL"); if ((o & ONIG_OPTION_POSIX_REGION) != 0) fprintf(fp, " POSIX_REGION"); if ((o & ONIG_OPTION_CHECK_VALIDITY_OF_STRING) != 0) fprintf(fp, " CHECK_VALIDITY_OF_STRING"); if ((o & ONIG_OPTION_IGNORECASE_IS_ASCII) != 0) fprintf(fp, " IGNORECASE_IS_ASCII"); if ((o & ONIG_OPTION_WORD_IS_ASCII) != 0) fprintf(fp, " WORD_IS_ASCII"); if ((o & ONIG_OPTION_DIGIT_IS_ASCII) != 0) fprintf(fp, " DIGIT_IS_ASCII"); if ((o & ONIG_OPTION_SPACE_IS_ASCII) != 0) fprintf(fp, " SPACE_IS_ASCII"); if ((o & ONIG_OPTION_POSIX_IS_ASCII) != 0) fprintf(fp, " POSIX_IS_ASCII"); if ((o & ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER) != 0) fprintf(fp, " TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER"); if ((o & ONIG_OPTION_TEXT_SEGMENT_WORD) != 0) fprintf(fp, " TEXT_SEGMENT_WORD"); if ((o & ONIG_OPTION_NOT_BEGIN_STRING) != 0) fprintf(fp, " NOT_BIGIN_STRING"); if ((o & ONIG_OPTION_NOT_END_STRING) != 0) fprintf(fp, " NOT_END_STRING"); if ((o & ONIG_OPTION_NOT_BEGIN_POSITION) != 0) fprintf(fp, " NOT_BEGIN_POSITION"); if ((o & ONIG_OPTION_CALLBACK_EACH_MATCH) != 0) fprintf(fp, " CALLBACK_EACH_MATCH"); } #endif #if defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) #ifndef ONIG_DONT_OPTIMIZE static void print_distance_range(FILE* f, OnigLen a, OnigLen b) { if (a == INFINITE_LEN) fputs("inf", f); else fprintf(f, "(%u)", a); fputs("-", f); if (b == INFINITE_LEN) fputs("inf", f); else fprintf(f, "(%u)", b); } static void print_anchor(FILE* f, int anchor) { int q = 0; fprintf(f, "["); if (anchor & ANCR_BEGIN_BUF) { fprintf(f, "begin-buf"); q = 1; } if (anchor & ANCR_BEGIN_LINE) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "begin-line"); } if (anchor & ANCR_BEGIN_POSITION) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "begin-pos"); } if (anchor & ANCR_END_BUF) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "end-buf"); } if (anchor & ANCR_SEMI_END_BUF) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "semi-end-buf"); } if (anchor & ANCR_END_LINE) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "end-line"); } if (anchor & ANCR_ANYCHAR_INF) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "anychar-inf"); } if (anchor & ANCR_ANYCHAR_INF_ML) { if (q) fprintf(f, ", "); fprintf(f, "anychar-inf-ml"); } fprintf(f, "]"); } static void print_optimize_info(FILE* f, regex_t* reg) { static const char* on[] = { "NONE", "STR", "STR_FAST", "STR_FAST_STEP_FORWARD", "MAP" }; fprintf(f, "optimize: %s\n", on[reg->optimize]); fprintf(f, " anchor: "); print_anchor(f, reg->anchor); if ((reg->anchor & ANCR_END_BUF_MASK) != 0) print_distance_range(f, reg->anc_dist_min, reg->anc_dist_max); fprintf(f, "\n"); if (reg->optimize) { fprintf(f, " sub anchor: "); print_anchor(f, reg->sub_anchor); fprintf(f, "\n"); } fprintf(f, "\n"); if (reg->exact) { UChar *p; fprintf(f, "exact: ["); for (p = reg->exact; p < reg->exact_end; p++) { fputc(*p, f); } fprintf(f, "]: length: %ld, dmin: %u, ", (reg->exact_end - reg->exact), reg->dist_min); if (reg->dist_max == INFINITE_LEN) fprintf(f, "dmax: inf.\n"); else fprintf(f, "dmax: %u\n", reg->dist_max); } else if (reg->optimize & OPTIMIZE_MAP) { int c, i, n = 0; for (i = 0; i < CHAR_MAP_SIZE; i++) if (reg->map[i]) n++; fprintf(f, "map: n=%d, dmin: %u, dmax: %u\n", n, reg->dist_min, reg->dist_max); if (n > 0) { c = 0; fputc('[', f); for (i = 0; i < CHAR_MAP_SIZE; i++) { if (reg->map[i] != 0) { if (c > 0) fputs(", ", f); c++; if (ONIGENC_MBC_MAXLEN(reg->enc) == 1 && ONIGENC_IS_CODE_PRINT(reg->enc, (OnigCodePoint )i)) fputc(i, f); else fprintf(f, "0x%02x", i); } } fprintf(f, "]\n"); } } } #endif /* ONIG_DONT_OPTIMIZE */ #endif /* defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) */ extern RegexExt* onig_get_regex_ext(regex_t* reg) { if (IS_NULL(reg->extp)) { RegexExt* ext = (RegexExt* )xmalloc(sizeof(*ext)); if (IS_NULL(ext)) return 0; ext->pattern = 0; ext->pattern_end = 0; #ifdef USE_CALLOUT ext->tag_table = 0; ext->callout_num = 0; ext->callout_list_alloc = 0; ext->callout_list = 0; #endif reg->extp = ext; } return reg->extp; } static void free_regex_ext(RegexExt* ext) { if (IS_NOT_NULL(ext)) { if (IS_NOT_NULL(ext->pattern)) xfree((void* )ext->pattern); #ifdef USE_CALLOUT if (IS_NOT_NULL(ext->tag_table)) onig_callout_tag_table_free(ext->tag_table); if (IS_NOT_NULL(ext->callout_list)) onig_free_reg_callout_list(ext->callout_num, ext->callout_list); #endif xfree(ext); } } extern int onig_ext_set_pattern(regex_t* reg, const UChar* pattern, const UChar* pattern_end) { RegexExt* ext; UChar* s; ext = onig_get_regex_ext(reg); CHECK_NULL_RETURN_MEMERR(ext); s = onigenc_strdup(reg->enc, pattern, pattern_end); CHECK_NULL_RETURN_MEMERR(s); ext->pattern = s; ext->pattern_end = s + (pattern_end - pattern); return ONIG_NORMAL; } extern void onig_free_body(regex_t* reg) { if (IS_NOT_NULL(reg)) { ops_free(reg); if (IS_NOT_NULL(reg->string_pool)) { xfree(reg->string_pool); reg->string_pool_end = reg->string_pool = 0; } if (IS_NOT_NULL(reg->exact)) xfree(reg->exact); if (IS_NOT_NULL(reg->repeat_range)) xfree(reg->repeat_range); if (IS_NOT_NULL(reg->extp)) { free_regex_ext(reg->extp); reg->extp = 0; } onig_names_free(reg); } } extern void onig_free(regex_t* reg) { if (IS_NOT_NULL(reg)) { onig_free_body(reg); xfree(reg); } } #ifdef ONIG_DEBUG_PARSE static void print_tree P_((FILE* f, Node* node)); #endif extern int onig_init_for_match_at(regex_t* reg); static int parse_and_tune(regex_t* reg, const UChar* pattern, const UChar* pattern_end, ParseEnv *scan_env, Node** rroot, OnigErrorInfo* einfo #ifdef USE_CALL , UnsetAddrList* uslist #endif ) { int r; Node* root; root = NULL_NODE; if (IS_NOT_NULL(einfo)) { einfo->enc = reg->enc; einfo->par = (UChar* )NULL; } r = onig_parse_tree(&root, pattern, pattern_end, reg, scan_env); if (r != 0) goto err; #ifdef USE_WHOLE_OPTIONS if ((scan_env->flags & PE_FLAG_HAS_WHOLE_OPTIONS) != 0) { r = check_whole_options_position(root, scan_env); if (r != 0) goto err; } #endif r = reduce_string_list(root, reg->enc); if (r != 0) goto err; /* mixed use named group and no-named group */ if (scan_env->num_named > 0 && IS_SYNTAX_BV(scan_env->syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) && ! OPTON_CAPTURE_GROUP(reg->options)) { if (scan_env->num_named != scan_env->num_mem) r = disable_noname_group_capture(&root, reg, scan_env); else r = numbered_ref_check(root); if (r != 0) goto err; } r = check_backrefs(root, scan_env); if (r != 0) goto err; #ifdef USE_CALL if (scan_env->num_call > 0) { r = unset_addr_list_init(uslist, scan_env->num_call); if (r != 0) goto err; scan_env->unset_addr_list = uslist; r = tune_call(root, scan_env, 0); if (r != 0) goto err_unset; r = tune_call2(root); if (r != 0) goto err_unset; r = recursive_call_check_trav(root, scan_env, 0); if (r < 0) goto err_unset; r = infinite_recursive_call_check_trav(root, scan_env); if (r != 0) goto err_unset; tune_called_state(root, 0); } reg->num_call = scan_env->num_call; #endif #ifdef ONIG_DEBUG_PARSE fprintf(DBGFP, "MAX PARSE DEPTH: %d\n", scan_env->max_parse_depth); #endif r = tune_tree(root, reg, 0, scan_env); if (r != 0) { #ifdef ONIG_DEBUG_PARSE fprintf(DBGFP, "TREE (error in tune)\n"); print_tree(DBGFP, root); fprintf(DBGFP, "\n"); #endif goto err_unset; } if (scan_env->backref_num != 0) { set_parent_node_trav(root, NULL_NODE); r = set_empty_repeat_node_trav(root, NULL_NODE, scan_env); if (r != 0) goto err_unset; set_empty_status_check_trav(root, scan_env); } *rroot = root; return r; err_unset: #ifdef USE_CALL if (scan_env->num_call > 0) { unset_addr_list_end(uslist); } #endif err: if (IS_NOT_NULL(scan_env->error)) { if (IS_NOT_NULL(einfo)) { einfo->par = scan_env->error; einfo->par_end = scan_env->error_end; } } onig_node_free(root); if (IS_NOT_NULL(scan_env->mem_env_dynamic)) xfree(scan_env->mem_env_dynamic); *rroot = NULL_NODE; return r; } extern int onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo) { int r; Node* root; ParseEnv scan_env; #ifdef USE_CALL UnsetAddrList uslist = {0}; #endif #if defined(ONIG_DEBUG_PARSE) || defined(ONIG_DEBUG_MATCH) || \ defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) fprintf(DBGFP, "\nPATTERN: /"); print_enc_string(DBGFP, reg->enc, pattern, pattern_end); fprintf(DBGFP, "/\n"); fprintf(DBGFP, "OPTIONS:"); print_options(DBGFP, reg->options); fprintf(DBGFP, "\n"); #endif if (reg->ops_alloc == 0) { r = ops_init(reg, OPS_INIT_SIZE); if (r != 0) { if (IS_NOT_NULL(einfo)) { einfo->enc = reg->enc; einfo->par = (UChar* )NULL; } return r; } } else reg->ops_used = 0; r = parse_and_tune(reg, pattern, pattern_end, &scan_env, &root, einfo #ifdef USE_CALL , &uslist #endif ); if (r != 0) return r; #ifdef ONIG_DEBUG_PARSE fprintf(DBGFP, "TREE (after tune)\n"); print_tree(DBGFP, root); fprintf(DBGFP, "\n"); #endif reg->capture_history = scan_env.cap_history; reg->push_mem_start = scan_env.backtrack_mem | scan_env.cap_history; #ifdef USE_CALLOUT if (IS_NOT_NULL(reg->extp) && reg->extp->callout_num != 0) { reg->push_mem_end = reg->push_mem_start; } else { if (MEM_STATUS_IS_ALL_ON(reg->push_mem_start)) reg->push_mem_end = scan_env.backrefed_mem | scan_env.cap_history; else reg->push_mem_end = reg->push_mem_start & (scan_env.backrefed_mem | scan_env.cap_history); } #else if (MEM_STATUS_IS_ALL_ON(reg->push_mem_start)) reg->push_mem_end = scan_env.backrefed_mem | scan_env.cap_history; else reg->push_mem_end = reg->push_mem_start & (scan_env.backrefed_mem | scan_env.cap_history); #endif clear_optimize_info(reg); #ifndef ONIG_DONT_OPTIMIZE r = set_optimize_info_from_tree(root, reg, &scan_env); if (r != 0) { #ifdef USE_CALL if (scan_env.num_call > 0) { unset_addr_list_end(&uslist); } #endif goto err; } #endif if (IS_NOT_NULL(scan_env.mem_env_dynamic)) { xfree(scan_env.mem_env_dynamic); scan_env.mem_env_dynamic = (MemEnv* )NULL; } r = compile_tree(root, reg, &scan_env); if (r == 0) { if (scan_env.keep_num > 0) { r = add_op(reg, OP_UPDATE_VAR); if (r != 0) goto err; COP(reg)->update_var.type = UPDATE_VAR_KEEP_FROM_STACK_LAST; COP(reg)->update_var.id = 0; /* not used */ COP(reg)->update_var.clear = FALSE; } r = add_op(reg, OP_END); if (r != 0) goto err; #ifdef USE_CALL if (scan_env.num_call > 0) { r = fix_unset_addr_list(&uslist, reg); unset_addr_list_end(&uslist); if (r != 0) goto err; } #endif r = ops_resize(reg, reg->ops_used); if (r != ONIG_NORMAL) goto err; set_addr_in_repeat_range(reg); if ((reg->push_mem_end != 0) #ifdef USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR || (reg->num_repeat != 0) || (reg->num_empty_check != 0) #endif #ifdef USE_CALLOUT || (IS_NOT_NULL(reg->extp) && reg->extp->callout_num != 0) #endif #ifdef USE_CALL || scan_env.num_call > 0 #endif ) reg->stack_pop_level = STACK_POP_LEVEL_ALL; else { if (reg->push_mem_start != 0) reg->stack_pop_level = STACK_POP_LEVEL_MEM_START; else reg->stack_pop_level = STACK_POP_LEVEL_FREE; } r = ops_make_string_pool(reg); if (r != 0) goto err; } #ifdef USE_CALL else if (scan_env.num_call > 0) { unset_addr_list_end(&uslist); } #endif onig_node_free(root); #ifdef ONIG_DEBUG_COMPILE onig_print_names(DBGFP, reg); onig_print_compiled_byte_code_list(DBGFP, reg); #endif #ifdef USE_DIRECT_THREADED_CODE /* opcode -> opaddr */ onig_init_for_match_at(reg); #endif return r; err: if (IS_NOT_NULL(scan_env.error)) { if (IS_NOT_NULL(einfo)) { einfo->par = scan_env.error; einfo->par_end = scan_env.error_end; } } onig_node_free(root); if (IS_NOT_NULL(scan_env.mem_env_dynamic)) xfree(scan_env.mem_env_dynamic); return r; } static int onig_inited = 0; extern int onig_reg_init(regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax) { int r; xmemset(reg, 0, sizeof(*reg)); if (onig_inited == 0) { #if 0 return ONIGERR_LIBRARY_IS_NOT_INITIALIZED; #else r = onig_initialize(&enc, 1); if (r != 0) return ONIGERR_FAIL_TO_INITIALIZE; onig_warning("You didn't call onig_initialize() explicitly"); #endif } if (IS_NULL(reg)) return ONIGERR_INVALID_ARGUMENT; if (ONIGENC_IS_UNDEF(enc)) return ONIGERR_DEFAULT_ENCODING_IS_NOT_SET; if ((option & (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP)) == (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP)) { return ONIGERR_INVALID_COMBINATION_OF_OPTIONS; } if ((option & ONIG_OPTION_NEGATE_SINGLELINE) != 0) { option |= syntax->options; option &= ~ONIG_OPTION_SINGLELINE; } else option |= syntax->options; if ((option & ONIG_OPTION_IGNORECASE_IS_ASCII) != 0) { case_fold_flag &= ~(INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR | ONIGENC_CASE_FOLD_TURKISH_AZERI); case_fold_flag |= ONIGENC_CASE_FOLD_ASCII_ONLY; } (reg)->enc = enc; (reg)->options = option; (reg)->syntax = syntax; (reg)->optimize = 0; (reg)->exact = (UChar* )NULL; (reg)->extp = (RegexExt* )NULL; (reg)->ops = (Operation* )NULL; (reg)->ops_curr = (Operation* )NULL; (reg)->ops_used = 0; (reg)->ops_alloc = 0; (reg)->name_table = (void* )NULL; (reg)->case_fold_flag = case_fold_flag; return 0; } extern int onig_new_without_alloc(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo) { int r; r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax); if (r != 0) return r; r = onig_compile(reg, pattern, pattern_end, einfo); return r; } extern int onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo) { int r; *reg = (regex_t* )xmalloc(sizeof(regex_t)); if (IS_NULL(*reg)) return ONIGERR_MEMORY; r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax); if (r != 0) { xfree(*reg); *reg = NULL; return r; } r = onig_compile(*reg, pattern, pattern_end, einfo); if (r != 0) { onig_free(*reg); *reg = NULL; } return r; } extern int onig_initialize(OnigEncoding encodings[], int n) { int i; int r; if (onig_inited != 0) return 0; onigenc_init(); onig_inited = 1; for (i = 0; i < n; i++) { OnigEncoding enc = encodings[i]; r = onig_initialize_encoding(enc); if (r != 0) return r; } return ONIG_NORMAL; } typedef struct EndCallListItem { struct EndCallListItem* next; void (*func)(void); } EndCallListItemType; static EndCallListItemType* EndCallTop; extern void onig_add_end_call(void (*func)(void)) { EndCallListItemType* item; item = (EndCallListItemType* )xmalloc(sizeof(*item)); if (item == 0) return ; item->next = EndCallTop; item->func = func; EndCallTop = item; } static void exec_end_call_list(void) { EndCallListItemType* prev; void (*func)(void); while (EndCallTop != 0) { func = EndCallTop->func; (*func)(); prev = EndCallTop; EndCallTop = EndCallTop->next; xfree(prev); } } extern int onig_end(void) { exec_end_call_list(); #ifdef USE_CALLOUT onig_global_callout_names_free(); #endif onigenc_end(); onig_inited = 0; return 0; } extern int onig_is_in_code_range(const UChar* p, OnigCodePoint code) { OnigCodePoint n, *data; OnigCodePoint low, high, x; GET_CODE_POINT(n, p); data = (OnigCodePoint* )p; data++; for (low = 0, high = n; low < high; ) { x = (low + high) >> 1; if (code > data[x * 2 + 1]) low = x + 1; else high = x; } return ((low < n && code >= data[low * 2]) ? 1 : 0); } extern int onig_is_code_in_cc_len(int elen, OnigCodePoint code, /* CClassNode* */ void* cc_arg) { int found; CClassNode* cc = (CClassNode* )cc_arg; if (elen > 1 || (code >= SINGLE_BYTE_SIZE)) { if (IS_NULL(cc->mbuf)) { found = 0; } else { found = onig_is_in_code_range(cc->mbuf->p, code) != 0; } } else { found = BITSET_AT(cc->bs, code) != 0; } if (IS_NCCLASS_NOT(cc)) return !found; else return found; } extern int onig_is_code_in_cc(OnigEncoding enc, OnigCodePoint code, CClassNode* cc) { int len; if (ONIGENC_MBC_MINLEN(enc) > 1) { len = 2; } else { len = ONIGENC_CODE_TO_MBCLEN(enc, code); if (len < 0) return 0; } return onig_is_code_in_cc_len(len, code, cc); } #define MANY_REPEAT_OF_ANYCHAR 20 typedef enum { MJ_NO = 0, MJ_YES = 1, MJ_IGNORE = 2, } MJ_RESULT; static MJ_RESULT mostly_just_anychar(Node* node, int in_reluctant) { MJ_RESULT r; r = MJ_NO; switch (ND_TYPE(node)) { case ND_LIST: { int found = FALSE; do { r = mostly_just_anychar(ND_CAR(node), in_reluctant); if (r == MJ_NO) break; if (r == MJ_YES) found = TRUE; } while (IS_NOT_NULL(node = ND_CDR(node))); if (r == MJ_IGNORE) { if (found == TRUE) r = MJ_YES; } } break; case ND_ALT: r = MJ_IGNORE; do { r = mostly_just_anychar(ND_CAR(node), in_reluctant); if (r == MJ_YES) break; } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: { QuantNode* qn = QUANT_(node); if (qn->upper == 0) r = MJ_IGNORE; else { if (in_reluctant == FALSE) { if (qn->greedy != 0 && (! IS_INFINITE_REPEAT(qn->upper) && qn->upper <= MANY_REPEAT_OF_ANYCHAR)) { in_reluctant = TRUE; } } r = mostly_just_anychar(ND_BODY(node), in_reluctant); } } break; case ND_ANCHOR: switch (ANCHOR_(node)->type) { case ANCR_PREC_READ: case ANCR_PREC_READ_NOT: case ANCR_LOOK_BEHIND: case ANCR_LOOK_BEHIND_NOT: case ANCR_TEXT_SEGMENT_BOUNDARY: /* \y */ r = MJ_IGNORE; break; default: break; } break; case ND_BAG: { BagNode* en = BAG_(node); if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = mostly_just_anychar(en->te.Then, in_reluctant); if (r == MJ_YES) break; } if (IS_NOT_NULL(en->te.Else)) { r = mostly_just_anychar(en->te.Else, in_reluctant); } } else { r = mostly_just_anychar(ND_BODY(node), in_reluctant); } } break; case ND_CTYPE: if (CTYPE_(node)->ctype == CTYPE_ANYCHAR) r = MJ_YES; else r = MJ_NO; break; case ND_STRING: if (ND_STRING_LEN(node) == 0) { r = MJ_IGNORE; break; } /* fall */ case ND_CCLASS: r = MJ_NO; break; #ifdef USE_CALL case ND_CALL: /* ignore call */ #endif case ND_BACKREF: case ND_GIMMICK: r = MJ_IGNORE; break; default: break; } return r; } #define MAX_CALLS_IN_DETECT 10 typedef struct { int prec_read; int look_behind; int backref; int backref_with_level; int call; int is_keep; int anychar_reluctant_many; int empty_check_nest_level; int max_empty_check_nest_level; int heavy_element; } SlowElementCount; static int detect_can_be_slow(Node* node, SlowElementCount* ct, int ncall, int calls[]) { int r; r = 0; switch (ND_TYPE(node)) { case ND_LIST: case ND_ALT: do { r = detect_can_be_slow(ND_CAR(node), ct, ncall, calls); if (r != 0) return r; } while (IS_NOT_NULL(node = ND_CDR(node))); break; case ND_QUANT: { QuantNode* qn; Node* body; int prev_heavy_element = 0; qn = QUANT_(node); body = ND_BODY(node); if (qn->emptiness != BODY_IS_NOT_EMPTY) { prev_heavy_element = ct->heavy_element; ct->empty_check_nest_level++; if (ct->empty_check_nest_level > ct->max_empty_check_nest_level) ct->max_empty_check_nest_level = ct->empty_check_nest_level; } else if (IS_INFINITE_REPEAT(qn->upper) || qn->upper > 0) { MJ_RESULT mr = mostly_just_anychar(body, (qn->greedy == 0)); if (mr == MJ_YES) ct->anychar_reluctant_many++; } r = detect_can_be_slow(body, ct, ncall, calls); if (qn->emptiness != BODY_IS_NOT_EMPTY) { if (ND_IS_INPEEK(node)) { if (ct->empty_check_nest_level > 2) { if (prev_heavy_element == ct->heavy_element) ct->heavy_element++; } } ct->empty_check_nest_level--; } } break; case ND_ANCHOR: switch (ANCHOR_(node)->type) { case ANCR_PREC_READ: case ANCR_PREC_READ_NOT: ct->prec_read++; break; case ANCR_LOOK_BEHIND: case ANCR_LOOK_BEHIND_NOT: ct->look_behind++; break; default: break; } if (ANCHOR_HAS_BODY(ANCHOR_(node))) r = detect_can_be_slow(ND_BODY(node), ct, ncall, calls); break; case ND_BAG: { BagNode* en = BAG_(node); r = detect_can_be_slow(ND_BODY(node), ct, ncall, calls); if (r != 0) return r; if (en->type == BAG_IF_ELSE) { if (IS_NOT_NULL(en->te.Then)) { r = detect_can_be_slow(en->te.Then, ct, ncall, calls); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) { r = detect_can_be_slow(en->te.Else, ct, ncall, calls); if (r != 0) return r; } } } break; #ifdef USE_BACKREF_WITH_LEVEL case ND_BACKREF: if (ND_IS_NEST_LEVEL(node)) ct->heavy_element++; else ct->backref++; break; #endif #ifdef USE_CALL case ND_CALL: { int i; int found; int gnum; gnum = CALL_(node)->called_gnum; ct->call++; if (ND_IS_RECURSION(node) && ND_IS_INPEEK(node) && ND_IS_IN_REAL_REPEAT(node)) { ct->heavy_element += 10; } found = FALSE; for (i = 0; i < ncall; i++) { if (gnum == calls[i]) { found = TRUE; break; } } if (! found) { if (ncall + 1 < MAX_CALLS_IN_DETECT) { calls[ncall] = gnum; r = detect_can_be_slow(ND_BODY(node), ct, ncall + 1, calls); } else { ct->heavy_element++; } } } break; #endif case ND_GIMMICK: { GimmickNode* g = GIMMICK_(node); if (g->type == GIMMICK_SAVE && g->detail_type == SAVE_KEEP) ct->is_keep = TRUE; } break; default: break; } return r; } extern int onig_detect_can_be_slow_pattern(const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax) { int r; regex_t* reg; Node* root; ParseEnv scan_env; SlowElementCount count; int calls[MAX_CALLS_IN_DETECT]; #ifdef USE_CALL UnsetAddrList uslist = {0}; #endif reg = (regex_t* )xmalloc(sizeof(regex_t)); if (IS_NULL(reg)) return ONIGERR_MEMORY; r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax); if (r != 0) { xfree(reg); return r; } r = parse_and_tune(reg, pattern, pattern_end, &scan_env, &root, NULL #ifdef USE_CALL , &uslist #endif ); if (r != 0) goto err; #ifdef USE_CALL if (scan_env.num_call > 0) { unset_addr_list_end(&uslist); } #endif count.prec_read = 0; count.look_behind = 0; count.backref = 0; count.backref_with_level = 0; count.call = 0; count.is_keep = FALSE; count.anychar_reluctant_many = 0; count.empty_check_nest_level = 0; count.max_empty_check_nest_level = 0; count.heavy_element = 0; r = detect_can_be_slow(root, &count, 0, calls); if (r == 0) { int n; n = count.prec_read + count.look_behind + count.backref + count.backref_with_level + count.call + count.anychar_reluctant_many; if (count.is_keep) count.max_empty_check_nest_level++; if (count.max_empty_check_nest_level > 2) n += count.max_empty_check_nest_level - 2; if (count.heavy_element != 0) { if (count.heavy_element < 0x10000) n += count.heavy_element << 8; else n += count.heavy_element; } r = n; #ifdef ONIG_DEBUG_PARSE fprintf(DBGFP, "-- detect can be slow --\n"); fprintf(DBGFP, " prec_read: %d\n", count.prec_read); fprintf(DBGFP, " look_behind: %d\n", count.look_behind); fprintf(DBGFP, " backref: %d\n", count.backref); fprintf(DBGFP, " backref_with_level: %d\n", count.backref_with_level); fprintf(DBGFP, " call: %d\n", count.call); fprintf(DBGFP, " is_keep: %d\n", count.is_keep); fprintf(DBGFP, " any_reluctant_many: %d\n", count.anychar_reluctant_many); fprintf(DBGFP, " max_empty_check_nest_level: %d\n", count.max_empty_check_nest_level); fprintf(DBGFP, " heavy_element: %d\n", count.heavy_element); fprintf(DBGFP, " r: %d\n", r); fprintf(DBGFP, "\n"); #endif } if (IS_NOT_NULL(scan_env.mem_env_dynamic)) xfree(scan_env.mem_env_dynamic); err: onig_node_free(root); onig_free(reg); return r; } #ifdef ONIG_DEBUG_PARSE #ifdef USE_CALL static void p_string(FILE* f, int len, UChar* s) { fputs(":", f); while (len-- > 0) { fputc(*s++, f); } } #endif static void Indent(FILE* f, int indent) { int i; for (i = 0; i < indent; i++) putc(' ', f); } static void print_indent_tree(FILE* f, Node* node, int indent) { static char* emptiness_name[] = { "", " empty", " empty_mem", " empty_rec" }; int i; NodeType type; UChar* p; int add = 3; Indent(f, indent); if (IS_NULL(node)) { fprintf(f, "ERROR: null node!!!\n"); exit(0); } type = ND_TYPE(node); switch (type) { case ND_LIST: case ND_ALT: if (type == ND_LIST) fprintf(f, "\n", node); else fprintf(f, "\n", node); print_indent_tree(f, ND_CAR(node), indent + add); while (IS_NOT_NULL(node = ND_CDR(node))) { if (ND_TYPE(node) != type) { fprintf(f, "ERROR: list/alt right is not a cons. %d\n", ND_TYPE(node)); exit(0); } print_indent_tree(f, ND_CAR(node), indent + add); } break; case ND_STRING: { char* str; char* mode; if (ND_STRING_IS_CRUDE(node)) mode = "-crude"; else if (ND_IS_IGNORECASE(node)) mode = "-ignorecase"; else mode = ""; if (STR_(node)->s == STR_(node)->end) str = "empty-string"; else str = "string"; fprintf(f, "<%s%s:%p>", str, mode, node); for (p = STR_(node)->s; p < STR_(node)->end; p++) { if (*p >= 0x20 && *p < 0x7f) fputc(*p, f); else { fprintf(f, " 0x%02x", *p); } } } break; case ND_CCLASS: #define CCLASS_MBUF_MAX_OUTPUT_NUM 10 fprintf(f, "", node); if (IS_NCCLASS_NOT(CCLASS_(node))) fputs(" not", f); if (CCLASS_(node)->mbuf) { BBuf* bbuf = CCLASS_(node)->mbuf; fprintf(f, " mbuf(%u) ", bbuf->used); for (i = 0; i < bbuf->used && i < CCLASS_MBUF_MAX_OUTPUT_NUM; i++) { if (i > 0) fprintf(f, ","); fprintf(f, "%0x", bbuf->p[i]); } if (i < bbuf->used) fprintf(f, "..."); } break; case ND_CTYPE: fprintf(f, " ", node); switch (CTYPE_(node)->ctype) { case CTYPE_ANYCHAR: fprintf(f, "anychar"); break; case ONIGENC_CTYPE_WORD: if (CTYPE_(node)->not != 0) fputs("not word", f); else fputs("word", f); if (CTYPE_(node)->ascii_mode != 0) fputs(" (ascii)", f); break; default: fprintf(f, "ERROR: undefined ctype.\n"); exit(0); } break; case ND_ANCHOR: fprintf(f, " ", node); switch (ANCHOR_(node)->type) { case ANCR_BEGIN_BUF: fputs("begin buf", f); break; case ANCR_END_BUF: fputs("end buf", f); break; case ANCR_BEGIN_LINE: fputs("begin line", f); break; case ANCR_END_LINE: fputs("end line", f); break; case ANCR_SEMI_END_BUF: fputs("semi end buf", f); break; case ANCR_BEGIN_POSITION: fputs("begin position", f); break; case ANCR_WORD_BOUNDARY: fputs("word boundary", f); break; case ANCR_NO_WORD_BOUNDARY: fputs("not word boundary", f); break; #ifdef USE_WORD_BEGIN_END case ANCR_WORD_BEGIN: fputs("word begin", f); break; case ANCR_WORD_END: fputs("word end", f); break; #endif case ANCR_TEXT_SEGMENT_BOUNDARY: fputs("text-segment boundary", f); break; case ANCR_NO_TEXT_SEGMENT_BOUNDARY: fputs("no text-segment boundary", f); break; case ANCR_PREC_READ: fprintf(f, "prec read\n"); print_indent_tree(f, ND_BODY(node), indent + add); break; case ANCR_PREC_READ_NOT: fprintf(f, "prec read not\n"); print_indent_tree(f, ND_BODY(node), indent + add); break; case ANCR_LOOK_BEHIND: fprintf(f, "look behind\n"); print_indent_tree(f, ND_BODY(node), indent + add); break; case ANCR_LOOK_BEHIND_NOT: fprintf(f, "look behind not\n"); print_indent_tree(f, ND_BODY(node), indent + add); break; default: fprintf(f, "ERROR: undefined anchor type.\n"); break; } break; case ND_BACKREF: { int* p; BackRefNode* br = BACKREF_(node); p = BACKREFS_P(br); fprintf(f, "", ND_IS_CHECKER(node) ? "-checker" : "", node); for (i = 0; i < br->back_num; i++) { if (i > 0) fputs(", ", f); fprintf(f, "%d", p[i]); } #ifdef USE_BACKREF_WITH_LEVEL if (ND_IS_NEST_LEVEL(node)) { fprintf(f, ", level: %d", br->nest_level); } #endif } break; #ifdef USE_CALL case ND_CALL: { CallNode* cn = CALL_(node); fprintf(f, "", node); fprintf(f, " num: %d, name", cn->called_gnum); p_string(f, cn->name_end - cn->name, cn->name); if (ND_IS_RECURSION(node)) fprintf(f, ", recursion"); if (ND_IS_INPEEK(node)) fprintf(f, ", in-peek"); if (ND_IS_IN_REAL_REPEAT(node)) fprintf(f, ", in-real-repeat"); } break; #endif case ND_QUANT: { fprintf(f, "{%d,%d}%s%s%s", node, QUANT_(node)->lower, QUANT_(node)->upper, (QUANT_(node)->greedy ? "" : "?"), QUANT_(node)->include_referred == 0 ? "" : " referred", emptiness_name[QUANT_(node)->emptiness]); if (ND_IS_INPEEK(node)) fprintf(f, ", in-peek"); fprintf(f, "\n"); print_indent_tree(f, ND_BODY(node), indent + add); } break; case ND_BAG: { BagNode* bn = BAG_(node); fprintf(f, " ", node); if (bn->type == BAG_IF_ELSE) { Node* Then; Node* Else; fprintf(f, "if-else\n"); print_indent_tree(f, ND_BODY(node), indent + add); Then = bn->te.Then; Else = bn->te.Else; if (IS_NULL(Then)) { Indent(f, indent + add); fprintf(f, "THEN empty\n"); } else print_indent_tree(f, Then, indent + add); if (IS_NULL(Else)) { Indent(f, indent + add); fprintf(f, "ELSE empty\n"); } else print_indent_tree(f, Else, indent + add); } else { switch (bn->type) { case BAG_OPTION: fprintf(f, "option:%d", bn->o.options); break; case BAG_MEMORY: fprintf(f, "memory:%d", bn->m.regnum); if (ND_IS_CALLED(node)) { fprintf(f, ", called"); if (ND_IS_RECURSION(node)) fprintf(f, ", recursion"); } else if (ND_IS_REFERENCED(node)) fprintf(f, ", referenced"); if (ND_IS_FIXED_ADDR(node)) fprintf(f, ", fixed-addr"); if ((bn->m.called_state & IN_PEEK) != 0) fprintf(f, ", in-peek"); break; case BAG_STOP_BACKTRACK: fprintf(f, "stop-bt"); break; default: break; } fprintf(f, "\n"); print_indent_tree(f, ND_BODY(node), indent + add); } } break; case ND_GIMMICK: fprintf(f, " ", node); switch (GIMMICK_(node)->type) { case GIMMICK_FAIL: fprintf(f, "fail"); break; case GIMMICK_SAVE: fprintf(f, "save:%d:%d", GIMMICK_(node)->detail_type, GIMMICK_(node)->id); break; case GIMMICK_UPDATE_VAR: fprintf(f, "update_var:%d:%d", GIMMICK_(node)->detail_type, GIMMICK_(node)->id); break; #ifdef USE_CALLOUT case GIMMICK_CALLOUT: switch (GIMMICK_(node)->detail_type) { case ONIG_CALLOUT_OF_CONTENTS: fprintf(f, "callout:contents:%d", GIMMICK_(node)->num); break; case ONIG_CALLOUT_OF_NAME: fprintf(f, "callout:name:%d:%d", GIMMICK_(node)->id, GIMMICK_(node)->num); break; } #endif } break; default: fprintf(f, "print_indent_tree: undefined node type %d\n", ND_TYPE(node)); break; } if (type != ND_LIST && type != ND_ALT && type != ND_QUANT && type != ND_BAG) fprintf(f, "\n"); fflush(f); } static void print_tree(FILE* f, Node* node) { print_indent_tree(f, node, 0); } #endif jq-1.8.2/vendor/oniguruma/src/regerror.c0000644000175100017510000003267515215513537013730 /********************************************************************** regerror.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2022 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #ifndef NEED_TO_INCLUDE_STDIO /* for vsnprintf() */ #define NEED_TO_INCLUDE_STDIO #endif #include "regint.h" extern UChar* onig_error_code_to_format(int code) { char *p; switch (code) { case ONIG_MISMATCH: p = "mismatch"; break; case ONIG_NO_SUPPORT_CONFIG: p = "no support in this configuration"; break; case ONIG_ABORT: p = "abort"; break; case ONIGERR_MEMORY: p = "fail to memory allocation"; break; case ONIGERR_MATCH_STACK_LIMIT_OVER: p = "match-stack limit over"; break; case ONIGERR_PARSE_DEPTH_LIMIT_OVER: p = "parse depth limit over"; break; case ONIGERR_RETRY_LIMIT_IN_MATCH_OVER: p = "retry-limit-in-match over"; break; case ONIGERR_RETRY_LIMIT_IN_SEARCH_OVER: p = "retry-limit-in-search over"; break; case ONIGERR_SUBEXP_CALL_LIMIT_IN_SEARCH_OVER: p = "subexp-call-limit-in-search over"; break; case ONIGERR_TYPE_BUG: p = "undefined type (bug)"; break; case ONIGERR_PARSER_BUG: p = "internal parser error (bug)"; break; case ONIGERR_STACK_BUG: p = "stack error (bug)"; break; case ONIGERR_UNDEFINED_BYTECODE: p = "undefined bytecode (bug)"; break; case ONIGERR_UNEXPECTED_BYTECODE: p = "unexpected bytecode (bug)"; break; case ONIGERR_DEFAULT_ENCODING_IS_NOT_SET: p = "default multibyte-encoding is not set"; break; case ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR: p = "can't convert to wide-char on specified multibyte-encoding"; break; case ONIGERR_FAIL_TO_INITIALIZE: p = "fail to initialize"; break; case ONIGERR_INVALID_ARGUMENT: p = "invalid argument"; break; case ONIGERR_END_PATTERN_AT_LEFT_BRACE: p = "end pattern at left brace"; break; case ONIGERR_END_PATTERN_AT_LEFT_BRACKET: p = "end pattern at left bracket"; break; case ONIGERR_EMPTY_CHAR_CLASS: p = "empty char-class"; break; case ONIGERR_PREMATURE_END_OF_CHAR_CLASS: p = "premature end of char-class"; break; case ONIGERR_END_PATTERN_AT_ESCAPE: p = "end pattern at escape"; break; case ONIGERR_END_PATTERN_AT_META: p = "end pattern at meta"; break; case ONIGERR_END_PATTERN_AT_CONTROL: p = "end pattern at control"; break; case ONIGERR_META_CODE_SYNTAX: p = "invalid meta-code syntax"; break; case ONIGERR_CONTROL_CODE_SYNTAX: p = "invalid control-code syntax"; break; case ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE: p = "char-class value at end of range"; break; case ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE: p = "char-class value at start of range"; break; case ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS: p = "unmatched range specifier in char-class"; break; case ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED: p = "target of repeat operator is not specified"; break; case ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID: p = "target of repeat operator is invalid"; break; case ONIGERR_NESTED_REPEAT_OPERATOR: p = "nested repeat operator"; break; case ONIGERR_UNMATCHED_CLOSE_PARENTHESIS: p = "unmatched close parenthesis"; break; case ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS: p = "end pattern with unmatched parenthesis"; break; case ONIGERR_END_PATTERN_IN_GROUP: p = "end pattern in group"; break; case ONIGERR_UNDEFINED_GROUP_OPTION: p = "undefined group option"; break; case ONIGERR_INVALID_GROUP_OPTION: p = "invalid group option"; break; case ONIGERR_INVALID_POSIX_BRACKET_TYPE: p = "invalid POSIX bracket type"; break; case ONIGERR_INVALID_LOOK_BEHIND_PATTERN: p = "invalid pattern in look-behind"; break; case ONIGERR_INVALID_REPEAT_RANGE_PATTERN: p = "invalid repeat range {lower,upper}"; break; case ONIGERR_TOO_BIG_NUMBER: p = "too big number"; break; case ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE: p = "too big number for repeat range"; break; case ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE: p = "upper is smaller than lower in repeat range"; break; case ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS: p = "empty range in char class"; break; case ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE: p = "mismatch multibyte code length in char-class range"; break; case ONIGERR_TOO_MANY_MULTI_BYTE_RANGES: p = "too many multibyte code ranges are specified"; break; case ONIGERR_TOO_SHORT_MULTI_BYTE_STRING: p = "too short multibyte code string"; break; case ONIGERR_TOO_BIG_BACKREF_NUMBER: p = "too big backref number"; break; case ONIGERR_INVALID_BACKREF: p = "invalid backref number/name"; break; case ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED: p = "numbered backref/call is not allowed. (use name)"; break; case ONIGERR_TOO_MANY_CAPTURES: p = "too many captures"; break; case ONIGERR_TOO_BIG_WIDE_CHAR_VALUE: p = "too big wide-char value"; break; case ONIGERR_TOO_LONG_WIDE_CHAR_VALUE: p = "too long wide-char value"; break; case ONIGERR_UNDEFINED_OPERATOR: p = "undefined operator"; break; case ONIGERR_INVALID_CODE_POINT_VALUE: p = "invalid code point value"; break; case ONIGERR_EMPTY_GROUP_NAME: p = "group name is empty"; break; case ONIGERR_INVALID_GROUP_NAME: p = "invalid group name <%n>"; break; case ONIGERR_INVALID_CHAR_IN_GROUP_NAME: p = "invalid char in group name <%n>"; break; case ONIGERR_UNDEFINED_NAME_REFERENCE: p = "undefined name <%n> reference"; break; case ONIGERR_UNDEFINED_GROUP_REFERENCE: p = "undefined group <%n> reference"; break; case ONIGERR_MULTIPLEX_DEFINED_NAME: p = "multiplex defined name <%n>"; break; case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL: p = "multiplex definition name <%n> call"; break; case ONIGERR_NEVER_ENDING_RECURSION: p = "never ending recursion"; break; case ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY: p = "group number is too big for capture history"; break; case ONIGERR_INVALID_CHAR_PROPERTY_NAME: p = "invalid character property name {%n}"; break; case ONIGERR_INVALID_IF_ELSE_SYNTAX: p = "invalid if-else syntax"; break; case ONIGERR_INVALID_ABSENT_GROUP_PATTERN: p = "invalid absent group pattern"; break; case ONIGERR_INVALID_ABSENT_GROUP_GENERATOR_PATTERN: p = "invalid absent group generator pattern"; break; case ONIGERR_INVALID_CALLOUT_PATTERN: p = "invalid callout pattern"; break; case ONIGERR_INVALID_CALLOUT_NAME: p = "invalid callout name"; break; case ONIGERR_UNDEFINED_CALLOUT_NAME: p = "undefined callout name"; break; case ONIGERR_INVALID_CALLOUT_BODY: p = "invalid callout body"; break; case ONIGERR_INVALID_CALLOUT_TAG_NAME: p = "invalid callout tag name"; break; case ONIGERR_INVALID_CALLOUT_ARG: p = "invalid callout arg"; break; case ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION: p = "not supported encoding combination"; break; case ONIGERR_INVALID_COMBINATION_OF_OPTIONS: p = "invalid combination of options"; break; case ONIGERR_VERY_INEFFICIENT_PATTERN: p = "very inefficient pattern"; break; case ONIGERR_LIBRARY_IS_NOT_INITIALIZED: p = "library is not initialized"; break; default: p = "undefined error code"; break; } return (UChar* )p; } static void sprint_byte(char* s, unsigned int v) { xsnprintf(s, 3, "%02x", (v & 0377)); } static void sprint_byte_with_x(char* s, unsigned int v) { xsnprintf(s, 5, "\\x%02x", (v & 0377)); } static int to_ascii(OnigEncoding enc, UChar *s, UChar *end, UChar buf[], int buf_size, int *is_over) { int len; UChar *p; OnigCodePoint code; if (!s) { len = 0; *is_over = 0; } else if (ONIGENC_MBC_MINLEN(enc) > 1) { p = s; len = 0; while (p < end) { code = ONIGENC_MBC_TO_CODE(enc, p, end); if (code >= 0x80) { if (code > 0xffff && len + 10 <= buf_size) { sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 24)); sprint_byte((char*)(&(buf[len+4])), (unsigned int)(code >> 16)); sprint_byte((char*)(&(buf[len+6])), (unsigned int)(code >> 8)); sprint_byte((char*)(&(buf[len+8])), (unsigned int)code); len += 10; } else if (len + 6 <= buf_size) { sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 8)); sprint_byte((char*)(&(buf[len+4])), (unsigned int)code); len += 6; } else { break; } } else { buf[len++] = (UChar )code; } p += enclen(enc, p); if (len >= buf_size) break; } *is_over = p < end; } else { len = MIN((int )(end - s), buf_size); xmemcpy(buf, s, (size_t )len); *is_over = ((buf_size < (end - s)) ? 1 : 0); } return len; } extern int onig_is_error_code_needs_param(int code) { switch (code) { case ONIGERR_UNDEFINED_NAME_REFERENCE: case ONIGERR_UNDEFINED_GROUP_REFERENCE: case ONIGERR_MULTIPLEX_DEFINED_NAME: case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL: case ONIGERR_INVALID_GROUP_NAME: case ONIGERR_INVALID_CHAR_IN_GROUP_NAME: case ONIGERR_INVALID_CHAR_PROPERTY_NAME: return 1; default: return 0; } } /* for ONIG_MAX_ERROR_MESSAGE_LEN */ #define MAX_ERROR_PAR_LEN 30 extern int ONIG_VARIADIC_FUNC_ATTR onig_error_code_to_str(UChar* s, int code, ...) { UChar *p, *q; OnigErrorInfo* einfo; int len, is_over; UChar parbuf[MAX_ERROR_PAR_LEN]; va_list vargs; va_start(vargs, code); switch (code) { case ONIGERR_UNDEFINED_NAME_REFERENCE: case ONIGERR_UNDEFINED_GROUP_REFERENCE: case ONIGERR_MULTIPLEX_DEFINED_NAME: case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL: case ONIGERR_INVALID_GROUP_NAME: case ONIGERR_INVALID_CHAR_IN_GROUP_NAME: case ONIGERR_INVALID_CHAR_PROPERTY_NAME: einfo = va_arg(vargs, OnigErrorInfo*); len = to_ascii(einfo->enc, einfo->par, einfo->par_end, parbuf, MAX_ERROR_PAR_LEN - 3, &is_over); q = onig_error_code_to_format(code); p = s; while (*q != '\0') { if (*q == '%') { q++; if (*q == 'n') { /* '%n': name */ xmemcpy(p, parbuf, len); p += len; if (is_over != 0) { xmemcpy(p, "...", 3); p += 3; } q++; } else goto normal_char; } else { normal_char: *p++ = *q++; } } *p = '\0'; len = (int )(p - s); break; default: q = onig_error_code_to_format(code); len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q); xmemcpy(s, q, len); s[len] = '\0'; break; } va_end(vargs); return len; } void ONIG_VARIADIC_FUNC_ATTR onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const char *fmt, ...) { int n, need, len; UChar *p, *s, *bp; UChar bs[6]; va_list args; va_start(args, fmt); n = xvsnprintf((char* )buf, bufsize, fmt, args); va_end(args); need = (int )(pat_end - pat) * 4 + 4; if (n + need < bufsize) { xstrcat((char* )buf, ": /", bufsize); s = buf + onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, buf); p = pat; while (p < pat_end) { if (ONIGENC_IS_MBC_HEAD(enc, p)) { len = enclen(enc, p); if (ONIGENC_MBC_MINLEN(enc) == 1) { while (len-- > 0) *s++ = *p++; } else { /* for UTF16/32 */ int blen; while (len-- > 0) { sprint_byte_with_x((char* )bs, (unsigned int )(*p++)); blen = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs); bp = bs; while (blen-- > 0) *s++ = *bp++; } } } else if (*p == '\\') { *s++ = *p++; len = enclen(enc, p); while (len-- > 0) *s++ = *p++; } else if (*p == '/') { *s++ = (unsigned char )'\\'; *s++ = *p++; } else if (!ONIGENC_IS_CODE_PRINT(enc, *p) && !ONIGENC_IS_CODE_SPACE(enc, *p)) { sprint_byte_with_x((char* )bs, (unsigned int )(*p++)); len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs); bp = bs; while (len-- > 0) *s++ = *bp++; } else { *s++ = *p++; } } *s++ = '/'; *s = '\0'; } } jq-1.8.2/vendor/oniguruma/src/iso8859_4.c0000644000175100017510000002121715215513537013442 /********************************************************************** iso8859_4.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_4_TO_LOWER_CASE(c) EncISO_8859_4_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_4_CTYPE(code,ctype) \ ((EncISO_8859_4_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_4_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\261', '\242', '\263', '\244', '\265', '\266', '\247', '\250', '\271', '\272', '\273', '\274', '\255', '\276', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\277', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_4_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x30e2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x00a0, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_4_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; /* return byte length of converted char to lower */ } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_4_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa1, 0xb1 }, { 0xa3, 0xb3 }, { 0xa5, 0xb5 }, { 0xa6, 0xb6 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xae, 0xbe }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_4 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-4", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/mktable.c0000644000175100017510000007074615215513537013521 /********************************************************************** mktable.c **********************************************************************/ /*- * Copyright (c) 2002-2022 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include #include #include #ifndef __USE_ISOC99 #define __USE_ISOC99 #endif #include #include "regenc.h" #define ASCII 0 #define UNICODE_ISO_8859_1 1 #define ISO_8859_1 2 #define ISO_8859_2 3 #define ISO_8859_3 4 #define ISO_8859_4 5 #define ISO_8859_5 6 #define ISO_8859_6 7 #define ISO_8859_7 8 #define ISO_8859_8 9 #define ISO_8859_9 10 #define ISO_8859_10 11 #define ISO_8859_11 12 #define ISO_8859_13 13 #define ISO_8859_14 14 #define ISO_8859_15 15 #define ISO_8859_16 16 #define KOI8 17 #define KOI8_R 18 typedef struct { int num; char* name; } ENC_INFO; static ENC_INFO Info[] = { { ASCII, "ASCII" }, { UNICODE_ISO_8859_1, "UNICODE_ISO_8859_1" }, { ISO_8859_1, "ISO_8859_1" }, { ISO_8859_2, "ISO_8859_2" }, { ISO_8859_3, "ISO_8859_3" }, { ISO_8859_4, "ISO_8859_4" }, { ISO_8859_5, "ISO_8859_5" }, { ISO_8859_6, "ISO_8859_6" }, { ISO_8859_7, "ISO_8859_7" }, { ISO_8859_8, "ISO_8859_8" }, { ISO_8859_9, "ISO_8859_9" }, { ISO_8859_10, "ISO_8859_10" }, { ISO_8859_11, "ISO_8859_11" }, { ISO_8859_13, "ISO_8859_13" }, { ISO_8859_14, "ISO_8859_14" }, { ISO_8859_15, "ISO_8859_15" }, { ISO_8859_16, "ISO_8859_16" }, { KOI8, "KOI8" }, { KOI8_R, "KOI8_R" } }; static int IsAlpha(int enc, int c) { if (enc == ASCII) return isalpha(c); if (c >= 0x41 && c <= 0x5a) return 1; if (c >= 0x61 && c <= 0x7a) return 1; switch (enc) { case UNICODE_ISO_8859_1: case ISO_8859_1: case ISO_8859_9: if (c == 0xaa) return 1; if (c == 0xb5) return 1; if (c == 0xba) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xff) return 1; break; case ISO_8859_2: if (c == 0xa1 || c == 0xa3) return 1; if (c == 0xa5 || c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c >= 0xae && c <= 0xaf) return 1; if (c == 0xb1 || c == 0xb3) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbc) return 1; if (c >= 0xbe && c <= 0xbf) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_3: if (c == 0xa1) return 1; if (c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c == 0xaf) return 1; if (c == 0xb1) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbc) return 1; if (c == 0xbf) return 1; if (c >= 0xc0 && c <= 0xc2) return 1; if (c >= 0xc4 && c <= 0xcf) return 1; if (c >= 0xd1 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xe2) return 1; if (c >= 0xe4 && c <= 0xef) return 1; if (c >= 0xf1 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_4: if (c >= 0xa1 && c <= 0xa3) return 1; if (c == 0xa5 || c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c == 0xae) return 1; if (c == 0xb1 || c == 0xb3) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbf) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_5: if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1; if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1; break; case ISO_8859_6: if (c >= 0xc1 && c <= 0xda) return 1; if (c >= 0xe0 && c <= 0xf2) return 1; break; case ISO_8859_7: if (c == 0xb6) return 1; if (c >= 0xb8 && c <= 0xba) return 1; if (c == 0xbc) return 1; if (c >= 0xbe && c <= 0xbf) return 1; if (c == 0xc0) return 1; if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1; if (c >= 0xdc && c <= 0xfe) return 1; break; case ISO_8859_8: if (c == 0xb5) return 1; if (c >= 0xe0 && c <= 0xfa) return 1; break; case ISO_8859_10: if (c >= 0xa1 && c <= 0xa6) return 1; if (c >= 0xa8 && c <= 0xac) return 1; if (c == 0xae || c == 0xaf) return 1; if (c >= 0xb1 && c <= 0xb6) return 1; if (c >= 0xb8 && c <= 0xbc) return 1; if (c >= 0xbe && c <= 0xff) return 1; break; case ISO_8859_11: if (c >= 0xa1 && c <= 0xda) return 1; if (c >= 0xdf && c <= 0xfb) return 1; break; case ISO_8859_13: if (c == 0xa8) return 1; if (c == 0xaa) return 1; if (c == 0xaf) return 1; if (c == 0xb5) return 1; if (c == 0xb8) return 1; if (c == 0xba) return 1; if (c >= 0xbf && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_14: if (c == 0xa1 || c == 0xa2) return 1; if (c == 0xa4 || c == 0xa5) return 1; if (c == 0xa6 || c == 0xa8) return 1; if (c >= 0xaa && c <= 0xac) return 1; if (c >= 0xaf && c <= 0xb5) return 1; if (c >= 0xb7 && c <= 0xff) return 1; break; case ISO_8859_15: if (c == 0xaa) return 1; if (c == 0xb5) return 1; if (c == 0xba) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xff) return 1; if (c == 0xa6) return 1; if (c == 0xa8) return 1; if (c == 0xb4) return 1; if (c == 0xb8) return 1; if (c == 0xbc) return 1; if (c == 0xbd) return 1; if (c == 0xbe) return 1; break; case ISO_8859_16: if (c == 0xa1) return 1; if (c == 0xa2) return 1; if (c == 0xa3) return 1; if (c == 0xa6) return 1; if (c == 0xa8) return 1; if (c == 0xaa) return 1; if (c == 0xac) return 1; if (c == 0xae) return 1; if (c == 0xaf) return 1; if (c == 0xb2) return 1; if (c == 0xb3) return 1; if (c == 0xb4) return 1; if (c >= 0xb8 && c <= 0xba) return 1; if (c == 0xbc) return 1; if (c == 0xbd) return 1; if (c == 0xbe) return 1; if (c == 0xbf) return 1; if (c >= 0xc0 && c <= 0xde) return 1; if (c >= 0xdf && c <= 0xff) return 1; break; case KOI8_R: if (c == 0xa3 || c == 0xb3) return 1; /* fall */ case KOI8: if (c >= 0xc0 && c <= 0xff) return 1; break; default: exit(-1); } return 0; } static int IsBlank(int enc, int c) { if (enc == ASCII) return isblank(c); if (c == 0x09 || c == 0x20) return 1; switch (enc) { case UNICODE_ISO_8859_1: case ISO_8859_1: case ISO_8859_2: case ISO_8859_3: case ISO_8859_4: case ISO_8859_5: case ISO_8859_6: case ISO_8859_7: case ISO_8859_8: case ISO_8859_9: case ISO_8859_10: case ISO_8859_11: case ISO_8859_13: case ISO_8859_14: case ISO_8859_15: case ISO_8859_16: case KOI8: if (c == 0xa0) return 1; break; case KOI8_R: if (c == 0x9a) return 1; break; default: exit(-1); } return 0; } static int IsCntrl(int enc, int c) { if (enc == ASCII) return iscntrl(c); if (c >= 0x00 && c <= 0x1F) return 1; switch (enc) { case UNICODE_ISO_8859_1: if (c == 0xad) return 1; /* fall */ case ISO_8859_1: case ISO_8859_2: case ISO_8859_3: case ISO_8859_4: case ISO_8859_5: case ISO_8859_6: case ISO_8859_7: case ISO_8859_8: case ISO_8859_9: case ISO_8859_10: case ISO_8859_11: case ISO_8859_13: case ISO_8859_14: case ISO_8859_15: case ISO_8859_16: case KOI8: if (c >= 0x7f && c <= 0x9F) return 1; break; case KOI8_R: if (c == 0x7f) return 1; break; default: exit(-1); } return 0; } static int IsDigit(int enc ARG_UNUSED, int c) { if (c >= 0x30 && c <= 0x39) return 1; return 0; } static int IsGraph(int enc, int c) { if (enc == ASCII) return isgraph(c); if (c >= 0x21 && c <= 0x7e) return 1; switch (enc) { case UNICODE_ISO_8859_1: case ISO_8859_1: case ISO_8859_2: case ISO_8859_4: case ISO_8859_5: case ISO_8859_9: case ISO_8859_10: case ISO_8859_13: case ISO_8859_14: case ISO_8859_15: case ISO_8859_16: if (c >= 0xa1 && c <= 0xff) return 1; break; case ISO_8859_3: if (c >= 0xa1) { if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 || c == 0xe3 || c == 0xf0) return 0; else return 1; } break; case ISO_8859_6: if (c == 0xa4 || c == 0xac || c == 0xad || c == 0xbb || c == 0xbf) return 1; if (c >= 0xc1 && c <= 0xda) return 1; if (c >= 0xe0 && c <= 0xf2) return 1; break; case ISO_8859_7: if (c >= 0xa1 && c <= 0xfe && c != 0xa4 && c != 0xa5 && c != 0xaa && c != 0xae && c != 0xd2) return 1; break; case ISO_8859_8: if (c >= 0xa2 && c <= 0xfa) { if (c >= 0xbf && c <= 0xde) return 0; return 1; } break; case ISO_8859_11: if (c >= 0xa1 && c <= 0xda) return 1; if (c >= 0xdf && c <= 0xfb) return 1; break; case KOI8: if (c >= 0xc0 && c <= 0xff) return 1; break; case KOI8_R: if (c >= 0x80 && c <= 0xff && c != 0x9a) return 1; break; default: exit(-1); } return 0; } static int IsLower(int enc, int c) { if (enc == ASCII) return islower(c); if (c >= 0x61 && c <= 0x7a) return 1; switch (enc) { case UNICODE_ISO_8859_1: case ISO_8859_1: case ISO_8859_9: if (c == 0xaa) return 1; if (c == 0xb5) return 1; if (c == 0xba) return 1; if (c >= 0xdf && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xff) return 1; break; case ISO_8859_2: if (c == 0xb1 || c == 0xb3) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbc) return 1; if (c >= 0xbe && c <= 0xbf) return 1; if (c >= 0xdf && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_3: if (c == 0xb1) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbc) return 1; if (c == 0xbf) return 1; if (c == 0xdf) return 1; if (c >= 0xe0 && c <= 0xe2) return 1; if (c >= 0xe4 && c <= 0xef) return 1; if (c >= 0xf1 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_4: if (c == 0xa2) return 1; if (c == 0xb1 || c == 0xb3) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbc) return 1; if (c >= 0xbe && c <= 0xbf) return 1; if (c == 0xdf) return 1; if (c >= 0xe0 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_5: if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1; break; case ISO_8859_6: break; case ISO_8859_7: if (c == 0xc0) return 1; if (c >= 0xdc && c <= 0xfe) return 1; break; case ISO_8859_8: if (c == 0xb5) return 1; break; case ISO_8859_10: if (c >= 0xb1 && c <= 0xb6) return 1; if (c >= 0xb8 && c <= 0xbc) return 1; if (c == 0xbe || c == 0xbf) return 1; if (c >= 0xdf && c <= 0xff) return 1; break; case ISO_8859_11: break; case ISO_8859_13: if (c == 0xb5) return 1; if (c == 0xb8) return 1; if (c == 0xba) return 1; if (c == 0xbf) return 1; if (c >= 0xdf && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_14: if (c == 0xa2) return 1; if (c == 0xa5) return 1; if (c == 0xab) return 1; if (c == 0xb1 || c == 0xb3 || c == 0xb5) return 1; if (c >= 0xb8 && c <= 0xba) return 1; if (c == 0xbc) return 1; if (c == 0xbe || c == 0xbf) return 1; if (c >= 0xdf && c <= 0xff) return 1; break; case ISO_8859_15: if (c == 0xaa) return 1; if (c == 0xb5) return 1; if (c == 0xba) return 1; if (c >= 0xdf && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xff) return 1; if (c == 0xa8) return 1; if (c == 0xb8) return 1; if (c == 0xbd) return 1; break; case ISO_8859_16: if (c == 0xa2) return 1; if (c == 0xa8) return 1; if (c == 0xae) return 1; if (c == 0xb3) return 1; if (c >= 0xb8 && c <= 0xba) return 1; if (c == 0xbd) return 1; if (c == 0xbf) return 1; if (c >= 0xdf && c <= 0xff) return 1; break; case KOI8_R: if (c == 0xa3) return 1; /* fall */ case KOI8: if (c >= 0xc0 && c <= 0xdf) return 1; break; default: exit(-1); } return 0; } static int IsPrint(int enc, int c) { if (enc == ASCII) return isprint(c); if (c >= 0x20 && c <= 0x7e) return 1; switch (enc) { case UNICODE_ISO_8859_1: if (c >= 0x09 && c <= 0x0d) return 1; if (c == 0x85) return 1; /* fall */ case ISO_8859_1: case ISO_8859_2: case ISO_8859_4: case ISO_8859_5: case ISO_8859_9: case ISO_8859_10: case ISO_8859_13: case ISO_8859_14: case ISO_8859_15: case ISO_8859_16: if (c >= 0xa0 && c <= 0xff) return 1; break; case ISO_8859_3: if (c >= 0xa0) { if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 || c == 0xe3 || c == 0xf0) return 0; else return 1; } break; case ISO_8859_6: if (c == 0xa0) return 1; if (c == 0xa4 || c == 0xac || c == 0xad || c == 0xbb || c == 0xbf) return 1; if (c >= 0xc1 && c <= 0xda) return 1; if (c >= 0xe0 && c <= 0xf2) return 1; break; case ISO_8859_7: if (c >= 0xa0 && c <= 0xfe && c != 0xa4 && c != 0xa5 && c != 0xaa && c != 0xae && c != 0xd2) return 1; break; case ISO_8859_8: if (c >= 0xa0 && c <= 0xfa) { if (c >= 0xbf && c <= 0xde) return 0; if (c == 0xa1) return 0; return 1; } break; case ISO_8859_11: if (c >= 0xa0 && c <= 0xda) return 1; if (c >= 0xdf && c <= 0xfb) return 1; break; case KOI8: if (c == 0xa0) return 1; if (c >= 0xc0 && c <= 0xff) return 1; break; case KOI8_R: if (c >= 0x80 && c <= 0xff) return 1; break; default: exit(-1); } return 0; } static int IsPunct(int enc, int c) { if (enc == ASCII) return ispunct(c); if (c >= 0x21 && c <= 0x2f) return 1; if (c >= 0x3a && c <= 0x40) return 1; if (c >= 0x5b && c <= 0x60) return 1; if (c >= 0x7b && c <= 0x7e) return 1; if (enc == UNICODE_ISO_8859_1) { if (c < 0x80) return 0; if (c >= 0xa1 && c <= 0xa9) return 1; if (c >= 0xab && c <= 0xac) return 1; if (c >= 0xae && c <= 0xb1) return 1; if (c == 0xb4) return 1; if (c >= 0xb6 && c <= 0xb8) return 1; if (c == 0xbb || c == 0xbf || c == 0xd7 || c == 0xf7) return 1; return 0; } switch (enc) { case ISO_8859_1: case ISO_8859_9: case ISO_8859_15: if (c == 0xad) return 1; if (c == 0xa1) return 1; if (c == 0xab) return 1; if (c == 0xb7) return 1; if (c == 0xbb) return 1; if (c == 0xbf) return 1; break; case ISO_8859_2: case ISO_8859_4: case ISO_8859_5: case ISO_8859_14: if (c == 0xad) return 1; break; case ISO_8859_3: case ISO_8859_10: if (c == 0xad) return 1; if (c == 0xb7) return 1; if (c == 0xbd) return 1; break; case ISO_8859_6: if (c == 0xac) return 1; if (c == 0xad) return 1; if (c == 0xbb) return 1; if (c == 0xbf) return 1; break; case ISO_8859_7: if (c == 0xa1 || c == 0xa2) return 1; if (c == 0xab) return 1; if (c == 0xaf) return 1; if (c == 0xad) return 1; if (c == 0xb7 || c == 0xbb) return 1; break; case ISO_8859_8: if (c == 0xab) return 1; if (c == 0xad) return 1; if (c == 0xb7) return 1; if (c == 0xbb) return 1; if (c == 0xdf) return 1; break; case ISO_8859_13: if (c == 0xa1 || c == 0xa5) return 1; if (c == 0xab || c == 0xad) return 1; if (c == 0xb4 || c == 0xb7) return 1; if (c == 0xbb) return 1; if (c == 0xff) return 1; break; case ISO_8859_16: if (c == 0xa5) return 1; if (c == 0xab) return 1; if (c == 0xad) return 1; if (c == 0xb5) return 1; if (c == 0xb7) return 1; if (c == 0xbb) return 1; break; case KOI8_R: if (c == 0x9e) return 1; break; case ISO_8859_11: case KOI8: break; default: exit(-1); } return 0; } static int IsSpace(int enc, int c) { if (enc == ASCII) return isspace(c); if (c >= 0x09 && c <= 0x0d) return 1; if (c == 0x20) return 1; switch (enc) { case UNICODE_ISO_8859_1: if (c == 0x85) return 1; /* fall */ case ISO_8859_1: case ISO_8859_2: case ISO_8859_3: case ISO_8859_4: case ISO_8859_5: case ISO_8859_6: case ISO_8859_7: case ISO_8859_8: case ISO_8859_9: case ISO_8859_10: case ISO_8859_11: case ISO_8859_13: case ISO_8859_14: case ISO_8859_15: case ISO_8859_16: case KOI8: if (c == 0xa0) return 1; break; case KOI8_R: if (c == 0x9a) return 1; break; default: exit(-1); } return 0; } static int IsUpper(int enc, int c) { if (enc == ASCII) return isupper(c); if (c >= 0x41 && c <= 0x5a) return 1; switch (enc) { case UNICODE_ISO_8859_1: case ISO_8859_1: case ISO_8859_9: if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xde) return 1; break; case ISO_8859_2: if (c == 0xa1 || c == 0xa3) return 1; if (c == 0xa5 || c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c >= 0xae && c <= 0xaf) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xde) return 1; break; case ISO_8859_3: if (c == 0xa1) return 1; if (c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c == 0xaf) return 1; if (c >= 0xc0 && c <= 0xc2) return 1; if (c >= 0xc4 && c <= 0xcf) return 1; if (c >= 0xd1 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xde) return 1; break; case ISO_8859_4: if (c == 0xa1 || c == 0xa3) return 1; if (c == 0xa5 || c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c == 0xae) return 1; if (c == 0xbd) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xde) return 1; break; case ISO_8859_5: if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1; break; case ISO_8859_6: break; case ISO_8859_7: if (c == 0xb6) return 1; if (c >= 0xb8 && c <= 0xba) return 1; if (c == 0xbc) return 1; if (c >= 0xbe && c <= 0xbf) return 1; if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1; break; case ISO_8859_8: case ISO_8859_11: break; case ISO_8859_10: if (c >= 0xa1 && c <= 0xa6) return 1; if (c >= 0xa8 && c <= 0xac) return 1; if (c == 0xae || c == 0xaf) return 1; if (c >= 0xc0 && c <= 0xde) return 1; break; case ISO_8859_13: if (c == 0xa8) return 1; if (c == 0xaa) return 1; if (c == 0xaf) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xde) return 1; break; case ISO_8859_14: if (c == 0xa1) return 1; if (c == 0xa4 || c == 0xa6) return 1; if (c == 0xa8) return 1; if (c == 0xaa || c == 0xac) return 1; if (c == 0xaf || c == 0xb0) return 1; if (c == 0xb2 || c == 0xb4 || c == 0xb7) return 1; if (c == 0xbb || c == 0xbd) return 1; if (c >= 0xc0 && c <= 0xde) return 1; break; case ISO_8859_15: if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xde) return 1; if (c == 0xa6) return 1; if (c == 0xb4) return 1; if (c == 0xbc) return 1; if (c == 0xbe) return 1; break; case ISO_8859_16: if (c == 0xa1) return 1; if (c == 0xa3) return 1; if (c == 0xa6) return 1; if (c == 0xaa) return 1; if (c == 0xac) return 1; if (c == 0xaf) return 1; if (c == 0xb2) return 1; if (c == 0xb4) return 1; if (c == 0xbc) return 1; if (c == 0xbe) return 1; if (c >= 0xc0 && c <= 0xde) return 1; break; case KOI8_R: if (c == 0xb3) return 1; /* fall */ case KOI8: if (c >= 0xe0 && c <= 0xff) return 1; break; default: exit(-1); } return 0; } static int IsXDigit(int enc, int c) { if (enc == ASCII) return isxdigit(c); if (c >= 0x30 && c <= 0x39) return 1; if (c >= 0x41 && c <= 0x46) return 1; if (c >= 0x61 && c <= 0x66) return 1; return 0; } static int IsWord(int enc, int c) { if (enc == ASCII) { return (isalpha(c) || isdigit(c) || c == 0x5f); } if (c >= 0x30 && c <= 0x39) return 1; if (c >= 0x41 && c <= 0x5a) return 1; if (c == 0x5f) return 1; if (c >= 0x61 && c <= 0x7a) return 1; switch (enc) { case UNICODE_ISO_8859_1: case ISO_8859_1: case ISO_8859_9: if (c == 0xaa) return 1; if (c >= 0xb2 && c <= 0xb3) return 1; if (c == 0xb5) return 1; if (c >= 0xb9 && c <= 0xba) return 1; if (c >= 0xbc && c <= 0xbe) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xff) return 1; break; case ISO_8859_2: if (c == 0xa1 || c == 0xa3) return 1; if (c == 0xa5 || c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c >= 0xae && c <= 0xaf) return 1; if (c == 0xb1 || c == 0xb3) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbc) return 1; if (c >= 0xbe && c <= 0xbf) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_3: if (c == 0xa1) return 1; if (c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c == 0xaf) return 1; if (c >= 0xb1 && c <= 0xb3) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbd) return 1; if (c == 0xbf) return 1; if (c >= 0xc0 && c <= 0xc2) return 1; if (c >= 0xc4 && c <= 0xcf) return 1; if (c >= 0xd1 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xe2) return 1; if (c >= 0xe4 && c <= 0xef) return 1; if (c >= 0xf1 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_4: if (c >= 0xa1 && c <= 0xa3) return 1; if (c == 0xa5 || c == 0xa6) return 1; if (c >= 0xa9 && c <= 0xac) return 1; if (c == 0xae) return 1; if (c == 0xb1 || c == 0xb3) return 1; if (c == 0xb5 || c == 0xb6) return 1; if (c >= 0xb9 && c <= 0xbf) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_5: if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1; if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1; break; case ISO_8859_6: if (c >= 0xc1 && c <= 0xda) return 1; if (c >= 0xe0 && c <= 0xea) return 1; if (c >= 0xeb && c <= 0xf2) return 1; break; case ISO_8859_7: if (c == 0xb2 || c == 0xb3) return 1; if (c == 0xb6) return 1; if (c >= 0xb8 && c <= 0xba) return 1; if (c >= 0xbc && c <= 0xbf) return 1; if (c == 0xc0) return 1; if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1; if (c >= 0xdc && c <= 0xfe) return 1; break; case ISO_8859_8: if (c == 0xb2 || c == 0xb3 || c == 0xb5 || c == 0xb9) return 1; if (c >= 0xbc && c <= 0xbe) return 1; if (c >= 0xe0 && c <= 0xfa) return 1; break; case ISO_8859_10: if (c >= 0xa1 && c <= 0xff) { if (c != 0xa7 && c != 0xad && c != 0xb0 && c != 0xb7 && c != 0xbd) return 1; } break; case ISO_8859_11: if (c >= 0xa1 && c <= 0xda) return 1; if (c >= 0xdf && c <= 0xfb) return 1; break; case ISO_8859_13: if (c == 0xa8) return 1; if (c == 0xaa) return 1; if (c == 0xaf) return 1; if (c == 0xb2 || c == 0xb3 || c == 0xb5 || c == 0xb9) return 1; if (c >= 0xbc && c <= 0xbe) return 1; if (c == 0xb8) return 1; if (c == 0xba) return 1; if (c >= 0xbf && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xfe) return 1; break; case ISO_8859_14: if (c >= 0xa1 && c <= 0xff) { if (c == 0xa3 || c == 0xa7 || c == 0xa9 || c == 0xad || c == 0xae || c == 0xb6) return 0; return 1; } break; case ISO_8859_15: if (c == 0xaa) return 1; if (c >= 0xb2 && c <= 0xb3) return 1; if (c == 0xb5) return 1; if (c >= 0xb9 && c <= 0xba) return 1; if (c >= 0xbc && c <= 0xbe) return 1; if (c >= 0xc0 && c <= 0xd6) return 1; if (c >= 0xd8 && c <= 0xf6) return 1; if (c >= 0xf8 && c <= 0xff) return 1; if (c == 0xa6) return 1; if (c == 0xa8) return 1; if (c == 0xb4) return 1; if (c == 0xb8) return 1; break; case ISO_8859_16: if (c == 0xa1) return 1; if (c == 0xa2) return 1; if (c == 0xa3) return 1; if (c == 0xa6) return 1; if (c == 0xa8) return 1; if (c == 0xaa) return 1; if (c == 0xac) return 1; if (c == 0xae) return 1; if (c == 0xaf) return 1; if (c == 0xb2) return 1; if (c == 0xb3) return 1; if (c == 0xb4) return 1; if (c >= 0xb8 && c <= 0xba) return 1; if (c == 0xbc) return 1; if (c == 0xbd) return 1; if (c == 0xbe) return 1; if (c == 0xbf) return 1; if (c >= 0xc0 && c <= 0xde) return 1; if (c >= 0xdf && c <= 0xff) return 1; break; case KOI8_R: if (c == 0x9d) return 1; if (c == 0xa3 || c == 0xb3) return 1; /* fall */ case KOI8: if (c >= 0xc0 && c <= 0xff) return 1; break; default: exit(-1); } return 0; } static int IsAscii(int enc ARG_UNUSED, int c) { if (c >= 0x00 && c <= 0x7f) return 1; return 0; } static int IsNewline(int enc ARG_UNUSED, int c) { if (c == NEWLINE_CODE) return 1; return 0; } static int exec(FILE* fp, ENC_INFO* einfo) { #define NCOL 8 int c, val, enc; int r; enc = einfo->num; r = fprintf(fp, "static const unsigned short Enc%s_CtypeTable[256] = {\n", einfo->name); if (r < 0) return -1; for (c = 0; c < 256; c++) { val = 0; if (IsNewline(enc, c)) val |= BIT_CTYPE_NEWLINE; if (IsAlpha (enc, c)) val |= (BIT_CTYPE_ALPHA | BIT_CTYPE_ALNUM); if (IsBlank (enc, c)) val |= BIT_CTYPE_BLANK; if (IsCntrl (enc, c)) val |= BIT_CTYPE_CNTRL; if (IsDigit (enc, c)) val |= (BIT_CTYPE_DIGIT | BIT_CTYPE_ALNUM); if (IsGraph (enc, c)) val |= BIT_CTYPE_GRAPH; if (IsLower (enc, c)) val |= BIT_CTYPE_LOWER; if (IsPrint (enc, c)) val |= BIT_CTYPE_PRINT; if (IsPunct (enc, c)) val |= BIT_CTYPE_PUNCT; if (IsSpace (enc, c)) val |= BIT_CTYPE_SPACE; if (IsUpper (enc, c)) val |= BIT_CTYPE_UPPER; if (IsXDigit(enc, c)) val |= BIT_CTYPE_XDIGIT; if (IsWord (enc, c)) val |= BIT_CTYPE_WORD; if (IsAscii (enc, c)) val |= BIT_CTYPE_ASCII; if (c % NCOL == 0) { r = fputs(" ", fp); if (r < 0) return -1; } r = fprintf(fp, "0x%04x", val); if (r < 0) return -1; if (c != 255) { r = fputs(",", fp); if (r < 0) return -1; } if (c != 0 && c % NCOL == (NCOL-1)) r = fputs("\n", fp); else r = fputs(" ", fp); if (r < 0) return -1; } r = fprintf(fp, "};\n"); if (r < 0) return -1; return 0; } extern int main(int argc ARG_UNUSED, char* argv[] ARG_UNUSED) { int r; int i; FILE* fp = stdout; setlocale(LC_ALL, "C"); /* setlocale(LC_ALL, "POSIX"); */ /* setlocale(LC_ALL, "en_GB.iso88591"); */ /* setlocale(LC_ALL, "de_BE.iso88591"); */ /* setlocale(LC_ALL, "fr_FR.iso88591"); */ for (i = 0; i < (int )(sizeof(Info)/sizeof(ENC_INFO)); i++) { r = exec(fp, &Info[i]); if (r < 0) { fprintf(stderr, "FAIL exec(): %d\n", r); return -1; } } return 0; } jq-1.8.2/vendor/oniguruma/src/st.c0000644000175100017510000002614515215513537012522 /* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */ /* static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; */ #ifndef NEED_TO_INCLUDE_STDIO #define NEED_TO_INCLUDE_STDIO #endif #include "regint.h" #include "st.h" typedef struct st_table_entry st_table_entry; struct st_table_entry { unsigned int hash; st_data_t key; st_data_t record; st_table_entry *next; }; #define ST_DEFAULT_MAX_DENSITY 5 #define ST_DEFAULT_INIT_TABLE_SIZE 11 /* * DEFAULT_MAX_DENSITY is the default for the largest we allow the * average number of items per bin before increasing the number of * bins * * DEFAULT_INIT_TABLE_SIZE is the default for the number of bins * allocated initially * */ static int numcmp(st_data_t, st_data_t); static int numhash(st_data_t); static struct st_hash_type type_numhash = { numcmp, numhash, }; static int str_cmp(st_data_t, st_data_t); static int str_hash(st_data_t); static struct st_hash_type type_strhash = { str_cmp, str_hash, }; static void rehash(st_table *); #define alloc(type) (type*)xmalloc((unsigned)sizeof(type)) #define Calloc(n,s) (char*)xcalloc((n),(s)) #define EQUAL(table,x,y) ((x)==(y) || (*table->type->compare)((x),(y)) == 0) #define do_hash(key,table) (unsigned int)(*(table)->type->hash)((key)) #define do_hash_bin(key,table) (do_hash(key, table)%(table)->num_bins) /* * MINSIZE is the minimum size of a dictionary. */ #define MINSIZE 8 /* Table of prime numbers 2^n+a, 2<=n<=30. */ static const long primes[] = { 8 + 3, 16 + 3, 32 + 5, 64 + 3, 128 + 3, 256 + 27, 512 + 9, 1024 + 9, 2048 + 5, 4096 + 3, 8192 + 27, 16384 + 43, 32768 + 3, 65536 + 45, 131072 + 29, 262144 + 3, 524288 + 21, 1048576 + 7, 2097152 + 17, 4194304 + 15, 8388608 + 9, 16777216 + 43, 33554432 + 35, 67108864 + 15, 134217728 + 29, 268435456 + 3, 536870912 + 11, 1073741824 + 85, 0 }; static int new_size(int size) { int i; #if 0 for (i=3; i<31; i++) { if ((1< size) return 1< size) return primes[i]; } /* Ran out of polynomials */ return -1; /* should raise exception */ #endif } #ifdef HASH_LOG static int collision = 0; static int init_st = 0; static void stat_col(void) { FILE *f = fopen("/tmp/col", "w"); if (f == 0) return ; (void) fprintf(f, "collision: %d\n", collision); (void) fclose(f); } #endif extern st_table* st_init_table_with_size(struct st_hash_type* type, int size) { st_table *tbl; #ifdef HASH_LOG if (init_st == 0) { init_st = 1; atexit(stat_col); } #endif size = new_size(size); /* round up to prime number */ if (size <= 0) return 0; tbl = alloc(st_table); if (tbl == 0) return 0; tbl->type = type; tbl->num_entries = 0; tbl->num_bins = size; tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*)); if (tbl->bins == 0) { free(tbl); return 0; } return tbl; } extern st_table* st_init_table(struct st_hash_type* type) { return st_init_table_with_size(type, 0); } extern st_table* st_init_numtable(void) { return st_init_table(&type_numhash); } extern st_table* st_init_numtable_with_size(int size) { return st_init_table_with_size(&type_numhash, size); } extern st_table* st_init_strtable(void) { return st_init_table(&type_strhash); } extern st_table* st_init_strtable_with_size(int size) { return st_init_table_with_size(&type_strhash, size); } extern void st_free_table(st_table* table) { register st_table_entry *ptr, *next; int i; for(i = 0; i < table->num_bins; i++) { ptr = table->bins[i]; while (ptr != 0) { next = ptr->next; free(ptr); ptr = next; } } free(table->bins); free(table); } #define PTR_NOT_EQUAL(table, ptr, hash_val, key) \ ((ptr) != 0 && (ptr->hash != (hash_val) || !EQUAL((table), (key), (ptr)->key))) #ifdef HASH_LOG #define COLLISION collision++ #else #define COLLISION #endif #define FIND_ENTRY(table, ptr, hash_val, bin_pos) do {\ bin_pos = hash_val%(table)->num_bins;\ ptr = (table)->bins[bin_pos];\ if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\ COLLISION;\ while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\ ptr = ptr->next;\ }\ ptr = ptr->next;\ }\ } while (0) extern int st_lookup(st_table* table, register st_data_t key, st_data_t* value) { unsigned int hash_val, bin_pos; register st_table_entry *ptr; hash_val = do_hash(key, table); FIND_ENTRY(table, ptr, hash_val, bin_pos); if (ptr == 0) { return 0; } else { if (value != 0) *value = ptr->record; return 1; } } #define ADD_DIRECT(table, key, value, hash_val, bin_pos, ret) \ do {\ st_table_entry *entry;\ if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\ rehash(table);\ bin_pos = hash_val % table->num_bins;\ }\ entry = alloc(st_table_entry);\ if (IS_NULL(entry)) return ret;\ entry->hash = hash_val;\ entry->key = key;\ entry->record = value;\ entry->next = table->bins[bin_pos];\ table->bins[bin_pos] = entry;\ table->num_entries++;\ } while (0) extern int st_insert(register st_table* table, register st_data_t key, st_data_t value) { unsigned int hash_val, bin_pos; register st_table_entry *ptr; hash_val = do_hash(key, table); FIND_ENTRY(table, ptr, hash_val, bin_pos); if (ptr == 0) { ADD_DIRECT(table, key, value, hash_val, bin_pos, ONIGERR_MEMORY); return 0; } else { ptr->record = value; return 1; } } extern void st_add_direct(st_table* table, st_data_t key, st_data_t value) { unsigned int hash_val, bin_pos; hash_val = do_hash(key, table); bin_pos = hash_val % table->num_bins; ADD_DIRECT(table, key, value, hash_val, bin_pos,); } static void rehash(register st_table* table) { register st_table_entry *ptr, *next, **new_bins; int i, new_num_bins, old_num_bins; unsigned int hash_val; old_num_bins = table->num_bins; new_num_bins = new_size(old_num_bins + 1); if (new_num_bins <= 0) return ; new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*)); if (new_bins == 0) { return ; } for(i = 0; i < old_num_bins; i++) { ptr = table->bins[i]; while (ptr != 0) { next = ptr->next; hash_val = ptr->hash % new_num_bins; ptr->next = new_bins[hash_val]; new_bins[hash_val] = ptr; ptr = next; } } free(table->bins); table->num_bins = new_num_bins; table->bins = new_bins; } extern st_table* st_copy(st_table* old_table) { st_table *new_table; st_table_entry *ptr, *entry; int i, num_bins = old_table->num_bins; new_table = alloc(st_table); if (new_table == 0) { return 0; } *new_table = *old_table; new_table->bins = (st_table_entry**) Calloc((unsigned)num_bins, sizeof(st_table_entry*)); if (new_table->bins == 0) { free(new_table); return 0; } for(i = 0; i < num_bins; i++) { new_table->bins[i] = 0; ptr = old_table->bins[i]; while (ptr != 0) { entry = alloc(st_table_entry); if (entry == 0) { free(new_table->bins); free(new_table); return 0; } *entry = *ptr; entry->next = new_table->bins[i]; new_table->bins[i] = entry; ptr = ptr->next; } } return new_table; } extern int st_delete(register st_table* table, register st_data_t* key, st_data_t* value) { unsigned int hash_val; st_table_entry *tmp; register st_table_entry *ptr; hash_val = do_hash_bin(*key, table); ptr = table->bins[hash_val]; if (ptr == 0) { if (value != 0) *value = 0; return 0; } if (EQUAL(table, *key, ptr->key)) { table->bins[hash_val] = ptr->next; table->num_entries--; if (value != 0) *value = ptr->record; *key = ptr->key; free(ptr); return 1; } for(; ptr->next != 0; ptr = ptr->next) { if (EQUAL(table, ptr->next->key, *key)) { tmp = ptr->next; ptr->next = ptr->next->next; table->num_entries--; if (value != 0) *value = tmp->record; *key = tmp->key; free(tmp); return 1; } } return 0; } extern int st_delete_safe(register st_table* table, register st_data_t* key, st_data_t* value, st_data_t never) { unsigned int hash_val; register st_table_entry *ptr; hash_val = do_hash_bin(*key, table); ptr = table->bins[hash_val]; if (ptr == 0) { if (value != 0) *value = 0; return 0; } for(; ptr != 0; ptr = ptr->next) { if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) { table->num_entries--; *key = ptr->key; if (value != 0) *value = ptr->record; ptr->key = ptr->record = never; return 1; } } return 0; } static int #if defined(__GNUC__) delete_never(st_data_t key __attribute__ ((unused)), st_data_t value, st_data_t never) #else delete_never(st_data_t key, st_data_t value, st_data_t never) #endif { if (value == never) return ST_DELETE; return ST_CONTINUE; } extern void st_cleanup_safe(st_table* table, st_data_t never) { int num_entries = table->num_entries; st_foreach(table, delete_never, never); table->num_entries = num_entries; } extern int st_foreach(st_table* table, int (*func)(st_data_t, st_data_t, st_data_t), st_data_t arg) { st_table_entry *ptr, *last, *tmp; enum st_retval retval; int i; for(i = 0; i < table->num_bins; i++) { last = 0; for(ptr = table->bins[i]; ptr != 0;) { retval = (*func)(ptr->key, ptr->record, arg); switch (retval) { case ST_CHECK: /* check if hash is modified during iteration */ tmp = 0; if (i < table->num_bins) { for (tmp = table->bins[i]; tmp; tmp=tmp->next) { if (tmp == ptr) break; } } if (!tmp) { /* call func with error notice */ return 1; } /* fall through */ case ST_CONTINUE: last = ptr; ptr = ptr->next; break; case ST_STOP: return 0; case ST_DELETE: tmp = ptr; if (last == 0) { table->bins[i] = ptr->next; } else { last->next = ptr->next; } ptr = ptr->next; free(tmp); table->num_entries--; } } } return 0; } static int str_cmp(st_data_t a1, st_data_t a2) { const char* s1 = (const char* )a1; const char* s2 = (const char* )a2; return strcmp(s1, s2); } static int str_hash(st_data_t astring) { const char* string = (const char* )astring; register int c; #ifdef HASH_ELFHASH register unsigned int h = 0, g; while ((c = *string++) != '\0') { h = ( h << 4 ) + c; if ( g = h & 0xF0000000 ) h ^= g >> 24; h &= ~g; } return h; #elif HASH_PERL register int val = 0; while ((c = *string++) != '\0') { val += c; val += (val << 10); val ^= (val >> 6); } val += (val << 3); val ^= (val >> 11); return val + (val << 15); #else register int val = 0; while ((c = *string++) != '\0') { val = val*997 + c; } return val + (val>>5); #endif } static int numcmp(st_data_t x, st_data_t y) { return x != y; } static int numhash(st_data_t n) { return n; } jq-1.8.2/vendor/oniguruma/src/regparse.c0000644000175100017510000067110015215513537013701 /********************************************************************** regparse.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #ifdef DEBUG_ND_FREE #ifndef NEED_TO_INCLUDE_STDIO #define NEED_TO_INCLUDE_STDIO #endif #endif #include "regparse.h" #include "st.h" #define INIT_TAG_NAMES_ALLOC_NUM 5 #define WARN_BUFSIZE 256 #define CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS #define IS_ALLOWED_CODE_IN_CALLOUT_NAME(c) \ ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_' /* || c == '!' */) #define IS_ALLOWED_CODE_IN_CALLOUT_TAG_NAME(c) \ ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_') #define OPTON_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE) #define OPTON_MULTILINE(option) ((option) & ONIG_OPTION_MULTILINE) #define OPTON_IGNORECASE(option) ((option) & ONIG_OPTION_IGNORECASE) #define OPTON_EXTEND(option) ((option) & ONIG_OPTION_EXTEND) #define OPTON_WORD_ASCII(option) \ ((option) & (ONIG_OPTION_WORD_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII)) #define OPTON_DIGIT_ASCII(option) \ ((option) & (ONIG_OPTION_DIGIT_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII)) #define OPTON_SPACE_ASCII(option) \ ((option) & (ONIG_OPTION_SPACE_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII)) #define OPTON_POSIX_ASCII(option) ((option) & ONIG_OPTION_POSIX_IS_ASCII) #define OPTON_TEXT_SEGMENT_WORD(option) ((option) & ONIG_OPTION_TEXT_SEGMENT_WORD) #define OPTON_IS_ASCII_MODE_CTYPE(ctype, options) \ ((ctype) >= 0 && \ (((ctype) < ONIGENC_CTYPE_ASCII && OPTON_POSIX_ASCII(options)) ||\ ((ctype) == ONIGENC_CTYPE_WORD && OPTON_WORD_ASCII(options)) ||\ ((ctype) == ONIGENC_CTYPE_DIGIT && OPTON_DIGIT_ASCII(options)) ||\ ((ctype) == ONIGENC_CTYPE_SPACE && OPTON_SPACE_ASCII(options)))) OnigSyntaxType OnigSyntaxOniguruma = { (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 | ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_O_BRACE_OCTAL | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL ) & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END ) , ( ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_ONIGURUMA | ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP | ONIG_SYN_OP2_ESC_K_NAMED_BACKREF | ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE | ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP | ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS | ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME | ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT | ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE | ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT | ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP | ONIG_SYN_OP2_ESC_G_SUBEXP_CALL | ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY | ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT | ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT | ONIG_SYN_OP2_CCLASS_SET_OP | ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL | ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META | ONIG_SYN_OP2_ESC_V_VTAB | ONIG_SYN_OP2_ESC_H_XDIGIT | ONIG_SYN_OP2_ESC_U_HEX4 ) , ( SYN_GNU_REGEX_BV | ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV | ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND | ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND | ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP | ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME | ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY | ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC | ONIG_SYN_WARN_CC_OP_NOT_ESCAPED | #ifdef USE_WHOLE_OPTIONS ONIG_SYN_WHOLE_OPTIONS | #endif ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT ) , ONIG_OPTION_NONE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType OnigSyntaxRuby = { (( SYN_GNU_REGEX_OP | ONIG_SYN_OP_QMARK_NON_GREEDY | ONIG_SYN_OP_ESC_OCTAL3 | ONIG_SYN_OP_ESC_X_HEX2 | ONIG_SYN_OP_ESC_X_BRACE_HEX8 | ONIG_SYN_OP_ESC_O_BRACE_OCTAL | ONIG_SYN_OP_ESC_CONTROL_CHARS | ONIG_SYN_OP_ESC_C_CONTROL ) & ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END ) , ( ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_RUBY | ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP | ONIG_SYN_OP2_ESC_K_NAMED_BACKREF | ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE | ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP | ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT | ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE | ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP | ONIG_SYN_OP2_ESC_G_SUBEXP_CALL | ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY | ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT | ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT | ONIG_SYN_OP2_CCLASS_SET_OP | ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL | ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META | ONIG_SYN_OP2_ESC_V_VTAB | ONIG_SYN_OP2_ESC_H_XDIGIT | ONIG_SYN_OP2_ESC_U_HEX4 ) , ( SYN_GNU_REGEX_BV | ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV | ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND | ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP | ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME | ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY | ONIG_SYN_WARN_CC_OP_NOT_ESCAPED | ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT ) , ONIG_OPTION_NONE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; OnigSyntaxType* OnigDefaultSyntax = ONIG_SYNTAX_ONIGURUMA; #define BB_INIT(buf,size) bbuf_init((BBuf* )(buf), (size)) #define BB_EXPAND(buf,low) do{\ do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\ (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\ } while (0) #define BB_ENSURE_SIZE(buf,size) do{\ unsigned int new_alloc = (buf)->alloc;\ while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\ if ((buf)->alloc != new_alloc) {\ (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\ (buf)->alloc = new_alloc;\ }\ } while (0) #define BB_WRITE(buf,pos,bytes,n) do{\ int used = (pos) + (n);\ if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\ xmemcpy((buf)->p + (pos), (bytes), (n));\ if ((buf)->used < (unsigned int )used) (buf)->used = used;\ } while (0) #define BB_WRITE1(buf,pos,byte) do{\ int used = (pos) + 1;\ if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\ (buf)->p[(pos)] = (byte);\ if ((buf)->used < (unsigned int )used) (buf)->used = used;\ } while (0) #define BB_ADD(buf,bytes,n) BB_WRITE((buf),(buf)->used,(bytes),(n)) #define BB_ADD1(buf,byte) BB_WRITE1((buf),(buf)->used,(byte)) #define BB_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used) #define BB_GET_OFFSET_POS(buf) ((buf)->used) /* from < to */ #define BB_MOVE_RIGHT(buf,from,to,n) do {\ if ((unsigned int )((to)+(n)) > (buf)->alloc) BB_EXPAND((buf),(to) + (n));\ xmemmove((buf)->p + (to), (buf)->p + (from), (n));\ if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\ } while (0) /* from > to */ #define BB_MOVE_LEFT(buf,from,to,n) do {\ xmemmove((buf)->p + (to), (buf)->p + (from), (n));\ } while (0) /* from > to */ #define BB_MOVE_LEFT_REDUCE(buf,from,to) do {\ xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\ (buf)->used -= (from - to);\ } while (0) #define BB_INSERT(buf,pos,bytes,n) do {\ if (pos >= (buf)->used) {\ BB_WRITE(buf,pos,bytes,n);\ }\ else {\ BB_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\ xmemcpy((buf)->p + (pos), (bytes), (n));\ }\ } while (0) #define BB_GET_BYTE(buf, pos) (buf)->p[(pos)] typedef enum { CS_VALUE, CS_RANGE, CS_COMPLETE, CS_START } CSTATE; typedef enum { CV_UNDEF, CV_SB, CV_MB, CV_CPROP } CVAL; extern void onig_null_warn(const char* s ARG_UNUSED) { } #ifdef DEFAULT_WARN_FUNCTION static OnigWarnFunc onig_warn = (OnigWarnFunc )DEFAULT_WARN_FUNCTION; #else static OnigWarnFunc onig_warn = onig_null_warn; #endif #ifdef DEFAULT_VERB_WARN_FUNCTION static OnigWarnFunc onig_verb_warn = (OnigWarnFunc )DEFAULT_VERB_WARN_FUNCTION; #else static OnigWarnFunc onig_verb_warn = onig_null_warn; #endif extern void onig_set_warn_func(OnigWarnFunc f) { onig_warn = f; } extern void onig_set_verb_warn_func(OnigWarnFunc f) { onig_verb_warn = f; } extern void onig_warning(const char* s) { if (onig_warn == onig_null_warn) return ; (*onig_warn)(s); } #define DEFAULT_MAX_CAPTURE_NUM 32767 static int MaxCaptureNum = DEFAULT_MAX_CAPTURE_NUM; extern int onig_set_capture_num_limit(int num) { if (num < 0) return -1; MaxCaptureNum = num; return 0; } static unsigned int ParseDepthLimit = DEFAULT_PARSE_DEPTH_LIMIT; extern unsigned int onig_get_parse_depth_limit(void) { return ParseDepthLimit; } extern int onig_set_parse_depth_limit(unsigned int depth) { if (depth == 0) ParseDepthLimit = DEFAULT_PARSE_DEPTH_LIMIT; else ParseDepthLimit = depth; return 0; } #ifdef ONIG_DEBUG_PARSE #define INC_PARSE_DEPTH(d) do {\ (d)++;\ if (env->max_parse_depth < (d)) env->max_parse_depth = d;\ if ((d) > ParseDepthLimit) \ return ONIGERR_PARSE_DEPTH_LIMIT_OVER;\ } while (0) #else #define INC_PARSE_DEPTH(d) do {\ (d)++;\ if ((d) > ParseDepthLimit) \ return ONIGERR_PARSE_DEPTH_LIMIT_OVER;\ } while (0) #endif #define DEC_PARSE_DEPTH(d) (d)-- static int bbuf_init(BBuf* buf, int size) { if (size <= 0) { size = 0; buf->p = NULL; } else { buf->p = (UChar* )xmalloc(size); if (IS_NULL(buf->p)) return(ONIGERR_MEMORY); } buf->alloc = size; buf->used = 0; return 0; } static void bbuf_free(BBuf* bbuf) { if (IS_NOT_NULL(bbuf)) { if (IS_NOT_NULL(bbuf->p)) xfree(bbuf->p); xfree(bbuf); } } static int bbuf_clone(BBuf** rto, BBuf* from) { int r; BBuf *to; *rto = to = (BBuf* )xmalloc(sizeof(BBuf)); CHECK_NULL_RETURN_MEMERR(to); r = BB_INIT(to, from->alloc); if (r != 0) { bbuf_free(to); *rto = 0; return r; } to->used = from->used; xmemcpy(to->p, from->p, from->used); return 0; } static int backref_rel_to_abs(int rel_no, ParseEnv* env) { if (rel_no > 0) { if (rel_no > ONIG_INT_MAX - env->num_mem) return ONIGERR_INVALID_BACKREF; return env->num_mem + rel_no; } else { return env->num_mem + 1 + rel_no; } } #define OPTION_ON(v,f) ((v) |= (f)) #define OPTION_OFF(v,f) ((v) &= ~(f)) #define OPTION_NEGATE(v,f,negative) (negative) ? ((v) &= ~(f)) : ((v) |= (f)) #define MBCODE_START_POS(enc) \ (OnigCodePoint )(ONIGENC_MBC_MINLEN(enc) > 1 ? 0 : 0x80) #define SET_ALL_MULTI_BYTE_RANGE(enc, pbuf) \ add_code_range_to_buf(pbuf, MBCODE_START_POS(enc), ~((OnigCodePoint )0)) #define ADD_ALL_MULTI_BYTE_RANGE(enc, mbuf) do {\ if (! ONIGENC_IS_SINGLEBYTE(enc)) {\ r = SET_ALL_MULTI_BYTE_RANGE(enc, &(mbuf));\ if (r != 0) return r;\ }\ } while (0) #define BITSET_IS_EMPTY(bs,empty) do {\ int i;\ empty = 1;\ for (i = 0; i < (int )BITSET_REAL_SIZE; i++) {\ if ((bs)[i] != 0) {\ empty = 0; break;\ }\ }\ } while (0) static void bitset_set_range(BitSetRef bs, int from, int to) { int i; for (i = from; i <= to && i < SINGLE_BYTE_SIZE; i++) { BITSET_SET_BIT(bs, i); } } static void bitset_invert(BitSetRef bs) { int i; for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { bs[i] = ~(bs[i]); } } static void bitset_invert_to(BitSetRef from, BitSetRef to) { int i; for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { to[i] = ~(from[i]); } } static void bitset_and(BitSetRef dest, BitSetRef bs) { int i; for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { dest[i] &= bs[i]; } } static void bitset_or(BitSetRef dest, BitSetRef bs) { int i; for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { dest[i] |= bs[i]; } } static void bitset_copy(BitSetRef dest, BitSetRef bs) { int i; for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { dest[i] = bs[i]; } } extern int onig_strncmp(const UChar* s1, const UChar* s2, int n) { int x; while (n-- > 0) { x = *s2++ - *s1++; if (x) return x; } return 0; } extern void onig_strcpy(UChar* dest, const UChar* src, const UChar* end) { int len = (int )(end - src); if (len > 0) { xmemcpy(dest, src, len); dest[len] = (UChar )0; } } /* scan pattern methods */ #define PEND_VALUE 0 #define PFETCH_READY UChar* pfetch_prev #define PEND (p < end ? 0 : 1) #define PUNFETCH p = pfetch_prev #define PPREV pfetch_prev #define PINC do { \ pfetch_prev = p; \ p += ONIGENC_MBC_ENC_LEN(enc, p); \ } while (0) #define PFETCH(c) do { \ c = ONIGENC_MBC_TO_CODE(enc, p, end); \ pfetch_prev = p; \ p += ONIGENC_MBC_ENC_LEN(enc, p); \ } while (0) #define PINC_S do { \ p += ONIGENC_MBC_ENC_LEN(enc, p); \ } while (0) #define PFETCH_S(c) do { \ c = ONIGENC_MBC_TO_CODE(enc, p, end); \ p += ONIGENC_MBC_ENC_LEN(enc, p); \ } while (0) #define PPEEK (p < end ? ONIGENC_MBC_TO_CODE(enc, p, end) : PEND_VALUE) #define PPEEK_IS(c) (PPEEK == (OnigCodePoint )c) static UChar* strcat_capa(UChar* dest, UChar* dest_end, const UChar* src, const UChar* src_end, int capa) { UChar* r; ptrdiff_t dest_delta = dest_end - dest; if (dest) r = (UChar* )xrealloc(dest, capa + 1); else r = (UChar* )xmalloc(capa + 1); CHECK_NULL_RETURN(r); onig_strcpy(r + dest_delta, src, src_end); return r; } /* dest on static area */ static UChar* strcat_capa_from_static(UChar* dest, UChar* dest_end, const UChar* src, const UChar* src_end, int capa) { UChar* r; r = (UChar* )xmalloc(capa + 1); CHECK_NULL_RETURN(r); onig_strcpy(r, dest, dest_end); onig_strcpy(r + (dest_end - dest), src, src_end); return r; } #ifdef USE_ST_LIBRARY typedef struct { UChar* s; UChar* end; } st_str_end_key; static int str_end_cmp(st_data_t ax, st_data_t ay) { st_str_end_key* x = (st_str_end_key* )ax; st_str_end_key* y = (st_str_end_key* )ay; UChar *p, *q; int c; if ((x->end - x->s) != (y->end - y->s)) return 1; p = x->s; q = y->s; while (p < x->end) { c = (int )*p - (int )*q; if (c != 0) return c; p++; q++; } return 0; } static int str_end_hash(st_data_t ax) { st_str_end_key* x = (st_str_end_key* )ax; UChar *p; unsigned val = 0; p = x->s; while (p < x->end) { val = val * 997 + (unsigned )*p++; } return (int) (val + (val >> 5)); } extern hash_table_type onig_st_init_strend_table_with_size(int size) { static struct st_hash_type hashType = { str_end_cmp, str_end_hash, }; return (hash_table_type )onig_st_init_table_with_size(&hashType, size); } extern int onig_st_lookup_strend(hash_table_type table, const UChar* str_key, const UChar* end_key, hash_data_type *value) { st_str_end_key key; key.s = (UChar* )str_key; key.end = (UChar* )end_key; return onig_st_lookup(table, (st_data_t )(&key), value); } extern int onig_st_insert_strend(hash_table_type table, const UChar* str_key, const UChar* end_key, hash_data_type value) { st_str_end_key* key; int result; key = (st_str_end_key* )xmalloc(sizeof(st_str_end_key)); CHECK_NULL_RETURN_MEMERR(key); key->s = (UChar* )str_key; key->end = (UChar* )end_key; result = onig_st_insert(table, (st_data_t )key, value); if (result) { xfree(key); } return result; } #ifdef USE_CALLOUT typedef struct { OnigEncoding enc; int type; /* callout type: single or not */ UChar* s; UChar* end; } st_callout_name_key; static int callout_name_table_cmp(st_data_t ax, st_data_t ay) { st_callout_name_key* x = (st_callout_name_key* )ax; st_callout_name_key* y = (st_callout_name_key* )ay; UChar *p, *q; int c; if (x->enc != y->enc) return 1; if (x->type != y->type) return 1; if ((x->end - x->s) != (y->end - y->s)) return 1; p = x->s; q = y->s; while (p < x->end) { c = (int )*p - (int )*q; if (c != 0) return c; p++; q++; } return 0; } static int callout_name_table_hash(st_data_t ax) { st_callout_name_key* x = (st_callout_name_key* )ax; UChar *p; unsigned int val = 0; p = x->s; while (p < x->end) { val = val * 997 + (unsigned int )*p++; } /* use intptr_t for escape warning in Windows */ return (int )(val + (val >> 5) + ((intptr_t )x->enc & 0xffff) + x->type); } extern hash_table_type onig_st_init_callout_name_table_with_size(int size) { static struct st_hash_type hashType = { callout_name_table_cmp, callout_name_table_hash, }; return (hash_table_type )onig_st_init_table_with_size(&hashType, size); } extern int onig_st_lookup_callout_name_table(hash_table_type table, OnigEncoding enc, int type, const UChar* str_key, const UChar* end_key, hash_data_type *value) { st_callout_name_key key; key.enc = enc; key.type = type; key.s = (UChar* )str_key; key.end = (UChar* )end_key; return onig_st_lookup(table, (st_data_t )(&key), value); } static int st_insert_callout_name_table(hash_table_type table, OnigEncoding enc, int type, UChar* str_key, UChar* end_key, hash_data_type value) { st_callout_name_key* key; int result; key = (st_callout_name_key* )xmalloc(sizeof(st_callout_name_key)); CHECK_NULL_RETURN_MEMERR(key); /* key->s: don't duplicate, because str_key is duped in callout_name_entry() */ key->enc = enc; key->type = type; key->s = str_key; key->end = end_key; result = onig_st_insert(table, (st_data_t )key, value); if (result) { xfree(key); } return result; } #endif #endif /* USE_ST_LIBRARY */ #define INIT_NAME_BACKREFS_ALLOC_NUM 8 typedef struct { UChar* name; int name_len; /* byte length */ int back_num; /* number of backrefs */ int back_alloc; int back_ref1; int* back_refs; } NameEntry; #ifdef USE_ST_LIBRARY #define INIT_NAMES_ALLOC_NUM 5 typedef st_table NameTable; typedef st_data_t HashDataType; /* 1.6 st.h doesn't define st_data_t type */ #define NAMEBUF_SIZE 24 #define NAMEBUF_SIZE_1 25 #ifdef ONIG_DEBUG static int i_print_name_entry(st_data_t akey, st_data_t ae, st_data_t arg) { int i; FILE* fp; NameEntry* e; e = (NameEntry* )ae; fp = (FILE* )arg; fprintf(fp, "%s: ", e->name); if (e->back_num == 0) fputs("-", fp); else if (e->back_num == 1) fprintf(fp, "%d", e->back_ref1); else { for (i = 0; i < e->back_num; i++) { if (i > 0) fprintf(fp, ", "); fprintf(fp, "%d", e->back_refs[i]); } } fputs("\n", fp); return ST_CONTINUE; } extern int onig_print_names(FILE* fp, regex_t* reg) { NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) { fprintf(fp, "name table\n"); onig_st_foreach(t, i_print_name_entry, (HashDataType )fp); fputs("\n", fp); } return 0; } #endif /* ONIG_DEBUG */ static int i_free_name_entry(st_data_t akey, st_data_t ae, st_data_t arg ARG_UNUSED) { UChar* key; NameEntry* e; key = (UChar* )akey; e = (NameEntry* )ae; xfree(e->name); if (IS_NOT_NULL(e->back_refs)) xfree(e->back_refs); xfree(key); xfree(e); return ST_DELETE; } static int names_clear(regex_t* reg) { NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) { onig_st_foreach(t, i_free_name_entry, 0); } return 0; } extern int onig_names_free(regex_t* reg) { int r; NameTable* t; r = names_clear(reg); if (r != 0) return r; t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) onig_st_free_table(t); reg->name_table = (void* )NULL; return 0; } static NameEntry* name_find(regex_t* reg, const UChar* name, const UChar* name_end) { NameEntry* e; NameTable* t = (NameTable* )reg->name_table; e = (NameEntry* )NULL; if (IS_NOT_NULL(t)) { onig_st_lookup_strend(t, name, name_end, (HashDataType* )((void* )(&e))); } return e; } typedef struct { int (*func)(const UChar*, const UChar*,int,int*,regex_t*,void*); regex_t* reg; void* arg; int ret; OnigEncoding enc; } INamesArg; static int i_names(st_data_t key ARG_UNUSED, st_data_t ae, st_data_t aarg) { NameEntry* e; INamesArg* arg; e = (NameEntry* )ae; arg = (INamesArg* )aarg; int r = (*(arg->func))(e->name, e->name + e->name_len, e->back_num, (e->back_num > 1 ? e->back_refs : &(e->back_ref1)), arg->reg, arg->arg); if (r != 0) { arg->ret = r; return ST_STOP; } return ST_CONTINUE; } extern int onig_foreach_name(regex_t* reg, int (*func)(const UChar*, const UChar*,int,int*,regex_t*,void*), void* arg) { INamesArg narg; NameTable* t = (NameTable* )reg->name_table; narg.ret = 0; if (IS_NOT_NULL(t)) { narg.func = func; narg.reg = reg; narg.arg = arg; narg.enc = reg->enc; /* should be pattern encoding. */ onig_st_foreach(t, i_names, (HashDataType )&narg); } return narg.ret; } static int i_renumber_name(st_data_t key ARG_UNUSED, st_data_t ae, st_data_t amap) { int i; NameEntry* e; GroupNumMap* map; e = (NameEntry* )ae; map = (GroupNumMap* )amap; if (e->back_num > 1) { for (i = 0; i < e->back_num; i++) { e->back_refs[i] = map[e->back_refs[i]].new_val; } } else if (e->back_num == 1) { e->back_ref1 = map[e->back_ref1].new_val; } return ST_CONTINUE; } extern int onig_renumber_name_table(regex_t* reg, GroupNumMap* map) { NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) { onig_st_foreach(t, i_renumber_name, (HashDataType )map); } return 0; } extern int onig_number_of_names(regex_t* reg) { NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) return t->num_entries; else return 0; } #else /* USE_ST_LIBRARY */ #define INIT_NAMES_ALLOC_NUM 8 typedef struct { NameEntry* e; int num; int alloc; } NameTable; #ifdef ONIG_DEBUG extern int onig_print_names(FILE* fp, regex_t* reg) { int i, j; NameEntry* e; NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t) && t->num > 0) { fprintf(fp, "name table\n"); for (i = 0; i < t->num; i++) { e = &(t->e[i]); fprintf(fp, "%s: ", e->name); if (e->back_num == 0) { fputs("-", fp); } else if (e->back_num == 1) { fprintf(fp, "%d", e->back_ref1); } else { for (j = 0; j < e->back_num; j++) { if (j > 0) fprintf(fp, ", "); fprintf(fp, "%d", e->back_refs[j]); } } fputs("\n", fp); } fputs("\n", fp); } return 0; } #endif static int names_clear(regex_t* reg) { int i; NameEntry* e; NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) { for (i = 0; i < t->num; i++) { e = &(t->e[i]); if (IS_NOT_NULL(e->name)) { xfree(e->name); e->name = NULL; e->name_len = 0; e->back_num = 0; e->back_alloc = 0; if (IS_NOT_NULL(e->back_refs)) xfree(e->back_refs); e->back_refs = (int* )NULL; } } if (IS_NOT_NULL(t->e)) { xfree(t->e); t->e = NULL; } t->num = 0; } return 0; } extern int onig_names_free(regex_t* reg) { int r; NameTable* t; r = names_clear(reg); if (r != 0) return r; t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) xfree(t); reg->name_table = NULL; return 0; } static NameEntry* name_find(regex_t* reg, UChar* name, UChar* name_end) { int i, len; NameEntry* e; NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) { len = name_end - name; for (i = 0; i < t->num; i++) { e = &(t->e[i]); if (len == e->name_len && onig_strncmp(name, e->name, len) == 0) return e; } } return (NameEntry* )NULL; } extern int onig_foreach_name(regex_t* reg, int (*func)(const UChar*, const UChar*,int,int*,regex_t*,void*), void* arg) { int i, r; NameEntry* e; NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) { for (i = 0; i < t->num; i++) { e = &(t->e[i]); r = (*func)(e->name, e->name + e->name_len, e->back_num, (e->back_num > 1 ? e->back_refs : &(e->back_ref1)), reg, arg); if (r != 0) return r; } } return 0; } extern int onig_number_of_names(regex_t* reg) { NameTable* t = (NameTable* )reg->name_table; if (IS_NOT_NULL(t)) return t->num; else return 0; } #endif /* else USE_ST_LIBRARY */ static int name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ParseEnv* env) { int r; int alloc; NameEntry* e; NameTable* t = (NameTable* )reg->name_table; if (name_end - name <= 0) return ONIGERR_EMPTY_GROUP_NAME; e = name_find(reg, name, name_end); if (IS_NULL(e)) { #ifdef USE_ST_LIBRARY if (IS_NULL(t)) { t = onig_st_init_strend_table_with_size(INIT_NAMES_ALLOC_NUM); CHECK_NULL_RETURN_MEMERR(t); reg->name_table = (void* )t; } e = (NameEntry* )xmalloc(sizeof(NameEntry)); CHECK_NULL_RETURN_MEMERR(e); e->name = onigenc_strdup(reg->enc, name, name_end); if (IS_NULL(e->name)) { xfree(e); return ONIGERR_MEMORY; } r = onig_st_insert_strend(t, e->name, (e->name + (name_end - name)), (HashDataType )e); if (r < 0) return r; e->name_len = (int )(name_end - name); e->back_num = 0; e->back_alloc = 0; e->back_refs = (int* )NULL; #else if (IS_NULL(t)) { alloc = INIT_NAMES_ALLOC_NUM; t = (NameTable* )xmalloc(sizeof(NameTable)); CHECK_NULL_RETURN_MEMERR(t); t->e = NULL; t->alloc = 0; t->num = 0; t->e = (NameEntry* )xmalloc(sizeof(NameEntry) * alloc); if (IS_NULL(t->e)) { xfree(t); return ONIGERR_MEMORY; } t->alloc = alloc; reg->name_table = t; goto clear; } else if (t->num == t->alloc) { int i; alloc = t->alloc * 2; t->e = (NameEntry* )xrealloc(t->e, sizeof(NameEntry) * alloc); CHECK_NULL_RETURN_MEMERR(t->e); t->alloc = alloc; clear: for (i = t->num; i < t->alloc; i++) { t->e[i].name = NULL; t->e[i].name_len = 0; t->e[i].back_num = 0; t->e[i].back_alloc = 0; t->e[i].back_refs = (int* )NULL; } } e = &(t->e[t->num]); t->num++; e->name = onigenc_strdup(reg->enc, name, name_end); if (IS_NULL(e->name)) return ONIGERR_MEMORY; e->name_len = name_end - name; #endif } if (e->back_num >= 1 && ! IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME)) { onig_scan_env_set_error_string(env, ONIGERR_MULTIPLEX_DEFINED_NAME, name, name_end); return ONIGERR_MULTIPLEX_DEFINED_NAME; } e->back_num++; if (e->back_num == 1) { e->back_ref1 = backref; } else { if (e->back_num == 2) { alloc = INIT_NAME_BACKREFS_ALLOC_NUM; e->back_refs = (int* )xmalloc(sizeof(int) * alloc); CHECK_NULL_RETURN_MEMERR(e->back_refs); e->back_alloc = alloc; e->back_refs[0] = e->back_ref1; e->back_refs[1] = backref; } else { if (e->back_num > e->back_alloc) { alloc = e->back_alloc * 2; e->back_refs = (int* )xrealloc(e->back_refs, sizeof(int) * alloc); CHECK_NULL_RETURN_MEMERR(e->back_refs); e->back_alloc = alloc; } e->back_refs[e->back_num - 1] = backref; } } return 0; } extern int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end, int** nums) { NameEntry* e = name_find(reg, name, name_end); if (IS_NULL(e)) return ONIGERR_UNDEFINED_NAME_REFERENCE; switch (e->back_num) { case 0: break; case 1: *nums = &(e->back_ref1); break; default: *nums = e->back_refs; break; } return e->back_num; } static int name_to_group_numbers(ParseEnv* env, const UChar* name, const UChar* name_end, int** nums) { regex_t* reg; NameEntry* e; reg = env->reg; e = name_find(reg, name, name_end); if (IS_NULL(e)) { onig_scan_env_set_error_string(env, ONIGERR_UNDEFINED_NAME_REFERENCE, (UChar* )name, (UChar* )name_end); return ONIGERR_UNDEFINED_NAME_REFERENCE; } switch (e->back_num) { case 0: break; case 1: *nums = &(e->back_ref1); break; default: *nums = e->back_refs; break; } return e->back_num; } extern int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end, OnigRegion *region) { int i, n, *nums; n = onig_name_to_group_numbers(reg, name, name_end, &nums); if (n < 0) return n; else if (n == 0) return ONIGERR_PARSER_BUG; else if (n == 1) return nums[0]; else { if (IS_NOT_NULL(region)) { for (i = n - 1; i >= 0; i--) { if (region->beg[nums[i]] != ONIG_REGION_NOTPOS) return nums[i]; } } return nums[n - 1]; } } extern int onig_noname_group_capture_is_active(regex_t* reg) { if (OPTON_DONT_CAPTURE_GROUP(reg->options)) return 0; if (onig_number_of_names(reg) > 0 && IS_SYNTAX_BV(reg->syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) && ! OPTON_CAPTURE_GROUP(reg->options)) { return 0; } return 1; } #ifdef USE_CALLOUT typedef struct { OnigCalloutType type; int in; OnigCalloutFunc start_func; OnigCalloutFunc end_func; int arg_num; int opt_arg_num; unsigned int arg_types[ONIG_CALLOUT_MAX_ARGS_NUM]; OnigValue opt_defaults[ONIG_CALLOUT_MAX_ARGS_NUM]; UChar* name; /* reference to GlobalCalloutNameTable entry: e->name */ } CalloutNameListEntry; typedef struct { int n; int alloc; CalloutNameListEntry* v; } CalloutNameListType; static CalloutNameListType* GlobalCalloutNameList; static int make_callout_func_list(CalloutNameListType** rs, int init_size) { CalloutNameListType* s; CalloutNameListEntry* v; *rs = 0; s = xmalloc(sizeof(*s)); if (IS_NULL(s)) return ONIGERR_MEMORY; v = (CalloutNameListEntry* )xmalloc(sizeof(CalloutNameListEntry) * init_size); if (IS_NULL(v)) { xfree(s); return ONIGERR_MEMORY; } s->n = 0; s->alloc = init_size; s->v = v; *rs = s; return ONIG_NORMAL; } static void free_callout_func_list(CalloutNameListType* s) { if (IS_NOT_NULL(s)) { if (IS_NOT_NULL(s->v)) { int i, j; for (i = 0; i < s->n; i++) { CalloutNameListEntry* e = s->v + i; for (j = e->arg_num - e->opt_arg_num; j < e->arg_num; j++) { if (e->arg_types[j] == ONIG_TYPE_STRING) { UChar* p = e->opt_defaults[j].s.start; if (IS_NOT_NULL(p)) xfree(p); } } } xfree(s->v); } xfree(s); } } static int callout_func_list_add(CalloutNameListType* s, int* rid) { if (s->n >= s->alloc) { int new_size = s->alloc * 2; CalloutNameListEntry* nv = (CalloutNameListEntry* ) xrealloc(s->v, sizeof(CalloutNameListEntry) * new_size); if (IS_NULL(nv)) return ONIGERR_MEMORY; s->alloc = new_size; s->v = nv; } *rid = s->n; xmemset(&(s->v[s->n]), 0, sizeof(*(s->v))); s->n++; return ONIG_NORMAL; } typedef struct { UChar* name; int name_len; /* byte length */ int id; } CalloutNameEntry; #ifdef USE_ST_LIBRARY typedef st_table CalloutNameTable; #else typedef struct { CalloutNameEntry* e; int num; int alloc; } CalloutNameTable; #endif static CalloutNameTable* GlobalCalloutNameTable; static int CalloutNameIDCounter; #ifdef USE_ST_LIBRARY static int i_free_callout_name_entry(st_data_t akey, st_data_t ae, st_data_t arg ARG_UNUSED) { st_callout_name_key* key; CalloutNameEntry* e; key = (st_callout_name_key* )akey; e = (CalloutNameEntry* )ae; if (IS_NOT_NULL(e)) { xfree(e->name); } /*xfree(key->s); */ /* is same as e->name */ xfree(key); xfree(e); return ST_DELETE; } static int callout_name_table_clear(CalloutNameTable* t) { if (IS_NOT_NULL(t)) { onig_st_foreach(t, i_free_callout_name_entry, 0); } return 0; } static int global_callout_name_table_free(void) { if (IS_NOT_NULL(GlobalCalloutNameTable)) { int r = callout_name_table_clear(GlobalCalloutNameTable); if (r != 0) return r; onig_st_free_table(GlobalCalloutNameTable); GlobalCalloutNameTable = 0; CalloutNameIDCounter = 0; } return 0; } static CalloutNameEntry* callout_name_find(OnigEncoding enc, int is_not_single, const UChar* name, const UChar* name_end) { int r; CalloutNameEntry* e; CalloutNameTable* t = GlobalCalloutNameTable; e = (CalloutNameEntry* )NULL; if (IS_NOT_NULL(t)) { r = onig_st_lookup_callout_name_table(t, enc, is_not_single, name, name_end, (HashDataType* )((void* )(&e))); if (r == 0) { /* not found */ if (enc != ONIG_ENCODING_ASCII && ONIGENC_IS_ASCII_COMPATIBLE_ENCODING(enc)) { enc = ONIG_ENCODING_ASCII; onig_st_lookup_callout_name_table(t, enc, is_not_single, name, name_end, (HashDataType* )((void* )(&e))); } } } return e; } #else static int callout_name_table_clear(CalloutNameTable* t) { int i; CalloutNameEntry* e; if (IS_NOT_NULL(t)) { for (i = 0; i < t->num; i++) { e = &(t->e[i]); if (IS_NOT_NULL(e->name)) { xfree(e->name); e->name = NULL; e->name_len = 0; e->id = 0; e->func = 0; } } if (IS_NOT_NULL(t->e)) { xfree(t->e); t->e = NULL; } t->num = 0; } return 0; } static int global_callout_name_table_free(void) { if (IS_NOT_NULL(GlobalCalloutNameTable)) { int r = callout_name_table_clear(GlobalCalloutNameTable); if (r != 0) return r; xfree(GlobalCalloutNameTable); GlobalCalloutNameTable = 0; CalloutNameIDCounter = 0; } return 0; } static CalloutNameEntry* callout_name_find(UChar* name, UChar* name_end) { int i, len; CalloutNameEntry* e; CalloutNameTable* t = Calloutnames; if (IS_NOT_NULL(t)) { len = name_end - name; for (i = 0; i < t->num; i++) { e = &(t->e[i]); if (len == e->name_len && onig_strncmp(name, e->name, len) == 0) return e; } } return (CalloutNameEntry* )NULL; } #endif /* name string must be single byte char string. */ static int callout_name_entry(CalloutNameEntry** rentry, OnigEncoding enc, int is_not_single, UChar* name, UChar* name_end) { int r; CalloutNameEntry* e; CalloutNameTable* t = GlobalCalloutNameTable; *rentry = 0; if (name_end - name <= 0) return ONIGERR_INVALID_CALLOUT_NAME; e = callout_name_find(enc, is_not_single, name, name_end); if (IS_NULL(e)) { #ifdef USE_ST_LIBRARY if (IS_NULL(t)) { t = onig_st_init_callout_name_table_with_size(INIT_NAMES_ALLOC_NUM); CHECK_NULL_RETURN_MEMERR(t); GlobalCalloutNameTable = t; } e = (CalloutNameEntry* )xmalloc(sizeof(CalloutNameEntry)); CHECK_NULL_RETURN_MEMERR(e); e->name = onigenc_strdup(enc, name, name_end); if (IS_NULL(e->name)) { xfree(e); return ONIGERR_MEMORY; } r = st_insert_callout_name_table(t, enc, is_not_single, e->name, (e->name + (name_end - name)), (HashDataType )e); if (r < 0) return r; #else int alloc; if (IS_NULL(t)) { alloc = INIT_NAMES_ALLOC_NUM; t = (CalloutNameTable* )xmalloc(sizeof(CalloutNameTable)); CHECK_NULL_RETURN_MEMERR(t); t->e = NULL; t->alloc = 0; t->num = 0; t->e = (CalloutNameEntry* )xmalloc(sizeof(CalloutNameEntry) * alloc); if (IS_NULL(t->e)) { xfree(t); return ONIGERR_MEMORY; } t->alloc = alloc; GlobalCalloutNameTable = t; goto clear; } else if (t->num == t->alloc) { int i; alloc = t->alloc * 2; t->e = (CalloutNameEntry* )xrealloc(t->e, sizeof(CalloutNameEntry) * alloc); CHECK_NULL_RETURN_MEMERR(t->e); t->alloc = alloc; clear: for (i = t->num; i < t->alloc; i++) { t->e[i].name = NULL; t->e[i].name_len = 0; t->e[i].id = 0; } } e = &(t->e[t->num]); t->num++; e->name = onigenc_strdup(enc, name, name_end); if (IS_NULL(e->name)) return ONIGERR_MEMORY; #endif CalloutNameIDCounter++; e->id = CalloutNameIDCounter; e->name_len = (int )(name_end - name); } *rentry = e; return e->id; } static int is_allowed_callout_name(OnigEncoding enc, UChar* name, UChar* name_end) { UChar* p; OnigCodePoint c; if (name >= name_end) return 0; p = name; while (p < name_end) { c = ONIGENC_MBC_TO_CODE(enc, p, name_end); if (! IS_ALLOWED_CODE_IN_CALLOUT_NAME(c)) return 0; if (p == name) { if (c >= '0' && c <= '9') return 0; } p += ONIGENC_MBC_ENC_LEN(enc, p); } return 1; } static int is_allowed_callout_tag_name(OnigEncoding enc, UChar* name, UChar* name_end) { UChar* p; OnigCodePoint c; if (name >= name_end) return 0; p = name; while (p < name_end) { c = ONIGENC_MBC_TO_CODE(enc, p, name_end); if (! IS_ALLOWED_CODE_IN_CALLOUT_TAG_NAME(c)) return 0; if (p == name) { if (c >= '0' && c <= '9') return 0; } p += ONIGENC_MBC_ENC_LEN(enc, p); } return 1; } extern int onig_set_callout_of_name(OnigEncoding enc, OnigCalloutType callout_type, UChar* name, UChar* name_end, int in, OnigCalloutFunc start_func, OnigCalloutFunc end_func, int arg_num, unsigned int arg_types[], int opt_arg_num, OnigValue opt_defaults[]) { int r; int i; int j; int id; int is_not_single; CalloutNameEntry* e; CalloutNameListEntry* fe; if (callout_type != ONIG_CALLOUT_TYPE_SINGLE) return ONIGERR_INVALID_ARGUMENT; if (arg_num < 0 || arg_num > ONIG_CALLOUT_MAX_ARGS_NUM) return ONIGERR_INVALID_CALLOUT_ARG; if (opt_arg_num < 0 || opt_arg_num > arg_num) return ONIGERR_INVALID_CALLOUT_ARG; if (start_func == 0 && end_func == 0) return ONIGERR_INVALID_CALLOUT_ARG; if ((in & ONIG_CALLOUT_IN_PROGRESS) == 0 && (in & ONIG_CALLOUT_IN_RETRACTION) == 0) return ONIGERR_INVALID_CALLOUT_ARG; for (i = 0; i < arg_num; i++) { unsigned int t = arg_types[i]; if (t == ONIG_TYPE_VOID) return ONIGERR_INVALID_CALLOUT_ARG; else { if (i >= arg_num - opt_arg_num) { if (t != ONIG_TYPE_LONG && t != ONIG_TYPE_CHAR && t != ONIG_TYPE_STRING && t != ONIG_TYPE_TAG) return ONIGERR_INVALID_CALLOUT_ARG; } else { if (t != ONIG_TYPE_LONG) { t = t & ~ONIG_TYPE_LONG; if (t != ONIG_TYPE_CHAR && t != ONIG_TYPE_STRING && t != ONIG_TYPE_TAG) return ONIGERR_INVALID_CALLOUT_ARG; } } } } if (! is_allowed_callout_name(enc, name, name_end)) { return ONIGERR_INVALID_CALLOUT_NAME; } is_not_single = (callout_type != ONIG_CALLOUT_TYPE_SINGLE); id = callout_name_entry(&e, enc, is_not_single, name, name_end); if (id < 0) return id; r = ONIG_NORMAL; if (IS_NULL(GlobalCalloutNameList)) { r = make_callout_func_list(&GlobalCalloutNameList, 10); if (r != ONIG_NORMAL) return r; } while (id >= GlobalCalloutNameList->n) { int rid; r = callout_func_list_add(GlobalCalloutNameList, &rid); if (r != ONIG_NORMAL) return r; } fe = GlobalCalloutNameList->v + id; fe->type = callout_type; fe->in = in; fe->start_func = start_func; fe->end_func = end_func; fe->arg_num = arg_num; fe->opt_arg_num = opt_arg_num; fe->name = e->name; for (i = 0; i < arg_num; i++) { fe->arg_types[i] = arg_types[i]; } for (i = arg_num - opt_arg_num, j = 0; i < arg_num; i++, j++) { if (IS_NULL(opt_defaults)) return ONIGERR_INVALID_ARGUMENT; if (fe->arg_types[i] == ONIG_TYPE_STRING) { OnigValue* val; UChar* ds; val = opt_defaults + j; ds = onigenc_strdup(enc, val->s.start, val->s.end); CHECK_NULL_RETURN_MEMERR(ds); fe->opt_defaults[i].s.start = ds; fe->opt_defaults[i].s.end = ds + (val->s.end - val->s.start); } else { fe->opt_defaults[i] = opt_defaults[j]; } } r = id; return r; } static int get_callout_name_id_by_name(OnigEncoding enc, int is_not_single, UChar* name, UChar* name_end, int* rid) { int r; CalloutNameEntry* e; if (! is_allowed_callout_name(enc, name, name_end)) { return ONIGERR_INVALID_CALLOUT_NAME; } e = callout_name_find(enc, is_not_single, name, name_end); if (IS_NULL(e)) { return ONIGERR_UNDEFINED_CALLOUT_NAME; } r = ONIG_NORMAL; *rid = e->id; return r; } extern OnigCalloutFunc onig_get_callout_start_func(regex_t* reg, int callout_num) { /* If used for callouts of contents, return 0. */ CalloutListEntry* e; e = onig_reg_callout_list_at(reg, callout_num); CHECK_NULL_RETURN(e); return e->start_func; } extern const UChar* onig_get_callout_tag_start(regex_t* reg, int callout_num) { CalloutListEntry* e = onig_reg_callout_list_at(reg, callout_num); CHECK_NULL_RETURN(e); return e->tag_start; } extern const UChar* onig_get_callout_tag_end(regex_t* reg, int callout_num) { CalloutListEntry* e = onig_reg_callout_list_at(reg, callout_num); CHECK_NULL_RETURN(e); return e->tag_end; } extern OnigCalloutType onig_get_callout_type_by_name_id(int name_id) { if (name_id < 0 || name_id >= GlobalCalloutNameList->n) return 0; return GlobalCalloutNameList->v[name_id].type; } extern OnigCalloutFunc onig_get_callout_start_func_by_name_id(int name_id) { if (name_id < 0 || name_id >= GlobalCalloutNameList->n) return 0; return GlobalCalloutNameList->v[name_id].start_func; } extern OnigCalloutFunc onig_get_callout_end_func_by_name_id(int name_id) { if (name_id < 0 || name_id >= GlobalCalloutNameList->n) return 0; return GlobalCalloutNameList->v[name_id].end_func; } extern int onig_get_callout_in_by_name_id(int name_id) { if (name_id < 0 || name_id >= GlobalCalloutNameList->n) return 0; return GlobalCalloutNameList->v[name_id].in; } static int get_callout_arg_num_by_name_id(int name_id) { return GlobalCalloutNameList->v[name_id].arg_num; } static int get_callout_opt_arg_num_by_name_id(int name_id) { return GlobalCalloutNameList->v[name_id].opt_arg_num; } static unsigned int get_callout_arg_type_by_name_id(int name_id, int index) { return GlobalCalloutNameList->v[name_id].arg_types[index]; } static OnigValue get_callout_opt_default_by_name_id(int name_id, int index) { return GlobalCalloutNameList->v[name_id].opt_defaults[index]; } extern UChar* onig_get_callout_name_by_name_id(int name_id) { if (name_id < 0 || name_id >= GlobalCalloutNameList->n) return 0; return GlobalCalloutNameList->v[name_id].name; } extern int onig_global_callout_names_free(void) { free_callout_func_list(GlobalCalloutNameList); GlobalCalloutNameList = 0; global_callout_name_table_free(); return ONIG_NORMAL; } typedef st_table CalloutTagTable; typedef intptr_t CalloutTagVal; #define CALLOUT_TAG_LIST_FLAG_TAG_EXIST (1<<0) static int i_callout_callout_list_set(st_data_t key ARG_UNUSED, st_data_t ae, st_data_t arg) { int num; CalloutTagVal e; RegexExt* ext; e = (CalloutTagVal )ae; ext = (RegexExt* )arg; num = (int )e - 1; ext->callout_list[num].flag |= CALLOUT_TAG_LIST_FLAG_TAG_EXIST; return ST_CONTINUE; } static int setup_ext_callout_list_values(regex_t* reg) { int i, j; RegexExt* ext; ext = reg->extp; if (IS_NOT_NULL(ext->tag_table)) { onig_st_foreach((CalloutTagTable *)ext->tag_table, i_callout_callout_list_set, (st_data_t )ext); } for (i = 0; i < ext->callout_num; i++) { CalloutListEntry* e = ext->callout_list + i; if (e->of == ONIG_CALLOUT_OF_NAME) { for (j = 0; j < e->u.arg.num; j++) { if (e->u.arg.types[j] == ONIG_TYPE_TAG) { UChar* start; UChar* end; int num; start = e->u.arg.vals[j].s.start; end = e->u.arg.vals[j].s.end; num = onig_get_callout_num_by_tag(reg, start, end); if (num < 0) return num; e->u.arg.vals[j].tag = num; } } } } return ONIG_NORMAL; } extern int onig_callout_tag_is_exist_at_callout_num(regex_t* reg, int callout_num) { RegexExt* ext = reg->extp; if (IS_NULL(ext) || IS_NULL(ext->callout_list)) return 0; if (callout_num > ext->callout_num) return 0; return (ext->callout_list[callout_num].flag & CALLOUT_TAG_LIST_FLAG_TAG_EXIST) != 0; } static int i_free_callout_tag_entry(st_data_t akey, st_data_t e ARG_UNUSED, st_data_t arg ARG_UNUSED) { UChar* key; key = (UChar* )akey; xfree(key); return ST_DELETE; } static int callout_tag_table_clear(CalloutTagTable* t) { if (IS_NOT_NULL(t)) { onig_st_foreach(t, i_free_callout_tag_entry, 0); } return 0; } extern int onig_callout_tag_table_free(void* table) { CalloutTagTable* t = (CalloutTagTable* )table; if (IS_NOT_NULL(t)) { int r = callout_tag_table_clear(t); if (r != 0) return r; onig_st_free_table(t); } return 0; } extern int onig_get_callout_num_by_tag(regex_t* reg, const UChar* tag, const UChar* tag_end) { int r; RegexExt* ext; CalloutTagVal e; ext = reg->extp; if (IS_NULL(ext) || IS_NULL(ext->tag_table)) return ONIGERR_INVALID_CALLOUT_TAG_NAME; r = onig_st_lookup_strend(ext->tag_table, tag, tag_end, (HashDataType* )((void* )(&e))); if (r == 0) return ONIGERR_INVALID_CALLOUT_TAG_NAME; return (int )e; } static CalloutTagVal callout_tag_find(CalloutTagTable* t, const UChar* name, const UChar* name_end) { CalloutTagVal e; e = -1; if (IS_NOT_NULL(t)) { onig_st_lookup_strend(t, name, name_end, (HashDataType* )((void* )(&e))); } return e; } static int callout_tag_table_new(CalloutTagTable** rt) { CalloutTagTable* t; *rt = 0; t = onig_st_init_strend_table_with_size(INIT_TAG_NAMES_ALLOC_NUM); CHECK_NULL_RETURN_MEMERR(t); *rt = t; return ONIG_NORMAL; } static int callout_tag_entry_raw(ParseEnv* env, CalloutTagTable* t, UChar* name, UChar* name_end, CalloutTagVal entry_val) { int r; CalloutTagVal val; if (name_end - name <= 0) return ONIGERR_INVALID_CALLOUT_TAG_NAME; val = callout_tag_find(t, name, name_end); if (val >= 0) { onig_scan_env_set_error_string(env, ONIGERR_MULTIPLEX_DEFINED_NAME, name, name_end); return ONIGERR_MULTIPLEX_DEFINED_NAME; } r = onig_st_insert_strend(t, name, name_end, (HashDataType )entry_val); if (r < 0) return r; return ONIG_NORMAL; } static int ext_ensure_tag_table(regex_t* reg) { int r; RegexExt* ext; CalloutTagTable* t; ext = onig_get_regex_ext(reg); CHECK_NULL_RETURN_MEMERR(ext); if (IS_NULL(ext->tag_table)) { r = callout_tag_table_new(&t); if (r != ONIG_NORMAL) return r; ext->tag_table = t; } return ONIG_NORMAL; } static int callout_tag_entry(ParseEnv* env, regex_t* reg, UChar* name, UChar* name_end, CalloutTagVal entry_val) { int r; RegexExt* ext; CalloutListEntry* e; r = ext_ensure_tag_table(reg); if (r != ONIG_NORMAL) return r; ext = onig_get_regex_ext(reg); CHECK_NULL_RETURN_MEMERR(ext); r = callout_tag_entry_raw(env, ext->tag_table, name, name_end, entry_val); e = onig_reg_callout_list_at(reg, (int )entry_val); CHECK_NULL_RETURN_MEMERR(e); e->tag_start = name; e->tag_end = name_end; return r; } #endif /* USE_CALLOUT */ #define INIT_PARSEENV_MEMENV_ALLOC_SIZE 16 static void scan_env_clear(ParseEnv* env) { MEM_STATUS_CLEAR(env->cap_history); MEM_STATUS_CLEAR(env->backtrack_mem); MEM_STATUS_CLEAR(env->backrefed_mem); env->error = (UChar* )NULL; env->error_end = (UChar* )NULL; env->num_call = 0; #ifdef USE_CALL env->unset_addr_list = NULL; #endif env->num_mem = 0; env->num_named = 0; env->mem_alloc = 0; env->mem_env_dynamic = (MemEnv* )NULL; xmemset(env->mem_env_static, 0, sizeof(env->mem_env_static)); env->parse_depth = 0; #ifdef ONIG_DEBUG_PARSE env->max_parse_depth = 0; #endif env->backref_num = 0; env->keep_num = 0; env->id_num = 0; env->save_alloc_num = 0; env->saves = 0; env->flags = 0; } static int scan_env_add_mem_entry(ParseEnv* env) { int i, need, alloc; MemEnv* p; need = env->num_mem + 1; if (need > MaxCaptureNum && MaxCaptureNum != 0) return ONIGERR_TOO_MANY_CAPTURES; if (need >= PARSEENV_MEMENV_SIZE) { if (env->mem_alloc <= need) { if (IS_NULL(env->mem_env_dynamic)) { alloc = INIT_PARSEENV_MEMENV_ALLOC_SIZE; p = (MemEnv* )xmalloc(sizeof(MemEnv) * alloc); CHECK_NULL_RETURN_MEMERR(p); xmemcpy(p, env->mem_env_static, sizeof(env->mem_env_static)); } else { alloc = env->mem_alloc * 2; p = (MemEnv* )xrealloc(env->mem_env_dynamic, sizeof(MemEnv) * alloc); CHECK_NULL_RETURN_MEMERR(p); } for (i = env->num_mem + 1; i < alloc; i++) { p[i].mem_node = NULL_NODE; p[i].empty_repeat_node = NULL_NODE; } env->mem_env_dynamic = p; env->mem_alloc = alloc; } } env->num_mem++; return env->num_mem; } static int scan_env_set_mem_node(ParseEnv* env, int num, Node* node) { if (env->num_mem >= num) PARSEENV_MEMENV(env)[num].mem_node = node; else return ONIGERR_PARSER_BUG; return 0; } static void node_free_body(Node* node) { if (IS_NULL(node)) return ; switch (ND_TYPE(node)) { case ND_STRING: if (STR_(node)->capacity != 0 && IS_NOT_NULL(STR_(node)->s) && STR_(node)->s != STR_(node)->buf) { xfree(STR_(node)->s); } break; case ND_LIST: case ND_ALT: onig_node_free(ND_CAR(node)); node = ND_CDR(node); while (IS_NOT_NULL(node)) { Node* next = ND_CDR(node); onig_node_free(ND_CAR(node)); xfree(node); node = next; } break; case ND_CCLASS: { CClassNode* cc = CCLASS_(node); if (cc->mbuf) bbuf_free(cc->mbuf); } break; case ND_BACKREF: if (IS_NOT_NULL(BACKREF_(node)->back_dynamic)) xfree(BACKREF_(node)->back_dynamic); break; case ND_BAG: if (ND_BODY(node)) onig_node_free(ND_BODY(node)); { BagNode* en = BAG_(node); if (en->type == BAG_IF_ELSE) { onig_node_free(en->te.Then); onig_node_free(en->te.Else); } } break; case ND_QUANT: if (ND_BODY(node)) onig_node_free(ND_BODY(node)); break; case ND_ANCHOR: if (ND_BODY(node)) onig_node_free(ND_BODY(node)); if (IS_NOT_NULL(ANCHOR_(node)->lead_node)) onig_node_free(ANCHOR_(node)->lead_node); break; case ND_CTYPE: case ND_CALL: case ND_GIMMICK: break; } } extern void onig_node_free(Node* node) { if (IS_NULL(node)) return ; #ifdef DEBUG_ND_FREE fprintf(stderr, "onig_node_free: %p\n", node); #endif node_free_body(node); xfree(node); } static void cons_node_free_alone(Node* node) { ND_CAR(node) = 0; ND_CDR(node) = 0; onig_node_free(node); } static Node* node_new(void) { Node* node; node = (Node* )xmalloc(sizeof(Node)); CHECK_NULL_RETURN(node); xmemset(node, 0, sizeof(*node)); #ifdef DEBUG_ND_FREE fprintf(stderr, "node_new: %p\n", node); #endif return node; } extern int onig_node_copy(Node** rcopy, Node* from) { int r; Node* copy; *rcopy = NULL_NODE; switch (ND_TYPE(from)) { case ND_LIST: case ND_ALT: case ND_ANCHOR: /* These node's link to other nodes are processed by caller. */ break; case ND_STRING: case ND_CCLASS: case ND_CTYPE: /* Fixed contents after copy. */ break; default: /* Not supported yet. */ return ONIGERR_TYPE_BUG; break; } copy = node_new(); CHECK_NULL_RETURN_MEMERR(copy); xmemcpy(copy, from, sizeof(*copy)); switch (ND_TYPE(copy)) { case ND_STRING: r = onig_node_str_set(copy, STR_(from)->s, STR_(from)->end, FALSE); if (r != 0) { err: onig_node_free(copy); return r; } break; case ND_CCLASS: { CClassNode *fcc, *tcc; fcc = CCLASS_(from); tcc = CCLASS_(copy); if (IS_NOT_NULL(fcc->mbuf)) { r = bbuf_clone(&(tcc->mbuf), fcc->mbuf); if (r != 0) goto err; } } break; default: break; } *rcopy = copy; return ONIG_NORMAL; } static void initialize_cclass(CClassNode* cc) { BITSET_CLEAR(cc->bs); cc->flags = 0; cc->mbuf = NULL; } static Node* node_new_cclass(void) { Node* node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_CCLASS); initialize_cclass(CCLASS_(node)); return node; } static Node* node_new_ctype(int type, int not, OnigOptionType options) { Node* node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_CTYPE); CTYPE_(node)->ctype = type; CTYPE_(node)->not = not; CTYPE_(node)->ascii_mode = OPTON_IS_ASCII_MODE_CTYPE(type, options); return node; } static Node* node_new_anychar(OnigOptionType options) { Node* node; node = node_new_ctype(CTYPE_ANYCHAR, FALSE, options); CHECK_NULL_RETURN(node); if (OPTON_MULTILINE(options)) ND_STATUS_ADD(node, MULTILINE); return node; } static int node_new_no_newline(Node** node, ParseEnv* env) { Node* n; n = node_new_anychar(ONIG_OPTION_NONE); CHECK_NULL_RETURN_MEMERR(n); *node = n; return 0; } static int node_new_true_anychar(Node** node) { Node* n; n = node_new_anychar(ONIG_OPTION_MULTILINE); CHECK_NULL_RETURN_MEMERR(n); *node = n; return 0; } static Node* node_new_list(Node* left, Node* right) { Node* node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_LIST); ND_CAR(node) = left; ND_CDR(node) = right; return node; } extern Node* onig_node_new_list(Node* left, Node* right) { return node_new_list(left, right); } extern Node* onig_node_new_alt(Node* left, Node* right) { Node* node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_ALT); ND_CAR(node) = left; ND_CDR(node) = right; return node; } static Node* make_list_or_alt(NodeType type, int n, Node* ns[]) { Node* r; if (n <= 0) return NULL_NODE; if (n == 1) { r = node_new(); CHECK_NULL_RETURN(r); ND_SET_TYPE(r, type); ND_CAR(r) = ns[0]; ND_CDR(r) = NULL_NODE; } else { Node* right; r = node_new(); CHECK_NULL_RETURN(r); right = make_list_or_alt(type, n - 1, ns + 1); if (IS_NULL(right)) { onig_node_free(r); return NULL_NODE; } ND_SET_TYPE(r, type); ND_CAR(r) = ns[0]; ND_CDR(r) = right; } return r; } static Node* make_list(int n, Node* ns[]) { return make_list_or_alt(ND_LIST, n, ns); } static Node* make_alt(int n, Node* ns[]) { return make_list_or_alt(ND_ALT, n, ns); } static Node* node_new_anchor(int type) { Node* node; node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_ANCHOR); ANCHOR_(node)->type = type; ANCHOR_(node)->char_min_len = 0; ANCHOR_(node)->char_max_len = INFINITE_LEN; ANCHOR_(node)->ascii_mode = 0; ANCHOR_(node)->lead_node = NULL_NODE; return node; } static Node* node_new_anchor_with_options(int type, OnigOptionType options) { int ascii_mode; Node* node; node = node_new_anchor(type); CHECK_NULL_RETURN(node); ascii_mode = OPTON_WORD_ASCII(options) && IS_WORD_ANCHOR_TYPE(type) ? 1 : 0; ANCHOR_(node)->ascii_mode = ascii_mode; if (type == ANCR_TEXT_SEGMENT_BOUNDARY || type == ANCR_NO_TEXT_SEGMENT_BOUNDARY) { if (OPTON_TEXT_SEGMENT_WORD(options)) ND_STATUS_ADD(node, TEXT_SEGMENT_WORD); } return node; } static Node* node_new_backref(int back_num, int* backrefs, int by_name, #ifdef USE_BACKREF_WITH_LEVEL int exist_level, int nest_level, #endif ParseEnv* env) { int i; Node* node; node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_BACKREF); BACKREF_(node)->back_num = back_num; BACKREF_(node)->back_dynamic = (int* )NULL; if (by_name != 0) ND_STATUS_ADD(node, BY_NAME); if (OPTON_IGNORECASE(env->options)) ND_STATUS_ADD(node, IGNORECASE); #ifdef USE_BACKREF_WITH_LEVEL if (exist_level != 0) { ND_STATUS_ADD(node, NEST_LEVEL); BACKREF_(node)->nest_level = nest_level; } #endif for (i = 0; i < back_num; i++) { if (backrefs[i] <= env->num_mem && IS_NULL(PARSEENV_MEMENV(env)[backrefs[i]].mem_node)) { ND_STATUS_ADD(node, RECURSION); /* /...(\1).../ */ break; } } if (back_num <= ND_BACKREFS_SIZE) { for (i = 0; i < back_num; i++) BACKREF_(node)->back_static[i] = backrefs[i]; } else { int* p = (int* )xmalloc(sizeof(int) * back_num); if (IS_NULL(p)) { onig_node_free(node); return NULL; } BACKREF_(node)->back_dynamic = p; for (i = 0; i < back_num; i++) p[i] = backrefs[i]; } env->backref_num++; return node; } static Node* node_new_backref_checker(int back_num, int* backrefs, int by_name, #ifdef USE_BACKREF_WITH_LEVEL int exist_level, int nest_level, #endif ParseEnv* env) { Node* node; node = node_new_backref(back_num, backrefs, by_name, #ifdef USE_BACKREF_WITH_LEVEL exist_level, nest_level, #endif env); CHECK_NULL_RETURN(node); ND_STATUS_ADD(node, CHECKER); return node; } #ifdef USE_CALL static Node* node_new_call(UChar* name, UChar* name_end, int gnum, int by_number) { Node* node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_CALL); CALL_(node)->by_number = by_number; CALL_(node)->name = name; CALL_(node)->name_end = name_end; CALL_(node)->called_gnum = gnum; CALL_(node)->entry_count = 1; return node; } #endif static Node* node_new_quantifier(int lower, int upper, int by_number) { Node* node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_QUANT); QUANT_(node)->lower = lower; QUANT_(node)->upper = upper; QUANT_(node)->greedy = 1; QUANT_(node)->emptiness = BODY_IS_NOT_EMPTY; QUANT_(node)->head_exact = NULL_NODE; QUANT_(node)->next_head_exact = NULL_NODE; QUANT_(node)->include_referred = 0; QUANT_(node)->empty_status_mem = 0; if (by_number != 0) ND_STATUS_ADD(node, BY_NUMBER); return node; } static Node* node_new_bag(enum BagType type) { Node* node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_BAG); BAG_(node)->type = type; switch (type) { case BAG_MEMORY: BAG_(node)->m.regnum = 0; BAG_(node)->m.called_addr = -1; BAG_(node)->m.entry_count = 1; BAG_(node)->m.called_state = 0; break; case BAG_OPTION: BAG_(node)->o.options = 0; break; case BAG_STOP_BACKTRACK: break; case BAG_IF_ELSE: BAG_(node)->te.Then = 0; BAG_(node)->te.Else = 0; break; } BAG_(node)->opt_count = 0; return node; } extern Node* onig_node_new_bag(enum BagType type) { return node_new_bag(type); } static Node* node_new_bag_if_else(Node* cond, Node* Then, Node* Else) { Node* n; n = node_new_bag(BAG_IF_ELSE); CHECK_NULL_RETURN(n); ND_BODY(n) = cond; BAG_(n)->te.Then = Then; BAG_(n)->te.Else = Else; return n; } static Node* node_new_memory(int is_named) { Node* node = node_new_bag(BAG_MEMORY); CHECK_NULL_RETURN(node); if (is_named != 0) ND_STATUS_ADD(node, NAMED_GROUP); return node; } static Node* node_new_option(OnigOptionType option) { Node* node = node_new_bag(BAG_OPTION); CHECK_NULL_RETURN(node); BAG_(node)->o.options = option; return node; } static Node* node_new_group(Node* content) { Node* node; node = node_new(); CHECK_NULL_RETURN(node); ND_SET_TYPE(node, ND_LIST); ND_CAR(node) = content; ND_CDR(node) = NULL_NODE; return node; } static Node* node_drop_group(Node* group) { Node* content; content = ND_CAR(group); ND_CAR(group) = NULL_NODE; onig_node_free(group); return content; } static int node_set_fail(Node* node) { ND_SET_TYPE(node, ND_GIMMICK); GIMMICK_(node)->type = GIMMICK_FAIL; return ONIG_NORMAL; } static int node_new_fail(Node** node, ParseEnv* env) { *node = node_new(); CHECK_NULL_RETURN_MEMERR(*node); return node_set_fail(*node); } extern int onig_node_reset_fail(Node* node) { node_free_body(node); return node_set_fail(node); } static int node_new_save_gimmick(Node** node, enum SaveType save_type, ParseEnv* env) { int id; ID_ENTRY(env, id); *node = node_new(); CHECK_NULL_RETURN_MEMERR(*node); ND_SET_TYPE(*node, ND_GIMMICK); GIMMICK_(*node)->id = id; GIMMICK_(*node)->type = GIMMICK_SAVE; GIMMICK_(*node)->detail_type = (int )save_type; return ONIG_NORMAL; } static int node_new_update_var_gimmick(Node** node, enum UpdateVarType update_var_type, int id, ParseEnv* env) { *node = node_new(); CHECK_NULL_RETURN_MEMERR(*node); ND_SET_TYPE(*node, ND_GIMMICK); GIMMICK_(*node)->id = id; GIMMICK_(*node)->type = GIMMICK_UPDATE_VAR; GIMMICK_(*node)->detail_type = (int )update_var_type; return ONIG_NORMAL; } static int node_new_keep(Node** node, ParseEnv* env) { int r; r = node_new_save_gimmick(node, SAVE_KEEP, env); if (r != 0) return r; env->keep_num++; return ONIG_NORMAL; } #ifdef USE_CALLOUT extern void onig_free_reg_callout_list(int n, CalloutListEntry* list) { int i; int j; if (IS_NULL(list)) return ; for (i = 0; i < n; i++) { if (list[i].of == ONIG_CALLOUT_OF_NAME) { for (j = 0; j < list[i].u.arg.passed_num; j++) { if (list[i].u.arg.types[j] == ONIG_TYPE_STRING) { if (IS_NOT_NULL(list[i].u.arg.vals[j].s.start)) xfree(list[i].u.arg.vals[j].s.start); } } } else { /* ONIG_CALLOUT_OF_CONTENTS */ if (IS_NOT_NULL(list[i].u.content.start)) { xfree((void* )list[i].u.content.start); } } } xfree(list); } extern CalloutListEntry* onig_reg_callout_list_at(regex_t* reg, int num) { RegexExt* ext = reg->extp; CHECK_NULL_RETURN(ext); if (num <= 0 || num > ext->callout_num) return 0; num--; return ext->callout_list + num; } static int reg_callout_list_entry(ParseEnv* env, int* rnum) { #define INIT_CALLOUT_LIST_NUM 3 int num; CalloutListEntry* list; CalloutListEntry* e; RegexExt* ext; ext = onig_get_regex_ext(env->reg); CHECK_NULL_RETURN_MEMERR(ext); if (IS_NULL(ext->callout_list)) { list = (CalloutListEntry* )xmalloc(sizeof(*list) * INIT_CALLOUT_LIST_NUM); CHECK_NULL_RETURN_MEMERR(list); ext->callout_list = list; ext->callout_list_alloc = INIT_CALLOUT_LIST_NUM; ext->callout_num = 0; } num = ext->callout_num + 1; if (num > ext->callout_list_alloc) { int alloc = ext->callout_list_alloc * 2; list = (CalloutListEntry* )xrealloc(ext->callout_list, sizeof(CalloutListEntry) * alloc); CHECK_NULL_RETURN_MEMERR(list); ext->callout_list = list; ext->callout_list_alloc = alloc; } e = ext->callout_list + (num - 1); e->flag = 0; e->of = 0; e->in = ONIG_CALLOUT_OF_CONTENTS; e->type = 0; e->tag_start = 0; e->tag_end = 0; e->start_func = 0; e->end_func = 0; e->u.arg.num = 0; e->u.arg.passed_num = 0; ext->callout_num = num; *rnum = num; return ONIG_NORMAL; } static int node_new_callout(Node** node, OnigCalloutOf callout_of, int num, int id, ParseEnv* env) { *node = node_new(); CHECK_NULL_RETURN_MEMERR(*node); ND_SET_TYPE(*node, ND_GIMMICK); GIMMICK_(*node)->id = id; GIMMICK_(*node)->num = num; GIMMICK_(*node)->type = GIMMICK_CALLOUT; GIMMICK_(*node)->detail_type = (int )callout_of; return ONIG_NORMAL; } #endif static int make_text_segment(Node** node, ParseEnv* env) { int r; int i; Node* x; Node* ns[2]; /* \X == (?>\O(?:\Y\O)*) */ ns[1] = NULL_NODE; r = ONIGERR_MEMORY; ns[0] = node_new_anchor_with_options(ANCR_NO_TEXT_SEGMENT_BOUNDARY, env->options); if (IS_NULL(ns[0])) goto err; r = node_new_true_anychar(&ns[1]); if (r != 0) goto err1; x = make_list(2, ns); if (IS_NULL(x)) goto err; ns[0] = x; ns[1] = NULL_NODE; x = node_new_quantifier(0, INFINITE_REPEAT, TRUE); if (IS_NULL(x)) goto err; ND_BODY(x) = ns[0]; ns[0] = NULL_NODE; ns[1] = x; r = node_new_true_anychar(&ns[0]); if (r != 0) goto err1; x = make_list(2, ns); if (IS_NULL(x)) goto err; ns[0] = x; ns[1] = NULL_NODE; x = node_new_bag(BAG_STOP_BACKTRACK); if (IS_NULL(x)) goto err; ND_BODY(x) = ns[0]; *node = x; return ONIG_NORMAL; err: r = ONIGERR_MEMORY; err1: for (i = 0; i < 2; i++) onig_node_free(ns[i]); return r; } static int make_absent_engine(Node** node, int pre_save_right_id, Node* absent, Node* step_one, int lower, int upper, int possessive, int is_range_cutter, ParseEnv* env) { int r; int i; int id; Node* x; Node* ns[4]; for (i = 0; i < 4; i++) ns[i] = NULL_NODE; ns[1] = absent; ns[3] = step_one; /* for err */ r = node_new_save_gimmick(&ns[0], SAVE_S, env); if (r != 0) goto err; id = GIMMICK_(ns[0])->id; r = node_new_update_var_gimmick(&ns[2], UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK, id, env); if (r != 0) goto err; if (is_range_cutter != 0) ND_STATUS_ADD(ns[2], ABSENT_WITH_SIDE_EFFECTS); r = node_new_fail(&ns[3], env); if (r != 0) goto err; x = make_list(4, ns); if (IS_NULL(x)) goto err0; ns[0] = x; ns[1] = step_one; ns[2] = ns[3] = NULL_NODE; x = make_alt(2, ns); if (IS_NULL(x)) goto err0; ns[0] = x; x = node_new_quantifier(lower, upper, FALSE); if (IS_NULL(x)) goto err0; ND_BODY(x) = ns[0]; ns[0] = x; if (possessive != 0) { x = node_new_bag(BAG_STOP_BACKTRACK); if (IS_NULL(x)) goto err0; ND_BODY(x) = ns[0]; ns[0] = x; } r = node_new_update_var_gimmick(&ns[1], UPDATE_VAR_RIGHT_RANGE_FROM_STACK, pre_save_right_id, env); if (r != 0) goto err; r = node_new_fail(&ns[2], env); if (r != 0) goto err; x = make_list(2, ns + 1); if (IS_NULL(x)) goto err0; ns[1] = x; ns[2] = NULL_NODE; x = make_alt(2, ns); if (IS_NULL(x)) goto err0; if (is_range_cutter != FALSE) ND_STATUS_ADD(x, SUPER); *node = x; return ONIG_NORMAL; err0: r = ONIGERR_MEMORY; err: for (i = 0; i < 4; i++) onig_node_free(ns[i]); return r; } static int make_absent_tail(Node** node1, Node** node2, int pre_save_right_id, ParseEnv* env) { int r; int id; Node* save; Node* x; Node* ns[2]; *node1 = *node2 = NULL_NODE; save = ns[0] = ns[1] = NULL_NODE; r = node_new_save_gimmick(&save, SAVE_RIGHT_RANGE, env); if (r != 0) goto err; id = GIMMICK_(save)->id; r = node_new_update_var_gimmick(&ns[0], UPDATE_VAR_RIGHT_RANGE_FROM_STACK, id, env); if (r != 0) goto err; r = node_new_fail(&ns[1], env); if (r != 0) goto err; x = make_list(2, ns); if (IS_NULL(x)) goto err0; ns[0] = NULL_NODE; ns[1] = x; r = node_new_update_var_gimmick(&ns[0], UPDATE_VAR_RIGHT_RANGE_FROM_STACK, pre_save_right_id, env); if (r != 0) goto err; x = make_alt(2, ns); if (IS_NULL(x)) goto err0; *node1 = save; *node2 = x; return ONIG_NORMAL; err0: r = ONIGERR_MEMORY; err: onig_node_free(save); onig_node_free(ns[0]); onig_node_free(ns[1]); return r; } static int make_range_clear(Node** node, ParseEnv* env) { int r; int id; Node* save; Node* x; Node* ns[2]; *node = NULL_NODE; save = ns[0] = ns[1] = NULL_NODE; r = node_new_save_gimmick(&save, SAVE_RIGHT_RANGE, env); if (r != 0) goto err; id = GIMMICK_(save)->id; r = node_new_update_var_gimmick(&ns[0], UPDATE_VAR_RIGHT_RANGE_FROM_STACK, id, env); if (r != 0) goto err; r = node_new_fail(&ns[1], env); if (r != 0) goto err; x = make_list(2, ns); if (IS_NULL(x)) goto err0; ns[0] = NULL_NODE; ns[1] = x; #define ID_NOT_USED_DONT_CARE_ME 0 r = node_new_update_var_gimmick(&ns[0], UPDATE_VAR_RIGHT_RANGE_INIT, ID_NOT_USED_DONT_CARE_ME, env); if (r != 0) goto err; ND_STATUS_ADD(ns[0], ABSENT_WITH_SIDE_EFFECTS); x = make_alt(2, ns); if (IS_NULL(x)) goto err0; ND_STATUS_ADD(x, SUPER); ns[0] = save; ns[1] = x; save = NULL_NODE; x = make_list(2, ns); if (IS_NULL(x)) goto err0; *node = x; return ONIG_NORMAL; err0: r = ONIGERR_MEMORY; err: onig_node_free(save); onig_node_free(ns[0]); onig_node_free(ns[1]); return r; } static int is_simple_one_char_repeat(Node* node, Node** rquant, Node** rbody, int* is_possessive, ParseEnv* env) { Node* quant; Node* body; *rquant = *rbody = 0; *is_possessive = 0; if (ND_TYPE(node) == ND_QUANT) { quant = node; } else { if (ND_TYPE(node) == ND_BAG) { BagNode* en = BAG_(node); if (en->type == BAG_STOP_BACKTRACK) { *is_possessive = 1; quant = ND_BAG_BODY(en); if (ND_TYPE(quant) != ND_QUANT) return 0; } else return 0; } else return 0; } if (QUANT_(quant)->greedy == 0) return 0; body = ND_BODY(quant); switch (ND_TYPE(body)) { case ND_STRING: { int len; StrNode* sn = STR_(body); UChar *s = sn->s; len = 0; while (s < sn->end) { s += enclen(env->enc, s); len++; } if (len != 1) return 0; } case ND_CCLASS: break; default: return 0; break; } if (node != quant) { ND_BODY(node) = 0; onig_node_free(node); } ND_BODY(quant) = NULL_NODE; *rquant = quant; *rbody = body; return 1; } static int make_absent_tree_for_simple_one_char_repeat(Node** node, Node* absent, Node* quant, Node* body, int possessive, ParseEnv* env) { int r; int i; int id1; int lower, upper; Node* x; Node* ns[4]; *node = NULL_NODE; r = ONIGERR_MEMORY; ns[0] = ns[1] = NULL_NODE; ns[2] = body, ns[3] = absent; lower = QUANT_(quant)->lower; upper = QUANT_(quant)->upper; r = node_new_save_gimmick(&ns[0], SAVE_RIGHT_RANGE, env); if (r != 0) goto err; id1 = GIMMICK_(ns[0])->id; r = make_absent_engine(&ns[1], id1, absent, body, lower, upper, possessive, FALSE, env); if (r != 0) goto err; ns[2] = ns[3] = NULL_NODE; r = node_new_update_var_gimmick(&ns[2], UPDATE_VAR_RIGHT_RANGE_FROM_STACK, id1, env); if (r != 0) goto err; x = make_list(3, ns); if (IS_NULL(x)) goto err0; *node = x; return ONIG_NORMAL; err0: r = ONIGERR_MEMORY; err: for (i = 0; i < 4; i++) onig_node_free(ns[i]); return r; } static int make_absent_tree(Node** node, Node* absent, Node* expr, int is_range_cutter, ParseEnv* env) { int r; int i; int id1, id2; int possessive; Node* x; Node* ns[7]; r = ONIGERR_MEMORY; for (i = 0; i < 7; i++) ns[i] = NULL_NODE; ns[4] = expr; ns[5] = absent; if (is_range_cutter == 0) { Node* quant; Node* body; if (expr == NULL_NODE) { /* default expr \O* */ quant = node_new_quantifier(0, INFINITE_REPEAT, FALSE); if (IS_NULL(quant)) goto err0; r = node_new_true_anychar(&body); if (r != 0) { onig_node_free(quant); goto err; } possessive = 0; goto simple; } else { if (is_simple_one_char_repeat(expr, &quant, &body, &possessive, env)) { simple: r = make_absent_tree_for_simple_one_char_repeat(node, absent, quant, body, possessive, env); onig_node_free(quant); if (r != 0) { ns[4] = NULL_NODE; onig_node_free(body); goto err; } return ONIG_NORMAL; } } } r = node_new_save_gimmick(&ns[0], SAVE_RIGHT_RANGE, env); if (r != 0) goto err; id1 = GIMMICK_(ns[0])->id; r = node_new_save_gimmick(&ns[1], SAVE_S, env); if (r != 0) goto err; id2 = GIMMICK_(ns[1])->id; r = node_new_true_anychar(&ns[3]); if (r != 0) goto err; possessive = 1; r = make_absent_engine(&ns[2], id1, absent, ns[3], 0, INFINITE_REPEAT, possessive, is_range_cutter, env); if (r != 0) goto err; ns[3] = NULL_NODE; ns[5] = NULL_NODE; r = node_new_update_var_gimmick(&ns[3], UPDATE_VAR_S_FROM_STACK, id2, env); if (r != 0) goto err; if (is_range_cutter != 0) { x = make_list(4, ns); if (IS_NULL(x)) goto err0; } else { r = make_absent_tail(&ns[5], &ns[6], id1, env); if (r != 0) goto err; x = make_list(7, ns); if (IS_NULL(x)) goto err0; } *node = x; return ONIG_NORMAL; err0: r = ONIGERR_MEMORY; err: for (i = 0; i < 7; i++) onig_node_free(ns[i]); return r; } extern int onig_node_str_cat(Node* node, const UChar* s, const UChar* end) { int addlen = (int )(end - s); if (addlen > 0) { int len = (int )(STR_(node)->end - STR_(node)->s); if (STR_(node)->capacity > 0 || (len + addlen > ND_STRING_BUF_SIZE - 1)) { UChar* p; int capa = len + addlen + ND_STRING_MARGIN; if (capa <= STR_(node)->capacity) { onig_strcpy(STR_(node)->s + len, s, end); } else { if (STR_(node)->s == STR_(node)->buf) p = strcat_capa_from_static(STR_(node)->s, STR_(node)->end, s, end, capa); else p = strcat_capa(STR_(node)->s, STR_(node)->end, s, end, capa); CHECK_NULL_RETURN_MEMERR(p); STR_(node)->s = p; STR_(node)->capacity = capa; } } else { onig_strcpy(STR_(node)->s + len, s, end); } STR_(node)->end = STR_(node)->s + len + addlen; } return 0; } extern int onig_node_str_set(Node* node, const UChar* s, const UChar* end, int need_free) { onig_node_str_clear(node, need_free); return onig_node_str_cat(node, s, end); } static int node_str_remove_char(Node* node, UChar c) { UChar* p; int n; n = 0; p = STR_(node)->s; while (p < STR_(node)->end) { if (*p == c) { UChar *q, *q1; q = q1 = p; q1++; while (q1 < STR_(node)->end) { *q = *q1; q++; q1++; } n++; STR_(node)->end--; } else { p++; } } return n; } static int node_str_cat_char(Node* node, UChar c) { UChar s[1]; s[0] = c; return onig_node_str_cat(node, s, s + 1); } extern void onig_node_str_clear(Node* node, int need_free) { if (need_free != 0 && STR_(node)->capacity != 0 && IS_NOT_NULL(STR_(node)->s) && STR_(node)->s != STR_(node)->buf) { xfree(STR_(node)->s); } STR_(node)->flag = 0; STR_(node)->s = STR_(node)->buf; STR_(node)->end = STR_(node)->buf; STR_(node)->capacity = 0; } static int node_set_str(Node* node, const UChar* s, const UChar* end) { int r; ND_SET_TYPE(node, ND_STRING); STR_(node)->flag = 0; STR_(node)->s = STR_(node)->buf; STR_(node)->end = STR_(node)->buf; STR_(node)->capacity = 0; r = onig_node_str_cat(node, s, end); return r; } static Node* node_new_str(const UChar* s, const UChar* end) { int r; Node* node = node_new(); CHECK_NULL_RETURN(node); r = node_set_str(node, s, end); if (r != 0) { onig_node_free(node); return NULL; } return node; } static int node_reset_str(Node* node, const UChar* s, const UChar* end) { node_free_body(node); return node_set_str(node, s, end); } extern int onig_node_reset_empty(Node* node) { return node_reset_str(node, NULL, NULL); } extern Node* onig_node_new_str(const UChar* s, const UChar* end) { return node_new_str(s, end); } static Node* node_new_str_with_options(const UChar* s, const UChar* end, OnigOptionType options) { Node* node; node = node_new_str(s, end); if (OPTON_IGNORECASE(options)) ND_STATUS_ADD(node, IGNORECASE); return node; } static Node* node_new_str_crude(UChar* s, UChar* end, OnigOptionType options) { Node* node = node_new_str_with_options(s, end, options); CHECK_NULL_RETURN(node); ND_STRING_SET_CRUDE(node); return node; } static Node* node_new_empty(void) { return node_new_str(NULL, NULL); } static Node* node_new_str_crude_char(UChar c, OnigOptionType options) { int i; UChar p[1]; Node* node; p[0] = c; node = node_new_str_crude(p, p + 1, options); CHECK_NULL_RETURN(node); /* clear buf tail */ for (i = 1; i < ND_STRING_BUF_SIZE; i++) STR_(node)->buf[i] = '\0'; return node; } static Node* str_node_split_last_char(Node* node, OnigEncoding enc) { const UChar *p; Node* rn; StrNode* sn; sn = STR_(node); rn = NULL_NODE; if (sn->end > sn->s) { p = onigenc_get_prev_char_head(enc, sn->s, sn->end); if (p && p > sn->s) { /* can be split. */ rn = node_new_str(p, sn->end); CHECK_NULL_RETURN(rn); sn->end = (UChar* )p; STR_(rn)->flag = sn->flag; ND_STATUS(rn) = ND_STATUS(node); } } return rn; } static int str_node_can_be_split(Node* node, OnigEncoding enc) { StrNode* sn = STR_(node); if (sn->end > sn->s) { return ((enclen(enc, sn->s) < sn->end - sn->s) ? 1 : 0); } return 0; } static int scan_number(UChar** src, const UChar* end, OnigEncoding enc) { int num, val; OnigCodePoint c; UChar* p; PFETCH_READY; p = *src; num = 0; while (! PEND) { PFETCH(c); if (IS_CODE_DIGIT_ASCII(enc, c)) { val = (int )DIGITVAL(c); if ((ONIG_INT_MAX - val) / 10 < num) return -1; /* overflow */ num = num * 10 + val; } else { PUNFETCH; break; } } *src = p; return num; } static int scan_hexadecimal_number(UChar** src, UChar* end, int minlen, int maxlen, OnigEncoding enc, OnigCodePoint* rcode) { OnigCodePoint code; OnigCodePoint c; unsigned int val; int n; UChar* p; PFETCH_READY; p = *src; code = 0; n = 0; while (! PEND && n < maxlen) { PFETCH(c); if (IS_CODE_XDIGIT_ASCII(enc, c)) { n++; val = (unsigned int )XDIGITVAL(enc, c); if ((UINT_MAX - val) / 16UL < code) return ONIGERR_TOO_BIG_NUMBER; /* overflow */ code = (code << 4) + val; } else { PUNFETCH; break; } } if (n < minlen) return ONIGERR_INVALID_CODE_POINT_VALUE; *rcode = code; *src = p; return ONIG_NORMAL; } static int scan_octal_number(UChar** src, UChar* end, int minlen, int maxlen, OnigEncoding enc, OnigCodePoint* rcode) { OnigCodePoint code; OnigCodePoint c; unsigned int val; int n; UChar* p; PFETCH_READY; p = *src; code = 0; n = 0; while (! PEND && n < maxlen) { PFETCH(c); if (IS_CODE_DIGIT_ASCII(enc, c) && c < '8') { n++; val = (unsigned int )ODIGITVAL(c); if ((UINT_MAX - val) / 8UL < code) return ONIGERR_TOO_BIG_NUMBER; /* overflow */ code = (code << 3) + val; } else { PUNFETCH; break; } } if (n < minlen) return ONIGERR_INVALID_CODE_POINT_VALUE; *rcode = code; *src = p; return ONIG_NORMAL; } static int scan_number_of_base(UChar** src, UChar* end, int minlen, OnigEncoding enc, OnigCodePoint* rcode, int base) { int r; if (base == 16) r = scan_hexadecimal_number(src, end, minlen, 8, enc, rcode); else if (base == 8) r = scan_octal_number(src, end, minlen, 11, enc, rcode); else r = ONIGERR_INVALID_CODE_POINT_VALUE; return r; } #define IS_CODE_POINT_DIVIDE(c) ((c) == ' ' || (c) == '\n') enum CPS_STATE { CPS_EMPTY = 0, CPS_START = 1, CPS_RANGE = 2 }; static int check_code_point_sequence_cc(UChar* p, UChar* end, int base, OnigEncoding enc, int state) { int r; int n; int end_digit; OnigCodePoint code; OnigCodePoint c; PFETCH_READY; end_digit = FALSE; n = 0; while (! PEND) { start: PFETCH(c); if (c == '}') { end_char: if (state == CPS_RANGE) return ONIGERR_INVALID_CODE_POINT_VALUE; return n; } if (IS_CODE_POINT_DIVIDE(c)) { while (! PEND) { PFETCH(c); if (! IS_CODE_POINT_DIVIDE(c)) break; } if (IS_CODE_POINT_DIVIDE(c)) return ONIGERR_INVALID_CODE_POINT_VALUE; } else if (c == '-') { range: if (state != CPS_START) return ONIGERR_INVALID_CODE_POINT_VALUE; if (PEND) return ONIGERR_INVALID_CODE_POINT_VALUE; end_digit = FALSE; state = CPS_RANGE; goto start; } else if (end_digit == TRUE) { if (base == 16) { if (IS_CODE_XDIGIT_ASCII(enc, c)) return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } else if (base == 8) { if (IS_CODE_DIGIT_ASCII(enc, c) && c < '8') return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } return ONIGERR_INVALID_CODE_POINT_VALUE; } if (c == '}') goto end_char; if (c == '-') goto range; PUNFETCH; r = scan_number_of_base(&p, end, 1, enc, &code, base); if (r != 0) return r; n++; end_digit = TRUE; state = (state == CPS_RANGE) ? CPS_EMPTY : CPS_START; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static int check_code_point_sequence(UChar* p, UChar* end, int base, OnigEncoding enc) { int r; int n; int end_digit; OnigCodePoint code; OnigCodePoint c; PFETCH_READY; end_digit = FALSE; n = 0; while (! PEND) { PFETCH(c); if (c == '}') { end_char: return n; } if (IS_CODE_POINT_DIVIDE(c)) { while (! PEND) { PFETCH(c); if (! IS_CODE_POINT_DIVIDE(c)) break; } if (IS_CODE_POINT_DIVIDE(c)) return ONIGERR_INVALID_CODE_POINT_VALUE; } else if (end_digit == TRUE) { if (base == 16) { if (IS_CODE_XDIGIT_ASCII(enc, c)) return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } else if (base == 8) { if (IS_CODE_DIGIT_ASCII(enc, c) && c < '8') return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } return ONIGERR_INVALID_CODE_POINT_VALUE; } if (c == '}') goto end_char; PUNFETCH; r = scan_number_of_base(&p, end, 1, enc, &code, base); if (r != 0) return r; n++; end_digit = TRUE; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static int get_next_code_point(UChar** src, UChar* end, int base, OnigEncoding enc, int in_cc, OnigCodePoint* rcode) { int r; OnigCodePoint c; UChar* p; PFETCH_READY; p = *src; while (! PEND) { PFETCH(c); if (! IS_CODE_POINT_DIVIDE(c)) { if (c == '}') { *src = p; return 1; /* end of sequence */ } else if (c == '-' && in_cc == TRUE) { *src = p; return 2; /* range */ } PUNFETCH; break; } else { if (PEND) return ONIGERR_INVALID_CODE_POINT_VALUE; } } r = scan_number_of_base(&p, end, 1, enc, rcode, base); if (r != 0) return r; *src = p; return ONIG_NORMAL; } #define BB_WRITE_CODE_POINT(bbuf,pos,code) \ BB_WRITE(bbuf, pos, &(code), SIZE_CODE_POINT) /* data format: [n][from-1][to-1][from-2][to-2] ... [from-n][to-n] (all data size is OnigCodePoint) */ static int new_code_range(BBuf** pbuf) { #define INIT_MULTI_BYTE_RANGE_SIZE (SIZE_CODE_POINT * 5) int r; OnigCodePoint n; BBuf* bbuf; bbuf = *pbuf = (BBuf* )xmalloc(sizeof(BBuf)); CHECK_NULL_RETURN_MEMERR(bbuf); r = BB_INIT(bbuf, INIT_MULTI_BYTE_RANGE_SIZE); if (r != 0) { xfree(bbuf); *pbuf = 0; return r; } n = 0; BB_WRITE_CODE_POINT(bbuf, 0, n); return 0; } static int add_code_range_to_buf(BBuf** pbuf, OnigCodePoint from, OnigCodePoint to) { int r, inc_n, pos; int low, high, bound, x; OnigCodePoint n, *data; BBuf* bbuf; if (from > to) { n = from; from = to; to = n; } if (IS_NULL(*pbuf)) { r = new_code_range(pbuf); if (r != 0) return r; bbuf = *pbuf; n = 0; } else { bbuf = *pbuf; GET_CODE_POINT(n, bbuf->p); } data = (OnigCodePoint* )(bbuf->p); data++; for (low = 0, bound = n; low < bound; ) { x = (low + bound) >> 1; if (from > data[x*2 + 1]) low = x + 1; else bound = x; } high = (to == ~((OnigCodePoint )0)) ? n : low; for (bound = n; high < bound; ) { x = (high + bound) >> 1; if (to + 1 >= data[x*2]) high = x + 1; else bound = x; } inc_n = low + 1 - high; if (n + inc_n > ONIG_MAX_MULTI_BYTE_RANGES_NUM) return ONIGERR_TOO_MANY_MULTI_BYTE_RANGES; if (inc_n != 1) { if (from > data[low*2]) from = data[low*2]; if (to < data[(high - 1)*2 + 1]) to = data[(high - 1)*2 + 1]; } if (inc_n != 0 && (OnigCodePoint )high < n) { int from_pos = SIZE_CODE_POINT * (1 + high * 2); int to_pos = SIZE_CODE_POINT * (1 + (low + 1) * 2); int size = (n - high) * 2 * SIZE_CODE_POINT; if (inc_n > 0) { BB_MOVE_RIGHT(bbuf, from_pos, to_pos, size); } else { BB_MOVE_LEFT_REDUCE(bbuf, from_pos, to_pos); } } pos = SIZE_CODE_POINT * (1 + low * 2); BB_ENSURE_SIZE(bbuf, pos + SIZE_CODE_POINT * 2); BB_WRITE_CODE_POINT(bbuf, pos, from); BB_WRITE_CODE_POINT(bbuf, pos + SIZE_CODE_POINT, to); n += inc_n; BB_WRITE_CODE_POINT(bbuf, 0, n); return 0; } static int add_code_range(BBuf** pbuf, ParseEnv* env, OnigCodePoint from, OnigCodePoint to) { if (from > to) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC)) return 0; else return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS; } return add_code_range_to_buf(pbuf, from, to); } static int not_code_range_buf(OnigEncoding enc, BBuf* bbuf, BBuf** pbuf) { int r, i, n; OnigCodePoint pre, from, *data, to = 0; *pbuf = (BBuf* )NULL; if (IS_NULL(bbuf)) { set_all: return SET_ALL_MULTI_BYTE_RANGE(enc, pbuf); } data = (OnigCodePoint* )(bbuf->p); GET_CODE_POINT(n, data); data++; if (n <= 0) goto set_all; r = 0; pre = MBCODE_START_POS(enc); for (i = 0; i < n; i++) { from = data[i*2]; to = data[i*2+1]; if (pre <= from - 1) { r = add_code_range_to_buf(pbuf, pre, from - 1); if (r != 0) { bbuf_free(*pbuf); return r; } } if (to == ~((OnigCodePoint )0)) break; pre = to + 1; } if (to < ~((OnigCodePoint )0)) { r = add_code_range_to_buf(pbuf, to + 1, ~((OnigCodePoint )0)); if (r != 0) bbuf_free(*pbuf); } return r; } #define SWAP_BB_NOT(bbuf1, not1, bbuf2, not2) do {\ BBuf *tbuf; \ int tnot; \ tnot = not1; not1 = not2; not2 = tnot; \ tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf; \ } while (0) static int or_code_range_buf(OnigEncoding enc, BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf) { int r; OnigCodePoint i, n1, *data1; OnigCodePoint from, to; *pbuf = (BBuf* )NULL; if (IS_NULL(bbuf1) && IS_NULL(bbuf2)) { if (not1 != 0 || not2 != 0) return SET_ALL_MULTI_BYTE_RANGE(enc, pbuf); return 0; } r = 0; if (IS_NULL(bbuf2)) SWAP_BB_NOT(bbuf1, not1, bbuf2, not2); if (IS_NULL(bbuf1)) { if (not1 != 0) { return SET_ALL_MULTI_BYTE_RANGE(enc, pbuf); } else { if (not2 == 0) { return bbuf_clone(pbuf, bbuf2); } else { return not_code_range_buf(enc, bbuf2, pbuf); } } } if (not1 != 0) SWAP_BB_NOT(bbuf1, not1, bbuf2, not2); data1 = (OnigCodePoint* )(bbuf1->p); GET_CODE_POINT(n1, data1); data1++; if (not2 == 0 && not1 == 0) { /* 1 OR 2 */ r = bbuf_clone(pbuf, bbuf2); } else if (not1 == 0) { /* 1 OR (not 2) */ r = not_code_range_buf(enc, bbuf2, pbuf); } if (r != 0) return r; for (i = 0; i < n1; i++) { from = data1[i*2]; to = data1[i*2+1]; r = add_code_range_to_buf(pbuf, from, to); if (r != 0) return r; } return 0; } static int and_code_range1(BBuf** pbuf, OnigCodePoint from1, OnigCodePoint to1, OnigCodePoint* data, int n) { int i, r; OnigCodePoint from2, to2; for (i = 0; i < n; i++) { from2 = data[i*2]; to2 = data[i*2+1]; if (from2 < from1) { if (to2 < from1) continue; else { from1 = to2 + 1; } } else if (from2 <= to1) { if (to2 < to1) { if (from1 <= from2 - 1) { r = add_code_range_to_buf(pbuf, from1, from2-1); if (r != 0) return r; } from1 = to2 + 1; } else { to1 = from2 - 1; } } else { from1 = from2; } if (from1 > to1) break; } if (from1 <= to1) { r = add_code_range_to_buf(pbuf, from1, to1); if (r != 0) return r; } return 0; } static int and_code_range_buf(BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf) { int r; OnigCodePoint i, j, n1, n2, *data1, *data2; OnigCodePoint from, to, from1, to1, from2, to2; *pbuf = (BBuf* )NULL; if (IS_NULL(bbuf1)) { if (not1 != 0 && IS_NOT_NULL(bbuf2)) /* not1 != 0 -> not2 == 0 */ return bbuf_clone(pbuf, bbuf2); return 0; } else if (IS_NULL(bbuf2)) { if (not2 != 0) return bbuf_clone(pbuf, bbuf1); return 0; } if (not1 != 0) SWAP_BB_NOT(bbuf1, not1, bbuf2, not2); data1 = (OnigCodePoint* )(bbuf1->p); data2 = (OnigCodePoint* )(bbuf2->p); GET_CODE_POINT(n1, data1); GET_CODE_POINT(n2, data2); data1++; data2++; if (not2 == 0 && not1 == 0) { /* 1 AND 2 */ for (i = 0; i < n1; i++) { from1 = data1[i*2]; to1 = data1[i*2+1]; for (j = 0; j < n2; j++) { from2 = data2[j*2]; to2 = data2[j*2+1]; if (from2 > to1) break; if (to2 < from1) continue; from = MAX(from1, from2); to = MIN(to1, to2); r = add_code_range_to_buf(pbuf, from, to); if (r != 0) return r; } } } else if (not1 == 0) { /* 1 AND (not 2) */ for (i = 0; i < n1; i++) { from1 = data1[i*2]; to1 = data1[i*2+1]; r = and_code_range1(pbuf, from1, to1, data2, n2); if (r != 0) return r; } } return 0; } static int and_cclass(CClassNode* dest, CClassNode* cc, OnigEncoding enc) { int r, not1, not2; BBuf *buf1, *buf2, *pbuf; BitSetRef bsr1, bsr2; BitSet bs1, bs2; not1 = IS_NCCLASS_NOT(dest); bsr1 = dest->bs; buf1 = dest->mbuf; not2 = IS_NCCLASS_NOT(cc); bsr2 = cc->bs; buf2 = cc->mbuf; if (not1 != 0) { bitset_invert_to(bsr1, bs1); bsr1 = bs1; } if (not2 != 0) { bitset_invert_to(bsr2, bs2); bsr2 = bs2; } bitset_and(bsr1, bsr2); if (bsr1 != dest->bs) { bitset_copy(dest->bs, bsr1); } if (not1 != 0) { bitset_invert(dest->bs); } if (! ONIGENC_IS_SINGLEBYTE(enc)) { if (not1 != 0 && not2 != 0) { r = or_code_range_buf(enc, buf1, 0, buf2, 0, &pbuf); } else { r = and_code_range_buf(buf1, not1, buf2, not2, &pbuf); if (r == 0 && not1 != 0) { BBuf *tbuf; r = not_code_range_buf(enc, pbuf, &tbuf); if (r != 0) { bbuf_free(pbuf); return r; } bbuf_free(pbuf); pbuf = tbuf; } } if (r != 0) return r; dest->mbuf = pbuf; bbuf_free(buf1); return r; } return 0; } static int or_cclass(CClassNode* dest, CClassNode* cc, OnigEncoding enc) { int r, not1, not2; BBuf *buf1, *buf2, *pbuf; BitSetRef bsr1, bsr2; BitSet bs1, bs2; not1 = IS_NCCLASS_NOT(dest); bsr1 = dest->bs; buf1 = dest->mbuf; not2 = IS_NCCLASS_NOT(cc); bsr2 = cc->bs; buf2 = cc->mbuf; if (not1 != 0) { bitset_invert_to(bsr1, bs1); bsr1 = bs1; } if (not2 != 0) { bitset_invert_to(bsr2, bs2); bsr2 = bs2; } bitset_or(bsr1, bsr2); if (bsr1 != dest->bs) { bitset_copy(dest->bs, bsr1); } if (not1 != 0) { bitset_invert(dest->bs); } if (! ONIGENC_IS_SINGLEBYTE(enc)) { if (not1 != 0 && not2 != 0) { r = and_code_range_buf(buf1, 0, buf2, 0, &pbuf); } else { r = or_code_range_buf(enc, buf1, not1, buf2, not2, &pbuf); if (r == 0 && not1 != 0) { BBuf *tbuf; r = not_code_range_buf(enc, pbuf, &tbuf); if (r != 0) { bbuf_free(pbuf); return r; } bbuf_free(pbuf); pbuf = tbuf; } } if (r != 0) return r; dest->mbuf = pbuf; bbuf_free(buf1); return r; } else return 0; } static OnigCodePoint conv_backslash_value(OnigCodePoint c, ParseEnv* env) { if (IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_CONTROL_CHARS)) { switch (c) { case 'n': return '\n'; case 't': return '\t'; case 'r': return '\r'; case 'f': return '\f'; case 'a': return '\007'; case 'b': return '\010'; case 'e': return '\033'; case 'v': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_V_VTAB)) return '\v'; break; default: break; } } return c; } static int is_invalid_quantifier_target(Node* node) { switch (ND_TYPE(node)) { case ND_ANCHOR: case ND_GIMMICK: return 1; break; case ND_BAG: /* allow enclosed elements */ /* return is_invalid_quantifier_target(ND_BODY(node)); */ break; case ND_LIST: do { if (! is_invalid_quantifier_target(ND_CAR(node))) return 0; } while (IS_NOT_NULL(node = ND_CDR(node))); return 0; break; case ND_ALT: do { if (is_invalid_quantifier_target(ND_CAR(node))) return 1; } while (IS_NOT_NULL(node = ND_CDR(node))); break; default: break; } return 0; } /* ?:0, *:1, +:2, ??:3, *?:4, +?:5 */ static int quantifier_type_num(QuantNode* q) { if (q->greedy) { if (q->lower == 0) { if (q->upper == 1) return 0; else if (IS_INFINITE_REPEAT(q->upper)) return 1; } else if (q->lower == 1) { if (IS_INFINITE_REPEAT(q->upper)) return 2; } } else { if (q->lower == 0) { if (q->upper == 1) return 3; else if (IS_INFINITE_REPEAT(q->upper)) return 4; } else if (q->lower == 1) { if (IS_INFINITE_REPEAT(q->upper)) return 5; } } return -1; } enum ReduceType { RQ_ASIS = 0, /* as is */ RQ_DEL, /* delete parent */ RQ_A, /* to '*' */ RQ_P, /* to '+' */ RQ_AQ, /* to '*?' */ RQ_QQ, /* to '??' */ RQ_P_QQ, /* to '+)??' */ }; static enum ReduceType ReduceTypeTable[6][6] = { {RQ_DEL, RQ_A, RQ_A, RQ_QQ, RQ_AQ, RQ_ASIS}, /* '?' */ {RQ_DEL, RQ_DEL, RQ_DEL, RQ_P_QQ, RQ_P_QQ, RQ_DEL}, /* '*' */ {RQ_A, RQ_A, RQ_DEL, RQ_ASIS, RQ_P_QQ, RQ_DEL}, /* '+' */ {RQ_DEL, RQ_AQ, RQ_AQ, RQ_DEL, RQ_AQ, RQ_AQ}, /* '??' */ {RQ_DEL, RQ_DEL, RQ_DEL, RQ_DEL, RQ_DEL, RQ_DEL}, /* '*?' */ {RQ_ASIS, RQ_A, RQ_P, RQ_AQ, RQ_AQ, RQ_DEL} /* '+?' */ }; extern int onig_reduce_nested_quantifier(Node* pnode) { int pnum, cnum; QuantNode *p, *c; Node* cnode; cnode = ND_BODY(pnode); p = QUANT_(pnode); c = QUANT_(cnode); pnum = quantifier_type_num(p); cnum = quantifier_type_num(c); if (pnum < 0 || cnum < 0) { if (p->lower == p->upper && c->lower == c->upper) { int n = onig_positive_int_multiply(p->lower, c->lower); if (n < 0) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; p->lower = p->upper = n; ND_BODY(pnode) = ND_BODY(cnode); goto remove_cnode; } return 0; } switch(ReduceTypeTable[cnum][pnum]) { case RQ_DEL: *pnode = *cnode; goto remove_cnode; break; case RQ_A: ND_BODY(pnode) = ND_BODY(cnode); p->lower = 0; p->upper = INFINITE_REPEAT; p->greedy = 1; goto remove_cnode; break; case RQ_P: ND_BODY(pnode) = ND_BODY(cnode); p->lower = 1; p->upper = INFINITE_REPEAT; p->greedy = 1; goto remove_cnode; break; case RQ_AQ: ND_BODY(pnode) = ND_BODY(cnode); p->lower = 0; p->upper = INFINITE_REPEAT; p->greedy = 0; goto remove_cnode; break; case RQ_QQ: ND_BODY(pnode) = ND_BODY(cnode); p->lower = 0; p->upper = 1; p->greedy = 0; goto remove_cnode; break; case RQ_P_QQ: p->lower = 0; p->upper = 1; p->greedy = 0; c->lower = 1; c->upper = INFINITE_REPEAT; c->greedy = 1; break; case RQ_ASIS: break; } return 0; remove_cnode: ND_BODY(cnode) = NULL_NODE; onig_node_free(cnode); return 0; } static int node_new_general_newline(Node** node, ParseEnv* env) { int r; int dlen, alen; UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN * 2]; Node* crnl; Node* ncc; Node* x; CClassNode* cc; dlen = ONIGENC_CODE_TO_MBC(env->enc, 0x0d, buf); if (dlen < 0) return dlen; alen = ONIGENC_CODE_TO_MBC(env->enc, NEWLINE_CODE, buf + dlen); if (alen < 0) return alen; crnl = node_new_str_crude(buf, buf + dlen + alen, ONIG_OPTION_NONE); CHECK_NULL_RETURN_MEMERR(crnl); ncc = node_new_cclass(); if (IS_NULL(ncc)) goto err2; cc = CCLASS_(ncc); if (dlen == 1) { bitset_set_range(cc->bs, NEWLINE_CODE, 0x0d); } else { r = add_code_range(&(cc->mbuf), env, NEWLINE_CODE, 0x0d); if (r != 0) { err1: onig_node_free(ncc); err2: onig_node_free(crnl); return ONIGERR_MEMORY; } } if (ONIGENC_IS_UNICODE_ENCODING(env->enc)) { r = add_code_range(&(cc->mbuf), env, 0x85, 0x85); if (r != 0) goto err1; r = add_code_range(&(cc->mbuf), env, 0x2028, 0x2029); if (r != 0) goto err1; } x = node_new_bag_if_else(crnl, NULL_NODE, ncc); if (IS_NULL(x)) goto err1; *node = x; return 0; } enum TokenSyms { TK_EOT = 0, /* end of token */ TK_CRUDE_BYTE, TK_CHAR, TK_STRING, TK_CODE_POINT, TK_ANYCHAR, TK_CHAR_TYPE, TK_BACKREF, TK_CALL, TK_ANCHOR, TK_REPEAT, TK_INTERVAL, TK_ANYCHAR_ANYTIME, /* SQL '%' == .* */ TK_ALT, TK_SUBEXP_OPEN, TK_SUBEXP_CLOSE, TK_OPEN_CC, TK_QUOTE_OPEN, TK_CHAR_PROPERTY, /* \p{...}, \P{...} */ TK_KEEP, /* \K */ TK_GENERAL_NEWLINE, /* \R */ TK_NO_NEWLINE, /* \N */ TK_TRUE_ANYCHAR, /* \O */ TK_TEXT_SEGMENT, /* \X */ /* in cc */ TK_CC_CLOSE, TK_CC_RANGE, TK_CC_POSIX_BRACKET_OPEN, TK_CC_AND, /* && */ TK_CC_OPEN_CC /* [ */ }; typedef struct { enum TokenSyms type; int code_point_continue; int escaped; int base_num; /* is number: 8, 16 (used in [....]) */ UChar* backp; union { UChar* s; UChar byte; OnigCodePoint code; int anchor; int subtype; struct { int lower; int upper; int greedy; int possessive; } repeat; struct { int num; int ref1; int* refs; int by_name; #ifdef USE_BACKREF_WITH_LEVEL int exist_level; int level; /* \k */ #endif } backref; struct { UChar* name; UChar* name_end; int gnum; int by_number; } call; struct { int ctype; int not; } prop; } u; } PToken; static void ptoken_init(PToken* tok) { tok->code_point_continue = 0; } static int fetch_interval(UChar** src, UChar* end, PToken* tok, ParseEnv* env) { int low, up, syn_allow, non_low; int r; OnigCodePoint c; OnigEncoding enc; UChar* p; PFETCH_READY; p = *src; r = 0; non_low = 0; enc = env->enc; syn_allow = IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_INVALID_INTERVAL); if (PEND) { if (syn_allow) return 1; /* "....{" : OK! */ else return ONIGERR_END_PATTERN_AT_LEFT_BRACE; /* "....{" syntax error */ } if (! syn_allow) { c = PPEEK; if (c == ')' || c == '(' || c == '|') { return ONIGERR_END_PATTERN_AT_LEFT_BRACE; } } low = scan_number(&p, end, env->enc); if (low < 0) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; if (low > ONIG_MAX_REPEAT_NUM) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; if (p == *src) { /* can't read low */ if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV)) { /* allow {,n} as {0,n} */ low = 0; non_low = 1; } else goto invalid; } if (PEND) goto invalid; PFETCH(c); if (c == ',') { UChar* prev = p; up = scan_number(&p, end, env->enc); if (up < 0) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; if (up > ONIG_MAX_REPEAT_NUM) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE; if (p == prev) { if (non_low != 0) goto invalid; up = INFINITE_REPEAT; /* {n,} : {n,infinite} */ } } else { if (non_low != 0) goto invalid; PUNFETCH; up = low; /* {n} : exact n times */ r = 2; /* fixed */ } if (PEND) goto invalid; PFETCH(c); if (IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_BRACE_INTERVAL)) { if (c != MC_ESC(env->syntax) || PEND) goto invalid; PFETCH(c); } if (c != '}') goto invalid; if (!IS_INFINITE_REPEAT(up) && low > up) { /* {n,m}+ supported case */ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL)) return ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE; tok->u.repeat.possessive = 1; { int tmp; tmp = low; low = up; up = tmp; } } else tok->u.repeat.possessive = 0; tok->type = TK_INTERVAL; tok->u.repeat.lower = low; tok->u.repeat.upper = up; *src = p; return r; /* 0: normal {n,m}, 2: fixed {n} */ invalid: if (syn_allow) { /* *src = p; */ /* !!! Don't do this line !!! */ return 1; /* OK */ } else return ONIGERR_INVALID_REPEAT_RANGE_PATTERN; } /* \M-, \C-, \c, or \... */ static int fetch_escaped_value_raw(UChar** src, UChar* end, ParseEnv* env, OnigCodePoint* val) { int v; OnigCodePoint c; OnigEncoding enc = env->enc; UChar* p = *src; if (PEND) return ONIGERR_END_PATTERN_AT_ESCAPE; PFETCH_S(c); switch (c) { case 'M': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META)) { if (PEND) return ONIGERR_END_PATTERN_AT_META; PFETCH_S(c); if (c != '-') return ONIGERR_META_CODE_SYNTAX; if (PEND) return ONIGERR_END_PATTERN_AT_META; PFETCH_S(c); if (c == MC_ESC(env->syntax)) { v = fetch_escaped_value_raw(&p, end, env, &c); if (v < 0) return v; } c = ((c & 0xff) | 0x80); } else goto backslash; break; case 'C': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL)) { if (PEND) return ONIGERR_END_PATTERN_AT_CONTROL; PFETCH_S(c); if (c != '-') return ONIGERR_CONTROL_CODE_SYNTAX; goto control; } else goto backslash; case 'c': if (IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_C_CONTROL)) { control: if (PEND) return ONIGERR_END_PATTERN_AT_CONTROL; PFETCH_S(c); if (c == '?') { c = 0177; } else { if (c == MC_ESC(env->syntax)) { v = fetch_escaped_value_raw(&p, end, env, &c); if (v < 0) return v; } c &= 0x9f; } break; } /* fall through */ default: { backslash: c = conv_backslash_value(c, env); } break; } *src = p; *val = c; return 0; } static int fetch_escaped_value(UChar** src, UChar* end, ParseEnv* env, OnigCodePoint* val) { int r; int len; r = fetch_escaped_value_raw(src, end, env, val); if (r != 0) return r; len = ONIGENC_CODE_TO_MBCLEN(env->enc, *val); if (len < 0) return len; return 0; } static int fetch_token(PToken* tok, UChar** src, UChar* end, ParseEnv* env); static OnigCodePoint get_name_end_code_point(OnigCodePoint start) { switch (start) { case '<': return (OnigCodePoint )'>'; break; case '\'': return (OnigCodePoint )'\''; break; case '(': return (OnigCodePoint )')'; break; default: break; } return (OnigCodePoint )0; } enum REF_NUM { IS_NOT_NUM = 0, IS_ABS_NUM = 1, IS_REL_NUM = 2 }; #ifdef USE_BACKREF_WITH_LEVEL /* \k, \k \k, \k \k<-num+n>, \k<-num-n> \k<+num+n>, \k<+num-n> */ static int fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end, UChar** rname_end, ParseEnv* env, int* rback_num, int* rlevel, enum REF_NUM* num_type) { int r, sign, exist_level; int digit_count; OnigCodePoint end_code; OnigCodePoint c; OnigEncoding enc; UChar *name_end; UChar *pnum_head; UChar *p; PFETCH_READY; p = *src; c = 0; enc = env->enc; *rback_num = 0; exist_level = 0; *num_type = IS_NOT_NUM; sign = 1; pnum_head = *src; end_code = get_name_end_code_point(start_code); *rlevel = 0; digit_count = 0; name_end = end; r = 0; if (PEND) { return ONIGERR_EMPTY_GROUP_NAME; } else { PFETCH(c); if (c == end_code) return ONIGERR_EMPTY_GROUP_NAME; if (IS_CODE_DIGIT_ASCII(enc, c)) { *num_type = IS_ABS_NUM; digit_count++; } else if (c == '-') { *num_type = IS_REL_NUM; sign = -1; pnum_head = p; } else if (c == '+') { *num_type = IS_REL_NUM; sign = 1; pnum_head = p; } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } while (!PEND) { name_end = p; PFETCH(c); if (c == end_code || c == ')' || c == '+' || c == '-') { if (*num_type != IS_NOT_NUM && digit_count == 0) r = ONIGERR_INVALID_GROUP_NAME; break; } if (*num_type != IS_NOT_NUM) { if (IS_CODE_DIGIT_ASCII(enc, c)) { digit_count++; } else { r = ONIGERR_INVALID_GROUP_NAME; *num_type = IS_NOT_NUM; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } if (r == 0 && c != end_code) { if (c == '+' || c == '-') { int level; int flag = (c == '-' ? -1 : 1); if (PEND) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; goto end; } PFETCH(c); if (! IS_CODE_DIGIT_ASCII(enc, c)) goto err; PUNFETCH; level = scan_number(&p, end, enc); if (level < 0) return ONIGERR_TOO_BIG_NUMBER; *rlevel = (level * flag); exist_level = 1; if (!PEND) { PFETCH(c); if (c == end_code) goto end; } } err: name_end = end; err2: r = ONIGERR_INVALID_GROUP_NAME; } end: if (r == 0) { if (*num_type != IS_NOT_NUM) { *rback_num = scan_number(&pnum_head, name_end, enc); if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER; else if (*rback_num == 0) { if (*num_type == IS_REL_NUM) goto err2; } *rback_num *= sign; } *rname_end = name_end; *src = p; return (exist_level ? 1 : 0); } else { onig_scan_env_set_error_string(env, r, *src, name_end); return r; } } #endif /* USE_BACKREF_WITH_LEVEL */ /* ref: 0 -> define name (don't allow number name) 1 -> reference name (allow number name) */ static int fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, UChar** rname_end, ParseEnv* env, int* rback_num, enum REF_NUM* num_type, int is_ref) { int r, sign; int digit_count; OnigCodePoint end_code; OnigCodePoint c = 0; OnigEncoding enc = env->enc; UChar *name_end; UChar *pnum_head; UChar *p = *src; *rback_num = 0; end_code = get_name_end_code_point(start_code); digit_count = 0; name_end = end; pnum_head = *src; r = 0; *num_type = IS_NOT_NUM; sign = 1; if (PEND) { return ONIGERR_EMPTY_GROUP_NAME; } else { PFETCH_S(c); if (c == end_code) return ONIGERR_EMPTY_GROUP_NAME; if (IS_CODE_DIGIT_ASCII(enc, c)) { if (is_ref == TRUE) *num_type = IS_ABS_NUM; else { r = ONIGERR_INVALID_GROUP_NAME; } digit_count++; } else if (c == '-') { if (is_ref == TRUE) { *num_type = IS_REL_NUM; sign = -1; pnum_head = p; } else { r = ONIGERR_INVALID_GROUP_NAME; } } else if (c == '+') { if (is_ref == TRUE) { *num_type = IS_REL_NUM; sign = 1; pnum_head = p; } else { r = ONIGERR_INVALID_GROUP_NAME; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } if (r == 0) { while (!PEND) { name_end = p; PFETCH_S(c); if (c == end_code || c == ')') { if (*num_type != IS_NOT_NUM && digit_count == 0) r = ONIGERR_INVALID_GROUP_NAME; break; } if (*num_type != IS_NOT_NUM) { if (IS_CODE_DIGIT_ASCII(enc, c)) { digit_count++; } else { if (!ONIGENC_IS_CODE_WORD(enc, c)) r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; else r = ONIGERR_INVALID_GROUP_NAME; *num_type = IS_NOT_NUM; } } else { if (!ONIGENC_IS_CODE_WORD(enc, c)) { r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME; } } } if (c != end_code) { r = ONIGERR_INVALID_GROUP_NAME; goto err; } if (*num_type != IS_NOT_NUM) { *rback_num = scan_number(&pnum_head, name_end, enc); if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER; else if (*rback_num == 0) { if (*num_type == IS_REL_NUM) { r = ONIGERR_INVALID_GROUP_NAME; goto err; } } *rback_num *= sign; } *rname_end = name_end; *src = p; return 0; } else { while (!PEND) { name_end = p; PFETCH_S(c); if (c == end_code || c == ')') break; } if (PEND) name_end = end; err: onig_scan_env_set_error_string(env, r, *src, name_end); return r; } } static void CC_ESC_WARN(ParseEnv* env, UChar *c) { if (onig_warn == onig_null_warn) return ; if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_CC_OP_NOT_ESCAPED) && IS_SYNTAX_BV(env->syntax, ONIG_SYN_BACKSLASH_ESCAPE_IN_CC)) { UChar buf[WARN_BUFSIZE]; onig_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc, env->pattern, env->pattern_end, "character class has '%s' without escape", c); (*onig_warn)((char* )buf); } } static void CLOSE_BRACKET_WITHOUT_ESC_WARN(ParseEnv* env, UChar* c) { if (onig_warn == onig_null_warn) return ; if (IS_SYNTAX_BV((env)->syntax, ONIG_SYN_WARN_CC_OP_NOT_ESCAPED)) { UChar buf[WARN_BUFSIZE]; onig_snprintf_with_pattern(buf, WARN_BUFSIZE, (env)->enc, (env)->pattern, (env)->pattern_end, "regular expression has '%s' without escape", c); (*onig_warn)((char* )buf); } } static UChar* find_str_position(OnigCodePoint s[], int n, UChar* from, UChar* to, UChar **next, OnigEncoding enc) { int i; OnigCodePoint x; UChar *q; UChar *p = from; while (p < to) { x = ONIGENC_MBC_TO_CODE(enc, p, to); q = p + enclen(enc, p); if (x == s[0]) { for (i = 1; i < n && q < to; i++) { x = ONIGENC_MBC_TO_CODE(enc, q, to); if (x != s[i]) break; q += enclen(enc, q); } if (i >= n) { if (IS_NOT_NULL(next)) *next = q; return p; } } p = q; } return NULL_UCHARP; } static int is_head_of_bre_subexp(UChar* p, UChar* end, OnigEncoding enc, ParseEnv* env) { UChar* start; OnigCodePoint code; start = env->pattern; if (p > start) { p = onigenc_get_prev_char_head(enc, start, p); if (p > start) { code = ONIGENC_MBC_TO_CODE(enc, p, end); if (code == '(' || (code == '|' && IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_VBAR_ALT))) { p = onigenc_get_prev_char_head(enc, start, p); code = ONIGENC_MBC_TO_CODE(enc, p, end); if (IS_MC_ESC_CODE(code, env->syntax)) { int count = 0; while (p > start) { p = onigenc_get_prev_char_head(enc, start, p); code = ONIGENC_MBC_TO_CODE(enc, p, end); if (! IS_MC_ESC_CODE(code, env->syntax)) break; count++; } return (count % 2 == 0); } } } return FALSE; } else { return TRUE; } } static int is_end_of_bre_subexp(UChar* p, UChar* end, OnigEncoding enc, ParseEnv* env) { OnigCodePoint code; if (p == end) return TRUE; code = ONIGENC_MBC_TO_CODE(enc, p, end); if (IS_MC_ESC_CODE(code, env->syntax)) { p += ONIGENC_MBC_ENC_LEN(enc, p); if (p < end) { code = ONIGENC_MBC_TO_CODE(enc, p, end); if (code == ')' || (code == '|' && IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_VBAR_ALT))) return TRUE; } } return FALSE; } static int is_posix_bracket_start(UChar* from, UChar* to, OnigEncoding enc) { int n; OnigCodePoint x; UChar *p; n = 0; p = from; while (p < to) { x = ONIGENC_MBC_TO_CODE(enc, p, to); p += enclen(enc, p); if (x == ':') { if (p < to) { x = ONIGENC_MBC_TO_CODE(enc, p, to); if (x == ']') { if (n == 0) return FALSE; else return TRUE; } } return FALSE; } else if (x == '^' && n == 0) { ; } else if (! ONIGENC_IS_CODE_ALPHA(enc, x)) { break; } n += 1; } return FALSE; } static int fetch_token_cc(PToken* tok, UChar** src, UChar* end, ParseEnv* env, int state) { int r; OnigCodePoint code; OnigCodePoint c, c2; int mindigits, maxdigits; OnigSyntaxType* syn; OnigEncoding enc; UChar* prev; UChar* p; PFETCH_READY; p = *src; enc = env->enc; syn = env->syntax; if (tok->code_point_continue != 0) { r = get_next_code_point(&p, end, tok->base_num, enc, TRUE, &code); if (r == 1) { tok->code_point_continue = 0; } else if (r == 2) { tok->type = TK_CC_RANGE; goto end; } else if (r == 0) { tok->type = TK_CODE_POINT; tok->u.code = code; goto end; } else return r; /* error */ } if (PEND) { tok->type = TK_EOT; return tok->type; } PFETCH(c); tok->type = TK_CHAR; tok->base_num = 0; tok->u.code = c; tok->escaped = 0; if (c == ']') { tok->type = TK_CC_CLOSE; } else if (c == '-') { tok->type = TK_CC_RANGE; } else if (c == MC_ESC(syn)) { if (! IS_SYNTAX_BV(syn, ONIG_SYN_BACKSLASH_ESCAPE_IN_CC)) goto end; if (PEND) return ONIGERR_END_PATTERN_AT_ESCAPE; PFETCH(c); tok->escaped = 1; tok->u.code = c; switch (c) { case 'w': tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_WORD; tok->u.prop.not = 0; break; case 'W': tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_WORD; tok->u.prop.not = 1; break; case 'd': tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; tok->u.prop.not = 0; break; case 'D': tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; tok->u.prop.not = 1; break; case 's': tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; tok->u.prop.not = 0; break; case 'S': tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; tok->u.prop.not = 1; break; case 'h': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_H_XDIGIT)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; tok->u.prop.not = 0; break; case 'H': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_H_XDIGIT)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; tok->u.prop.not = 1; break; case 'p': case 'P': if (PEND) break; c2 = PPEEK; if (c2 == '{' && IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY)) { PINC; tok->type = TK_CHAR_PROPERTY; tok->u.prop.not = c == 'P'; if (!PEND && IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT)) { PFETCH(c2); if (c2 == '^') { tok->u.prop.not = tok->u.prop.not == 0; } else PUNFETCH; } } break; case 'o': if (PEND) break; prev = p; if (PPEEK_IS('{') && IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_O_BRACE_OCTAL)) { PINC; r = scan_octal_number(&p, end, 0, 11, enc, &code); if (r < 0) return r; if (!PEND) { c2 = PPEEK; if (IS_CODE_DIGIT_ASCII(enc, c2)) return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } tok->base_num = 8; goto brace_code_point_entry; } break; case 'x': if (PEND) break; prev = p; if (PPEEK_IS('{') && IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_BRACE_HEX8)) { PINC; r = scan_hexadecimal_number(&p, end, 0, 8, enc, &code); if (r < 0) return r; if (!PEND) { c2 = PPEEK; if (IS_CODE_XDIGIT_ASCII(enc, c2)) return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } tok->base_num = 16; brace_code_point_entry: if ((p > prev + enclen(enc, prev))) { if (PEND) return ONIGERR_INVALID_CODE_POINT_VALUE; if (PPEEK_IS('}')) { PINC; } else { int curr_state; curr_state = (state == CS_RANGE) ? CPS_EMPTY : CPS_START; r = check_code_point_sequence_cc(p, end, tok->base_num, enc, curr_state); if (r < 0) return r; if (r == 0) return ONIGERR_INVALID_CODE_POINT_VALUE; tok->code_point_continue = TRUE; } tok->type = TK_CODE_POINT; tok->u.code = code; } else { /* can't read nothing or invalid format */ p = prev; } } else if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_HEX2)) { r = scan_hexadecimal_number(&p, end, 0, 2, enc, &code); if (r < 0) return r; if (p == prev) { /* can't read nothing. */ code = 0; /* but, it's not error */ } tok->type = TK_CRUDE_BYTE; tok->base_num = 16; tok->u.byte = (UChar )code; } break; case 'u': if (PEND) break; prev = p; if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_U_HEX4)) { mindigits = maxdigits = 4; u_hex_digits: r = scan_hexadecimal_number(&p, end, mindigits, maxdigits, enc, &code); if (r < 0) return r; if (p == prev) { /* can't read nothing. */ code = 0; /* but, it's not error */ } tok->type = TK_CODE_POINT; tok->base_num = 16; tok->u.code = code; } break; case 'U': if (PEND) break; prev = p; if (IS_SYNTAX_BV(syn, ONIG_SYN_PYTHON)) { mindigits = maxdigits = 8; goto u_hex_digits; } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_OCTAL3)) { PUNFETCH; prev = p; r = scan_octal_number(&p, end, 0, 3, enc, &code); if (r < 0) return r; if (code >= 256) return ONIGERR_TOO_BIG_NUMBER; if (p == prev) { /* can't read nothing. */ code = 0; /* but, it's not error */ } tok->type = TK_CRUDE_BYTE; tok->base_num = 8; tok->u.byte = (UChar )code; } break; default: PUNFETCH; r = fetch_escaped_value(&p, end, env, &c2); if (r < 0) return r; if (tok->u.code != c2) { tok->u.code = c2; tok->type = TK_CODE_POINT; } break; } } else if (c == '[') { if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_POSIX_BRACKET) && (PPEEK_IS(':'))) { tok->backp = p; /* point at '[' is read */ PINC; if (is_posix_bracket_start(p, end, enc)) { tok->type = TK_CC_POSIX_BRACKET_OPEN; } else { PUNFETCH; goto cc_in_cc; } } else { cc_in_cc: if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_CCLASS_SET_OP)) { tok->type = TK_CC_OPEN_CC; } else { CC_ESC_WARN(env, (UChar* )"["); } } } else if (c == '&') { if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_CCLASS_SET_OP) && !PEND && (PPEEK_IS('&'))) { PINC; tok->type = TK_CC_AND; } } end: *src = p; return tok->type; } static int fetch_token(PToken* tok, UChar** src, UChar* end, ParseEnv* env) { int r; OnigCodePoint code; OnigCodePoint c; int mindigits, maxdigits; UChar* prev; int allow_num; OnigEncoding enc; OnigSyntaxType* syn; UChar* p; PFETCH_READY; enc = env->enc; syn = env->syntax; p = *src; if (tok->code_point_continue != 0) { r = get_next_code_point(&p, end, tok->base_num, enc, FALSE, &code); if (r == 1) { tok->code_point_continue = 0; } else if (r == 0) { tok->type = TK_CODE_POINT; tok->u.code = code; goto out; } else return r; /* error */ } start: if (PEND) { tok->type = TK_EOT; return tok->type; } tok->type = TK_STRING; tok->base_num = 0; tok->backp = p; PFETCH(c); if (IS_MC_ESC_CODE(c, syn)) { if (PEND) return ONIGERR_END_PATTERN_AT_ESCAPE; tok->backp = p; PFETCH(c); tok->u.code = c; tok->escaped = 1; switch (c) { case '*': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF)) break; tok->type = TK_REPEAT; tok->u.repeat.lower = 0; tok->u.repeat.upper = INFINITE_REPEAT; goto greedy_check; break; case '+': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_PLUS_ONE_INF)) break; tok->type = TK_REPEAT; tok->u.repeat.lower = 1; tok->u.repeat.upper = INFINITE_REPEAT; goto greedy_check; break; case '?': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_QMARK_ZERO_ONE)) break; tok->type = TK_REPEAT; tok->u.repeat.lower = 0; tok->u.repeat.upper = 1; greedy_check: tok->u.repeat.possessive = 0; greedy_check2: if (!PEND && PPEEK_IS('?') && IS_SYNTAX_OP(syn, ONIG_SYN_OP_QMARK_NON_GREEDY) && tok->u.repeat.possessive == 0) { PFETCH(c); tok->u.repeat.greedy = 0; tok->u.repeat.possessive = 0; } else { possessive_check: tok->u.repeat.greedy = 1; if (!PEND && PPEEK_IS('+') && ((IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT) && tok->type != TK_INTERVAL) || (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL) && tok->type == TK_INTERVAL)) && tok->u.repeat.possessive == 0) { PFETCH(c); tok->u.repeat.possessive = 1; } } break; case '{': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_BRACE_INTERVAL)) break; r = fetch_interval(&p, end, tok, env); if (r < 0) return r; /* error */ if (r == 0) goto greedy_check2; else if (r == 2) { /* {n} */ if (IS_SYNTAX_BV(syn, ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY)) goto possessive_check; goto greedy_check2; } /* r == 1 : normal char */ break; case '|': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_VBAR_ALT)) break; tok->type = TK_ALT; break; case '(': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_LPAREN_SUBEXP)) break; tok->type = TK_SUBEXP_OPEN; break; case ')': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_LPAREN_SUBEXP)) break; tok->type = TK_SUBEXP_CLOSE; break; case 'w': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_W_WORD)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_WORD; tok->u.prop.not = 0; break; case 'W': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_W_WORD)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_WORD; tok->u.prop.not = 1; break; case 'b': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_B_WORD_BOUND)) break; tok->type = TK_ANCHOR; tok->u.anchor = ANCR_WORD_BOUNDARY; break; case 'B': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_B_WORD_BOUND)) break; tok->type = TK_ANCHOR; tok->u.anchor = ANCR_NO_WORD_BOUNDARY; break; case 'y': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT)) break; tok->type = TK_ANCHOR; tok->u.anchor = ANCR_TEXT_SEGMENT_BOUNDARY; break; case 'Y': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT)) break; tok->type = TK_ANCHOR; tok->u.anchor = ANCR_NO_TEXT_SEGMENT_BOUNDARY; break; #ifdef USE_WORD_BEGIN_END case '<': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END)) break; tok->type = TK_ANCHOR; tok->u.anchor = ANCR_WORD_BEGIN; break; case '>': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END)) break; tok->type = TK_ANCHOR; tok->u.anchor = ANCR_WORD_END; break; #endif case 's': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_S_WHITE_SPACE)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; tok->u.prop.not = 0; break; case 'S': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_S_WHITE_SPACE)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; tok->u.prop.not = 1; break; case 'd': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_D_DIGIT)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; tok->u.prop.not = 0; break; case 'D': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_D_DIGIT)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; tok->u.prop.not = 1; break; case 'h': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_H_XDIGIT)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; tok->u.prop.not = 0; break; case 'H': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_H_XDIGIT)) break; tok->type = TK_CHAR_TYPE; tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; tok->u.prop.not = 1; break; case 'K': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP)) break; tok->type = TK_KEEP; break; case 'R': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE)) break; tok->type = TK_GENERAL_NEWLINE; break; case 'N': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT)) break; tok->type = TK_NO_NEWLINE; break; case 'O': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT)) break; tok->type = TK_TRUE_ANYCHAR; break; case 'X': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT)) break; tok->type = TK_TEXT_SEGMENT; break; case 'A': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR)) break; begin_buf: tok->type = TK_ANCHOR; tok->u.subtype = ANCR_BEGIN_BUF; break; case 'Z': if (IS_SYNTAX_BV(syn, ONIG_SYN_PYTHON)) { goto end_buf; } else { if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR)) break; tok->type = TK_ANCHOR; tok->u.subtype = ANCR_SEMI_END_BUF; } break; case 'z': if (IS_SYNTAX_BV(syn, ONIG_SYN_PYTHON)) return ONIGERR_UNDEFINED_OPERATOR; if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR)) break; end_buf: tok->type = TK_ANCHOR; tok->u.subtype = ANCR_END_BUF; break; case 'G': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR)) break; tok->type = TK_ANCHOR; tok->u.subtype = ANCR_BEGIN_POSITION; break; case '`': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR)) break; goto begin_buf; break; case '\'': if (! IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR)) break; goto end_buf; break; case 'o': if (PEND) break; prev = p; if (PPEEK_IS('{') && IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_O_BRACE_OCTAL)) { PINC; r = scan_octal_number(&p, end, 0, 11, enc, &code); if (r < 0) return r; if (!PEND) { if (IS_CODE_DIGIT_ASCII(enc, PPEEK)) return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } tok->base_num = 8; goto brace_code_point_entry; } break; case 'x': if (PEND) break; prev = p; if (PPEEK_IS('{') && IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_BRACE_HEX8)) { PINC; r = scan_hexadecimal_number(&p, end, 0, 8, enc, &code); if (r < 0) return r; if (!PEND) { if (IS_CODE_XDIGIT_ASCII(enc, PPEEK)) return ONIGERR_TOO_LONG_WIDE_CHAR_VALUE; } tok->base_num = 16; brace_code_point_entry: if ((p > prev + enclen(enc, prev))) { if (PEND) return ONIGERR_INVALID_CODE_POINT_VALUE; if (PPEEK_IS('}')) { PINC; } else { r = check_code_point_sequence(p, end, tok->base_num, enc); if (r < 0) return r; if (r == 0) return ONIGERR_INVALID_CODE_POINT_VALUE; tok->code_point_continue = TRUE; } tok->type = TK_CODE_POINT; tok->u.code = code; } else { /* can't read nothing or invalid format */ p = prev; } } else if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_X_HEX2)) { r = scan_hexadecimal_number(&p, end, 0, 2, enc, &code); if (r < 0) return r; if (p == prev) { /* can't read nothing. */ code = 0; /* but, it's not error */ } tok->type = TK_CRUDE_BYTE; tok->base_num = 16; tok->u.byte = (UChar )code; } break; case 'u': if (PEND) break; prev = p; mindigits = maxdigits = 4; if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_U_HEX4)) { u_hex_digits: r = scan_hexadecimal_number(&p, end, mindigits, maxdigits, enc, &code); if (r < 0) return r; if (p == prev) { /* can't read nothing. */ code = 0; /* but, it's not error */ } tok->type = TK_CODE_POINT; tok->base_num = 16; tok->u.code = code; } break; case 'U': if (PEND) break; prev = p; if (IS_SYNTAX_BV(syn, ONIG_SYN_PYTHON)) { mindigits = maxdigits = 8; goto u_hex_digits; } break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': PUNFETCH; prev = p; r = scan_number(&p, end, enc); if (r < 0 || r > ONIG_MAX_BACKREF_NUM) { goto skip_backref; } if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_DECIMAL_BACKREF) && (r <= env->num_mem || r <= 9)) { /* This spec. from GNU regex */ if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) { if (r > env->num_mem || IS_NULL(PARSEENV_MEMENV(env)[r].mem_node)) return ONIGERR_INVALID_BACKREF; } tok->type = TK_BACKREF; tok->u.backref.num = 1; tok->u.backref.ref1 = r; tok->u.backref.by_name = 0; #ifdef USE_BACKREF_WITH_LEVEL tok->u.backref.exist_level = 0; tok->u.backref.level = 0; #endif break; } skip_backref: if (c == '8' || c == '9') { /* normal char */ p = prev; PINC; break; } p = prev; /* fall through */ case '0': if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_OCTAL3)) { prev = p; r = scan_octal_number(&p, end, 0, (c == '0' ? 2:3), enc, &code); if (r < 0 || r >= 256) return ONIGERR_TOO_BIG_NUMBER; if (p == prev) { /* can't read nothing. */ code = 0; /* but, it's not error */ } tok->type = TK_CRUDE_BYTE; tok->base_num = 8; tok->u.byte = (UChar )code; } else if (c != '0') { PINC; } break; case 'k': if (!PEND && IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_K_NAMED_BACKREF)) { PFETCH(c); if (c == '<' || c == '\'') { UChar* name_end; int* backs; int back_num; enum REF_NUM num_type; allow_num = 1; backref_start: prev = p; #ifdef USE_BACKREF_WITH_LEVEL name_end = NULL_UCHARP; /* no need. escape gcc warning. */ r = fetch_name_with_level((OnigCodePoint )c, &p, end, &name_end, env, &back_num, &tok->u.backref.level, &num_type); if (r == 1) tok->u.backref.exist_level = 1; else tok->u.backref.exist_level = 0; #else r = fetch_name(c, &p, end, &name_end, env, &back_num, &num_type, TRUE); #endif if (r < 0) return r; if (num_type != IS_NOT_NUM) { if (allow_num == 0) return ONIGERR_INVALID_BACKREF; if (num_type == IS_REL_NUM) { back_num = backref_rel_to_abs(back_num, env); } if (back_num <= 0) return ONIGERR_INVALID_BACKREF; if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) { if (back_num > env->num_mem || IS_NULL(PARSEENV_MEMENV(env)[back_num].mem_node)) return ONIGERR_INVALID_BACKREF; } tok->type = TK_BACKREF; tok->u.backref.by_name = 0; tok->u.backref.num = 1; tok->u.backref.ref1 = back_num; } else { int num = name_to_group_numbers(env, prev, name_end, &backs); if (num <= 0) { return ONIGERR_UNDEFINED_NAME_REFERENCE; } if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) { int i; for (i = 0; i < num; i++) { if (backs[i] > env->num_mem || IS_NULL(PARSEENV_MEMENV(env)[backs[i]].mem_node)) return ONIGERR_INVALID_BACKREF; } } tok->type = TK_BACKREF; tok->u.backref.by_name = 1; if (num == 1) { tok->u.backref.num = 1; tok->u.backref.ref1 = backs[0]; } else { tok->u.backref.num = num; tok->u.backref.refs = backs; } } } else PUNFETCH; } break; #ifdef USE_CALL case 'g': if (!PEND && IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_G_SUBEXP_CALL)) { PFETCH(c); if (c == '<' || c == '\'') { int gnum; UChar* name_end; enum REF_NUM num_type; allow_num = 1; call_start: prev = p; r = fetch_name((OnigCodePoint )c, &p, end, &name_end, env, &gnum, &num_type, TRUE); if (r < 0) return r; if (num_type != IS_NOT_NUM) { if (allow_num == 0) return ONIGERR_UNDEFINED_GROUP_REFERENCE; if (num_type == IS_REL_NUM) { gnum = backref_rel_to_abs(gnum, env); if (gnum < 0) { onig_scan_env_set_error_string(env, ONIGERR_UNDEFINED_NAME_REFERENCE, prev, name_end); return ONIGERR_UNDEFINED_GROUP_REFERENCE; } } tok->u.call.by_number = 1; tok->u.call.gnum = gnum; } else { tok->u.call.by_number = 0; tok->u.call.gnum = 0; } tok->type = TK_CALL; tok->u.call.name = prev; tok->u.call.name_end = name_end; } else PUNFETCH; } break; #endif case 'Q': if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE)) { tok->type = TK_QUOTE_OPEN; } break; case 'p': case 'P': if (!PEND && PPEEK_IS('{') && IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY)) { PINC; tok->type = TK_CHAR_PROPERTY; tok->u.prop.not = c == 'P'; if (!PEND && IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT)) { PFETCH(c); if (c == '^') { tok->u.prop.not = tok->u.prop.not == 0; } else PUNFETCH; } } break; default: { OnigCodePoint c2; PUNFETCH; r = fetch_escaped_value(&p, end, env, &c2); if (r < 0) return r; if (tok->u.code != c2) { tok->type = TK_CODE_POINT; tok->u.code = c2; } else { /* string */ p = tok->backp + enclen(enc, tok->backp); } } break; } } else { tok->u.code = c; tok->escaped = 0; #ifdef USE_VARIABLE_META_CHARS if ((c != ONIG_INEFFECTIVE_META_CHAR) && IS_SYNTAX_OP(syn, ONIG_SYN_OP_VARIABLE_META_CHARACTERS)) { if (c == MC_ANYCHAR(syn)) goto any_char; else if (c == MC_ANYTIME(syn)) goto any_time; else if (c == MC_ZERO_OR_ONE_TIME(syn)) goto zero_or_one_time; else if (c == MC_ONE_OR_MORE_TIME(syn)) goto one_or_more_time; else if (c == MC_ANYCHAR_ANYTIME(syn)) { tok->type = TK_ANYCHAR_ANYTIME; goto out; } } #endif switch (c) { case '.': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_DOT_ANYCHAR)) break; #ifdef USE_VARIABLE_META_CHARS any_char: #endif tok->type = TK_ANYCHAR; break; case '*': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ASTERISK_ZERO_INF)) break; #ifdef USE_VARIABLE_META_CHARS any_time: #endif tok->type = TK_REPEAT; tok->u.repeat.lower = 0; tok->u.repeat.upper = INFINITE_REPEAT; goto greedy_check; break; case '+': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_PLUS_ONE_INF)) break; #ifdef USE_VARIABLE_META_CHARS one_or_more_time: #endif tok->type = TK_REPEAT; tok->u.repeat.lower = 1; tok->u.repeat.upper = INFINITE_REPEAT; goto greedy_check; break; case '?': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_QMARK_ZERO_ONE)) break; #ifdef USE_VARIABLE_META_CHARS zero_or_one_time: #endif tok->type = TK_REPEAT; tok->u.repeat.lower = 0; tok->u.repeat.upper = 1; goto greedy_check; break; case '{': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_BRACE_INTERVAL)) break; r = fetch_interval(&p, end, tok, env); if (r < 0) return r; /* error */ if (r == 0) goto greedy_check2; else if (r == 2) { /* {n} */ if (IS_SYNTAX_BV(syn, ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY)) goto possessive_check; goto greedy_check2; } /* r == 1 : normal char */ break; case '|': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_VBAR_ALT)) break; tok->type = TK_ALT; break; case '(': if (!PEND && PPEEK_IS('?') && IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_QMARK_GROUP_EFFECT)) { prev = p; PINC; if (! PEND) { c = PPEEK; if (c == '#') { PFETCH(c); while (1) { if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); if (c == MC_ESC(syn)) { if (! PEND) PFETCH(c); } else { if (c == ')') break; } } goto start; } else if (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL)) { int gnum; UChar* name; UChar* name_end; enum REF_NUM num_type; switch (c) { case '&': { PINC; name = p; r = fetch_name((OnigCodePoint )'(', &p, end, &name_end, env, &gnum, &num_type, FALSE); if (r < 0) return r; tok->type = TK_CALL; tok->u.call.by_number = 0; tok->u.call.gnum = 0; tok->u.call.name = name; tok->u.call.name_end = name_end; } break; case 'R': tok->type = TK_CALL; tok->u.call.by_number = 1; tok->u.call.gnum = 0; tok->u.call.name = p; PINC; if (! PPEEK_IS(')')) return ONIGERR_UNDEFINED_GROUP_OPTION; tok->u.call.name_end = p; break; case '-': case '+': if (! PEND) { PINC; if (! PEND) { c = PPEEK; if (ONIGENC_IS_CODE_DIGIT(enc, c)) { PUNFETCH; goto lparen_qmark_num; } } } p = prev; goto lparen_qmark_end2; break; default: if (! ONIGENC_IS_CODE_DIGIT(enc, c)) goto lparen_qmark_end; lparen_qmark_num: { name = p; r = fetch_name((OnigCodePoint )'(', &p, end, &name_end, env, &gnum, &num_type, TRUE); if (r < 0) return r; if (num_type == IS_NOT_NUM) { return ONIGERR_INVALID_GROUP_NAME; } else { if (num_type == IS_REL_NUM) { gnum = backref_rel_to_abs(gnum, env); if (gnum < 0) { onig_scan_env_set_error_string(env, ONIGERR_UNDEFINED_NAME_REFERENCE, name, name_end); return ONIGERR_UNDEFINED_GROUP_REFERENCE; } } tok->u.call.by_number = 1; tok->u.call.gnum = gnum; } tok->type = TK_CALL; tok->u.call.name = name; tok->u.call.name_end = name_end; } break; } break; } else if (c == 'P' && IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_CAPITAL_P_NAME)) { PINC; /* skip 'P' */ if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); allow_num = 0; if (c == '=') { c = '('; goto backref_start; } else if (c == '>') { #ifdef USE_CALL c = '('; goto call_start; #else return ONIGERR_UNDEFINED_OPERATOR; #endif } else { p = prev; goto lparen_qmark_end2; } } } lparen_qmark_end: PUNFETCH; } lparen_qmark_end2: if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_LPAREN_SUBEXP)) break; tok->type = TK_SUBEXP_OPEN; break; case ')': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_LPAREN_SUBEXP)) break; tok->type = TK_SUBEXP_CLOSE; break; case '^': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_LINE_ANCHOR)) break; if (IS_SYNTAX_BV(syn, ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP)) { if (! is_head_of_bre_subexp(PPREV, end, enc, env)) break; } tok->type = TK_ANCHOR; tok->u.subtype = (OPTON_SINGLELINE(env->options) ? ANCR_BEGIN_BUF : ANCR_BEGIN_LINE); break; case '$': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_LINE_ANCHOR)) break; if (IS_SYNTAX_BV(syn, ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP)) { if (! is_end_of_bre_subexp(p, end, enc, env)) break; } tok->type = TK_ANCHOR; tok->u.subtype = (OPTON_SINGLELINE(env->options) ? ANCR_SEMI_END_BUF : ANCR_END_LINE); break; case '[': if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_BRACKET_CC)) break; tok->type = TK_OPEN_CC; break; case ']': if (*src > env->pattern) /* /].../ is allowed. */ CLOSE_BRACKET_WITHOUT_ESC_WARN(env, (UChar* )"]"); break; case '#': if (OPTON_EXTEND(env->options)) { while (!PEND) { PFETCH(c); if (ONIGENC_IS_CODE_NEWLINE(enc, c)) break; } goto start; break; } break; case ' ': case '\t': case '\n': case '\r': case '\f': if (OPTON_EXTEND(env->options)) goto start; break; default: /* string */ break; } } out: *src = p; return tok->type; } static int add_ctype_to_cc_by_range(CClassNode* cc, int ctype ARG_UNUSED, int not, OnigEncoding enc ARG_UNUSED, OnigCodePoint sb_out, const OnigCodePoint mbr[]) { int i, r; OnigCodePoint j; int n = ONIGENC_CODE_RANGE_NUM(mbr); if (not == 0) { for (i = 0; i < n; i++) { for (j = ONIGENC_CODE_RANGE_FROM(mbr, i); j <= ONIGENC_CODE_RANGE_TO(mbr, i); j++) { if (j >= sb_out) { if (j > ONIGENC_CODE_RANGE_FROM(mbr, i)) { r = add_code_range_to_buf(&(cc->mbuf), j, ONIGENC_CODE_RANGE_TO(mbr, i)); if (r != 0) return r; i++; } goto sb_end; } BITSET_SET_BIT(cc->bs, j); } } sb_end: for ( ; i < n; i++) { r = add_code_range_to_buf(&(cc->mbuf), ONIGENC_CODE_RANGE_FROM(mbr, i), ONIGENC_CODE_RANGE_TO(mbr, i)); if (r != 0) return r; } } else { OnigCodePoint prev = 0; for (i = 0; i < n; i++) { for (j = prev; j < ONIGENC_CODE_RANGE_FROM(mbr, i); j++) { if (j >= sb_out) { goto sb_end2; } BITSET_SET_BIT(cc->bs, j); } prev = ONIGENC_CODE_RANGE_TO(mbr, i) + 1; } for (j = prev; j < sb_out; j++) { BITSET_SET_BIT(cc->bs, j); } sb_end2: prev = sb_out; for (i = 0; i < n; i++) { if (prev < ONIGENC_CODE_RANGE_FROM(mbr, i)) { r = add_code_range_to_buf(&(cc->mbuf), prev, ONIGENC_CODE_RANGE_FROM(mbr, i) - 1); if (r != 0) return r; } prev = ONIGENC_CODE_RANGE_TO(mbr, i) + 1; if (prev == 0) goto end; } r = add_code_range_to_buf(&(cc->mbuf), prev, MAX_CODE_POINT); if (r != 0) return r; } end: return 0; } static int add_ctype_to_cc_by_range_limit(CClassNode* cc, int ctype ARG_UNUSED, int not, OnigEncoding enc ARG_UNUSED, OnigCodePoint sb_out, const OnigCodePoint mbr[], OnigCodePoint limit) { int i, r; OnigCodePoint j; OnigCodePoint from; OnigCodePoint to; int n = ONIGENC_CODE_RANGE_NUM(mbr); if (not == 0) { for (i = 0; i < n; i++) { for (j = ONIGENC_CODE_RANGE_FROM(mbr, i); j <= ONIGENC_CODE_RANGE_TO(mbr, i); j++) { if (j > limit) goto end; if (j >= sb_out) { if (j > ONIGENC_CODE_RANGE_FROM(mbr, i)) { to = ONIGENC_CODE_RANGE_TO(mbr, i); if (to > limit) to = limit; r = add_code_range_to_buf(&(cc->mbuf), j, to); if (r != 0) return r; i++; } goto sb_end; } BITSET_SET_BIT(cc->bs, j); } } sb_end: for ( ; i < n; i++) { from = ONIGENC_CODE_RANGE_FROM(mbr, i); to = ONIGENC_CODE_RANGE_TO(mbr, i); if (from > limit) break; if (to > limit) to = limit; r = add_code_range_to_buf(&(cc->mbuf), from, to); if (r != 0) return r; } } else { OnigCodePoint prev = 0; for (i = 0; i < n; i++) { from = ONIGENC_CODE_RANGE_FROM(mbr, i); if (from > limit) { for (j = prev; j < sb_out; j++) { BITSET_SET_BIT(cc->bs, j); } goto sb_end2; } for (j = prev; j < from; j++) { if (j >= sb_out) goto sb_end2; BITSET_SET_BIT(cc->bs, j); } prev = ONIGENC_CODE_RANGE_TO(mbr, i); if (prev > limit) prev = limit; prev++; if (prev == 0) goto end; } for (j = prev; j < sb_out; j++) { BITSET_SET_BIT(cc->bs, j); } sb_end2: prev = sb_out; for (i = 0; i < n; i++) { from = ONIGENC_CODE_RANGE_FROM(mbr, i); if (from > limit) goto last; if (prev < from) { r = add_code_range_to_buf(&(cc->mbuf), prev, from - 1); if (r != 0) return r; } prev = ONIGENC_CODE_RANGE_TO(mbr, i); if (prev > limit) prev = limit; prev++; if (prev == 0) goto end; } last: r = add_code_range_to_buf(&(cc->mbuf), prev, MAX_CODE_POINT); if (r != 0) return r; } end: return 0; } static int add_ctype_to_cc(CClassNode* cc, int ctype, int not, ParseEnv* env) { int c, r; int ascii_mode; int is_single; const OnigCodePoint *ranges; OnigCodePoint limit; OnigCodePoint sb_out; OnigEncoding enc = env->enc; ascii_mode = OPTON_IS_ASCII_MODE_CTYPE(ctype, env->options); r = ONIGENC_GET_CTYPE_CODE_RANGE(enc, ctype, &sb_out, &ranges); if (r == 0) { if (ascii_mode == 0) r = add_ctype_to_cc_by_range(cc, ctype, not, env->enc, sb_out, ranges); else r = add_ctype_to_cc_by_range_limit(cc, ctype, not, env->enc, sb_out, ranges, ASCII_LIMIT); return r; } else if (r != ONIG_NO_SUPPORT_CONFIG) { return r; } r = 0; is_single = ONIGENC_IS_SINGLEBYTE(enc); limit = ascii_mode ? ASCII_LIMIT : SINGLE_BYTE_SIZE; switch (ctype) { case ONIGENC_CTYPE_ALPHA: case ONIGENC_CTYPE_BLANK: case ONIGENC_CTYPE_CNTRL: case ONIGENC_CTYPE_DIGIT: case ONIGENC_CTYPE_LOWER: case ONIGENC_CTYPE_PUNCT: case ONIGENC_CTYPE_SPACE: case ONIGENC_CTYPE_UPPER: case ONIGENC_CTYPE_XDIGIT: case ONIGENC_CTYPE_ASCII: case ONIGENC_CTYPE_ALNUM: if (not != 0) { for (c = 0; c < (int )limit; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) { if (! ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } } for (c = limit; c < SINGLE_BYTE_SIZE; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) BITSET_SET_BIT(cc->bs, c); } if (is_single == 0) ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf); } else { for (c = 0; c < (int )limit; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) { if (ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } } } break; case ONIGENC_CTYPE_GRAPH: case ONIGENC_CTYPE_PRINT: case ONIGENC_CTYPE_WORD: if (not != 0) { for (c = 0; c < (int )limit; c++) { /* check invalid code point */ if ((is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) && ! ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } for (c = limit; c < SINGLE_BYTE_SIZE; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) BITSET_SET_BIT(cc->bs, c); } if (ascii_mode != 0 && is_single == 0) ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf); } else { for (c = 0; c < (int )limit; c++) { if ((is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) && ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } if (ascii_mode == 0 && is_single == 0) ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf); } break; default: return ONIGERR_PARSER_BUG; break; } return r; } static int prs_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ParseEnv* env) { static PosixBracketEntryType PBS[] = { { (UChar* )"alnum", ONIGENC_CTYPE_ALNUM, 5 }, { (UChar* )"alpha", ONIGENC_CTYPE_ALPHA, 5 }, { (UChar* )"blank", ONIGENC_CTYPE_BLANK, 5 }, { (UChar* )"cntrl", ONIGENC_CTYPE_CNTRL, 5 }, { (UChar* )"digit", ONIGENC_CTYPE_DIGIT, 5 }, { (UChar* )"graph", ONIGENC_CTYPE_GRAPH, 5 }, { (UChar* )"lower", ONIGENC_CTYPE_LOWER, 5 }, { (UChar* )"print", ONIGENC_CTYPE_PRINT, 5 }, { (UChar* )"punct", ONIGENC_CTYPE_PUNCT, 5 }, { (UChar* )"space", ONIGENC_CTYPE_SPACE, 5 }, { (UChar* )"upper", ONIGENC_CTYPE_UPPER, 5 }, { (UChar* )"xdigit", ONIGENC_CTYPE_XDIGIT, 6 }, { (UChar* )"ascii", ONIGENC_CTYPE_ASCII, 5 }, { (UChar* )"word", ONIGENC_CTYPE_WORD, 4 }, { (UChar* )NULL, -1, 0 } }; PosixBracketEntryType *pb; int not, r; OnigEncoding enc = env->enc; UChar *p = *src; if (PPEEK_IS('^')) { PINC_S; not = 1; } else not = 0; for (pb = PBS; IS_NOT_NULL(pb->name); pb++) { if (onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0) { p = (UChar* )onigenc_step(enc, p, end, pb->len); if (onigenc_with_ascii_strncmp(enc, p, end, (UChar* )":]", 2) != 0) break; r = add_ctype_to_cc(cc, pb->ctype, not, env); if (r != 0) return r; PINC_S; PINC_S; *src = p; return 0; } } return ONIGERR_INVALID_POSIX_BRACKET_TYPE; } static int fetch_char_property_to_ctype(UChar** src, UChar* end, ParseEnv* env) { int r; OnigCodePoint c; OnigEncoding enc; UChar *prev, *start, *p; p = *src; enc = env->enc; r = ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS; start = prev = p; while (!PEND) { prev = p; PFETCH_S(c); if (c == '}') { r = ONIGENC_PROPERTY_NAME_TO_CTYPE(enc, start, prev); if (r >= 0) { *src = p; } else { onig_scan_env_set_error_string(env, r, *src, prev); } return r; } else if (c == '(' || c == ')' || c == '{' || c == '|') { break; } } return r; } static int prs_char_property(Node** np, PToken* tok, UChar** src, UChar* end, ParseEnv* env) { int r, ctype; CClassNode* cc; ctype = fetch_char_property_to_ctype(src, end, env); if (ctype < 0) return ctype; if (ctype == ONIGENC_CTYPE_WORD) { *np = node_new_ctype(ctype, tok->u.prop.not, env->options); CHECK_NULL_RETURN_MEMERR(*np); return 0; } *np = node_new_cclass(); CHECK_NULL_RETURN_MEMERR(*np); cc = CCLASS_(*np); r = add_ctype_to_cc(cc, ctype, FALSE, env); if (r != 0) return r; if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc); return 0; } static int cc_cprop_next(CClassNode* cc, OnigCodePoint* pcode, CVAL* val, CSTATE* state, ParseEnv* env) { int r; if (*state == CS_RANGE) return ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE; if (*state == CS_VALUE) { if (*val == CV_SB) BITSET_SET_BIT(cc->bs, (int )(*pcode)); else if (*val == CV_MB) { r = add_code_range(&(cc->mbuf), env, *pcode, *pcode); if (r < 0) return r; } } *state = CS_VALUE; *val = CV_CPROP; return 0; } static int cc_char_next(CClassNode* cc, OnigCodePoint *from, OnigCodePoint to, int* from_raw, int to_raw, CVAL intype, CVAL* type, CSTATE* state, ParseEnv* env) { int r; switch (*state) { case CS_VALUE: if (*type == CV_SB) { if (*from > 0xff) return ONIGERR_INVALID_CODE_POINT_VALUE; BITSET_SET_BIT(cc->bs, (int )(*from)); } else if (*type == CV_MB) { r = add_code_range(&(cc->mbuf), env, *from, *from); if (r < 0) return r; } break; case CS_RANGE: if (intype == *type) { if (intype == CV_SB) { if (*from > 0xff || to > 0xff) return ONIGERR_INVALID_CODE_POINT_VALUE; if (*from > to) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC)) goto ccs_range_end; else return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS; } bitset_set_range(cc->bs, (int )*from, (int )to); } else { r = add_code_range(&(cc->mbuf), env, *from, to); if (r < 0) return r; } } else { if (*from > to) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC)) goto ccs_range_end; else return ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS; } bitset_set_range(cc->bs, (int )*from, (int )(to < 0xff ? to : 0xff)); r = add_code_range(&(cc->mbuf), env, (OnigCodePoint )*from, to); if (r < 0) return r; } ccs_range_end: *state = CS_COMPLETE; break; case CS_COMPLETE: case CS_START: *state = CS_VALUE; break; default: break; } *from_raw = to_raw; *from = to; *type = intype; return 0; } static int code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped, ParseEnv* env) { int in_esc; OnigCodePoint code; OnigEncoding enc = env->enc; UChar* p = from; in_esc = 0; while (! PEND) { if (ignore_escaped && in_esc) { in_esc = 0; } else { PFETCH_S(code); if (code == c) return 1; if (code == MC_ESC(env->syntax)) in_esc = 1; } } return 0; } static int prs_cc(Node** np, PToken* tok, UChar** src, UChar* end, ParseEnv* env) { int r, neg, len, fetched, and_start; OnigCodePoint in_code, curr_code; UChar *p; Node* node; CClassNode *cc, *prev_cc; CClassNode work_cc; int curr_raw, in_raw; CSTATE state; CVAL in_type; CVAL curr_type; *np = NULL_NODE; INC_PARSE_DEPTH(env->parse_depth); state = CS_START; prev_cc = (CClassNode* )NULL; r = fetch_token_cc(tok, src, end, env, state); if (r == TK_CHAR && tok->u.code == (OnigCodePoint )'^' && tok->escaped == 0) { neg = 1; r = fetch_token_cc(tok, src, end, env, state); } else { neg = 0; } if (r < 0) return r; if (r == TK_CC_CLOSE) { if (! code_exist_check((OnigCodePoint )']', *src, env->pattern_end, 1, env)) return ONIGERR_EMPTY_CHAR_CLASS; CC_ESC_WARN(env, (UChar* )"]"); r = tok->type = TK_CHAR; /* allow []...] */ } *np = node = node_new_cclass(); CHECK_NULL_RETURN_MEMERR(node); cc = CCLASS_(node); and_start = 0; curr_type = CV_UNDEF; p = *src; while (r != TK_CC_CLOSE) { fetched = 0; switch (r) { case TK_CHAR: any_char_in: len = ONIGENC_CODE_TO_MBCLEN(env->enc, tok->u.code); if (len < 0) { r = len; goto err; } in_type = (len == 1) ? CV_SB : CV_MB; in_code = tok->u.code; in_raw = 0; goto val_entry2; break; case TK_CRUDE_BYTE: /* tok->base_num != 0 : octal or hexadec. */ if (! ONIGENC_IS_SINGLEBYTE(env->enc) && tok->base_num != 0) { int i, j; UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN]; UChar* bufe = buf + ONIGENC_CODE_TO_MBC_MAXLEN; UChar* psave = p; int base_num = tok->base_num; buf[0] = tok->u.byte; for (i = 1; i < ONIGENC_MBC_MAXLEN(env->enc); i++) { r = fetch_token_cc(tok, &p, end, env, CS_COMPLETE); if (r < 0) goto err; if (r != TK_CRUDE_BYTE || tok->base_num != base_num) { fetched = 1; break; } buf[i] = tok->u.byte; } if (i < ONIGENC_MBC_MINLEN(env->enc)) { r = ONIGERR_TOO_SHORT_MULTI_BYTE_STRING; goto err; } /* clear buf tail */ for (j = i; j < ONIGENC_CODE_TO_MBC_MAXLEN; j++) buf[j] = '\0'; len = enclen(env->enc, buf); if (i < len) { r = ONIGERR_TOO_SHORT_MULTI_BYTE_STRING; goto err; } else if (i > len) { /* fetch back */ p = psave; for (i = 1; i < len; i++) { r = fetch_token_cc(tok, &p, end, env, CS_COMPLETE); if (r < 0) goto err; } fetched = 0; } if (i == 1) { in_code = (OnigCodePoint )buf[0]; goto crude_single; } else { if (! ONIGENC_IS_VALID_MBC_STRING(env->enc, buf, buf + len)) { r = ONIGERR_INVALID_WIDE_CHAR_VALUE; goto err; } in_code = ONIGENC_MBC_TO_CODE(env->enc, buf, bufe); in_type = CV_MB; } } else { in_code = (OnigCodePoint )tok->u.byte; crude_single: in_type = CV_SB; } in_raw = 1; goto val_entry2; break; case TK_CODE_POINT: in_code = tok->u.code; in_raw = 1; val_entry: len = ONIGENC_CODE_TO_MBCLEN(env->enc, in_code); if (len < 0) { if (state != CS_RANGE || ! IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC) || in_code < 0x100 || ONIGENC_MBC_MAXLEN(env->enc) == 1) { r = len; goto err; } } in_type = (len == 1 ? CV_SB : CV_MB); val_entry2: r = cc_char_next(cc, &curr_code, in_code, &curr_raw, in_raw, in_type, &curr_type, &state, env); if (r != 0) goto err; break; case TK_CC_POSIX_BRACKET_OPEN: r = prs_posix_bracket(cc, &p, end, env); if (r < 0) goto err; if (r == 1) { /* is not POSIX bracket */ CC_ESC_WARN(env, (UChar* )"["); p = tok->backp; in_code = tok->u.code; in_raw = 0; goto val_entry; } goto next_cprop; break; case TK_CHAR_TYPE: r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not, env); if (r != 0) goto err; next_cprop: r = cc_cprop_next(cc, &curr_code, &curr_type, &state, env); if (r != 0) goto err; break; case TK_CHAR_PROPERTY: { int ctype = fetch_char_property_to_ctype(&p, end, env); if (ctype < 0) { r = ctype; goto err; } r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, env); if (r != 0) goto err; goto next_cprop; } break; case TK_CC_RANGE: if (state == CS_VALUE) { r = fetch_token_cc(tok, &p, end, env, CS_RANGE); if (r < 0) goto err; fetched = 1; if (r == TK_CC_CLOSE) { /* allow [x-] */ range_end_val: in_code = (OnigCodePoint )'-'; in_raw = 0; goto val_entry; } else if (r == TK_CC_AND) { range_end_val_with_warning: CC_ESC_WARN(env, (UChar* )"-"); goto range_end_val; } if (curr_type == CV_CPROP) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC)) { goto range_end_val_with_warning; } r = ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS; goto err; } state = CS_RANGE; } else if (state == CS_START) { /* [-xa] is allowed */ in_code = tok->u.code; in_raw = 0; r = fetch_token_cc(tok, &p, end, env, CS_VALUE); if (r < 0) goto err; fetched = 1; /* [--x] or [a&&-x] is warned. */ if (r == TK_CC_RANGE || and_start != 0) CC_ESC_WARN(env, (UChar* )"-"); goto val_entry; } else if (state == CS_RANGE) { CC_ESC_WARN(env, (UChar* )"-"); goto any_char_in; /* [!--] is allowed */ } else { /* CS_COMPLETE */ r = fetch_token_cc(tok, &p, end, env, CS_VALUE); if (r < 0) goto err; fetched = 1; if (r == TK_CC_CLOSE) { goto range_end_val; /* allow [a-b-] */ } else if (r == TK_CC_AND) { goto range_end_val_with_warning; } if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC)) { /* [0-9-a] is allowed as [0-9\-a] */ goto range_end_val_with_warning; } r = ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS; goto err; } break; case TK_CC_OPEN_CC: /* [ */ { Node *anode; CClassNode* acc; if (state == CS_VALUE) { r = cc_char_next(cc, &curr_code, 0, &curr_raw, 0, curr_type, &curr_type, &state, env); if (r != 0) goto err; } state = CS_COMPLETE; r = prs_cc(&anode, tok, &p, end, env); if (r != 0) { onig_node_free(anode); goto cc_open_err; } acc = CCLASS_(anode); r = or_cclass(cc, acc, env->enc); onig_node_free(anode); cc_open_err: if (r != 0) goto err; } break; case TK_CC_AND: /* && */ { if (state == CS_VALUE) { r = cc_char_next(cc, &curr_code, 0, &curr_raw, 0, curr_type, &curr_type, &state, env); if (r != 0) goto err; } /* initialize local variables */ and_start = 1; state = CS_START; if (IS_NOT_NULL(prev_cc)) { r = and_cclass(prev_cc, cc, env->enc); if (r != 0) goto err; bbuf_free(cc->mbuf); } else { prev_cc = cc; cc = &work_cc; } initialize_cclass(cc); } break; case TK_EOT: r = ONIGERR_PREMATURE_END_OF_CHAR_CLASS; goto err; break; default: r = ONIGERR_PARSER_BUG; goto err; break; } if (fetched) r = tok->type; else { r = fetch_token_cc(tok, &p, end, env, state); if (r < 0) goto err; } } if (state == CS_VALUE) { r = cc_char_next(cc, &curr_code, 0, &curr_raw, 0, curr_type, &curr_type, &state, env); if (r != 0) goto err; } if (IS_NOT_NULL(prev_cc)) { r = and_cclass(prev_cc, cc, env->enc); if (r != 0) goto err; bbuf_free(cc->mbuf); cc = prev_cc; } if (neg != 0) NCCLASS_SET_NOT(cc); else NCCLASS_CLEAR_NOT(cc); if (IS_NCCLASS_NOT(cc) && IS_SYNTAX_BV(env->syntax, ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC)) { int is_empty = (IS_NULL(cc->mbuf) ? 1 : 0); if (is_empty != 0) BITSET_IS_EMPTY(cc->bs, is_empty); if (is_empty == 0) { if (ONIGENC_IS_CODE_NEWLINE(env->enc, NEWLINE_CODE)) { if (ONIGENC_CODE_TO_MBCLEN(env->enc, NEWLINE_CODE) == 1) BITSET_SET_BIT(cc->bs, NEWLINE_CODE); else add_code_range(&(cc->mbuf), env, NEWLINE_CODE, NEWLINE_CODE); } } } *src = p; DEC_PARSE_DEPTH(env->parse_depth); return 0; err: if (cc != CCLASS_(*np)) bbuf_free(cc->mbuf); return r; } static int prs_alts(Node** top, PToken* tok, int term, UChar** src, UChar* end, ParseEnv* env, int group_head); #ifdef USE_CALLOUT /* (?{...}[tag][+-]) (?{{...}}[tag][+-]) */ static int prs_callout_of_contents(Node** np, int cterm, UChar** src, UChar* end, ParseEnv* env) { int r; int i; int in; int num; OnigCodePoint c; UChar* code_start; UChar* code_end; UChar* contents; UChar* tag_start; UChar* tag_end; int brace_nest; CalloutListEntry* e; RegexExt* ext; OnigEncoding enc = env->enc; UChar* p = *src; if (PEND) return ONIGERR_INVALID_CALLOUT_PATTERN; brace_nest = 0; while (PPEEK_IS('{')) { brace_nest++; PINC_S; if (PEND) return ONIGERR_INVALID_CALLOUT_PATTERN; } in = ONIG_CALLOUT_IN_PROGRESS; code_start = p; while (1) { if (PEND) return ONIGERR_INVALID_CALLOUT_PATTERN; code_end = p; PFETCH_S(c); if (c == '}') { i = brace_nest; while (i > 0) { if (PEND) return ONIGERR_INVALID_CALLOUT_PATTERN; PFETCH_S(c); if (c == '}') i--; else break; } if (i == 0) break; } } if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH_S(c); if (c == '[') { if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; tag_end = tag_start = p; while (! PEND) { if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; tag_end = p; PFETCH_S(c); if (c == ']') break; } if (! is_allowed_callout_tag_name(enc, tag_start, tag_end)) return ONIGERR_INVALID_CALLOUT_TAG_NAME; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH_S(c); } else { tag_start = tag_end = 0; } if (c == 'X') { in |= ONIG_CALLOUT_IN_RETRACTION; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH_S(c); } else if (c == '<') { in = ONIG_CALLOUT_IN_RETRACTION; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH_S(c); } else if (c == '>') { /* no needs (default) */ if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH_S(c); } if (c != cterm) return ONIGERR_INVALID_CALLOUT_PATTERN; r = reg_callout_list_entry(env, &num); if (r != 0) return r; ext = onig_get_regex_ext(env->reg); CHECK_NULL_RETURN_MEMERR(ext); if (IS_NULL(ext->pattern)) { r = onig_ext_set_pattern(env->reg, env->pattern, env->pattern_end); if (r != ONIG_NORMAL) return r; } if (tag_start != tag_end) { r = callout_tag_entry(env, env->reg, tag_start, tag_end, num); if (r != ONIG_NORMAL) return r; } contents = onigenc_strdup(enc, code_start, code_end); CHECK_NULL_RETURN_MEMERR(contents); e = onig_reg_callout_list_at(env->reg, num); if (IS_NULL(e)) { xfree(contents); return ONIGERR_MEMORY; } r = node_new_callout(np, ONIG_CALLOUT_OF_CONTENTS, num, ONIG_NON_NAME_ID, env); if (r != 0) { xfree(contents); return r; } e->of = ONIG_CALLOUT_OF_CONTENTS; e->in = in; e->name_id = ONIG_NON_NAME_ID; e->u.content.start = contents; e->u.content.end = contents + (code_end - code_start); *src = p; return 0; } static long prs_long(OnigEncoding enc, UChar* s, UChar* end, int sign_on, long max, long* rl) { long v; long d; int flag; UChar* p; OnigCodePoint c; if (s >= end) return ONIGERR_INVALID_CALLOUT_ARG; flag = 1; v = 0; p = s; while (p < end) { c = ONIGENC_MBC_TO_CODE(enc, p, end); p += ONIGENC_MBC_ENC_LEN(enc, p); if (c >= '0' && c <= '9') { d = (long )(c - '0'); if (v > (max - d) / 10) return ONIGERR_INVALID_CALLOUT_ARG; v = v * 10 + d; } else if (sign_on != 0 && (c == '-' || c == '+')) { if (c == '-') flag = -1; } else return ONIGERR_INVALID_CALLOUT_ARG; sign_on = 0; } *rl = flag * v; return ONIG_NORMAL; } static void clear_callout_args(int n, unsigned int types[], OnigValue vals[]) { int i; for (i = 0; i < n; i++) { switch (types[i]) { case ONIG_TYPE_STRING: if (IS_NOT_NULL(vals[i].s.start)) xfree(vals[i].s.start); break; default: break; } } } static int prs_callout_args(int skip_mode, int cterm, UChar** src, UChar* end, int max_arg_num, unsigned int types[], OnigValue vals[], ParseEnv* env) { #define MAX_CALLOUT_ARG_BYTE_LENGTH 128 int r; int n; int esc; int cn; UChar* s; UChar* e; UChar* eesc; OnigCodePoint c; UChar* bufend; UChar buf[MAX_CALLOUT_ARG_BYTE_LENGTH]; OnigEncoding enc = env->enc; UChar* p = *src; if (PEND) return ONIGERR_INVALID_CALLOUT_PATTERN; c = 0; n = 0; while (n < ONIG_CALLOUT_MAX_ARGS_NUM) { cn = 0; esc = 0; eesc = 0; bufend = buf; s = e = p; while (1) { if (PEND) { r = ONIGERR_INVALID_CALLOUT_PATTERN; goto err_clear; } e = p; PFETCH_S(c); if (esc != 0) { esc = 0; if (c == '\\' || c == cterm || c == ',') { /* */ } else { e = eesc; cn++; } goto add_char; } else { if (c == '\\') { esc = 1; eesc = e; } else if (c == cterm || c == ',') break; else { size_t clen; add_char: if (skip_mode == FALSE) { clen = p - e; if (bufend + clen > buf + MAX_CALLOUT_ARG_BYTE_LENGTH) { r = ONIGERR_INVALID_CALLOUT_ARG; /* too long argument */ goto err_clear; } xmemcpy(bufend, e, clen); bufend += clen; } cn++; } } } if (cn != 0) { if (max_arg_num >= 0 && n >= max_arg_num) { r = ONIGERR_INVALID_CALLOUT_ARG; goto err_clear; } if (skip_mode == FALSE) { if ((types[n] & ONIG_TYPE_LONG) != 0) { int fixed = 0; if (cn > 0) { long rl; r = prs_long(enc, buf, bufend, 1, LONG_MAX, &rl); if (r == ONIG_NORMAL) { vals[n].l = rl; fixed = 1; types[n] = ONIG_TYPE_LONG; } } if (fixed == 0) { types[n] = (types[n] & ~ONIG_TYPE_LONG); if (types[n] == ONIG_TYPE_VOID) { r = ONIGERR_INVALID_CALLOUT_ARG; goto err_clear; } } } switch (types[n]) { case ONIG_TYPE_LONG: break; case ONIG_TYPE_CHAR: if (cn != 1) { r = ONIGERR_INVALID_CALLOUT_ARG; goto err_clear; } vals[n].c = ONIGENC_MBC_TO_CODE(enc, buf, bufend); break; case ONIG_TYPE_STRING: { UChar* rs = onigenc_strdup(enc, buf, bufend); if (IS_NULL(rs)) { r = ONIGERR_MEMORY; goto err_clear; } vals[n].s.start = rs; vals[n].s.end = rs + (e - s); } break; case ONIG_TYPE_TAG: if (eesc != 0 || ! is_allowed_callout_tag_name(enc, s, e)) { r = ONIGERR_INVALID_CALLOUT_TAG_NAME; goto err_clear; } vals[n].s.start = s; vals[n].s.end = e; break; case ONIG_TYPE_VOID: case ONIG_TYPE_POINTER: r = ONIGERR_PARSER_BUG; goto err_clear; break; } } n++; } if (c == cterm) break; } if (c != cterm) { r = ONIGERR_INVALID_CALLOUT_PATTERN; goto err_clear; } *src = p; return n; err_clear: if (skip_mode == FALSE) clear_callout_args(n, types, vals); return r; } /* (*name[TAG]) (*name[TAG]{a,b,..}) */ static int prs_callout_of_name(Node** np, int cterm, UChar** src, UChar* end, ParseEnv* env) { int r; int i; int in; int num; int name_id; int arg_num; int max_arg_num; int opt_arg_num; int is_not_single; OnigCodePoint c; UChar* name_start; UChar* name_end; UChar* tag_start; UChar* tag_end; Node* node; CalloutListEntry* e; RegexExt* ext; unsigned int types[ONIG_CALLOUT_MAX_ARGS_NUM]; OnigValue vals[ONIG_CALLOUT_MAX_ARGS_NUM]; OnigEncoding enc = env->enc; UChar* p = *src; /* PFETCH_READY; */ if (PEND) return ONIGERR_INVALID_CALLOUT_PATTERN; node = 0; name_start = p; while (1) { if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; name_end = p; PFETCH_S(c); if (c == cterm || c == '[' || c == '{') break; } if (! is_allowed_callout_name(enc, name_start, name_end)) return ONIGERR_INVALID_CALLOUT_NAME; if (c == '[') { if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; tag_end = tag_start = p; while (! PEND) { if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; tag_end = p; PFETCH_S(c); if (c == ']') break; } if (! is_allowed_callout_tag_name(enc, tag_start, tag_end)) return ONIGERR_INVALID_CALLOUT_TAG_NAME; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH_S(c); } else { tag_start = tag_end = 0; } if (c == '{') { UChar* save; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; /* read for single check only */ save = p; arg_num = prs_callout_args(TRUE, '}', &p, end, -1, NULL, NULL, env); if (arg_num < 0) return arg_num; is_not_single = PPEEK_IS(cterm) ? 0 : 1; p = save; r = get_callout_name_id_by_name(enc, is_not_single, name_start, name_end, &name_id); if (r != ONIG_NORMAL) return r; max_arg_num = get_callout_arg_num_by_name_id(name_id); for (i = 0; i < max_arg_num; i++) { types[i] = get_callout_arg_type_by_name_id(name_id, i); } arg_num = prs_callout_args(FALSE, '}', &p, end, max_arg_num, types, vals, env); if (arg_num < 0) return arg_num; if (PEND) { r = ONIGERR_END_PATTERN_IN_GROUP; goto err_clear; } PFETCH_S(c); } else { arg_num = 0; is_not_single = 0; r = get_callout_name_id_by_name(enc, is_not_single, name_start, name_end, &name_id); if (r != ONIG_NORMAL) return r; max_arg_num = get_callout_arg_num_by_name_id(name_id); for (i = 0; i < max_arg_num; i++) { types[i] = get_callout_arg_type_by_name_id(name_id, i); } } in = onig_get_callout_in_by_name_id(name_id); opt_arg_num = get_callout_opt_arg_num_by_name_id(name_id); if (arg_num > max_arg_num || arg_num < (max_arg_num - opt_arg_num)) { r = ONIGERR_INVALID_CALLOUT_ARG; goto err_clear; } if (c != cterm) { r = ONIGERR_INVALID_CALLOUT_PATTERN; goto err_clear; } r = reg_callout_list_entry(env, &num); if (r != 0) goto err_clear; ext = onig_get_regex_ext(env->reg); if (IS_NULL(ext)) { r = ONIGERR_MEMORY; goto err_clear; } if (IS_NULL(ext->pattern)) { r = onig_ext_set_pattern(env->reg, env->pattern, env->pattern_end); if (r != ONIG_NORMAL) goto err_clear; } if (tag_start != tag_end) { r = callout_tag_entry(env, env->reg, tag_start, tag_end, num); if (r != ONIG_NORMAL) goto err_clear; } e = onig_reg_callout_list_at(env->reg, num); if (IS_NULL(e)) { r = ONIGERR_MEMORY; goto err_clear; } r = node_new_callout(&node, ONIG_CALLOUT_OF_NAME, num, name_id, env); if (r != ONIG_NORMAL) goto err_clear; e->of = ONIG_CALLOUT_OF_NAME; e->in = in; e->name_id = name_id; e->type = onig_get_callout_type_by_name_id(name_id); e->start_func = onig_get_callout_start_func_by_name_id(name_id); e->end_func = onig_get_callout_end_func_by_name_id(name_id); e->u.arg.num = max_arg_num; e->u.arg.passed_num = arg_num; for (i = 0; i < max_arg_num; i++) { e->u.arg.types[i] = types[i]; if (i < arg_num) e->u.arg.vals[i] = vals[i]; else e->u.arg.vals[i] = get_callout_opt_default_by_name_id(name_id, i); } *np = node; *src = p; return 0; err_clear: clear_callout_args(arg_num, types, vals); return r; } #endif #ifdef USE_WHOLE_OPTIONS static int set_whole_options(OnigOptionType option, ParseEnv* env) { if ((env->flags & PE_FLAG_HAS_WHOLE_OPTIONS) != 0) return ONIGERR_INVALID_GROUP_OPTION; env->flags |= PE_FLAG_HAS_WHOLE_OPTIONS; if (OPTON_DONT_CAPTURE_GROUP(option)) { env->reg->options |= ONIG_OPTION_DONT_CAPTURE_GROUP; if ((option & (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP)) == (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP)) return ONIGERR_INVALID_COMBINATION_OF_OPTIONS; } if ((option & ONIG_OPTION_IGNORECASE_IS_ASCII) != 0) { env->reg->case_fold_flag &= ~(INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR | ONIGENC_CASE_FOLD_TURKISH_AZERI); env->reg->case_fold_flag |= ONIGENC_CASE_FOLD_ASCII_ONLY; env->reg->options |= ONIG_OPTION_IGNORECASE_IS_ASCII; } if (OPTON_FIND_LONGEST(option)) { env->reg->options |= ONIG_OPTION_FIND_LONGEST; } return 0; } #endif static int prs_bag(Node** np, PToken* tok, int term, UChar** src, UChar* end, ParseEnv* env) { int r, num; Node *target; OnigOptionType option; OnigCodePoint c; int list_capture; OnigEncoding enc; UChar* p; PFETCH_READY; p = *src; enc = env->enc; *np = NULL; if (PEND) return ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS; option = env->options; c = PPEEK; if (c == '?' && IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_GROUP_EFFECT)) { PINC; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); switch (c) { case ':': /* (?:...) grouping only */ group: r = fetch_token(tok, &p, end, env); if (r < 0) return r; r = prs_alts(np, tok, term, &p, end, env, FALSE); if (r < 0) return r; *src = p; return 1; /* group */ break; case '=': *np = node_new_anchor(ANCR_PREC_READ); break; case '!': /* preceding read */ *np = node_new_anchor(ANCR_PREC_READ_NOT); break; case '>': /* (?>...) stop backtrack */ *np = node_new_bag(BAG_STOP_BACKTRACK); break; case '\'': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP)) { goto named_group1; } else return ONIGERR_UNDEFINED_GROUP_OPTION; break; case '<': /* look behind (?<=...), (?syntax, ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP)) { UChar *name; UChar *name_end; enum REF_NUM num_type; PUNFETCH; c = '<'; named_group1: list_capture = 0; #ifdef USE_CAPTURE_HISTORY named_group2: #endif name = p; r = fetch_name((OnigCodePoint )c, &p, end, &name_end, env, &num, &num_type, FALSE); if (r < 0) return r; num = scan_env_add_mem_entry(env); if (num < 0) return num; if (list_capture != 0 && num >= (int )MEM_STATUS_BITS_NUM) return ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY; r = name_add(env->reg, name, name_end, num, env); if (r != 0) return r; *np = node_new_memory(1); CHECK_NULL_RETURN_MEMERR(*np); BAG_(*np)->m.regnum = num; if (list_capture != 0) MEM_STATUS_ON_SIMPLE(env->cap_history, num); env->num_named++; } else { return ONIGERR_UNDEFINED_GROUP_OPTION; } } break; case '~': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP)) { Node* absent; Node* expr; int head_bar; int is_range_cutter; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; if (PPEEK_IS('|')) { /* (?~|generator|absent) */ PINC; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; head_bar = 1; if (PPEEK_IS(')')) { /* (?~|) : range clear */ PINC; r = make_range_clear(np, env); if (r != 0) return r; env->flags |= PE_FLAG_HAS_ABSENT_STOPPER; goto end; } } else head_bar = 0; r = fetch_token(tok, &p, end, env); if (r < 0) return r; r = prs_alts(&absent, tok, term, &p, end, env, TRUE); if (r < 0) { onig_node_free(absent); return r; } expr = NULL_NODE; is_range_cutter = 0; if (head_bar != 0) { Node* top = absent; if (ND_TYPE(top) != ND_ALT || IS_NULL(ND_CDR(top))) { expr = NULL_NODE; is_range_cutter = 1; env->flags |= PE_FLAG_HAS_ABSENT_STOPPER; } else { absent = ND_CAR(top); expr = ND_CDR(top); ND_CAR(top) = NULL_NODE; ND_CDR(top) = NULL_NODE; onig_node_free(top); if (IS_NULL(ND_CDR(expr))) { top = expr; expr = ND_CAR(top); ND_CAR(top) = NULL_NODE; onig_node_free(top); } } } r = make_absent_tree(np, absent, expr, is_range_cutter, env); if (r != 0) { return r; } goto end; } else { return ONIGERR_UNDEFINED_GROUP_OPTION; } break; #ifdef USE_CALLOUT case '{': if (! IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS)) return ONIGERR_UNDEFINED_GROUP_OPTION; r = prs_callout_of_contents(np, ')', &p, end, env); if (r != 0) return r; goto end; break; #endif case '(': /* (?()...) */ if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE)) { UChar *prev; Node* condition; int condition_is_checker; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; if (IS_CODE_DIGIT_ASCII(enc, c) || c == '-' || c == '+' || c == '<' || c == '\'') { #ifdef USE_BACKREF_WITH_LEVEL int exist_level; int level; #endif UChar* name_end; int back_num; enum REF_NUM num_type; int is_enclosed; is_enclosed = (c == '<' || c == '\'') ? 1 : 0; if (! is_enclosed) PUNFETCH; prev = p; #ifdef USE_BACKREF_WITH_LEVEL exist_level = 0; name_end = NULL_UCHARP; /* no need. escape gcc warning. */ r = fetch_name_with_level( (OnigCodePoint )(is_enclosed != 0 ? c : '('), &p, end, &name_end, env, &back_num, &level, &num_type); if (r == 1) exist_level = 1; #else r = fetch_name((OnigCodePoint )(is_enclosed != 0 ? c : '('), &p, end, &name_end, env, &back_num, &num_type, TRUE); #endif if (r < 0) { if (is_enclosed == 0) { goto any_condition; } else return r; } condition_is_checker = 1; if (num_type != IS_NOT_NUM) { if (num_type == IS_REL_NUM) { back_num = backref_rel_to_abs(back_num, env); } if (back_num <= 0) return ONIGERR_INVALID_BACKREF; if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_STRICT_CHECK_BACKREF)) { if (back_num > env->num_mem || IS_NULL(PARSEENV_MEMENV(env)[back_num].mem_node)) return ONIGERR_INVALID_BACKREF; } condition = node_new_backref_checker(1, &back_num, FALSE, #ifdef USE_BACKREF_WITH_LEVEL exist_level, level, #endif env); } else { int num; int* backs; num = name_to_group_numbers(env, prev, name_end, &backs); if (num <= 0) { return ONIGERR_UNDEFINED_NAME_REFERENCE; } if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_STRICT_CHECK_BACKREF)) { int i; for (i = 0; i < num; i++) { if (backs[i] > env->num_mem || IS_NULL(PARSEENV_MEMENV(env)[backs[i]].mem_node)) return ONIGERR_INVALID_BACKREF; } } condition = node_new_backref_checker(num, backs, TRUE, #ifdef USE_BACKREF_WITH_LEVEL exist_level, level, #endif env); } if (is_enclosed != 0) { if (PEND) goto err_if_else; PFETCH(c); if (c != ')') goto err_if_else; } } #ifdef USE_CALLOUT else if (c == '?') { if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS)) { if (! PEND && PPEEK_IS('{')) { /* condition part is callouts of contents: (?(?{...})THEN|ELSE) */ condition_is_checker = 0; PFETCH(c); r = prs_callout_of_contents(&condition, ')', &p, end, env); if (r != 0) return r; goto end_condition; } } goto any_condition; } else if (c == '*' && IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME)) { condition_is_checker = 0; r = prs_callout_of_name(&condition, ')', &p, end, env); if (r != 0) return r; goto end_condition; } #endif else { any_condition: PUNFETCH; condition_is_checker = 0; r = fetch_token(tok, &p, end, env); if (r < 0) return r; r = prs_alts(&condition, tok, term, &p, end, env, FALSE); if (r < 0) { onig_node_free(condition); return r; } } #ifdef USE_CALLOUT end_condition: #endif CHECK_NULL_RETURN_MEMERR(condition); if (PEND) { err_if_else: onig_node_free(condition); return ONIGERR_END_PATTERN_IN_GROUP; } if (PPEEK_IS(')')) { /* case: empty body: make backref checker */ if (condition_is_checker == 0) { onig_node_free(condition); return ONIGERR_INVALID_IF_ELSE_SYNTAX; } PFETCH(c); *np = condition; } else { /* if-else */ int then_is_empty; Node *Then, *Else; Then = 0; if (PPEEK_IS('|')) { PFETCH(c); then_is_empty = 1; } else then_is_empty = 0; r = fetch_token(tok, &p, end, env); if (r < 0) { onig_node_free(condition); return r; } r = prs_alts(&target, tok, term, &p, end, env, TRUE); if (r < 0) { onig_node_free(condition); onig_node_free(target); return r; } if (then_is_empty != 0) { Else = target; } else { if (ND_TYPE(target) == ND_ALT) { Then = ND_CAR(target); if (ND_CDR(ND_CDR(target)) == NULL_NODE) { Else = ND_CAR(ND_CDR(target)); cons_node_free_alone(ND_CDR(target)); } else { Else = ND_CDR(target); } cons_node_free_alone(target); } else { Then = target; Else = 0; } } *np = node_new_bag_if_else(condition, Then, Else); if (IS_NULL(*np)) { onig_node_free(condition); onig_node_free(Then); onig_node_free(Else); return ONIGERR_MEMORY; } } goto end; } else { return ONIGERR_UNDEFINED_GROUP_OPTION; } break; #ifdef USE_CAPTURE_HISTORY case '@': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY)) { if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP)) { PFETCH(c); if (c == '<' || c == '\'') { list_capture = 1; goto named_group2; /* (?@...) */ } PUNFETCH; } *np = node_new_memory(0); CHECK_NULL_RETURN_MEMERR(*np); num = scan_env_add_mem_entry(env); if (num < 0) { return num; } else if (num >= (int )MEM_STATUS_BITS_NUM) { return ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY; } BAG_(*np)->m.regnum = num; MEM_STATUS_ON_SIMPLE(env->cap_history, num); } else { return ONIGERR_UNDEFINED_GROUP_OPTION; } break; #endif #ifdef USE_WHOLE_OPTIONS case 'C': case 'I': case 'L': if (! IS_SYNTAX_BV(env->syntax, ONIG_SYN_WHOLE_OPTIONS)) return ONIGERR_UNDEFINED_GROUP_OPTION; goto options_start; break; #endif case 'P': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_QMARK_CAPITAL_P_NAME)) { if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); if (c == '<') goto named_group1; return ONIGERR_UNDEFINED_GROUP_OPTION; } /* else fall */ case 'W': case 'D': case 'S': case 'y': if (! IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_ONIGURUMA)) return ONIGERR_UNDEFINED_GROUP_OPTION; /* else fall */ #ifdef USE_POSIXLINE_OPTION case 'p': #endif case 'a': case '-': case 'i': case 'm': case 's': case 'x': #ifdef USE_WHOLE_OPTIONS options_start: #endif { int neg; #ifdef USE_WHOLE_OPTIONS int whole_options; whole_options = FALSE; #endif neg = FALSE; while (1) { switch (c) { case ':': case ')': break; case '-': neg = TRUE; break; case 'x': OPTION_NEGATE(option, ONIG_OPTION_EXTEND, neg); break; case 'i': OPTION_NEGATE(option, ONIG_OPTION_IGNORECASE, neg); break; case 's': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_PERL)) { OPTION_NEGATE(option, ONIG_OPTION_MULTILINE, neg); } else return ONIGERR_UNDEFINED_GROUP_OPTION; break; case 'm': if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_PERL)) { OPTION_NEGATE(option, ONIG_OPTION_SINGLELINE, (neg == FALSE ? TRUE : FALSE)); } else if (IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_ONIGURUMA|ONIG_SYN_OP2_OPTION_RUBY)) { OPTION_NEGATE(option, ONIG_OPTION_MULTILINE, neg); } else return ONIGERR_UNDEFINED_GROUP_OPTION; break; #ifdef USE_POSIXLINE_OPTION case 'p': OPTION_NEGATE(option, ONIG_OPTION_MULTILINE|ONIG_OPTION_SINGLELINE, neg); break; #endif case 'W': if (! IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_ONIGURUMA)) return ONIGERR_UNDEFINED_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_WORD_IS_ASCII, neg); break; case 'D': if (! IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_ONIGURUMA)) return ONIGERR_UNDEFINED_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_DIGIT_IS_ASCII, neg); break; case 'S': if (! IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_ONIGURUMA)) return ONIGERR_UNDEFINED_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_SPACE_IS_ASCII, neg); break; case 'P': if (! IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_ONIGURUMA)) return ONIGERR_UNDEFINED_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_POSIX_IS_ASCII, neg); break; case 'y': /* y{g}, y{w} */ { if (! IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_OPTION_ONIGURUMA)) return ONIGERR_UNDEFINED_GROUP_OPTION; if (neg == TRUE) return ONIGERR_UNDEFINED_GROUP_OPTION; if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; if (! PPEEK_IS('{')) return ONIGERR_UNDEFINED_GROUP_OPTION; PFETCH(c); if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); switch (c) { case 'g': if (! ONIGENC_IS_UNICODE_ENCODING(enc)) return ONIGERR_UNDEFINED_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER, FALSE); OPTION_NEGATE(option, ONIG_OPTION_TEXT_SEGMENT_WORD, TRUE); break; #ifdef USE_UNICODE_WORD_BREAK case 'w': if (! ONIGENC_IS_UNICODE_ENCODING(enc)) return ONIGERR_UNDEFINED_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_TEXT_SEGMENT_WORD, FALSE); OPTION_NEGATE(option, ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER, TRUE); break; #endif default: return ONIGERR_UNDEFINED_GROUP_OPTION; break; } if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); if (c != '}') return ONIGERR_UNDEFINED_GROUP_OPTION; } /* case 'y' */ break; case 'a': if (! IS_SYNTAX_BV(env->syntax, ONIG_SYN_PYTHON)) return ONIGERR_UNDEFINED_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_POSIX_IS_ASCII, neg); break; #ifdef USE_WHOLE_OPTIONS case 'C': if (! IS_SYNTAX_BV(env->syntax, ONIG_SYN_WHOLE_OPTIONS)) return ONIGERR_UNDEFINED_GROUP_OPTION; if (neg == TRUE) return ONIGERR_INVALID_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_DONT_CAPTURE_GROUP, neg); whole_options = TRUE; break; case 'I': if (! IS_SYNTAX_BV(env->syntax, ONIG_SYN_WHOLE_OPTIONS)) return ONIGERR_UNDEFINED_GROUP_OPTION; if (neg == TRUE) return ONIGERR_INVALID_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_IGNORECASE_IS_ASCII, neg); whole_options = TRUE; break; case 'L': if (! IS_SYNTAX_BV(env->syntax, ONIG_SYN_WHOLE_OPTIONS)) return ONIGERR_UNDEFINED_GROUP_OPTION; if (neg == TRUE) return ONIGERR_INVALID_GROUP_OPTION; OPTION_NEGATE(option, ONIG_OPTION_FIND_LONGEST, neg); whole_options = TRUE; break; #endif default: return ONIGERR_UNDEFINED_GROUP_OPTION; } if (c == ')') { *np = node_new_option(option); CHECK_NULL_RETURN_MEMERR(*np); #ifdef USE_WHOLE_OPTIONS if (whole_options == TRUE) { r = set_whole_options(option, env); if (r != 0) return r; ND_STATUS_ADD(*np, WHOLE_OPTIONS); } #endif *src = p; return 2; /* option only */ } else if (c == ':') { OnigOptionType prev = env->options; env->options = option; #ifdef USE_WHOLE_OPTIONS if (whole_options == TRUE) { r = set_whole_options(option, env); if (r != 0) return r; } #endif r = fetch_token(tok, &p, end, env); if (r < 0) return r; r = prs_alts(&target, tok, term, &p, end, env, FALSE); env->options = prev; if (r < 0) { onig_node_free(target); return r; } *np = node_new_option(option); CHECK_NULL_RETURN_MEMERR(*np); ND_BODY(*np) = target; ND_STATUS_ADD(*np, WHOLE_OPTIONS); *src = p; return 0; } if (PEND) return ONIGERR_END_PATTERN_IN_GROUP; PFETCH(c); } /* while (1) */ } break; default: return ONIGERR_UNDEFINED_GROUP_OPTION; } } #ifdef USE_CALLOUT else if (c == '*' && IS_SYNTAX_OP2(env->syntax, ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME)) { PINC; r = prs_callout_of_name(np, ')', &p, end, env); if (r != 0) return r; goto end; } #endif else { if (OPTON_DONT_CAPTURE_GROUP(env->options)) goto group; *np = node_new_memory(0); CHECK_NULL_RETURN_MEMERR(*np); num = scan_env_add_mem_entry(env); if (num < 0) return num; BAG_(*np)->m.regnum = num; } CHECK_NULL_RETURN_MEMERR(*np); r = fetch_token(tok, &p, end, env); if (r < 0) return r; r = prs_alts(&target, tok, term, &p, end, env, FALSE); if (r < 0) { onig_node_free(target); return r; } ND_BODY(*np) = target; if (ND_TYPE(*np) == ND_BAG) { if (BAG_(*np)->type == BAG_MEMORY) { /* Don't move this to previous of prs_alts() */ r = scan_env_set_mem_node(env, BAG_(*np)->m.regnum, *np); if (r != 0) return r; } } end: *src = p; return 0; } static const char* PopularQStr[] = { "?", "*", "+", "??", "*?", "+?" }; static const char* ReduceQStr[] = { "", "", "*", "*?", "??", "+ and ??", "+? and ?" }; static int assign_quantifier_body(Node* qnode, Node* target, int group, ParseEnv* env) { QuantNode* qn; qn = QUANT_(qnode); if (qn->lower == 1 && qn->upper == 1) return 1; switch (ND_TYPE(target)) { case ND_STRING: if (group == 0) { if (str_node_can_be_split(target, env->enc)) { Node* n = str_node_split_last_char(target, env->enc); if (IS_NOT_NULL(n)) { ND_BODY(qnode) = n; return 2; } } } break; case ND_QUANT: { /* check redundant double repeat. */ /* verbose warn (?:.?)? etc... but not warn (.?)? etc... */ QuantNode* qnt = QUANT_(target); int nestq_num = quantifier_type_num(qn); int targetq_num = quantifier_type_num(qnt); #ifdef USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR if (targetq_num >= 0 && nestq_num >= 0 && IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT)) { UChar buf[WARN_BUFSIZE]; switch(ReduceTypeTable[targetq_num][nestq_num]) { case RQ_ASIS: break; case RQ_DEL: if (onig_verb_warn != onig_null_warn) { onig_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc, env->pattern, env->pattern_end, "redundant nested repeat operator"); (*onig_verb_warn)((char* )buf); } goto warn_exit; break; default: if (onig_verb_warn != onig_null_warn) { onig_snprintf_with_pattern(buf, WARN_BUFSIZE, env->enc, env->pattern, env->pattern_end, "nested repeat operator %s and %s was replaced with '%s'", PopularQStr[targetq_num], PopularQStr[nestq_num], ReduceQStr[ReduceTypeTable[targetq_num][nestq_num]]); (*onig_verb_warn)((char* )buf); } goto warn_exit; break; } } warn_exit: #endif if (targetq_num >= 0 && nestq_num < 0) { if (targetq_num == 1 || targetq_num == 2) { /* * or + */ /* (?:a*){n,m}, (?:a+){n,m} => (?:a*){n,n}, (?:a+){n,n} */ if (! IS_INFINITE_REPEAT(qn->upper) && qn->upper > 1 && qn->greedy) { qn->upper = (qn->lower == 0 ? 1 : qn->lower); } } } else { int r; ND_BODY(qnode) = target; r = onig_reduce_nested_quantifier(qnode); return r; } } break; default: break; } ND_BODY(qnode) = target; return 0; } #ifndef CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS static int clear_not_flag_cclass(CClassNode* cc, OnigEncoding enc) { BBuf *tbuf; int r; if (IS_NCCLASS_NOT(cc)) { bitset_invert(cc->bs); if (! ONIGENC_IS_SINGLEBYTE(enc)) { r = not_code_range_buf(enc, cc->mbuf, &tbuf); if (r != 0) return r; bbuf_free(cc->mbuf); cc->mbuf = tbuf; } NCCLASS_CLEAR_NOT(cc); } return 0; } #endif /* CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS */ #define ADD_CODE_INTO_CC(cc, code, enc) do {\ if (ONIGENC_MBC_MINLEN(enc) > 1 || ONIGENC_CODE_TO_MBCLEN(enc, code) != 1) {\ add_code_range_to_buf(&((cc)->mbuf), code, code);\ }\ else {\ BITSET_SET_BIT((cc)->bs, code);\ }\ } while (0) extern int onig_new_cclass_with_code_list(Node** rnode, OnigEncoding enc, int n, OnigCodePoint codes[]) { int i; Node* node; CClassNode* cc; *rnode = NULL_NODE; node = node_new_cclass(); CHECK_NULL_RETURN_MEMERR(node); cc = CCLASS_(node); for (i = 0; i < n; i++) { ADD_CODE_INTO_CC(cc, codes[i], enc); } *rnode = node; return 0; } typedef struct { ParseEnv* env; CClassNode* cc; Node* alt_root; Node** ptail; } IApplyCaseFoldArg; static int i_apply_case_fold(OnigCodePoint from, OnigCodePoint to[], int to_len, void* arg) { IApplyCaseFoldArg* iarg; ParseEnv* env; OnigEncoding enc; CClassNode* cc; iarg = (IApplyCaseFoldArg* )arg; env = iarg->env; cc = iarg->cc; enc = env->enc; if (to_len == 1) { int is_in = onig_is_code_in_cc(enc, from, cc); #ifdef CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS if ((is_in != 0 && !IS_NCCLASS_NOT(cc)) || (is_in == 0 && IS_NCCLASS_NOT(cc))) { ADD_CODE_INTO_CC(cc, *to, enc); } #else if (is_in != 0) { if (ONIGENC_MBC_MINLEN(enc) > 1 || ONIGENC_CODE_TO_MBCLEN(enc, *to) != 1) { if (IS_NCCLASS_NOT(cc)) clear_not_flag_cclass(cc, enc); add_code_range(&(cc->mbuf), env, *to, *to); } else { if (IS_NCCLASS_NOT(cc)) { BITSET_CLEAR_BIT(cc->bs, *to); } else BITSET_SET_BIT(cc->bs, *to); } } #endif /* CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS */ } else { int r, i, len; UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN]; if (onig_is_code_in_cc(enc, from, cc) #ifdef CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS && !IS_NCCLASS_NOT(cc) #endif ) { int n, j, m, index; Node* list_node; Node* ns[3]; n = 0; for (i = 0; i < to_len; i++) { OnigCodePoint code; Node* csnode; CClassNode* cs_cc; index = 0; if (ONIGENC_IS_UNICODE_ENCODING(enc) && (index = onigenc_unicode_fold1_key(&to[i])) >= 0) { csnode = node_new_cclass(); cs_cc = CCLASS_(csnode); if (IS_NULL(csnode)) { err_free_ns: for (j = 0; j < n; j++) onig_node_free(ns[j]); return ONIGERR_MEMORY; } m = FOLDS1_UNFOLDS_NUM(index); for (j = 0; j < m; j++) { code = FOLDS1_UNFOLDS(index)[j]; ADD_CODE_INTO_CC(cs_cc, code, enc); } ADD_CODE_INTO_CC(cs_cc, to[i], enc); ns[n++] = csnode; } else { len = ONIGENC_CODE_TO_MBC(enc, to[i], buf); if (n == 0 || ND_TYPE(ns[n-1]) != ND_STRING) { csnode = node_new_str(buf, buf + len); if (IS_NULL(csnode)) goto err_free_ns; if (index == 0) ND_STATUS_ADD(csnode, IGNORECASE); else ND_STRING_SET_CASE_EXPANDED(csnode); ns[n++] = csnode; } else { r = onig_node_str_cat(ns[n-1], buf, buf + len); if (r < 0) goto err_free_ns; } } } if (n == 1) list_node = ns[0]; else list_node = make_list(n, ns); *(iarg->ptail) = onig_node_new_alt(list_node, NULL_NODE); if (IS_NULL(*(iarg->ptail))) { onig_node_free(list_node); return ONIGERR_MEMORY; } iarg->ptail = &(ND_CDR((*(iarg->ptail)))); } } return 0; } static int prs_exp(Node** np, PToken* tok, int term, UChar** src, UChar* end, ParseEnv* env, int group_head) { int r, len, group; Node* qn; Node** tp; unsigned int parse_depth; retry: group = 0; *np = NULL; if (tok->type == (enum TokenSyms )term) goto end_of_token; parse_depth = env->parse_depth; switch (tok->type) { case TK_ALT: case TK_EOT: end_of_token: *np = node_new_empty(); CHECK_NULL_RETURN_MEMERR(*np); return tok->type; break; case TK_SUBEXP_OPEN: r = prs_bag(np, tok, TK_SUBEXP_CLOSE, src, end, env); if (r < 0) return r; if (r == 1) { /* group */ if (group_head == 0) group = 1; else { Node* target = *np; *np = node_new_group(target); if (IS_NULL(*np)) { onig_node_free(target); return ONIGERR_MEMORY; } group = 2; } } else if (r == 2) { /* option only */ if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH)) { env->options = BAG_(*np)->o.options; r = fetch_token(tok, src, end, env); if (r < 0) return r; onig_node_free(*np); goto retry; } else { Node* target; OnigOptionType prev = env->options; env->options = BAG_(*np)->o.options; r = fetch_token(tok, src, end, env); if (r < 0) return r; r = prs_alts(&target, tok, term, src, end, env, FALSE); env->options = prev; if (r < 0) { onig_node_free(target); return r; } ND_BODY(*np) = target; } return tok->type; } break; case TK_SUBEXP_CLOSE: if (! IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP)) return ONIGERR_UNMATCHED_CLOSE_PARENTHESIS; if (tok->escaped) goto tk_crude_byte; else goto tk_byte; break; case TK_STRING: tk_byte: { *np = node_new_str_with_options(tok->backp, *src, env->options); tk_byte2: CHECK_NULL_RETURN_MEMERR(*np); while (1) { r = fetch_token(tok, src, end, env); if (r < 0) return r; if (r != TK_STRING) break; r = onig_node_str_cat(*np, tok->backp, *src); if (r < 0) return r; } string_end: tp = np; goto repeat; } break; case TK_CRUDE_BYTE: tk_crude_byte: { *np = node_new_str_crude_char(tok->u.byte, env->options); CHECK_NULL_RETURN_MEMERR(*np); len = 1; while (1) { if (len >= ONIGENC_MBC_MINLEN(env->enc)) { if (len == enclen(env->enc, STR_(*np)->s)) { r = fetch_token(tok, src, end, env); goto tk_crude_byte_end; } } r = fetch_token(tok, src, end, env); if (r < 0) return r; if (r != TK_CRUDE_BYTE) return ONIGERR_TOO_SHORT_MULTI_BYTE_STRING; r = node_str_cat_char(*np, tok->u.byte); if (r < 0) return r; len++; } tk_crude_byte_end: if (! ONIGENC_IS_VALID_MBC_STRING(env->enc, STR_(*np)->s, STR_(*np)->end)) return ONIGERR_INVALID_WIDE_CHAR_VALUE; ND_STRING_CLEAR_CRUDE(*np); goto string_end; } break; case TK_CODE_POINT: { UChar buf[ONIGENC_CODE_TO_MBC_MAXLEN]; len = ONIGENC_CODE_TO_MBCLEN(env->enc, tok->u.code); if (len < 0) return len; len = ONIGENC_CODE_TO_MBC(env->enc, tok->u.code, buf); #ifdef NUMBERED_CHAR_IS_NOT_CASE_AMBIG *np = node_new_str_crude(buf, buf + len, env->options); #else *np = node_new_str_with_options(buf, buf + len, env->options); #endif CHECK_NULL_RETURN_MEMERR(*np); } break; case TK_QUOTE_OPEN: { OnigCodePoint end_op[2]; UChar *qstart, *qend, *nextp; end_op[0] = (OnigCodePoint )MC_ESC(env->syntax); end_op[1] = (OnigCodePoint )'E'; qstart = *src; qend = find_str_position(end_op, 2, qstart, end, &nextp, env->enc); if (IS_NULL(qend)) { nextp = qend = end; } *np = node_new_str_with_options(qstart, qend, env->options); CHECK_NULL_RETURN_MEMERR(*np); *src = nextp; } break; case TK_CHAR_TYPE: { switch (tok->u.prop.ctype) { case ONIGENC_CTYPE_WORD: *np = node_new_ctype(tok->u.prop.ctype, tok->u.prop.not, env->options); CHECK_NULL_RETURN_MEMERR(*np); break; case ONIGENC_CTYPE_SPACE: case ONIGENC_CTYPE_DIGIT: case ONIGENC_CTYPE_XDIGIT: { CClassNode* cc; *np = node_new_cclass(); CHECK_NULL_RETURN_MEMERR(*np); cc = CCLASS_(*np); r = add_ctype_to_cc(cc, tok->u.prop.ctype, FALSE, env); if (r != 0) { onig_node_free(*np); *np = NULL_NODE; return r; } if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc); } break; default: return ONIGERR_PARSER_BUG; break; } } break; case TK_CHAR_PROPERTY: r = prs_char_property(np, tok, src, end, env); if (r != 0) return r; break; case TK_OPEN_CC: { CClassNode* cc; r = prs_cc(np, tok, src, end, env); if (r != 0) return r; cc = CCLASS_(*np); if (OPTON_IGNORECASE(env->options)) { IApplyCaseFoldArg iarg; iarg.env = env; iarg.cc = cc; iarg.alt_root = NULL_NODE; iarg.ptail = &(iarg.alt_root); r = ONIGENC_APPLY_ALL_CASE_FOLD(env->enc, env->reg->case_fold_flag, i_apply_case_fold, &iarg); if (r != 0) { onig_node_free(iarg.alt_root); return r; } if (IS_NOT_NULL(iarg.alt_root)) { Node* work = onig_node_new_alt(*np, iarg.alt_root); if (IS_NULL(work)) { onig_node_free(iarg.alt_root); return ONIGERR_MEMORY; } *np = work; } } } break; case TK_ANYCHAR: *np = node_new_anychar(env->options); CHECK_NULL_RETURN_MEMERR(*np); break; case TK_ANYCHAR_ANYTIME: *np = node_new_anychar(env->options); CHECK_NULL_RETURN_MEMERR(*np); qn = node_new_quantifier(0, INFINITE_REPEAT, FALSE); CHECK_NULL_RETURN_MEMERR(qn); ND_BODY(qn) = *np; *np = qn; break; case TK_BACKREF: len = tok->u.backref.num; *np = node_new_backref(len, (len > 1 ? tok->u.backref.refs : &(tok->u.backref.ref1)), tok->u.backref.by_name, #ifdef USE_BACKREF_WITH_LEVEL tok->u.backref.exist_level, tok->u.backref.level, #endif env); CHECK_NULL_RETURN_MEMERR(*np); break; #ifdef USE_CALL case TK_CALL: { int gnum = tok->u.call.gnum; *np = node_new_call(tok->u.call.name, tok->u.call.name_end, gnum, tok->u.call.by_number); CHECK_NULL_RETURN_MEMERR(*np); env->num_call++; if (tok->u.call.by_number != 0 && gnum == 0) { env->flags |= PE_FLAG_HAS_CALL_ZERO; } } break; #endif case TK_ANCHOR: *np = node_new_anchor_with_options(tok->u.anchor, env->options); CHECK_NULL_RETURN_MEMERR(*np); break; case TK_REPEAT: case TK_INTERVAL: if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS)) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS)) return ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED; else { *np = node_new_empty(); CHECK_NULL_RETURN_MEMERR(*np); } } else { if (tok->type == TK_INTERVAL && IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_BRACE_INTERVAL)) { *np = node_new_str_with_options(tok->backp, *src, env->options); node_str_remove_char(*np, (UChar )'\\'); goto tk_byte2; } else { goto tk_byte; } } break; case TK_KEEP: r = node_new_keep(np, env); if (r < 0) return r; break; case TK_GENERAL_NEWLINE: r = node_new_general_newline(np, env); if (r < 0) return r; break; case TK_NO_NEWLINE: r = node_new_no_newline(np, env); if (r < 0) return r; break; case TK_TRUE_ANYCHAR: r = node_new_true_anychar(np); if (r < 0) return r; break; case TK_TEXT_SEGMENT: r = make_text_segment(np, env); if (r < 0) return r; break; default: return ONIGERR_PARSER_BUG; break; } { tp = np; re_entry: r = fetch_token(tok, src, end, env); if (r < 0) return r; repeat: if (r == TK_REPEAT || r == TK_INTERVAL) { Node* target; if (is_invalid_quantifier_target(*tp)) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS)) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS)) return ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID; } return r; } INC_PARSE_DEPTH(parse_depth); qn = node_new_quantifier(tok->u.repeat.lower, tok->u.repeat.upper, r == TK_INTERVAL); CHECK_NULL_RETURN_MEMERR(qn); QUANT_(qn)->greedy = tok->u.repeat.greedy; if (group == 2) { target = node_drop_group(*tp); *tp = NULL_NODE; } else { target = *tp; } r = assign_quantifier_body(qn, target, group, env); if (r < 0) { onig_node_free(qn); *tp = NULL_NODE; return r; } if (tok->u.repeat.possessive != 0) { Node* en; en = node_new_bag(BAG_STOP_BACKTRACK); if (IS_NULL(en)) { onig_node_free(qn); return ONIGERR_MEMORY; } ND_BODY(en) = qn; qn = en; } if (r == 0) { *tp = qn; } else if (r == 1) { /* x{1,1} ==> x */ onig_node_free(qn); *tp = target; } else if (r == 2) { /* split case: /abc+/ */ Node *tmp; *tp = node_new_list(*tp, NULL); if (IS_NULL(*tp)) { onig_node_free(qn); return ONIGERR_MEMORY; } tmp = ND_CDR(*tp) = node_new_list(qn, NULL); if (IS_NULL(tmp)) { onig_node_free(qn); return ONIGERR_MEMORY; } tp = &(ND_CAR(tmp)); } group = 0; goto re_entry; } } return r; } static int prs_branch(Node** top, PToken* tok, int term, UChar** src, UChar* end, ParseEnv* env, int group_head) { int r; Node *node, **headp; *top = NULL; INC_PARSE_DEPTH(env->parse_depth); r = prs_exp(&node, tok, term, src, end, env, group_head); if (r < 0) { onig_node_free(node); return r; } if (r == TK_EOT || r == term || r == TK_ALT) { *top = node; } else { *top = node_new_list(node, NULL); if (IS_NULL(*top)) { mem_err: onig_node_free(node); return ONIGERR_MEMORY; } headp = &(ND_CDR(*top)); while (r != TK_EOT && r != term && r != TK_ALT) { r = prs_exp(&node, tok, term, src, end, env, FALSE); if (r < 0) { onig_node_free(node); return r; } if (ND_TYPE(node) == ND_LIST) { *headp = node; while (IS_NOT_NULL(ND_CDR(node))) node = ND_CDR(node); headp = &(ND_CDR(node)); } else { *headp = node_new_list(node, NULL); if (IS_NULL(*headp)) goto mem_err; headp = &(ND_CDR(*headp)); } } } DEC_PARSE_DEPTH(env->parse_depth); return r; } /* term_tok: TK_EOT or TK_SUBEXP_CLOSE */ static int prs_alts(Node** top, PToken* tok, int term, UChar** src, UChar* end, ParseEnv* env, int group_head) { int r; Node *node, **headp; OnigOptionType save_options; *top = NULL; INC_PARSE_DEPTH(env->parse_depth); save_options = env->options; r = prs_branch(&node, tok, term, src, end, env, group_head); if (r < 0) { onig_node_free(node); return r; } if (r == term) { *top = node; } else if (r == TK_ALT) { *top = onig_node_new_alt(node, NULL); if (IS_NULL(*top)) { onig_node_free(node); return ONIGERR_MEMORY; } headp = &(ND_CDR(*top)); while (r == TK_ALT) { r = fetch_token(tok, src, end, env); if (r < 0) return r; r = prs_branch(&node, tok, term, src, end, env, FALSE); if (r < 0) { onig_node_free(node); return r; } *headp = onig_node_new_alt(node, NULL); if (IS_NULL(*headp)) { onig_node_free(node); onig_node_free(*top); *top = NULL_NODE; return ONIGERR_MEMORY; } headp = &(ND_CDR(*headp)); } if (tok->type != (enum TokenSyms )term) goto err; } else { onig_node_free(node); err: if (term == TK_SUBEXP_CLOSE) return ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS; else return ONIGERR_PARSER_BUG; } env->options = save_options; DEC_PARSE_DEPTH(env->parse_depth); return r; } static int prs_regexp(Node** top, UChar** src, UChar* end, ParseEnv* env) { int r; PToken tok; ptoken_init(&tok); r = fetch_token(&tok, src, end, env); if (r < 0) return r; r = prs_alts(top, &tok, TK_EOT, src, end, env, FALSE); if (r < 0) return r; return 0; } #ifdef USE_CALL static int make_call_zero_body(Node* node, ParseEnv* env, Node** rnode) { int r; Node* x = node_new_memory(0 /* 0: is not named */); CHECK_NULL_RETURN_MEMERR(x); ND_BODY(x) = node; BAG_(x)->m.regnum = 0; r = scan_env_set_mem_node(env, 0, x); if (r != 0) { onig_node_free(x); return r; } *rnode = x; return 0; } #endif extern int onig_parse_tree(Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ParseEnv* env) { int r; UChar* p; #ifdef USE_CALLOUT RegexExt* ext; #endif reg->string_pool = 0; reg->string_pool_end = 0; reg->num_mem = 0; reg->num_repeat = 0; reg->num_empty_check = 0; reg->repeat_range_alloc = 0; reg->repeat_range = (RepeatRange* )NULL; names_clear(reg); scan_env_clear(env); env->options = reg->options; env->case_fold_flag = reg->case_fold_flag; env->enc = reg->enc; env->syntax = reg->syntax; env->pattern = (UChar* )pattern; env->pattern_end = (UChar* )end; env->reg = reg; *root = NULL; if (! ONIGENC_IS_VALID_MBC_STRING(env->enc, pattern, end)) return ONIGERR_INVALID_WIDE_CHAR_VALUE; p = (UChar* )pattern; r = prs_regexp(root, &p, (UChar* )end, env); if (r != 0) return r; #ifdef USE_CALL if ((env->flags & PE_FLAG_HAS_CALL_ZERO) != 0) { Node* zero_node; r = make_call_zero_body(*root, env, &zero_node); if (r != 0) return r; *root = zero_node; } #endif reg->num_mem = env->num_mem; #ifdef USE_CALLOUT ext = reg->extp; if (IS_NOT_NULL(ext) && ext->callout_num > 0) { r = setup_ext_callout_list_values(reg); } #endif return r; } extern void onig_scan_env_set_error_string(ParseEnv* env, int ecode ARG_UNUSED, UChar* arg, UChar* arg_end) { env->error = arg; env->error_end = arg_end; } jq-1.8.2/vendor/oniguruma/src/utf16_be.c0000644000175100017510000001672215215513537013507 /********************************************************************** utf16_be.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" /* for USE_CALLOUT */ static int init(void) { #ifdef USE_CALLOUT int id; OnigEncoding enc; char* name; unsigned int args[4]; OnigValue opts[4]; enc = ONIG_ENCODING_UTF16_BE; name = "\000F\000A\000I\000L\000\000"; BC0_P(name, fail); name = "\000M\000I\000S\000M\000A\000T\000C\000H\000\000"; BC0_P(name, mismatch); name = "\000S\000K\000I\000P\000\000"; BC0_P(name, skip); name = "\000M\000A\000X\000\000"; args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; args[1] = ONIG_TYPE_CHAR; opts[0].c = 'X'; BC_B_O(name, max, 2, args, 1, opts); name = "\000E\000R\000R\000O\000R\000\000"; args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT; BC_P_O(name, error, 1, args, 1, opts); name = "\000C\000O\000U\000N\000T\000\000"; args[0] = ONIG_TYPE_CHAR; opts[0].c = '>'; BC_B_O(name, count, 1, args, 1, opts); name = "\000T\000O\000T\000A\000L\000_\000C\000O\000U\000N\000T\000\000"; args[0] = ONIG_TYPE_CHAR; opts[0].c = '>'; BC_B_O(name, total_count, 1, args, 1, opts); name = "\000C\000M\000P\000\000"; args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; args[1] = ONIG_TYPE_STRING; args[2] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; BC_P(name, cmp, 3, args); #endif /* USE_CALLOUT */ return ONIG_NORMAL; } static const int EncLen_UTF16[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; static int utf16be_mbc_enc_len(const UChar* p) { return EncLen_UTF16[*p]; } static int is_valid_mbc_string(const UChar* s, const UChar* end) { while (s < end) { int len = utf16be_mbc_enc_len(s); if (len == 4) { if (s + 2 >= end) return FALSE; if (! UTF16_IS_SURROGATE_SECOND(*(s+2))) return FALSE; } else if (UTF16_IS_SURROGATE_SECOND(*s)) return FALSE; s += len; } if (s != end) return FALSE; else return TRUE; } static int utf16be_is_mbc_newline(const UChar* p, const UChar* end) { if (p + 1 < end) { if (*(p+1) == NEWLINE_CODE && *p == 0x00) return 1; #ifdef USE_UNICODE_ALL_LINE_TERMINATORS if (( #ifndef USE_CRNL_AS_LINE_TERMINATOR *(p+1) == 0x0d || #endif *(p+1) == 0x85) && *p == 0x00) return 1; if (*p == 0x20 && (*(p+1) == 0x29 || *(p+1) == 0x28)) return 1; #endif } return 0; } static OnigCodePoint utf16be_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED) { OnigCodePoint code; if (UTF16_IS_SURROGATE_FIRST(*p)) { code = ((((p[0] - 0xd8) << 2) + ((p[1] & 0xc0) >> 6) + 1) << 16) + ((((p[1] & 0x3f) << 2) + (p[2] - 0xdc)) << 8) + p[3]; } else { code = p[0] * 256 + p[1]; } return code; } static int utf16be_code_to_mbclen(OnigCodePoint code) { if (code > 0xffff) { if (code > 0x10ffff) return ONIGERR_INVALID_CODE_POINT_VALUE; else return 4; } else { return 2; } } static int utf16be_code_to_mbc(OnigCodePoint code, UChar *buf) { UChar* p = buf; if (code > 0xffff) { unsigned int plane, high; plane = (code >> 16) - 1; *p++ = (plane >> 2) + 0xd8; high = (code & 0xff00) >> 8; *p++ = ((plane & 0x03) << 6) + (high >> 2); *p++ = (high & 0x03) + 0xdc; *p = (UChar )(code & 0xff); return 4; } else { *p++ = (UChar )((code & 0xff00) >> 8); *p = (UChar )(code & 0xff); return 2; } } static int utf16be_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold) { const UChar* p = *pp; if (ONIGENC_IS_ASCII_CODE(*(p+1)) && *p == 0) { p++; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (*p == 0x49) { *fold++ = 0x01; *fold = 0x31; (*pp) += 2; return 2; } } #endif *fold++ = 0; *fold = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p); *pp += 2; return 2; } else return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF16_BE, flag, pp, end, fold); } static UChar* utf16be_left_adjust_char_head(const UChar* start, const UChar* s) { if (s <= start) return (UChar* )s; if ((s - start) % 2 == 1) { s--; } if (UTF16_IS_SURROGATE_SECOND(*s) && s > start + 1 && UTF16_IS_SURROGATE_FIRST(*(s-2))) s -= 2; return (UChar* )s; } static int utf16be_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF16_BE, flag, p, end, items); } OnigEncodingType OnigEncodingUTF16_BE = { utf16be_mbc_enc_len, "UTF-16BE", /* name */ 4, /* max enc length */ 2, /* min enc length */ utf16be_is_mbc_newline, utf16be_mbc_to_code, utf16be_code_to_mbclen, utf16be_code_to_mbc, utf16be_mbc_case_fold, onigenc_unicode_apply_all_case_fold, utf16be_get_case_fold_codes_by_str, onigenc_unicode_property_name_to_ctype, onigenc_unicode_is_code_ctype, onigenc_utf16_32_get_ctype_code_range, utf16be_left_adjust_char_head, onigenc_always_false_is_allowed_reverse_match, init, 0, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_2, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/regparse.h0000644000175100017510000003675315215513537013717 #ifndef REGPARSE_H #define REGPARSE_H /********************************************************************** regparse.h - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2022 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #define ND_STRING_MARGIN 16 #define ND_STRING_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */ #define ND_BACKREFS_SIZE 6 /* node type */ typedef enum { ND_STRING = 0, ND_CCLASS = 1, ND_CTYPE = 2, ND_BACKREF = 3, ND_QUANT = 4, ND_BAG = 5, ND_ANCHOR = 6, ND_LIST = 7, ND_ALT = 8, ND_CALL = 9, ND_GIMMICK = 10 } NodeType; enum BagType { BAG_MEMORY = 0, BAG_OPTION = 1, BAG_STOP_BACKTRACK = 2, BAG_IF_ELSE = 3, }; enum GimmickType { GIMMICK_FAIL = 0, GIMMICK_SAVE = 1, GIMMICK_UPDATE_VAR = 2, #ifdef USE_CALLOUT GIMMICK_CALLOUT = 3, #endif }; enum BodyEmptyType { BODY_IS_NOT_EMPTY = 0, BODY_MAY_BE_EMPTY = 1, BODY_MAY_BE_EMPTY_MEM = 2, BODY_MAY_BE_EMPTY_REC = 3 }; /* bytes buffer */ typedef struct _BBuf { UChar* p; unsigned int used; unsigned int alloc; } BBuf; struct _Node; typedef struct { NodeType node_type; int status; struct _Node* parent; UChar* s; UChar* end; unsigned int flag; UChar buf[ND_STRING_BUF_SIZE]; int capacity; /* (allocated size - 1) or 0: use buf[] */ } StrNode; typedef struct { NodeType node_type; int status; struct _Node* parent; unsigned int flags; BitSet bs; BBuf* mbuf; /* multi-byte info or NULL */ } CClassNode; typedef struct { NodeType node_type; int status; struct _Node* parent; struct _Node* body; int lower; int upper; int greedy; enum BodyEmptyType emptiness; struct _Node* head_exact; struct _Node* next_head_exact; int include_referred; /* include called node. don't eliminate even if {0} */ MemStatusType empty_status_mem; } QuantNode; typedef struct { NodeType node_type; int status; struct _Node* parent; struct _Node* body; enum BagType type; union { struct { int regnum; AbsAddrType called_addr; int entry_count; int called_state; } m; struct { OnigOptionType options; } o; struct { /* body is condition */ struct _Node* Then; struct _Node* Else; } te; }; /* for multiple call reference */ OnigLen min_len; /* min length (byte) */ OnigLen max_len; /* max length (byte) */ OnigLen min_char_len; OnigLen max_char_len; int opt_count; /* referenced count in optimize_nodes() */ } BagNode; #ifdef USE_CALL typedef struct { int offset; struct _Node* target; } UnsetAddr; typedef struct { int num; int alloc; UnsetAddr* us; } UnsetAddrList; typedef struct { NodeType node_type; int status; struct _Node* parent; struct _Node* body; /* to BagNode : BAG_MEMORY */ int by_number; int called_gnum; UChar* name; UChar* name_end; int entry_count; } CallNode; #endif typedef struct { NodeType node_type; int status; struct _Node* parent; int back_num; int back_static[ND_BACKREFS_SIZE]; int* back_dynamic; int nest_level; } BackRefNode; typedef struct { NodeType node_type; int status; struct _Node* parent; struct _Node* body; int type; OnigLen char_min_len; OnigLen char_max_len; int ascii_mode; struct _Node* lead_node; } AnchorNode; typedef struct { NodeType node_type; int status; struct _Node* parent; struct _Node* car; struct _Node* cdr; } ConsAltNode; typedef struct { NodeType node_type; int status; struct _Node* parent; int ctype; int not; int ascii_mode; } CtypeNode; typedef struct { NodeType node_type; int status; struct _Node* parent; enum GimmickType type; int detail_type; int num; int id; } GimmickNode; typedef struct _Node { union { struct { NodeType node_type; int status; struct _Node* parent; struct _Node* body; } base; StrNode str; CClassNode cclass; QuantNode quant; BagNode bag; BackRefNode backref; AnchorNode anchor; ConsAltNode cons; CtypeNode ctype; #ifdef USE_CALL CallNode call; #endif GimmickNode gimmick; } u; } Node; typedef struct { int new_val; } GroupNumMap; #define NULL_NODE ((Node* )0) /* node type bit */ #define ND_TYPE2BIT(type) (1<<(type)) #define ND_BIT_STRING ND_TYPE2BIT(ND_STRING) #define ND_BIT_CCLASS ND_TYPE2BIT(ND_CCLASS) #define ND_BIT_CTYPE ND_TYPE2BIT(ND_CTYPE) #define ND_BIT_BACKREF ND_TYPE2BIT(ND_BACKREF) #define ND_BIT_QUANT ND_TYPE2BIT(ND_QUANT) #define ND_BIT_BAG ND_TYPE2BIT(ND_BAG) #define ND_BIT_ANCHOR ND_TYPE2BIT(ND_ANCHOR) #define ND_BIT_LIST ND_TYPE2BIT(ND_LIST) #define ND_BIT_ALT ND_TYPE2BIT(ND_ALT) #define ND_BIT_CALL ND_TYPE2BIT(ND_CALL) #define ND_BIT_GIMMICK ND_TYPE2BIT(ND_GIMMICK) #define ND_TYPE(node) ((node)->u.base.node_type) #define ND_SET_TYPE(node, ntype) (node)->u.base.node_type = (ntype) #define STR_(node) (&((node)->u.str)) #define CCLASS_(node) (&((node)->u.cclass)) #define CTYPE_(node) (&((node)->u.ctype)) #define BACKREF_(node) (&((node)->u.backref)) #define QUANT_(node) (&((node)->u.quant)) #define BAG_(node) (&((node)->u.bag)) #define ANCHOR_(node) (&((node)->u.anchor)) #define CONS_(node) (&((node)->u.cons)) #define CALL_(node) (&((node)->u.call)) #define GIMMICK_(node) (&((node)->u.gimmick)) #define ND_CAR(node) (CONS_(node)->car) #define ND_CDR(node) (CONS_(node)->cdr) #define CTYPE_ANYCHAR -1 #define ND_IS_ANYCHAR(node) \ (ND_TYPE(node) == ND_CTYPE && CTYPE_(node)->ctype == CTYPE_ANYCHAR) #define ANCR_ANYCHAR_INF_MASK (ANCR_ANYCHAR_INF | ANCR_ANYCHAR_INF_ML) #define ANCR_END_BUF_MASK (ANCR_END_BUF | ANCR_SEMI_END_BUF) #define ND_STRING_CRUDE (1<<0) #define ND_STRING_CASE_EXPANDED (1<<1) #define ND_STRING_LEN(node) (int )((node)->u.str.end - (node)->u.str.s) #define ND_STRING_SET_CRUDE(node) (node)->u.str.flag |= ND_STRING_CRUDE #define ND_STRING_CLEAR_CRUDE(node) (node)->u.str.flag &= ~ND_STRING_CRUDE #define ND_STRING_SET_CASE_EXPANDED(node) (node)->u.str.flag |= ND_STRING_CASE_EXPANDED #define ND_STRING_IS_CRUDE(node) \ (((node)->u.str.flag & ND_STRING_CRUDE) != 0) #define ND_STRING_IS_CASE_EXPANDED(node) \ (((node)->u.str.flag & ND_STRING_CASE_EXPANDED) != 0) #define BACKREFS_P(br) \ (IS_NOT_NULL((br)->back_dynamic) ? (br)->back_dynamic : (br)->back_static) /* node status bits */ #define ND_ST_FIXED_MIN (1<<0) #define ND_ST_FIXED_MAX (1<<1) #define ND_ST_FIXED_CLEN (1<<2) #define ND_ST_MARK1 (1<<3) #define ND_ST_MARK2 (1<<4) #define ND_ST_STRICT_REAL_REPEAT (1<<5) #define ND_ST_RECURSION (1<<6) #define ND_ST_CALLED (1<<7) #define ND_ST_FIXED_ADDR (1<<8) #define ND_ST_NAMED_GROUP (1<<9) #define ND_ST_IN_REAL_REPEAT (1<<10) /* STK_REPEAT is nested in stack. */ #define ND_ST_IN_ZERO_REPEAT (1<<11) /* (....){0} */ #define ND_ST_IN_MULTI_ENTRY (1<<12) #define ND_ST_NEST_LEVEL (1<<13) #define ND_ST_BY_NUMBER (1<<14) /* {n,m} */ #define ND_ST_BY_NAME (1<<15) /* backref by name */ #define ND_ST_BACKREF (1<<16) #define ND_ST_CHECKER (1<<17) #define ND_ST_PROHIBIT_RECURSION (1<<18) #define ND_ST_SUPER (1<<19) #define ND_ST_EMPTY_STATUS_CHECK (1<<20) #define ND_ST_IGNORECASE (1<<21) #define ND_ST_MULTILINE (1<<22) #define ND_ST_TEXT_SEGMENT_WORD (1<<23) #define ND_ST_ABSENT_WITH_SIDE_EFFECTS (1<<24) /* stopper or clear */ #define ND_ST_FIXED_CLEN_MIN_SURE (1<<25) #define ND_ST_REFERENCED (1<<26) #define ND_ST_INPEEK (1<<27) #define ND_ST_WHOLE_OPTIONS (1<<28) #define ND_STATUS(node) (((Node* )node)->u.base.status) #define ND_STATUS_ADD(node,f) (ND_STATUS(node) |= (ND_ST_ ## f)) #define ND_STATUS_REMOVE(node,f) (ND_STATUS(node) &= ~(ND_ST_ ## f)) #define ND_IS_BY_NUMBER(node) ((ND_STATUS(node) & ND_ST_BY_NUMBER) != 0) #define ND_IS_IN_REAL_REPEAT(node) ((ND_STATUS(node) & ND_ST_IN_REAL_REPEAT) != 0) #define ND_IS_CALLED(node) ((ND_STATUS(node) & ND_ST_CALLED) != 0) #define ND_IS_IN_MULTI_ENTRY(node) ((ND_STATUS(node) & ND_ST_IN_MULTI_ENTRY) != 0) #define ND_IS_RECURSION(node) ((ND_STATUS(node) & ND_ST_RECURSION) != 0) #define ND_IS_IN_ZERO_REPEAT(node) ((ND_STATUS(node) & ND_ST_IN_ZERO_REPEAT) != 0) #define ND_IS_NAMED_GROUP(node) ((ND_STATUS(node) & ND_ST_NAMED_GROUP) != 0) #define ND_IS_FIXED_ADDR(node) ((ND_STATUS(node) & ND_ST_FIXED_ADDR) != 0) #define ND_IS_FIXED_CLEN(node) ((ND_STATUS(node) & ND_ST_FIXED_CLEN) != 0) #define ND_IS_FIXED_MIN(node) ((ND_STATUS(node) & ND_ST_FIXED_MIN) != 0) #define ND_IS_FIXED_MAX(node) ((ND_STATUS(node) & ND_ST_FIXED_MAX) != 0) #define ND_IS_MARK1(node) ((ND_STATUS(node) & ND_ST_MARK1) != 0) #define ND_IS_MARK2(node) ((ND_STATUS(node) & ND_ST_MARK2) != 0) #define ND_IS_NEST_LEVEL(node) ((ND_STATUS(node) & ND_ST_NEST_LEVEL) != 0) #define ND_IS_BY_NAME(node) ((ND_STATUS(node) & ND_ST_BY_NAME) != 0) #define ND_IS_BACKREF(node) ((ND_STATUS(node) & ND_ST_BACKREF) != 0) #define ND_IS_CHECKER(node) ((ND_STATUS(node) & ND_ST_CHECKER) != 0) #define ND_IS_SUPER(node) ((ND_STATUS(node) & ND_ST_SUPER) != 0) #define ND_IS_PROHIBIT_RECURSION(node) \ ((ND_STATUS(node) & ND_ST_PROHIBIT_RECURSION) != 0) #define ND_IS_STRICT_REAL_REPEAT(node) \ ((ND_STATUS(node) & ND_ST_STRICT_REAL_REPEAT) != 0) #define ND_IS_EMPTY_STATUS_CHECK(node) \ ((ND_STATUS(node) & ND_ST_EMPTY_STATUS_CHECK) != 0) #define ND_IS_IGNORECASE(node) ((ND_STATUS(node) & ND_ST_IGNORECASE) != 0) #define ND_IS_MULTILINE(node) ((ND_STATUS(node) & ND_ST_MULTILINE) != 0) #define ND_IS_TEXT_SEGMENT_WORD(node) ((ND_STATUS(node) & ND_ST_TEXT_SEGMENT_WORD) != 0) #define ND_IS_ABSENT_WITH_SIDE_EFFECTS(node) ((ND_STATUS(node) & ND_ST_ABSENT_WITH_SIDE_EFFECTS) != 0) #define ND_IS_FIXED_CLEN_MIN_SURE(node) ((ND_STATUS(node) & ND_ST_FIXED_CLEN_MIN_SURE) != 0) #define ND_IS_REFERENCED(node) ((ND_STATUS(node) & ND_ST_REFERENCED) != 0) #define ND_IS_INPEEK(node) ((ND_STATUS(node) & ND_ST_INPEEK) != 0) #define ND_IS_WHOLE_OPTIONS(node) ((ND_STATUS(node) & ND_ST_WHOLE_OPTIONS) != 0) #define ND_PARENT(node) ((node)->u.base.parent) #define ND_BODY(node) ((node)->u.base.body) #define ND_QUANT_BODY(node) ((node)->body) #define ND_BAG_BODY(node) ((node)->body) #define ND_CALL_BODY(node) ((node)->body) #define ND_ANCHOR_BODY(node) ((node)->body) #define PARSEENV_MEMENV_SIZE 8 #define PARSEENV_MEMENV(senv) \ (IS_NOT_NULL((senv)->mem_env_dynamic) ? \ (senv)->mem_env_dynamic : (senv)->mem_env_static) #define IS_SYNTAX_OP(syn, opm) (((syn)->op & (opm)) != 0) #define IS_SYNTAX_OP2(syn, opm) (((syn)->op2 & (opm)) != 0) #define IS_SYNTAX_BV(syn, bvm) (((syn)->behavior & (bvm)) != 0) #define ID_ENTRY(env, id) do {\ id = (env)->id_num++;\ } while(0) typedef struct { Node* mem_node; Node* empty_repeat_node; } MemEnv; typedef struct { enum SaveType type; } SaveItem; typedef struct { OnigOptionType options; OnigCaseFoldType case_fold_flag; OnigEncoding enc; OnigSyntaxType* syntax; MemStatusType cap_history; MemStatusType backtrack_mem; /* backtrack/recursion */ MemStatusType backrefed_mem; UChar* pattern; UChar* pattern_end; UChar* error; UChar* error_end; regex_t* reg; /* for reg->names only */ int num_call; int num_mem; int num_named; int mem_alloc; MemEnv mem_env_static[PARSEENV_MEMENV_SIZE]; MemEnv* mem_env_dynamic; int backref_num; int keep_num; int id_num; int save_alloc_num; SaveItem* saves; #ifdef USE_CALL UnsetAddrList* unset_addr_list; #endif unsigned int parse_depth; #ifdef ONIG_DEBUG_PARSE unsigned int max_parse_depth; #endif unsigned int flags; } ParseEnv; #define PE_FLAG_HAS_CALL_ZERO (1<<0) #define PE_FLAG_HAS_WHOLE_OPTIONS (1<<1) #define PE_FLAG_HAS_ABSENT_STOPPER (1<<2) extern int onig_renumber_name_table P_((regex_t* reg, GroupNumMap* map)); extern int onig_strncmp P_((const UChar* s1, const UChar* s2, int n)); extern void onig_strcpy P_((UChar* dest, const UChar* src, const UChar* end)); extern void onig_scan_env_set_error_string P_((ParseEnv* env, int ecode, UChar* arg, UChar* arg_end)); extern int onig_reduce_nested_quantifier P_((Node* pnode)); extern int onig_node_copy(Node** rcopy, Node* from); extern int onig_node_str_cat P_((Node* node, const UChar* s, const UChar* end)); extern int onig_node_str_set P_((Node* node, const UChar* s, const UChar* end, int need_free)); extern void onig_node_str_clear P_((Node* node, int need_free)); extern void onig_node_free P_((Node* node)); extern int onig_node_reset_empty P_((Node* node)); extern int onig_node_reset_fail P_((Node* node)); extern Node* onig_node_new_bag P_((enum BagType type)); extern Node* onig_node_new_str P_((const UChar* s, const UChar* end)); extern Node* onig_node_new_list P_((Node* left, Node* right)); extern Node* onig_node_new_alt P_((Node* left, Node* right)); extern int onig_names_free P_((regex_t* reg)); extern int onig_parse_tree P_((Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ParseEnv* env)); extern int onig_free_shared_cclass_table P_((void)); extern int onig_is_code_in_cc P_((OnigEncoding enc, OnigCodePoint code, CClassNode* cc)); extern int onig_new_cclass_with_code_list(Node** rnode, OnigEncoding enc, int n, OnigCodePoint codes[]); extern OnigLen onig_get_tiny_min_len(Node* node, unsigned int inhibit_node_types, int* invalid_node); #ifdef USE_CALLOUT extern int onig_global_callout_names_free(void); #endif #ifdef ONIG_DEBUG extern int onig_print_names(FILE*, regex_t*); #endif #endif /* REGPARSE_H */ jq-1.8.2/vendor/oniguruma/src/regint.h0000644000175100017510000010224415215513537013364 #ifndef REGINT_H #define REGINT_H /********************************************************************** regint.h - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ /* for debug */ /* #define ONIG_DEBUG_PARSE */ /* #define ONIG_DEBUG_COMPILE */ /* #define ONIG_DEBUG_SEARCH */ /* #define ONIG_DEBUG_MATCH */ /* #define ONIG_DEBUG_MATCH_COUNTER */ /* #define ONIG_DEBUG_CALL */ /* #define ONIG_DONT_OPTIMIZE */ /* #define ONIG_DEBUG */ /* for byte-code statistical data. */ /* #define ONIG_DEBUG_STATISTICS */ #if defined(ONIG_DEBUG_PARSE) || defined(ONIG_DEBUG_MATCH) || \ defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \ defined(ONIG_DEBUG_MATCH_COUNTER) || defined(ONIG_DEBUG_CALL) || \ defined(ONIG_DEBUG_STATISTICS) #ifndef ONIG_DEBUG #define ONIG_DEBUG #endif #endif #ifdef ONIG_DEBUG #define DBGFP stderr #endif #ifndef ONIG_DISABLE_DIRECT_THREADING #ifdef __GNUC__ #define USE_GOTO_LABELS_AS_VALUES #endif #endif #ifndef ONIG_PRINTFLIKE #if defined(__clang__) || defined(__GNUC__) #define ONIG_PRINTFLIKE(x, y) __attribute__((format(printf, x, y))) #else #define ONIG_PRINTFLIKE(x, y) #endif #endif /* config */ /* spec. config */ #define USE_REGSET #define USE_CALL #define USE_CALLOUT #define USE_SKIP_SEARCH #define USE_BACKREF_WITH_LEVEL /* \k, \k */ #define USE_WHOLE_OPTIONS #define USE_RIGID_CHECK_CAPTURES_IN_EMPTY_REPEAT /* /(?:()|())*\2/ */ #define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */ #define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR #define USE_RETRY_LIMIT #ifdef USE_GOTO_LABELS_AS_VALUES #define USE_THREADED_CODE #define USE_DIRECT_THREADED_CODE #endif /* internal config */ #define USE_CHECK_VALIDITY_OF_STRING_IN_TREE #define USE_OP_PUSH_OR_JUMP_EXACT #define USE_QUANT_PEEK_NEXT #define USE_ST_LIBRARY #define USE_TIMEOFDAY #define USE_STRICT_POINTER_ADDRESS #define USE_STRICT_POINTER_COMPARISON #define USE_WORD_BEGIN_END /* "\<", "\>" */ #define USE_CAPTURE_HISTORY #define USE_VARIABLE_META_CHARS #define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE /* #define USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR */ /* enabled by configure --enable-posix-api=yes */ /* #define USE_POSIX_API */ #define DEFAULT_PARSE_DEPTH_LIMIT 4096 #define INIT_MATCH_STACK_SIZE 160 #define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */ #define DEFAULT_RETRY_LIMIT_IN_MATCH 10000000 #define DEFAULT_RETRY_LIMIT_IN_SEARCH 0 /* unlimited */ #define DEFAULT_SUBEXP_CALL_LIMIT_IN_SEARCH 0 /* unlimited */ #define DEFAULT_SUBEXP_CALL_MAX_NEST_LEVEL 20 #include "regenc.h" #ifndef ONIG_NO_STANDARD_C_HEADERS #include #include #include #include #include #include #ifdef HAVE_STDINT_H #include #endif #if defined(HAVE_ALLOCA_H) #include #endif #ifdef HAVE_SYS_TYPES_H #ifndef __BORLANDC__ #include #endif #endif #ifdef HAVE_INTTYPES_H #include #endif #if defined(_WIN32) || defined(__BORLANDC__) #include #endif #if defined(ONIG_DEBUG) || defined(NEED_TO_INCLUDE_STDIO) # include #endif #ifdef ONIG_DEBUG_STATISTICS #ifdef USE_TIMEOFDAY #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #else /* USE_TIMEOFDAY */ #ifdef HAVE_SYS_TIMES_H #include #endif #endif /* USE_TIMEOFDAY */ #endif /* ONIG_DEBUG_STATISTICS */ /* I don't think these x....'s need to be included in ONIG_NO_STANDARD_C_HEADERS, but they are required by Issue #170 and do so since there is no problem. */ #ifndef xmemset #define xmemset memset #endif #ifndef xmemcpy #define xmemcpy memcpy #endif #ifndef xmemmove #define xmemmove memmove #endif #endif /* ONIG_NO_STANDARD_C_HEADERS */ #ifdef MIN #undef MIN #endif #ifdef MAX #undef MAX #endif #define MIN(a,b) (((a)>(b))?(b):(a)) #define MAX(a,b) (((a)<(b))?(b):(a)) #define IS_NULL(p) (((void*)(p)) == (void*)0) #define IS_NOT_NULL(p) (((void*)(p)) != (void*)0) #define CHECK_NULL_RETURN(p) if (IS_NULL(p)) return NULL #define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY #define NULL_UCHARP ((UChar* )0) #ifdef USE_STRICT_POINTER_COMPARISON #define PTR_GE(p,q) ((p) != NULL && (p) >= (q)) #else #define PTR_GE(p,q) (p) >= (q) #endif #ifndef ONIG_INT_MAX #define ONIG_INT_MAX INT_MAX #endif #define CHAR_MAP_SIZE 256 #define INFINITE_LEN ONIG_INFINITE_DISTANCE #define STEP_BACK_MAX_CHAR_LEN 65535 /* INT_MAX is too big */ #define LOOK_BEHIND_MAX_CHAR_LEN STEP_BACK_MAX_CHAR_LEN /* escape other system UChar definition */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION #endif #define xmalloc malloc #define xrealloc realloc #define xcalloc calloc #define xfree free #define st_init_table onig_st_init_table #define st_init_table_with_size onig_st_init_table_with_size #define st_init_numtable onig_st_init_numtable #define st_init_numtable_with_size onig_st_init_numtable_with_size #define st_init_strtable onig_st_init_strtable #define st_init_strtable_with_size onig_st_init_strtable_with_size #define st_delete onig_st_delete #define st_delete_safe onig_st_delete_safe #define st_insert onig_st_insert #define st_lookup onig_st_lookup #define st_foreach onig_st_foreach #define st_add_direct onig_st_add_direct #define st_free_table onig_st_free_table #define st_cleanup_safe onig_st_cleanup_safe #define st_copy onig_st_copy #define st_nothing_key_clone onig_st_nothing_key_clone #define st_nothing_key_free onig_st_nothing_key_free /* */ #define onig_st_is_member st_is_member #if defined(_WIN32) && !defined(__GNUC__) #ifndef xalloca #define xalloca _alloca #endif #ifndef xvsnprintf #define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args) #endif #ifndef xsnprintf #define xsnprintf sprintf_s #endif #ifndef xstrcat #define xstrcat(dest,src,size) strcat_s(dest,size,src) #endif #else #ifndef xalloca #define xalloca alloca #endif #ifndef xvsnprintf #define xvsnprintf vsnprintf #endif #ifndef xsnprintf #define xsnprintf snprintf #endif #ifndef xstrcat #define xstrcat(dest,src,size) strcat(dest,src) #endif #endif /* defined(_WIN32) && !defined(__GNUC__) */ #ifdef _WIN32 #ifdef _MSC_VER #if _MSC_VER < 1300 typedef int intptr_t; typedef unsigned int uintptr_t; #endif #if _MSC_VER < 1600 typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #endif #endif #endif /* _WIN32 */ #if SIZEOF_VOIDP == SIZEOF_LONG typedef unsigned long hash_data_type; #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG typedef unsigned long long hash_data_type; #endif /* strend hash */ typedef void* hash_table_type; #ifdef USE_CALLOUT typedef struct { int flag; OnigCalloutOf of; int in; int name_id; const UChar* tag_start; const UChar* tag_end; OnigCalloutType type; OnigCalloutFunc start_func; OnigCalloutFunc end_func; union { struct { const UChar* start; const UChar* end; } content; struct { int num; int passed_num; OnigType types[ONIG_CALLOUT_MAX_ARGS_NUM]; OnigValue vals[ONIG_CALLOUT_MAX_ARGS_NUM]; } arg; } u; } CalloutListEntry; #endif /* stack pop level */ enum StackPopLevel { STACK_POP_LEVEL_FREE = 0, STACK_POP_LEVEL_MEM_START = 1, STACK_POP_LEVEL_ALL = 2 }; /* optimize flags */ enum OptimizeType { OPTIMIZE_NONE = 0, OPTIMIZE_STR, /* Slow Search */ OPTIMIZE_STR_FAST, /* Sunday quick search / BMH */ OPTIMIZE_STR_FAST_STEP_FORWARD, /* Sunday quick search / BMH */ OPTIMIZE_MAP /* char map */ }; /* bit status */ typedef unsigned int MemStatusType; #define MEM_STATUS_BITS_NUM (sizeof(MemStatusType) * 8) #define MEM_STATUS_CLEAR(stats) (stats) = 0 #define MEM_STATUS_ON_ALL(stats) (stats) = ~((MemStatusType )0) #define MEM_STATUS_AT(stats,n) \ ((n) < (int )MEM_STATUS_BITS_NUM ? ((stats) & ((MemStatusType )1 << n)) : ((stats) & 1)) #define MEM_STATUS_AT0(stats,n) \ ((n) > 0 && (n) < (int )MEM_STATUS_BITS_NUM ? ((stats) & ((MemStatusType )1 << n)) : ((stats) & 1)) #define MEM_STATUS_IS_ALL_ON(stats) (((stats) & 1) != 0) #define MEM_STATUS_ON(stats,n) do {\ if ((n) < (int )MEM_STATUS_BITS_NUM) {\ if ((n) != 0)\ (stats) |= ((MemStatusType )1 << (n));\ }\ else\ (stats) |= 1;\ } while (0) #define MEM_STATUS_ON_SIMPLE(stats,n) do {\ if ((n) < (int )MEM_STATUS_BITS_NUM)\ (stats) |= ((MemStatusType )1 << (n));\ } while (0) #define MEM_STATUS_LIMIT_AT(stats,n) \ ((n) < (int )MEM_STATUS_BITS_NUM ? ((stats) & ((MemStatusType )1 << n)) : 0) #define MEM_STATUS_LIMIT_ON(stats,n) do {\ if ((n) < (int )MEM_STATUS_BITS_NUM && (n) != 0) {\ (stats) |= ((MemStatusType )1 << (n));\ }\ } while (0) #define IS_CODE_WORD_ASCII(enc,code) \ (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code)) #define IS_CODE_DIGIT_ASCII(enc, code) \ (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_DIGIT(enc,code)) #define IS_CODE_XDIGIT_ASCII(enc, code) \ (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_XDIGIT(enc,code)) #define DIGITVAL(code) ((code) - '0') #define ODIGITVAL(code) DIGITVAL(code) #define XDIGITVAL(enc,code) \ (IS_CODE_DIGIT_ASCII(enc,code) ? DIGITVAL(code) \ : (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10)) #define OPTON_CALLBACK_EACH_MATCH(option) \ ((option) & ONIG_OPTION_CALLBACK_EACH_MATCH) #define OPTON_FIND_LONGEST(option) ((option) & ONIG_OPTION_FIND_LONGEST) #define OPTON_FIND_NOT_EMPTY(option) ((option) & ONIG_OPTION_FIND_NOT_EMPTY) #define OPTON_NEGATE_SINGLELINE(option) ((option) & \ ONIG_OPTION_NEGATE_SINGLELINE) #define OPTON_DONT_CAPTURE_GROUP(option) ((option) & \ ONIG_OPTION_DONT_CAPTURE_GROUP) #define OPTON_CAPTURE_GROUP(option) ((option) & ONIG_OPTION_CAPTURE_GROUP) #define OPTON_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL) #define OPTON_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL) #define OPTON_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION) #define OPTON_CHECK_VALIDITY_OF_STRING(option) ((option) & \ ONIG_OPTION_CHECK_VALIDITY_OF_STRING) #define OPTON_NOT_BEGIN_STRING(option) ((option) & ONIG_OPTION_NOT_BEGIN_STRING) #define OPTON_NOT_END_STRING(option) ((option) & ONIG_OPTION_NOT_END_STRING) #define OPTON_NOT_BEGIN_POSITION(option) ((option) & ONIG_OPTION_NOT_BEGIN_POSITION) #define OPTON_MATCH_WHOLE_STRING(option) ((option) & ONIG_OPTION_MATCH_WHOLE_STRING) #define INFINITE_REPEAT -1 #define IS_INFINITE_REPEAT(n) ((n) == INFINITE_REPEAT) /* bitset */ #define BITS_PER_BYTE 8 #define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE) #define BITS_IN_ROOM 32 /* 4 * BITS_PER_BYTE */ #define BITSET_REAL_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM) typedef uint32_t Bits; typedef Bits BitSet[BITSET_REAL_SIZE]; typedef Bits* BitSetRef; #define SIZE_BITSET sizeof(BitSet) #define BITSET_CLEAR(bs) do {\ int i;\ for (i = 0; i < (int )BITSET_REAL_SIZE; i++) { (bs)[i] = 0; } \ } while (0) #define BS_ROOM(bs,pos) (bs)[(unsigned int )(pos) >> 5] #define BS_BIT(pos) (1u << ((unsigned int )(pos) & 0x1f)) #define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos)) #define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos) #define BITSET_CLEAR_BIT(bs, pos) BS_ROOM(bs,pos) &= ~(BS_BIT(pos)) #define BITSET_INVERT_BIT(bs, pos) BS_ROOM(bs,pos) ^= BS_BIT(pos) /* has body */ #define ANCR_PREC_READ (1<<0) #define ANCR_PREC_READ_NOT (1<<1) #define ANCR_LOOK_BEHIND (1<<2) #define ANCR_LOOK_BEHIND_NOT (1<<3) /* no body */ #define ANCR_BEGIN_BUF (1<<4) #define ANCR_BEGIN_LINE (1<<5) #define ANCR_BEGIN_POSITION (1<<6) #define ANCR_END_BUF (1<<7) #define ANCR_SEMI_END_BUF (1<<8) #define ANCR_END_LINE (1<<9) #define ANCR_WORD_BOUNDARY (1<<10) #define ANCR_NO_WORD_BOUNDARY (1<<11) #define ANCR_WORD_BEGIN (1<<12) #define ANCR_WORD_END (1<<13) #define ANCR_ANYCHAR_INF (1<<14) #define ANCR_ANYCHAR_INF_ML (1<<15) #define ANCR_TEXT_SEGMENT_BOUNDARY (1<<16) #define ANCR_NO_TEXT_SEGMENT_BOUNDARY (1<<17) #define ANCHOR_HAS_BODY(a) ((a)->type < ANCR_BEGIN_BUF) #define IS_WORD_ANCHOR_TYPE(type) \ ((type) == ANCR_WORD_BOUNDARY || (type) == ANCR_NO_WORD_BOUNDARY || \ (type) == ANCR_WORD_BEGIN || (type) == ANCR_WORD_END) /* operation code */ enum OpCode { OP_FINISH = 0, /* matching process terminator (no more alternative) */ OP_END, /* pattern code terminator (success end) */ OP_STR_1, /* single byte, N = 1 */ OP_STR_2, /* single byte, N = 2 */ OP_STR_3, /* single byte, N = 3 */ OP_STR_4, /* single byte, N = 4 */ OP_STR_5, /* single byte, N = 5 */ OP_STR_N, /* single byte */ OP_STR_MB2N1, /* mb-length = 2 N = 1 */ OP_STR_MB2N2, /* mb-length = 2 N = 2 */ OP_STR_MB2N3, /* mb-length = 2 N = 3 */ OP_STR_MB2N, /* mb-length = 2 */ OP_STR_MB3N, /* mb-length = 3 */ OP_STR_MBN, /* other length */ OP_CCLASS, OP_CCLASS_MB, OP_CCLASS_MIX, OP_CCLASS_NOT, OP_CCLASS_MB_NOT, OP_CCLASS_MIX_NOT, OP_ANYCHAR, /* "." */ OP_ANYCHAR_ML, /* "." multi-line */ OP_ANYCHAR_STAR, /* ".*" */ OP_ANYCHAR_ML_STAR, /* ".*" multi-line */ OP_ANYCHAR_STAR_PEEK_NEXT, OP_ANYCHAR_ML_STAR_PEEK_NEXT, OP_WORD, OP_WORD_ASCII, OP_NO_WORD, OP_NO_WORD_ASCII, OP_WORD_BOUNDARY, OP_NO_WORD_BOUNDARY, OP_WORD_BEGIN, OP_WORD_END, OP_TEXT_SEGMENT_BOUNDARY, OP_BEGIN_BUF, OP_END_BUF, OP_BEGIN_LINE, OP_END_LINE, OP_SEMI_END_BUF, OP_CHECK_POSITION, OP_BACKREF1, OP_BACKREF2, OP_BACKREF_N, OP_BACKREF_N_IC, OP_BACKREF_MULTI, OP_BACKREF_MULTI_IC, #ifdef USE_BACKREF_WITH_LEVEL OP_BACKREF_WITH_LEVEL, /* \k, \k */ OP_BACKREF_WITH_LEVEL_IC, /* \k, \k */ #endif OP_BACKREF_CHECK, /* (?(n)), (?('name')) */ #ifdef USE_BACKREF_WITH_LEVEL OP_BACKREF_CHECK_WITH_LEVEL, /* (?(n-level)), (?('name-level')) */ #endif OP_MEM_START, OP_MEM_START_PUSH, /* push back-tracker to stack */ OP_MEM_END_PUSH, /* push back-tracker to stack */ #ifdef USE_CALL OP_MEM_END_PUSH_REC, /* push back-tracker to stack */ #endif OP_MEM_END, #ifdef USE_CALL OP_MEM_END_REC, /* push marker to stack */ #endif OP_FAIL, /* pop stack and move */ OP_JUMP, OP_PUSH, OP_PUSH_SUPER, OP_POP, OP_POP_TO_MARK, #ifdef USE_OP_PUSH_OR_JUMP_EXACT OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */ #endif OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */ OP_REPEAT, /* {n,m} */ OP_REPEAT_NG, /* {n,m}? (non greedy) */ OP_REPEAT_INC, OP_REPEAT_INC_NG, /* non greedy */ OP_EMPTY_CHECK_START, /* null loop checker start */ OP_EMPTY_CHECK_END, /* null loop checker end */ OP_EMPTY_CHECK_END_MEMST, /* null loop checker end (with capture status) */ #ifdef USE_CALL OP_EMPTY_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */ #endif OP_MOVE, OP_STEP_BACK_START, OP_STEP_BACK_NEXT, OP_CUT_TO_MARK, OP_MARK, OP_SAVE_VAL, OP_UPDATE_VAR, #ifdef USE_CALL OP_CALL, /* \g */ OP_RETURN, #endif #ifdef USE_CALLOUT OP_CALLOUT_CONTENTS, /* (?{...}) (?{{...}}) */ OP_CALLOUT_NAME, /* (*name) (*name[tag](args...)) */ #endif }; enum SaveType { SAVE_KEEP = 0, /* SAVE S */ SAVE_S = 1, SAVE_RIGHT_RANGE = 2, }; enum UpdateVarType { UPDATE_VAR_KEEP_FROM_STACK_LAST = 0, UPDATE_VAR_S_FROM_STACK = 1, UPDATE_VAR_RIGHT_RANGE_FROM_STACK = 2, UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK = 3, UPDATE_VAR_RIGHT_RANGE_TO_S = 4, UPDATE_VAR_RIGHT_RANGE_INIT = 5, }; enum CheckPositionType { CHECK_POSITION_SEARCH_START = 0, CHECK_POSITION_CURRENT_RIGHT_RANGE = 1, }; enum TextSegmentBoundaryType { EXTENDED_GRAPHEME_CLUSTER_BOUNDARY = 0, WORD_BOUNDARY = 1, }; typedef int RelAddrType; typedef int AbsAddrType; typedef int LengthType; typedef int RelPositionType; typedef int RepeatNumType; typedef int MemNumType; typedef void* PointerType; typedef int SaveType; typedef int UpdateVarType; typedef int ModeType; #define SIZE_OPCODE 1 #define SIZE_RELADDR sizeof(RelAddrType) #define SIZE_ABSADDR sizeof(AbsAddrType) #define SIZE_LENGTH sizeof(LengthType) #define SIZE_MEMNUM sizeof(MemNumType) #define SIZE_REPEATNUM sizeof(RepeatNumType) #define SIZE_OPTION sizeof(OnigOptionType) #define SIZE_CODE_POINT sizeof(OnigCodePoint) #define SIZE_POINTER sizeof(PointerType) #define SIZE_SAVE_TYPE sizeof(SaveType) #define SIZE_UPDATE_VAR_TYPE sizeof(UpdateVarType) #define SIZE_MODE sizeof(ModeType) /* code point's address must be aligned address. */ #define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p)) /* op-code + arg size */ /* for relative address increment to go next op. */ #define SIZE_INC 1 #define OPSIZE_ANYCHAR_STAR 1 #define OPSIZE_ANYCHAR_STAR_PEEK_NEXT 1 #define OPSIZE_JUMP 1 #define OPSIZE_PUSH 1 #define OPSIZE_PUSH_SUPER 1 #define OPSIZE_POP 1 #define OPSIZE_POP_TO_MARK 1 #ifdef USE_OP_PUSH_OR_JUMP_EXACT #define OPSIZE_PUSH_OR_JUMP_EXACT1 1 #endif #define OPSIZE_PUSH_IF_PEEK_NEXT 1 #define OPSIZE_REPEAT 1 #define OPSIZE_REPEAT_INC 1 #define OPSIZE_REPEAT_INC_NG 1 #define OPSIZE_WORD_BOUNDARY 1 #define OPSIZE_BACKREF 1 #define OPSIZE_FAIL 1 #define OPSIZE_MEM_START 1 #define OPSIZE_MEM_START_PUSH 1 #define OPSIZE_MEM_END_PUSH 1 #define OPSIZE_MEM_END_PUSH_REC 1 #define OPSIZE_MEM_END 1 #define OPSIZE_MEM_END_REC 1 #define OPSIZE_EMPTY_CHECK_START 1 #define OPSIZE_EMPTY_CHECK_END 1 #define OPSIZE_CHECK_POSITION 1 #define OPSIZE_CALL 1 #define OPSIZE_RETURN 1 #define OPSIZE_MOVE 1 #define OPSIZE_STEP_BACK_START 1 #define OPSIZE_STEP_BACK_NEXT 1 #define OPSIZE_CUT_TO_MARK 1 #define OPSIZE_MARK 1 #define OPSIZE_SAVE_VAL 1 #define OPSIZE_UPDATE_VAR 1 #ifdef USE_CALLOUT #define OPSIZE_CALLOUT_CONTENTS 1 #define OPSIZE_CALLOUT_NAME 1 #endif #define MC_ESC(syn) (syn)->meta_char_table.esc #define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar #define MC_ANYTIME(syn) (syn)->meta_char_table.anytime #define MC_ZERO_OR_ONE_TIME(syn) (syn)->meta_char_table.zero_or_one_time #define MC_ONE_OR_MORE_TIME(syn) (syn)->meta_char_table.one_or_more_time #define MC_ANYCHAR_ANYTIME(syn) (syn)->meta_char_table.anychar_anytime #define IS_MC_ESC_CODE(code, syn) \ ((code) == MC_ESC(syn) && \ !IS_SYNTAX_OP2((syn), ONIG_SYN_OP2_INEFFECTIVE_ESCAPE)) #define SYN_POSIX_COMMON_OP \ ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_POSIX_BRACKET | \ ONIG_SYN_OP_DECIMAL_BACKREF | \ ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_ASTERISK_ZERO_INF | \ ONIG_SYN_OP_LINE_ANCHOR | \ ONIG_SYN_OP_ESC_CONTROL_CHARS ) #define SYN_GNU_REGEX_OP \ ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | \ ONIG_SYN_OP_POSIX_BRACKET | ONIG_SYN_OP_DECIMAL_BACKREF | \ ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_LPAREN_SUBEXP | \ ONIG_SYN_OP_VBAR_ALT | \ ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_PLUS_ONE_INF | \ ONIG_SYN_OP_QMARK_ZERO_ONE | \ ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR | ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR | \ ONIG_SYN_OP_ESC_W_WORD | \ ONIG_SYN_OP_ESC_B_WORD_BOUND | ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | \ ONIG_SYN_OP_ESC_S_WHITE_SPACE | ONIG_SYN_OP_ESC_D_DIGIT | \ ONIG_SYN_OP_LINE_ANCHOR ) #define SYN_GNU_REGEX_BV \ ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | \ ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | ONIG_SYN_ALLOW_INVALID_INTERVAL | \ ONIG_SYN_BACKSLASH_ESCAPE_IN_CC | ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC ) #define NCCLASS_FLAGS(cc) ((cc)->flags) #define NCCLASS_FLAG_SET(cc,flag) (NCCLASS_FLAGS(cc) |= (flag)) #define NCCLASS_FLAG_CLEAR(cc,flag) (NCCLASS_FLAGS(cc) &= ~(flag)) #define IS_NCCLASS_FLAG_ON(cc,flag) ((NCCLASS_FLAGS(cc) & (flag)) != 0) /* cclass node */ #define FLAG_NCCLASS_NOT (1<<0) #define FLAG_NCCLASS_SHARE (1<<1) #define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT) #define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT) #define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT) typedef struct { #ifdef USE_DIRECT_THREADED_CODE const void* opaddr; #else enum OpCode opcode; #endif union { struct { UChar s[16]; /* Now used first 7 bytes only. */ } exact; struct { UChar* s; LengthType n; /* number of chars */ } exact_n; /* EXACTN, EXACTN_IC, EXACTMB2N, EXACTMB3N */ struct { UChar* s; LengthType n; /* number of chars */ LengthType len; /* char byte length */ } exact_len_n; /* EXACTMBN */ struct { BitSetRef bsp; } cclass; struct { void* mb; } cclass_mb; struct { void* mb; /* mb must be same position with cclass_mb for match_at(). */ BitSetRef bsp; } cclass_mix; struct { UChar c; } anychar_star_peek_next; struct { ModeType mode; } word_boundary; /* OP_WORD_BOUNDARY, OP_NO_WORD_BOUNDARY, OP_WORD_BEGIN, OP_WORD_END */ struct { enum TextSegmentBoundaryType type; int not; } text_segment_boundary; struct { enum CheckPositionType type; } check_position; struct { union { MemNumType n1; /* num == 1 */ MemNumType* ns; /* num > 1 */ }; int num; int nest_level; } backref_general; /* BACKREF_MULTI, BACKREF_MULTI_IC, BACKREF_WITH_LEVEL, BACKREF_CHECK, BACKREF_CHECK_WITH_LEVEL, */ struct { MemNumType n1; } backref_n; /* BACKREF_N, BACKREF_N_IC */ struct { MemNumType num; } memory_start; /* MEMORY_START, MEMORY_START_PUSH */ struct { MemNumType num; } memory_end; /* MEMORY_END, MEMORY_END_REC, MEMORY_END_PUSH, MEMORY_END_PUSH_REC */ struct { RelAddrType addr; } jump; struct { RelAddrType addr; } push; struct { RelAddrType addr; UChar c; } push_or_jump_exact1; struct { RelAddrType addr; UChar c; } push_if_peek_next; struct { MemNumType id; } pop_to_mark; struct { MemNumType id; RelAddrType addr; } repeat; /* REPEAT, REPEAT_NG */ struct { MemNumType id; } repeat_inc; /* REPEAT_INC, REPEAT_INC_NG */ struct { MemNumType mem; } empty_check_start; struct { MemNumType mem; MemStatusType empty_status_mem; } empty_check_end; /* EMPTY_CHECK_END, EMPTY_CHECK_END_MEMST, EMPTY_CHECK_END_MEMST_PUSH */ struct { RelAddrType addr; } prec_read_not_start; struct { LengthType len; } look_behind; struct { LengthType len; RelAddrType addr; } look_behind_not_start; struct { RelPositionType n; /* char relative position */ } move; struct { LengthType initial; /* char length */ LengthType remaining; /* char length */ RelAddrType addr; } step_back_start; struct { MemNumType id; int restore_pos; /* flag: restore current string position */ } cut_to_mark; struct { MemNumType id; int save_pos; /* flag: save current string position */ } mark; struct { SaveType type; MemNumType id; } save_val; struct { UpdateVarType type; MemNumType id; int clear; /* UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK or UPDATE_VAR_RIGHT_RANGE_FROM_STACK */ } update_var; struct { AbsAddrType addr; #if defined(ONIG_DEBUG_MATCH_COUNTER) || defined(ONIG_DEBUG_CALL) MemNumType called_mem; #endif } call; #ifdef USE_CALLOUT struct { MemNumType num; } callout_contents; struct { MemNumType num; MemNumType id; } callout_name; #endif }; } Operation; typedef struct { const UChar* pattern; const UChar* pattern_end; #ifdef USE_CALLOUT void* tag_table; int callout_num; int callout_list_alloc; CalloutListEntry* callout_list; /* index: callout num */ #endif } RegexExt; typedef struct { int lower; int upper; union { Operation* pcode; /* address of repeated body */ int offset; } u; } RepeatRange; struct re_pattern_buffer { /* common members of BBuf(bytes-buffer) */ Operation* ops; #ifdef USE_DIRECT_THREADED_CODE enum OpCode* ocs; #endif Operation* ops_curr; unsigned int ops_used; /* used space for ops */ unsigned int ops_alloc; /* allocated space for ops */ unsigned char* string_pool; unsigned char* string_pool_end; int num_mem; /* used memory(...) num counted from 1 */ int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */ int num_empty_check; /* OP_EMPTY_CHECK_START/END id counter */ int num_call; /* number of subexp call */ MemStatusType capture_history; /* (?@...) flag (1-31) */ MemStatusType push_mem_start; /* need backtrack flag */ MemStatusType push_mem_end; /* need backtrack flag */ int stack_pop_level; int repeat_range_alloc; RepeatRange* repeat_range; OnigEncoding enc; OnigOptionType options; OnigSyntaxType* syntax; OnigCaseFoldType case_fold_flag; void* name_table; /* optimization info (string search, char-map and anchors) */ int optimize; /* optimize flag */ int threshold_len; /* search str-length for apply optimize */ int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */ OnigLen anc_dist_min; /* (SEMI_)END_BUF anchor distance */ OnigLen anc_dist_max; /* (SEMI_)END_BUF anchor distance */ int sub_anchor; /* start-anchor for exact or map */ unsigned char *exact; unsigned char *exact_end; unsigned char map[CHAR_MAP_SIZE]; /* used as BMH skip or char-map */ int map_offset; OnigLen dist_min; /* min-distance of exact or map */ OnigLen dist_max; /* max-distance of exact or map */ RegexExt* extp; }; #define COP(reg) ((reg)->ops_curr) #define COP_CURR_OFFSET(reg) ((reg)->ops_used - 1) #define COP_CURR_OFFSET_BYTES(reg, p) \ ((int )((char* )(&((reg)->ops_curr->p)) - (char* )((reg)->ops))) extern void onig_add_end_call(void (*func)(void)); extern void onig_warning(const char* s); extern UChar* onig_error_code_to_format P_((int code)); extern void ONIG_VARIADIC_FUNC_ATTR ONIG_PRINTFLIKE(6, 7) onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const char *fmt, ...)); extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo)); extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, void* /* CClassNode* */ cc)); extern RegexExt* onig_get_regex_ext(regex_t* reg); extern int onig_ext_set_pattern(regex_t* reg, const UChar* pattern, const UChar* pattern_end); extern int onig_positive_int_multiply(int x, int y); extern hash_table_type onig_st_init_strend_table_with_size P_((int size)); extern int onig_st_lookup_strend P_((hash_table_type table, const UChar* str_key, const UChar* end_key, hash_data_type *value)); extern int onig_st_insert_strend P_((hash_table_type table, const UChar* str_key, const UChar* end_key, hash_data_type value)); #ifdef ONIG_DEBUG #ifdef ONIG_DEBUG_COMPILE extern void onig_print_compiled_byte_code_list(FILE* f, regex_t* reg); #endif #ifdef ONIG_DEBUG_STATISTICS extern void onig_statistics_init P_((void)); extern int onig_print_statistics P_((FILE* f)); #endif #endif /* ONIG_DEBUG */ #ifdef USE_CALLOUT extern OnigCalloutType onig_get_callout_type_by_name_id(int name_id); extern OnigCalloutFunc onig_get_callout_start_func_by_name_id(int id); extern OnigCalloutFunc onig_get_callout_end_func_by_name_id(int id); extern int onig_callout_tag_table_free(void* table); extern void onig_free_reg_callout_list(int n, CalloutListEntry* list); extern CalloutListEntry* onig_reg_callout_list_at(regex_t* reg, int num); extern OnigCalloutFunc onig_get_callout_start_func(regex_t* reg, int callout_num); /* for definition of builtin callout */ #define BC0_P(name, func) do {\ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )(name), (UChar* )((name) + len),\ ONIG_CALLOUT_IN_PROGRESS,\ onig_builtin_ ## func, 0, 0, 0, 0, 0);\ if (id < 0) return id;\ } while(0) #define BC0_R(name, func) do {\ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )(name), (UChar* )((name) + len),\ ONIG_CALLOUT_IN_RETRACTION,\ onig_builtin_ ## func, 0, 0, 0, 0, 0);\ if (id < 0) return id;\ } while(0) #define BC0_B(name, func) do {\ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )(name), (UChar* )((name) + len),\ ONIG_CALLOUT_IN_BOTH,\ onig_builtin_ ## func, 0, 0, 0, 0, 0);\ if (id < 0) return id;\ } while(0) #define BC_P(name, func, na, ts) do {\ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )(name), (UChar* )((name) + len),\ ONIG_CALLOUT_IN_PROGRESS,\ onig_builtin_ ## func, 0, (na), (ts), 0, 0); \ if (id < 0) return id;\ } while(0) #define BC_P_O(name, func, nts, ts, nopts, opts) do {\ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )(name), (UChar* )((name) + len),\ ONIG_CALLOUT_IN_PROGRESS,\ onig_builtin_ ## func, 0, (nts), (ts), (nopts), (opts));\ if (id < 0) return id;\ } while(0) #define BC_B(name, func, na, ts) do {\ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )(name), (UChar* )((name) + len),\ ONIG_CALLOUT_IN_BOTH,\ onig_builtin_ ## func, 0, (na), (ts), 0, 0);\ if (id < 0) return id;\ } while(0) #define BC_B_O(name, func, nts, ts, nopts, opts) do {\ int len = onigenc_str_bytelen_null(enc, (UChar* )name);\ id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\ (UChar* )(name), (UChar* )((name) + len),\ ONIG_CALLOUT_IN_BOTH,\ onig_builtin_ ## func, 0, (nts), (ts), (nopts), (opts));\ if (id < 0) return id;\ } while(0) #endif /* USE_CALLOUT */ typedef int (*ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void); #endif /* REGINT_H */ jq-1.8.2/vendor/oniguruma/src/ascii.c0000644000175100017510000000731215215513537013157 /********************************************************************** ascii.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" /* for USE_CALLOUT */ static int init(void) { #ifdef USE_CALLOUT int id; OnigEncoding enc; char* name; unsigned int args[4]; OnigValue opts[4]; enc = ONIG_ENCODING_ASCII; name = "FAIL"; BC0_P(name, fail); name = "MISMATCH"; BC0_P(name, mismatch); #ifdef USE_SKIP_SEARCH name = "SKIP"; BC0_P(name, skip); #endif name = "MAX"; args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; args[1] = ONIG_TYPE_CHAR; opts[0].c = 'X'; BC_B_O(name, max, 2, args, 1, opts); name = "ERROR"; args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT; BC_P_O(name, error, 1, args, 1, opts); name = "COUNT"; args[0] = ONIG_TYPE_CHAR; opts[0].c = '>'; BC_B_O(name, count, 1, args, 1, opts); name = "TOTAL_COUNT"; args[0] = ONIG_TYPE_CHAR; opts[0].c = '>'; BC_B_O(name, total_count, 1, args, 1, opts); name = "CMP"; args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; args[1] = ONIG_TYPE_STRING; args[2] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; BC_P(name, cmp, 3, args); #endif /* USE_CALLOUT */ return ONIG_NORMAL; } #if 0 static int is_initialized(void) { /* Don't use this function */ /* can't answer, because builtin callout entries removed in onig_end() */ return 0; } #endif static int ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 128) return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); else return FALSE; } OnigEncodingType OnigEncodingASCII = { onigenc_single_byte_mbc_enc_len, "US-ASCII", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, onigenc_ascii_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, ascii_is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, init, 0, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/Makefile.am0000644000175100017510000000424515215513537013761 ## Makefile.am for Oniguruma libname = libonig.la AM_CFLAGS = -Wall AM_CPPFLAGS = -I$(top_srcdir) include_HEADERS = oniguruma.h oniggnu.h posix_headers = onigposix.h if ENABLE_POSIX_API posix_sources = regposix.c regposerr.c include_HEADERS += $(posix_headers) AM_CFLAGS += -DUSE_POSIX_API else posix_sources = endif if ENABLE_BINARY_COMPATIBLE_POSIX_API AM_CFLAGS += -DUSE_BINARY_COMPATIBLE_POSIX_API endif lib_LTLIBRARIES = $(libname) libonig_la_SOURCES = regint.h regparse.h regenc.h st.h \ regparse.c regcomp.c regexec.c \ regenc.c regerror.c regext.c regsyntax.c regtrav.c regversion.c st.c \ reggnu.c \ $(posix_sources) \ unicode.c \ unicode_unfold_key.c \ unicode_fold1_key.c \ unicode_fold2_key.c \ unicode_fold3_key.c \ ascii.c utf8.c \ utf16_be.c utf16_le.c \ utf32_be.c utf32_le.c \ euc_jp.c euc_jp_prop.c \ sjis.c sjis_prop.c \ iso8859_1.c \ iso8859_2.c iso8859_3.c \ iso8859_4.c iso8859_5.c \ iso8859_6.c iso8859_7.c \ iso8859_8.c iso8859_9.c \ iso8859_10.c iso8859_11.c \ iso8859_13.c iso8859_14.c \ iso8859_15.c iso8859_16.c \ euc_tw.c euc_kr.c big5.c \ gb18030.c koi8_r.c cp1251.c \ onig_init.c EXTRA_DIST = koi8.c mktable.c \ unicode_fold_data.c unicode_property_data.c \ unicode_property_data_posix.c \ unicode_egcb_data.c unicode_wb_data.c libonig_la_LDFLAGS = $(EXTRA_LIBONIG_LDFLAGS) -version-info $(LTVERSION) if USE_LIBONIG_DEF_FILE libonig_la_LDFLAGS += -Wl,--output-def,$(LIBONIG_DEF_FILE) install-data-hook: echo "$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_DATA) $(LIBONIG_DEF_FILE) $(DESTDIR)$(libdir)"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_DATA) $(LIBONIG_DEF_FILE) $(DESTDIR)$(libdir) || exit 1 uninstall-hook: echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$(LIBONIG_DEF_FILE)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$(LIBONIG_DEF_FILE)" endif dll: $(CXX) -shared -Wl,--output-def,libonig.def -o libonig.dll *.o \ $(LIBS) strip libonig.dll # character-types-table source generator mktable: mktable.c regenc.h $(CC) -I$(top_srcdir) -o mktable mktable.c jq-1.8.2/vendor/oniguruma/src/unicode.c0000644000175100017510000010053515215513537013516 /********************************************************************** unicode.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" struct PoolPropertyNameCtype { short int name; short int ctype; }; #define ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(code,ctype) \ ((EncUNICODE_ISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const unsigned short EncUNICODE_ISO_8859_1_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x428c, 0x4289, 0x4288, 0x4288, 0x4288, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0288, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x30e2, 0x01a0, 0x01a0, 0x00a8, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x10a0, 0x10a0, 0x01a0, 0x30e2, 0x01a0, 0x01a0, 0x01a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; #include "st.h" #include "unicode_fold_data.c" extern int onigenc_unicode_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold) { const struct ByUnfoldKey* buk; OnigCodePoint code; int i, len, rlen; const UChar *p = *pp; code = ONIGENC_MBC_TO_CODE(enc, p, end); len = enclen(enc, p); *pp += len; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (code == 0x0130) { return ONIGENC_CODE_TO_MBC(enc, 0x0069, fold); } #if 0 if (code == 0x0049) { return ONIGENC_CODE_TO_MBC(enc, 0x0131, fold); } #endif } #endif if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(code)) { buk = onigenc_unicode_unfold_key(code); if (buk != 0) { if (buk->fold_len == 1) { if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*FOLDS1_FOLD(buk->index))) return ONIGENC_CODE_TO_MBC(enc, *FOLDS1_FOLD(buk->index), fold); } else { OnigCodePoint* addr; FOLDS_FOLD_ADDR_BUK(buk, addr); rlen = 0; for (i = 0; i < buk->fold_len; i++) { OnigCodePoint c = addr[i]; len = ONIGENC_CODE_TO_MBC(enc, c, fold); fold += len; rlen += len; } return rlen; } } } for (i = 0; i < len; i++) { *fold++ = *p++; } return len; } static int apply_case_fold1(OnigCaseFoldType flag, int from, int to, OnigApplyAllCaseFoldFunc f, void* arg) { int i, j, k, n, r; for (i = from; i < to; ) { OnigCodePoint fold = *FOLDS1_FOLD(i); if (CASE_FOLD_IS_ASCII_ONLY(flag) && ! ONIGENC_IS_ASCII_CODE(fold)) break; n = FOLDS1_UNFOLDS_NUM(i); for (j = 0; j < n; j++) { OnigCodePoint unfold = FOLDS1_UNFOLDS(i)[j]; if (CASE_FOLD_IS_ASCII_ONLY(flag) && ! ONIGENC_IS_ASCII_CODE(unfold)) continue; r = (*f)(fold, &unfold, 1, arg); if (r != 0) return r; r = (*f)(unfold, &fold, 1, arg); if (r != 0) return r; for (k = 0; k < j; k++) { OnigCodePoint unfold2 = FOLDS1_UNFOLDS(i)[k]; if (CASE_FOLD_IS_ASCII_ONLY(flag) && ! ONIGENC_IS_ASCII_CODE(unfold2)) continue; r = (*f)(unfold, &unfold2, 1, arg); if (r != 0) return r; r = (*f)(unfold2, &unfold, 1, arg); if (r != 0) return r; } } i = FOLDS1_NEXT_INDEX(i); } return 0; } static int apply_case_fold2(int from, int to, OnigApplyAllCaseFoldFunc f, void* arg) { int i, j, k, n, r; for (i = from; i < to; ) { OnigCodePoint* fold = FOLDS2_FOLD(i); n = FOLDS2_UNFOLDS_NUM(i); for (j = 0; j < n; j++) { OnigCodePoint unfold = FOLDS2_UNFOLDS(i)[j]; r = (*f)(unfold, fold, 2, arg); if (r != 0) return r; for (k = 0; k < j; k++) { OnigCodePoint unfold2 = FOLDS2_UNFOLDS(i)[k]; r = (*f)(unfold, &unfold2, 1, arg); if (r != 0) return r; r = (*f)(unfold2, &unfold, 1, arg); if (r != 0) return r; } } i = FOLDS2_NEXT_INDEX(i); } return 0; } static int apply_case_fold3(int from, int to, OnigApplyAllCaseFoldFunc f, void* arg) { int i, j, k, n, r; for (i = from; i < to; ) { OnigCodePoint* fold = FOLDS3_FOLD(i); n = FOLDS3_UNFOLDS_NUM(i); for (j = 0; j < n; j++) { OnigCodePoint unfold = FOLDS3_UNFOLDS(i)[j]; r = (*f)(unfold, fold, 3, arg); if (r != 0) return r; for (k = 0; k < j; k++) { OnigCodePoint unfold2 = FOLDS3_UNFOLDS(i)[k]; r = (*f)(unfold, &unfold2, 1, arg); if (r != 0) return r; r = (*f)(unfold2, &unfold, 1, arg); if (r != 0) return r; } } i = FOLDS3_NEXT_INDEX(i); } return 0; } extern int onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { int r; r = apply_case_fold1(flag, 0, FOLDS1_NORMAL_END_INDEX, f, arg); if (r != 0) return r; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { code = 0x0131; r = (*f)(0x0049, &code, 1, arg); if (r != 0) return r; code = 0x0049; r = (*f)(0x0131, &code, 1, arg); if (r != 0) return r; code = 0x0130; r = (*f)(0x0069, &code, 1, arg); if (r != 0) return r; code = 0x0069; r = (*f)(0x0130, &code, 1, arg); if (r != 0) return r; } else { #endif r = apply_case_fold1(flag, FOLDS1_NORMAL_END_INDEX, FOLDS1_END_INDEX, f, arg); if (r != 0) return r; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI } #endif if ((flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) == 0) return 0; r = apply_case_fold2(0, FOLDS2_NORMAL_END_INDEX, f, arg); if (r != 0) return r; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) == 0) { #endif r = apply_case_fold2(FOLDS2_NORMAL_END_INDEX, FOLDS2_END_INDEX, f, arg); if (r != 0) return r; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI } #endif r = apply_case_fold3(0, FOLDS3_NORMAL_END_INDEX, f, arg); if (r != 0) return r; return 0; } extern int onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { int n, m, i, j, k, len, lens[3]; int index; int fn, ncs[3]; OnigCodePoint cs[3][4]; OnigCodePoint code, codes[3], orig_codes[3]; const struct ByUnfoldKey* buk1; n = 0; code = ONIGENC_MBC_TO_CODE(enc, p, end); if (CASE_FOLD_IS_ASCII_ONLY(flag)) { if (! ONIGENC_IS_ASCII_CODE(code)) return n; } len = enclen(enc, p); #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (code == 0x0049) { items[0].byte_len = len; items[0].code_len = 1; items[0].code[0] = 0x0131; return 1; } else if (code == 0x0130) { items[0].byte_len = len; items[0].code_len = 1; items[0].code[0] = 0x0069; return 1; } else if (code == 0x0131) { items[0].byte_len = len; items[0].code_len = 1; items[0].code[0] = 0x0049; return 1; } else if (code == 0x0069) { items[0].byte_len = len; items[0].code_len = 1; items[0].code[0] = 0x0130; return 1; } } #endif orig_codes[0] = code; lens[0] = len; p += len; buk1 = onigenc_unicode_unfold_key(orig_codes[0]); if (buk1 != 0 && buk1->fold_len == 1) { codes[0] = *FOLDS1_FOLD(buk1->index); } else codes[0] = orig_codes[0]; if ((flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) == 0) goto fold1; if (p < end) { const struct ByUnfoldKey* buk; code = ONIGENC_MBC_TO_CODE(enc, p, end); orig_codes[1] = code; len = enclen(enc, p); lens[1] = lens[0] + len; buk = onigenc_unicode_unfold_key(orig_codes[1]); if (buk != 0 && buk->fold_len == 1) { codes[1] = *FOLDS1_FOLD(buk->index); } else codes[1] = orig_codes[1]; p += len; if (p < end) { code = ONIGENC_MBC_TO_CODE(enc, p, end); orig_codes[2] = code; len = enclen(enc, p); lens[2] = lens[1] + len; buk = onigenc_unicode_unfold_key(orig_codes[2]); if (buk != 0 && buk->fold_len == 1) { codes[2] = *FOLDS1_FOLD(buk->index); } else codes[2] = orig_codes[2]; index = onigenc_unicode_fold3_key(codes); if (index >= 0) { m = FOLDS3_UNFOLDS_NUM(index); for (i = 0; i < m; i++) { items[n].byte_len = lens[2]; items[n].code_len = 1; items[n].code[0] = FOLDS3_UNFOLDS(index)[i]; n++; } for (fn = 0; fn < 3; fn++) { int sindex; cs[fn][0] = FOLDS3_FOLD(index)[fn]; ncs[fn] = 1; sindex = onigenc_unicode_fold1_key(&cs[fn][0]); if (sindex >= 0) { int m = FOLDS1_UNFOLDS_NUM(sindex); for (i = 0; i < m; i++) { cs[fn][i+1] = FOLDS1_UNFOLDS(sindex)[i]; } ncs[fn] += m; } } for (i = 0; i < ncs[0]; i++) { for (j = 0; j < ncs[1]; j++) { for (k = 0; k < ncs[2]; k++) { if (cs[0][i] == orig_codes[0] && cs[1][j] == orig_codes[1] && cs[2][k] == orig_codes[2]) continue; items[n].byte_len = lens[2]; items[n].code_len = 3; items[n].code[0] = cs[0][i]; items[n].code[1] = cs[1][j]; items[n].code[2] = cs[2][k]; n++; } } } return n; } } index = onigenc_unicode_fold2_key(codes); if (index >= 0) { m = FOLDS2_UNFOLDS_NUM(index); for (i = 0; i < m; i++) { items[n].byte_len = lens[1]; items[n].code_len = 1; items[n].code[0] = FOLDS2_UNFOLDS(index)[i]; n++; } for (fn = 0; fn < 2; fn++) { int sindex; cs[fn][0] = FOLDS2_FOLD(index)[fn]; ncs[fn] = 1; sindex = onigenc_unicode_fold1_key(&cs[fn][0]); if (sindex >= 0) { int m = FOLDS1_UNFOLDS_NUM(sindex); for (i = 0; i < m; i++) { cs[fn][i+1] = FOLDS1_UNFOLDS(sindex)[i]; } ncs[fn] += m; } } for (i = 0; i < ncs[0]; i++) { for (j = 0; j < ncs[1]; j++) { if (cs[0][i] == orig_codes[0] && cs[1][j] == orig_codes[1]) continue; items[n].byte_len = lens[1]; items[n].code_len = 2; items[n].code[0] = cs[0][i]; items[n].code[1] = cs[1][j]; n++; } } return n; } } fold1: if (buk1 != 0) { if (buk1->fold_len == 1) { int un; if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*FOLDS1_FOLD(buk1->index))) { items[0].byte_len = lens[0]; items[0].code_len = 1; items[0].code[0] = *FOLDS1_FOLD(buk1->index); n++; } un = FOLDS1_UNFOLDS_NUM(buk1->index); for (i = 0; i < un; i++) { OnigCodePoint unfold = FOLDS1_UNFOLDS(buk1->index)[i]; if (unfold != orig_codes[0]) { if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(unfold)) { items[n].byte_len = lens[0]; items[n].code_len = 1; items[n].code[0] = unfold; n++; } } } } else if ((flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { if (buk1->fold_len == 2) { m = FOLDS2_UNFOLDS_NUM(buk1->index); for (i = 0; i < m; i++) { OnigCodePoint unfold = FOLDS2_UNFOLDS(buk1->index)[i]; if (unfold == orig_codes[0]) continue; items[n].byte_len = lens[0]; items[n].code_len = 1; items[n].code[0] = unfold; n++; } for (fn = 0; fn < 2; fn++) { int index; cs[fn][0] = FOLDS2_FOLD(buk1->index)[fn]; ncs[fn] = 1; index = onigenc_unicode_fold1_key(&cs[fn][0]); if (index >= 0) { int m = FOLDS1_UNFOLDS_NUM(index); for (i = 0; i < m; i++) { cs[fn][i+1] = FOLDS1_UNFOLDS(index)[i]; } ncs[fn] += m; } } for (i = 0; i < ncs[0]; i++) { for (j = 0; j < ncs[1]; j++) { items[n].byte_len = lens[0]; items[n].code_len = 2; items[n].code[0] = cs[0][i]; items[n].code[1] = cs[1][j]; n++; } } } else { /* fold_len == 3 */ m = FOLDS3_UNFOLDS_NUM(buk1->index); for (i = 0; i < m; i++) { OnigCodePoint unfold = FOLDS3_UNFOLDS(buk1->index)[i]; if (unfold == orig_codes[0]) continue; items[n].byte_len = lens[0]; items[n].code_len = 1; items[n].code[0] = unfold; n++; } for (fn = 0; fn < 3; fn++) { int index; cs[fn][0] = FOLDS3_FOLD(buk1->index)[fn]; ncs[fn] = 1; index = onigenc_unicode_fold1_key(&cs[fn][0]); if (index >= 0) { int m = FOLDS1_UNFOLDS_NUM(index); for (i = 0; i < m; i++) { cs[fn][i+1] = FOLDS1_UNFOLDS(index)[i]; } ncs[fn] += m; } } for (i = 0; i < ncs[0]; i++) { for (j = 0; j < ncs[1]; j++) { for (k = 0; k < ncs[2]; k++) { items[n].byte_len = lens[0]; items[n].code_len = 3; items[n].code[0] = cs[0][i]; items[n].code[1] = cs[1][j]; items[n].code[2] = cs[2][k]; n++; } } } } } } else { int index = onigenc_unicode_fold1_key(orig_codes); if (index >= 0) { int m = FOLDS1_UNFOLDS_NUM(index); for (i = 0; i < m; i++) { code = FOLDS1_UNFOLDS(index)[i]; if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag)||ONIGENC_IS_ASCII_CODE(code)) { items[n].byte_len = lens[0]; items[n].code_len = 1; items[n].code[0] = code; n++; } } } } return n; } #ifdef USE_UNICODE_PROPERTIES #include "unicode_property_data.c" #else #include "unicode_property_data_posix.c" #endif #ifdef USE_UNICODE_WORD_BREAK enum WB_TYPE { WB_Any = 0, WB_ALetter, WB_CR, WB_Double_Quote, WB_Extend, WB_ExtendNumLet, WB_Format, WB_Hebrew_Letter, WB_Katakana, WB_LF, WB_MidLetter, WB_MidNum, WB_MidNumLet, WB_Newline, WB_Numeric, WB_Regional_Indicator, WB_Single_Quote, WB_WSegSpace, WB_ZWJ, }; typedef struct { OnigCodePoint start; OnigCodePoint end; enum WB_TYPE type; } WB_RANGE_TYPE; #include "unicode_wb_data.c" static enum WB_TYPE wb_get_type(OnigCodePoint code) { OnigCodePoint low, high, x; enum WB_TYPE type; for (low = 0, high = (OnigCodePoint )WB_RANGE_NUM; low < high; ) { x = (low + high) >> 1; if (code > WB_RANGES[x].end) low = x + 1; else high = x; } type = (low < (OnigCodePoint )WB_RANGE_NUM && code >= WB_RANGES[low].start) ? WB_RANGES[low].type : WB_Any; return type; } #define IS_WB_IGNORE_TAIL(t) ((t) == WB_Extend || (t) == WB_Format || (t) == WB_ZWJ) #define IS_WB_AHLetter(t) ((t) == WB_ALetter || (t) == WB_Hebrew_Letter) #define IS_WB_MidNumLetQ(t) ((t) == WB_MidNumLet || (t) == WB_Single_Quote) static int wb_get_next_main_code(OnigEncoding enc, UChar* p, const UChar* end, OnigCodePoint* rcode, enum WB_TYPE* rtype) { OnigCodePoint code; enum WB_TYPE type; while (TRUE) { p += enclen(enc, p); if (p >= end) break; code = ONIGENC_MBC_TO_CODE(enc, p, end); type = wb_get_type(code); if (! IS_WB_IGNORE_TAIL(type)) { *rcode = code; *rtype = type; return 1; } } return 0; } extern int onigenc_wb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev, const UChar* start, const UChar* end) { int r; UChar* pp; OnigCodePoint cfrom; OnigCodePoint cfrom2; OnigCodePoint cto; OnigCodePoint cto2; enum WB_TYPE from; enum WB_TYPE from2; enum WB_TYPE to; enum WB_TYPE to2; /* WB1: sot / Any */ if (p == start) return TRUE; /* WB2: Any / eot */ if (p == end) return TRUE; if (IS_NULL(prev)) { prev = onigenc_get_prev_char_head(enc, start, p); if (IS_NULL(prev)) return TRUE; } cfrom = ONIGENC_MBC_TO_CODE(enc, prev, end); cto = ONIGENC_MBC_TO_CODE(enc, p, end); from = wb_get_type(cfrom); to = wb_get_type(cto); /* short cut */ if (from == 0 && to == 0) goto WB999; /* WB3: CR + LF */ if (from == WB_CR && to == WB_LF) return FALSE; /* WB3a: (Newline|CR|LF) / */ if (from == WB_Newline || from == WB_CR || from == WB_LF) return TRUE; /* WB3b: / (Newline|CR|LF) */ if (to == WB_Newline || to == WB_CR || to == WB_LF) return TRUE; /* WB3c: ZWJ + {Extended_Pictographic} */ if (from == WB_ZWJ) { if (onigenc_unicode_is_code_ctype(cto, PROP_INDEX_EXTENDEDPICTOGRAPHIC)) return FALSE; } /* WB3d: WSegSpace + WSegSpace */ if (from == WB_WSegSpace && to == WB_WSegSpace) return FALSE; /* WB4: X (Extend|Format|ZWJ)* -> X */ if (IS_WB_IGNORE_TAIL(to)) return FALSE; if (IS_WB_IGNORE_TAIL(from)) { while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) { prev = pp; cfrom = ONIGENC_MBC_TO_CODE(enc, prev, end); from = wb_get_type(cfrom); if (! IS_WB_IGNORE_TAIL(from)) break; } } if (IS_WB_AHLetter(from)) { /* WB5: AHLetter + AHLetter */ if (IS_WB_AHLetter(to)) return FALSE; /* WB6: AHLetter + (MidLetter | MidNumLetQ) AHLetter */ if (to == WB_MidLetter || IS_WB_MidNumLetQ(to)) { r = wb_get_next_main_code(enc, p, end, &cto2, &to2); if (r == 1) { if (IS_WB_AHLetter(to2)) return FALSE; } } } /* WB7: AHLetter (MidLetter | MidNumLetQ) + AHLetter */ if (from == WB_MidLetter || IS_WB_MidNumLetQ(from)) { if (IS_WB_AHLetter(to)) { from2 = WB_Any; while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) { prev = pp; cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end); from2 = wb_get_type(cfrom2); if (! IS_WB_IGNORE_TAIL(from2)) break; } if (IS_WB_AHLetter(from2)) return FALSE; } } if (from == WB_Hebrew_Letter) { /* WB7a: Hebrew_Letter + Single_Quote */ if (to == WB_Single_Quote) return FALSE; /* WB7b: Hebrew_Letter + Double_Quote Hebrew_Letter */ if (to == WB_Double_Quote) { r = wb_get_next_main_code(enc, p, end, &cto2, &to2); if (r == 1) { if (to2 == WB_Hebrew_Letter) return FALSE; } } } /* WB7c: Hebrew_Letter Double_Quote + Hebrew_Letter */ if (from == WB_Double_Quote) { if (to == WB_Hebrew_Letter) { from2 = WB_Any; while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) { prev = pp; cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end); from2 = wb_get_type(cfrom2); if (! IS_WB_IGNORE_TAIL(from2)) break; } if (from2 == WB_Hebrew_Letter) return FALSE; } } if (to == WB_Numeric) { /* WB8: Numeric + Numeric */ if (from == WB_Numeric) return FALSE; /* WB9: AHLetter + Numeric */ if (IS_WB_AHLetter(from)) return FALSE; /* WB11: Numeric (MidNum | MidNumLetQ) + Numeric */ if (from == WB_MidNum || IS_WB_MidNumLetQ(from)) { from2 = WB_Any; while ((pp = onigenc_get_prev_char_head(enc, start, prev)) != NULL) { prev = pp; cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end); from2 = wb_get_type(cfrom2); if (! IS_WB_IGNORE_TAIL(from2)) break; } if (from2 == WB_Numeric) return FALSE; } } if (from == WB_Numeric) { /* WB10: Numeric + AHLetter */ if (IS_WB_AHLetter(to)) return FALSE; /* WB12: Numeric + (MidNum | MidNumLetQ) Numeric */ if (to == WB_MidNum || IS_WB_MidNumLetQ(to)) { r = wb_get_next_main_code(enc, p, end, &cto2, &to2); if (r == 1) { if (to2 == WB_Numeric) return FALSE; } } } /* WB13: Katakana + Katakana */ if (from == WB_Katakana && to == WB_Katakana) return FALSE; /* WB13a: (AHLetter | Numeric | Katakana | ExtendNumLet) + ExtendNumLet */ if (IS_WB_AHLetter(from) || from == WB_Numeric || from == WB_Katakana || from == WB_ExtendNumLet) { if (to == WB_ExtendNumLet) return FALSE; } /* WB13b: ExtendNumLet + (AHLetter | Numeric | Katakana) */ if (from == WB_ExtendNumLet) { if (IS_WB_AHLetter(to) || to == WB_Numeric || to == WB_Katakana) return FALSE; } /* WB15: sot (RI RI)* RI + RI */ /* WB16: [^RI] (RI RI)* RI + RI */ if (from == WB_Regional_Indicator && to == WB_Regional_Indicator) { int n = 0; while ((prev = onigenc_get_prev_char_head(enc, start, prev)) != NULL) { cfrom2 = ONIGENC_MBC_TO_CODE(enc, prev, end); from2 = wb_get_type(cfrom2); if (from2 != WB_Regional_Indicator) break; n++; } if ((n % 2) == 0) return FALSE; } WB999: /* WB999: Any / Any */ return TRUE; } #endif /* USE_UNICODE_WORD_BREAK */ #ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER enum EGCB_BREAK_TYPE { EGCB_NOT_BREAK = 0, EGCB_BREAK = 1, EGCB_BREAK_UNDEF_GB11 = 2, EGCB_BREAK_UNDEF_RI_RI = 3 }; enum EGCB_TYPE { EGCB_Other = 0, EGCB_CR = 1, EGCB_LF = 2, EGCB_Control = 3, EGCB_Extend = 4, EGCB_Prepend = 5, EGCB_Regional_Indicator = 6, EGCB_SpacingMark = 7, EGCB_ZWJ = 8, #if 0 /* obsoleted */ EGCB_E_Base = 9, EGCB_E_Base_GAZ = 10, EGCB_E_Modifier = 11, EGCB_Glue_After_Zwj = 12, #endif EGCB_L = 13, EGCB_LV = 14, EGCB_LVT = 15, EGCB_T = 16, EGCB_V = 17 }; typedef struct { OnigCodePoint start; OnigCodePoint end; enum EGCB_TYPE type; } EGCB_RANGE_TYPE; #include "unicode_egcb_data.c" static enum EGCB_TYPE egcb_get_type(OnigCodePoint code) { OnigCodePoint low, high, x; enum EGCB_TYPE type; for (low = 0, high = (OnigCodePoint )EGCB_RANGE_NUM; low < high; ) { x = (low + high) >> 1; if (code > EGCB_RANGES[x].end) low = x + 1; else high = x; } type = (low < (OnigCodePoint )EGCB_RANGE_NUM && code >= EGCB_RANGES[low].start) ? EGCB_RANGES[low].type : EGCB_Other; return type; } #define IS_CONTROL_CR_LF(code) ((code) <= EGCB_Control && (code) >= EGCB_CR) #define IS_HANGUL(code) ((code) >= EGCB_L) /* GB1 and GB2 are outside of this function. */ static enum EGCB_BREAK_TYPE unicode_egcb_is_break_2code(OnigCodePoint from_code, OnigCodePoint to_code) { enum EGCB_TYPE from; enum EGCB_TYPE to; from = egcb_get_type(from_code); to = egcb_get_type(to_code); /* short cut */ if (from == 0 && to == 0) goto GB999; /* GB3 */ if (from == EGCB_CR && to == EGCB_LF) return EGCB_NOT_BREAK; /* GB4 */ if (IS_CONTROL_CR_LF(from)) return EGCB_BREAK; /* GB5 */ if (IS_CONTROL_CR_LF(to)) return EGCB_BREAK; if (IS_HANGUL(from) && IS_HANGUL(to)) { /* GB6 */ if (from == EGCB_L && to != EGCB_T) return EGCB_NOT_BREAK; /* GB7 */ if ((from == EGCB_LV || from == EGCB_V) && (to == EGCB_V || to == EGCB_T)) return EGCB_NOT_BREAK; /* GB8 */ if ((to == EGCB_T) && (from == EGCB_LVT || from == EGCB_T)) return EGCB_NOT_BREAK; goto GB999; } /* GB9 */ if (to == EGCB_Extend || to == EGCB_ZWJ) return EGCB_NOT_BREAK; /* GB9a */ if (to == EGCB_SpacingMark) return EGCB_NOT_BREAK; /* GB9b */ if (from == EGCB_Prepend) return EGCB_NOT_BREAK; /* GB10 removed */ /* GB11 */ if (from == EGCB_ZWJ) { if (onigenc_unicode_is_code_ctype(to_code, PROP_INDEX_EXTENDEDPICTOGRAPHIC)) return EGCB_BREAK_UNDEF_GB11; goto GB999; } /* GB12, GB13 */ if (from == EGCB_Regional_Indicator && to == EGCB_Regional_Indicator) { return EGCB_BREAK_UNDEF_RI_RI; } GB999: return EGCB_BREAK; } #endif /* USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER */ extern int onigenc_egcb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev, const UChar* start, const UChar* end) { OnigCodePoint from; OnigCodePoint to; #ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER enum EGCB_BREAK_TYPE btype; enum EGCB_TYPE type; #endif /* GB1 and GB2 */ if (p == start) return 1; if (p == end) return 1; if (IS_NULL(prev)) { prev = onigenc_get_prev_char_head(enc, start, p); if (IS_NULL(prev)) return 1; } from = ONIGENC_MBC_TO_CODE(enc, prev, end); to = ONIGENC_MBC_TO_CODE(enc, p, end); #ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER if (! ONIGENC_IS_UNICODE_ENCODING(enc)) { return from != 0x000d || to != NEWLINE_CODE; } btype = unicode_egcb_is_break_2code(from, to); switch (btype) { case EGCB_NOT_BREAK: return 0; break; case EGCB_BREAK: return 1; break; case EGCB_BREAK_UNDEF_GB11: while ((prev = onigenc_get_prev_char_head(enc, start, prev)) != NULL) { from = ONIGENC_MBC_TO_CODE(enc, prev, end); if (onigenc_unicode_is_code_ctype(from, PROP_INDEX_EXTENDEDPICTOGRAPHIC)) return 0; type = egcb_get_type(from); if (type != EGCB_Extend) break; } break; case EGCB_BREAK_UNDEF_RI_RI: { int n = 0; while ((prev = onigenc_get_prev_char_head(enc, start, prev)) != NULL) { from = ONIGENC_MBC_TO_CODE(enc, prev, end); type = egcb_get_type(from); if (type != EGCB_Regional_Indicator) break; n++; } if ((n % 2) == 0) return 0; } break; } return 1; #else return from != 0x000d || to != NEWLINE_CODE; #endif /* USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER */ } #define USER_DEFINED_PROPERTY_MAX_NUM 20 typedef struct { int ctype; OnigCodePoint* ranges; } UserDefinedPropertyValue; static int UserDefinedPropertyNum; static UserDefinedPropertyValue UserDefinedPropertyRanges[USER_DEFINED_PROPERTY_MAX_NUM]; static st_table* UserDefinedPropertyTable; extern int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges) { UserDefinedPropertyValue* e; int r; int i; int n; int len; int c; char* s; UChar* uname; if (UserDefinedPropertyNum >= USER_DEFINED_PROPERTY_MAX_NUM) return ONIGERR_TOO_MANY_USER_DEFINED_OBJECTS; len = (int )strlen(name); if (len >= PROPERTY_NAME_MAX_SIZE) return ONIGERR_TOO_LONG_PROPERTY_NAME; s = (char* )xmalloc(len + 1); if (s == 0) return ONIGERR_MEMORY; uname = (UChar* )name; n = 0; for (i = 0; i < len; i++) { c = uname[i]; if (c < 0x20 || c >= 0x80) { xfree(s); return ONIGERR_INVALID_CHAR_PROPERTY_NAME; } if (c != ' ' && c != '-' && c != '_') { s[n] = c; n++; } } s[n] = '\0'; if (UserDefinedPropertyTable == 0) { UserDefinedPropertyTable = onig_st_init_strend_table_with_size(10); if (IS_NULL(UserDefinedPropertyTable)) { xfree(s); return ONIGERR_MEMORY; } } e = UserDefinedPropertyRanges + UserDefinedPropertyNum; e->ctype = CODE_RANGES_NUM + UserDefinedPropertyNum; e->ranges = ranges; r = onig_st_insert_strend(UserDefinedPropertyTable, (const UChar* )s, (const UChar* )s + n, (hash_data_type )((void* )e)); if (r < 0) return r; UserDefinedPropertyNum++; return 0; } extern int onigenc_unicode_is_code_ctype(OnigCodePoint code, unsigned int ctype) { if ( #ifdef USE_UNICODE_PROPERTIES ctype <= ONIGENC_MAX_STD_CTYPE && #endif code < 256) { return ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(code, ctype); } if (ctype >= CODE_RANGES_NUM) { int index = ctype - CODE_RANGES_NUM; if (index < UserDefinedPropertyNum) return onig_is_in_code_range((UChar* )UserDefinedPropertyRanges[index].ranges, code); else return ONIGERR_TYPE_BUG; } return onig_is_in_code_range((UChar* )CodeRanges[ctype], code); } extern int onigenc_unicode_ctype_code_range(OnigCtype ctype, const OnigCodePoint* ranges[]) { if (ctype >= CODE_RANGES_NUM) { int index = ctype - CODE_RANGES_NUM; if (index < UserDefinedPropertyNum) { *ranges = UserDefinedPropertyRanges[index].ranges; return 0; } else return ONIGERR_TYPE_BUG; } *ranges = CodeRanges[ctype]; return 0; } extern int onigenc_utf16_32_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]) { *sb_out = 0x00; return onigenc_unicode_ctype_code_range(ctype, ranges); } extern int onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end) { int len; UChar *p; OnigCodePoint code; const struct PoolPropertyNameCtype* pc; char buf[PROPERTY_NAME_MAX_SIZE]; p = name; len = 0; while (p < end) { code = ONIGENC_MBC_TO_CODE(enc, p, end); if (code >= 0x80) return ONIGERR_INVALID_CHAR_PROPERTY_NAME; if (code != ' ' && code != '-' && code != '_') { buf[len++] = (char )code; if (len >= PROPERTY_NAME_MAX_SIZE) return ONIGERR_INVALID_CHAR_PROPERTY_NAME; } p += enclen(enc, p); } buf[len] = 0; if (UserDefinedPropertyTable != 0) { UserDefinedPropertyValue* e; e = (UserDefinedPropertyValue* )NULL; onig_st_lookup_strend(UserDefinedPropertyTable, (const UChar* )buf, (const UChar* )buf + len, (hash_data_type* )((void* )(&e))); if (e != 0) { return e->ctype; } } pc = unicode_lookup_property_name(buf, len); if (pc != 0) { /* fprintf(stderr, "LOOKUP: %s: %d\n", buf, pc->ctype); */ #ifndef USE_UNICODE_PROPERTIES if (pc->ctype > ONIGENC_MAX_STD_CTYPE) return ONIGERR_INVALID_CHAR_PROPERTY_NAME; #endif return (int )pc->ctype; } return ONIGERR_INVALID_CHAR_PROPERTY_NAME; } jq-1.8.2/vendor/oniguruma/src/utf32_le.c0000644000175100017510000001136515215513537013515 /********************************************************************** utf32_le.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" static int utf32le_mbc_enc_len(const UChar* p ARG_UNUSED) { return 4; } static int is_valid_mbc_string(const UChar* s, const UChar* end) { return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_UTF32_LE, s, end); } static int utf32le_is_mbc_newline(const UChar* p, const UChar* end) { if (p + 3 < end) { if (*p == NEWLINE_CODE && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) return 1; #ifdef USE_UNICODE_ALL_LINE_TERMINATORS if (( #ifndef USE_CRNL_AS_LINE_TERMINATOR *p == 0x0d || #endif *p == 0x85) && *(p+1) == 0x00 && (p+2) == 0x00 && *(p+3) == 0x00) return 1; if (*(p+1) == 0x20 && (*p == 0x29 || *p == 0x28) && *(p+2) == 0x00 && *(p+3) == 0x00) return 1; #endif } return 0; } static OnigCodePoint utf32le_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED) { OnigCodePoint code; code = (OnigCodePoint )((((p[3] & 0x7f) * 256 + p[2]) * 256 + p[1]) * 256 + p[0]); return code; } static int utf32le_code_to_mbclen(OnigCodePoint code ARG_UNUSED) { return 4; } static int utf32le_code_to_mbc(OnigCodePoint code, UChar *buf) { UChar* p = buf; *p++ = (UChar ) (code & 0xff); *p++ = (UChar )((code & 0xff00) >> 8); *p++ = (UChar )((code & 0xff0000) >>16); *p++ = (UChar )((code & 0xff000000) >>24); return 4; } static int utf32le_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold) { const UChar* p = *pp; if (ONIGENC_IS_ASCII_CODE(*p) && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) { #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (*p == 0x49) { *fold++ = 0x31; *fold++ = 0x01; } } else { #endif *fold++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p); *fold++ = 0; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI } #endif *fold++ = 0; *fold = 0; *pp += 4; return 4; } else return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF32_LE, flag, pp, end, fold); } static UChar* utf32le_left_adjust_char_head(const UChar* start, const UChar* s) { int rem; if (s <= start) return (UChar* )s; rem = (s - start) % 4; return (UChar* )(s - rem); } static int utf32le_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF32_LE, flag, p, end, items); } OnigEncodingType OnigEncodingUTF32_LE = { utf32le_mbc_enc_len, "UTF-32LE", /* name */ 4, /* max enc length */ 4, /* min enc length */ utf32le_is_mbc_newline, utf32le_mbc_to_code, utf32le_code_to_mbclen, utf32le_code_to_mbc, utf32le_mbc_case_fold, onigenc_unicode_apply_all_case_fold, utf32le_get_case_fold_codes_by_str, onigenc_unicode_property_name_to_ctype, onigenc_unicode_is_code_ctype, onigenc_utf16_32_get_ctype_code_range, utf32le_left_adjust_char_head, onigenc_always_false_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/unicode_wb_data.c0000644000175100017510000011720215215513537015176 /* unicode_wb_data.c: Generated by make_unicode_wb_data.py. */ /*- * Copyright (c) 2019-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #define WORD_BREAK_PROPERTY_VERSION 160000 /* ALetter CR Double_Quote Extend ExtendNumLet Format Hebrew_Letter Katakana LF MidLetter MidNum MidNumLet Newline Numeric Regional_Indicator Single_Quote WSegSpace ZWJ */ static int WB_RANGE_NUM = 1085; static WB_RANGE_TYPE WB_RANGES[] = { {0x00000a, 0x00000a, WB_LF }, {0x00000b, 0x00000c, WB_Newline }, {0x00000d, 0x00000d, WB_CR }, {0x000020, 0x000020, WB_WSegSpace }, {0x000022, 0x000022, WB_Double_Quote }, {0x000027, 0x000027, WB_Single_Quote }, {0x00002c, 0x00002c, WB_MidNum }, {0x00002e, 0x00002e, WB_MidNumLet }, {0x000030, 0x000039, WB_Numeric }, {0x00003a, 0x00003a, WB_MidLetter }, {0x00003b, 0x00003b, WB_MidNum }, {0x000041, 0x00005a, WB_ALetter }, {0x00005f, 0x00005f, WB_ExtendNumLet }, {0x000061, 0x00007a, WB_ALetter }, {0x000085, 0x000085, WB_Newline }, {0x0000aa, 0x0000aa, WB_ALetter }, {0x0000ad, 0x0000ad, WB_Format }, {0x0000b5, 0x0000b5, WB_ALetter }, {0x0000b7, 0x0000b7, WB_MidLetter }, {0x0000ba, 0x0000ba, WB_ALetter }, {0x0000c0, 0x0000d6, WB_ALetter }, {0x0000d8, 0x0000f6, WB_ALetter }, {0x0000f8, 0x0002d7, WB_ALetter }, {0x0002de, 0x0002ff, WB_ALetter }, {0x000300, 0x00036f, WB_Extend }, {0x000370, 0x000374, WB_ALetter }, {0x000376, 0x000377, WB_ALetter }, {0x00037a, 0x00037d, WB_ALetter }, {0x00037e, 0x00037e, WB_MidNum }, {0x00037f, 0x00037f, WB_ALetter }, {0x000386, 0x000386, WB_ALetter }, {0x000387, 0x000387, WB_MidLetter }, {0x000388, 0x00038a, WB_ALetter }, {0x00038c, 0x00038c, WB_ALetter }, {0x00038e, 0x0003a1, WB_ALetter }, {0x0003a3, 0x0003f5, WB_ALetter }, {0x0003f7, 0x000481, WB_ALetter }, {0x000483, 0x000489, WB_Extend }, {0x00048a, 0x00052f, WB_ALetter }, {0x000531, 0x000556, WB_ALetter }, {0x000559, 0x00055c, WB_ALetter }, {0x00055e, 0x00055e, WB_ALetter }, {0x00055f, 0x00055f, WB_MidLetter }, {0x000560, 0x000588, WB_ALetter }, {0x000589, 0x000589, WB_MidNum }, {0x00058a, 0x00058a, WB_ALetter }, {0x000591, 0x0005bd, WB_Extend }, {0x0005bf, 0x0005bf, WB_Extend }, {0x0005c1, 0x0005c2, WB_Extend }, {0x0005c4, 0x0005c5, WB_Extend }, {0x0005c7, 0x0005c7, WB_Extend }, {0x0005d0, 0x0005ea, WB_Hebrew_Letter }, {0x0005ef, 0x0005f2, WB_Hebrew_Letter }, {0x0005f3, 0x0005f3, WB_ALetter }, {0x0005f4, 0x0005f4, WB_MidLetter }, {0x000600, 0x000605, WB_Numeric }, {0x00060c, 0x00060d, WB_MidNum }, {0x000610, 0x00061a, WB_Extend }, {0x00061c, 0x00061c, WB_Format }, {0x000620, 0x00064a, WB_ALetter }, {0x00064b, 0x00065f, WB_Extend }, {0x000660, 0x000669, WB_Numeric }, {0x00066b, 0x00066b, WB_Numeric }, {0x00066c, 0x00066c, WB_MidNum }, {0x00066e, 0x00066f, WB_ALetter }, {0x000670, 0x000670, WB_Extend }, {0x000671, 0x0006d3, WB_ALetter }, {0x0006d5, 0x0006d5, WB_ALetter }, {0x0006d6, 0x0006dc, WB_Extend }, {0x0006dd, 0x0006dd, WB_Numeric }, {0x0006df, 0x0006e4, WB_Extend }, {0x0006e5, 0x0006e6, WB_ALetter }, {0x0006e7, 0x0006e8, WB_Extend }, {0x0006ea, 0x0006ed, WB_Extend }, {0x0006ee, 0x0006ef, WB_ALetter }, {0x0006f0, 0x0006f9, WB_Numeric }, {0x0006fa, 0x0006fc, WB_ALetter }, {0x0006ff, 0x0006ff, WB_ALetter }, {0x00070f, 0x000710, WB_ALetter }, {0x000711, 0x000711, WB_Extend }, {0x000712, 0x00072f, WB_ALetter }, {0x000730, 0x00074a, WB_Extend }, {0x00074d, 0x0007a5, WB_ALetter }, {0x0007a6, 0x0007b0, WB_Extend }, {0x0007b1, 0x0007b1, WB_ALetter }, {0x0007c0, 0x0007c9, WB_Numeric }, {0x0007ca, 0x0007ea, WB_ALetter }, {0x0007eb, 0x0007f3, WB_Extend }, {0x0007f4, 0x0007f5, WB_ALetter }, {0x0007f8, 0x0007f8, WB_MidNum }, {0x0007fa, 0x0007fa, WB_ALetter }, {0x0007fd, 0x0007fd, WB_Extend }, {0x000800, 0x000815, WB_ALetter }, {0x000816, 0x000819, WB_Extend }, {0x00081a, 0x00081a, WB_ALetter }, {0x00081b, 0x000823, WB_Extend }, {0x000824, 0x000824, WB_ALetter }, {0x000825, 0x000827, WB_Extend }, {0x000828, 0x000828, WB_ALetter }, {0x000829, 0x00082d, WB_Extend }, {0x000840, 0x000858, WB_ALetter }, {0x000859, 0x00085b, WB_Extend }, {0x000860, 0x00086a, WB_ALetter }, {0x000870, 0x000887, WB_ALetter }, {0x000889, 0x00088e, WB_ALetter }, {0x000890, 0x000891, WB_Numeric }, {0x000897, 0x00089f, WB_Extend }, {0x0008a0, 0x0008c9, WB_ALetter }, {0x0008ca, 0x0008e1, WB_Extend }, {0x0008e2, 0x0008e2, WB_Numeric }, {0x0008e3, 0x000903, WB_Extend }, {0x000904, 0x000939, WB_ALetter }, {0x00093a, 0x00093c, WB_Extend }, {0x00093d, 0x00093d, WB_ALetter }, {0x00093e, 0x00094f, WB_Extend }, {0x000950, 0x000950, WB_ALetter }, {0x000951, 0x000957, WB_Extend }, {0x000958, 0x000961, WB_ALetter }, {0x000962, 0x000963, WB_Extend }, {0x000966, 0x00096f, WB_Numeric }, {0x000971, 0x000980, WB_ALetter }, {0x000981, 0x000983, WB_Extend }, {0x000985, 0x00098c, WB_ALetter }, {0x00098f, 0x000990, WB_ALetter }, {0x000993, 0x0009a8, WB_ALetter }, {0x0009aa, 0x0009b0, WB_ALetter }, {0x0009b2, 0x0009b2, WB_ALetter }, {0x0009b6, 0x0009b9, WB_ALetter }, {0x0009bc, 0x0009bc, WB_Extend }, {0x0009bd, 0x0009bd, WB_ALetter }, {0x0009be, 0x0009c4, WB_Extend }, {0x0009c7, 0x0009c8, WB_Extend }, {0x0009cb, 0x0009cd, WB_Extend }, {0x0009ce, 0x0009ce, WB_ALetter }, {0x0009d7, 0x0009d7, WB_Extend }, {0x0009dc, 0x0009dd, WB_ALetter }, {0x0009df, 0x0009e1, WB_ALetter }, {0x0009e2, 0x0009e3, WB_Extend }, {0x0009e6, 0x0009ef, WB_Numeric }, {0x0009f0, 0x0009f1, WB_ALetter }, {0x0009fc, 0x0009fc, WB_ALetter }, {0x0009fe, 0x0009fe, WB_Extend }, {0x000a01, 0x000a03, WB_Extend }, {0x000a05, 0x000a0a, WB_ALetter }, {0x000a0f, 0x000a10, WB_ALetter }, {0x000a13, 0x000a28, WB_ALetter }, {0x000a2a, 0x000a30, WB_ALetter }, {0x000a32, 0x000a33, WB_ALetter }, {0x000a35, 0x000a36, WB_ALetter }, {0x000a38, 0x000a39, WB_ALetter }, {0x000a3c, 0x000a3c, WB_Extend }, {0x000a3e, 0x000a42, WB_Extend }, {0x000a47, 0x000a48, WB_Extend }, {0x000a4b, 0x000a4d, WB_Extend }, {0x000a51, 0x000a51, WB_Extend }, {0x000a59, 0x000a5c, WB_ALetter }, {0x000a5e, 0x000a5e, WB_ALetter }, {0x000a66, 0x000a6f, WB_Numeric }, {0x000a70, 0x000a71, WB_Extend }, {0x000a72, 0x000a74, WB_ALetter }, {0x000a75, 0x000a75, WB_Extend }, {0x000a81, 0x000a83, WB_Extend }, {0x000a85, 0x000a8d, WB_ALetter }, {0x000a8f, 0x000a91, WB_ALetter }, {0x000a93, 0x000aa8, WB_ALetter }, {0x000aaa, 0x000ab0, WB_ALetter }, {0x000ab2, 0x000ab3, WB_ALetter }, {0x000ab5, 0x000ab9, WB_ALetter }, {0x000abc, 0x000abc, WB_Extend }, {0x000abd, 0x000abd, WB_ALetter }, {0x000abe, 0x000ac5, WB_Extend }, {0x000ac7, 0x000ac9, WB_Extend }, {0x000acb, 0x000acd, WB_Extend }, {0x000ad0, 0x000ad0, WB_ALetter }, {0x000ae0, 0x000ae1, WB_ALetter }, {0x000ae2, 0x000ae3, WB_Extend }, {0x000ae6, 0x000aef, WB_Numeric }, {0x000af9, 0x000af9, WB_ALetter }, {0x000afa, 0x000aff, WB_Extend }, {0x000b01, 0x000b03, WB_Extend }, {0x000b05, 0x000b0c, WB_ALetter }, {0x000b0f, 0x000b10, WB_ALetter }, {0x000b13, 0x000b28, WB_ALetter }, {0x000b2a, 0x000b30, WB_ALetter }, {0x000b32, 0x000b33, WB_ALetter }, {0x000b35, 0x000b39, WB_ALetter }, {0x000b3c, 0x000b3c, WB_Extend }, {0x000b3d, 0x000b3d, WB_ALetter }, {0x000b3e, 0x000b44, WB_Extend }, {0x000b47, 0x000b48, WB_Extend }, {0x000b4b, 0x000b4d, WB_Extend }, {0x000b55, 0x000b57, WB_Extend }, {0x000b5c, 0x000b5d, WB_ALetter }, {0x000b5f, 0x000b61, WB_ALetter }, {0x000b62, 0x000b63, WB_Extend }, {0x000b66, 0x000b6f, WB_Numeric }, {0x000b71, 0x000b71, WB_ALetter }, {0x000b82, 0x000b82, WB_Extend }, {0x000b83, 0x000b83, WB_ALetter }, {0x000b85, 0x000b8a, WB_ALetter }, {0x000b8e, 0x000b90, WB_ALetter }, {0x000b92, 0x000b95, WB_ALetter }, {0x000b99, 0x000b9a, WB_ALetter }, {0x000b9c, 0x000b9c, WB_ALetter }, {0x000b9e, 0x000b9f, WB_ALetter }, {0x000ba3, 0x000ba4, WB_ALetter }, {0x000ba8, 0x000baa, WB_ALetter }, {0x000bae, 0x000bb9, WB_ALetter }, {0x000bbe, 0x000bc2, WB_Extend }, {0x000bc6, 0x000bc8, WB_Extend }, {0x000bca, 0x000bcd, WB_Extend }, {0x000bd0, 0x000bd0, WB_ALetter }, {0x000bd7, 0x000bd7, WB_Extend }, {0x000be6, 0x000bef, WB_Numeric }, {0x000c00, 0x000c04, WB_Extend }, {0x000c05, 0x000c0c, WB_ALetter }, {0x000c0e, 0x000c10, WB_ALetter }, {0x000c12, 0x000c28, WB_ALetter }, {0x000c2a, 0x000c39, WB_ALetter }, {0x000c3c, 0x000c3c, WB_Extend }, {0x000c3d, 0x000c3d, WB_ALetter }, {0x000c3e, 0x000c44, WB_Extend }, {0x000c46, 0x000c48, WB_Extend }, {0x000c4a, 0x000c4d, WB_Extend }, {0x000c55, 0x000c56, WB_Extend }, {0x000c58, 0x000c5a, WB_ALetter }, {0x000c5d, 0x000c5d, WB_ALetter }, {0x000c60, 0x000c61, WB_ALetter }, {0x000c62, 0x000c63, WB_Extend }, {0x000c66, 0x000c6f, WB_Numeric }, {0x000c80, 0x000c80, WB_ALetter }, {0x000c81, 0x000c83, WB_Extend }, {0x000c85, 0x000c8c, WB_ALetter }, {0x000c8e, 0x000c90, WB_ALetter }, {0x000c92, 0x000ca8, WB_ALetter }, {0x000caa, 0x000cb3, WB_ALetter }, {0x000cb5, 0x000cb9, WB_ALetter }, {0x000cbc, 0x000cbc, WB_Extend }, {0x000cbd, 0x000cbd, WB_ALetter }, {0x000cbe, 0x000cc4, WB_Extend }, {0x000cc6, 0x000cc8, WB_Extend }, {0x000cca, 0x000ccd, WB_Extend }, {0x000cd5, 0x000cd6, WB_Extend }, {0x000cdd, 0x000cde, WB_ALetter }, {0x000ce0, 0x000ce1, WB_ALetter }, {0x000ce2, 0x000ce3, WB_Extend }, {0x000ce6, 0x000cef, WB_Numeric }, {0x000cf1, 0x000cf2, WB_ALetter }, {0x000cf3, 0x000cf3, WB_Extend }, {0x000d00, 0x000d03, WB_Extend }, {0x000d04, 0x000d0c, WB_ALetter }, {0x000d0e, 0x000d10, WB_ALetter }, {0x000d12, 0x000d3a, WB_ALetter }, {0x000d3b, 0x000d3c, WB_Extend }, {0x000d3d, 0x000d3d, WB_ALetter }, {0x000d3e, 0x000d44, WB_Extend }, {0x000d46, 0x000d48, WB_Extend }, {0x000d4a, 0x000d4d, WB_Extend }, {0x000d4e, 0x000d4e, WB_ALetter }, {0x000d54, 0x000d56, WB_ALetter }, {0x000d57, 0x000d57, WB_Extend }, {0x000d5f, 0x000d61, WB_ALetter }, {0x000d62, 0x000d63, WB_Extend }, {0x000d66, 0x000d6f, WB_Numeric }, {0x000d7a, 0x000d7f, WB_ALetter }, {0x000d81, 0x000d83, WB_Extend }, {0x000d85, 0x000d96, WB_ALetter }, {0x000d9a, 0x000db1, WB_ALetter }, {0x000db3, 0x000dbb, WB_ALetter }, {0x000dbd, 0x000dbd, WB_ALetter }, {0x000dc0, 0x000dc6, WB_ALetter }, {0x000dca, 0x000dca, WB_Extend }, {0x000dcf, 0x000dd4, WB_Extend }, {0x000dd6, 0x000dd6, WB_Extend }, {0x000dd8, 0x000ddf, WB_Extend }, {0x000de6, 0x000def, WB_Numeric }, {0x000df2, 0x000df3, WB_Extend }, {0x000e31, 0x000e31, WB_Extend }, {0x000e34, 0x000e3a, WB_Extend }, {0x000e47, 0x000e4e, WB_Extend }, {0x000e50, 0x000e59, WB_Numeric }, {0x000eb1, 0x000eb1, WB_Extend }, {0x000eb4, 0x000ebc, WB_Extend }, {0x000ec8, 0x000ece, WB_Extend }, {0x000ed0, 0x000ed9, WB_Numeric }, {0x000f00, 0x000f00, WB_ALetter }, {0x000f18, 0x000f19, WB_Extend }, {0x000f20, 0x000f29, WB_Numeric }, {0x000f35, 0x000f35, WB_Extend }, {0x000f37, 0x000f37, WB_Extend }, {0x000f39, 0x000f39, WB_Extend }, {0x000f3e, 0x000f3f, WB_Extend }, {0x000f40, 0x000f47, WB_ALetter }, {0x000f49, 0x000f6c, WB_ALetter }, {0x000f71, 0x000f84, WB_Extend }, {0x000f86, 0x000f87, WB_Extend }, {0x000f88, 0x000f8c, WB_ALetter }, {0x000f8d, 0x000f97, WB_Extend }, {0x000f99, 0x000fbc, WB_Extend }, {0x000fc6, 0x000fc6, WB_Extend }, {0x00102b, 0x00103e, WB_Extend }, {0x001040, 0x001049, WB_Numeric }, {0x001056, 0x001059, WB_Extend }, {0x00105e, 0x001060, WB_Extend }, {0x001062, 0x001064, WB_Extend }, {0x001067, 0x00106d, WB_Extend }, {0x001071, 0x001074, WB_Extend }, {0x001082, 0x00108d, WB_Extend }, {0x00108f, 0x00108f, WB_Extend }, {0x001090, 0x001099, WB_Numeric }, {0x00109a, 0x00109d, WB_Extend }, {0x0010a0, 0x0010c5, WB_ALetter }, {0x0010c7, 0x0010c7, WB_ALetter }, {0x0010cd, 0x0010cd, WB_ALetter }, {0x0010d0, 0x0010fa, WB_ALetter }, {0x0010fc, 0x001248, WB_ALetter }, {0x00124a, 0x00124d, WB_ALetter }, {0x001250, 0x001256, WB_ALetter }, {0x001258, 0x001258, WB_ALetter }, {0x00125a, 0x00125d, WB_ALetter }, {0x001260, 0x001288, WB_ALetter }, {0x00128a, 0x00128d, WB_ALetter }, {0x001290, 0x0012b0, WB_ALetter }, {0x0012b2, 0x0012b5, WB_ALetter }, {0x0012b8, 0x0012be, WB_ALetter }, {0x0012c0, 0x0012c0, WB_ALetter }, {0x0012c2, 0x0012c5, WB_ALetter }, {0x0012c8, 0x0012d6, WB_ALetter }, {0x0012d8, 0x001310, WB_ALetter }, {0x001312, 0x001315, WB_ALetter }, {0x001318, 0x00135a, WB_ALetter }, {0x00135d, 0x00135f, WB_Extend }, {0x001380, 0x00138f, WB_ALetter }, {0x0013a0, 0x0013f5, WB_ALetter }, {0x0013f8, 0x0013fd, WB_ALetter }, {0x001401, 0x00166c, WB_ALetter }, {0x00166f, 0x00167f, WB_ALetter }, {0x001680, 0x001680, WB_WSegSpace }, {0x001681, 0x00169a, WB_ALetter }, {0x0016a0, 0x0016ea, WB_ALetter }, {0x0016ee, 0x0016f8, WB_ALetter }, {0x001700, 0x001711, WB_ALetter }, {0x001712, 0x001715, WB_Extend }, {0x00171f, 0x001731, WB_ALetter }, {0x001732, 0x001734, WB_Extend }, {0x001740, 0x001751, WB_ALetter }, {0x001752, 0x001753, WB_Extend }, {0x001760, 0x00176c, WB_ALetter }, {0x00176e, 0x001770, WB_ALetter }, {0x001772, 0x001773, WB_Extend }, {0x0017b4, 0x0017d3, WB_Extend }, {0x0017dd, 0x0017dd, WB_Extend }, {0x0017e0, 0x0017e9, WB_Numeric }, {0x00180b, 0x00180d, WB_Extend }, {0x00180e, 0x00180e, WB_Format }, {0x00180f, 0x00180f, WB_Extend }, {0x001810, 0x001819, WB_Numeric }, {0x001820, 0x001878, WB_ALetter }, {0x001880, 0x001884, WB_ALetter }, {0x001885, 0x001886, WB_Extend }, {0x001887, 0x0018a8, WB_ALetter }, {0x0018a9, 0x0018a9, WB_Extend }, {0x0018aa, 0x0018aa, WB_ALetter }, {0x0018b0, 0x0018f5, WB_ALetter }, {0x001900, 0x00191e, WB_ALetter }, {0x001920, 0x00192b, WB_Extend }, {0x001930, 0x00193b, WB_Extend }, {0x001946, 0x00194f, WB_Numeric }, {0x0019d0, 0x0019da, WB_Numeric }, {0x001a00, 0x001a16, WB_ALetter }, {0x001a17, 0x001a1b, WB_Extend }, {0x001a55, 0x001a5e, WB_Extend }, {0x001a60, 0x001a7c, WB_Extend }, {0x001a7f, 0x001a7f, WB_Extend }, {0x001a80, 0x001a89, WB_Numeric }, {0x001a90, 0x001a99, WB_Numeric }, {0x001ab0, 0x001ace, WB_Extend }, {0x001b00, 0x001b04, WB_Extend }, {0x001b05, 0x001b33, WB_ALetter }, {0x001b34, 0x001b44, WB_Extend }, {0x001b45, 0x001b4c, WB_ALetter }, {0x001b50, 0x001b59, WB_Numeric }, {0x001b6b, 0x001b73, WB_Extend }, {0x001b80, 0x001b82, WB_Extend }, {0x001b83, 0x001ba0, WB_ALetter }, {0x001ba1, 0x001bad, WB_Extend }, {0x001bae, 0x001baf, WB_ALetter }, {0x001bb0, 0x001bb9, WB_Numeric }, {0x001bba, 0x001be5, WB_ALetter }, {0x001be6, 0x001bf3, WB_Extend }, {0x001c00, 0x001c23, WB_ALetter }, {0x001c24, 0x001c37, WB_Extend }, {0x001c40, 0x001c49, WB_Numeric }, {0x001c4d, 0x001c4f, WB_ALetter }, {0x001c50, 0x001c59, WB_Numeric }, {0x001c5a, 0x001c7d, WB_ALetter }, {0x001c80, 0x001c8a, WB_ALetter }, {0x001c90, 0x001cba, WB_ALetter }, {0x001cbd, 0x001cbf, WB_ALetter }, {0x001cd0, 0x001cd2, WB_Extend }, {0x001cd4, 0x001ce8, WB_Extend }, {0x001ce9, 0x001cec, WB_ALetter }, {0x001ced, 0x001ced, WB_Extend }, {0x001cee, 0x001cf3, WB_ALetter }, {0x001cf4, 0x001cf4, WB_Extend }, {0x001cf5, 0x001cf6, WB_ALetter }, {0x001cf7, 0x001cf9, WB_Extend }, {0x001cfa, 0x001cfa, WB_ALetter }, {0x001d00, 0x001dbf, WB_ALetter }, {0x001dc0, 0x001dff, WB_Extend }, {0x001e00, 0x001f15, WB_ALetter }, {0x001f18, 0x001f1d, WB_ALetter }, {0x001f20, 0x001f45, WB_ALetter }, {0x001f48, 0x001f4d, WB_ALetter }, {0x001f50, 0x001f57, WB_ALetter }, {0x001f59, 0x001f59, WB_ALetter }, {0x001f5b, 0x001f5b, WB_ALetter }, {0x001f5d, 0x001f5d, WB_ALetter }, {0x001f5f, 0x001f7d, WB_ALetter }, {0x001f80, 0x001fb4, WB_ALetter }, {0x001fb6, 0x001fbc, WB_ALetter }, {0x001fbe, 0x001fbe, WB_ALetter }, {0x001fc2, 0x001fc4, WB_ALetter }, {0x001fc6, 0x001fcc, WB_ALetter }, {0x001fd0, 0x001fd3, WB_ALetter }, {0x001fd6, 0x001fdb, WB_ALetter }, {0x001fe0, 0x001fec, WB_ALetter }, {0x001ff2, 0x001ff4, WB_ALetter }, {0x001ff6, 0x001ffc, WB_ALetter }, {0x002000, 0x002006, WB_WSegSpace }, {0x002008, 0x00200a, WB_WSegSpace }, {0x00200c, 0x00200c, WB_Extend }, {0x00200d, 0x00200d, WB_ZWJ }, {0x00200e, 0x00200f, WB_Format }, {0x002018, 0x002019, WB_MidNumLet }, {0x002024, 0x002024, WB_MidNumLet }, {0x002027, 0x002027, WB_MidLetter }, {0x002028, 0x002029, WB_Newline }, {0x00202a, 0x00202e, WB_Format }, {0x00202f, 0x00202f, WB_ExtendNumLet }, {0x00203f, 0x002040, WB_ExtendNumLet }, {0x002044, 0x002044, WB_MidNum }, {0x002054, 0x002054, WB_ExtendNumLet }, {0x00205f, 0x00205f, WB_WSegSpace }, {0x002060, 0x002064, WB_Format }, {0x002066, 0x00206f, WB_Format }, {0x002071, 0x002071, WB_ALetter }, {0x00207f, 0x00207f, WB_ALetter }, {0x002090, 0x00209c, WB_ALetter }, {0x0020d0, 0x0020f0, WB_Extend }, {0x002102, 0x002102, WB_ALetter }, {0x002107, 0x002107, WB_ALetter }, {0x00210a, 0x002113, WB_ALetter }, {0x002115, 0x002115, WB_ALetter }, {0x002119, 0x00211d, WB_ALetter }, {0x002124, 0x002124, WB_ALetter }, {0x002126, 0x002126, WB_ALetter }, {0x002128, 0x002128, WB_ALetter }, {0x00212a, 0x00212d, WB_ALetter }, {0x00212f, 0x002139, WB_ALetter }, {0x00213c, 0x00213f, WB_ALetter }, {0x002145, 0x002149, WB_ALetter }, {0x00214e, 0x00214e, WB_ALetter }, {0x002160, 0x002188, WB_ALetter }, {0x0024b6, 0x0024e9, WB_ALetter }, {0x002c00, 0x002ce4, WB_ALetter }, {0x002ceb, 0x002cee, WB_ALetter }, {0x002cef, 0x002cf1, WB_Extend }, {0x002cf2, 0x002cf3, WB_ALetter }, {0x002d00, 0x002d25, WB_ALetter }, {0x002d27, 0x002d27, WB_ALetter }, {0x002d2d, 0x002d2d, WB_ALetter }, {0x002d30, 0x002d67, WB_ALetter }, {0x002d6f, 0x002d6f, WB_ALetter }, {0x002d7f, 0x002d7f, WB_Extend }, {0x002d80, 0x002d96, WB_ALetter }, {0x002da0, 0x002da6, WB_ALetter }, {0x002da8, 0x002dae, WB_ALetter }, {0x002db0, 0x002db6, WB_ALetter }, {0x002db8, 0x002dbe, WB_ALetter }, {0x002dc0, 0x002dc6, WB_ALetter }, {0x002dc8, 0x002dce, WB_ALetter }, {0x002dd0, 0x002dd6, WB_ALetter }, {0x002dd8, 0x002dde, WB_ALetter }, {0x002de0, 0x002dff, WB_Extend }, {0x002e2f, 0x002e2f, WB_ALetter }, {0x003000, 0x003000, WB_WSegSpace }, {0x003005, 0x003005, WB_ALetter }, {0x00302a, 0x00302f, WB_Extend }, {0x003031, 0x003035, WB_Katakana }, {0x00303b, 0x00303c, WB_ALetter }, {0x003099, 0x00309a, WB_Extend }, {0x00309b, 0x00309c, WB_Katakana }, {0x0030a0, 0x0030fa, WB_Katakana }, {0x0030fc, 0x0030ff, WB_Katakana }, {0x003105, 0x00312f, WB_ALetter }, {0x003131, 0x00318e, WB_ALetter }, {0x0031a0, 0x0031bf, WB_ALetter }, {0x0031f0, 0x0031ff, WB_Katakana }, {0x0032d0, 0x0032fe, WB_Katakana }, {0x003300, 0x003357, WB_Katakana }, {0x00a000, 0x00a48c, WB_ALetter }, {0x00a4d0, 0x00a4fd, WB_ALetter }, {0x00a500, 0x00a60c, WB_ALetter }, {0x00a610, 0x00a61f, WB_ALetter }, {0x00a620, 0x00a629, WB_Numeric }, {0x00a62a, 0x00a62b, WB_ALetter }, {0x00a640, 0x00a66e, WB_ALetter }, {0x00a66f, 0x00a672, WB_Extend }, {0x00a674, 0x00a67d, WB_Extend }, {0x00a67f, 0x00a69d, WB_ALetter }, {0x00a69e, 0x00a69f, WB_Extend }, {0x00a6a0, 0x00a6ef, WB_ALetter }, {0x00a6f0, 0x00a6f1, WB_Extend }, {0x00a708, 0x00a7cd, WB_ALetter }, {0x00a7d0, 0x00a7d1, WB_ALetter }, {0x00a7d3, 0x00a7d3, WB_ALetter }, {0x00a7d5, 0x00a7dc, WB_ALetter }, {0x00a7f2, 0x00a801, WB_ALetter }, {0x00a802, 0x00a802, WB_Extend }, {0x00a803, 0x00a805, WB_ALetter }, {0x00a806, 0x00a806, WB_Extend }, {0x00a807, 0x00a80a, WB_ALetter }, {0x00a80b, 0x00a80b, WB_Extend }, {0x00a80c, 0x00a822, WB_ALetter }, {0x00a823, 0x00a827, WB_Extend }, {0x00a82c, 0x00a82c, WB_Extend }, {0x00a840, 0x00a873, WB_ALetter }, {0x00a880, 0x00a881, WB_Extend }, {0x00a882, 0x00a8b3, WB_ALetter }, {0x00a8b4, 0x00a8c5, WB_Extend }, {0x00a8d0, 0x00a8d9, WB_Numeric }, {0x00a8e0, 0x00a8f1, WB_Extend }, {0x00a8f2, 0x00a8f7, WB_ALetter }, {0x00a8fb, 0x00a8fb, WB_ALetter }, {0x00a8fd, 0x00a8fe, WB_ALetter }, {0x00a8ff, 0x00a8ff, WB_Extend }, {0x00a900, 0x00a909, WB_Numeric }, {0x00a90a, 0x00a925, WB_ALetter }, {0x00a926, 0x00a92d, WB_Extend }, {0x00a930, 0x00a946, WB_ALetter }, {0x00a947, 0x00a953, WB_Extend }, {0x00a960, 0x00a97c, WB_ALetter }, {0x00a980, 0x00a983, WB_Extend }, {0x00a984, 0x00a9b2, WB_ALetter }, {0x00a9b3, 0x00a9c0, WB_Extend }, {0x00a9cf, 0x00a9cf, WB_ALetter }, {0x00a9d0, 0x00a9d9, WB_Numeric }, {0x00a9e5, 0x00a9e5, WB_Extend }, {0x00a9f0, 0x00a9f9, WB_Numeric }, {0x00aa00, 0x00aa28, WB_ALetter }, {0x00aa29, 0x00aa36, WB_Extend }, {0x00aa40, 0x00aa42, WB_ALetter }, {0x00aa43, 0x00aa43, WB_Extend }, {0x00aa44, 0x00aa4b, WB_ALetter }, {0x00aa4c, 0x00aa4d, WB_Extend }, {0x00aa50, 0x00aa59, WB_Numeric }, {0x00aa7b, 0x00aa7d, WB_Extend }, {0x00aab0, 0x00aab0, WB_Extend }, {0x00aab2, 0x00aab4, WB_Extend }, {0x00aab7, 0x00aab8, WB_Extend }, {0x00aabe, 0x00aabf, WB_Extend }, {0x00aac1, 0x00aac1, WB_Extend }, {0x00aae0, 0x00aaea, WB_ALetter }, {0x00aaeb, 0x00aaef, WB_Extend }, {0x00aaf2, 0x00aaf4, WB_ALetter }, {0x00aaf5, 0x00aaf6, WB_Extend }, {0x00ab01, 0x00ab06, WB_ALetter }, {0x00ab09, 0x00ab0e, WB_ALetter }, {0x00ab11, 0x00ab16, WB_ALetter }, {0x00ab20, 0x00ab26, WB_ALetter }, {0x00ab28, 0x00ab2e, WB_ALetter }, {0x00ab30, 0x00ab69, WB_ALetter }, {0x00ab70, 0x00abe2, WB_ALetter }, {0x00abe3, 0x00abea, WB_Extend }, {0x00abec, 0x00abed, WB_Extend }, {0x00abf0, 0x00abf9, WB_Numeric }, {0x00ac00, 0x00d7a3, WB_ALetter }, {0x00d7b0, 0x00d7c6, WB_ALetter }, {0x00d7cb, 0x00d7fb, WB_ALetter }, {0x00fb00, 0x00fb06, WB_ALetter }, {0x00fb13, 0x00fb17, WB_ALetter }, {0x00fb1d, 0x00fb1d, WB_Hebrew_Letter }, {0x00fb1e, 0x00fb1e, WB_Extend }, {0x00fb1f, 0x00fb28, WB_Hebrew_Letter }, {0x00fb2a, 0x00fb36, WB_Hebrew_Letter }, {0x00fb38, 0x00fb3c, WB_Hebrew_Letter }, {0x00fb3e, 0x00fb3e, WB_Hebrew_Letter }, {0x00fb40, 0x00fb41, WB_Hebrew_Letter }, {0x00fb43, 0x00fb44, WB_Hebrew_Letter }, {0x00fb46, 0x00fb4f, WB_Hebrew_Letter }, {0x00fb50, 0x00fbb1, WB_ALetter }, {0x00fbd3, 0x00fd3d, WB_ALetter }, {0x00fd50, 0x00fd8f, WB_ALetter }, {0x00fd92, 0x00fdc7, WB_ALetter }, {0x00fdf0, 0x00fdfb, WB_ALetter }, {0x00fe00, 0x00fe0f, WB_Extend }, {0x00fe13, 0x00fe13, WB_MidLetter }, {0x00fe20, 0x00fe2f, WB_Extend }, {0x00fe33, 0x00fe34, WB_ExtendNumLet }, {0x00fe4d, 0x00fe4f, WB_ExtendNumLet }, {0x00fe50, 0x00fe50, WB_MidNum }, {0x00fe52, 0x00fe52, WB_MidNumLet }, {0x00fe54, 0x00fe54, WB_MidNum }, {0x00fe55, 0x00fe55, WB_MidLetter }, {0x00fe70, 0x00fe74, WB_ALetter }, {0x00fe76, 0x00fefc, WB_ALetter }, {0x00feff, 0x00feff, WB_Format }, {0x00ff07, 0x00ff07, WB_MidNumLet }, {0x00ff0c, 0x00ff0c, WB_MidNum }, {0x00ff0e, 0x00ff0e, WB_MidNumLet }, {0x00ff10, 0x00ff19, WB_Numeric }, {0x00ff1a, 0x00ff1a, WB_MidLetter }, {0x00ff1b, 0x00ff1b, WB_MidNum }, {0x00ff21, 0x00ff3a, WB_ALetter }, {0x00ff3f, 0x00ff3f, WB_ExtendNumLet }, {0x00ff41, 0x00ff5a, WB_ALetter }, {0x00ff66, 0x00ff9d, WB_Katakana }, {0x00ff9e, 0x00ff9f, WB_Extend }, {0x00ffa0, 0x00ffbe, WB_ALetter }, {0x00ffc2, 0x00ffc7, WB_ALetter }, {0x00ffca, 0x00ffcf, WB_ALetter }, {0x00ffd2, 0x00ffd7, WB_ALetter }, {0x00ffda, 0x00ffdc, WB_ALetter }, {0x00fff9, 0x00fffb, WB_Format }, {0x010000, 0x01000b, WB_ALetter }, {0x01000d, 0x010026, WB_ALetter }, {0x010028, 0x01003a, WB_ALetter }, {0x01003c, 0x01003d, WB_ALetter }, {0x01003f, 0x01004d, WB_ALetter }, {0x010050, 0x01005d, WB_ALetter }, {0x010080, 0x0100fa, WB_ALetter }, {0x010140, 0x010174, WB_ALetter }, {0x0101fd, 0x0101fd, WB_Extend }, {0x010280, 0x01029c, WB_ALetter }, {0x0102a0, 0x0102d0, WB_ALetter }, {0x0102e0, 0x0102e0, WB_Extend }, {0x010300, 0x01031f, WB_ALetter }, {0x01032d, 0x01034a, WB_ALetter }, {0x010350, 0x010375, WB_ALetter }, {0x010376, 0x01037a, WB_Extend }, {0x010380, 0x01039d, WB_ALetter }, {0x0103a0, 0x0103c3, WB_ALetter }, {0x0103c8, 0x0103cf, WB_ALetter }, {0x0103d1, 0x0103d5, WB_ALetter }, {0x010400, 0x01049d, WB_ALetter }, {0x0104a0, 0x0104a9, WB_Numeric }, {0x0104b0, 0x0104d3, WB_ALetter }, {0x0104d8, 0x0104fb, WB_ALetter }, {0x010500, 0x010527, WB_ALetter }, {0x010530, 0x010563, WB_ALetter }, {0x010570, 0x01057a, WB_ALetter }, {0x01057c, 0x01058a, WB_ALetter }, {0x01058c, 0x010592, WB_ALetter }, {0x010594, 0x010595, WB_ALetter }, {0x010597, 0x0105a1, WB_ALetter }, {0x0105a3, 0x0105b1, WB_ALetter }, {0x0105b3, 0x0105b9, WB_ALetter }, {0x0105bb, 0x0105bc, WB_ALetter }, {0x0105c0, 0x0105f3, WB_ALetter }, {0x010600, 0x010736, WB_ALetter }, {0x010740, 0x010755, WB_ALetter }, {0x010760, 0x010767, WB_ALetter }, {0x010780, 0x010785, WB_ALetter }, {0x010787, 0x0107b0, WB_ALetter }, {0x0107b2, 0x0107ba, WB_ALetter }, {0x010800, 0x010805, WB_ALetter }, {0x010808, 0x010808, WB_ALetter }, {0x01080a, 0x010835, WB_ALetter }, {0x010837, 0x010838, WB_ALetter }, {0x01083c, 0x01083c, WB_ALetter }, {0x01083f, 0x010855, WB_ALetter }, {0x010860, 0x010876, WB_ALetter }, {0x010880, 0x01089e, WB_ALetter }, {0x0108e0, 0x0108f2, WB_ALetter }, {0x0108f4, 0x0108f5, WB_ALetter }, {0x010900, 0x010915, WB_ALetter }, {0x010920, 0x010939, WB_ALetter }, {0x010980, 0x0109b7, WB_ALetter }, {0x0109be, 0x0109bf, WB_ALetter }, {0x010a00, 0x010a00, WB_ALetter }, {0x010a01, 0x010a03, WB_Extend }, {0x010a05, 0x010a06, WB_Extend }, {0x010a0c, 0x010a0f, WB_Extend }, {0x010a10, 0x010a13, WB_ALetter }, {0x010a15, 0x010a17, WB_ALetter }, {0x010a19, 0x010a35, WB_ALetter }, {0x010a38, 0x010a3a, WB_Extend }, {0x010a3f, 0x010a3f, WB_Extend }, {0x010a60, 0x010a7c, WB_ALetter }, {0x010a80, 0x010a9c, WB_ALetter }, {0x010ac0, 0x010ac7, WB_ALetter }, {0x010ac9, 0x010ae4, WB_ALetter }, {0x010ae5, 0x010ae6, WB_Extend }, {0x010b00, 0x010b35, WB_ALetter }, {0x010b40, 0x010b55, WB_ALetter }, {0x010b60, 0x010b72, WB_ALetter }, {0x010b80, 0x010b91, WB_ALetter }, {0x010c00, 0x010c48, WB_ALetter }, {0x010c80, 0x010cb2, WB_ALetter }, {0x010cc0, 0x010cf2, WB_ALetter }, {0x010d00, 0x010d23, WB_ALetter }, {0x010d24, 0x010d27, WB_Extend }, {0x010d30, 0x010d39, WB_Numeric }, {0x010d40, 0x010d49, WB_Numeric }, {0x010d4a, 0x010d65, WB_ALetter }, {0x010d69, 0x010d6d, WB_Extend }, {0x010d6f, 0x010d85, WB_ALetter }, {0x010e80, 0x010ea9, WB_ALetter }, {0x010eab, 0x010eac, WB_Extend }, {0x010eb0, 0x010eb1, WB_ALetter }, {0x010ec2, 0x010ec4, WB_ALetter }, {0x010efc, 0x010eff, WB_Extend }, {0x010f00, 0x010f1c, WB_ALetter }, {0x010f27, 0x010f27, WB_ALetter }, {0x010f30, 0x010f45, WB_ALetter }, {0x010f46, 0x010f50, WB_Extend }, {0x010f70, 0x010f81, WB_ALetter }, {0x010f82, 0x010f85, WB_Extend }, {0x010fb0, 0x010fc4, WB_ALetter }, {0x010fe0, 0x010ff6, WB_ALetter }, {0x011000, 0x011002, WB_Extend }, {0x011003, 0x011037, WB_ALetter }, {0x011038, 0x011046, WB_Extend }, {0x011066, 0x01106f, WB_Numeric }, {0x011070, 0x011070, WB_Extend }, {0x011071, 0x011072, WB_ALetter }, {0x011073, 0x011074, WB_Extend }, {0x011075, 0x011075, WB_ALetter }, {0x01107f, 0x011082, WB_Extend }, {0x011083, 0x0110af, WB_ALetter }, {0x0110b0, 0x0110ba, WB_Extend }, {0x0110bd, 0x0110bd, WB_Numeric }, {0x0110c2, 0x0110c2, WB_Extend }, {0x0110cd, 0x0110cd, WB_Numeric }, {0x0110d0, 0x0110e8, WB_ALetter }, {0x0110f0, 0x0110f9, WB_Numeric }, {0x011100, 0x011102, WB_Extend }, {0x011103, 0x011126, WB_ALetter }, {0x011127, 0x011134, WB_Extend }, {0x011136, 0x01113f, WB_Numeric }, {0x011144, 0x011144, WB_ALetter }, {0x011145, 0x011146, WB_Extend }, {0x011147, 0x011147, WB_ALetter }, {0x011150, 0x011172, WB_ALetter }, {0x011173, 0x011173, WB_Extend }, {0x011176, 0x011176, WB_ALetter }, {0x011180, 0x011182, WB_Extend }, {0x011183, 0x0111b2, WB_ALetter }, {0x0111b3, 0x0111c0, WB_Extend }, {0x0111c1, 0x0111c4, WB_ALetter }, {0x0111c9, 0x0111cc, WB_Extend }, {0x0111ce, 0x0111cf, WB_Extend }, {0x0111d0, 0x0111d9, WB_Numeric }, {0x0111da, 0x0111da, WB_ALetter }, {0x0111dc, 0x0111dc, WB_ALetter }, {0x011200, 0x011211, WB_ALetter }, {0x011213, 0x01122b, WB_ALetter }, {0x01122c, 0x011237, WB_Extend }, {0x01123e, 0x01123e, WB_Extend }, {0x01123f, 0x011240, WB_ALetter }, {0x011241, 0x011241, WB_Extend }, {0x011280, 0x011286, WB_ALetter }, {0x011288, 0x011288, WB_ALetter }, {0x01128a, 0x01128d, WB_ALetter }, {0x01128f, 0x01129d, WB_ALetter }, {0x01129f, 0x0112a8, WB_ALetter }, {0x0112b0, 0x0112de, WB_ALetter }, {0x0112df, 0x0112ea, WB_Extend }, {0x0112f0, 0x0112f9, WB_Numeric }, {0x011300, 0x011303, WB_Extend }, {0x011305, 0x01130c, WB_ALetter }, {0x01130f, 0x011310, WB_ALetter }, {0x011313, 0x011328, WB_ALetter }, {0x01132a, 0x011330, WB_ALetter }, {0x011332, 0x011333, WB_ALetter }, {0x011335, 0x011339, WB_ALetter }, {0x01133b, 0x01133c, WB_Extend }, {0x01133d, 0x01133d, WB_ALetter }, {0x01133e, 0x011344, WB_Extend }, {0x011347, 0x011348, WB_Extend }, {0x01134b, 0x01134d, WB_Extend }, {0x011350, 0x011350, WB_ALetter }, {0x011357, 0x011357, WB_Extend }, {0x01135d, 0x011361, WB_ALetter }, {0x011362, 0x011363, WB_Extend }, {0x011366, 0x01136c, WB_Extend }, {0x011370, 0x011374, WB_Extend }, {0x011380, 0x011389, WB_ALetter }, {0x01138b, 0x01138b, WB_ALetter }, {0x01138e, 0x01138e, WB_ALetter }, {0x011390, 0x0113b5, WB_ALetter }, {0x0113b7, 0x0113b7, WB_ALetter }, {0x0113b8, 0x0113c0, WB_Extend }, {0x0113c2, 0x0113c2, WB_Extend }, {0x0113c5, 0x0113c5, WB_Extend }, {0x0113c7, 0x0113ca, WB_Extend }, {0x0113cc, 0x0113d0, WB_Extend }, {0x0113d1, 0x0113d1, WB_ALetter }, {0x0113d2, 0x0113d2, WB_Extend }, {0x0113d3, 0x0113d3, WB_ALetter }, {0x0113e1, 0x0113e2, WB_Extend }, {0x011400, 0x011434, WB_ALetter }, {0x011435, 0x011446, WB_Extend }, {0x011447, 0x01144a, WB_ALetter }, {0x011450, 0x011459, WB_Numeric }, {0x01145e, 0x01145e, WB_Extend }, {0x01145f, 0x011461, WB_ALetter }, {0x011480, 0x0114af, WB_ALetter }, {0x0114b0, 0x0114c3, WB_Extend }, {0x0114c4, 0x0114c5, WB_ALetter }, {0x0114c7, 0x0114c7, WB_ALetter }, {0x0114d0, 0x0114d9, WB_Numeric }, {0x011580, 0x0115ae, WB_ALetter }, {0x0115af, 0x0115b5, WB_Extend }, {0x0115b8, 0x0115c0, WB_Extend }, {0x0115d8, 0x0115db, WB_ALetter }, {0x0115dc, 0x0115dd, WB_Extend }, {0x011600, 0x01162f, WB_ALetter }, {0x011630, 0x011640, WB_Extend }, {0x011644, 0x011644, WB_ALetter }, {0x011650, 0x011659, WB_Numeric }, {0x011680, 0x0116aa, WB_ALetter }, {0x0116ab, 0x0116b7, WB_Extend }, {0x0116b8, 0x0116b8, WB_ALetter }, {0x0116c0, 0x0116c9, WB_Numeric }, {0x0116d0, 0x0116e3, WB_Numeric }, {0x01171d, 0x01172b, WB_Extend }, {0x011730, 0x011739, WB_Numeric }, {0x011800, 0x01182b, WB_ALetter }, {0x01182c, 0x01183a, WB_Extend }, {0x0118a0, 0x0118df, WB_ALetter }, {0x0118e0, 0x0118e9, WB_Numeric }, {0x0118ff, 0x011906, WB_ALetter }, {0x011909, 0x011909, WB_ALetter }, {0x01190c, 0x011913, WB_ALetter }, {0x011915, 0x011916, WB_ALetter }, {0x011918, 0x01192f, WB_ALetter }, {0x011930, 0x011935, WB_Extend }, {0x011937, 0x011938, WB_Extend }, {0x01193b, 0x01193e, WB_Extend }, {0x01193f, 0x01193f, WB_ALetter }, {0x011940, 0x011940, WB_Extend }, {0x011941, 0x011941, WB_ALetter }, {0x011942, 0x011943, WB_Extend }, {0x011950, 0x011959, WB_Numeric }, {0x0119a0, 0x0119a7, WB_ALetter }, {0x0119aa, 0x0119d0, WB_ALetter }, {0x0119d1, 0x0119d7, WB_Extend }, {0x0119da, 0x0119e0, WB_Extend }, {0x0119e1, 0x0119e1, WB_ALetter }, {0x0119e3, 0x0119e3, WB_ALetter }, {0x0119e4, 0x0119e4, WB_Extend }, {0x011a00, 0x011a00, WB_ALetter }, {0x011a01, 0x011a0a, WB_Extend }, {0x011a0b, 0x011a32, WB_ALetter }, {0x011a33, 0x011a39, WB_Extend }, {0x011a3a, 0x011a3a, WB_ALetter }, {0x011a3b, 0x011a3e, WB_Extend }, {0x011a47, 0x011a47, WB_Extend }, {0x011a50, 0x011a50, WB_ALetter }, {0x011a51, 0x011a5b, WB_Extend }, {0x011a5c, 0x011a89, WB_ALetter }, {0x011a8a, 0x011a99, WB_Extend }, {0x011a9d, 0x011a9d, WB_ALetter }, {0x011ab0, 0x011af8, WB_ALetter }, {0x011bc0, 0x011be0, WB_ALetter }, {0x011bf0, 0x011bf9, WB_Numeric }, {0x011c00, 0x011c08, WB_ALetter }, {0x011c0a, 0x011c2e, WB_ALetter }, {0x011c2f, 0x011c36, WB_Extend }, {0x011c38, 0x011c3f, WB_Extend }, {0x011c40, 0x011c40, WB_ALetter }, {0x011c50, 0x011c59, WB_Numeric }, {0x011c72, 0x011c8f, WB_ALetter }, {0x011c92, 0x011ca7, WB_Extend }, {0x011ca9, 0x011cb6, WB_Extend }, {0x011d00, 0x011d06, WB_ALetter }, {0x011d08, 0x011d09, WB_ALetter }, {0x011d0b, 0x011d30, WB_ALetter }, {0x011d31, 0x011d36, WB_Extend }, {0x011d3a, 0x011d3a, WB_Extend }, {0x011d3c, 0x011d3d, WB_Extend }, {0x011d3f, 0x011d45, WB_Extend }, {0x011d46, 0x011d46, WB_ALetter }, {0x011d47, 0x011d47, WB_Extend }, {0x011d50, 0x011d59, WB_Numeric }, {0x011d60, 0x011d65, WB_ALetter }, {0x011d67, 0x011d68, WB_ALetter }, {0x011d6a, 0x011d89, WB_ALetter }, {0x011d8a, 0x011d8e, WB_Extend }, {0x011d90, 0x011d91, WB_Extend }, {0x011d93, 0x011d97, WB_Extend }, {0x011d98, 0x011d98, WB_ALetter }, {0x011da0, 0x011da9, WB_Numeric }, {0x011ee0, 0x011ef2, WB_ALetter }, {0x011ef3, 0x011ef6, WB_Extend }, {0x011f00, 0x011f01, WB_Extend }, {0x011f02, 0x011f02, WB_ALetter }, {0x011f03, 0x011f03, WB_Extend }, {0x011f04, 0x011f10, WB_ALetter }, {0x011f12, 0x011f33, WB_ALetter }, {0x011f34, 0x011f3a, WB_Extend }, {0x011f3e, 0x011f42, WB_Extend }, {0x011f50, 0x011f59, WB_Numeric }, {0x011f5a, 0x011f5a, WB_Extend }, {0x011fb0, 0x011fb0, WB_ALetter }, {0x012000, 0x012399, WB_ALetter }, {0x012400, 0x01246e, WB_ALetter }, {0x012480, 0x012543, WB_ALetter }, {0x012f90, 0x012ff0, WB_ALetter }, {0x013000, 0x01342f, WB_ALetter }, {0x013430, 0x01343f, WB_Format }, {0x013440, 0x013440, WB_Extend }, {0x013441, 0x013446, WB_ALetter }, {0x013447, 0x013455, WB_Extend }, {0x013460, 0x0143fa, WB_ALetter }, {0x014400, 0x014646, WB_ALetter }, {0x016100, 0x01611d, WB_ALetter }, {0x01611e, 0x01612f, WB_Extend }, {0x016130, 0x016139, WB_Numeric }, {0x016800, 0x016a38, WB_ALetter }, {0x016a40, 0x016a5e, WB_ALetter }, {0x016a60, 0x016a69, WB_Numeric }, {0x016a70, 0x016abe, WB_ALetter }, {0x016ac0, 0x016ac9, WB_Numeric }, {0x016ad0, 0x016aed, WB_ALetter }, {0x016af0, 0x016af4, WB_Extend }, {0x016b00, 0x016b2f, WB_ALetter }, {0x016b30, 0x016b36, WB_Extend }, {0x016b40, 0x016b43, WB_ALetter }, {0x016b50, 0x016b59, WB_Numeric }, {0x016b63, 0x016b77, WB_ALetter }, {0x016b7d, 0x016b8f, WB_ALetter }, {0x016d40, 0x016d6c, WB_ALetter }, {0x016d70, 0x016d79, WB_Numeric }, {0x016e40, 0x016e7f, WB_ALetter }, {0x016f00, 0x016f4a, WB_ALetter }, {0x016f4f, 0x016f4f, WB_Extend }, {0x016f50, 0x016f50, WB_ALetter }, {0x016f51, 0x016f87, WB_Extend }, {0x016f8f, 0x016f92, WB_Extend }, {0x016f93, 0x016f9f, WB_ALetter }, {0x016fe0, 0x016fe1, WB_ALetter }, {0x016fe3, 0x016fe3, WB_ALetter }, {0x016fe4, 0x016fe4, WB_Extend }, {0x016ff0, 0x016ff1, WB_Extend }, {0x01aff0, 0x01aff3, WB_Katakana }, {0x01aff5, 0x01affb, WB_Katakana }, {0x01affd, 0x01affe, WB_Katakana }, {0x01b000, 0x01b000, WB_Katakana }, {0x01b120, 0x01b122, WB_Katakana }, {0x01b155, 0x01b155, WB_Katakana }, {0x01b164, 0x01b167, WB_Katakana }, {0x01bc00, 0x01bc6a, WB_ALetter }, {0x01bc70, 0x01bc7c, WB_ALetter }, {0x01bc80, 0x01bc88, WB_ALetter }, {0x01bc90, 0x01bc99, WB_ALetter }, {0x01bc9d, 0x01bc9e, WB_Extend }, {0x01bca0, 0x01bca3, WB_Format }, {0x01ccf0, 0x01ccf9, WB_Numeric }, {0x01cf00, 0x01cf2d, WB_Extend }, {0x01cf30, 0x01cf46, WB_Extend }, {0x01d165, 0x01d169, WB_Extend }, {0x01d16d, 0x01d172, WB_Extend }, {0x01d173, 0x01d17a, WB_Format }, {0x01d17b, 0x01d182, WB_Extend }, {0x01d185, 0x01d18b, WB_Extend }, {0x01d1aa, 0x01d1ad, WB_Extend }, {0x01d242, 0x01d244, WB_Extend }, {0x01d400, 0x01d454, WB_ALetter }, {0x01d456, 0x01d49c, WB_ALetter }, {0x01d49e, 0x01d49f, WB_ALetter }, {0x01d4a2, 0x01d4a2, WB_ALetter }, {0x01d4a5, 0x01d4a6, WB_ALetter }, {0x01d4a9, 0x01d4ac, WB_ALetter }, {0x01d4ae, 0x01d4b9, WB_ALetter }, {0x01d4bb, 0x01d4bb, WB_ALetter }, {0x01d4bd, 0x01d4c3, WB_ALetter }, {0x01d4c5, 0x01d505, WB_ALetter }, {0x01d507, 0x01d50a, WB_ALetter }, {0x01d50d, 0x01d514, WB_ALetter }, {0x01d516, 0x01d51c, WB_ALetter }, {0x01d51e, 0x01d539, WB_ALetter }, {0x01d53b, 0x01d53e, WB_ALetter }, {0x01d540, 0x01d544, WB_ALetter }, {0x01d546, 0x01d546, WB_ALetter }, {0x01d54a, 0x01d550, WB_ALetter }, {0x01d552, 0x01d6a5, WB_ALetter }, {0x01d6a8, 0x01d6c0, WB_ALetter }, {0x01d6c2, 0x01d6da, WB_ALetter }, {0x01d6dc, 0x01d6fa, WB_ALetter }, {0x01d6fc, 0x01d714, WB_ALetter }, {0x01d716, 0x01d734, WB_ALetter }, {0x01d736, 0x01d74e, WB_ALetter }, {0x01d750, 0x01d76e, WB_ALetter }, {0x01d770, 0x01d788, WB_ALetter }, {0x01d78a, 0x01d7a8, WB_ALetter }, {0x01d7aa, 0x01d7c2, WB_ALetter }, {0x01d7c4, 0x01d7cb, WB_ALetter }, {0x01d7ce, 0x01d7ff, WB_Numeric }, {0x01da00, 0x01da36, WB_Extend }, {0x01da3b, 0x01da6c, WB_Extend }, {0x01da75, 0x01da75, WB_Extend }, {0x01da84, 0x01da84, WB_Extend }, {0x01da9b, 0x01da9f, WB_Extend }, {0x01daa1, 0x01daaf, WB_Extend }, {0x01df00, 0x01df1e, WB_ALetter }, {0x01df25, 0x01df2a, WB_ALetter }, {0x01e000, 0x01e006, WB_Extend }, {0x01e008, 0x01e018, WB_Extend }, {0x01e01b, 0x01e021, WB_Extend }, {0x01e023, 0x01e024, WB_Extend }, {0x01e026, 0x01e02a, WB_Extend }, {0x01e030, 0x01e06d, WB_ALetter }, {0x01e08f, 0x01e08f, WB_Extend }, {0x01e100, 0x01e12c, WB_ALetter }, {0x01e130, 0x01e136, WB_Extend }, {0x01e137, 0x01e13d, WB_ALetter }, {0x01e140, 0x01e149, WB_Numeric }, {0x01e14e, 0x01e14e, WB_ALetter }, {0x01e290, 0x01e2ad, WB_ALetter }, {0x01e2ae, 0x01e2ae, WB_Extend }, {0x01e2c0, 0x01e2eb, WB_ALetter }, {0x01e2ec, 0x01e2ef, WB_Extend }, {0x01e2f0, 0x01e2f9, WB_Numeric }, {0x01e4d0, 0x01e4eb, WB_ALetter }, {0x01e4ec, 0x01e4ef, WB_Extend }, {0x01e4f0, 0x01e4f9, WB_Numeric }, {0x01e5d0, 0x01e5ed, WB_ALetter }, {0x01e5ee, 0x01e5ef, WB_Extend }, {0x01e5f0, 0x01e5f0, WB_ALetter }, {0x01e5f1, 0x01e5fa, WB_Numeric }, {0x01e7e0, 0x01e7e6, WB_ALetter }, {0x01e7e8, 0x01e7eb, WB_ALetter }, {0x01e7ed, 0x01e7ee, WB_ALetter }, {0x01e7f0, 0x01e7fe, WB_ALetter }, {0x01e800, 0x01e8c4, WB_ALetter }, {0x01e8d0, 0x01e8d6, WB_Extend }, {0x01e900, 0x01e943, WB_ALetter }, {0x01e944, 0x01e94a, WB_Extend }, {0x01e94b, 0x01e94b, WB_ALetter }, {0x01e950, 0x01e959, WB_Numeric }, {0x01ee00, 0x01ee03, WB_ALetter }, {0x01ee05, 0x01ee1f, WB_ALetter }, {0x01ee21, 0x01ee22, WB_ALetter }, {0x01ee24, 0x01ee24, WB_ALetter }, {0x01ee27, 0x01ee27, WB_ALetter }, {0x01ee29, 0x01ee32, WB_ALetter }, {0x01ee34, 0x01ee37, WB_ALetter }, {0x01ee39, 0x01ee39, WB_ALetter }, {0x01ee3b, 0x01ee3b, WB_ALetter }, {0x01ee42, 0x01ee42, WB_ALetter }, {0x01ee47, 0x01ee47, WB_ALetter }, {0x01ee49, 0x01ee49, WB_ALetter }, {0x01ee4b, 0x01ee4b, WB_ALetter }, {0x01ee4d, 0x01ee4f, WB_ALetter }, {0x01ee51, 0x01ee52, WB_ALetter }, {0x01ee54, 0x01ee54, WB_ALetter }, {0x01ee57, 0x01ee57, WB_ALetter }, {0x01ee59, 0x01ee59, WB_ALetter }, {0x01ee5b, 0x01ee5b, WB_ALetter }, {0x01ee5d, 0x01ee5d, WB_ALetter }, {0x01ee5f, 0x01ee5f, WB_ALetter }, {0x01ee61, 0x01ee62, WB_ALetter }, {0x01ee64, 0x01ee64, WB_ALetter }, {0x01ee67, 0x01ee6a, WB_ALetter }, {0x01ee6c, 0x01ee72, WB_ALetter }, {0x01ee74, 0x01ee77, WB_ALetter }, {0x01ee79, 0x01ee7c, WB_ALetter }, {0x01ee7e, 0x01ee7e, WB_ALetter }, {0x01ee80, 0x01ee89, WB_ALetter }, {0x01ee8b, 0x01ee9b, WB_ALetter }, {0x01eea1, 0x01eea3, WB_ALetter }, {0x01eea5, 0x01eea9, WB_ALetter }, {0x01eeab, 0x01eebb, WB_ALetter }, {0x01f130, 0x01f149, WB_ALetter }, {0x01f150, 0x01f169, WB_ALetter }, {0x01f170, 0x01f189, WB_ALetter }, {0x01f1e6, 0x01f1ff, WB_Regional_Indicator }, {0x01f3fb, 0x01f3ff, WB_Extend }, {0x01fbf0, 0x01fbf9, WB_Numeric }, {0x0e0001, 0x0e0001, WB_Format }, {0x0e0020, 0x0e007f, WB_Extend }, {0x0e0100, 0x0e01ef, WB_Extend } }; jq-1.8.2/vendor/oniguruma/src/unicode_property_data_posix.c0000644000175100017510000031755615215513537017712 /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -T -C -c -t -j1 -L ANSI-C --ignore-case --pic -Q unicode_prop_name_pool -N unicode_lookup_property_name --output-file gperf2.tmp unicode_property_data_posix.gperf */ /* Computed positions: -k'1,3' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif /* Generated by make_unicode_property_data.py. */ /*- * Copyright (c) 2016-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ /* PROPERTY: 'NEWLINE': POSIX [[:NEWLINE:]] */ static const OnigCodePoint CR_NEWLINE[] = { 1, 0x000a, 0x000a, }; /* END of CR_NEWLINE */ /* PROPERTY: 'Alpha': POSIX [[:Alpha:]] */ static const OnigCodePoint CR_Alpha[] = { 757, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0345, 0x0345, 0x0363, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x05b0, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0657, 0x0659, 0x065f, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06e1, 0x06e8, 0x06ed, 0x06ef, 0x06fa, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x073f, 0x074d, 0x07b1, 0x07ca, 0x07ea, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x0800, 0x0817, 0x081a, 0x082c, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x0897, 0x08a0, 0x08c9, 0x08d4, 0x08df, 0x08e3, 0x08e9, 0x08f0, 0x093b, 0x093d, 0x094c, 0x094e, 0x0950, 0x0955, 0x0963, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09cc, 0x09ce, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09f0, 0x09f1, 0x09fc, 0x09fc, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4c, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a70, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acc, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0af9, 0x0afc, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4c, 0x0b56, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcc, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4c, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccc, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4c, 0x0d4e, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e46, 0x0e4d, 0x0e4d, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb9, 0x0ebb, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ecd, 0x0ecd, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f83, 0x0f88, 0x0f97, 0x0f99, 0x0fbc, 0x1000, 0x1036, 0x1038, 0x1038, 0x103b, 0x103f, 0x1050, 0x108f, 0x109a, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1713, 0x171f, 0x1733, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17b3, 0x17b6, 0x17c8, 0x17d7, 0x17d7, 0x17dc, 0x17dc, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x1938, 0x1950, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a61, 0x1a74, 0x1aa7, 0x1aa7, 0x1abf, 0x1ac0, 0x1acc, 0x1ace, 0x1b00, 0x1b33, 0x1b35, 0x1b43, 0x1b45, 0x1b4c, 0x1b80, 0x1ba9, 0x1bac, 0x1baf, 0x1bba, 0x1be5, 0x1be7, 0x1bf1, 0x1c00, 0x1c36, 0x1c4d, 0x1c4f, 0x1c5a, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1dd3, 0x1df4, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x24b6, 0x24e9, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x2e2f, 0x2e2f, 0x3005, 0x3007, 0x3021, 0x3029, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa61f, 0xa62a, 0xa62b, 0xa640, 0xa66e, 0xa674, 0xa67b, 0xa67f, 0xa6ef, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa805, 0xa807, 0xa827, 0xa840, 0xa873, 0xa880, 0xa8c3, 0xa8c5, 0xa8c5, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa8ff, 0xa90a, 0xa92a, 0xa930, 0xa952, 0xa960, 0xa97c, 0xa980, 0xa9b2, 0xa9b4, 0xa9bf, 0xa9cf, 0xa9cf, 0xa9e0, 0xa9ef, 0xa9fa, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa60, 0xaa76, 0xaa7a, 0xaabe, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf5, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff21, 0xff3a, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d4a, 0x10d65, 0x10d69, 0x10d69, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10efc, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11045, 0x11071, 0x11075, 0x11080, 0x110b8, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x11100, 0x11132, 0x11144, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11180, 0x111bf, 0x111c1, 0x111c4, 0x111ce, 0x111cf, 0x111da, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11234, 0x11237, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112e8, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134c, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113cd, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11441, 0x11443, 0x11445, 0x11447, 0x1144a, 0x1145f, 0x11461, 0x11480, 0x114c1, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x11580, 0x115b5, 0x115b8, 0x115be, 0x115d8, 0x115dd, 0x11600, 0x1163e, 0x11640, 0x11640, 0x11644, 0x11644, 0x11680, 0x116b5, 0x116b8, 0x116b8, 0x11700, 0x1171a, 0x1171d, 0x1172a, 0x11740, 0x11746, 0x11800, 0x11838, 0x118a0, 0x118df, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x1193c, 0x1193f, 0x11942, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119df, 0x119e1, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a32, 0x11a35, 0x11a3e, 0x11a50, 0x11a97, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c3e, 0x11c40, 0x11c40, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d41, 0x11d43, 0x11d43, 0x11d46, 0x11d47, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d96, 0x11d98, 0x11d98, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f40, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1612e, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a70, 0x16abe, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b40, 0x16b43, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9e, 0x1bc9e, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e4d0, 0x1e4eb, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5f0, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e900, 0x1e943, 0x1e947, 0x1e947, 0x1e94b, 0x1e94b, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Alpha */ /* PROPERTY: 'Blank': POSIX [[:Blank:]] */ static const OnigCodePoint CR_Blank[] = { 8, 0x0009, 0x0009, 0x0020, 0x0020, 0x00a0, 0x00a0, 0x1680, 0x1680, 0x2000, 0x200a, 0x202f, 0x202f, 0x205f, 0x205f, 0x3000, 0x3000, }; /* END of CR_Blank */ /* PROPERTY: 'Cntrl': POSIX [[:Cntrl:]] */ static const OnigCodePoint CR_Cntrl[] = { 2, 0x0000, 0x001f, 0x007f, 0x009f, }; /* END of CR_Cntrl */ /* PROPERTY: 'Digit': POSIX [[:Digit:]] */ static const OnigCodePoint CR_Digit[] = { 71, 0x0030, 0x0039, 0x0660, 0x0669, 0x06f0, 0x06f9, 0x07c0, 0x07c9, 0x0966, 0x096f, 0x09e6, 0x09ef, 0x0a66, 0x0a6f, 0x0ae6, 0x0aef, 0x0b66, 0x0b6f, 0x0be6, 0x0bef, 0x0c66, 0x0c6f, 0x0ce6, 0x0cef, 0x0d66, 0x0d6f, 0x0de6, 0x0def, 0x0e50, 0x0e59, 0x0ed0, 0x0ed9, 0x0f20, 0x0f29, 0x1040, 0x1049, 0x1090, 0x1099, 0x17e0, 0x17e9, 0x1810, 0x1819, 0x1946, 0x194f, 0x19d0, 0x19d9, 0x1a80, 0x1a89, 0x1a90, 0x1a99, 0x1b50, 0x1b59, 0x1bb0, 0x1bb9, 0x1c40, 0x1c49, 0x1c50, 0x1c59, 0xa620, 0xa629, 0xa8d0, 0xa8d9, 0xa900, 0xa909, 0xa9d0, 0xa9d9, 0xa9f0, 0xa9f9, 0xaa50, 0xaa59, 0xabf0, 0xabf9, 0xff10, 0xff19, 0x104a0, 0x104a9, 0x10d30, 0x10d39, 0x10d40, 0x10d49, 0x11066, 0x1106f, 0x110f0, 0x110f9, 0x11136, 0x1113f, 0x111d0, 0x111d9, 0x112f0, 0x112f9, 0x11450, 0x11459, 0x114d0, 0x114d9, 0x11650, 0x11659, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11730, 0x11739, 0x118e0, 0x118e9, 0x11950, 0x11959, 0x11bf0, 0x11bf9, 0x11c50, 0x11c59, 0x11d50, 0x11d59, 0x11da0, 0x11da9, 0x11f50, 0x11f59, 0x16130, 0x16139, 0x16a60, 0x16a69, 0x16ac0, 0x16ac9, 0x16b50, 0x16b59, 0x16d70, 0x16d79, 0x1ccf0, 0x1ccf9, 0x1d7ce, 0x1d7ff, 0x1e140, 0x1e149, 0x1e2f0, 0x1e2f9, 0x1e4f0, 0x1e4f9, 0x1e5f1, 0x1e5fa, 0x1e950, 0x1e959, 0x1fbf0, 0x1fbf9, }; /* END of CR_Digit */ /* PROPERTY: 'Graph': POSIX [[:Graph:]] */ static const OnigCodePoint CR_Graph[] = { 737, 0x0021, 0x007e, 0x00a1, 0x0377, 0x037a, 0x037f, 0x0384, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x052f, 0x0531, 0x0556, 0x0559, 0x058a, 0x058d, 0x058f, 0x0591, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f4, 0x0600, 0x070d, 0x070f, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07fa, 0x07fd, 0x082d, 0x0830, 0x083e, 0x0840, 0x085b, 0x085e, 0x085e, 0x0860, 0x086a, 0x0870, 0x088e, 0x0890, 0x0891, 0x0897, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a76, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0af1, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b77, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bfa, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c77, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4f, 0x0d54, 0x0d63, 0x0d66, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df4, 0x0e01, 0x0e3a, 0x0e3f, 0x0e5b, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f97, 0x0f99, 0x0fbc, 0x0fbe, 0x0fcc, 0x0fce, 0x0fda, 0x1000, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x137c, 0x1380, 0x1399, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1400, 0x167f, 0x1681, 0x169c, 0x16a0, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1736, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17dd, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x1800, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1940, 0x1940, 0x1944, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x19de, 0x1a1b, 0x1a1e, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa0, 0x1aad, 0x1ab0, 0x1ace, 0x1b00, 0x1b4c, 0x1b4e, 0x1bf3, 0x1bfc, 0x1c37, 0x1c3b, 0x1c49, 0x1c4d, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cc7, 0x1cd0, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fc4, 0x1fc6, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fdd, 0x1fef, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffe, 0x200b, 0x2027, 0x202a, 0x202e, 0x2030, 0x205e, 0x2060, 0x2064, 0x2066, 0x2071, 0x2074, 0x208e, 0x2090, 0x209c, 0x20a0, 0x20c0, 0x20d0, 0x20f0, 0x2100, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x2460, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2cf3, 0x2cf9, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d70, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x2fff, 0x3001, 0x303f, 0x3041, 0x3096, 0x3099, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x3190, 0x31e5, 0x31ef, 0x321e, 0x3220, 0xa48c, 0xa490, 0xa4c6, 0xa4d0, 0xa62b, 0xa640, 0xa6f7, 0xa700, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa82c, 0xa830, 0xa839, 0xa840, 0xa877, 0xa880, 0xa8c5, 0xa8ce, 0xa8d9, 0xa8e0, 0xa953, 0xa95f, 0xa97c, 0xa980, 0xa9cd, 0xa9cf, 0xa9d9, 0xa9de, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa5c, 0xaac2, 0xaadb, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab6b, 0xab70, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xe000, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbc2, 0xfbd3, 0xfd8f, 0xfd92, 0xfdc7, 0xfdcf, 0xfdcf, 0xfdf0, 0xfe19, 0xfe20, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xfeff, 0xfeff, 0xff01, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfff9, 0xfffd, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10100, 0x10102, 0x10107, 0x10133, 0x10137, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102fb, 0x10300, 0x10323, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x1039f, 0x103c3, 0x103c8, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x1056f, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10857, 0x1089e, 0x108a7, 0x108af, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x108fb, 0x1091b, 0x1091f, 0x10939, 0x1093f, 0x1093f, 0x10980, 0x109b7, 0x109bc, 0x109cf, 0x109d2, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a48, 0x10a50, 0x10a58, 0x10a60, 0x10a9f, 0x10ac0, 0x10ae6, 0x10aeb, 0x10af6, 0x10b00, 0x10b35, 0x10b39, 0x10b55, 0x10b58, 0x10b72, 0x10b78, 0x10b91, 0x10b99, 0x10b9c, 0x10ba9, 0x10baf, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10cfa, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d85, 0x10d8e, 0x10d8f, 0x10e60, 0x10e7e, 0x10e80, 0x10ea9, 0x10eab, 0x10ead, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f27, 0x10f30, 0x10f59, 0x10f70, 0x10f89, 0x10fb0, 0x10fcb, 0x10fe0, 0x10ff6, 0x11000, 0x1104d, 0x11052, 0x11075, 0x1107f, 0x110c2, 0x110cd, 0x110cd, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x11147, 0x11150, 0x11176, 0x11180, 0x111df, 0x111e1, 0x111f4, 0x11200, 0x11211, 0x11213, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a9, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d5, 0x113d7, 0x113d8, 0x113e1, 0x113e2, 0x11400, 0x1145b, 0x1145d, 0x11461, 0x11480, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115dd, 0x11600, 0x11644, 0x11650, 0x11659, 0x11660, 0x1166c, 0x11680, 0x116b9, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11746, 0x11800, 0x1183b, 0x118a0, 0x118f2, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11946, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e4, 0x11a00, 0x11a47, 0x11a50, 0x11aa2, 0x11ab0, 0x11af8, 0x11b00, 0x11b09, 0x11bc0, 0x11be1, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c45, 0x11c50, 0x11c6c, 0x11c70, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef8, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f5a, 0x11fb0, 0x11fb0, 0x11fc0, 0x11ff1, 0x11fff, 0x12399, 0x12400, 0x1246e, 0x12470, 0x12474, 0x12480, 0x12543, 0x12f90, 0x12ff2, 0x13000, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a6e, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af5, 0x16b00, 0x16b45, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d79, 0x16e40, 0x16e9a, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9c, 0x1bca3, 0x1cc00, 0x1ccf9, 0x1cd00, 0x1ceb3, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d1ea, 0x1d200, 0x1d245, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d300, 0x1d356, 0x1d360, 0x1d378, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1da8b, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14f, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e2ff, 0x1e2ff, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e5ff, 0x1e5ff, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8c7, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1e95e, 0x1e95f, 0x1ec71, 0x1ecb4, 0x1ed01, 0x1ed3d, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f100, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0001, 0xe0001, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, 0xf0000, 0xffffd, 0x100000, 0x10fffd, }; /* END of CR_Graph */ /* PROPERTY: 'Lower': POSIX [[:Lower:]] */ static const OnigCodePoint CR_Lower[] = { 675, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00df, 0x00f6, 0x00f8, 0x00ff, 0x0101, 0x0101, 0x0103, 0x0103, 0x0105, 0x0105, 0x0107, 0x0107, 0x0109, 0x0109, 0x010b, 0x010b, 0x010d, 0x010d, 0x010f, 0x010f, 0x0111, 0x0111, 0x0113, 0x0113, 0x0115, 0x0115, 0x0117, 0x0117, 0x0119, 0x0119, 0x011b, 0x011b, 0x011d, 0x011d, 0x011f, 0x011f, 0x0121, 0x0121, 0x0123, 0x0123, 0x0125, 0x0125, 0x0127, 0x0127, 0x0129, 0x0129, 0x012b, 0x012b, 0x012d, 0x012d, 0x012f, 0x012f, 0x0131, 0x0131, 0x0133, 0x0133, 0x0135, 0x0135, 0x0137, 0x0138, 0x013a, 0x013a, 0x013c, 0x013c, 0x013e, 0x013e, 0x0140, 0x0140, 0x0142, 0x0142, 0x0144, 0x0144, 0x0146, 0x0146, 0x0148, 0x0149, 0x014b, 0x014b, 0x014d, 0x014d, 0x014f, 0x014f, 0x0151, 0x0151, 0x0153, 0x0153, 0x0155, 0x0155, 0x0157, 0x0157, 0x0159, 0x0159, 0x015b, 0x015b, 0x015d, 0x015d, 0x015f, 0x015f, 0x0161, 0x0161, 0x0163, 0x0163, 0x0165, 0x0165, 0x0167, 0x0167, 0x0169, 0x0169, 0x016b, 0x016b, 0x016d, 0x016d, 0x016f, 0x016f, 0x0171, 0x0171, 0x0173, 0x0173, 0x0175, 0x0175, 0x0177, 0x0177, 0x017a, 0x017a, 0x017c, 0x017c, 0x017e, 0x0180, 0x0183, 0x0183, 0x0185, 0x0185, 0x0188, 0x0188, 0x018c, 0x018d, 0x0192, 0x0192, 0x0195, 0x0195, 0x0199, 0x019b, 0x019e, 0x019e, 0x01a1, 0x01a1, 0x01a3, 0x01a3, 0x01a5, 0x01a5, 0x01a8, 0x01a8, 0x01aa, 0x01ab, 0x01ad, 0x01ad, 0x01b0, 0x01b0, 0x01b4, 0x01b4, 0x01b6, 0x01b6, 0x01b9, 0x01ba, 0x01bd, 0x01bf, 0x01c6, 0x01c6, 0x01c9, 0x01c9, 0x01cc, 0x01cc, 0x01ce, 0x01ce, 0x01d0, 0x01d0, 0x01d2, 0x01d2, 0x01d4, 0x01d4, 0x01d6, 0x01d6, 0x01d8, 0x01d8, 0x01da, 0x01da, 0x01dc, 0x01dd, 0x01df, 0x01df, 0x01e1, 0x01e1, 0x01e3, 0x01e3, 0x01e5, 0x01e5, 0x01e7, 0x01e7, 0x01e9, 0x01e9, 0x01eb, 0x01eb, 0x01ed, 0x01ed, 0x01ef, 0x01f0, 0x01f3, 0x01f3, 0x01f5, 0x01f5, 0x01f9, 0x01f9, 0x01fb, 0x01fb, 0x01fd, 0x01fd, 0x01ff, 0x01ff, 0x0201, 0x0201, 0x0203, 0x0203, 0x0205, 0x0205, 0x0207, 0x0207, 0x0209, 0x0209, 0x020b, 0x020b, 0x020d, 0x020d, 0x020f, 0x020f, 0x0211, 0x0211, 0x0213, 0x0213, 0x0215, 0x0215, 0x0217, 0x0217, 0x0219, 0x0219, 0x021b, 0x021b, 0x021d, 0x021d, 0x021f, 0x021f, 0x0221, 0x0221, 0x0223, 0x0223, 0x0225, 0x0225, 0x0227, 0x0227, 0x0229, 0x0229, 0x022b, 0x022b, 0x022d, 0x022d, 0x022f, 0x022f, 0x0231, 0x0231, 0x0233, 0x0239, 0x023c, 0x023c, 0x023f, 0x0240, 0x0242, 0x0242, 0x0247, 0x0247, 0x0249, 0x0249, 0x024b, 0x024b, 0x024d, 0x024d, 0x024f, 0x0293, 0x0295, 0x02b8, 0x02c0, 0x02c1, 0x02e0, 0x02e4, 0x0345, 0x0345, 0x0371, 0x0371, 0x0373, 0x0373, 0x0377, 0x0377, 0x037a, 0x037d, 0x0390, 0x0390, 0x03ac, 0x03ce, 0x03d0, 0x03d1, 0x03d5, 0x03d7, 0x03d9, 0x03d9, 0x03db, 0x03db, 0x03dd, 0x03dd, 0x03df, 0x03df, 0x03e1, 0x03e1, 0x03e3, 0x03e3, 0x03e5, 0x03e5, 0x03e7, 0x03e7, 0x03e9, 0x03e9, 0x03eb, 0x03eb, 0x03ed, 0x03ed, 0x03ef, 0x03f3, 0x03f5, 0x03f5, 0x03f8, 0x03f8, 0x03fb, 0x03fc, 0x0430, 0x045f, 0x0461, 0x0461, 0x0463, 0x0463, 0x0465, 0x0465, 0x0467, 0x0467, 0x0469, 0x0469, 0x046b, 0x046b, 0x046d, 0x046d, 0x046f, 0x046f, 0x0471, 0x0471, 0x0473, 0x0473, 0x0475, 0x0475, 0x0477, 0x0477, 0x0479, 0x0479, 0x047b, 0x047b, 0x047d, 0x047d, 0x047f, 0x047f, 0x0481, 0x0481, 0x048b, 0x048b, 0x048d, 0x048d, 0x048f, 0x048f, 0x0491, 0x0491, 0x0493, 0x0493, 0x0495, 0x0495, 0x0497, 0x0497, 0x0499, 0x0499, 0x049b, 0x049b, 0x049d, 0x049d, 0x049f, 0x049f, 0x04a1, 0x04a1, 0x04a3, 0x04a3, 0x04a5, 0x04a5, 0x04a7, 0x04a7, 0x04a9, 0x04a9, 0x04ab, 0x04ab, 0x04ad, 0x04ad, 0x04af, 0x04af, 0x04b1, 0x04b1, 0x04b3, 0x04b3, 0x04b5, 0x04b5, 0x04b7, 0x04b7, 0x04b9, 0x04b9, 0x04bb, 0x04bb, 0x04bd, 0x04bd, 0x04bf, 0x04bf, 0x04c2, 0x04c2, 0x04c4, 0x04c4, 0x04c6, 0x04c6, 0x04c8, 0x04c8, 0x04ca, 0x04ca, 0x04cc, 0x04cc, 0x04ce, 0x04cf, 0x04d1, 0x04d1, 0x04d3, 0x04d3, 0x04d5, 0x04d5, 0x04d7, 0x04d7, 0x04d9, 0x04d9, 0x04db, 0x04db, 0x04dd, 0x04dd, 0x04df, 0x04df, 0x04e1, 0x04e1, 0x04e3, 0x04e3, 0x04e5, 0x04e5, 0x04e7, 0x04e7, 0x04e9, 0x04e9, 0x04eb, 0x04eb, 0x04ed, 0x04ed, 0x04ef, 0x04ef, 0x04f1, 0x04f1, 0x04f3, 0x04f3, 0x04f5, 0x04f5, 0x04f7, 0x04f7, 0x04f9, 0x04f9, 0x04fb, 0x04fb, 0x04fd, 0x04fd, 0x04ff, 0x04ff, 0x0501, 0x0501, 0x0503, 0x0503, 0x0505, 0x0505, 0x0507, 0x0507, 0x0509, 0x0509, 0x050b, 0x050b, 0x050d, 0x050d, 0x050f, 0x050f, 0x0511, 0x0511, 0x0513, 0x0513, 0x0515, 0x0515, 0x0517, 0x0517, 0x0519, 0x0519, 0x051b, 0x051b, 0x051d, 0x051d, 0x051f, 0x051f, 0x0521, 0x0521, 0x0523, 0x0523, 0x0525, 0x0525, 0x0527, 0x0527, 0x0529, 0x0529, 0x052b, 0x052b, 0x052d, 0x052d, 0x052f, 0x052f, 0x0560, 0x0588, 0x10d0, 0x10fa, 0x10fc, 0x10ff, 0x13f8, 0x13fd, 0x1c80, 0x1c88, 0x1c8a, 0x1c8a, 0x1d00, 0x1dbf, 0x1e01, 0x1e01, 0x1e03, 0x1e03, 0x1e05, 0x1e05, 0x1e07, 0x1e07, 0x1e09, 0x1e09, 0x1e0b, 0x1e0b, 0x1e0d, 0x1e0d, 0x1e0f, 0x1e0f, 0x1e11, 0x1e11, 0x1e13, 0x1e13, 0x1e15, 0x1e15, 0x1e17, 0x1e17, 0x1e19, 0x1e19, 0x1e1b, 0x1e1b, 0x1e1d, 0x1e1d, 0x1e1f, 0x1e1f, 0x1e21, 0x1e21, 0x1e23, 0x1e23, 0x1e25, 0x1e25, 0x1e27, 0x1e27, 0x1e29, 0x1e29, 0x1e2b, 0x1e2b, 0x1e2d, 0x1e2d, 0x1e2f, 0x1e2f, 0x1e31, 0x1e31, 0x1e33, 0x1e33, 0x1e35, 0x1e35, 0x1e37, 0x1e37, 0x1e39, 0x1e39, 0x1e3b, 0x1e3b, 0x1e3d, 0x1e3d, 0x1e3f, 0x1e3f, 0x1e41, 0x1e41, 0x1e43, 0x1e43, 0x1e45, 0x1e45, 0x1e47, 0x1e47, 0x1e49, 0x1e49, 0x1e4b, 0x1e4b, 0x1e4d, 0x1e4d, 0x1e4f, 0x1e4f, 0x1e51, 0x1e51, 0x1e53, 0x1e53, 0x1e55, 0x1e55, 0x1e57, 0x1e57, 0x1e59, 0x1e59, 0x1e5b, 0x1e5b, 0x1e5d, 0x1e5d, 0x1e5f, 0x1e5f, 0x1e61, 0x1e61, 0x1e63, 0x1e63, 0x1e65, 0x1e65, 0x1e67, 0x1e67, 0x1e69, 0x1e69, 0x1e6b, 0x1e6b, 0x1e6d, 0x1e6d, 0x1e6f, 0x1e6f, 0x1e71, 0x1e71, 0x1e73, 0x1e73, 0x1e75, 0x1e75, 0x1e77, 0x1e77, 0x1e79, 0x1e79, 0x1e7b, 0x1e7b, 0x1e7d, 0x1e7d, 0x1e7f, 0x1e7f, 0x1e81, 0x1e81, 0x1e83, 0x1e83, 0x1e85, 0x1e85, 0x1e87, 0x1e87, 0x1e89, 0x1e89, 0x1e8b, 0x1e8b, 0x1e8d, 0x1e8d, 0x1e8f, 0x1e8f, 0x1e91, 0x1e91, 0x1e93, 0x1e93, 0x1e95, 0x1e9d, 0x1e9f, 0x1e9f, 0x1ea1, 0x1ea1, 0x1ea3, 0x1ea3, 0x1ea5, 0x1ea5, 0x1ea7, 0x1ea7, 0x1ea9, 0x1ea9, 0x1eab, 0x1eab, 0x1ead, 0x1ead, 0x1eaf, 0x1eaf, 0x1eb1, 0x1eb1, 0x1eb3, 0x1eb3, 0x1eb5, 0x1eb5, 0x1eb7, 0x1eb7, 0x1eb9, 0x1eb9, 0x1ebb, 0x1ebb, 0x1ebd, 0x1ebd, 0x1ebf, 0x1ebf, 0x1ec1, 0x1ec1, 0x1ec3, 0x1ec3, 0x1ec5, 0x1ec5, 0x1ec7, 0x1ec7, 0x1ec9, 0x1ec9, 0x1ecb, 0x1ecb, 0x1ecd, 0x1ecd, 0x1ecf, 0x1ecf, 0x1ed1, 0x1ed1, 0x1ed3, 0x1ed3, 0x1ed5, 0x1ed5, 0x1ed7, 0x1ed7, 0x1ed9, 0x1ed9, 0x1edb, 0x1edb, 0x1edd, 0x1edd, 0x1edf, 0x1edf, 0x1ee1, 0x1ee1, 0x1ee3, 0x1ee3, 0x1ee5, 0x1ee5, 0x1ee7, 0x1ee7, 0x1ee9, 0x1ee9, 0x1eeb, 0x1eeb, 0x1eed, 0x1eed, 0x1eef, 0x1eef, 0x1ef1, 0x1ef1, 0x1ef3, 0x1ef3, 0x1ef5, 0x1ef5, 0x1ef7, 0x1ef7, 0x1ef9, 0x1ef9, 0x1efb, 0x1efb, 0x1efd, 0x1efd, 0x1eff, 0x1f07, 0x1f10, 0x1f15, 0x1f20, 0x1f27, 0x1f30, 0x1f37, 0x1f40, 0x1f45, 0x1f50, 0x1f57, 0x1f60, 0x1f67, 0x1f70, 0x1f7d, 0x1f80, 0x1f87, 0x1f90, 0x1f97, 0x1fa0, 0x1fa7, 0x1fb0, 0x1fb4, 0x1fb6, 0x1fb7, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fc7, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fd7, 0x1fe0, 0x1fe7, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ff7, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x210a, 0x210a, 0x210e, 0x210f, 0x2113, 0x2113, 0x212f, 0x212f, 0x2134, 0x2134, 0x2139, 0x2139, 0x213c, 0x213d, 0x2146, 0x2149, 0x214e, 0x214e, 0x2170, 0x217f, 0x2184, 0x2184, 0x24d0, 0x24e9, 0x2c30, 0x2c5f, 0x2c61, 0x2c61, 0x2c65, 0x2c66, 0x2c68, 0x2c68, 0x2c6a, 0x2c6a, 0x2c6c, 0x2c6c, 0x2c71, 0x2c71, 0x2c73, 0x2c74, 0x2c76, 0x2c7d, 0x2c81, 0x2c81, 0x2c83, 0x2c83, 0x2c85, 0x2c85, 0x2c87, 0x2c87, 0x2c89, 0x2c89, 0x2c8b, 0x2c8b, 0x2c8d, 0x2c8d, 0x2c8f, 0x2c8f, 0x2c91, 0x2c91, 0x2c93, 0x2c93, 0x2c95, 0x2c95, 0x2c97, 0x2c97, 0x2c99, 0x2c99, 0x2c9b, 0x2c9b, 0x2c9d, 0x2c9d, 0x2c9f, 0x2c9f, 0x2ca1, 0x2ca1, 0x2ca3, 0x2ca3, 0x2ca5, 0x2ca5, 0x2ca7, 0x2ca7, 0x2ca9, 0x2ca9, 0x2cab, 0x2cab, 0x2cad, 0x2cad, 0x2caf, 0x2caf, 0x2cb1, 0x2cb1, 0x2cb3, 0x2cb3, 0x2cb5, 0x2cb5, 0x2cb7, 0x2cb7, 0x2cb9, 0x2cb9, 0x2cbb, 0x2cbb, 0x2cbd, 0x2cbd, 0x2cbf, 0x2cbf, 0x2cc1, 0x2cc1, 0x2cc3, 0x2cc3, 0x2cc5, 0x2cc5, 0x2cc7, 0x2cc7, 0x2cc9, 0x2cc9, 0x2ccb, 0x2ccb, 0x2ccd, 0x2ccd, 0x2ccf, 0x2ccf, 0x2cd1, 0x2cd1, 0x2cd3, 0x2cd3, 0x2cd5, 0x2cd5, 0x2cd7, 0x2cd7, 0x2cd9, 0x2cd9, 0x2cdb, 0x2cdb, 0x2cdd, 0x2cdd, 0x2cdf, 0x2cdf, 0x2ce1, 0x2ce1, 0x2ce3, 0x2ce4, 0x2cec, 0x2cec, 0x2cee, 0x2cee, 0x2cf3, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0xa641, 0xa641, 0xa643, 0xa643, 0xa645, 0xa645, 0xa647, 0xa647, 0xa649, 0xa649, 0xa64b, 0xa64b, 0xa64d, 0xa64d, 0xa64f, 0xa64f, 0xa651, 0xa651, 0xa653, 0xa653, 0xa655, 0xa655, 0xa657, 0xa657, 0xa659, 0xa659, 0xa65b, 0xa65b, 0xa65d, 0xa65d, 0xa65f, 0xa65f, 0xa661, 0xa661, 0xa663, 0xa663, 0xa665, 0xa665, 0xa667, 0xa667, 0xa669, 0xa669, 0xa66b, 0xa66b, 0xa66d, 0xa66d, 0xa681, 0xa681, 0xa683, 0xa683, 0xa685, 0xa685, 0xa687, 0xa687, 0xa689, 0xa689, 0xa68b, 0xa68b, 0xa68d, 0xa68d, 0xa68f, 0xa68f, 0xa691, 0xa691, 0xa693, 0xa693, 0xa695, 0xa695, 0xa697, 0xa697, 0xa699, 0xa699, 0xa69b, 0xa69d, 0xa723, 0xa723, 0xa725, 0xa725, 0xa727, 0xa727, 0xa729, 0xa729, 0xa72b, 0xa72b, 0xa72d, 0xa72d, 0xa72f, 0xa731, 0xa733, 0xa733, 0xa735, 0xa735, 0xa737, 0xa737, 0xa739, 0xa739, 0xa73b, 0xa73b, 0xa73d, 0xa73d, 0xa73f, 0xa73f, 0xa741, 0xa741, 0xa743, 0xa743, 0xa745, 0xa745, 0xa747, 0xa747, 0xa749, 0xa749, 0xa74b, 0xa74b, 0xa74d, 0xa74d, 0xa74f, 0xa74f, 0xa751, 0xa751, 0xa753, 0xa753, 0xa755, 0xa755, 0xa757, 0xa757, 0xa759, 0xa759, 0xa75b, 0xa75b, 0xa75d, 0xa75d, 0xa75f, 0xa75f, 0xa761, 0xa761, 0xa763, 0xa763, 0xa765, 0xa765, 0xa767, 0xa767, 0xa769, 0xa769, 0xa76b, 0xa76b, 0xa76d, 0xa76d, 0xa76f, 0xa778, 0xa77a, 0xa77a, 0xa77c, 0xa77c, 0xa77f, 0xa77f, 0xa781, 0xa781, 0xa783, 0xa783, 0xa785, 0xa785, 0xa787, 0xa787, 0xa78c, 0xa78c, 0xa78e, 0xa78e, 0xa791, 0xa791, 0xa793, 0xa795, 0xa797, 0xa797, 0xa799, 0xa799, 0xa79b, 0xa79b, 0xa79d, 0xa79d, 0xa79f, 0xa79f, 0xa7a1, 0xa7a1, 0xa7a3, 0xa7a3, 0xa7a5, 0xa7a5, 0xa7a7, 0xa7a7, 0xa7a9, 0xa7a9, 0xa7af, 0xa7af, 0xa7b5, 0xa7b5, 0xa7b7, 0xa7b7, 0xa7b9, 0xa7b9, 0xa7bb, 0xa7bb, 0xa7bd, 0xa7bd, 0xa7bf, 0xa7bf, 0xa7c1, 0xa7c1, 0xa7c3, 0xa7c3, 0xa7c8, 0xa7c8, 0xa7ca, 0xa7ca, 0xa7cd, 0xa7cd, 0xa7d1, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7d5, 0xa7d7, 0xa7d7, 0xa7d9, 0xa7d9, 0xa7db, 0xa7db, 0xa7f2, 0xa7f4, 0xa7f6, 0xa7f6, 0xa7f8, 0xa7fa, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabbf, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xff41, 0xff5a, 0x10428, 0x1044f, 0x104d8, 0x104fb, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x10780, 0x10780, 0x10783, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10cc0, 0x10cf2, 0x10d70, 0x10d85, 0x118c0, 0x118df, 0x16e60, 0x16e7f, 0x1d41a, 0x1d433, 0x1d44e, 0x1d454, 0x1d456, 0x1d467, 0x1d482, 0x1d49b, 0x1d4b6, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d4cf, 0x1d4ea, 0x1d503, 0x1d51e, 0x1d537, 0x1d552, 0x1d56b, 0x1d586, 0x1d59f, 0x1d5ba, 0x1d5d3, 0x1d5ee, 0x1d607, 0x1d622, 0x1d63b, 0x1d656, 0x1d66f, 0x1d68a, 0x1d6a5, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6e1, 0x1d6fc, 0x1d714, 0x1d716, 0x1d71b, 0x1d736, 0x1d74e, 0x1d750, 0x1d755, 0x1d770, 0x1d788, 0x1d78a, 0x1d78f, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7c9, 0x1d7cb, 0x1d7cb, 0x1df00, 0x1df09, 0x1df0b, 0x1df1e, 0x1df25, 0x1df2a, 0x1e030, 0x1e06d, 0x1e922, 0x1e943, }; /* END of CR_Lower */ /* PROPERTY: 'Print': POSIX [[:Print:]] */ static const OnigCodePoint CR_Print[] = { 733, 0x0020, 0x007e, 0x00a0, 0x0377, 0x037a, 0x037f, 0x0384, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x052f, 0x0531, 0x0556, 0x0559, 0x058a, 0x058d, 0x058f, 0x0591, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f4, 0x0600, 0x070d, 0x070f, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07fa, 0x07fd, 0x082d, 0x0830, 0x083e, 0x0840, 0x085b, 0x085e, 0x085e, 0x0860, 0x086a, 0x0870, 0x088e, 0x0890, 0x0891, 0x0897, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a76, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0af1, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b77, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bfa, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c77, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4f, 0x0d54, 0x0d63, 0x0d66, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df4, 0x0e01, 0x0e3a, 0x0e3f, 0x0e5b, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f97, 0x0f99, 0x0fbc, 0x0fbe, 0x0fcc, 0x0fce, 0x0fda, 0x1000, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x137c, 0x1380, 0x1399, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1400, 0x169c, 0x16a0, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1736, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17dd, 0x17e0, 0x17e9, 0x17f0, 0x17f9, 0x1800, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1940, 0x1940, 0x1944, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19da, 0x19de, 0x1a1b, 0x1a1e, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa0, 0x1aad, 0x1ab0, 0x1ace, 0x1b00, 0x1b4c, 0x1b4e, 0x1bf3, 0x1bfc, 0x1c37, 0x1c3b, 0x1c49, 0x1c4d, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cc7, 0x1cd0, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fc4, 0x1fc6, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fdd, 0x1fef, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffe, 0x2000, 0x2027, 0x202a, 0x2064, 0x2066, 0x2071, 0x2074, 0x208e, 0x2090, 0x209c, 0x20a0, 0x20c0, 0x20d0, 0x20f0, 0x2100, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x2460, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2cf3, 0x2cf9, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d70, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x303f, 0x3041, 0x3096, 0x3099, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x3190, 0x31e5, 0x31ef, 0x321e, 0x3220, 0xa48c, 0xa490, 0xa4c6, 0xa4d0, 0xa62b, 0xa640, 0xa6f7, 0xa700, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa82c, 0xa830, 0xa839, 0xa840, 0xa877, 0xa880, 0xa8c5, 0xa8ce, 0xa8d9, 0xa8e0, 0xa953, 0xa95f, 0xa97c, 0xa980, 0xa9cd, 0xa9cf, 0xa9d9, 0xa9de, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa5c, 0xaac2, 0xaadb, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab6b, 0xab70, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xe000, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbc2, 0xfbd3, 0xfd8f, 0xfd92, 0xfdc7, 0xfdcf, 0xfdcf, 0xfdf0, 0xfe19, 0xfe20, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xfeff, 0xfeff, 0xff01, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfff9, 0xfffd, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10100, 0x10102, 0x10107, 0x10133, 0x10137, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102fb, 0x10300, 0x10323, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x1039f, 0x103c3, 0x103c8, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x1056f, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10857, 0x1089e, 0x108a7, 0x108af, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x108fb, 0x1091b, 0x1091f, 0x10939, 0x1093f, 0x1093f, 0x10980, 0x109b7, 0x109bc, 0x109cf, 0x109d2, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a48, 0x10a50, 0x10a58, 0x10a60, 0x10a9f, 0x10ac0, 0x10ae6, 0x10aeb, 0x10af6, 0x10b00, 0x10b35, 0x10b39, 0x10b55, 0x10b58, 0x10b72, 0x10b78, 0x10b91, 0x10b99, 0x10b9c, 0x10ba9, 0x10baf, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10cfa, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d85, 0x10d8e, 0x10d8f, 0x10e60, 0x10e7e, 0x10e80, 0x10ea9, 0x10eab, 0x10ead, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f27, 0x10f30, 0x10f59, 0x10f70, 0x10f89, 0x10fb0, 0x10fcb, 0x10fe0, 0x10ff6, 0x11000, 0x1104d, 0x11052, 0x11075, 0x1107f, 0x110c2, 0x110cd, 0x110cd, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x11147, 0x11150, 0x11176, 0x11180, 0x111df, 0x111e1, 0x111f4, 0x11200, 0x11211, 0x11213, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a9, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d5, 0x113d7, 0x113d8, 0x113e1, 0x113e2, 0x11400, 0x1145b, 0x1145d, 0x11461, 0x11480, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115dd, 0x11600, 0x11644, 0x11650, 0x11659, 0x11660, 0x1166c, 0x11680, 0x116b9, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11746, 0x11800, 0x1183b, 0x118a0, 0x118f2, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11946, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e4, 0x11a00, 0x11a47, 0x11a50, 0x11aa2, 0x11ab0, 0x11af8, 0x11b00, 0x11b09, 0x11bc0, 0x11be1, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c45, 0x11c50, 0x11c6c, 0x11c70, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef8, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f5a, 0x11fb0, 0x11fb0, 0x11fc0, 0x11ff1, 0x11fff, 0x12399, 0x12400, 0x1246e, 0x12470, 0x12474, 0x12480, 0x12543, 0x12f90, 0x12ff2, 0x13000, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a6e, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af5, 0x16b00, 0x16b45, 0x16b50, 0x16b59, 0x16b5b, 0x16b61, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d79, 0x16e40, 0x16e9a, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9c, 0x1bca3, 0x1cc00, 0x1ccf9, 0x1cd00, 0x1ceb3, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d1ea, 0x1d200, 0x1d245, 0x1d2c0, 0x1d2d3, 0x1d2e0, 0x1d2f3, 0x1d300, 0x1d356, 0x1d360, 0x1d378, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d7cb, 0x1d7ce, 0x1da8b, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14f, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e2ff, 0x1e2ff, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e5ff, 0x1e5ff, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8c7, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1e95e, 0x1e95f, 0x1ec71, 0x1ecb4, 0x1ed01, 0x1ed3d, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f100, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0001, 0xe0001, 0xe0020, 0xe007f, 0xe0100, 0xe01ef, 0xf0000, 0xffffd, 0x100000, 0x10fffd, }; /* END of CR_Print */ /* PROPERTY: 'PosixPunct': POSIX [[:punct:]] */ static const OnigCodePoint CR_PosixPunct[] = { 349, 0x0021, 0x002f, 0x003a, 0x0040, 0x005b, 0x0060, 0x007b, 0x007e, 0x00a1, 0x00a9, 0x00ab, 0x00ac, 0x00ae, 0x00b1, 0x00b4, 0x00b4, 0x00b6, 0x00b8, 0x00bb, 0x00bb, 0x00bf, 0x00bf, 0x00d7, 0x00d7, 0x00f7, 0x00f7, 0x02c2, 0x02c5, 0x02d2, 0x02df, 0x02e5, 0x02eb, 0x02ed, 0x02ed, 0x02ef, 0x02ff, 0x0375, 0x0375, 0x037e, 0x037e, 0x0384, 0x0385, 0x0387, 0x0387, 0x03f6, 0x03f6, 0x0482, 0x0482, 0x055a, 0x055f, 0x0589, 0x058a, 0x058d, 0x058f, 0x05be, 0x05be, 0x05c0, 0x05c0, 0x05c3, 0x05c3, 0x05c6, 0x05c6, 0x05f3, 0x05f4, 0x0606, 0x060f, 0x061b, 0x061b, 0x061d, 0x061f, 0x066a, 0x066d, 0x06d4, 0x06d4, 0x06de, 0x06de, 0x06e9, 0x06e9, 0x06fd, 0x06fe, 0x0700, 0x070d, 0x07f6, 0x07f9, 0x07fe, 0x07ff, 0x0830, 0x083e, 0x085e, 0x085e, 0x0888, 0x0888, 0x0964, 0x0965, 0x0970, 0x0970, 0x09f2, 0x09f3, 0x09fa, 0x09fb, 0x09fd, 0x09fd, 0x0a76, 0x0a76, 0x0af0, 0x0af1, 0x0b70, 0x0b70, 0x0bf3, 0x0bfa, 0x0c77, 0x0c77, 0x0c7f, 0x0c7f, 0x0c84, 0x0c84, 0x0d4f, 0x0d4f, 0x0d79, 0x0d79, 0x0df4, 0x0df4, 0x0e3f, 0x0e3f, 0x0e4f, 0x0e4f, 0x0e5a, 0x0e5b, 0x0f01, 0x0f17, 0x0f1a, 0x0f1f, 0x0f34, 0x0f34, 0x0f36, 0x0f36, 0x0f38, 0x0f38, 0x0f3a, 0x0f3d, 0x0f85, 0x0f85, 0x0fbe, 0x0fc5, 0x0fc7, 0x0fcc, 0x0fce, 0x0fda, 0x104a, 0x104f, 0x109e, 0x109f, 0x10fb, 0x10fb, 0x1360, 0x1368, 0x1390, 0x1399, 0x1400, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x16eb, 0x16ed, 0x1735, 0x1736, 0x17d4, 0x17d6, 0x17d8, 0x17db, 0x1800, 0x180a, 0x1940, 0x1940, 0x1944, 0x1945, 0x19de, 0x19ff, 0x1a1e, 0x1a1f, 0x1aa0, 0x1aa6, 0x1aa8, 0x1aad, 0x1b4e, 0x1b4f, 0x1b5a, 0x1b6a, 0x1b74, 0x1b7f, 0x1bfc, 0x1bff, 0x1c3b, 0x1c3f, 0x1c7e, 0x1c7f, 0x1cc0, 0x1cc7, 0x1cd3, 0x1cd3, 0x1fbd, 0x1fbd, 0x1fbf, 0x1fc1, 0x1fcd, 0x1fcf, 0x1fdd, 0x1fdf, 0x1fed, 0x1fef, 0x1ffd, 0x1ffe, 0x2010, 0x2027, 0x2030, 0x205e, 0x207a, 0x207e, 0x208a, 0x208e, 0x20a0, 0x20c0, 0x2100, 0x2101, 0x2103, 0x2106, 0x2108, 0x2109, 0x2114, 0x2114, 0x2116, 0x2118, 0x211e, 0x2123, 0x2125, 0x2125, 0x2127, 0x2127, 0x2129, 0x2129, 0x212e, 0x212e, 0x213a, 0x213b, 0x2140, 0x2144, 0x214a, 0x214d, 0x214f, 0x214f, 0x218a, 0x218b, 0x2190, 0x2429, 0x2440, 0x244a, 0x249c, 0x24e9, 0x2500, 0x2775, 0x2794, 0x2b73, 0x2b76, 0x2b95, 0x2b97, 0x2bff, 0x2ce5, 0x2cea, 0x2cf9, 0x2cfc, 0x2cfe, 0x2cff, 0x2d70, 0x2d70, 0x2e00, 0x2e2e, 0x2e30, 0x2e5d, 0x2e80, 0x2e99, 0x2e9b, 0x2ef3, 0x2f00, 0x2fd5, 0x2ff0, 0x2fff, 0x3001, 0x3004, 0x3008, 0x3020, 0x3030, 0x3030, 0x3036, 0x3037, 0x303d, 0x303f, 0x309b, 0x309c, 0x30a0, 0x30a0, 0x30fb, 0x30fb, 0x3190, 0x3191, 0x3196, 0x319f, 0x31c0, 0x31e5, 0x31ef, 0x31ef, 0x3200, 0x321e, 0x322a, 0x3247, 0x3250, 0x3250, 0x3260, 0x327f, 0x328a, 0x32b0, 0x32c0, 0x33ff, 0x4dc0, 0x4dff, 0xa490, 0xa4c6, 0xa4fe, 0xa4ff, 0xa60d, 0xa60f, 0xa673, 0xa673, 0xa67e, 0xa67e, 0xa6f2, 0xa6f7, 0xa700, 0xa716, 0xa720, 0xa721, 0xa789, 0xa78a, 0xa828, 0xa82b, 0xa836, 0xa839, 0xa874, 0xa877, 0xa8ce, 0xa8cf, 0xa8f8, 0xa8fa, 0xa8fc, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa95f, 0xa9c1, 0xa9cd, 0xa9de, 0xa9df, 0xaa5c, 0xaa5f, 0xaa77, 0xaa79, 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xab5b, 0xab5b, 0xab6a, 0xab6b, 0xabeb, 0xabeb, 0xfb29, 0xfb29, 0xfbb2, 0xfbc2, 0xfd3e, 0xfd4f, 0xfdcf, 0xfdcf, 0xfdfc, 0xfdff, 0xfe10, 0xfe19, 0xfe30, 0xfe52, 0xfe54, 0xfe66, 0xfe68, 0xfe6b, 0xff01, 0xff0f, 0xff1a, 0xff20, 0xff3b, 0xff40, 0xff5b, 0xff65, 0xffe0, 0xffe6, 0xffe8, 0xffee, 0xfffc, 0xfffd, 0x10100, 0x10102, 0x10137, 0x1013f, 0x10179, 0x10189, 0x1018c, 0x1018e, 0x10190, 0x1019c, 0x101a0, 0x101a0, 0x101d0, 0x101fc, 0x1039f, 0x1039f, 0x103d0, 0x103d0, 0x1056f, 0x1056f, 0x10857, 0x10857, 0x10877, 0x10878, 0x1091f, 0x1091f, 0x1093f, 0x1093f, 0x10a50, 0x10a58, 0x10a7f, 0x10a7f, 0x10ac8, 0x10ac8, 0x10af0, 0x10af6, 0x10b39, 0x10b3f, 0x10b99, 0x10b9c, 0x10d6e, 0x10d6e, 0x10d8e, 0x10d8f, 0x10ead, 0x10ead, 0x10f55, 0x10f59, 0x10f86, 0x10f89, 0x11047, 0x1104d, 0x110bb, 0x110bc, 0x110be, 0x110c1, 0x11140, 0x11143, 0x11174, 0x11175, 0x111c5, 0x111c8, 0x111cd, 0x111cd, 0x111db, 0x111db, 0x111dd, 0x111df, 0x11238, 0x1123d, 0x112a9, 0x112a9, 0x113d4, 0x113d5, 0x113d7, 0x113d8, 0x1144b, 0x1144f, 0x1145a, 0x1145b, 0x1145d, 0x1145d, 0x114c6, 0x114c6, 0x115c1, 0x115d7, 0x11641, 0x11643, 0x11660, 0x1166c, 0x116b9, 0x116b9, 0x1173c, 0x1173f, 0x1183b, 0x1183b, 0x11944, 0x11946, 0x119e2, 0x119e2, 0x11a3f, 0x11a46, 0x11a9a, 0x11a9c, 0x11a9e, 0x11aa2, 0x11b00, 0x11b09, 0x11be1, 0x11be1, 0x11c41, 0x11c45, 0x11c70, 0x11c71, 0x11ef7, 0x11ef8, 0x11f43, 0x11f4f, 0x11fd5, 0x11ff1, 0x11fff, 0x11fff, 0x12470, 0x12474, 0x12ff1, 0x12ff2, 0x16a6e, 0x16a6f, 0x16af5, 0x16af5, 0x16b37, 0x16b3f, 0x16b44, 0x16b45, 0x16d6d, 0x16d6f, 0x16e97, 0x16e9a, 0x16fe2, 0x16fe2, 0x1bc9c, 0x1bc9c, 0x1bc9f, 0x1bc9f, 0x1cc00, 0x1ccef, 0x1cd00, 0x1ceb3, 0x1cf50, 0x1cfc3, 0x1d000, 0x1d0f5, 0x1d100, 0x1d126, 0x1d129, 0x1d164, 0x1d16a, 0x1d16c, 0x1d183, 0x1d184, 0x1d18c, 0x1d1a9, 0x1d1ae, 0x1d1ea, 0x1d200, 0x1d241, 0x1d245, 0x1d245, 0x1d300, 0x1d356, 0x1d6c1, 0x1d6c1, 0x1d6db, 0x1d6db, 0x1d6fb, 0x1d6fb, 0x1d715, 0x1d715, 0x1d735, 0x1d735, 0x1d74f, 0x1d74f, 0x1d76f, 0x1d76f, 0x1d789, 0x1d789, 0x1d7a9, 0x1d7a9, 0x1d7c3, 0x1d7c3, 0x1d800, 0x1d9ff, 0x1da37, 0x1da3a, 0x1da6d, 0x1da74, 0x1da76, 0x1da83, 0x1da85, 0x1da8b, 0x1e14f, 0x1e14f, 0x1e2ff, 0x1e2ff, 0x1e5ff, 0x1e5ff, 0x1e95e, 0x1e95f, 0x1ecac, 0x1ecac, 0x1ecb0, 0x1ecb0, 0x1ed2e, 0x1ed2e, 0x1eef0, 0x1eef1, 0x1f000, 0x1f02b, 0x1f030, 0x1f093, 0x1f0a0, 0x1f0ae, 0x1f0b1, 0x1f0bf, 0x1f0c1, 0x1f0cf, 0x1f0d1, 0x1f0f5, 0x1f10d, 0x1f1ad, 0x1f1e6, 0x1f202, 0x1f210, 0x1f23b, 0x1f240, 0x1f248, 0x1f250, 0x1f251, 0x1f260, 0x1f265, 0x1f300, 0x1f6d7, 0x1f6dc, 0x1f6ec, 0x1f6f0, 0x1f6fc, 0x1f700, 0x1f776, 0x1f77b, 0x1f7d9, 0x1f7e0, 0x1f7eb, 0x1f7f0, 0x1f7f0, 0x1f800, 0x1f80b, 0x1f810, 0x1f847, 0x1f850, 0x1f859, 0x1f860, 0x1f887, 0x1f890, 0x1f8ad, 0x1f8b0, 0x1f8bb, 0x1f8c0, 0x1f8c1, 0x1f900, 0x1fa53, 0x1fa60, 0x1fa6d, 0x1fa70, 0x1fa7c, 0x1fa80, 0x1fa89, 0x1fa8f, 0x1fac6, 0x1face, 0x1fadc, 0x1fadf, 0x1fae9, 0x1faf0, 0x1faf8, 0x1fb00, 0x1fb92, 0x1fb94, 0x1fbef, }; /* END of CR_PosixPunct */ /* PROPERTY: 'Space': POSIX [[:Space:]] */ static const OnigCodePoint CR_Space[] = { 10, 0x0009, 0x000d, 0x0020, 0x0020, 0x0085, 0x0085, 0x00a0, 0x00a0, 0x1680, 0x1680, 0x2000, 0x200a, 0x2028, 0x2029, 0x202f, 0x202f, 0x205f, 0x205f, 0x3000, 0x3000, }; /* END of CR_Space */ /* PROPERTY: 'Upper': POSIX [[:Upper:]] */ static const OnigCodePoint CR_Upper[] = { 656, 0x0041, 0x005a, 0x00c0, 0x00d6, 0x00d8, 0x00de, 0x0100, 0x0100, 0x0102, 0x0102, 0x0104, 0x0104, 0x0106, 0x0106, 0x0108, 0x0108, 0x010a, 0x010a, 0x010c, 0x010c, 0x010e, 0x010e, 0x0110, 0x0110, 0x0112, 0x0112, 0x0114, 0x0114, 0x0116, 0x0116, 0x0118, 0x0118, 0x011a, 0x011a, 0x011c, 0x011c, 0x011e, 0x011e, 0x0120, 0x0120, 0x0122, 0x0122, 0x0124, 0x0124, 0x0126, 0x0126, 0x0128, 0x0128, 0x012a, 0x012a, 0x012c, 0x012c, 0x012e, 0x012e, 0x0130, 0x0130, 0x0132, 0x0132, 0x0134, 0x0134, 0x0136, 0x0136, 0x0139, 0x0139, 0x013b, 0x013b, 0x013d, 0x013d, 0x013f, 0x013f, 0x0141, 0x0141, 0x0143, 0x0143, 0x0145, 0x0145, 0x0147, 0x0147, 0x014a, 0x014a, 0x014c, 0x014c, 0x014e, 0x014e, 0x0150, 0x0150, 0x0152, 0x0152, 0x0154, 0x0154, 0x0156, 0x0156, 0x0158, 0x0158, 0x015a, 0x015a, 0x015c, 0x015c, 0x015e, 0x015e, 0x0160, 0x0160, 0x0162, 0x0162, 0x0164, 0x0164, 0x0166, 0x0166, 0x0168, 0x0168, 0x016a, 0x016a, 0x016c, 0x016c, 0x016e, 0x016e, 0x0170, 0x0170, 0x0172, 0x0172, 0x0174, 0x0174, 0x0176, 0x0176, 0x0178, 0x0179, 0x017b, 0x017b, 0x017d, 0x017d, 0x0181, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, 0x0189, 0x018b, 0x018e, 0x0191, 0x0193, 0x0194, 0x0196, 0x0198, 0x019c, 0x019d, 0x019f, 0x01a0, 0x01a2, 0x01a2, 0x01a4, 0x01a4, 0x01a6, 0x01a7, 0x01a9, 0x01a9, 0x01ac, 0x01ac, 0x01ae, 0x01af, 0x01b1, 0x01b3, 0x01b5, 0x01b5, 0x01b7, 0x01b8, 0x01bc, 0x01bc, 0x01c4, 0x01c4, 0x01c7, 0x01c7, 0x01ca, 0x01ca, 0x01cd, 0x01cd, 0x01cf, 0x01cf, 0x01d1, 0x01d1, 0x01d3, 0x01d3, 0x01d5, 0x01d5, 0x01d7, 0x01d7, 0x01d9, 0x01d9, 0x01db, 0x01db, 0x01de, 0x01de, 0x01e0, 0x01e0, 0x01e2, 0x01e2, 0x01e4, 0x01e4, 0x01e6, 0x01e6, 0x01e8, 0x01e8, 0x01ea, 0x01ea, 0x01ec, 0x01ec, 0x01ee, 0x01ee, 0x01f1, 0x01f1, 0x01f4, 0x01f4, 0x01f6, 0x01f8, 0x01fa, 0x01fa, 0x01fc, 0x01fc, 0x01fe, 0x01fe, 0x0200, 0x0200, 0x0202, 0x0202, 0x0204, 0x0204, 0x0206, 0x0206, 0x0208, 0x0208, 0x020a, 0x020a, 0x020c, 0x020c, 0x020e, 0x020e, 0x0210, 0x0210, 0x0212, 0x0212, 0x0214, 0x0214, 0x0216, 0x0216, 0x0218, 0x0218, 0x021a, 0x021a, 0x021c, 0x021c, 0x021e, 0x021e, 0x0220, 0x0220, 0x0222, 0x0222, 0x0224, 0x0224, 0x0226, 0x0226, 0x0228, 0x0228, 0x022a, 0x022a, 0x022c, 0x022c, 0x022e, 0x022e, 0x0230, 0x0230, 0x0232, 0x0232, 0x023a, 0x023b, 0x023d, 0x023e, 0x0241, 0x0241, 0x0243, 0x0246, 0x0248, 0x0248, 0x024a, 0x024a, 0x024c, 0x024c, 0x024e, 0x024e, 0x0370, 0x0370, 0x0372, 0x0372, 0x0376, 0x0376, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x038f, 0x0391, 0x03a1, 0x03a3, 0x03ab, 0x03cf, 0x03cf, 0x03d2, 0x03d4, 0x03d8, 0x03d8, 0x03da, 0x03da, 0x03dc, 0x03dc, 0x03de, 0x03de, 0x03e0, 0x03e0, 0x03e2, 0x03e2, 0x03e4, 0x03e4, 0x03e6, 0x03e6, 0x03e8, 0x03e8, 0x03ea, 0x03ea, 0x03ec, 0x03ec, 0x03ee, 0x03ee, 0x03f4, 0x03f4, 0x03f7, 0x03f7, 0x03f9, 0x03fa, 0x03fd, 0x042f, 0x0460, 0x0460, 0x0462, 0x0462, 0x0464, 0x0464, 0x0466, 0x0466, 0x0468, 0x0468, 0x046a, 0x046a, 0x046c, 0x046c, 0x046e, 0x046e, 0x0470, 0x0470, 0x0472, 0x0472, 0x0474, 0x0474, 0x0476, 0x0476, 0x0478, 0x0478, 0x047a, 0x047a, 0x047c, 0x047c, 0x047e, 0x047e, 0x0480, 0x0480, 0x048a, 0x048a, 0x048c, 0x048c, 0x048e, 0x048e, 0x0490, 0x0490, 0x0492, 0x0492, 0x0494, 0x0494, 0x0496, 0x0496, 0x0498, 0x0498, 0x049a, 0x049a, 0x049c, 0x049c, 0x049e, 0x049e, 0x04a0, 0x04a0, 0x04a2, 0x04a2, 0x04a4, 0x04a4, 0x04a6, 0x04a6, 0x04a8, 0x04a8, 0x04aa, 0x04aa, 0x04ac, 0x04ac, 0x04ae, 0x04ae, 0x04b0, 0x04b0, 0x04b2, 0x04b2, 0x04b4, 0x04b4, 0x04b6, 0x04b6, 0x04b8, 0x04b8, 0x04ba, 0x04ba, 0x04bc, 0x04bc, 0x04be, 0x04be, 0x04c0, 0x04c1, 0x04c3, 0x04c3, 0x04c5, 0x04c5, 0x04c7, 0x04c7, 0x04c9, 0x04c9, 0x04cb, 0x04cb, 0x04cd, 0x04cd, 0x04d0, 0x04d0, 0x04d2, 0x04d2, 0x04d4, 0x04d4, 0x04d6, 0x04d6, 0x04d8, 0x04d8, 0x04da, 0x04da, 0x04dc, 0x04dc, 0x04de, 0x04de, 0x04e0, 0x04e0, 0x04e2, 0x04e2, 0x04e4, 0x04e4, 0x04e6, 0x04e6, 0x04e8, 0x04e8, 0x04ea, 0x04ea, 0x04ec, 0x04ec, 0x04ee, 0x04ee, 0x04f0, 0x04f0, 0x04f2, 0x04f2, 0x04f4, 0x04f4, 0x04f6, 0x04f6, 0x04f8, 0x04f8, 0x04fa, 0x04fa, 0x04fc, 0x04fc, 0x04fe, 0x04fe, 0x0500, 0x0500, 0x0502, 0x0502, 0x0504, 0x0504, 0x0506, 0x0506, 0x0508, 0x0508, 0x050a, 0x050a, 0x050c, 0x050c, 0x050e, 0x050e, 0x0510, 0x0510, 0x0512, 0x0512, 0x0514, 0x0514, 0x0516, 0x0516, 0x0518, 0x0518, 0x051a, 0x051a, 0x051c, 0x051c, 0x051e, 0x051e, 0x0520, 0x0520, 0x0522, 0x0522, 0x0524, 0x0524, 0x0526, 0x0526, 0x0528, 0x0528, 0x052a, 0x052a, 0x052c, 0x052c, 0x052e, 0x052e, 0x0531, 0x0556, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x13a0, 0x13f5, 0x1c89, 0x1c89, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1e00, 0x1e00, 0x1e02, 0x1e02, 0x1e04, 0x1e04, 0x1e06, 0x1e06, 0x1e08, 0x1e08, 0x1e0a, 0x1e0a, 0x1e0c, 0x1e0c, 0x1e0e, 0x1e0e, 0x1e10, 0x1e10, 0x1e12, 0x1e12, 0x1e14, 0x1e14, 0x1e16, 0x1e16, 0x1e18, 0x1e18, 0x1e1a, 0x1e1a, 0x1e1c, 0x1e1c, 0x1e1e, 0x1e1e, 0x1e20, 0x1e20, 0x1e22, 0x1e22, 0x1e24, 0x1e24, 0x1e26, 0x1e26, 0x1e28, 0x1e28, 0x1e2a, 0x1e2a, 0x1e2c, 0x1e2c, 0x1e2e, 0x1e2e, 0x1e30, 0x1e30, 0x1e32, 0x1e32, 0x1e34, 0x1e34, 0x1e36, 0x1e36, 0x1e38, 0x1e38, 0x1e3a, 0x1e3a, 0x1e3c, 0x1e3c, 0x1e3e, 0x1e3e, 0x1e40, 0x1e40, 0x1e42, 0x1e42, 0x1e44, 0x1e44, 0x1e46, 0x1e46, 0x1e48, 0x1e48, 0x1e4a, 0x1e4a, 0x1e4c, 0x1e4c, 0x1e4e, 0x1e4e, 0x1e50, 0x1e50, 0x1e52, 0x1e52, 0x1e54, 0x1e54, 0x1e56, 0x1e56, 0x1e58, 0x1e58, 0x1e5a, 0x1e5a, 0x1e5c, 0x1e5c, 0x1e5e, 0x1e5e, 0x1e60, 0x1e60, 0x1e62, 0x1e62, 0x1e64, 0x1e64, 0x1e66, 0x1e66, 0x1e68, 0x1e68, 0x1e6a, 0x1e6a, 0x1e6c, 0x1e6c, 0x1e6e, 0x1e6e, 0x1e70, 0x1e70, 0x1e72, 0x1e72, 0x1e74, 0x1e74, 0x1e76, 0x1e76, 0x1e78, 0x1e78, 0x1e7a, 0x1e7a, 0x1e7c, 0x1e7c, 0x1e7e, 0x1e7e, 0x1e80, 0x1e80, 0x1e82, 0x1e82, 0x1e84, 0x1e84, 0x1e86, 0x1e86, 0x1e88, 0x1e88, 0x1e8a, 0x1e8a, 0x1e8c, 0x1e8c, 0x1e8e, 0x1e8e, 0x1e90, 0x1e90, 0x1e92, 0x1e92, 0x1e94, 0x1e94, 0x1e9e, 0x1e9e, 0x1ea0, 0x1ea0, 0x1ea2, 0x1ea2, 0x1ea4, 0x1ea4, 0x1ea6, 0x1ea6, 0x1ea8, 0x1ea8, 0x1eaa, 0x1eaa, 0x1eac, 0x1eac, 0x1eae, 0x1eae, 0x1eb0, 0x1eb0, 0x1eb2, 0x1eb2, 0x1eb4, 0x1eb4, 0x1eb6, 0x1eb6, 0x1eb8, 0x1eb8, 0x1eba, 0x1eba, 0x1ebc, 0x1ebc, 0x1ebe, 0x1ebe, 0x1ec0, 0x1ec0, 0x1ec2, 0x1ec2, 0x1ec4, 0x1ec4, 0x1ec6, 0x1ec6, 0x1ec8, 0x1ec8, 0x1eca, 0x1eca, 0x1ecc, 0x1ecc, 0x1ece, 0x1ece, 0x1ed0, 0x1ed0, 0x1ed2, 0x1ed2, 0x1ed4, 0x1ed4, 0x1ed6, 0x1ed6, 0x1ed8, 0x1ed8, 0x1eda, 0x1eda, 0x1edc, 0x1edc, 0x1ede, 0x1ede, 0x1ee0, 0x1ee0, 0x1ee2, 0x1ee2, 0x1ee4, 0x1ee4, 0x1ee6, 0x1ee6, 0x1ee8, 0x1ee8, 0x1eea, 0x1eea, 0x1eec, 0x1eec, 0x1eee, 0x1eee, 0x1ef0, 0x1ef0, 0x1ef2, 0x1ef2, 0x1ef4, 0x1ef4, 0x1ef6, 0x1ef6, 0x1ef8, 0x1ef8, 0x1efa, 0x1efa, 0x1efc, 0x1efc, 0x1efe, 0x1efe, 0x1f08, 0x1f0f, 0x1f18, 0x1f1d, 0x1f28, 0x1f2f, 0x1f38, 0x1f3f, 0x1f48, 0x1f4d, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f5f, 0x1f68, 0x1f6f, 0x1fb8, 0x1fbb, 0x1fc8, 0x1fcb, 0x1fd8, 0x1fdb, 0x1fe8, 0x1fec, 0x1ff8, 0x1ffb, 0x2102, 0x2102, 0x2107, 0x2107, 0x210b, 0x210d, 0x2110, 0x2112, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x2130, 0x2133, 0x213e, 0x213f, 0x2145, 0x2145, 0x2160, 0x216f, 0x2183, 0x2183, 0x24b6, 0x24cf, 0x2c00, 0x2c2f, 0x2c60, 0x2c60, 0x2c62, 0x2c64, 0x2c67, 0x2c67, 0x2c69, 0x2c69, 0x2c6b, 0x2c6b, 0x2c6d, 0x2c70, 0x2c72, 0x2c72, 0x2c75, 0x2c75, 0x2c7e, 0x2c80, 0x2c82, 0x2c82, 0x2c84, 0x2c84, 0x2c86, 0x2c86, 0x2c88, 0x2c88, 0x2c8a, 0x2c8a, 0x2c8c, 0x2c8c, 0x2c8e, 0x2c8e, 0x2c90, 0x2c90, 0x2c92, 0x2c92, 0x2c94, 0x2c94, 0x2c96, 0x2c96, 0x2c98, 0x2c98, 0x2c9a, 0x2c9a, 0x2c9c, 0x2c9c, 0x2c9e, 0x2c9e, 0x2ca0, 0x2ca0, 0x2ca2, 0x2ca2, 0x2ca4, 0x2ca4, 0x2ca6, 0x2ca6, 0x2ca8, 0x2ca8, 0x2caa, 0x2caa, 0x2cac, 0x2cac, 0x2cae, 0x2cae, 0x2cb0, 0x2cb0, 0x2cb2, 0x2cb2, 0x2cb4, 0x2cb4, 0x2cb6, 0x2cb6, 0x2cb8, 0x2cb8, 0x2cba, 0x2cba, 0x2cbc, 0x2cbc, 0x2cbe, 0x2cbe, 0x2cc0, 0x2cc0, 0x2cc2, 0x2cc2, 0x2cc4, 0x2cc4, 0x2cc6, 0x2cc6, 0x2cc8, 0x2cc8, 0x2cca, 0x2cca, 0x2ccc, 0x2ccc, 0x2cce, 0x2cce, 0x2cd0, 0x2cd0, 0x2cd2, 0x2cd2, 0x2cd4, 0x2cd4, 0x2cd6, 0x2cd6, 0x2cd8, 0x2cd8, 0x2cda, 0x2cda, 0x2cdc, 0x2cdc, 0x2cde, 0x2cde, 0x2ce0, 0x2ce0, 0x2ce2, 0x2ce2, 0x2ceb, 0x2ceb, 0x2ced, 0x2ced, 0x2cf2, 0x2cf2, 0xa640, 0xa640, 0xa642, 0xa642, 0xa644, 0xa644, 0xa646, 0xa646, 0xa648, 0xa648, 0xa64a, 0xa64a, 0xa64c, 0xa64c, 0xa64e, 0xa64e, 0xa650, 0xa650, 0xa652, 0xa652, 0xa654, 0xa654, 0xa656, 0xa656, 0xa658, 0xa658, 0xa65a, 0xa65a, 0xa65c, 0xa65c, 0xa65e, 0xa65e, 0xa660, 0xa660, 0xa662, 0xa662, 0xa664, 0xa664, 0xa666, 0xa666, 0xa668, 0xa668, 0xa66a, 0xa66a, 0xa66c, 0xa66c, 0xa680, 0xa680, 0xa682, 0xa682, 0xa684, 0xa684, 0xa686, 0xa686, 0xa688, 0xa688, 0xa68a, 0xa68a, 0xa68c, 0xa68c, 0xa68e, 0xa68e, 0xa690, 0xa690, 0xa692, 0xa692, 0xa694, 0xa694, 0xa696, 0xa696, 0xa698, 0xa698, 0xa69a, 0xa69a, 0xa722, 0xa722, 0xa724, 0xa724, 0xa726, 0xa726, 0xa728, 0xa728, 0xa72a, 0xa72a, 0xa72c, 0xa72c, 0xa72e, 0xa72e, 0xa732, 0xa732, 0xa734, 0xa734, 0xa736, 0xa736, 0xa738, 0xa738, 0xa73a, 0xa73a, 0xa73c, 0xa73c, 0xa73e, 0xa73e, 0xa740, 0xa740, 0xa742, 0xa742, 0xa744, 0xa744, 0xa746, 0xa746, 0xa748, 0xa748, 0xa74a, 0xa74a, 0xa74c, 0xa74c, 0xa74e, 0xa74e, 0xa750, 0xa750, 0xa752, 0xa752, 0xa754, 0xa754, 0xa756, 0xa756, 0xa758, 0xa758, 0xa75a, 0xa75a, 0xa75c, 0xa75c, 0xa75e, 0xa75e, 0xa760, 0xa760, 0xa762, 0xa762, 0xa764, 0xa764, 0xa766, 0xa766, 0xa768, 0xa768, 0xa76a, 0xa76a, 0xa76c, 0xa76c, 0xa76e, 0xa76e, 0xa779, 0xa779, 0xa77b, 0xa77b, 0xa77d, 0xa77e, 0xa780, 0xa780, 0xa782, 0xa782, 0xa784, 0xa784, 0xa786, 0xa786, 0xa78b, 0xa78b, 0xa78d, 0xa78d, 0xa790, 0xa790, 0xa792, 0xa792, 0xa796, 0xa796, 0xa798, 0xa798, 0xa79a, 0xa79a, 0xa79c, 0xa79c, 0xa79e, 0xa79e, 0xa7a0, 0xa7a0, 0xa7a2, 0xa7a2, 0xa7a4, 0xa7a4, 0xa7a6, 0xa7a6, 0xa7a8, 0xa7a8, 0xa7aa, 0xa7ae, 0xa7b0, 0xa7b4, 0xa7b6, 0xa7b6, 0xa7b8, 0xa7b8, 0xa7ba, 0xa7ba, 0xa7bc, 0xa7bc, 0xa7be, 0xa7be, 0xa7c0, 0xa7c0, 0xa7c2, 0xa7c2, 0xa7c4, 0xa7c7, 0xa7c9, 0xa7c9, 0xa7cb, 0xa7cc, 0xa7d0, 0xa7d0, 0xa7d6, 0xa7d6, 0xa7d8, 0xa7d8, 0xa7da, 0xa7da, 0xa7dc, 0xa7dc, 0xa7f5, 0xa7f5, 0xff21, 0xff3a, 0x10400, 0x10427, 0x104b0, 0x104d3, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10c80, 0x10cb2, 0x10d50, 0x10d65, 0x118a0, 0x118bf, 0x16e40, 0x16e5f, 0x1d400, 0x1d419, 0x1d434, 0x1d44d, 0x1d468, 0x1d481, 0x1d49c, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b5, 0x1d4d0, 0x1d4e9, 0x1d504, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d538, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d56c, 0x1d585, 0x1d5a0, 0x1d5b9, 0x1d5d4, 0x1d5ed, 0x1d608, 0x1d621, 0x1d63c, 0x1d655, 0x1d670, 0x1d689, 0x1d6a8, 0x1d6c0, 0x1d6e2, 0x1d6fa, 0x1d71c, 0x1d734, 0x1d756, 0x1d76e, 0x1d790, 0x1d7a8, 0x1d7ca, 0x1d7ca, 0x1e900, 0x1e921, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, }; /* END of CR_Upper */ /* PROPERTY: 'XDigit': POSIX [[:XDigit:]] */ static const OnigCodePoint CR_XDigit[] = { 3, 0x0030, 0x0039, 0x0041, 0x0046, 0x0061, 0x0066, }; /* END of CR_XDigit */ /* PROPERTY: 'Word': POSIX [[:Word:]] */ static const OnigCodePoint CR_Word[] = { 795, 0x0030, 0x0039, 0x0041, 0x005a, 0x005f, 0x005f, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0300, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x0483, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x0591, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0669, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06df, 0x06e8, 0x06ea, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x074a, 0x074d, 0x07b1, 0x07c0, 0x07f5, 0x07fa, 0x07fa, 0x07fd, 0x07fd, 0x0800, 0x082d, 0x0840, 0x085b, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x08e1, 0x08e3, 0x0963, 0x0966, 0x096f, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bc, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09f1, 0x09fc, 0x09fc, 0x09fe, 0x09fe, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3c, 0x0a3c, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4d, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abc, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acd, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0aef, 0x0af9, 0x0aff, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3c, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4d, 0x0b55, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b6f, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcd, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bef, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3c, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4d, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbc, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccd, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d66, 0x0d6f, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dca, 0x0dca, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e4e, 0x0e50, 0x0e59, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ec8, 0x0ece, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f18, 0x0f19, 0x0f20, 0x0f29, 0x0f35, 0x0f35, 0x0f37, 0x0f37, 0x0f39, 0x0f39, 0x0f3e, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f84, 0x0f86, 0x0f97, 0x0f99, 0x0fbc, 0x0fc6, 0x0fc6, 0x1000, 0x1049, 0x1050, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x135d, 0x135f, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1715, 0x171f, 0x1734, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17d3, 0x17d7, 0x17d7, 0x17dc, 0x17dd, 0x17e0, 0x17e9, 0x180b, 0x180d, 0x180f, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x193b, 0x1946, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19d9, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a60, 0x1a7c, 0x1a7f, 0x1a89, 0x1a90, 0x1a99, 0x1aa7, 0x1aa7, 0x1ab0, 0x1ace, 0x1b00, 0x1b4c, 0x1b50, 0x1b59, 0x1b6b, 0x1b73, 0x1b80, 0x1bf3, 0x1c00, 0x1c37, 0x1c40, 0x1c49, 0x1c4d, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1cd0, 0x1cd2, 0x1cd4, 0x1cfa, 0x1d00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x203f, 0x2040, 0x2054, 0x2054, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x20d0, 0x20f0, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x24b6, 0x24e9, 0x2c00, 0x2ce4, 0x2ceb, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d7f, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x2e2f, 0x2e2f, 0x3005, 0x3007, 0x3021, 0x302f, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x3099, 0x309a, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa62b, 0xa640, 0xa672, 0xa674, 0xa67d, 0xa67f, 0xa6f1, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa827, 0xa82c, 0xa82c, 0xa840, 0xa873, 0xa880, 0xa8c5, 0xa8d0, 0xa8d9, 0xa8e0, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa92d, 0xa930, 0xa953, 0xa960, 0xa97c, 0xa980, 0xa9c0, 0xa9cf, 0xa9d9, 0xa9e0, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa60, 0xaa76, 0xaa7a, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf6, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xabec, 0xabed, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe00, 0xfe0f, 0xfe20, 0xfe2f, 0xfe33, 0xfe34, 0xfe4d, 0xfe4f, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff10, 0xff19, 0xff21, 0xff3a, 0xff3f, 0xff3f, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x101fd, 0x101fd, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x102e0, 0x102e0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a38, 0x10a3a, 0x10a3f, 0x10a3f, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae6, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d6d, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f50, 0x10f70, 0x10f85, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11046, 0x11066, 0x11075, 0x1107f, 0x110ba, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11134, 0x11136, 0x1113f, 0x11144, 0x11147, 0x11150, 0x11173, 0x11176, 0x11176, 0x11180, 0x111c4, 0x111c9, 0x111cc, 0x111ce, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112ea, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133b, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134d, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11366, 0x1136c, 0x11370, 0x11374, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113d3, 0x113e1, 0x113e2, 0x11400, 0x1144a, 0x11450, 0x11459, 0x1145e, 0x11461, 0x11480, 0x114c5, 0x114c7, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115c0, 0x115d8, 0x115dd, 0x11600, 0x11640, 0x11644, 0x11644, 0x11650, 0x11659, 0x11680, 0x116b8, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172b, 0x11730, 0x11739, 0x11740, 0x11746, 0x11800, 0x1183a, 0x118a0, 0x118e9, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x11943, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a3e, 0x11a47, 0x11a47, 0x11a50, 0x11a99, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c40, 0x11c50, 0x11c59, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f42, 0x11f50, 0x11f5a, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13440, 0x13455, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a70, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16af0, 0x16af4, 0x16b00, 0x16b36, 0x16b40, 0x16b43, 0x16b50, 0x16b59, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16d70, 0x16d79, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe4, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9d, 0x1bc9e, 0x1ccf0, 0x1ccf9, 0x1cf00, 0x1cf2d, 0x1cf30, 0x1cf46, 0x1d165, 0x1d169, 0x1d16d, 0x1d172, 0x1d17b, 0x1d182, 0x1d185, 0x1d18b, 0x1d1aa, 0x1d1ad, 0x1d242, 0x1d244, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1da00, 0x1da36, 0x1da3b, 0x1da6c, 0x1da75, 0x1da75, 0x1da84, 0x1da84, 0x1da9b, 0x1da9f, 0x1daa1, 0x1daaf, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e130, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ae, 0x1e2c0, 0x1e2f9, 0x1e4d0, 0x1e4f9, 0x1e5d0, 0x1e5fa, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e8d0, 0x1e8d6, 0x1e900, 0x1e94b, 0x1e950, 0x1e959, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, 0x1fbf0, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, 0xe0100, 0xe01ef, }; /* END of CR_Word */ /* PROPERTY: 'Alnum': POSIX [[:Alnum:]] */ static const OnigCodePoint CR_Alnum[] = { 802, 0x0030, 0x0039, 0x0041, 0x005a, 0x0061, 0x007a, 0x00aa, 0x00aa, 0x00b5, 0x00b5, 0x00ba, 0x00ba, 0x00c0, 0x00d6, 0x00d8, 0x00f6, 0x00f8, 0x02c1, 0x02c6, 0x02d1, 0x02e0, 0x02e4, 0x02ec, 0x02ec, 0x02ee, 0x02ee, 0x0345, 0x0345, 0x0363, 0x0374, 0x0376, 0x0377, 0x037a, 0x037d, 0x037f, 0x037f, 0x0386, 0x0386, 0x0388, 0x038a, 0x038c, 0x038c, 0x038e, 0x03a1, 0x03a3, 0x03f5, 0x03f7, 0x0481, 0x048a, 0x052f, 0x0531, 0x0556, 0x0559, 0x0559, 0x0560, 0x0588, 0x05b0, 0x05bd, 0x05bf, 0x05bf, 0x05c1, 0x05c2, 0x05c4, 0x05c5, 0x05c7, 0x05c7, 0x05d0, 0x05ea, 0x05ef, 0x05f2, 0x0610, 0x061a, 0x0620, 0x0657, 0x0659, 0x0669, 0x066e, 0x06d3, 0x06d5, 0x06dc, 0x06e1, 0x06e8, 0x06ed, 0x06fc, 0x06ff, 0x06ff, 0x0710, 0x073f, 0x074d, 0x07b1, 0x07c0, 0x07ea, 0x07f4, 0x07f5, 0x07fa, 0x07fa, 0x0800, 0x0817, 0x081a, 0x082c, 0x0840, 0x0858, 0x0860, 0x086a, 0x0870, 0x0887, 0x0889, 0x088e, 0x0897, 0x0897, 0x08a0, 0x08c9, 0x08d4, 0x08df, 0x08e3, 0x08e9, 0x08f0, 0x093b, 0x093d, 0x094c, 0x094e, 0x0950, 0x0955, 0x0963, 0x0966, 0x096f, 0x0971, 0x0983, 0x0985, 0x098c, 0x098f, 0x0990, 0x0993, 0x09a8, 0x09aa, 0x09b0, 0x09b2, 0x09b2, 0x09b6, 0x09b9, 0x09bd, 0x09c4, 0x09c7, 0x09c8, 0x09cb, 0x09cc, 0x09ce, 0x09ce, 0x09d7, 0x09d7, 0x09dc, 0x09dd, 0x09df, 0x09e3, 0x09e6, 0x09f1, 0x09fc, 0x09fc, 0x0a01, 0x0a03, 0x0a05, 0x0a0a, 0x0a0f, 0x0a10, 0x0a13, 0x0a28, 0x0a2a, 0x0a30, 0x0a32, 0x0a33, 0x0a35, 0x0a36, 0x0a38, 0x0a39, 0x0a3e, 0x0a42, 0x0a47, 0x0a48, 0x0a4b, 0x0a4c, 0x0a51, 0x0a51, 0x0a59, 0x0a5c, 0x0a5e, 0x0a5e, 0x0a66, 0x0a75, 0x0a81, 0x0a83, 0x0a85, 0x0a8d, 0x0a8f, 0x0a91, 0x0a93, 0x0aa8, 0x0aaa, 0x0ab0, 0x0ab2, 0x0ab3, 0x0ab5, 0x0ab9, 0x0abd, 0x0ac5, 0x0ac7, 0x0ac9, 0x0acb, 0x0acc, 0x0ad0, 0x0ad0, 0x0ae0, 0x0ae3, 0x0ae6, 0x0aef, 0x0af9, 0x0afc, 0x0b01, 0x0b03, 0x0b05, 0x0b0c, 0x0b0f, 0x0b10, 0x0b13, 0x0b28, 0x0b2a, 0x0b30, 0x0b32, 0x0b33, 0x0b35, 0x0b39, 0x0b3d, 0x0b44, 0x0b47, 0x0b48, 0x0b4b, 0x0b4c, 0x0b56, 0x0b57, 0x0b5c, 0x0b5d, 0x0b5f, 0x0b63, 0x0b66, 0x0b6f, 0x0b71, 0x0b71, 0x0b82, 0x0b83, 0x0b85, 0x0b8a, 0x0b8e, 0x0b90, 0x0b92, 0x0b95, 0x0b99, 0x0b9a, 0x0b9c, 0x0b9c, 0x0b9e, 0x0b9f, 0x0ba3, 0x0ba4, 0x0ba8, 0x0baa, 0x0bae, 0x0bb9, 0x0bbe, 0x0bc2, 0x0bc6, 0x0bc8, 0x0bca, 0x0bcc, 0x0bd0, 0x0bd0, 0x0bd7, 0x0bd7, 0x0be6, 0x0bef, 0x0c00, 0x0c0c, 0x0c0e, 0x0c10, 0x0c12, 0x0c28, 0x0c2a, 0x0c39, 0x0c3d, 0x0c44, 0x0c46, 0x0c48, 0x0c4a, 0x0c4c, 0x0c55, 0x0c56, 0x0c58, 0x0c5a, 0x0c5d, 0x0c5d, 0x0c60, 0x0c63, 0x0c66, 0x0c6f, 0x0c80, 0x0c83, 0x0c85, 0x0c8c, 0x0c8e, 0x0c90, 0x0c92, 0x0ca8, 0x0caa, 0x0cb3, 0x0cb5, 0x0cb9, 0x0cbd, 0x0cc4, 0x0cc6, 0x0cc8, 0x0cca, 0x0ccc, 0x0cd5, 0x0cd6, 0x0cdd, 0x0cde, 0x0ce0, 0x0ce3, 0x0ce6, 0x0cef, 0x0cf1, 0x0cf3, 0x0d00, 0x0d0c, 0x0d0e, 0x0d10, 0x0d12, 0x0d3a, 0x0d3d, 0x0d44, 0x0d46, 0x0d48, 0x0d4a, 0x0d4c, 0x0d4e, 0x0d4e, 0x0d54, 0x0d57, 0x0d5f, 0x0d63, 0x0d66, 0x0d6f, 0x0d7a, 0x0d7f, 0x0d81, 0x0d83, 0x0d85, 0x0d96, 0x0d9a, 0x0db1, 0x0db3, 0x0dbb, 0x0dbd, 0x0dbd, 0x0dc0, 0x0dc6, 0x0dcf, 0x0dd4, 0x0dd6, 0x0dd6, 0x0dd8, 0x0ddf, 0x0de6, 0x0def, 0x0df2, 0x0df3, 0x0e01, 0x0e3a, 0x0e40, 0x0e46, 0x0e4d, 0x0e4d, 0x0e50, 0x0e59, 0x0e81, 0x0e82, 0x0e84, 0x0e84, 0x0e86, 0x0e8a, 0x0e8c, 0x0ea3, 0x0ea5, 0x0ea5, 0x0ea7, 0x0eb9, 0x0ebb, 0x0ebd, 0x0ec0, 0x0ec4, 0x0ec6, 0x0ec6, 0x0ecd, 0x0ecd, 0x0ed0, 0x0ed9, 0x0edc, 0x0edf, 0x0f00, 0x0f00, 0x0f20, 0x0f29, 0x0f40, 0x0f47, 0x0f49, 0x0f6c, 0x0f71, 0x0f83, 0x0f88, 0x0f97, 0x0f99, 0x0fbc, 0x1000, 0x1036, 0x1038, 0x1038, 0x103b, 0x1049, 0x1050, 0x109d, 0x10a0, 0x10c5, 0x10c7, 0x10c7, 0x10cd, 0x10cd, 0x10d0, 0x10fa, 0x10fc, 0x1248, 0x124a, 0x124d, 0x1250, 0x1256, 0x1258, 0x1258, 0x125a, 0x125d, 0x1260, 0x1288, 0x128a, 0x128d, 0x1290, 0x12b0, 0x12b2, 0x12b5, 0x12b8, 0x12be, 0x12c0, 0x12c0, 0x12c2, 0x12c5, 0x12c8, 0x12d6, 0x12d8, 0x1310, 0x1312, 0x1315, 0x1318, 0x135a, 0x1380, 0x138f, 0x13a0, 0x13f5, 0x13f8, 0x13fd, 0x1401, 0x166c, 0x166f, 0x167f, 0x1681, 0x169a, 0x16a0, 0x16ea, 0x16ee, 0x16f8, 0x1700, 0x1713, 0x171f, 0x1733, 0x1740, 0x1753, 0x1760, 0x176c, 0x176e, 0x1770, 0x1772, 0x1773, 0x1780, 0x17b3, 0x17b6, 0x17c8, 0x17d7, 0x17d7, 0x17dc, 0x17dc, 0x17e0, 0x17e9, 0x1810, 0x1819, 0x1820, 0x1878, 0x1880, 0x18aa, 0x18b0, 0x18f5, 0x1900, 0x191e, 0x1920, 0x192b, 0x1930, 0x1938, 0x1946, 0x196d, 0x1970, 0x1974, 0x1980, 0x19ab, 0x19b0, 0x19c9, 0x19d0, 0x19d9, 0x1a00, 0x1a1b, 0x1a20, 0x1a5e, 0x1a61, 0x1a74, 0x1a80, 0x1a89, 0x1a90, 0x1a99, 0x1aa7, 0x1aa7, 0x1abf, 0x1ac0, 0x1acc, 0x1ace, 0x1b00, 0x1b33, 0x1b35, 0x1b43, 0x1b45, 0x1b4c, 0x1b50, 0x1b59, 0x1b80, 0x1ba9, 0x1bac, 0x1be5, 0x1be7, 0x1bf1, 0x1c00, 0x1c36, 0x1c40, 0x1c49, 0x1c4d, 0x1c7d, 0x1c80, 0x1c8a, 0x1c90, 0x1cba, 0x1cbd, 0x1cbf, 0x1ce9, 0x1cec, 0x1cee, 0x1cf3, 0x1cf5, 0x1cf6, 0x1cfa, 0x1cfa, 0x1d00, 0x1dbf, 0x1dd3, 0x1df4, 0x1e00, 0x1f15, 0x1f18, 0x1f1d, 0x1f20, 0x1f45, 0x1f48, 0x1f4d, 0x1f50, 0x1f57, 0x1f59, 0x1f59, 0x1f5b, 0x1f5b, 0x1f5d, 0x1f5d, 0x1f5f, 0x1f7d, 0x1f80, 0x1fb4, 0x1fb6, 0x1fbc, 0x1fbe, 0x1fbe, 0x1fc2, 0x1fc4, 0x1fc6, 0x1fcc, 0x1fd0, 0x1fd3, 0x1fd6, 0x1fdb, 0x1fe0, 0x1fec, 0x1ff2, 0x1ff4, 0x1ff6, 0x1ffc, 0x2071, 0x2071, 0x207f, 0x207f, 0x2090, 0x209c, 0x2102, 0x2102, 0x2107, 0x2107, 0x210a, 0x2113, 0x2115, 0x2115, 0x2119, 0x211d, 0x2124, 0x2124, 0x2126, 0x2126, 0x2128, 0x2128, 0x212a, 0x212d, 0x212f, 0x2139, 0x213c, 0x213f, 0x2145, 0x2149, 0x214e, 0x214e, 0x2160, 0x2188, 0x24b6, 0x24e9, 0x2c00, 0x2ce4, 0x2ceb, 0x2cee, 0x2cf2, 0x2cf3, 0x2d00, 0x2d25, 0x2d27, 0x2d27, 0x2d2d, 0x2d2d, 0x2d30, 0x2d67, 0x2d6f, 0x2d6f, 0x2d80, 0x2d96, 0x2da0, 0x2da6, 0x2da8, 0x2dae, 0x2db0, 0x2db6, 0x2db8, 0x2dbe, 0x2dc0, 0x2dc6, 0x2dc8, 0x2dce, 0x2dd0, 0x2dd6, 0x2dd8, 0x2dde, 0x2de0, 0x2dff, 0x2e2f, 0x2e2f, 0x3005, 0x3007, 0x3021, 0x3029, 0x3031, 0x3035, 0x3038, 0x303c, 0x3041, 0x3096, 0x309d, 0x309f, 0x30a1, 0x30fa, 0x30fc, 0x30ff, 0x3105, 0x312f, 0x3131, 0x318e, 0x31a0, 0x31bf, 0x31f0, 0x31ff, 0x3400, 0x4dbf, 0x4e00, 0xa48c, 0xa4d0, 0xa4fd, 0xa500, 0xa60c, 0xa610, 0xa62b, 0xa640, 0xa66e, 0xa674, 0xa67b, 0xa67f, 0xa6ef, 0xa717, 0xa71f, 0xa722, 0xa788, 0xa78b, 0xa7cd, 0xa7d0, 0xa7d1, 0xa7d3, 0xa7d3, 0xa7d5, 0xa7dc, 0xa7f2, 0xa805, 0xa807, 0xa827, 0xa840, 0xa873, 0xa880, 0xa8c3, 0xa8c5, 0xa8c5, 0xa8d0, 0xa8d9, 0xa8f2, 0xa8f7, 0xa8fb, 0xa8fb, 0xa8fd, 0xa92a, 0xa930, 0xa952, 0xa960, 0xa97c, 0xa980, 0xa9b2, 0xa9b4, 0xa9bf, 0xa9cf, 0xa9d9, 0xa9e0, 0xa9fe, 0xaa00, 0xaa36, 0xaa40, 0xaa4d, 0xaa50, 0xaa59, 0xaa60, 0xaa76, 0xaa7a, 0xaabe, 0xaac0, 0xaac0, 0xaac2, 0xaac2, 0xaadb, 0xaadd, 0xaae0, 0xaaef, 0xaaf2, 0xaaf5, 0xab01, 0xab06, 0xab09, 0xab0e, 0xab11, 0xab16, 0xab20, 0xab26, 0xab28, 0xab2e, 0xab30, 0xab5a, 0xab5c, 0xab69, 0xab70, 0xabea, 0xabf0, 0xabf9, 0xac00, 0xd7a3, 0xd7b0, 0xd7c6, 0xd7cb, 0xd7fb, 0xf900, 0xfa6d, 0xfa70, 0xfad9, 0xfb00, 0xfb06, 0xfb13, 0xfb17, 0xfb1d, 0xfb28, 0xfb2a, 0xfb36, 0xfb38, 0xfb3c, 0xfb3e, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfb46, 0xfbb1, 0xfbd3, 0xfd3d, 0xfd50, 0xfd8f, 0xfd92, 0xfdc7, 0xfdf0, 0xfdfb, 0xfe70, 0xfe74, 0xfe76, 0xfefc, 0xff10, 0xff19, 0xff21, 0xff3a, 0xff41, 0xff5a, 0xff66, 0xffbe, 0xffc2, 0xffc7, 0xffca, 0xffcf, 0xffd2, 0xffd7, 0xffda, 0xffdc, 0x10000, 0x1000b, 0x1000d, 0x10026, 0x10028, 0x1003a, 0x1003c, 0x1003d, 0x1003f, 0x1004d, 0x10050, 0x1005d, 0x10080, 0x100fa, 0x10140, 0x10174, 0x10280, 0x1029c, 0x102a0, 0x102d0, 0x10300, 0x1031f, 0x1032d, 0x1034a, 0x10350, 0x1037a, 0x10380, 0x1039d, 0x103a0, 0x103c3, 0x103c8, 0x103cf, 0x103d1, 0x103d5, 0x10400, 0x1049d, 0x104a0, 0x104a9, 0x104b0, 0x104d3, 0x104d8, 0x104fb, 0x10500, 0x10527, 0x10530, 0x10563, 0x10570, 0x1057a, 0x1057c, 0x1058a, 0x1058c, 0x10592, 0x10594, 0x10595, 0x10597, 0x105a1, 0x105a3, 0x105b1, 0x105b3, 0x105b9, 0x105bb, 0x105bc, 0x105c0, 0x105f3, 0x10600, 0x10736, 0x10740, 0x10755, 0x10760, 0x10767, 0x10780, 0x10785, 0x10787, 0x107b0, 0x107b2, 0x107ba, 0x10800, 0x10805, 0x10808, 0x10808, 0x1080a, 0x10835, 0x10837, 0x10838, 0x1083c, 0x1083c, 0x1083f, 0x10855, 0x10860, 0x10876, 0x10880, 0x1089e, 0x108e0, 0x108f2, 0x108f4, 0x108f5, 0x10900, 0x10915, 0x10920, 0x10939, 0x10980, 0x109b7, 0x109be, 0x109bf, 0x10a00, 0x10a03, 0x10a05, 0x10a06, 0x10a0c, 0x10a13, 0x10a15, 0x10a17, 0x10a19, 0x10a35, 0x10a60, 0x10a7c, 0x10a80, 0x10a9c, 0x10ac0, 0x10ac7, 0x10ac9, 0x10ae4, 0x10b00, 0x10b35, 0x10b40, 0x10b55, 0x10b60, 0x10b72, 0x10b80, 0x10b91, 0x10c00, 0x10c48, 0x10c80, 0x10cb2, 0x10cc0, 0x10cf2, 0x10d00, 0x10d27, 0x10d30, 0x10d39, 0x10d40, 0x10d65, 0x10d69, 0x10d69, 0x10d6f, 0x10d85, 0x10e80, 0x10ea9, 0x10eab, 0x10eac, 0x10eb0, 0x10eb1, 0x10ec2, 0x10ec4, 0x10efc, 0x10efc, 0x10f00, 0x10f1c, 0x10f27, 0x10f27, 0x10f30, 0x10f45, 0x10f70, 0x10f81, 0x10fb0, 0x10fc4, 0x10fe0, 0x10ff6, 0x11000, 0x11045, 0x11066, 0x1106f, 0x11071, 0x11075, 0x11080, 0x110b8, 0x110c2, 0x110c2, 0x110d0, 0x110e8, 0x110f0, 0x110f9, 0x11100, 0x11132, 0x11136, 0x1113f, 0x11144, 0x11147, 0x11150, 0x11172, 0x11176, 0x11176, 0x11180, 0x111bf, 0x111c1, 0x111c4, 0x111ce, 0x111da, 0x111dc, 0x111dc, 0x11200, 0x11211, 0x11213, 0x11234, 0x11237, 0x11237, 0x1123e, 0x11241, 0x11280, 0x11286, 0x11288, 0x11288, 0x1128a, 0x1128d, 0x1128f, 0x1129d, 0x1129f, 0x112a8, 0x112b0, 0x112e8, 0x112f0, 0x112f9, 0x11300, 0x11303, 0x11305, 0x1130c, 0x1130f, 0x11310, 0x11313, 0x11328, 0x1132a, 0x11330, 0x11332, 0x11333, 0x11335, 0x11339, 0x1133d, 0x11344, 0x11347, 0x11348, 0x1134b, 0x1134c, 0x11350, 0x11350, 0x11357, 0x11357, 0x1135d, 0x11363, 0x11380, 0x11389, 0x1138b, 0x1138b, 0x1138e, 0x1138e, 0x11390, 0x113b5, 0x113b7, 0x113c0, 0x113c2, 0x113c2, 0x113c5, 0x113c5, 0x113c7, 0x113ca, 0x113cc, 0x113cd, 0x113d1, 0x113d1, 0x113d3, 0x113d3, 0x11400, 0x11441, 0x11443, 0x11445, 0x11447, 0x1144a, 0x11450, 0x11459, 0x1145f, 0x11461, 0x11480, 0x114c1, 0x114c4, 0x114c5, 0x114c7, 0x114c7, 0x114d0, 0x114d9, 0x11580, 0x115b5, 0x115b8, 0x115be, 0x115d8, 0x115dd, 0x11600, 0x1163e, 0x11640, 0x11640, 0x11644, 0x11644, 0x11650, 0x11659, 0x11680, 0x116b5, 0x116b8, 0x116b8, 0x116c0, 0x116c9, 0x116d0, 0x116e3, 0x11700, 0x1171a, 0x1171d, 0x1172a, 0x11730, 0x11739, 0x11740, 0x11746, 0x11800, 0x11838, 0x118a0, 0x118e9, 0x118ff, 0x11906, 0x11909, 0x11909, 0x1190c, 0x11913, 0x11915, 0x11916, 0x11918, 0x11935, 0x11937, 0x11938, 0x1193b, 0x1193c, 0x1193f, 0x11942, 0x11950, 0x11959, 0x119a0, 0x119a7, 0x119aa, 0x119d7, 0x119da, 0x119df, 0x119e1, 0x119e1, 0x119e3, 0x119e4, 0x11a00, 0x11a32, 0x11a35, 0x11a3e, 0x11a50, 0x11a97, 0x11a9d, 0x11a9d, 0x11ab0, 0x11af8, 0x11bc0, 0x11be0, 0x11bf0, 0x11bf9, 0x11c00, 0x11c08, 0x11c0a, 0x11c36, 0x11c38, 0x11c3e, 0x11c40, 0x11c40, 0x11c50, 0x11c59, 0x11c72, 0x11c8f, 0x11c92, 0x11ca7, 0x11ca9, 0x11cb6, 0x11d00, 0x11d06, 0x11d08, 0x11d09, 0x11d0b, 0x11d36, 0x11d3a, 0x11d3a, 0x11d3c, 0x11d3d, 0x11d3f, 0x11d41, 0x11d43, 0x11d43, 0x11d46, 0x11d47, 0x11d50, 0x11d59, 0x11d60, 0x11d65, 0x11d67, 0x11d68, 0x11d6a, 0x11d8e, 0x11d90, 0x11d91, 0x11d93, 0x11d96, 0x11d98, 0x11d98, 0x11da0, 0x11da9, 0x11ee0, 0x11ef6, 0x11f00, 0x11f10, 0x11f12, 0x11f3a, 0x11f3e, 0x11f40, 0x11f50, 0x11f59, 0x11fb0, 0x11fb0, 0x12000, 0x12399, 0x12400, 0x1246e, 0x12480, 0x12543, 0x12f90, 0x12ff0, 0x13000, 0x1342f, 0x13441, 0x13446, 0x13460, 0x143fa, 0x14400, 0x14646, 0x16100, 0x1612e, 0x16130, 0x16139, 0x16800, 0x16a38, 0x16a40, 0x16a5e, 0x16a60, 0x16a69, 0x16a70, 0x16abe, 0x16ac0, 0x16ac9, 0x16ad0, 0x16aed, 0x16b00, 0x16b2f, 0x16b40, 0x16b43, 0x16b50, 0x16b59, 0x16b63, 0x16b77, 0x16b7d, 0x16b8f, 0x16d40, 0x16d6c, 0x16d70, 0x16d79, 0x16e40, 0x16e7f, 0x16f00, 0x16f4a, 0x16f4f, 0x16f87, 0x16f8f, 0x16f9f, 0x16fe0, 0x16fe1, 0x16fe3, 0x16fe3, 0x16ff0, 0x16ff1, 0x17000, 0x187f7, 0x18800, 0x18cd5, 0x18cff, 0x18d08, 0x1aff0, 0x1aff3, 0x1aff5, 0x1affb, 0x1affd, 0x1affe, 0x1b000, 0x1b122, 0x1b132, 0x1b132, 0x1b150, 0x1b152, 0x1b155, 0x1b155, 0x1b164, 0x1b167, 0x1b170, 0x1b2fb, 0x1bc00, 0x1bc6a, 0x1bc70, 0x1bc7c, 0x1bc80, 0x1bc88, 0x1bc90, 0x1bc99, 0x1bc9e, 0x1bc9e, 0x1ccf0, 0x1ccf9, 0x1d400, 0x1d454, 0x1d456, 0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4a9, 0x1d4ac, 0x1d4ae, 0x1d4b9, 0x1d4bb, 0x1d4bb, 0x1d4bd, 0x1d4c3, 0x1d4c5, 0x1d505, 0x1d507, 0x1d50a, 0x1d50d, 0x1d514, 0x1d516, 0x1d51c, 0x1d51e, 0x1d539, 0x1d53b, 0x1d53e, 0x1d540, 0x1d544, 0x1d546, 0x1d546, 0x1d54a, 0x1d550, 0x1d552, 0x1d6a5, 0x1d6a8, 0x1d6c0, 0x1d6c2, 0x1d6da, 0x1d6dc, 0x1d6fa, 0x1d6fc, 0x1d714, 0x1d716, 0x1d734, 0x1d736, 0x1d74e, 0x1d750, 0x1d76e, 0x1d770, 0x1d788, 0x1d78a, 0x1d7a8, 0x1d7aa, 0x1d7c2, 0x1d7c4, 0x1d7cb, 0x1d7ce, 0x1d7ff, 0x1df00, 0x1df1e, 0x1df25, 0x1df2a, 0x1e000, 0x1e006, 0x1e008, 0x1e018, 0x1e01b, 0x1e021, 0x1e023, 0x1e024, 0x1e026, 0x1e02a, 0x1e030, 0x1e06d, 0x1e08f, 0x1e08f, 0x1e100, 0x1e12c, 0x1e137, 0x1e13d, 0x1e140, 0x1e149, 0x1e14e, 0x1e14e, 0x1e290, 0x1e2ad, 0x1e2c0, 0x1e2eb, 0x1e2f0, 0x1e2f9, 0x1e4d0, 0x1e4eb, 0x1e4f0, 0x1e4f9, 0x1e5d0, 0x1e5ed, 0x1e5f0, 0x1e5fa, 0x1e7e0, 0x1e7e6, 0x1e7e8, 0x1e7eb, 0x1e7ed, 0x1e7ee, 0x1e7f0, 0x1e7fe, 0x1e800, 0x1e8c4, 0x1e900, 0x1e943, 0x1e947, 0x1e947, 0x1e94b, 0x1e94b, 0x1e950, 0x1e959, 0x1ee00, 0x1ee03, 0x1ee05, 0x1ee1f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee24, 0x1ee27, 0x1ee27, 0x1ee29, 0x1ee32, 0x1ee34, 0x1ee37, 0x1ee39, 0x1ee39, 0x1ee3b, 0x1ee3b, 0x1ee42, 0x1ee42, 0x1ee47, 0x1ee47, 0x1ee49, 0x1ee49, 0x1ee4b, 0x1ee4b, 0x1ee4d, 0x1ee4f, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee54, 0x1ee57, 0x1ee57, 0x1ee59, 0x1ee59, 0x1ee5b, 0x1ee5b, 0x1ee5d, 0x1ee5d, 0x1ee5f, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee64, 0x1ee67, 0x1ee6a, 0x1ee6c, 0x1ee72, 0x1ee74, 0x1ee77, 0x1ee79, 0x1ee7c, 0x1ee7e, 0x1ee7e, 0x1ee80, 0x1ee89, 0x1ee8b, 0x1ee9b, 0x1eea1, 0x1eea3, 0x1eea5, 0x1eea9, 0x1eeab, 0x1eebb, 0x1f130, 0x1f149, 0x1f150, 0x1f169, 0x1f170, 0x1f189, 0x1fbf0, 0x1fbf9, 0x20000, 0x2a6df, 0x2a700, 0x2b739, 0x2b740, 0x2b81d, 0x2b820, 0x2cea1, 0x2ceb0, 0x2ebe0, 0x2ebf0, 0x2ee5d, 0x2f800, 0x2fa1d, 0x30000, 0x3134a, 0x31350, 0x323af, }; /* END of CR_Alnum */ /* PROPERTY: 'ASCII': POSIX [[:ASCII:]] */ static const OnigCodePoint CR_ASCII[] = { 1, 0x0000, 0x007f, }; /* END of CR_ASCII */ static const OnigCodePoint* const CodeRanges[] = { CR_NEWLINE, CR_Alpha, CR_Blank, CR_Cntrl, CR_Digit, CR_Graph, CR_Lower, CR_Print, CR_PosixPunct, CR_Space, CR_Upper, CR_XDigit, CR_Word, CR_Alnum, CR_ASCII, }; #define pool_offset(s) offsetof(struct unicode_prop_name_pool_t, unicode_prop_name_pool_str##s) #define TOTAL_KEYWORDS 15 #define MIN_WORD_LENGTH 4 #define MAX_WORD_LENGTH 10 #define MIN_HASH_VALUE 5 #define MAX_HASH_VALUE 19 /* maximum key range = 15, duplicates = 0 */ #ifndef GPERF_DOWNCASE #define GPERF_DOWNCASE 1 static unsigned char gperf_downcase[256] = { 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, 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, 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 }; #endif #ifndef GPERF_CASE_STRNCMP #define GPERF_CASE_STRNCMP 1 static int gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n) { for (; n > 0;) { unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; if (c1 != 0 && c1 == c2) { n--; continue; } return (int)c1 - (int)c2; } return 0; } #endif #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 14, 8, 1, 20, 20, 12, 20, 1, 20, 20, 10, 20, 4, 20, 1, 20, 10, 0, 1, 4, 20, 1, 1, 20, 20, 20, 20, 20, 20, 20, 20, 0, 14, 8, 1, 20, 20, 12, 20, 1, 20, 20, 10, 20, 4, 20, 1, 20, 10, 0, 1, 4, 20, 1, 1, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 }; return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]]; } struct unicode_prop_name_pool_t { char unicode_prop_name_pool_str5[sizeof("space")]; char unicode_prop_name_pool_str6[sizeof("alpha")]; char unicode_prop_name_pool_str7[sizeof("print")]; char unicode_prop_name_pool_str8[sizeof("xdigit")]; char unicode_prop_name_pool_str9[sizeof("alnum")]; char unicode_prop_name_pool_str10[sizeof("upper")]; char unicode_prop_name_pool_str11[sizeof("posixpunct")]; char unicode_prop_name_pool_str12[sizeof("newline")]; char unicode_prop_name_pool_str13[sizeof("ascii")]; char unicode_prop_name_pool_str14[sizeof("cntrl")]; char unicode_prop_name_pool_str15[sizeof("word")]; char unicode_prop_name_pool_str16[sizeof("lower")]; char unicode_prop_name_pool_str17[sizeof("graph")]; char unicode_prop_name_pool_str18[sizeof("digit")]; char unicode_prop_name_pool_str19[sizeof("blank")]; }; static const struct unicode_prop_name_pool_t unicode_prop_name_pool_contents = { "space", "alpha", "print", "xdigit", "alnum", "upper", "posixpunct", "newline", "ascii", "cntrl", "word", "lower", "graph", "digit", "blank" }; #define unicode_prop_name_pool ((const char *) &unicode_prop_name_pool_contents) static const struct PoolPropertyNameCtype * unicode_lookup_property_name (register const char *str, register size_t len) { static const struct PoolPropertyNameCtype wordlist[] = { {-1}, {-1}, {-1}, {-1}, {-1}, {pool_offset(5), 9}, {pool_offset(6), 1}, {pool_offset(7), 7}, {pool_offset(8), 11}, {pool_offset(9), 13}, {pool_offset(10), 10}, {pool_offset(11), 8}, {pool_offset(12), 0}, {pool_offset(13), 14}, {pool_offset(14), 3}, {pool_offset(15), 12}, {pool_offset(16), 6}, {pool_offset(17), 5}, {pool_offset(18), 4}, {pool_offset(19), 2} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash (str, len); if (key <= MAX_HASH_VALUE) { register int o = wordlist[key].name; if (o >= 0) { register const char *s = o + unicode_prop_name_pool; if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0') return &wordlist[key]; } } } return 0; } #define PROPERTY_NAME_MAX_SIZE 20 #define CODE_RANGES_NUM 15 #define PROP_INDEX_NEWLINE 0 #define PROP_INDEX_ALPHA 1 #define PROP_INDEX_BLANK 2 #define PROP_INDEX_CNTRL 3 #define PROP_INDEX_DIGIT 4 #define PROP_INDEX_GRAPH 5 #define PROP_INDEX_LOWER 6 #define PROP_INDEX_PRINT 7 #define PROP_INDEX_POSIXPUNCT 8 #define PROP_INDEX_SPACE 9 #define PROP_INDEX_UPPER 10 #define PROP_INDEX_XDIGIT 11 #define PROP_INDEX_WORD 12 #define PROP_INDEX_ALNUM 13 #define PROP_INDEX_ASCII 14 jq-1.8.2/vendor/oniguruma/src/onig_init.c0000644000175100017510000000343015215513537014043 /********************************************************************** onig_init.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2016-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" /* onig_init(): deprecated function */ extern int onig_init(void) { #if 0 OnigEncoding encs[] = { ONIG_ENCODING_UTF8 }; return onig_initialize(encs, sizeof(encs)/sizeof(encs[0])); #else return onig_initialize(0, 0); #endif } jq-1.8.2/vendor/oniguruma/src/koi8.c0000644000175100017510000002153115215513537012740 /********************************************************************** koi8.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_KOI8_TO_LOWER_CASE(c) EncKOI8_ToLowerCaseTable[c] #define ENC_IS_KOI8_CTYPE(code,ctype) \ ((EncKOI8_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncKOI8_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337' }; static const unsigned short EncKOI8_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2 }; static int koi8_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_KOI8_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int koi8_is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_KOI8_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe }, { 0xdf, 0xff }, { 0xe0, 0xc0 }, { 0xe1, 0xc1 }, { 0xe2, 0xc2 }, { 0xe3, 0xc3 }, { 0xe4, 0xc4 }, { 0xe5, 0xc5 }, { 0xe6, 0xc6 }, { 0xe7, 0xc7 }, { 0xe8, 0xc8 }, { 0xe9, 0xc9 }, { 0xea, 0xca }, { 0xeb, 0xcb }, { 0xec, 0xcc }, { 0xed, 0xcd }, { 0xee, 0xce }, { 0xef, 0xcf }, { 0xf0, 0xd0 }, { 0xf1, 0xd1 }, { 0xf2, 0xd2 }, { 0xf3, 0xd3 }, { 0xf4, 0xd4 }, { 0xf5, 0xd5 }, { 0xf6, 0xd6 }, { 0xf7, 0xd7 }, { 0xf8, 0xd8 }, { 0xf9, 0xd9 }, { 0xfa, 0xda }, { 0xfb, 0xdb }, { 0xfc, 0xdc }, { 0xfe, 0xde }, { 0xff, 0xdf } }; static int koi8_apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, f, arg); } static int koi8_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, p, end, items); } OnigEncodingType OnigEncodingKOI8 = { onigenc_single_byte_mbc_enc_len, "KOI8", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, koi8_mbc_case_fold, koi8_apply_all_case_fold, koi8_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, koi8_is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/unicode_fold1_key.c0000644000175100017510000006133315215513537015455 /* This file was converted by gperf_fold_key_conv.py from gperf output file. */ /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold1_key unicode_fold1_key.gperf */ /* Computed positions: -k'1-3' */ /* This gperf source file was generated by make_unicode_fold_data.py */ /*- * Copyright (c) 2017-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #define TOTAL_KEYWORDS 1423 #define MIN_WORD_LENGTH 3 #define MAX_WORD_LENGTH 3 #define MIN_HASH_VALUE 4 #define MAX_HASH_VALUE 1846 /* maximum key range = 1843, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif /*ARGSUSED*/ static unsigned int hash(OnigCodePoint codes[]) { static const unsigned short asso_values[] = { 4, 2, 15, 124, 1, 9, 1398, 671, 1395, 664, 1384, 84, 91, 75, 1529, 74, 99, 54, 1525, 26, 1379, 552, 1374, 431, 144, 50, 1517, 24, 250, 557, 0, 27, 1506, 262, 1505, 197, 131, 1310, 782, 350, 781, 32, 771, 588, 5, 95, 1079, 463, 770, 455, 1074, 1496, 824, 1495, 584, 1484, 762, 1465, 751, 1559, 1372, 1339, 1350, 1365, 1347, 732, 1062, 951, 551, 701, 543, 1334, 657, 1479, 743, 108, 724, 1549, 530, 7, 522, 252, 503, 1541, 484, 1540, 425, 1532, 709, 1232, 466, 1147, 666, 1138, 1041, 845, 1325, 36, 1317, 465, 65, 1526, 301, 690, 45, 1301, 401, 1450, 381, 1437, 25, 994, 636, 603, 591, 1281, 176, 997, 339, 1215, 446, 1009, 571, 1175, 616, 473, 623, 386, 414, 1394, 921, 1489, 1022, 612, 613, 173, 1002, 74, 308, 327, 1471, 291, 1434, 202, 908, 1, 147, 1847, 1426, 226, 1222, 73, 56, 1847, 1423, 48, 1294, 292, 1267, 14, 275, 315, 205, 410, 990, 4, 17, 6, 974, 382, 1255, 675, 1225, 26, 360, 1437, 886, 1268, 1189, 37, 863, 267, 1167, 1190, 963, 1178, 936, 1133, 603, 137, 933, 393, 897, 71, 853, 1427, 843, 1161, 831, 1111, 1165, 1128, 1156, 1140, 830, 686, 1155, 1125, 507, 1116, 1123, 818, 237, 1064, 576, 1046, 562, 1033, 196, 816, 167, 815, 155, 793, 136, 131, 76, 795, 85, 1112, 124, 1110, 116, 285, 232, 1026, 188, 1383, 371, 1087, 350, 1045, 333, 1359, 812, 354, 270, 407, 801, 99, 565, 555, 1104, 128, 1097, 31, 1419, 130, 1414 }; return asso_values[(unsigned char)onig_codes_byte_at(codes, 2)+3] + asso_values[(unsigned char)onig_codes_byte_at(codes, 1)] + asso_values[(unsigned char)onig_codes_byte_at(codes, 0)]; } int onigenc_unicode_fold1_key(OnigCodePoint codes[]) { static const short int wordlist[] = { -1, -1, -1, -1, 1915, 1876, 210, 171, 3453, 1936, 3558, 231, 993, 1321, 1282, 3153, 2669, 3714, 1342, 544, 505, 2105, 1141, 390, 562, 3693, 2804, 3309, 3711, 2036, 1069, 324, 2249, 27, 1612, 3249, 1618, 3732, 1384, 159, 2252, 1047, 3405, 402, 664, 2723, 3096, 1615, 3750, 2027, 1060, 315, 4131, 12, 2732, 3240, 1636, 2270, 1366, 3681, 2099, 1120, 372, 2306, 649, 2783, 3087, 1654, 2432, 2020, 1053, 309, 4113, 0, 2729, 3234, 2381, 3132, 1354, 3591, 2195, 1231, 459, 3288, 640, 2894, 3081, 1465, 3597, 2198, 1234, 462, 4101, 80, 2897, 1888, 2369, 183, 3456, 2993, 2915, 1696, 3660, 1894, 1294, 189, 1795, 144, 2918, 3366, 517, 3546, 1300, 980, 273, 1801, 2447, 2657, 523, 3609, 2204, 1240, 468, 2984, 92, 2960, 2996, 3603, 2201, 1237, 465, 3672, 86, 2900, 3588, 1924, 153, 219, 165, 3585, 2192, 1228, 456, 3393, 1330, 2891, 1813, 2450, 1906, 2978, 201, 2090, 1111, 2954, 1807, 2246, 2774, 1312, 3579, 2189, 1225, 1792, 2291, 535, 2888, 3363, 1789, 1684, 3123, 3876, 3573, 2186, 1222, 2948, 2942, 2285, 2885, 3360, 3882, 1513, 2045, 1078, 333, 2936, 46, 1783, 1459, -1, 1519, 1402, 2939, 3621, 2210, 1246, 474, 673, 105, 1777, 2951, 798, 2183, 1219, 1582, 4149, 863, 2882, 3357, 2393, 366, 3894, 1135, 2552, 3279, 866, 2798, 3303, 3702, 3888, 1825, 1531, 2558, 709, 4095, 2912, 3873, -1, 1771, 1525, 2288, 3870, 3011, 1594, 369, 1600, 1510, 3615, 2207, 1243, 471, 1507, 99, 2174, 1210, 2975, 872, 712, 2873, 3354, 3864, -1, 3996, 2570, 869, 3939, 1912, 3564, 207, 999, 1501, 2564, 3858, 2675, 1819, 1318, 860, 784, 2549, 1753, 2441, 541, 1495, 2546, -1, 3651, 2225, 1261, 486, 4092, 135, 2909, 1132, 3906, 4089, 857, 2795, 3300, 3696, 3411, 3612, 3852, 2540, 1543, 4215, 96, 715, 854, 3008, 1660, 378, 1489, 1855, 4083, 2534, 3687, 721, 2024, 1056, 312, -1, 6, 703, 3237, 2078, 4077, 1360, 1816, 878, 2762, 3276, 4206, 643, 384, 3084, 2582, 851, 3900, 3699, 694, 4107, 3111, 3834, 2528, 2375, 363, 718, 1537, 3639, 2219, 1255, 483, 1471, 123, 4071, 2048, 1081, 336, 697, 52, 2747, 2987, -1, -1, 1408, 3633, 2216, 1252, 480, 3648, 117, -1, 875, 3002, 132, 1843, 2117, 1153, 4155, 2576, -1, 2816, 2399, 3735, 2510, 1573, 3627, 2213, 1249, 477, 3897, 111, 1837, 2300, 4218, 4053, 1852, 2033, 1066, 321, 1534, 4296, 1639, 3246, 348, 3720, 1378, 754, 3261, -1, 893, 1435, 658, 1831, 3093, -1, 3780, 2030, 1063, 318, 4125, 18, 3654, 3243, 1624, 4182, 1372, 138, 3945, 2426, 2063, 1096, 2573, 3705, 3090, 1690, -1, -1, 3924, 1438, 4119, 1999, 1014, 288, 2387, 682, 2690, 3213, 1561, 1858, -1, 2504, 1606, 4185, 2459, 3918, 616, 2429, 3060, 3933, -1, 3020, 2051, 1084, 339, 1555, 59, -1, 2357, 1570, 3468, 1414, 3426, 887, 2282, 3972, 3912, 679, 3462, 724, -1, -1, 2005, 1026, 294, 4161, 1549, 2702, 3219, 2405, 884, 345, -1, 74, 890, 3258, 637, 625, 1429, 3066, 1996, 1008, 285, 3975, 4098, 2684, 3210, -1, 2366, 2363, -1, 881, 4176, 3438, -1, 610, 2420, 3057, 3567, 1993, 1002, 282, 1576, 2168, 2678, 3207, 733, 2354, 2867, 3351, 2453, 3420, -1, 791, 604, 3951, 3054, 3561, 1990, 996, 279, -1, 2972, 2672, 3204, 3555, 1987, 990, 276, 1741, 3414, 2666, 3201, 601, 736, 3051, -1, 1864, 3531, 1975, 965, 598, 3966, 3047, 2642, 3189, 3525, 1972, 956, 3408, 3666, -1, 2636, 3186, 1873, 147, 3035, 3402, 2180, 1216, 3663, 2231, 1267, 2879, 3032, -1, 2345, 2054, 1087, 342, 3378, 65, 2177, 1213, 2339, 2276, 1420, 2876, 3372, 3483, 1951, 912, 243, 3450, 1765, 2594, 3165, 2042, 1075, 330, 4167, 40, 3822, 3255, 2411, 577, 1396, 2465, 1759, 2138, 1174, 411, 670, 37, 2837, 3327, 3774, 2321, 1393, 2072, 4143, 357, 2057, 1090, 2756, 3270, 71, 1453, 1456, 2060, 1093, 1426, 4140, 688, 691, 1681, 3105, 845, 1432, 4200, -1, -1, 2039, 1072, 327, 4173, 34, -1, 3252, 2417, 3957, 1390, 4179, 2966, 2492, 4041, 2423, 3846, 2990, 3099, 1588, -1, 3537, 1978, 971, 4137, -1, 1483, 2648, 3192, 1585, 3840, 2008, 1032, 297, -1, -1, 2708, 3222, -1, 3038, 1477, 2495, 396, -1, 896, -1, 628, 3726, 3069, 2351, 3990, 3993, 1198, 3384, 3963, -1, 2264, 3348, 2522, 9, 727, 3969, 3444, 2258, 1363, 3528, 1630, 960, 264, 4065, 646, 2639, 2516, 2471, 2002, 1020, 291, 1732, 4110, 2696, 3216, 589, 2378, 4059, -1, -1, -1, -1, 3549, 1984, 983, 3063, 779, 2342, 2660, 3198, 3516, 3375, 946, 258, 2486, 2360, 2627, 4230, 595, 3432, 3044, 3543, 1981, 977, -1, 4224, 730, 2654, 3195, 3495, 1957, 925, 249, -1, 3396, 2606, 3171, 592, 2930, 3041, 3489, 1954, 919, 246, -1, 2924, 2600, 3168, 3465, 1942, 1933, 237, 228, 3390, 3813, 3159, 3150, 2333, 1348, 1339, 1930, 1927, 225, 222, 568, 559, 3147, 3144, 2327, 1336, 1333, 3582, -1, 3594, 453, 556, 553, 2309, 77, 3657, 2228, 1264, 490, -1, 141, -1, -1, 2303, 2297, 836, 3645, 2222, 1258, 3576, 3570, 129, 450, 447, 1786, 435, 1798, 2444, 3477, 1948, 905, 4293, 1861, 4032, 2588, 2162, 2153, 424, 2477, 4287, 2861, 2852, 3342, 1849, 574, -1, 1780, 1774, 2150, 1750, 2438, 1041, -1, 2849, 3339, 2717, 2315, -1, 2147, 1183, 417, 1729, 1711, 2846, 3336, 634, -1, -1, 2126, 1162, 3029, 3026, 4245, 2825, 1705, 3753, 4212, -1, -1, -1, -1, 3023, 3017, 2483, 1699, -1, -1, 3867, -1, 3879, 2489, 2120, 1156, 399, 1657, 2435, 2819, 1504, 3741, 1516, -1, -1, 2144, 1180, 414, 1579, 3930, 2843, 3333, 3861, 3855, -1, 3831, 2087, 1108, -1, 1567, 1645, 2771, 1498, 1492, -1, 1468, -1, 3810, 3792, 2066, 1099, 1693, 2543, 3120, 2555, 3264, -1, -1, 1444, -1, 3786, 2141, 1177, 4086, 2135, 1171, 2840, 3330, 3777, 2834, 3324, 3768, 4191, -1, 2537, 2531, -1, 2507, 3522, -1, 953, 261, 832, 812, 2633, 4080, 4074, 1687, 4050, -1, 1675, 2132, 1168, -1, 586, 808, 2831, 3321, 3762, 1870, 4029, 4011, 2108, 1144, 393, 801, 2336, 2807, 3312, 3717, -1, -1, 4290, 4005, -1, 751, -1, 1669, 2102, 1138, 387, -1, 3981, 2801, 3306, 3708, 31, 2744, 1621, 49, 2075, 1387, 360, -1, 1405, 2759, 3273, 667, 742, 1462, 676, 62, 2750, 4278, 1609, 4134, 1417, 3108, 4152, 795, 2069, 1102, 2396, 3618, -1, 2753, 3267, -1, 102, 1450, 4164, -1, 4257, 444, 2408, -1, -1, 3102, -1, 2011, 1038, 300, 3636, 4251, 2714, 3225, 441, 120, 2906, -1, 1822, 4227, 4209, -1, 631, 788, 3072, 1768, 771, 3519, 1969, 950, 4203, 4197, 438, 2630, 3183, -1, 3942, 1840, 1762, 3471, 1945, 3999, 240, 583, 3459, 1939, 3162, 234, 3954, 1351, -1, 3156, 3630, 764, 1345, 571, 1756, 114, 2903, -1, 565, 3987, 3675, 2237, 1273, 496, 3369, 156, -1, 3669, 2234, 1270, 493, 4239, 150, 3606, -1, 3600, 1189, 1834, 89, 3903, 83, 1204, 432, -1, -1, -1, 3849, 2171, 1207, 1540, 1201, 428, 2870, 1192, 420, -1, 1486, -1, 3921, 3843, 1810, 1714, 1804, 1035, 3771, 1195, 1744, 2711, 1558, 1480, 3345, -1, 1029, 1747, -1, 1738, 2705, 3837, 1720, 2165, 2159, 2579, -1, 1678, 2864, 2858, 1186, 1474, 2525, 2156, 1726, 2129, 1165, 3447, 2855, -1, 2828, 1867, 3756, 4068, 3915, 2519, 3441, 68, 408, 1735, 1723, 2501, 1423, 3765, 1552, 1708, 4062, 2123, 1159, 1717, 405, 1663, 2822, 2513, 3747, 3759, 4170, 3891, 3795, 3885, 2414, 1591, 1672, 3825, 4056, -1, -1, 1528, -1, 1522, 3828, -1, 3819, 1651, 1666, 3801, -1, 56, -1, 899, 2096, 1117, 1411, 2114, 1150, 2780, 3285, 3807, 2813, 3318, 3729, 1023, 4284, 816, -1, 2699, 4158, 3129, 848, 2567, 2402, 2561, 3816, 3804, -1, 622, 3960, 842, 3789, 1633, 822, 4014, 3798, 2111, 1147, 774, 4044, 2462, 2810, 3315, 3723, 3435, 829, 4047, -1, 4038, 1129, 381, 4020, 2474, 2792, 3297, 3690, 3744, -1, -1, -1, 839, 826, 1627, 4026, -1, 3141, 43, -1, -1, 3948, 819, 1399, 758, -1, -1, 1648, 1126, 375, 4035, 4023, 2789, 3294, 3684, 768, 4008, 4146, 15, 2735, 4017, 2390, -1, 1369, 3138, -1, 748, 761, -1, 652, 2017, 1050, 306, -1, -1, 2726, 3231, 4116, 2014, 1044, 303, 2384, -1, 2720, 3228, -1, 3534, 3078, 968, 267, 2294, 3504, 2645, 934, 252, 3075, -1, 2615, 4281, 3513, 1966, 943, 3507, 1963, 937, 2624, 3180, 3936, 2618, 3177, 4233, 3642, -1, -1, 2348, 4221, 126, 3510, 3381, 940, 255, -1, -1, 2621, 3501, 1960, 931, 1903, -1, 198, 2612, 3174, 1900, 580, 195, 3624, 1309, 1885, 1846, 180, 108, 1306, 532, -1, -1, 745, 1291, 529, 1882, 351, 177, 1879, 514, 174, 2279, -1, 1441, 1288, 3014, 2273, 1285, -1, 1828, 511, 2267, -1, 508, 2243, 1279, 502, 4188, 168, 2240, 1276, 499, 2261, 162, 1123, 2255, 2093, 1114, 2786, 3291, 3678, 2777, 3282, -1, 2084, 1105, -1, 2480, -1, 2768, 3135, 24, 2741, 3126, 3738, -1, 1381, -1, 3927, 706, -1, 3117, 661, 1702, 21, 2738, -1, -1, 1564, 1375, 4128, -1, -1, 1642, 3492, 655, 922, 3978, -1, 2969, 2603, 2081, 3909, 4122, 2963, -1, 2765, 2468, 3540, 2933, 974, 270, 1546, 3486, 2651, 915, 700, -1, 3114, 2597, 2927, 354, 2330, 2921, 3480, 3474, 908, 902, 1447, -1, 2591, 2585, -1, -1, 685, 1921, 1918, 216, 213, -1, 3387, 2324, -1, 1603, 1327, 1324, 3783, 1909, 1597, 204, 550, 547, 2318, 2312, -1, 1897, 1315, 192, -1, 1891, 3, 186, 538, 1017, 1303, 1357, -1, 2693, 1297, -1, 526, 1011, 1005, 2456, 520, 2687, 2681, 619, 3552, 4104, 986, 804, -1, 2372, 2663, 613, 607, -1, 3498, -1, 928, 739, 3984, 3429, 2609, -1, -1, -1, -1, 4002, -1, 3423, 3417, -1, -1, -1, -1, -1, -1, -1, 3399, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4194, -1, -1, -1, -1, -1, -1, 3005, 2999, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2981, -1, -1, -1, -1, -1, -1, -1, 2957, -1, 4266, -1, 2945, -1, -1, -1, -1, -1, 4275, -1, -1, 4269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4272, -1, -1, -1, -1, -1, -1, 4263, 2498, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4254, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4248, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4242, 4236, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4260 }; { int key = hash(codes); if (key <= MAX_HASH_VALUE) { int index = wordlist[key]; if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds1 + index, 1) == 0) return index; } } return -1; } jq-1.8.2/vendor/oniguruma/src/sjis.c0000644000175100017510000002001115215513537013026 /********************************************************************** sjis.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" static const int EncLen_SJIS[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }; static const char SJIS_CAN_BE_TRAIL_TABLE[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 }; #define SJIS_ISMB_FIRST(byte) (EncLen_SJIS[byte] > 1) #define SJIS_ISMB_TRAIL(byte) SJIS_CAN_BE_TRAIL_TABLE[(byte)] static int mbc_enc_len(const UChar* p) { return EncLen_SJIS[*p]; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { while (p < end) { if (*p < 0x80) { p++; } else if (*p < 0xa1) { if (*p == 0xa0 || *p == 0x80) return FALSE; p++; if (p >= end) return FALSE; if (*p < 0x40 || *p > 0xfc || *p == 0x7f) return FALSE; p++; } else if (*p < 0xe0) { p++; } else if (*p < 0xfd) { p++; if (p >= end) return FALSE; if (*p < 0x40 || *p > 0xfc || *p == 0x7f) return FALSE; p++; } else return FALSE; } return TRUE; } static int code_to_mbclen(OnigCodePoint code) { if (code < 256) { if (EncLen_SJIS[(int )code] == 1) return 1; } else if (code < 0x10000) { if (EncLen_SJIS[(int )(code >> 8) & 0xff] == 2) return 2; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static OnigCodePoint mbc_to_code(const UChar* p, const UChar* end) { int c, i, len; OnigCodePoint n; len = enclen(ONIG_ENCODING_SJIS, p); c = *p++; n = c; if (len == 1) return n; for (i = 1; i < len; i++) { if (p >= end) break; c = *p++; n <<= 8; n += c; } return n; } static int code_to_mbc(OnigCodePoint code, UChar *buf) { UChar *p = buf; if ((code & 0xff00) != 0) *p++ = (UChar )(((code >> 8) & 0xff)); *p++ = (UChar )(code & 0xff); return (int )(p - buf); } static int mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (ONIGENC_IS_MBC_ASCII(p)) { *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p); (*pp)++; return 1; } else { int i; int len = enclen(ONIG_ENCODING_SJIS, p); for (i = 0; i < len; i++) { *lower++ = *p++; } (*pp) += len; return len; /* return byte length of converted char to lower */ } } static UChar* left_adjust_char_head(const UChar* start, const UChar* s) { const UChar *p; int len; if (s <= start) return (UChar* )s; p = s; if (SJIS_ISMB_TRAIL(*p)) { while (p > start) { if (! SJIS_ISMB_FIRST(*--p)) { p++; break; } } } len = enclen(ONIG_ENCODING_SJIS, p); if (p + len > s) return (UChar* )p; p += len; return (UChar* )(p + ((s - p) & ~1)); } static int is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED) { const UChar c = *s; return (SJIS_ISMB_TRAIL(c) ? FALSE : TRUE); } static const OnigCodePoint CR_Hiragana[] = { 1, 0x829f, 0x82f1 }; /* CR_Hiragana */ static const OnigCodePoint CR_Katakana[] = { 4, 0x00a6, 0x00af, 0x00b1, 0x00dd, 0x8340, 0x837e, 0x8380, 0x8396, }; /* CR_Katakana */ static const OnigCodePoint* PropertyList[] = { CR_Hiragana, CR_Katakana }; static int property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end) { struct PropertyNameCtype* pc; int len = (int )(end - p); char q[32]; if (len < sizeof(q) - 1) { xmemcpy(q, p, (size_t )len); q[len] = '\0'; pc = onigenc_sjis_lookup_property_name(q, len); if (pc != 0) return pc->ctype; } return ONIGERR_INVALID_CHAR_PROPERTY_NAME; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (ctype <= ONIGENC_MAX_STD_CTYPE) { if (code < 128) return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); else { if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) { return (code_to_mbclen(code) > 1 ? TRUE : FALSE); } } } else { ctype -= (ONIGENC_MAX_STD_CTYPE + 1); if (ctype >= (unsigned int )(sizeof(PropertyList)/sizeof(PropertyList[0]))) return ONIGERR_TYPE_BUG; return onig_is_in_code_range((UChar* )PropertyList[ctype], code); } return FALSE; } static int get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]) { if (ctype <= ONIGENC_MAX_STD_CTYPE) { return ONIG_NO_SUPPORT_CONFIG; } else { *sb_out = 0x80; ctype -= (ONIGENC_MAX_STD_CTYPE + 1); if (ctype >= (OnigCtype )(sizeof(PropertyList)/sizeof(PropertyList[0]))) return ONIGERR_TYPE_BUG; *ranges = PropertyList[ctype]; return 0; } } OnigEncodingType OnigEncodingSJIS = { mbc_enc_len, "Shift_JIS", /* name */ 2, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, mbc_to_code, code_to_mbclen, code_to_mbc, mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, property_name_to_ctype, is_code_ctype, get_ctype_code_range, left_adjust_char_head, is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/euc_kr.c0000644000175100017510000001345215215513537013341 /********************************************************************** euc_kr.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" static const int EncLen_EUCKR[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; static int euckr_mbc_enc_len(const UChar* p) { return EncLen_EUCKR[*p]; } static int euckr_code_to_mbclen(OnigCodePoint code) { if ((code & (~0xffff)) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE; if ((code & 0xff00) != 0) { if (EncLen_EUCKR[(int )(code >> 8) & 0xff] == 2) return 2; } else { if (EncLen_EUCKR[(int )(code & 0xff)] == 1) return 1; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { while (p < end) { if (*p < 0x80) { p++; } else if (*p < 0xa1) { return FALSE; } else if (*p < 0xff) { p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p == 0xff) return FALSE; p++; } else return FALSE; } return TRUE; } static OnigCodePoint euckr_mbc_to_code(const UChar* p, const UChar* end) { return onigenc_mbn_mbc_to_code(ONIG_ENCODING_EUC_KR, p, end); } static int euckr_code_to_mbc(OnigCodePoint code, UChar *buf) { return onigenc_mb2_code_to_mbc(ONIG_ENCODING_EUC_KR, code, buf); } static int euckr_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* lower) { return onigenc_mbn_mbc_case_fold(ONIG_ENCODING_EUC_KR, flag, pp, end, lower); } static int euckr_is_code_ctype(OnigCodePoint code, unsigned int ctype) { return onigenc_mb2_is_code_ctype(ONIG_ENCODING_EUC_KR, code, ctype); } #define euckr_islead(c) ((c) < 0xa1 || (c) == 0xff) static UChar* euckr_left_adjust_char_head(const UChar* start, const UChar* s) { /* Assumed in this encoding, mb-trail bytes don't mix with single bytes. */ const UChar *p; int len; if (s <= start) return (UChar* )s; p = s; while (!euckr_islead(*p) && p > start) p--; len = enclen(ONIG_ENCODING_EUC_KR, p); if (p + len > s) return (UChar* )p; p += len; return (UChar* )(p + ((s - p) & ~1)); } static int euckr_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED) { const UChar c = *s; if (c <= 0x7e) return TRUE; else return FALSE; } OnigEncodingType OnigEncodingEUC_KR = { euckr_mbc_enc_len, "EUC-KR", /* name */ 2, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, euckr_mbc_to_code, euckr_code_to_mbclen, euckr_code_to_mbc, euckr_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, euckr_is_code_ctype, onigenc_not_support_get_ctype_code_range, euckr_left_adjust_char_head, euckr_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0, 0, 0 }; /* Same with OnigEncodingEUC_KR except the name */ OnigEncodingType OnigEncodingEUC_CN = { euckr_mbc_enc_len, "EUC-CN", /* name */ 2, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, euckr_mbc_to_code, euckr_code_to_mbclen, euckr_code_to_mbc, euckr_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, euckr_is_code_ctype, onigenc_not_support_get_ctype_code_range, euckr_left_adjust_char_head, euckr_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/big5.c0000644000175100017510000001377215215513537012724 /********************************************************************** big5.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" static const int EncLen_BIG5[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; static int big5_mbc_enc_len(const UChar* p) { return EncLen_BIG5[*p]; } static int big5_code_to_mbclen(OnigCodePoint code) { if ((code & (~0xffff)) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE; if ((code & 0xff00) != 0) { if (EncLen_BIG5[(int )(code >> 8) & 0xff] == 2) return 2; } else { if (EncLen_BIG5[(int )(code & 0xff)] == 1) return 1; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { while (p < end) { if (*p < 0x80) { p++; } else if (*p < 0xa1) { return FALSE; } else if (*p < 0xff) { p++; if (p >= end) return FALSE; if (*p < 0x40) return FALSE; if (*p > 0x7e && *p < 0xa1) return FALSE; if (*p == 0xff) return FALSE; p++; } else return FALSE; } return TRUE; } static OnigCodePoint big5_mbc_to_code(const UChar* p, const UChar* end) { return onigenc_mbn_mbc_to_code(ONIG_ENCODING_BIG5, p, end); } static int big5_code_to_mbc(OnigCodePoint code, UChar *buf) { return onigenc_mb2_code_to_mbc(ONIG_ENCODING_BIG5, code, buf); } static int big5_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* lower) { return onigenc_mbn_mbc_case_fold(ONIG_ENCODING_BIG5, flag, pp, end, lower); } static int big5_is_code_ctype(OnigCodePoint code, unsigned int ctype) { return onigenc_mb2_is_code_ctype(ONIG_ENCODING_BIG5, code, ctype); } static const char BIG5_CAN_BE_TRAIL_TABLE[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }; #define BIG5_ISMB_FIRST(byte) (EncLen_BIG5[byte] > 1) #define BIG5_ISMB_TRAIL(byte) BIG5_CAN_BE_TRAIL_TABLE[(byte)] static UChar* big5_left_adjust_char_head(const UChar* start, const UChar* s) { const UChar *p; int len; if (s <= start) return (UChar* )s; p = s; if (BIG5_ISMB_TRAIL(*p)) { while (p > start) { if (! BIG5_ISMB_FIRST(*--p)) { p++; break; } } } len = enclen(ONIG_ENCODING_BIG5, p); if (p + len > s) return (UChar* )p; p += len; return (UChar* )(p + ((s - p) & ~1)); } static int big5_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED) { const UChar c = *s; return (BIG5_ISMB_TRAIL(c) ? FALSE : TRUE); } OnigEncodingType OnigEncodingBIG5 = { big5_mbc_enc_len, "Big5", /* name */ 2, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, big5_mbc_to_code, big5_code_to_mbclen, big5_code_to_mbc, big5_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, big5_is_code_ctype, onigenc_not_support_get_ctype_code_range, big5_left_adjust_char_head, big5_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/oniguruma.h0000644000175100017510000014013515215513537014103 #ifndef ONIGURUMA_H #define ONIGURUMA_H /********************************************************************** oniguruma.h - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #ifdef __cplusplus extern "C" { #endif #define ONIGURUMA #define ONIGURUMA_VERSION_MAJOR 6 #define ONIGURUMA_VERSION_MINOR 9 #define ONIGURUMA_VERSION_TEENY 10 #define ONIGURUMA_VERSION_INT 60910 #ifndef P_ #if defined(__STDC__) || defined(_WIN32) # define P_(args) args #else # define P_(args) () #endif #endif #ifndef PV_ # define PV_(args) args #endif #ifndef ONIG_STATIC #ifndef ONIG_EXTERN #if defined(_WIN32) && !defined(__GNUC__) #if defined(ONIGURUMA_EXPORT) #define ONIG_EXTERN extern __declspec(dllexport) #else #define ONIG_EXTERN extern __declspec(dllimport) #endif #endif #endif #ifndef ONIG_EXTERN #define ONIG_EXTERN extern #endif #else #define ONIG_EXTERN extern #endif #ifndef ONIG_VARIADIC_FUNC_ATTR #define ONIG_VARIADIC_FUNC_ATTR #endif /* PART: character encoding */ #ifndef ONIG_ESCAPE_UCHAR_COLLISION #define UChar OnigUChar #endif typedef unsigned int OnigCodePoint; typedef unsigned char OnigUChar; typedef unsigned int OnigCtype; typedef unsigned int OnigLen; #define ONIG_INFINITE_DISTANCE ~((OnigLen )0) typedef unsigned int OnigCaseFoldType; /* case fold flag */ ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag; #define ONIGENC_CASE_FOLD_ASCII_ONLY (1) /* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA (1<<1) */ /* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH (1<<2) */ #define ONIGENC_CASE_FOLD_TURKISH_AZERI (1<<20) #define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR (1<<30) #define ONIGENC_CASE_FOLD_MIN INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR #define ONIGENC_CASE_FOLD_DEFAULT OnigDefaultCaseFoldFlag #define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN 3 #define ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM 13 /* 13 => Unicode:0x1ffc */ /* code range */ #define ONIGENC_CODE_RANGE_NUM(range) ((int )range[0]) #define ONIGENC_CODE_RANGE_FROM(range,i) range[((i)*2) + 1] #define ONIGENC_CODE_RANGE_TO(range,i) range[((i)*2) + 2] typedef struct { int byte_len; /* argument(original) character(s) byte length */ int code_len; /* number of code */ OnigCodePoint code[ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN]; } OnigCaseFoldCodeItem; typedef struct { OnigCodePoint esc; OnigCodePoint anychar; OnigCodePoint anytime; OnigCodePoint zero_or_one_time; OnigCodePoint one_or_more_time; OnigCodePoint anychar_anytime; } OnigMetaCharTableType; typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg); typedef struct OnigEncodingTypeST { int (*mbc_enc_len)(const OnigUChar* p); const char* name; int max_enc_len; int min_enc_len; int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end); OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end); int (*code_to_mbclen)(OnigCodePoint code); int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf); int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to); int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg); int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]); int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end); int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype); int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]); OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p); int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end); int (*init)(void); int (*is_initialized)(void); int (*is_valid_mbc_string)(const OnigUChar* s, const OnigUChar* end); unsigned int flag; OnigCodePoint sb_range; int index; } OnigEncodingType; typedef OnigEncodingType* OnigEncoding; ONIG_EXTERN OnigEncodingType OnigEncodingASCII; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_1; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_2; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_3; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_4; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_5; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_6; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_7; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_8; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_9; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_10; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_11; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_13; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_14; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_15; ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_16; ONIG_EXTERN OnigEncodingType OnigEncodingUTF8; ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_BE; ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_LE; ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_BE; ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_LE; ONIG_EXTERN OnigEncodingType OnigEncodingEUC_JP; ONIG_EXTERN OnigEncodingType OnigEncodingEUC_TW; ONIG_EXTERN OnigEncodingType OnigEncodingEUC_KR; ONIG_EXTERN OnigEncodingType OnigEncodingEUC_CN; ONIG_EXTERN OnigEncodingType OnigEncodingSJIS; ONIG_EXTERN OnigEncodingType OnigEncodingKOI8; ONIG_EXTERN OnigEncodingType OnigEncodingKOI8_R; ONIG_EXTERN OnigEncodingType OnigEncodingCP1251; ONIG_EXTERN OnigEncodingType OnigEncodingBIG5; ONIG_EXTERN OnigEncodingType OnigEncodingGB18030; #define ONIG_ENCODING_ASCII (&OnigEncodingASCII) #define ONIG_ENCODING_ISO_8859_1 (&OnigEncodingISO_8859_1) #define ONIG_ENCODING_ISO_8859_2 (&OnigEncodingISO_8859_2) #define ONIG_ENCODING_ISO_8859_3 (&OnigEncodingISO_8859_3) #define ONIG_ENCODING_ISO_8859_4 (&OnigEncodingISO_8859_4) #define ONIG_ENCODING_ISO_8859_5 (&OnigEncodingISO_8859_5) #define ONIG_ENCODING_ISO_8859_6 (&OnigEncodingISO_8859_6) #define ONIG_ENCODING_ISO_8859_7 (&OnigEncodingISO_8859_7) #define ONIG_ENCODING_ISO_8859_8 (&OnigEncodingISO_8859_8) #define ONIG_ENCODING_ISO_8859_9 (&OnigEncodingISO_8859_9) #define ONIG_ENCODING_ISO_8859_10 (&OnigEncodingISO_8859_10) #define ONIG_ENCODING_ISO_8859_11 (&OnigEncodingISO_8859_11) #define ONIG_ENCODING_ISO_8859_13 (&OnigEncodingISO_8859_13) #define ONIG_ENCODING_ISO_8859_14 (&OnigEncodingISO_8859_14) #define ONIG_ENCODING_ISO_8859_15 (&OnigEncodingISO_8859_15) #define ONIG_ENCODING_ISO_8859_16 (&OnigEncodingISO_8859_16) #define ONIG_ENCODING_UTF8 (&OnigEncodingUTF8) #define ONIG_ENCODING_UTF16_BE (&OnigEncodingUTF16_BE) #define ONIG_ENCODING_UTF16_LE (&OnigEncodingUTF16_LE) #define ONIG_ENCODING_UTF32_BE (&OnigEncodingUTF32_BE) #define ONIG_ENCODING_UTF32_LE (&OnigEncodingUTF32_LE) #define ONIG_ENCODING_EUC_JP (&OnigEncodingEUC_JP) #define ONIG_ENCODING_EUC_TW (&OnigEncodingEUC_TW) #define ONIG_ENCODING_EUC_KR (&OnigEncodingEUC_KR) #define ONIG_ENCODING_EUC_CN (&OnigEncodingEUC_CN) #define ONIG_ENCODING_SJIS (&OnigEncodingSJIS) #define ONIG_ENCODING_KOI8 (&OnigEncodingKOI8) #define ONIG_ENCODING_KOI8_R (&OnigEncodingKOI8_R) #define ONIG_ENCODING_CP1251 (&OnigEncodingCP1251) #define ONIG_ENCODING_BIG5 (&OnigEncodingBIG5) #define ONIG_ENCODING_GB18030 (&OnigEncodingGB18030) #define ONIG_ENCODING_UNDEF ((OnigEncoding )0) /* work size */ #define ONIGENC_CODE_TO_MBC_MAXLEN 7 #define ONIGENC_MBC_CASE_FOLD_MAXLEN 18 /* 18: 6(max-byte) * 3(case-fold chars) */ /* character types */ typedef enum { ONIGENC_CTYPE_NEWLINE = 0, ONIGENC_CTYPE_ALPHA = 1, ONIGENC_CTYPE_BLANK = 2, ONIGENC_CTYPE_CNTRL = 3, ONIGENC_CTYPE_DIGIT = 4, ONIGENC_CTYPE_GRAPH = 5, ONIGENC_CTYPE_LOWER = 6, ONIGENC_CTYPE_PRINT = 7, ONIGENC_CTYPE_PUNCT = 8, ONIGENC_CTYPE_SPACE = 9, ONIGENC_CTYPE_UPPER = 10, ONIGENC_CTYPE_XDIGIT = 11, ONIGENC_CTYPE_WORD = 12, ONIGENC_CTYPE_ALNUM = 13, /* alpha || digit */ ONIGENC_CTYPE_ASCII = 14 } OnigEncCtype; #define ONIGENC_MAX_STD_CTYPE ONIGENC_CTYPE_ASCII #define onig_enc_len(enc,p,end) ONIGENC_MBC_ENC_LEN(enc,p) #define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF) #define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1) #define ONIGENC_IS_MBC_HEAD(enc,p) (ONIGENC_MBC_ENC_LEN(enc,p) != 1) #define ONIGENC_IS_MBC_ASCII(p) (*(p) < 128) #define ONIGENC_IS_CODE_ASCII(code) ((code) < 128) #define ONIGENC_IS_MBC_WORD(enc,s,end) \ ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end)) #define ONIGENC_IS_MBC_WORD_ASCII(enc,s,end) onigenc_is_mbc_word_ascii(enc,s,end) #define ONIGENC_NAME(enc) ((enc)->name) #define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \ (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf) #define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \ (enc)->is_allowed_reverse_match(s,end) #define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \ (enc)->left_adjust_char_head(start, s) #define ONIGENC_IS_VALID_MBC_STRING(enc,s,end) \ (enc)->is_valid_mbc_string(s,end) #define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \ (enc)->apply_all_case_fold(case_fold_flag,f,arg) #define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \ (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs) #define ONIGENC_STEP_BACK(enc,start,s,n) \ onigenc_step_back((enc),(start),(s),(n)) #define ONIGENC_MBC_ENC_LEN(enc,p) (enc)->mbc_enc_len(p) #define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len) #define ONIGENC_MBC_MAXLEN_DIST(enc) ONIGENC_MBC_MAXLEN(enc) #define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len) #define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end)) #define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end)) #define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code) #define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf) #define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \ (enc)->property_name_to_ctype(enc,p,end) #define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype) #define ONIGENC_IS_CODE_NEWLINE(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE) #define ONIGENC_IS_CODE_GRAPH(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_GRAPH) #define ONIGENC_IS_CODE_PRINT(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PRINT) #define ONIGENC_IS_CODE_ALNUM(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALNUM) #define ONIGENC_IS_CODE_ALPHA(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALPHA) #define ONIGENC_IS_CODE_LOWER(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_LOWER) #define ONIGENC_IS_CODE_UPPER(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_UPPER) #define ONIGENC_IS_CODE_CNTRL(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_CNTRL) #define ONIGENC_IS_CODE_PUNCT(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PUNCT) #define ONIGENC_IS_CODE_SPACE(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_SPACE) #define ONIGENC_IS_CODE_BLANK(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_BLANK) #define ONIGENC_IS_CODE_DIGIT(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT) #define ONIGENC_IS_CODE_XDIGIT(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_XDIGIT) #define ONIGENC_IS_CODE_WORD(enc,code) \ ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD) #define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \ (enc)->get_ctype_code_range(ctype,sbout,ranges) ONIG_EXTERN OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n)); /* encoding API */ ONIG_EXTERN int onigenc_init P_((void)); ONIG_EXTERN int onig_initialize_encoding P_((OnigEncoding enc)); ONIG_EXTERN int onigenc_set_default_encoding P_((OnigEncoding enc)); ONIG_EXTERN OnigEncoding onigenc_get_default_encoding P_((void)); ONIG_EXTERN void onigenc_set_default_caseconv_table P_((const OnigUChar* table)); ONIG_EXTERN OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar** prev)); ONIG_EXTERN OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); ONIG_EXTERN OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); ONIG_EXTERN OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); ONIG_EXTERN int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end)); ONIG_EXTERN int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p)); ONIG_EXTERN int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p)); ONIG_EXTERN int onigenc_is_valid_mbc_string P_((OnigEncoding enc, const OnigUChar* s, const OnigUChar* end)); ONIG_EXTERN OnigUChar* onigenc_strdup P_((OnigEncoding enc, const OnigUChar* s, const OnigUChar* end)); /* PART: regular expression */ /* config parameters */ #define ONIG_NREGION 10 #define ONIG_MAX_CAPTURE_NUM 2147483647 /* 2**31 - 1 */ #define ONIG_MAX_BACKREF_NUM 1000 #define ONIG_MAX_REPEAT_NUM 100000 #define ONIG_MAX_MULTI_BYTE_RANGES_NUM 10000 /* constants */ #define ONIG_MAX_ERROR_MESSAGE_LEN 90 typedef unsigned int OnigOptionType; #define ONIG_OPTION_DEFAULT ONIG_OPTION_NONE /* options */ #define ONIG_OPTION_NONE 0U /* options (compile time) */ #define ONIG_OPTION_IGNORECASE 1U #define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1) #define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1) #define ONIG_OPTION_SINGLELINE (ONIG_OPTION_MULTILINE << 1) #define ONIG_OPTION_FIND_LONGEST (ONIG_OPTION_SINGLELINE << 1) #define ONIG_OPTION_FIND_NOT_EMPTY (ONIG_OPTION_FIND_LONGEST << 1) #define ONIG_OPTION_NEGATE_SINGLELINE (ONIG_OPTION_FIND_NOT_EMPTY << 1) #define ONIG_OPTION_DONT_CAPTURE_GROUP (ONIG_OPTION_NEGATE_SINGLELINE << 1) #define ONIG_OPTION_CAPTURE_GROUP (ONIG_OPTION_DONT_CAPTURE_GROUP << 1) /* options (search time) */ #define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1) #define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1) #define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1) #define ONIG_OPTION_CHECK_VALIDITY_OF_STRING (ONIG_OPTION_POSIX_REGION << 1) /* options (compile time) */ #define ONIG_OPTION_IGNORECASE_IS_ASCII (ONIG_OPTION_CHECK_VALIDITY_OF_STRING << 3) #define ONIG_OPTION_WORD_IS_ASCII (ONIG_OPTION_IGNORECASE_IS_ASCII << 1) #define ONIG_OPTION_DIGIT_IS_ASCII (ONIG_OPTION_WORD_IS_ASCII << 1) #define ONIG_OPTION_SPACE_IS_ASCII (ONIG_OPTION_DIGIT_IS_ASCII << 1) #define ONIG_OPTION_POSIX_IS_ASCII (ONIG_OPTION_SPACE_IS_ASCII << 1) #define ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER (ONIG_OPTION_POSIX_IS_ASCII << 1) #define ONIG_OPTION_TEXT_SEGMENT_WORD (ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER << 1) /* options (search time) */ #define ONIG_OPTION_NOT_BEGIN_STRING (ONIG_OPTION_TEXT_SEGMENT_WORD << 1) #define ONIG_OPTION_NOT_END_STRING (ONIG_OPTION_NOT_BEGIN_STRING << 1) #define ONIG_OPTION_NOT_BEGIN_POSITION (ONIG_OPTION_NOT_END_STRING << 1) #define ONIG_OPTION_CALLBACK_EACH_MATCH (ONIG_OPTION_NOT_BEGIN_POSITION << 1) #define ONIG_OPTION_MATCH_WHOLE_STRING (ONIG_OPTION_CALLBACK_EACH_MATCH << 1) #define ONIG_OPTION_MAXBIT ONIG_OPTION_MATCH_WHOLE_STRING #define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt)) #define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt)) #define ONIG_IS_OPTION_ON(options,option) ((options) & (option)) /* syntax */ typedef struct { unsigned int op; unsigned int op2; unsigned int behavior; OnigOptionType options; /* default option */ OnigMetaCharTableType meta_char_table; } OnigSyntaxType; ONIG_EXTERN OnigSyntaxType OnigSyntaxASIS; ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic; ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended; ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs; ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep; ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex; ONIG_EXTERN OnigSyntaxType OnigSyntaxJava; ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl; ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl_NG; ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby; ONIG_EXTERN OnigSyntaxType OnigSyntaxPython; ONIG_EXTERN OnigSyntaxType OnigSyntaxOniguruma; /* predefined syntaxes (see regsyntax.c) */ #define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS) #define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic) #define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended) #define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs) #define ONIG_SYNTAX_GREP (&OnigSyntaxGrep) #define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex) #define ONIG_SYNTAX_JAVA (&OnigSyntaxJava) #define ONIG_SYNTAX_PERL (&OnigSyntaxPerl) #define ONIG_SYNTAX_PERL_NG (&OnigSyntaxPerl_NG) #define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby) #define ONIG_SYNTAX_PYTHON (&OnigSyntaxPython) #define ONIG_SYNTAX_ONIGURUMA (&OnigSyntaxOniguruma) /* default syntax */ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax; #define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax /* syntax (operators) */ #define ONIG_SYN_OP_VARIABLE_META_CHARACTERS (1U<<0) #define ONIG_SYN_OP_DOT_ANYCHAR (1U<<1) /* . */ #define ONIG_SYN_OP_ASTERISK_ZERO_INF (1U<<2) /* * */ #define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (1U<<3) #define ONIG_SYN_OP_PLUS_ONE_INF (1U<<4) /* + */ #define ONIG_SYN_OP_ESC_PLUS_ONE_INF (1U<<5) #define ONIG_SYN_OP_QMARK_ZERO_ONE (1U<<6) /* ? */ #define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (1U<<7) #define ONIG_SYN_OP_BRACE_INTERVAL (1U<<8) /* {lower,upper} */ #define ONIG_SYN_OP_ESC_BRACE_INTERVAL (1U<<9) /* \{lower,upper\} */ #define ONIG_SYN_OP_VBAR_ALT (1U<<10) /* | */ #define ONIG_SYN_OP_ESC_VBAR_ALT (1U<<11) /* \| */ #define ONIG_SYN_OP_LPAREN_SUBEXP (1U<<12) /* (...) */ #define ONIG_SYN_OP_ESC_LPAREN_SUBEXP (1U<<13) /* \(...\) */ #define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (1U<<14) /* \A, \Z, \z */ #define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (1U<<15) /* \G */ #define ONIG_SYN_OP_DECIMAL_BACKREF (1U<<16) /* \num */ #define ONIG_SYN_OP_BRACKET_CC (1U<<17) /* [...] */ #define ONIG_SYN_OP_ESC_W_WORD (1U<<18) /* \w, \W */ #define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (1U<<19) /* \<. \> */ #define ONIG_SYN_OP_ESC_B_WORD_BOUND (1U<<20) /* \b, \B */ #define ONIG_SYN_OP_ESC_S_WHITE_SPACE (1U<<21) /* \s, \S */ #define ONIG_SYN_OP_ESC_D_DIGIT (1U<<22) /* \d, \D */ #define ONIG_SYN_OP_LINE_ANCHOR (1U<<23) /* ^, $ */ #define ONIG_SYN_OP_POSIX_BRACKET (1U<<24) /* [:xxxx:] */ #define ONIG_SYN_OP_QMARK_NON_GREEDY (1U<<25) /* ??,*?,+?,{n,m}? */ #define ONIG_SYN_OP_ESC_CONTROL_CHARS (1U<<26) /* \n,\r,\t,\a ... */ #define ONIG_SYN_OP_ESC_C_CONTROL (1U<<27) /* \cx */ #define ONIG_SYN_OP_ESC_OCTAL3 (1U<<28) /* \OOO */ #define ONIG_SYN_OP_ESC_X_HEX2 (1U<<29) /* \xHH */ #define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1U<<30) /* \x{7HHHHHHH} */ #define ONIG_SYN_OP_ESC_O_BRACE_OCTAL (1U<<31) /* \o{1OOOOOOOOOO} */ #define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1U<<0) /* \Q...\E */ #define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1U<<1) /* (?...) */ #define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsx),(?-imsx) */ #define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imx), (?-imx) */ #define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1U<<4) /* ?+,*+,++ */ #define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1U<<5) /* {n,m}+ */ #define ONIG_SYN_OP2_CCLASS_SET_OP (1U<<6) /* [...&&..[..]..] */ #define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (1U<<7) /* (?...) */ #define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (1U<<8) /* \k */ #define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (1U<<9) /* \g, \g */ #define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (1U<<10) /* (?@..),(?@..) */ #define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1U<<11) /* \C-x */ #define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (1U<<12) /* \M-x */ #define ONIG_SYN_OP2_ESC_V_VTAB (1U<<13) /* \v as VTAB */ #define ONIG_SYN_OP2_ESC_U_HEX4 (1U<<14) /* \uHHHH */ #define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (1U<<15) /* \`, \' */ #define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (1U<<16) /* \p{...}, \P{...} */ #define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1U<<17) /* \p{^..}, \P{^..} */ /* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */ #define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */ #define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */ #define ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE (1U<<21) /* (?(n)) (?(...)...|...) */ #define ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP (1U<<22) /* \K */ #define ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE (1U<<23) /* \R \r\n else [\x0a-\x0d] */ #define ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT (1U<<24) /* \N (?-m:.), \O (?m:.) */ #define ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP (1U<<25) /* (?~...) */ #define ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER (1U<<26) /* obsoleted: use next */ #define ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT (1U<<26) /* \X \y \Y */ #define ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL (1U<<27) /* (?R), (?&name)... */ #define ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS (1U<<28) /* (?{...}) (?{{...}}) */ #define ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME (1U<<29) /* (*name) (*name{a,..}) */ #define ONIG_SYN_OP2_OPTION_ONIGURUMA (1U<<30) /* (?imxWDSPy) */ #define ONIG_SYN_OP2_QMARK_CAPITAL_P_NAME (1U<<31) /* (?P...) (?P=name) */ /* syntax (behavior) */ #define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */ #define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (1U<<0) /* ?, *, +, {n,m} */ #define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (1U<<1) /* error or ignore */ #define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1U<<2) /* ...)... */ #define ONIG_SYN_ALLOW_INVALID_INTERVAL (1U<<3) /* {??? */ #define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (1U<<4) /* {,n} => {0,n} */ #define ONIG_SYN_STRICT_CHECK_BACKREF (1U<<5) /* /(\1)/,/\1()/ ..*/ #define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1U<<6) /* (?<=a|bc) */ #define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1U<<7) /* see doc/RE */ #define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8) /* (?)(?) */ #define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1U<<9) /* a{n}?=(?:a{n})? */ #define ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH (1U<<10) /* ..(?i)...|... */ #define ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND (1U<<11) /* (?<=a+|..) */ #define ONIG_SYN_PYTHON (1U<<12) /* \UHHHHHHHH */ #define ONIG_SYN_WHOLE_OPTIONS (1U<<13) /* (?Ie) */ #define ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP (1U<<14) /* \(^abc$\) */ /* syntax (behavior) in char class [...] */ #define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */ #define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */ #define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22) #define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1U<<23) /* [0-9-a]=[0-9\-a] */ #define ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC (1U<<26) #define ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC (1U<<27) /* [\w-%]=[\w\-%] */ /* syntax (behavior) warning */ #define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1U<<24) /* [,-,] */ #define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1U<<25) /* (?:a*)+ */ /* meta character specifiers (onig_set_meta_char()) */ #define ONIG_META_CHAR_ESCAPE 0 #define ONIG_META_CHAR_ANYCHAR 1 #define ONIG_META_CHAR_ANYTIME 2 #define ONIG_META_CHAR_ZERO_OR_ONE_TIME 3 #define ONIG_META_CHAR_ONE_OR_MORE_TIME 4 #define ONIG_META_CHAR_ANYCHAR_ANYTIME 5 #define ONIG_INEFFECTIVE_META_CHAR 0 /* error codes */ #define ONIG_IS_PATTERN_ERROR(ecode) ((ecode) <= -100 && (ecode) > -1000) /* normal return */ #define ONIG_NORMAL 0 #define ONIG_VALUE_IS_NOT_SET 1 #define ONIG_MISMATCH -1 #define ONIG_NO_SUPPORT_CONFIG -2 #define ONIG_ABORT -3 /* internal error */ #define ONIGERR_MEMORY -5 #define ONIGERR_TYPE_BUG -6 #define ONIGERR_PARSER_BUG -11 #define ONIGERR_STACK_BUG -12 #define ONIGERR_UNDEFINED_BYTECODE -13 #define ONIGERR_UNEXPECTED_BYTECODE -14 #define ONIGERR_MATCH_STACK_LIMIT_OVER -15 #define ONIGERR_PARSE_DEPTH_LIMIT_OVER -16 #define ONIGERR_RETRY_LIMIT_IN_MATCH_OVER -17 #define ONIGERR_RETRY_LIMIT_IN_SEARCH_OVER -18 #define ONIGERR_SUBEXP_CALL_LIMIT_IN_SEARCH_OVER -19 #define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21 /*dont use*/ #define ONIGERR_DEFAULT_ENCODING_IS_NOT_SET -21 #define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22 #define ONIGERR_FAIL_TO_INITIALIZE -23 /* general error */ #define ONIGERR_INVALID_ARGUMENT -30 /* syntax error */ #define ONIGERR_END_PATTERN_AT_LEFT_BRACE -100 #define ONIGERR_END_PATTERN_AT_LEFT_BRACKET -101 #define ONIGERR_EMPTY_CHAR_CLASS -102 #define ONIGERR_PREMATURE_END_OF_CHAR_CLASS -103 #define ONIGERR_END_PATTERN_AT_ESCAPE -104 #define ONIGERR_END_PATTERN_AT_META -105 #define ONIGERR_END_PATTERN_AT_CONTROL -106 #define ONIGERR_META_CODE_SYNTAX -108 #define ONIGERR_CONTROL_CODE_SYNTAX -109 #define ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE -110 #define ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE -111 #define ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS -112 #define ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED -113 #define ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID -114 #define ONIGERR_NESTED_REPEAT_OPERATOR -115 #define ONIGERR_UNMATCHED_CLOSE_PARENTHESIS -116 #define ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS -117 #define ONIGERR_END_PATTERN_IN_GROUP -118 #define ONIGERR_UNDEFINED_GROUP_OPTION -119 #define ONIGERR_INVALID_GROUP_OPTION -120 #define ONIGERR_INVALID_POSIX_BRACKET_TYPE -121 #define ONIGERR_INVALID_LOOK_BEHIND_PATTERN -122 #define ONIGERR_INVALID_REPEAT_RANGE_PATTERN -123 /* values error (syntax error) */ #define ONIGERR_TOO_BIG_NUMBER -200 #define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE -201 #define ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE -202 #define ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS -203 #define ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE -204 #define ONIGERR_TOO_MANY_MULTI_BYTE_RANGES -205 #define ONIGERR_TOO_SHORT_MULTI_BYTE_STRING -206 #define ONIGERR_TOO_BIG_BACKREF_NUMBER -207 #define ONIGERR_INVALID_BACKREF -208 #define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED -209 #define ONIGERR_TOO_MANY_CAPTURES -210 #define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE -212 #define ONIGERR_UNDEFINED_OPERATOR -213 #define ONIGERR_EMPTY_GROUP_NAME -214 #define ONIGERR_INVALID_GROUP_NAME -215 #define ONIGERR_INVALID_CHAR_IN_GROUP_NAME -216 #define ONIGERR_UNDEFINED_NAME_REFERENCE -217 #define ONIGERR_UNDEFINED_GROUP_REFERENCE -218 #define ONIGERR_MULTIPLEX_DEFINED_NAME -219 #define ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL -220 #define ONIGERR_NEVER_ENDING_RECURSION -221 #define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222 #define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223 #define ONIGERR_INVALID_IF_ELSE_SYNTAX -224 #define ONIGERR_INVALID_ABSENT_GROUP_PATTERN -225 #define ONIGERR_INVALID_ABSENT_GROUP_GENERATOR_PATTERN -226 #define ONIGERR_INVALID_CALLOUT_PATTERN -227 #define ONIGERR_INVALID_CALLOUT_NAME -228 #define ONIGERR_UNDEFINED_CALLOUT_NAME -229 #define ONIGERR_INVALID_CALLOUT_BODY -230 #define ONIGERR_INVALID_CALLOUT_TAG_NAME -231 #define ONIGERR_INVALID_CALLOUT_ARG -232 #define ONIGERR_INVALID_CODE_POINT_VALUE -400 #define ONIGERR_INVALID_WIDE_CHAR_VALUE -400 #define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401 #define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION -402 #define ONIGERR_INVALID_COMBINATION_OF_OPTIONS -403 #define ONIGERR_TOO_MANY_USER_DEFINED_OBJECTS -404 #define ONIGERR_TOO_LONG_PROPERTY_NAME -405 #define ONIGERR_VERY_INEFFICIENT_PATTERN -406 #define ONIGERR_LIBRARY_IS_NOT_INITIALIZED -500 /* errors related to thread */ /* #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001 */ /* must be smaller than MEM_STATUS_BITS_NUM (unsigned int * 8) */ #define ONIG_MAX_CAPTURE_HISTORY_GROUP 31 #define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \ ((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i]) typedef struct OnigCaptureTreeNodeStruct { int group; /* group number */ int beg; int end; int allocated; int num_childs; struct OnigCaptureTreeNodeStruct** childs; } OnigCaptureTreeNode; /* match result region type */ struct re_registers { int allocated; int num_regs; int* beg; int* end; /* extended */ OnigCaptureTreeNode* history_root; /* capture history tree root */ }; /* capture tree traverse */ #define ONIG_TRAVERSE_CALLBACK_AT_FIRST 1 #define ONIG_TRAVERSE_CALLBACK_AT_LAST 2 #define ONIG_TRAVERSE_CALLBACK_AT_BOTH \ ( ONIG_TRAVERSE_CALLBACK_AT_FIRST | ONIG_TRAVERSE_CALLBACK_AT_LAST ) #define ONIG_REGION_NOTPOS -1 typedef struct re_registers OnigRegion; typedef struct { OnigEncoding enc; OnigUChar* par; OnigUChar* par_end; } OnigErrorInfo; typedef struct { int lower; int upper; } OnigRepeatRange; typedef void (*OnigWarnFunc) P_((const char* s)); extern void onig_null_warn P_((const char* s)); #define ONIG_NULL_WARN onig_null_warn #define ONIG_CHAR_TABLE_SIZE 256 struct re_pattern_buffer; typedef struct re_pattern_buffer OnigRegexType; typedef OnigRegexType* OnigRegex; #ifndef ONIG_ESCAPE_REGEX_T_COLLISION typedef OnigRegexType regex_t; #endif struct OnigRegSetStruct; typedef struct OnigRegSetStruct OnigRegSet; typedef enum { ONIG_REGSET_POSITION_LEAD = 0, ONIG_REGSET_REGEX_LEAD = 1, ONIG_REGSET_PRIORITY_TO_REGEX_ORDER = 2 } OnigRegSetLead; typedef struct { int num_of_elements; OnigEncoding pattern_enc; OnigEncoding target_enc; OnigSyntaxType* syntax; OnigOptionType option; OnigCaseFoldType case_fold_flag; } OnigCompileInfo; typedef int (*OnigCallbackEachMatchFunc)(const OnigUChar* str, const OnigUChar* end, const OnigUChar* match_start, OnigRegion* region, void* user_data); /* types for callout */ typedef enum { ONIG_CALLOUT_IN_PROGRESS = 1, /* 1<<0 */ ONIG_CALLOUT_IN_RETRACTION = 2 /* 1<<1 */ } OnigCalloutIn; #define ONIG_CALLOUT_IN_BOTH (ONIG_CALLOUT_IN_PROGRESS | ONIG_CALLOUT_IN_RETRACTION) typedef enum { ONIG_CALLOUT_OF_CONTENTS = 0, ONIG_CALLOUT_OF_NAME = 1 } OnigCalloutOf; typedef enum { ONIG_CALLOUT_TYPE_SINGLE = 0, ONIG_CALLOUT_TYPE_START_CALL = 1, ONIG_CALLOUT_TYPE_BOTH_CALL = 2, ONIG_CALLOUT_TYPE_START_MARK_END_CALL = 3, } OnigCalloutType; #define ONIG_NON_NAME_ID -1 #define ONIG_NON_CALLOUT_NUM 0 #define ONIG_CALLOUT_MAX_ARGS_NUM 4 #define ONIG_CALLOUT_DATA_SLOT_NUM 5 struct OnigCalloutArgsStruct; typedef struct OnigCalloutArgsStruct OnigCalloutArgs; typedef int (*OnigCalloutFunc)(OnigCalloutArgs* args, void* user_data); /* callout function return values (less than -1: error code) */ typedef enum { ONIG_CALLOUT_FAIL = 1, ONIG_CALLOUT_SUCCESS = 0 } OnigCalloutResult; typedef enum { ONIG_TYPE_VOID = 0, ONIG_TYPE_LONG = 1<<0, ONIG_TYPE_CHAR = 1<<1, ONIG_TYPE_STRING = 1<<2, ONIG_TYPE_POINTER = 1<<3, ONIG_TYPE_TAG = 1<<4, } OnigType; typedef union { long l; OnigCodePoint c; struct { OnigUChar* start; OnigUChar* end; } s; void* p; int tag; /* tag -> callout_num */ } OnigValue; struct OnigMatchParamStruct; typedef struct OnigMatchParamStruct OnigMatchParam; /* Oniguruma Native API */ ONIG_EXTERN int onig_initialize P_((OnigEncoding encodings[], int number_of_encodings)); /* onig_init(): deprecated function. Use onig_initialize(). */ ONIG_EXTERN int onig_init P_((void)); ONIG_EXTERN int ONIG_VARIADIC_FUNC_ATTR onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...)); ONIG_EXTERN int onig_is_error_code_needs_param PV_((int code)); ONIG_EXTERN void onig_set_warn_func P_((OnigWarnFunc f)); ONIG_EXTERN void onig_set_verb_warn_func P_((OnigWarnFunc f)); ONIG_EXTERN int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); ONIG_EXTERN int onig_reg_init P_((OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax)); int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); ONIG_EXTERN int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); ONIG_EXTERN void onig_free P_((OnigRegex)); ONIG_EXTERN void onig_free_body P_((OnigRegex)); ONIG_EXTERN int onig_scan(OnigRegex reg, const OnigUChar* str, const OnigUChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), void* callback_arg); ONIG_EXTERN int onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option)); ONIG_EXTERN int onig_search_with_param P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp)); ONIG_EXTERN int onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option)); ONIG_EXTERN int onig_match_with_param P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp)); ONIG_EXTERN int onig_regset_new P_((OnigRegSet** rset, int n, OnigRegex regs[])); ONIG_EXTERN int onig_regset_add P_((OnigRegSet* set, OnigRegex reg)); ONIG_EXTERN int onig_regset_replace P_((OnigRegSet* set, int at, OnigRegex reg)); ONIG_EXTERN void onig_regset_free P_((OnigRegSet* set)); ONIG_EXTERN int onig_regset_number_of_regex P_((OnigRegSet* set)); ONIG_EXTERN OnigRegex onig_regset_get_regex P_((OnigRegSet* set, int at)); ONIG_EXTERN OnigRegion* onig_regset_get_region P_((OnigRegSet* set, int at)); ONIG_EXTERN int onig_regset_search P_((OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos)); ONIG_EXTERN int onig_regset_search_with_param P_((OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos)); ONIG_EXTERN OnigRegion* onig_region_new P_((void)); ONIG_EXTERN void onig_region_init P_((OnigRegion* region)); ONIG_EXTERN void onig_region_free P_((OnigRegion* region, int free_self)); ONIG_EXTERN void onig_region_copy P_((OnigRegion* to, OnigRegion* from)); ONIG_EXTERN void onig_region_clear P_((OnigRegion* region)); ONIG_EXTERN int onig_region_resize P_((OnigRegion* region, int n)); ONIG_EXTERN int onig_region_set P_((OnigRegion* region, int at, int beg, int end)); ONIG_EXTERN int onig_name_to_group_numbers P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums)); ONIG_EXTERN int onig_name_to_backref_number P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region)); ONIG_EXTERN int onig_foreach_name P_((OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg)); ONIG_EXTERN int onig_number_of_names P_((OnigRegex reg)); ONIG_EXTERN int onig_number_of_captures P_((OnigRegex reg)); ONIG_EXTERN int onig_number_of_capture_histories P_((OnigRegex reg)); ONIG_EXTERN OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region)); ONIG_EXTERN int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg)); ONIG_EXTERN int onig_noname_group_capture_is_active P_((OnigRegex reg)); ONIG_EXTERN OnigEncoding onig_get_encoding P_((OnigRegex reg)); ONIG_EXTERN OnigOptionType onig_get_options P_((OnigRegex reg)); ONIG_EXTERN OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg)); ONIG_EXTERN OnigSyntaxType* onig_get_syntax P_((OnigRegex reg)); ONIG_EXTERN int onig_set_default_syntax P_((OnigSyntaxType* syntax)); ONIG_EXTERN void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from)); ONIG_EXTERN unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax)); ONIG_EXTERN unsigned int onig_get_syntax_op2 P_((OnigSyntaxType* syntax)); ONIG_EXTERN unsigned int onig_get_syntax_behavior P_((OnigSyntaxType* syntax)); ONIG_EXTERN OnigOptionType onig_get_syntax_options P_((OnigSyntaxType* syntax)); ONIG_EXTERN void onig_set_syntax_op P_((OnigSyntaxType* syntax, unsigned int op)); ONIG_EXTERN void onig_set_syntax_op2 P_((OnigSyntaxType* syntax, unsigned int op2)); ONIG_EXTERN void onig_set_syntax_behavior P_((OnigSyntaxType* syntax, unsigned int behavior)); ONIG_EXTERN void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options)); ONIG_EXTERN int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code)); ONIG_EXTERN void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from)); ONIG_EXTERN OnigCaseFoldType onig_get_default_case_fold_flag P_((void)); ONIG_EXTERN int onig_set_default_case_fold_flag P_((OnigCaseFoldType case_fold_flag)); ONIG_EXTERN unsigned int onig_get_match_stack_limit_size P_((void)); ONIG_EXTERN int onig_set_match_stack_limit_size P_((unsigned int size)); ONIG_EXTERN unsigned long onig_get_retry_limit_in_match P_((void)); ONIG_EXTERN int onig_set_retry_limit_in_match P_((unsigned long n)); ONIG_EXTERN unsigned long onig_get_retry_limit_in_search P_((void)); ONIG_EXTERN int onig_set_retry_limit_in_search P_((unsigned long n)); ONIG_EXTERN unsigned int onig_get_parse_depth_limit P_((void)); ONIG_EXTERN int onig_set_capture_num_limit P_((int num)); ONIG_EXTERN int onig_set_parse_depth_limit P_((unsigned int depth)); ONIG_EXTERN unsigned long onig_get_subexp_call_limit_in_search P_((void)); ONIG_EXTERN int onig_set_subexp_call_limit_in_search P_((unsigned long n)); ONIG_EXTERN int onig_get_subexp_call_max_nest_level P_((void)); ONIG_EXTERN int onig_set_subexp_call_max_nest_level P_((int level)); ONIG_EXTERN int onig_unicode_define_user_property P_((const char* name, OnigCodePoint* ranges)); ONIG_EXTERN int onig_end P_((void)); ONIG_EXTERN const char* onig_version P_((void)); ONIG_EXTERN const char* onig_copyright P_((void)); /* for callback each match */ ONIG_EXTERN OnigCallbackEachMatchFunc onig_get_callback_each_match P_((void)); ONIG_EXTERN int onig_set_callback_each_match P_((OnigCallbackEachMatchFunc f)); /* for OnigMatchParam */ ONIG_EXTERN OnigMatchParam* onig_new_match_param P_((void)); ONIG_EXTERN void onig_free_match_param P_((OnigMatchParam* p)); ONIG_EXTERN void onig_free_match_param_content P_((OnigMatchParam* p)); ONIG_EXTERN int onig_initialize_match_param P_((OnigMatchParam* mp)); ONIG_EXTERN int onig_set_match_stack_limit_size_of_match_param P_((OnigMatchParam* param, unsigned int limit)); ONIG_EXTERN int onig_set_retry_limit_in_match_of_match_param P_((OnigMatchParam* param, unsigned long limit)); ONIG_EXTERN int onig_set_retry_limit_in_search_of_match_param P_((OnigMatchParam* param, unsigned long limit)); ONIG_EXTERN int onig_set_progress_callout_of_match_param P_((OnigMatchParam* param, OnigCalloutFunc f)); ONIG_EXTERN int onig_set_retraction_callout_of_match_param P_((OnigMatchParam* param, OnigCalloutFunc f)); ONIG_EXTERN int onig_set_callout_user_data_of_match_param P_((OnigMatchParam* param, void* user_data)); /* for callout functions */ ONIG_EXTERN OnigCalloutFunc onig_get_progress_callout P_((void)); ONIG_EXTERN int onig_set_progress_callout P_((OnigCalloutFunc f)); ONIG_EXTERN OnigCalloutFunc onig_get_retraction_callout P_((void)); ONIG_EXTERN int onig_set_retraction_callout P_((OnigCalloutFunc f)); ONIG_EXTERN int onig_set_callout_of_name P_((OnigEncoding enc, OnigCalloutType type, OnigUChar* name, OnigUChar* name_end, int callout_in, OnigCalloutFunc callout, OnigCalloutFunc end_callout, int arg_num, unsigned int arg_types[], int optional_arg_num, OnigValue opt_defaults[])); ONIG_EXTERN OnigUChar* onig_get_callout_name_by_name_id P_((int id)); ONIG_EXTERN int onig_get_callout_num_by_tag P_((OnigRegex reg, const OnigUChar* tag, const OnigUChar* tag_end)); ONIG_EXTERN int onig_get_callout_data_by_tag P_((OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val)); ONIG_EXTERN int onig_set_callout_data_by_tag P_((OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType type, OnigValue* val)); ONIG_EXTERN int onig_get_callout_data_by_tag_dont_clear_old P_((OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val)); /* used in callout functions */ ONIG_EXTERN int onig_get_callout_num_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN OnigCalloutIn onig_get_callout_in_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN int onig_get_name_id_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN const OnigUChar* onig_get_contents_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN const OnigUChar* onig_get_contents_end_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN int onig_get_args_num_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN int onig_get_passed_args_num_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN int onig_get_arg_by_callout_args P_((OnigCalloutArgs* args, int index, OnigType* type, OnigValue* val)); ONIG_EXTERN const OnigUChar* onig_get_string_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN const OnigUChar* onig_get_string_end_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN const OnigUChar* onig_get_start_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN const OnigUChar* onig_get_right_range_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN const OnigUChar* onig_get_current_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN OnigRegex onig_get_regex_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN unsigned long onig_get_retry_counter_by_callout_args P_((OnigCalloutArgs* args)); ONIG_EXTERN int onig_callout_tag_is_exist_at_callout_num P_((OnigRegex reg, int callout_num)); ONIG_EXTERN const OnigUChar* onig_get_callout_tag_start P_((OnigRegex reg, int callout_num)); ONIG_EXTERN const OnigUChar* onig_get_callout_tag_end P_((OnigRegex reg, int callout_num)); ONIG_EXTERN int onig_get_callout_data_dont_clear_old P_((OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val)); ONIG_EXTERN int onig_get_callout_data_by_callout_args_self_dont_clear_old P_((OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val)); ONIG_EXTERN int onig_get_callout_data P_((OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val)); ONIG_EXTERN int onig_get_callout_data_by_callout_args P_((OnigCalloutArgs* args, int callout_num, int slot, OnigType* type, OnigValue* val)); ONIG_EXTERN int onig_get_callout_data_by_callout_args_self P_((OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val)); ONIG_EXTERN int onig_set_callout_data P_((OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType type, OnigValue* val)); ONIG_EXTERN int onig_set_callout_data_by_callout_args P_((OnigCalloutArgs* args, int callout_num, int slot, OnigType type, OnigValue* val)); ONIG_EXTERN int onig_set_callout_data_by_callout_args_self P_((OnigCalloutArgs* args, int slot, OnigType type, OnigValue* val)); ONIG_EXTERN int onig_get_capture_range_in_callout P_((OnigCalloutArgs* args, int mem_num, int* begin, int* end)); ONIG_EXTERN int onig_get_used_stack_size_in_callout P_((OnigCalloutArgs* args, int* used_num, int* used_bytes)); /* builtin callout functions */ ONIG_EXTERN int onig_builtin_fail P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_builtin_mismatch P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_builtin_error P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_builtin_skip P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_builtin_count P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_builtin_total_count P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_builtin_max P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_builtin_cmp P_((OnigCalloutArgs* args, void* user_data)); ONIG_EXTERN int onig_setup_builtin_monitors_by_ascii_encoded_name P_((void* fp)); #ifdef __cplusplus } #endif #endif /* ONIGURUMA_H */ jq-1.8.2/vendor/oniguruma/src/iso8859_1.c0000644000175100017510000002157715215513537013450 /********************************************************************** iso8859_1.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define LARGE_S 0x53 #define SMALL_S 0x73 #define ENC_IS_ISO_8859_1_CTYPE(code,ctype) \ ((EncISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const unsigned short EncISO_8859_1_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0, 0x00a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { static OnigUChar sa[] = { LARGE_S, SMALL_S }; int i, j, n; if (0x41 <= *p && *p <= 0x5a) { if (*p == LARGE_S && end > p + 1 && (*(p+1) == LARGE_S || *(p+1) == SMALL_S) && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) { /* SS */ ss_combination: items[0].byte_len = 2; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )0xdf; n = 1; for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { if (sa[i] == *p && sa[j] == *(p+1)) continue; items[n].byte_len = 2; items[n].code_len = 2; items[n].code[0] = (OnigCodePoint )sa[i]; items[n].code[1] = (OnigCodePoint )sa[j]; n++; } } return 4; } items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p + 0x20); return 1; } else if (0x61 <= *p && *p <= 0x7a) { if (*p == SMALL_S && end > p + 1 && (*(p+1) == SMALL_S || *(p+1) == LARGE_S) && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) { /* ss */ goto ss_combination; } items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p - 0x20); return 1; } else if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) { if (0xc0 <= *p && *p <= 0xcf) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p + 0x20); return 1; } else if (0xd0 <= *p && *p <= 0xdf) { if (*p == 0xdf) { items[0].byte_len = 1; items[0].code_len = 2; items[0].code[0] = (OnigCodePoint )'s'; items[0].code[1] = (OnigCodePoint )'s'; items[1].byte_len = 1; items[1].code_len = 2; items[1].code[0] = (OnigCodePoint )'S'; items[1].code[1] = (OnigCodePoint )'S'; items[2].byte_len = 1; items[2].code_len = 2; items[2].code[0] = (OnigCodePoint )'s'; items[2].code[1] = (OnigCodePoint )'S'; items[3].byte_len = 1; items[3].code_len = 2; items[3].code[0] = (OnigCodePoint )'S'; items[3].code[1] = (OnigCodePoint )'s'; return 4; } else if (*p != 0xd7) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p + 0x20); return 1; } } else if (0xe0 <= *p && *p <= 0xef) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p - 0x20); return 1; } else if (0xf0 <= *p && *p <= 0xfe) { if (*p != 0xf7) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p - 0x20); return 1; } } } return 0; } static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ONIGENC_ISO_8859_1_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_1_CTYPE(code, ctype); else return FALSE; } OnigEncodingType OnigEncodingISO_8859_1 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-1", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/utf32_be.c0000644000175100017510000001133215215513537013475 /********************************************************************** utf32_be.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" static int utf32be_mbc_enc_len(const UChar* p ARG_UNUSED) { return 4; } static int is_valid_mbc_string(const UChar* s, const UChar* end) { return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_UTF32_BE, s, end); } static int utf32be_is_mbc_newline(const UChar* p, const UChar* end) { if (p + 3 < end) { if (*(p+3) == NEWLINE_CODE && *(p+2) == 0 && *(p+1) == 0 && *p == 0) return 1; #ifdef USE_UNICODE_ALL_LINE_TERMINATORS if (( #ifndef USE_CRNL_AS_LINE_TERMINATOR *(p+3) == 0x0d || #endif *(p+3) == 0x85) && *(p+2) == 0 && *(p+1) == 0 && *p == 0x00) return 1; if (*(p+2) == 0x20 && (*(p+3) == 0x29 || *(p+3) == 0x28) && *(p+1) == 0 && *p == 0) return 1; #endif } return 0; } static OnigCodePoint utf32be_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED) { OnigCodePoint code; code = (OnigCodePoint )((((p[0] & 0x7f) * 256 + p[1]) * 256 + p[2]) * 256 + p[3]); return code; } static int utf32be_code_to_mbclen(OnigCodePoint code ARG_UNUSED) { return 4; } static int utf32be_code_to_mbc(OnigCodePoint code, UChar *buf) { UChar* p = buf; *p++ = (UChar )((code & 0xff000000) >>24); *p++ = (UChar )((code & 0xff0000) >>16); *p++ = (UChar )((code & 0xff00) >> 8); *p++ = (UChar ) (code & 0xff); return 4; } static int utf32be_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold) { const UChar* p = *pp; if (ONIGENC_IS_ASCII_CODE(*(p+3)) && *(p+2) == 0 && *(p+1) == 0 && *p == 0) { *fold++ = 0; *fold++ = 0; #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (*(p+3) == 0x49) { *fold++ = 0x01; *fold = 0x31; (*pp) += 4; return 4; } } #endif *fold++ = 0; *fold = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*(p+3)); *pp += 4; return 4; } else return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF32_BE, flag, pp, end, fold); } static UChar* utf32be_left_adjust_char_head(const UChar* start, const UChar* s) { int rem; if (s <= start) return (UChar* )s; rem = (s - start) % 4; return (UChar* )(s - rem); } static int utf32be_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF32_BE, flag, p, end, items); } OnigEncodingType OnigEncodingUTF32_BE = { utf32be_mbc_enc_len, "UTF-32BE", /* name */ 4, /* max enc length */ 4, /* min enc length */ utf32be_is_mbc_newline, utf32be_mbc_to_code, utf32be_code_to_mbclen, utf32be_code_to_mbc, utf32be_mbc_case_fold, onigenc_unicode_apply_all_case_fold, utf32be_get_case_fold_codes_by_str, onigenc_unicode_property_name_to_ctype, onigenc_unicode_is_code_ctype, onigenc_utf16_32_get_ctype_code_range, utf32be_left_adjust_char_head, onigenc_always_false_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_4, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/regenc.c0000644000175100017510000007156615215513537013346 /********************************************************************** regenc.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #define LARGE_S 0x53 #define SMALL_S 0x73 OnigEncoding OnigEncDefaultCharEncoding = ONIG_ENCODING_INIT_DEFAULT; #define INITED_LIST_SIZE 20 static int InitedListNum; static struct { OnigEncoding enc; int inited; } InitedList[INITED_LIST_SIZE]; static int enc_inited_entry(OnigEncoding enc) { int i; for (i = 0; i < InitedListNum; i++) { if (InitedList[i].enc == enc) { InitedList[i].inited = 1; return i; } } i = InitedListNum; if (i < INITED_LIST_SIZE - 1) { InitedList[i].enc = enc; InitedList[i].inited = 1; InitedListNum++; return i; } return -1; } static int enc_is_inited(OnigEncoding enc) { int i; for (i = 0; i < InitedListNum; i++) { if (InitedList[i].enc == enc) { return InitedList[i].inited; } } return 0; } static int OnigEncInited; extern int onigenc_init(void) { if (OnigEncInited != 0) return 0; OnigEncInited = 1; return 0; } extern int onigenc_end(void) { int i; for (i = 0; i < InitedListNum; i++) { InitedList[i].enc = 0; InitedList[i].inited = 0; } InitedListNum = 0; OnigEncInited = 0; return ONIG_NORMAL; } extern int onig_initialize_encoding(OnigEncoding enc) { int r; if (enc != ONIG_ENCODING_ASCII && ONIGENC_IS_ASCII_COMPATIBLE_ENCODING(enc)) { OnigEncoding ascii = ONIG_ENCODING_ASCII; if (ascii->init != 0 && enc_is_inited(ascii) == 0) { r = ascii->init(); if (r != ONIG_NORMAL) return r; enc_inited_entry(ascii); } } if (enc->init != 0 && enc_is_inited(enc) == 0) { r = (enc->init)(); if (r == ONIG_NORMAL) enc_inited_entry(enc); return r; } return 0; } extern OnigEncoding onigenc_get_default_encoding(void) { return OnigEncDefaultCharEncoding; } extern int onigenc_set_default_encoding(OnigEncoding enc) { OnigEncDefaultCharEncoding = enc; return 0; } extern UChar* onigenc_strdup(OnigEncoding enc, const UChar* s, const UChar* end) { int slen, term_len, i; UChar *r; slen = (int )(end - s); term_len = ONIGENC_MBC_MINLEN(enc); r = (UChar* )xmalloc(slen + term_len); CHECK_NULL_RETURN(r); xmemcpy(r, s, slen); for (i = 0; i < term_len; i++) r[slen + i] = (UChar )0; return r; } extern UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s) { UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s); if (p < s) { p += enclen(enc, p); } return p; } extern UChar* onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc, const UChar* start, const UChar* s, const UChar** prev) { UChar* p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s); if (p < s) { if (prev) *prev = (const UChar* )p; p += enclen(enc, p); } else { if (prev) *prev = onigenc_get_prev_char_head(enc, start, p); } return p; } extern UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s) { if (s <= start) return (UChar* )NULL; return ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s - 1); } extern UChar* onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, int n) { while (ONIG_IS_NOT_NULL(s) && n-- > 0) { if (s <= start) return (UChar* )NULL; s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s - 1); } return (UChar* )s; } extern UChar* onigenc_step(OnigEncoding enc, const UChar* p, const UChar* end, int n) { UChar* q = (UChar* )p; while (n-- > 0) { q += ONIGENC_MBC_ENC_LEN(enc, q); } return (q <= end ? q : NULL); } extern int onigenc_strlen(OnigEncoding enc, const UChar* p, const UChar* end) { int n = 0; UChar* q = (UChar* )p; while (q < end) { q += ONIGENC_MBC_ENC_LEN(enc, q); n++; } return n; } extern int onigenc_strlen_null(OnigEncoding enc, const UChar* s) { int n = 0; UChar* p = (UChar* )s; while (1) { if (*p == '\0') { UChar* q; int len = ONIGENC_MBC_MINLEN(enc); if (len == 1) return n; q = p + 1; while (len > 1) { if (*q != '\0') break; q++; len--; } if (len == 1) return n; } p += ONIGENC_MBC_ENC_LEN(enc, p); n++; } } extern int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s) { const UChar* start = s; const UChar* p = s; while (1) { if (*p == '\0') { const UChar* q; int len = ONIGENC_MBC_MINLEN(enc); if (len == 1) return (int )(p - start); q = p + 1; while (len > 1) { if (*q != '\0') break; q++; len--; } if (len == 1) return (int )(p - start); } p += ONIGENC_MBC_ENC_LEN(enc, p); } } const UChar OnigEncAsciiToLowerCaseTable[] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', }; #ifdef USE_UPPER_CASE_TABLE const UChar OnigEncAsciiToUpperCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\101', '\102', '\103', '\104', '\105', '\106', '\107', '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117', '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127', '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137', '\140', '\101', '\102', '\103', '\104', '\105', '\106', '\107', '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117', '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127', '\130', '\131', '\132', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', }; #endif const unsigned short OnigEncAsciiCtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; const UChar OnigEncISO_8859_1_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; #ifdef USE_UPPER_CASE_TABLE const UChar OnigEncISO_8859_1_ToUpperCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\101', '\102', '\103', '\104', '\105', '\106', '\107', '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117', '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127', '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137', '\140', '\101', '\102', '\103', '\104', '\105', '\106', '\107', '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117', '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127', '\130', '\131', '\132', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\367', '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\377', }; #endif extern void onigenc_set_default_caseconv_table(const UChar* table ARG_UNUSED) { /* nothing */ /* obsoleted. */ } extern UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s) { return ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, start, s); } const OnigPairCaseFoldCodes OnigAsciiLowerMap[] = { { 0x41, 0x61 }, { 0x42, 0x62 }, { 0x43, 0x63 }, { 0x44, 0x64 }, { 0x45, 0x65 }, { 0x46, 0x66 }, { 0x47, 0x67 }, { 0x48, 0x68 }, { 0x49, 0x69 }, { 0x4a, 0x6a }, { 0x4b, 0x6b }, { 0x4c, 0x6c }, { 0x4d, 0x6d }, { 0x4e, 0x6e }, { 0x4f, 0x6f }, { 0x50, 0x70 }, { 0x51, 0x71 }, { 0x52, 0x72 }, { 0x53, 0x73 }, { 0x54, 0x74 }, { 0x55, 0x75 }, { 0x56, 0x76 }, { 0x57, 0x77 }, { 0x58, 0x78 }, { 0x59, 0x79 }, { 0x5a, 0x7a } }; extern int onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED, OnigApplyAllCaseFoldFunc f, void* arg) { OnigCodePoint code; int i, r; for (i = 0; i < (int )(sizeof(OnigAsciiLowerMap)/sizeof(OnigPairCaseFoldCodes)); i++) { code = OnigAsciiLowerMap[i].to; r = (*f)(OnigAsciiLowerMap[i].from, &code, 1, arg); if (r != 0) return r; code = OnigAsciiLowerMap[i].from; r = (*f)(OnigAsciiLowerMap[i].to, &code, 1, arg); if (r != 0) return r; } return 0; } extern int onigenc_ascii_get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED, const OnigUChar* p, const OnigUChar* end ARG_UNUSED, OnigCaseFoldCodeItem items[]) { if (0x41 <= *p && *p <= 0x5a) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p + 0x20); return 1; } else if (0x61 <= *p && *p <= 0x7a) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p - 0x20); return 1; } else return 0; } static int ss_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED, OnigApplyAllCaseFoldFunc f, void* arg) { static OnigCodePoint ss[] = { SMALL_S, SMALL_S }; return (*f)((OnigCodePoint )0xdf, ss, 2, arg); } extern int onigenc_apply_all_case_fold_with_map(int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { OnigCodePoint code; int i, r; r = onigenc_ascii_apply_all_case_fold(flag, f, arg); if (r != 0) return r; if (CASE_FOLD_IS_ASCII_ONLY(flag)) return 0; for (i = 0; i < map_size; i++) { code = map[i].to; r = (*f)(map[i].from, &code, 1, arg); if (r != 0) return r; code = map[i].from; r = (*f)(map[i].to, &code, 1, arg); if (r != 0) return r; } if (ess_tsett_flag != 0) return ss_apply_all_case_fold(flag, f, arg); return 0; } extern int onigenc_get_case_fold_codes_by_str_with_map(int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { int i, j, n; static OnigUChar sa[] = { LARGE_S, SMALL_S }; if (0x41 <= *p && *p <= 0x5a) { /* A - Z */ if (*p == LARGE_S && ess_tsett_flag != 0 && end > p + 1 && (*(p+1) == LARGE_S || *(p+1) == SMALL_S) /* SS */ && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) { ss_combination: items[0].byte_len = 2; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )0xdf; n = 1; for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { if (sa[i] == *p && sa[j] == *(p+1)) continue; items[n].byte_len = 2; items[n].code_len = 2; items[n].code[0] = (OnigCodePoint )sa[i]; items[n].code[1] = (OnigCodePoint )sa[j]; n++; } } return 4; } items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p + 0x20); return 1; } else if (0x61 <= *p && *p <= 0x7a) { /* a - z */ if (*p == SMALL_S && ess_tsett_flag != 0 && end > p + 1 && (*(p+1) == SMALL_S || *(p+1) == LARGE_S) && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) { goto ss_combination; } items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = (OnigCodePoint )(*p - 0x20); return 1; } else if (*p == 0xdf && ess_tsett_flag != 0 && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) { items[0].byte_len = 1; items[0].code_len = 2; items[0].code[0] = (OnigCodePoint )'s'; items[0].code[1] = (OnigCodePoint )'s'; items[1].byte_len = 1; items[1].code_len = 2; items[1].code[0] = (OnigCodePoint )'S'; items[1].code[1] = (OnigCodePoint )'S'; items[2].byte_len = 1; items[2].code_len = 2; items[2].code[0] = (OnigCodePoint )'s'; items[2].code[1] = (OnigCodePoint )'S'; items[3].byte_len = 1; items[3].code_len = 2; items[3].code[0] = (OnigCodePoint )'S'; items[3].code[1] = (OnigCodePoint )'s'; return 4; } else { int i; if (CASE_FOLD_IS_ASCII_ONLY(flag)) return 0; for (i = 0; i < map_size; i++) { if (*p == map[i].from) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = map[i].to; return 1; } else if (*p == map[i].to) { items[0].byte_len = 1; items[0].code_len = 1; items[0].code[0] = map[i].from; return 1; } } } return 0; } extern int onigenc_not_support_get_ctype_code_range(OnigCtype ctype ARG_UNUSED, OnigCodePoint* sb_out ARG_UNUSED, const OnigCodePoint* ranges[] ARG_UNUSED) { return ONIG_NO_SUPPORT_CONFIG; } extern int onigenc_is_mbc_newline_0x0a(const UChar* p, const UChar* end) { if (p < end) { if (*p == NEWLINE_CODE) return 1; } return 0; } /* for single byte encodings */ extern int onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p, const UChar*end ARG_UNUSED, UChar* lower) { *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(**p); (*p)++; return 1; /* return byte length of converted char to lower */ } extern int onigenc_single_byte_mbc_enc_len(const UChar* p ARG_UNUSED) { return 1; } extern OnigCodePoint onigenc_single_byte_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED) { return (OnigCodePoint )(*p); } extern int onigenc_single_byte_code_to_mbclen(OnigCodePoint code ARG_UNUSED) { return (code < 0x100 ? 1 : ONIGERR_INVALID_CODE_POINT_VALUE); } extern int onigenc_single_byte_code_to_mbc(OnigCodePoint code, UChar *buf) { *buf = (UChar )(code & 0xff); return 1; } extern UChar* onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED, const UChar* s) { return (UChar* )s; } extern int onigenc_always_true_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED) { return TRUE; } extern int onigenc_always_false_is_allowed_reverse_match(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED) { return FALSE; } extern int onigenc_always_true_is_valid_mbc_string(const UChar* s ARG_UNUSED, const UChar* end ARG_UNUSED) { return TRUE; } extern int onigenc_length_check_is_valid_mbc_string(OnigEncoding enc, const UChar* p, const UChar* end) { while (p < end) { p += enclen(enc, p); } if (p != end) return FALSE; else return TRUE; } extern int onigenc_is_valid_mbc_string(OnigEncoding enc, const UChar* s, const UChar* end) { return ONIGENC_IS_VALID_MBC_STRING(enc, s, end); } extern OnigCodePoint onigenc_mbn_mbc_to_code(OnigEncoding enc, const UChar* p, const UChar* end) { int c, i, len; OnigCodePoint n; len = enclen(enc, p); n = (OnigCodePoint )(*p++); if (len == 1) return n; for (i = 1; i < len; i++) { if (p >= end) break; c = *p++; n <<= 8; n += c; } return n; } extern int onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { int len; const UChar *p = *pp; if (ONIGENC_IS_MBC_ASCII(p)) { *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p); (*pp)++; return 1; } else { int i; len = enclen(enc, p); for (i = 0; i < len; i++) { *lower++ = *p++; } (*pp) += len; return len; /* return byte length of converted to lower char */ } } extern int onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf) { UChar *p = buf; if ((code & 0xff00) != 0) { *p++ = (UChar )((code >> 8) & 0xff); } *p++ = (UChar )(code & 0xff); #if 1 if (enclen(enc, buf) != (p - buf)) return ONIGERR_INVALID_CODE_POINT_VALUE; #endif return (int )(p - buf); } extern int onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf) { UChar *p = buf; if ((code & 0xff000000) != 0) { *p++ = (UChar )((code >> 24) & 0xff); } if ((code & 0xff0000) != 0 || p != buf) { *p++ = (UChar )((code >> 16) & 0xff); } if ((code & 0xff00) != 0 || p != buf) { *p++ = (UChar )((code >> 8) & 0xff); } *p++ = (UChar )(code & 0xff); #if 1 if (enclen(enc, buf) != (p - buf)) return ONIGERR_INVALID_CODE_POINT_VALUE; #endif return (int )(p - buf); } extern int onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end) { static PosixBracketEntryType PBS[] = { { (UChar* )"Alnum", ONIGENC_CTYPE_ALNUM, 5 }, { (UChar* )"Alpha", ONIGENC_CTYPE_ALPHA, 5 }, { (UChar* )"Blank", ONIGENC_CTYPE_BLANK, 5 }, { (UChar* )"Cntrl", ONIGENC_CTYPE_CNTRL, 5 }, { (UChar* )"Digit", ONIGENC_CTYPE_DIGIT, 5 }, { (UChar* )"Graph", ONIGENC_CTYPE_GRAPH, 5 }, { (UChar* )"Lower", ONIGENC_CTYPE_LOWER, 5 }, { (UChar* )"Print", ONIGENC_CTYPE_PRINT, 5 }, { (UChar* )"Punct", ONIGENC_CTYPE_PUNCT, 5 }, { (UChar* )"Space", ONIGENC_CTYPE_SPACE, 5 }, { (UChar* )"Upper", ONIGENC_CTYPE_UPPER, 5 }, { (UChar* )"XDigit", ONIGENC_CTYPE_XDIGIT, 6 }, { (UChar* )"ASCII", ONIGENC_CTYPE_ASCII, 5 }, { (UChar* )"Word", ONIGENC_CTYPE_WORD, 4 }, { (UChar* )NULL, -1, 0 } }; PosixBracketEntryType *pb; int len; len = onigenc_strlen(enc, p, end); for (pb = PBS; IS_NOT_NULL(pb->name); pb++) { if (len == pb->len && onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0) return pb->ctype; } return ONIGERR_INVALID_CHAR_PROPERTY_NAME; } extern int onigenc_is_mbc_word_ascii(OnigEncoding enc, UChar* s, const UChar* end) { OnigCodePoint code = ONIGENC_MBC_TO_CODE(enc, s, end); if (code > ASCII_LIMIT) return 0; return ONIGENC_IS_ASCII_CODE_WORD(code); } extern int onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code, unsigned int ctype) { if (code < 128) return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); else { if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) { return (ONIGENC_CODE_TO_MBCLEN(enc, code) > 1 ? TRUE : FALSE); } } return FALSE; } extern int onigenc_mb4_is_code_ctype(OnigEncoding enc, OnigCodePoint code, unsigned int ctype) { if (code < 128) return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); else { if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) { return (ONIGENC_CODE_TO_MBCLEN(enc, code) > 1 ? TRUE : FALSE); } } return FALSE; } extern int onigenc_with_ascii_strncmp(OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n) { int x, c; while (n-- > 0) { if (p >= end) return (int )(*sascii); c = (int )ONIGENC_MBC_TO_CODE(enc, p, end); x = *sascii - c; if (x) return x; sascii++; p += enclen(enc, p); } return 0; } extern int onig_codes_cmp(OnigCodePoint a[], OnigCodePoint b[], int n) { int i; for (i = 0; i < n; i++) { if (a[i] != b[i]) return -1; } return 0; } extern int onig_codes_byte_at(OnigCodePoint codes[], int at) { int index; int b; OnigCodePoint code; index = at / 3; b = at % 3; code = codes[index]; return ((code >> ((2 - b) * 8)) & 0xff); } jq-1.8.2/vendor/oniguruma/src/iso8859_7.c0000644000175100017510000002056315215513537013450 /********************************************************************** iso8859_7.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_7_TO_LOWER_CASE(c) EncISO_8859_7_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_7_CTYPE(code,ctype) \ ((EncISO_8859_7_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_7_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\334', '\267', '\335', '\336', '\337', '\273', '\374', '\275', '\375', '\376', '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\322', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\334', '\335', '\336', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_7_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x01a0, 0x00a0, 0x0000, 0x0000, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x01a0, 0x00a0, 0x01a0, 0x0000, 0x01a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x00a0, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x10a0, 0x34a2, 0x34a2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x0000, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0000 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_7_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_7_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xb6, 0xdc }, { 0xb8, 0xdd }, { 0xb9, 0xde }, { 0xba, 0xdf }, { 0xbc, 0xfc }, { 0xbe, 0xfd }, { 0xbf, 0xfe }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_7 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-7", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/regversion.c0000644000175100017510000000415715215513537014256 /********************************************************************** regversion.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #ifndef NEED_TO_INCLUDE_STDIO #define NEED_TO_INCLUDE_STDIO #endif #include "regint.h" extern const char* onig_version(void) { static char s[12]; xsnprintf(s, sizeof(s), "%d.%d.%d", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY); return s; } extern const char* onig_copyright(void) { static char s[58]; xsnprintf(s, sizeof(s), "Oniguruma %d.%d.%d : Copyright (C) 2002-2018 K.Kosako", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY); return s; } jq-1.8.2/vendor/oniguruma/src/cp1251.c0000644000175100017510000002073615215513537013007 /********************************************************************** cp1251.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2006-2020 Byte * K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_CP1251_TO_LOWER_CASE(c) EncCP1251_ToLowerCaseTable[c] #define ENC_IS_CP1251_CTYPE(code,ctype) \ ((EncCP1251_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncCP1251_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\220', '\203', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\232', '\213', '\234', '\235', '\236', '\237', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\242', '\242', '\274', '\244', '\264', '\246', '\247', '\270', '\251', '\272', '\253', '\254', '\255', '\256', '\277', '\260', '\261', '\263', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\276', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncCP1251_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x428c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x34a2, 0x34a2, 0x01a0, 0x30e2, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x0000, 0x01a0, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x0008, 0x0000, 0x30e2, 0x01a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x0280, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x34a2, 0x01a0, 0x01a0, 0x34a2, 0x01a0, 0x34a2, 0x01a0, 0x01a0, 0x01a0, 0x01a0, 0x34a2, 0x01a0, 0x01a0, 0x34a2, 0x30e2, 0x30e2, 0x31e2, 0x01a0, 0x01a0, 0x30e2, 0x0000, 0x30e2, 0x01a0, 0x30e2, 0x34a2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static int cp1251_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_CP1251_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int cp1251_is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_CP1251_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xb8, 0xa8 }, { 0xe0, 0xc0 }, { 0xe1, 0xc1 }, { 0xe2, 0xc2 }, { 0xe3, 0xc3 }, { 0xe4, 0xc4 }, { 0xe5, 0xc5 }, { 0xe6, 0xc6 }, { 0xe7, 0xc7 }, { 0xe8, 0xc8 }, { 0xe9, 0xc9 }, { 0xea, 0xca }, { 0xeb, 0xcb }, { 0xec, 0xcc }, { 0xed, 0xcd }, { 0xee, 0xce }, { 0xef, 0xcf }, { 0xf0, 0xd0 }, { 0xf1, 0xd1 }, { 0xf2, 0xd2 }, { 0xf3, 0xd3 }, { 0xf4, 0xd4 }, { 0xf5, 0xd5 }, { 0xf6, 0xd6 }, { 0xf7, 0xd7 }, { 0xf8, 0xd8 }, { 0xf9, 0xd9 }, { 0xfa, 0xda }, { 0xfb, 0xdb }, { 0xfc, 0xdc }, { 0xfd, 0xdd }, { 0xfe, 0xde }, { 0xff, 0xdf } }; static int cp1251_apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, f, arg); } static int cp1251_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, p, end, items); } OnigEncodingType OnigEncodingCP1251 = { onigenc_single_byte_mbc_enc_len, "CP1251", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, cp1251_mbc_case_fold, cp1251_apply_all_case_fold, cp1251_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, cp1251_is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/regposerr.c0000644000175100017510000001062115215513537014074 /********************************************************************** regposerr.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ /* Can't include regint.h etc.. for conflict of regex_t. Define ONIGURUMA_EXPORT here for onigposix.h. */ #ifndef ONIGURUMA_EXPORT #define ONIGURUMA_EXPORT #endif #include "config.h" #include "onigposix.h" #undef regex_t #undef regmatch_t #undef regoff_t #undef regcomp #undef regexec #undef regfree #undef regerror #undef reg_set_encoding #undef reg_name_to_group_numbers #undef reg_foreach_name #undef reg_number_of_names #ifndef ONIG_NO_STANDARD_C_HEADERS #include #include #endif #if defined(__GNUC__) # define ARG_UNUSED __attribute__ ((unused)) #else # define ARG_UNUSED #endif #if defined(_WIN32) && !defined(__GNUC__) #ifndef xsnprintf #define xsnprintf sprintf_s #endif #ifndef xstrncpy #define xstrncpy(dest,src,size) strncpy_s(dest,size,src,_TRUNCATE) #endif #else #ifndef xsnprintf #define xsnprintf snprintf #endif #ifndef xstrncpy #define xstrncpy strncpy #endif #endif static char* ESTRING[] = { NULL, "failed to match", /* REG_NOMATCH */ "Invalid regular expression", /* REG_BADPAT */ "invalid collating element referenced", /* REG_ECOLLATE */ "invalid character class type referenced", /* REG_ECTYPE */ "bad backslash-escape sequence", /* REG_EESCAPE */ "invalid back reference number", /* REG_ESUBREG */ "imbalanced [ and ]", /* REG_EBRACK */ "imbalanced ( and )", /* REG_EPAREN */ "imbalanced { and }", /* REG_EBRACE */ "invalid repeat range {n,m}", /* REG_BADBR */ "invalid range", /* REG_ERANGE */ "Out of memory", /* REG_ESPACE */ "? * + not preceded by valid regular expression", /* REG_BADRPT */ /* Extended errors */ "internal error", /* REG_EONIG_INTERNAL */ "invalid wide char value", /* REG_EONIG_BADWC */ "invalid argument" /* REG_EONIG_BADARG */ }; extern size_t onig_posix_regerror(int posix_ecode, const onig_posix_regex_t* reg ARG_UNUSED, char* buf, size_t size) { char* s; char tbuf[35]; size_t len; if (posix_ecode > 0 && posix_ecode < (int )(sizeof(ESTRING) / sizeof(ESTRING[0]))) { s = ESTRING[posix_ecode]; } else if (posix_ecode == 0) { s = ""; } else { xsnprintf(tbuf, sizeof(tbuf), "undefined error code (%d)", posix_ecode); s = tbuf; } len = strlen(s) + 1; /* use strlen() because s is ascii encoding. */ if (buf != NULL && size > 0) { xstrncpy(buf, s, size - 1); buf[size - 1] = '\0'; } return len; } #ifdef USE_BINARY_COMPATIBLE_POSIX_API extern size_t regerror(int posix_ecode, const onig_posix_regex_t* reg ARG_UNUSED, char* buf, size_t size) { return onig_posix_regerror(posix_ecode, reg, buf, size); } #endif jq-1.8.2/vendor/oniguruma/src/unicode_fold3_key.c0000644000175100017510000000762715215513537015465 /* This file was converted by gperf_fold_key_conv.py from gperf output file. */ /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold3_key unicode_fold3_key.gperf */ /* Computed positions: -k'3,6,9' */ /* This gperf source file was generated by make_unicode_fold_data.py */ /*- * Copyright (c) 2017-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #define TOTAL_KEYWORDS 14 #define MIN_WORD_LENGTH 9 #define MAX_WORD_LENGTH 9 #define MIN_HASH_VALUE 0 #define MAX_HASH_VALUE 13 /* maximum key range = 14, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif /*ARGSUSED*/ static unsigned int hash(OnigCodePoint codes[]) { static const unsigned char asso_values[] = { 6, 3, 14, 14, 14, 14, 14, 14, 1, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 4, 14, 14, 5, 14, 14, 4, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 10, 14, 14, 14, 14, 14, 9, 14, 1, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 8, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; return asso_values[(unsigned char)onig_codes_byte_at(codes, 8)] + asso_values[(unsigned char)onig_codes_byte_at(codes, 5)] + asso_values[(unsigned char)onig_codes_byte_at(codes, 2)]; } int onigenc_unicode_fold3_key(OnigCodePoint codes[]) { static const short int wordlist[] = { 62, 47, 31, 57, 41, 25, 52, 36, 20, 67, 15, 10, 5, 0 }; { int key = hash(codes); if (key <= MAX_HASH_VALUE) { int index = wordlist[key]; if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds3 + index, 3) == 0) return index; } } return -1; } jq-1.8.2/vendor/oniguruma/src/utf16_le.c0000644000175100017510000001676415215513537013527 /********************************************************************** utf16_le.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" /* for USE_CALLOUT */ static int init(void) { #ifdef USE_CALLOUT int id; OnigEncoding enc; char* name; unsigned int args[4]; OnigValue opts[4]; enc = ONIG_ENCODING_UTF16_LE; name = "F\000A\000I\000L\000\000\000"; BC0_P(name, fail); name = "M\000I\000S\000M\000A\000T\000C\000H\000\000\000"; BC0_P(name, mismatch); name = "S\000K\000I\000P\000\000\000"; BC0_P(name, skip); name = "M\000A\000X\000\000\000"; args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; args[1] = ONIG_TYPE_CHAR; opts[0].c = 'X'; BC_B_O(name, max, 2, args, 1, opts); name = "E\000R\000R\000O\000R\000\000\000"; args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT; BC_P_O(name, error, 1, args, 1, opts); name = "C\000O\000U\000N\000T\000\000\000"; args[0] = ONIG_TYPE_CHAR; opts[0].c = '>'; BC_B_O(name, count, 1, args, 1, opts); name = "T\000O\000T\000A\000L\000_\000C\000O\000U\000N\000T\000\000\000"; args[0] = ONIG_TYPE_CHAR; opts[0].c = '>'; BC_B_O(name, total_count, 1, args, 1, opts); name = "C\000M\000P\000\000\000"; args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; args[1] = ONIG_TYPE_STRING; args[2] = ONIG_TYPE_TAG | ONIG_TYPE_LONG; BC_P(name, cmp, 3, args); #endif /* USE_CALLOUT */ return ONIG_NORMAL; } static const int EncLen_UTF16[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; static int utf16le_code_to_mbclen(OnigCodePoint code) { if (code > 0xffff) { if (code > 0x10ffff) return ONIGERR_INVALID_CODE_POINT_VALUE; else return 4; } else { return 2; } } static int utf16le_mbc_enc_len(const UChar* p) { return EncLen_UTF16[*(p+1)]; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { const UChar* end1 = end - 1; while (p < end1) { int len = utf16le_mbc_enc_len(p); if (len == 4) { if (p + 3 < end && ! UTF16_IS_SURROGATE_SECOND(*(p + 3))) return FALSE; } else if (UTF16_IS_SURROGATE_SECOND(*(p + 1))) return FALSE; p += len; } if (p != end) return FALSE; else return TRUE; } static int utf16le_is_mbc_newline(const UChar* p, const UChar* end) { if (p + 1 < end) { if (*p == NEWLINE_CODE && *(p+1) == 0x00) return 1; #ifdef USE_UNICODE_ALL_LINE_TERMINATORS if (( #ifndef USE_CRNL_AS_LINE_TERMINATOR *p == 0x0d || #endif *p == 0x85) && *(p+1) == 0x00) return 1; if (*(p+1) == 0x20 && (*p == 0x29 || *p == 0x28)) return 1; #endif } return 0; } static OnigCodePoint utf16le_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED) { OnigCodePoint code; UChar c0 = *p; UChar c1 = *(p+1); if (UTF16_IS_SURROGATE_FIRST(c1)) { code = ((((c1 - 0xd8) << 2) + ((c0 & 0xc0) >> 6) + 1) << 16) + ((((c0 & 0x3f) << 2) + (p[3] - 0xdc)) << 8) + p[2]; } else { code = c1 * 256 + p[0]; } return code; } static int utf16le_code_to_mbc(OnigCodePoint code, UChar *buf) { UChar* p = buf; if (code > 0xffff) { unsigned int plane, high; plane = (code >> 16) - 1; high = (code & 0xff00) >> 8; *p++ = ((plane & 0x03) << 6) + (high >> 2); *p++ = (plane >> 2) + 0xd8; *p++ = (UChar )(code & 0xff); *p = (high & 0x03) + 0xdc; return 4; } else { *p++ = (UChar )(code & 0xff); *p = (UChar )((code & 0xff00) >> 8); return 2; } } static int utf16le_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold) { const UChar* p = *pp; if (ONIGENC_IS_ASCII_CODE(*p) && *(p+1) == 0) { #ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) { if (*p == 0x49) { *fold++ = 0x31; *fold = 0x01; (*pp) += 2; return 2; } } #endif *fold++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p); *fold = 0; *pp += 2; return 2; } else return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF16_LE, flag, pp, end, fold); } static UChar* utf16le_left_adjust_char_head(const UChar* start, const UChar* s) { if (s <= start) return (UChar* )s; if ((s - start) % 2 != 0) { s--; } if (UTF16_IS_SURROGATE_SECOND(*(s+1)) && s > start + 1 && UTF16_IS_SURROGATE_FIRST(*(s-1))) s -= 2; return (UChar* )s; } static int utf16le_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF16_LE, flag, p, end, items); } OnigEncodingType OnigEncodingUTF16_LE = { utf16le_mbc_enc_len, "UTF-16LE", /* name */ 4, /* max enc length */ 2, /* min enc length */ utf16le_is_mbc_newline, utf16le_mbc_to_code, utf16le_code_to_mbclen, utf16le_code_to_mbc, utf16le_mbc_case_fold, onigenc_unicode_apply_all_case_fold, utf16le_get_case_fold_codes_by_str, onigenc_unicode_property_name_to_ctype, onigenc_unicode_is_code_ctype, onigenc_utf16_32_get_ctype_code_range, utf16le_left_adjust_char_head, onigenc_always_false_is_allowed_reverse_match, init, 0, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_UNICODE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/euc_jp.c0000644000175100017510000001727215215513537013342 /********************************************************************** euc_jp.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #define eucjp_islead(c) ((UChar )((c) - 0xa1) > 0xfe - 0xa1) static const int EncLen_EUCJP[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }; static int mbc_enc_len(const UChar* p) { return EncLen_EUCJP[*p]; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { while (p < end) { if (*p < 0x80) { p++; } else if (*p > 0xa0) { if (*p == 0xff) return FALSE; p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p == 0xff) return FALSE; p++; } else if (*p == 0x8e) { p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p > 0xdf) return FALSE; p++; } else if (*p == 0x8f) { p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p == 0xff) return FALSE; p++; if (p >= end) return FALSE; if (*p < 0xa1 || *p == 0xff) return FALSE; p++; } else return FALSE; } return TRUE; } static OnigCodePoint mbc_to_code(const UChar* p, const UChar* end) { int c, i, len; OnigCodePoint n; len = enclen(ONIG_ENCODING_EUC_JP, p); n = (OnigCodePoint )*p++; if (len == 1) return n; for (i = 1; i < len; i++) { if (p >= end) break; c = *p++; n <<= 8; n += c; } return n; } static int code_to_mbclen(OnigCodePoint code) { if (ONIGENC_IS_CODE_ASCII(code)) return 1; else if ((code & 0xff0000) != 0) { if (EncLen_EUCJP[(int )(code >> 16) & 0xff] == 3) return 3; } else if ((code & 0xff00) != 0) { if (EncLen_EUCJP[(int )(code >> 8) & 0xff] == 2) return 2; } else if (code < 256) { if (EncLen_EUCJP[(int )(code & 0xff)] == 1) return 1; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static int code_to_mbc(OnigCodePoint code, UChar *buf) { UChar *p = buf; if ((code & 0xff0000) != 0) { *p++ = (UChar )(((code >> 16) & 0xff)); *p++ = (UChar )(((code >> 8) & 0xff)); } else if ((code & 0xff00) != 0) *p++ = (UChar )(((code >> 8) & 0xff)); *p++ = (UChar )(code & 0xff); #if 1 if (enclen(ONIG_ENCODING_EUC_JP, buf) != (p - buf)) return ONIGERR_INVALID_CODE_POINT_VALUE; #endif return (int )(p - buf); } static int mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { int len; const UChar* p = *pp; if (ONIGENC_IS_MBC_ASCII(p)) { *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p); (*pp)++; return 1; } else { int i; len = enclen(ONIG_ENCODING_EUC_JP, p); for (i = 0; i < len; i++) { *lower++ = *p++; } (*pp) += len; return len; /* return byte length of converted char to lower */ } } static UChar* left_adjust_char_head(const UChar* start, const UChar* s) { /* In this encoding mb-trail bytes doesn't mix with single bytes. */ const UChar *p; int len; if (s <= start) return (UChar* )s; p = s; while (!eucjp_islead(*p) && p > start) p--; len = enclen(ONIG_ENCODING_EUC_JP, p); if (p + len > s) return (UChar* )p; p += len; return (UChar* )(p + ((s - p) & ~1)); } static int is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED) { const UChar c = *s; if (c <= 0x7e || c == 0x8e || c == 0x8f) return TRUE; else return FALSE; } static const OnigCodePoint CR_Hiragana[] = { 1, 0xa4a1, 0xa4f3 }; /* CR_Hiragana */ static const OnigCodePoint CR_Katakana[] = { 3, 0xa5a1, 0xa5f6, 0xaaa6, 0xaaaf, 0xaab1, 0xaadd }; /* CR_Katakana */ static const OnigCodePoint* PropertyList[] = { CR_Hiragana, CR_Katakana }; static int property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end) { struct PropertyNameCtype* pc; int len = (int )(end - p); char q[32]; if (len < sizeof(q) - 1) { xmemcpy(q, p, (size_t )len); q[len] = '\0'; pc = onigenc_euc_jp_lookup_property_name(q, len); if (pc != 0) return pc->ctype; } return ONIGERR_INVALID_CHAR_PROPERTY_NAME; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (ctype <= ONIGENC_MAX_STD_CTYPE) { if (code < 128) return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); else { if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) { return (code_to_mbclen(code) > 1 ? TRUE : FALSE); } } } else { ctype -= (ONIGENC_MAX_STD_CTYPE + 1); if (ctype >= (unsigned int )(sizeof(PropertyList)/sizeof(PropertyList[0]))) return ONIGERR_TYPE_BUG; return onig_is_in_code_range((UChar* )PropertyList[ctype], code); } return FALSE; } static int get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]) { if (ctype <= ONIGENC_MAX_STD_CTYPE) { return ONIG_NO_SUPPORT_CONFIG; } else { *sb_out = 0x80; ctype -= (ONIGENC_MAX_STD_CTYPE + 1); if (ctype >= (OnigCtype )sizeof(PropertyList)/sizeof(PropertyList[0])) return ONIGERR_TYPE_BUG; *ranges = PropertyList[ctype]; return 0; } } OnigEncodingType OnigEncodingEUC_JP = { mbc_enc_len, "EUC-JP", /* name */ 3, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, mbc_to_code, code_to_mbclen, code_to_mbc, mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, property_name_to_ctype, is_code_ctype, get_ctype_code_range, left_adjust_char_head, is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1_OR_0, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/gb18030.c0000644000175100017510000003536515215513537013064 /********************************************************************** gb18030.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2005-2023 KUBO Takehiro * K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" /* #define DEBUG_GB18030 */ #ifndef DEBUG_GB18030 #define DEBUG_OUT(arg) #else #ifndef NEED_TO_INCLUDE_STDIO #define NEED_TO_INCLUDE_STDIO #endif /* for printf() */ #include "regint.h" #define DEBUG_OUT(arg) printf arg #endif enum { C1, /* one-byte char */ C2, /* one-byte or second of two-byte char */ C4, /* one-byte or second or fourth of four-byte char */ CM /* first of two- or four-byte char or second of two-byte char */ }; static const char GB18030_MAP[] = { C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C1, C4, C4, C4, C4, C4, C4, C4, C4, C4, C4, C1, C1, C1, C1, C1, C1, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C2, C1, C2, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, CM, C1 }; static int gb18030_mbc_enc_len(const UChar* p) { if (GB18030_MAP[*p] != CM) return 1; p++; if (GB18030_MAP[*p] == C4) return 4; return 2; } static int gb18030_code_to_mbclen(OnigCodePoint code) { if ((code & 0xff000000) != 0) { if (GB18030_MAP[(int )(code >> 24) & 0xff] == CM) if (GB18030_MAP[(int )(code >> 16) & 0xff] == C4) return 4; } else if ((code & 0xff0000) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE; else if ((code & 0xff00) != 0) { if (GB18030_MAP[(int )(code >> 8) & 0xff] == CM) { char c = GB18030_MAP[(int )code & 0xff]; if (c == CM || c == C2) return 2; } } else { if (GB18030_MAP[(int )(code & 0xff)] != CM) return 1; } return ONIGERR_INVALID_CODE_POINT_VALUE; } static int is_valid_mbc_string(const UChar* p, const UChar* end) { while (p < end) { if (*p < 0x80) { p++; } else if (*p == 0x80 || *p == 0xff) { return FALSE; } else { p++; if (p >= end) return FALSE; if (*p < 0x40) { if (*p < 0x30 || *p > 0x39) return FALSE; p++; if (p >= end) return FALSE; if (*p < 0x81 || *p == 0xff) return FALSE; p++; if (p >= end) return FALSE; if (*p < 0x30 || *p > 0x39) return FALSE; p++; } else if (*p == 0x7f || *p == 0xff) { return FALSE; } else { p++; } } } return TRUE; } static OnigCodePoint gb18030_mbc_to_code(const UChar* p, const UChar* end) { return onigenc_mbn_mbc_to_code(ONIG_ENCODING_GB18030, p, end); } static int gb18030_code_to_mbc(OnigCodePoint code, UChar *buf) { return onigenc_mb4_code_to_mbc(ONIG_ENCODING_GB18030, code, buf); } static int gb18030_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* lower) { return onigenc_mbn_mbc_case_fold(ONIG_ENCODING_GB18030, flag, pp, end, lower); } static int gb18030_is_code_ctype(OnigCodePoint code, unsigned int ctype) { return onigenc_mb4_is_code_ctype(ONIG_ENCODING_GB18030, code, ctype); } enum state { S_START = 0, S_one_C2, S_one_C4, S_one_CM, S_odd_CM_one_CX, S_even_CM_one_CX, /* CMC4 : pair of "CM C4" */ S_one_CMC4, S_odd_CMC4, S_one_C4_odd_CMC4, S_even_CMC4, S_one_C4_even_CMC4, S_odd_CM_odd_CMC4, S_even_CM_odd_CMC4, S_odd_CM_even_CMC4, S_even_CM_even_CMC4, /* C4CM : pair of "C4 CM" */ S_odd_C4CM, S_one_CM_odd_C4CM, S_even_C4CM, S_one_CM_even_C4CM, S_even_CM_odd_C4CM, S_odd_CM_odd_C4CM, S_even_CM_even_C4CM, S_odd_CM_even_C4CM, }; #ifdef DEBUG_GB18030 static char* StateNames[] = { "S_START", "S_one_C2", "S_one_C4", "S_one_CM", "S_odd_CM_one_CX", "S_even_CM_one_CX", "S_one_CMC4", "S_odd_CMC4", "S_one_C4_odd_CMC4", "S_even_CMC4", "S_one_C4_even_CMC4", "S_odd_CM_odd_CMC4", "S_even_CM_odd_CMC4", "S_odd_CM_even_CMC4", "S_even_CM_even_CMC4", "S_odd_C4CM", "S_one_CM_odd_C4CM", "S_even_C4CM", "S_one_CM_even_C4CM", "S_even_CM_odd_C4CM", "S_odd_CM_odd_C4CM", "S_even_CM_even_C4CM", "S_odd_CM_even_C4CM" }; #endif static UChar* gb18030_left_adjust_char_head(const UChar* start, const UChar* s) { const UChar *p; enum state state = S_START; DEBUG_OUT(("----------------\n")); for (p = s; p >= start; p--) { DEBUG_OUT(("%5d: state %-19s (0x%02x)->\n", (int )(p - start), StateNames[state], *p)); switch (state) { case S_START: switch (GB18030_MAP[*p]) { case C1: return (UChar *)s; case C2: state = S_one_C2; /* C2 */ break; case C4: state = S_one_C4; /* C4 */ break; case CM: state = S_one_CM; /* CM */ break; } break; case S_one_C2: /* C2 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)s; case CM: state = S_odd_CM_one_CX; /* CM C2 */ break; } break; case S_one_C4: /* C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)s; case CM: state = S_one_CMC4; break; } break; case S_one_CM: /* CM */ switch (GB18030_MAP[*p]) { case C1: case C2: return (UChar *)s; case C4: state = S_odd_C4CM; break; case CM: state = S_odd_CM_one_CX; /* CM CM */ break; } break; case S_odd_CM_one_CX: /* CM C2 */ /* CM CM */ /* CM CM CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 1); case CM: state = S_even_CM_one_CX; break; } break; case S_even_CM_one_CX: /* CM CM C2 */ /* CM CM CM */ /* CM CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)s; case CM: state = S_odd_CM_one_CX; break; } break; case S_one_CMC4: /* CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: return (UChar *)(s - 1); case C4: state = S_one_C4_odd_CMC4; /* C4 CM C4 */ break; case CM: state = S_even_CM_one_CX; /* CM CM C4 */ break; } break; case S_odd_CMC4: /* CM C4 CM C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: return (UChar *)(s - 1); case C4: state = S_one_C4_odd_CMC4; break; case CM: state = S_odd_CM_odd_CMC4; break; } break; case S_one_C4_odd_CMC4: /* C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 1); case CM: state = S_even_CMC4; /* CM C4 CM C4 */ break; } break; case S_even_CMC4: /* CM C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: return (UChar *)(s - 3); case C4: state = S_one_C4_even_CMC4; break; case CM: state = S_odd_CM_even_CMC4; break; } break; case S_one_C4_even_CMC4: /* C4 CM C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 3); case CM: state = S_odd_CMC4; break; } break; case S_odd_CM_odd_CMC4: /* CM CM C4 CM C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 3); case CM: state = S_even_CM_odd_CMC4; break; } break; case S_even_CM_odd_CMC4: /* CM CM CM C4 CM C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 1); case CM: state = S_odd_CM_odd_CMC4; break; } break; case S_odd_CM_even_CMC4: /* CM CM C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 1); case CM: state = S_even_CM_even_CMC4; break; } break; case S_even_CM_even_CMC4: /* CM CM CM C4 CM C4 */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 3); case CM: state = S_odd_CM_even_CMC4; break; } break; case S_odd_C4CM: /* C4 CM */ /* C4 CM C4 CM C4 CM*/ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)s; case CM: state = S_one_CM_odd_C4CM; /* CM C4 CM */ break; } break; case S_one_CM_odd_C4CM: /* CM C4 CM */ /* CM C4 CM C4 CM C4 CM */ switch (GB18030_MAP[*p]) { case C1: case C2: return (UChar *)(s - 2); /* |CM C4 CM */ case C4: state = S_even_C4CM; break; case CM: state = S_even_CM_odd_C4CM; break; } break; case S_even_C4CM: /* C4 CM C4 CM */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 2); /* C4|CM C4 CM */ case CM: state = S_one_CM_even_C4CM; break; } break; case S_one_CM_even_C4CM: /* CM C4 CM C4 CM */ switch (GB18030_MAP[*p]) { case C1: case C2: return (UChar *)(s - 0); /*|CM C4 CM C4|CM */ case C4: state = S_odd_C4CM; break; case CM: state = S_even_CM_even_C4CM; break; } break; case S_even_CM_odd_C4CM: /* CM CM C4 CM */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 0); /* |CM CM|C4|CM */ case CM: state = S_odd_CM_odd_C4CM; break; } break; case S_odd_CM_odd_C4CM: /* CM CM CM C4 CM */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 2); /* |CM CM|CM C4 CM */ case CM: state = S_even_CM_odd_C4CM; break; } break; case S_even_CM_even_C4CM: /* CM CM C4 CM C4 CM */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 2); /* |CM CM|C4|CM C4 CM */ case CM: state = S_odd_CM_even_C4CM; break; } break; case S_odd_CM_even_C4CM: /* CM CM CM C4 CM C4 CM */ switch (GB18030_MAP[*p]) { case C1: case C2: case C4: return (UChar *)(s - 0); /* |CM CM|CM C4 CM C4|CM */ case CM: state = S_even_CM_even_C4CM; break; } break; } } DEBUG_OUT(("state %-19s\n", StateNames[state])); switch (state) { case S_START: return (UChar *)(s - 0); case S_one_C2: return (UChar *)(s - 0); case S_one_C4: return (UChar *)(s - 0); case S_one_CM: return (UChar *)(s - 0); case S_odd_CM_one_CX: return (UChar *)(s - 1); case S_even_CM_one_CX: return (UChar *)(s - 0); case S_one_CMC4: return (UChar *)(s - 1); case S_odd_CMC4: return (UChar *)(s - 1); case S_one_C4_odd_CMC4: return (UChar *)(s - 1); case S_even_CMC4: return (UChar *)(s - 3); case S_one_C4_even_CMC4: return (UChar *)(s - 3); case S_odd_CM_odd_CMC4: return (UChar *)(s - 3); case S_even_CM_odd_CMC4: return (UChar *)(s - 1); case S_odd_CM_even_CMC4: return (UChar *)(s - 1); case S_even_CM_even_CMC4: return (UChar *)(s - 3); case S_odd_C4CM: return (UChar *)(s - 0); case S_one_CM_odd_C4CM: return (UChar *)(s - 2); case S_even_C4CM: return (UChar *)(s - 2); case S_one_CM_even_C4CM: return (UChar *)(s - 0); case S_even_CM_odd_C4CM: return (UChar *)(s - 0); case S_odd_CM_odd_C4CM: return (UChar *)(s - 2); case S_even_CM_even_C4CM: return (UChar *)(s - 2); case S_odd_CM_even_C4CM: return (UChar *)(s - 0); } return (UChar* )s; /* never come here. (escape warning) */ } static int gb18030_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED) { return GB18030_MAP[*s] == C1 ? TRUE : FALSE; } OnigEncodingType OnigEncodingGB18030 = { gb18030_mbc_enc_len, "GB18030", /* name */ 4, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, gb18030_mbc_to_code, gb18030_code_to_mbclen, gb18030_code_to_mbc, gb18030_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, gb18030_is_code_ctype, onigenc_not_support_get_ctype_code_range, gb18030_left_adjust_char_head, gb18030_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/iso8859_2.c0000644000175100017510000002123615215513537013441 /********************************************************************** iso8859_2.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_2_TO_LOWER_CASE(c) EncISO_8859_2_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_2_CTYPE(code,ctype) \ ((EncISO_8859_2_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_2_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\261', '\242', '\263', '\244', '\265', '\266', '\247', '\250', '\271', '\272', '\273', '\274', '\255', '\276', '\277', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_2_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x00a0, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x00a0, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_2_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; /* return byte length of converted char to lower */ } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa1, 0xb1 }, { 0xa3, 0xb3 }, { 0xa5, 0xb5 }, { 0xa6, 0xb6 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xae, 0xbe }, { 0xaf, 0xbf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_2_CTYPE(code, ctype); else return FALSE; } OnigEncodingType OnigEncodingISO_8859_2 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-2", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/config.h.win640000644000175100017510000000243015215513537014303 #if defined(__MINGW32__) || _MSC_VER >= 1600 #define HAVE_STDINT_H 1 #endif #if defined(__MINGW32__) || _MSC_VER >= 1800 #define HAVE_INTTYPES_H 1 #endif #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_MEMORY_H 1 #define HAVE_OFF_T 1 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 #define SIZEOF_LONG_LONG 8 #define SIZEOF___INT64 8 #define SIZEOF_OFF_T 4 #define SIZEOF_VOIDP 8 #define SIZEOF_FLOAT 4 #define SIZEOF_DOUBLE 8 #define SIZEOF_SIZE_T 8 #define TOKEN_PASTE(x,y) x##y #ifndef NORETURN #if _MSC_VER > 1100 #define NORETURN(x) __declspec(noreturn) x #else #define NORETURN(x) x #endif #endif #define HAVE_DECL_SYS_NERR 1 #define HAVE_FCNTL_H 1 #define HAVE_SYS_UTIME_H 1 #define HAVE_MEMORY_H 1 #define uid_t int #define gid_t int #define GETGROUPS_T int #define HAVE_ALLOCA 1 #define HAVE_DUP2 1 #define HAVE_MKDIR 1 #define HAVE_FLOCK 1 #define HAVE_FINITE 1 #define HAVE_HYPOT 1 #define HAVE_WAITPID 1 #define HAVE_CHSIZE 1 #define HAVE_TIMES 1 #define HAVE_TELLDIR 1 #define HAVE_SEEKDIR 1 #define HAVE_EXECVE 1 #define HAVE_DAYLIGHT 1 #define SETPGRP_VOID 1 #define inline __inline #define NEED_IO_SEEK_BETWEEN_RW 1 #define RSHIFT(x,y) ((x)>>(int)y) #define FILE_COUNT _cnt #define FILE_READPTR _ptr #define DEFAULT_KCODE KCODE_NONE #define DLEXT ".so" #define DLEXT2 ".dll" jq-1.8.2/vendor/oniguruma/src/iso8859_9.c0000644000175100017510000002073715215513537013455 /********************************************************************** iso8859_9.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_9_TO_LOWER_CASE(c) EncISO_8859_9_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_9_CTYPE(code,ctype) \ ((EncISO_8859_9_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_9_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327', '\370', '\371', '\372', '\373', '\374', '\335', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_9_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0, 0x00a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_9_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_9_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_9 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-9", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/config.h.in0000644000175100017510000000557215215513553013752 /* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if using 'alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have 'alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if works. */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `void*', as computed by sizeof. */ #undef SIZEOF_VOIDP /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define if enable CR+NL as line terminator */ #undef USE_CRNL_AS_LINE_TERMINATOR /* Version number of package */ #undef VERSION /* Define to `unsigned int' if does not define. */ #undef size_t jq-1.8.2/vendor/oniguruma/src/iso8859_14.c0000644000175100017510000002136015215513537013522 /********************************************************************** iso8859_14.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_14_TO_LOWER_CASE(c) EncISO_8859_14_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_14_CTYPE(code,ctype) \ ((EncISO_8859_14_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_14_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\242', '\242', '\243', '\245', '\245', '\253', '\247', '\270', '\251', '\272', '\253', '\274', '\255', '\256', '\377', '\261', '\261', '\263', '\263', '\265', '\265', '\266', '\271', '\270', '\271', '\272', '\277', '\274', '\276', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_14_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x30e2, 0x00a0, 0x34a2, 0x30e2, 0x34a2, 0x00a0, 0x34a2, 0x00a0, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x00a0, 0x34a2, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x00a0, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_14_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; /* return byte length of converted char to lower */ } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_14_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa1, 0xa2 }, { 0xa4, 0xa5 }, { 0xa6, 0xab }, { 0xa8, 0xb8 }, { 0xaa, 0xba }, { 0xac, 0xbc }, { 0xaf, 0xff }, { 0xb0, 0xb1 }, { 0xb2, 0xb3 }, { 0xb4, 0xb5 }, { 0xb7, 0xb9 }, { 0xbb, 0xbf }, { 0xbd, 0xbe }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_14 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-14", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/euc_jp_prop.c0000644000175100017510000001236315215513537014376 /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -pt -T -L ANSI-C -N onigenc_euc_jp_lookup_property_name --output-file gperf1.tmp euc_jp_prop.gperf */ /* Computed positions: -k'1,3' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 1 "euc_jp_prop.gperf" #include "regint.h" #define TOTAL_KEYWORDS 16 #define MIN_WORD_LENGTH 4 #define MAX_WORD_LENGTH 8 #define MIN_HASH_VALUE 4 #define MAX_HASH_VALUE 55 /* maximum key range = 52, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash (register const char *str, register size_t len) { static unsigned char asso_values[] = { 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 0, 3, 10, 25, 56, 56, 30, 0, 56, 56, 0, 20, 56, 56, 56, 15, 56, 56, 20, 56, 30, 56, 0, 0, 56, 56, 56, 56, 56, 56, 56, 56, 15, 56, 56, 56, 56, 56, 25, 56, 10, 56, 56, 56, 56, 5, 56, 0, 56, 0, 56, 5, 56, 56, 20, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56 }; return (unsigned int )len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]]; } struct PropertyNameCtype * onigenc_euc_jp_lookup_property_name (register const char *str, register size_t len) { static struct PropertyNameCtype wordlist[] = { {""}, {""}, {""}, {""}, #line 22 "euc_jp_prop.gperf" {"Word", 12}, #line 11 "euc_jp_prop.gperf" {"Alpha", 1}, {""}, {""}, #line 25 "euc_jp_prop.gperf" {"Hiragana", 15}, {""}, #line 23 "euc_jp_prop.gperf" {"Alnum", 13}, {""}, {""}, #line 26 "euc_jp_prop.gperf" {"Katakana", 16}, {""}, #line 24 "euc_jp_prop.gperf" {"ASCII", 14}, #line 21 "euc_jp_prop.gperf" {"XDigit", 11}, {""}, {""}, {""}, #line 13 "euc_jp_prop.gperf" {"Cntrl", 3}, {""}, {""}, #line 12 "euc_jp_prop.gperf" {"Blank", 2}, {""}, #line 18 "euc_jp_prop.gperf" {"Punct", 8}, {""}, {""}, {""}, {""}, #line 17 "euc_jp_prop.gperf" {"Print", 7}, {""}, {""}, {""}, {""}, #line 20 "euc_jp_prop.gperf" {"Upper", 10}, {""}, {""}, {""}, {""}, #line 19 "euc_jp_prop.gperf" {"Space", 9}, {""}, {""}, {""}, {""}, #line 16 "euc_jp_prop.gperf" {"Lower", 6}, {""}, {""}, {""}, {""}, #line 15 "euc_jp_prop.gperf" {"Graph", 5}, {""}, {""}, {""}, {""}, #line 14 "euc_jp_prop.gperf" {"Digit", 4} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash (str, len); if (key <= MAX_HASH_VALUE) { register const char *s = wordlist[key].name; if (*str == *s && !strcmp (str + 1, s + 1)) return &wordlist[key]; } } return 0; } jq-1.8.2/vendor/oniguruma/src/iso8859_16.c0000644000175100017510000002127515215513537013531 /********************************************************************** iso8859_16.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_16_TO_LOWER_CASE(c) EncISO_8859_16_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_16_CTYPE(code,ctype) \ ((EncISO_8859_16_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_16_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\242', '\242', '\263', '\245', '\245', '\250', '\247', '\250', '\251', '\272', '\253', '\256', '\255', '\256', '\277', '\260', '\261', '\271', '\263', '\270', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\275', '\275', '\377', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_16_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x30e2, 0x34a2, 0x00a0, 0x01a0, 0x34a2, 0x00a0, 0x30e2, 0x00a0, 0x34a2, 0x01a0, 0x34a2, 0x01a0, 0x30e2, 0x34a2, 0x00a0, 0x00a0, 0x34a2, 0x30e2, 0x34a2, 0x01a0, 0x00a0, 0x01a0, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x34a2, 0x30e2, 0x34a2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_16_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; /* return byte length of converted char to lower */ } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_16_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa1, 0xa2 }, { 0xa3, 0xb3 }, { 0xa6, 0xa8 }, { 0xaa, 0xba }, { 0xac, 0xae }, { 0xaf, 0xbf }, { 0xb2, 0xb9 }, { 0xb4, 0xb8 }, { 0xbc, 0xbd }, { 0xbe, 0xff }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_16 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-16", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/unicode_egcb_data.c0000644000175100017510000014253415215513537015474 /* unicode_egcb_data.c: Generated by make_unicode_egcb_data.py. */ /*- * Copyright (c) 2017-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #define GRAPHEME_BREAK_PROPERTY_VERSION 160000 /* CR Control Extend L LF LV LVT Prepend Regional_Indicator SpacingMark T V ZWJ */ static int EGCB_RANGE_NUM = 1376; static EGCB_RANGE_TYPE EGCB_RANGES[] = { {0x000000, 0x000009, EGCB_Control }, {0x00000a, 0x00000a, EGCB_LF }, {0x00000b, 0x00000c, EGCB_Control }, {0x00000d, 0x00000d, EGCB_CR }, {0x00000e, 0x00001f, EGCB_Control }, {0x00007f, 0x00009f, EGCB_Control }, {0x0000ad, 0x0000ad, EGCB_Control }, {0x000300, 0x00036f, EGCB_Extend }, {0x000483, 0x000489, EGCB_Extend }, {0x000591, 0x0005bd, EGCB_Extend }, {0x0005bf, 0x0005bf, EGCB_Extend }, {0x0005c1, 0x0005c2, EGCB_Extend }, {0x0005c4, 0x0005c5, EGCB_Extend }, {0x0005c7, 0x0005c7, EGCB_Extend }, {0x000600, 0x000605, EGCB_Prepend }, {0x000610, 0x00061a, EGCB_Extend }, {0x00061c, 0x00061c, EGCB_Control }, {0x00064b, 0x00065f, EGCB_Extend }, {0x000670, 0x000670, EGCB_Extend }, {0x0006d6, 0x0006dc, EGCB_Extend }, {0x0006dd, 0x0006dd, EGCB_Prepend }, {0x0006df, 0x0006e4, EGCB_Extend }, {0x0006e7, 0x0006e8, EGCB_Extend }, {0x0006ea, 0x0006ed, EGCB_Extend }, {0x00070f, 0x00070f, EGCB_Prepend }, {0x000711, 0x000711, EGCB_Extend }, {0x000730, 0x00074a, EGCB_Extend }, {0x0007a6, 0x0007b0, EGCB_Extend }, {0x0007eb, 0x0007f3, EGCB_Extend }, {0x0007fd, 0x0007fd, EGCB_Extend }, {0x000816, 0x000819, EGCB_Extend }, {0x00081b, 0x000823, EGCB_Extend }, {0x000825, 0x000827, EGCB_Extend }, {0x000829, 0x00082d, EGCB_Extend }, {0x000859, 0x00085b, EGCB_Extend }, {0x000890, 0x000891, EGCB_Prepend }, {0x000897, 0x00089f, EGCB_Extend }, {0x0008ca, 0x0008e1, EGCB_Extend }, {0x0008e2, 0x0008e2, EGCB_Prepend }, {0x0008e3, 0x000902, EGCB_Extend }, {0x000903, 0x000903, EGCB_SpacingMark }, {0x00093a, 0x00093a, EGCB_Extend }, {0x00093b, 0x00093b, EGCB_SpacingMark }, {0x00093c, 0x00093c, EGCB_Extend }, {0x00093e, 0x000940, EGCB_SpacingMark }, {0x000941, 0x000948, EGCB_Extend }, {0x000949, 0x00094c, EGCB_SpacingMark }, {0x00094d, 0x00094d, EGCB_Extend }, {0x00094e, 0x00094f, EGCB_SpacingMark }, {0x000951, 0x000957, EGCB_Extend }, {0x000962, 0x000963, EGCB_Extend }, {0x000981, 0x000981, EGCB_Extend }, {0x000982, 0x000983, EGCB_SpacingMark }, {0x0009bc, 0x0009bc, EGCB_Extend }, {0x0009be, 0x0009be, EGCB_Extend }, {0x0009bf, 0x0009c0, EGCB_SpacingMark }, {0x0009c1, 0x0009c4, EGCB_Extend }, {0x0009c7, 0x0009c8, EGCB_SpacingMark }, {0x0009cb, 0x0009cc, EGCB_SpacingMark }, {0x0009cd, 0x0009cd, EGCB_Extend }, {0x0009d7, 0x0009d7, EGCB_Extend }, {0x0009e2, 0x0009e3, EGCB_Extend }, {0x0009fe, 0x0009fe, EGCB_Extend }, {0x000a01, 0x000a02, EGCB_Extend }, {0x000a03, 0x000a03, EGCB_SpacingMark }, {0x000a3c, 0x000a3c, EGCB_Extend }, {0x000a3e, 0x000a40, EGCB_SpacingMark }, {0x000a41, 0x000a42, EGCB_Extend }, {0x000a47, 0x000a48, EGCB_Extend }, {0x000a4b, 0x000a4d, EGCB_Extend }, {0x000a51, 0x000a51, EGCB_Extend }, {0x000a70, 0x000a71, EGCB_Extend }, {0x000a75, 0x000a75, EGCB_Extend }, {0x000a81, 0x000a82, EGCB_Extend }, {0x000a83, 0x000a83, EGCB_SpacingMark }, {0x000abc, 0x000abc, EGCB_Extend }, {0x000abe, 0x000ac0, EGCB_SpacingMark }, {0x000ac1, 0x000ac5, EGCB_Extend }, {0x000ac7, 0x000ac8, EGCB_Extend }, {0x000ac9, 0x000ac9, EGCB_SpacingMark }, {0x000acb, 0x000acc, EGCB_SpacingMark }, {0x000acd, 0x000acd, EGCB_Extend }, {0x000ae2, 0x000ae3, EGCB_Extend }, {0x000afa, 0x000aff, EGCB_Extend }, {0x000b01, 0x000b01, EGCB_Extend }, {0x000b02, 0x000b03, EGCB_SpacingMark }, {0x000b3c, 0x000b3c, EGCB_Extend }, {0x000b3e, 0x000b3f, EGCB_Extend }, {0x000b40, 0x000b40, EGCB_SpacingMark }, {0x000b41, 0x000b44, EGCB_Extend }, {0x000b47, 0x000b48, EGCB_SpacingMark }, {0x000b4b, 0x000b4c, EGCB_SpacingMark }, {0x000b4d, 0x000b4d, EGCB_Extend }, {0x000b55, 0x000b57, EGCB_Extend }, {0x000b62, 0x000b63, EGCB_Extend }, {0x000b82, 0x000b82, EGCB_Extend }, {0x000bbe, 0x000bbe, EGCB_Extend }, {0x000bbf, 0x000bbf, EGCB_SpacingMark }, {0x000bc0, 0x000bc0, EGCB_Extend }, {0x000bc1, 0x000bc2, EGCB_SpacingMark }, {0x000bc6, 0x000bc8, EGCB_SpacingMark }, {0x000bca, 0x000bcc, EGCB_SpacingMark }, {0x000bcd, 0x000bcd, EGCB_Extend }, {0x000bd7, 0x000bd7, EGCB_Extend }, {0x000c00, 0x000c00, EGCB_Extend }, {0x000c01, 0x000c03, EGCB_SpacingMark }, {0x000c04, 0x000c04, EGCB_Extend }, {0x000c3c, 0x000c3c, EGCB_Extend }, {0x000c3e, 0x000c40, EGCB_Extend }, {0x000c41, 0x000c44, EGCB_SpacingMark }, {0x000c46, 0x000c48, EGCB_Extend }, {0x000c4a, 0x000c4d, EGCB_Extend }, {0x000c55, 0x000c56, EGCB_Extend }, {0x000c62, 0x000c63, EGCB_Extend }, {0x000c81, 0x000c81, EGCB_Extend }, {0x000c82, 0x000c83, EGCB_SpacingMark }, {0x000cbc, 0x000cbc, EGCB_Extend }, {0x000cbe, 0x000cbe, EGCB_SpacingMark }, {0x000cbf, 0x000cc0, EGCB_Extend }, {0x000cc1, 0x000cc1, EGCB_SpacingMark }, {0x000cc2, 0x000cc2, EGCB_Extend }, {0x000cc3, 0x000cc4, EGCB_SpacingMark }, {0x000cc6, 0x000cc8, EGCB_Extend }, {0x000cca, 0x000ccd, EGCB_Extend }, {0x000cd5, 0x000cd6, EGCB_Extend }, {0x000ce2, 0x000ce3, EGCB_Extend }, {0x000cf3, 0x000cf3, EGCB_SpacingMark }, {0x000d00, 0x000d01, EGCB_Extend }, {0x000d02, 0x000d03, EGCB_SpacingMark }, {0x000d3b, 0x000d3c, EGCB_Extend }, {0x000d3e, 0x000d3e, EGCB_Extend }, {0x000d3f, 0x000d40, EGCB_SpacingMark }, {0x000d41, 0x000d44, EGCB_Extend }, {0x000d46, 0x000d48, EGCB_SpacingMark }, {0x000d4a, 0x000d4c, EGCB_SpacingMark }, {0x000d4d, 0x000d4d, EGCB_Extend }, {0x000d4e, 0x000d4e, EGCB_Prepend }, {0x000d57, 0x000d57, EGCB_Extend }, {0x000d62, 0x000d63, EGCB_Extend }, {0x000d81, 0x000d81, EGCB_Extend }, {0x000d82, 0x000d83, EGCB_SpacingMark }, {0x000dca, 0x000dca, EGCB_Extend }, {0x000dcf, 0x000dcf, EGCB_Extend }, {0x000dd0, 0x000dd1, EGCB_SpacingMark }, {0x000dd2, 0x000dd4, EGCB_Extend }, {0x000dd6, 0x000dd6, EGCB_Extend }, {0x000dd8, 0x000dde, EGCB_SpacingMark }, {0x000ddf, 0x000ddf, EGCB_Extend }, {0x000df2, 0x000df3, EGCB_SpacingMark }, {0x000e31, 0x000e31, EGCB_Extend }, {0x000e33, 0x000e33, EGCB_SpacingMark }, {0x000e34, 0x000e3a, EGCB_Extend }, {0x000e47, 0x000e4e, EGCB_Extend }, {0x000eb1, 0x000eb1, EGCB_Extend }, {0x000eb3, 0x000eb3, EGCB_SpacingMark }, {0x000eb4, 0x000ebc, EGCB_Extend }, {0x000ec8, 0x000ece, EGCB_Extend }, {0x000f18, 0x000f19, EGCB_Extend }, {0x000f35, 0x000f35, EGCB_Extend }, {0x000f37, 0x000f37, EGCB_Extend }, {0x000f39, 0x000f39, EGCB_Extend }, {0x000f3e, 0x000f3f, EGCB_SpacingMark }, {0x000f71, 0x000f7e, EGCB_Extend }, {0x000f7f, 0x000f7f, EGCB_SpacingMark }, {0x000f80, 0x000f84, EGCB_Extend }, {0x000f86, 0x000f87, EGCB_Extend }, {0x000f8d, 0x000f97, EGCB_Extend }, {0x000f99, 0x000fbc, EGCB_Extend }, {0x000fc6, 0x000fc6, EGCB_Extend }, {0x00102d, 0x001030, EGCB_Extend }, {0x001031, 0x001031, EGCB_SpacingMark }, {0x001032, 0x001037, EGCB_Extend }, {0x001039, 0x00103a, EGCB_Extend }, {0x00103b, 0x00103c, EGCB_SpacingMark }, {0x00103d, 0x00103e, EGCB_Extend }, {0x001056, 0x001057, EGCB_SpacingMark }, {0x001058, 0x001059, EGCB_Extend }, {0x00105e, 0x001060, EGCB_Extend }, {0x001071, 0x001074, EGCB_Extend }, {0x001082, 0x001082, EGCB_Extend }, {0x001084, 0x001084, EGCB_SpacingMark }, {0x001085, 0x001086, EGCB_Extend }, {0x00108d, 0x00108d, EGCB_Extend }, {0x00109d, 0x00109d, EGCB_Extend }, {0x001100, 0x00115f, EGCB_L }, {0x001160, 0x0011a7, EGCB_V }, {0x0011a8, 0x0011ff, EGCB_T }, {0x00135d, 0x00135f, EGCB_Extend }, {0x001712, 0x001715, EGCB_Extend }, {0x001732, 0x001734, EGCB_Extend }, {0x001752, 0x001753, EGCB_Extend }, {0x001772, 0x001773, EGCB_Extend }, {0x0017b4, 0x0017b5, EGCB_Extend }, {0x0017b6, 0x0017b6, EGCB_SpacingMark }, {0x0017b7, 0x0017bd, EGCB_Extend }, {0x0017be, 0x0017c5, EGCB_SpacingMark }, {0x0017c6, 0x0017c6, EGCB_Extend }, {0x0017c7, 0x0017c8, EGCB_SpacingMark }, {0x0017c9, 0x0017d3, EGCB_Extend }, {0x0017dd, 0x0017dd, EGCB_Extend }, {0x00180b, 0x00180d, EGCB_Extend }, {0x00180e, 0x00180e, EGCB_Control }, {0x00180f, 0x00180f, EGCB_Extend }, {0x001885, 0x001886, EGCB_Extend }, {0x0018a9, 0x0018a9, EGCB_Extend }, {0x001920, 0x001922, EGCB_Extend }, {0x001923, 0x001926, EGCB_SpacingMark }, {0x001927, 0x001928, EGCB_Extend }, {0x001929, 0x00192b, EGCB_SpacingMark }, {0x001930, 0x001931, EGCB_SpacingMark }, {0x001932, 0x001932, EGCB_Extend }, {0x001933, 0x001938, EGCB_SpacingMark }, {0x001939, 0x00193b, EGCB_Extend }, {0x001a17, 0x001a18, EGCB_Extend }, {0x001a19, 0x001a1a, EGCB_SpacingMark }, {0x001a1b, 0x001a1b, EGCB_Extend }, {0x001a55, 0x001a55, EGCB_SpacingMark }, {0x001a56, 0x001a56, EGCB_Extend }, {0x001a57, 0x001a57, EGCB_SpacingMark }, {0x001a58, 0x001a5e, EGCB_Extend }, {0x001a60, 0x001a60, EGCB_Extend }, {0x001a62, 0x001a62, EGCB_Extend }, {0x001a65, 0x001a6c, EGCB_Extend }, {0x001a6d, 0x001a72, EGCB_SpacingMark }, {0x001a73, 0x001a7c, EGCB_Extend }, {0x001a7f, 0x001a7f, EGCB_Extend }, {0x001ab0, 0x001ace, EGCB_Extend }, {0x001b00, 0x001b03, EGCB_Extend }, {0x001b04, 0x001b04, EGCB_SpacingMark }, {0x001b34, 0x001b3d, EGCB_Extend }, {0x001b3e, 0x001b41, EGCB_SpacingMark }, {0x001b42, 0x001b44, EGCB_Extend }, {0x001b6b, 0x001b73, EGCB_Extend }, {0x001b80, 0x001b81, EGCB_Extend }, {0x001b82, 0x001b82, EGCB_SpacingMark }, {0x001ba1, 0x001ba1, EGCB_SpacingMark }, {0x001ba2, 0x001ba5, EGCB_Extend }, {0x001ba6, 0x001ba7, EGCB_SpacingMark }, {0x001ba8, 0x001bad, EGCB_Extend }, {0x001be6, 0x001be6, EGCB_Extend }, {0x001be7, 0x001be7, EGCB_SpacingMark }, {0x001be8, 0x001be9, EGCB_Extend }, {0x001bea, 0x001bec, EGCB_SpacingMark }, {0x001bed, 0x001bed, EGCB_Extend }, {0x001bee, 0x001bee, EGCB_SpacingMark }, {0x001bef, 0x001bf3, EGCB_Extend }, {0x001c24, 0x001c2b, EGCB_SpacingMark }, {0x001c2c, 0x001c33, EGCB_Extend }, {0x001c34, 0x001c35, EGCB_SpacingMark }, {0x001c36, 0x001c37, EGCB_Extend }, {0x001cd0, 0x001cd2, EGCB_Extend }, {0x001cd4, 0x001ce0, EGCB_Extend }, {0x001ce1, 0x001ce1, EGCB_SpacingMark }, {0x001ce2, 0x001ce8, EGCB_Extend }, {0x001ced, 0x001ced, EGCB_Extend }, {0x001cf4, 0x001cf4, EGCB_Extend }, {0x001cf7, 0x001cf7, EGCB_SpacingMark }, {0x001cf8, 0x001cf9, EGCB_Extend }, {0x001dc0, 0x001dff, EGCB_Extend }, {0x00200b, 0x00200b, EGCB_Control }, {0x00200c, 0x00200c, EGCB_Extend }, {0x00200d, 0x00200d, EGCB_ZWJ }, {0x00200e, 0x00200f, EGCB_Control }, {0x002028, 0x00202e, EGCB_Control }, {0x002060, 0x00206f, EGCB_Control }, {0x0020d0, 0x0020f0, EGCB_Extend }, {0x002cef, 0x002cf1, EGCB_Extend }, {0x002d7f, 0x002d7f, EGCB_Extend }, {0x002de0, 0x002dff, EGCB_Extend }, {0x00302a, 0x00302f, EGCB_Extend }, {0x003099, 0x00309a, EGCB_Extend }, {0x00a66f, 0x00a672, EGCB_Extend }, {0x00a674, 0x00a67d, EGCB_Extend }, {0x00a69e, 0x00a69f, EGCB_Extend }, {0x00a6f0, 0x00a6f1, EGCB_Extend }, {0x00a802, 0x00a802, EGCB_Extend }, {0x00a806, 0x00a806, EGCB_Extend }, {0x00a80b, 0x00a80b, EGCB_Extend }, {0x00a823, 0x00a824, EGCB_SpacingMark }, {0x00a825, 0x00a826, EGCB_Extend }, {0x00a827, 0x00a827, EGCB_SpacingMark }, {0x00a82c, 0x00a82c, EGCB_Extend }, {0x00a880, 0x00a881, EGCB_SpacingMark }, {0x00a8b4, 0x00a8c3, EGCB_SpacingMark }, {0x00a8c4, 0x00a8c5, EGCB_Extend }, {0x00a8e0, 0x00a8f1, EGCB_Extend }, {0x00a8ff, 0x00a8ff, EGCB_Extend }, {0x00a926, 0x00a92d, EGCB_Extend }, {0x00a947, 0x00a951, EGCB_Extend }, {0x00a952, 0x00a952, EGCB_SpacingMark }, {0x00a953, 0x00a953, EGCB_Extend }, {0x00a960, 0x00a97c, EGCB_L }, {0x00a980, 0x00a982, EGCB_Extend }, {0x00a983, 0x00a983, EGCB_SpacingMark }, {0x00a9b3, 0x00a9b3, EGCB_Extend }, {0x00a9b4, 0x00a9b5, EGCB_SpacingMark }, {0x00a9b6, 0x00a9b9, EGCB_Extend }, {0x00a9ba, 0x00a9bb, EGCB_SpacingMark }, {0x00a9bc, 0x00a9bd, EGCB_Extend }, {0x00a9be, 0x00a9bf, EGCB_SpacingMark }, {0x00a9c0, 0x00a9c0, EGCB_Extend }, {0x00a9e5, 0x00a9e5, EGCB_Extend }, {0x00aa29, 0x00aa2e, EGCB_Extend }, {0x00aa2f, 0x00aa30, EGCB_SpacingMark }, {0x00aa31, 0x00aa32, EGCB_Extend }, {0x00aa33, 0x00aa34, EGCB_SpacingMark }, {0x00aa35, 0x00aa36, EGCB_Extend }, {0x00aa43, 0x00aa43, EGCB_Extend }, {0x00aa4c, 0x00aa4c, EGCB_Extend }, {0x00aa4d, 0x00aa4d, EGCB_SpacingMark }, {0x00aa7c, 0x00aa7c, EGCB_Extend }, {0x00aab0, 0x00aab0, EGCB_Extend }, {0x00aab2, 0x00aab4, EGCB_Extend }, {0x00aab7, 0x00aab8, EGCB_Extend }, {0x00aabe, 0x00aabf, EGCB_Extend }, {0x00aac1, 0x00aac1, EGCB_Extend }, {0x00aaeb, 0x00aaeb, EGCB_SpacingMark }, {0x00aaec, 0x00aaed, EGCB_Extend }, {0x00aaee, 0x00aaef, EGCB_SpacingMark }, {0x00aaf5, 0x00aaf5, EGCB_SpacingMark }, {0x00aaf6, 0x00aaf6, EGCB_Extend }, {0x00abe3, 0x00abe4, EGCB_SpacingMark }, {0x00abe5, 0x00abe5, EGCB_Extend }, {0x00abe6, 0x00abe7, EGCB_SpacingMark }, {0x00abe8, 0x00abe8, EGCB_Extend }, {0x00abe9, 0x00abea, EGCB_SpacingMark }, {0x00abec, 0x00abec, EGCB_SpacingMark }, {0x00abed, 0x00abed, EGCB_Extend }, {0x00ac00, 0x00ac00, EGCB_LV }, {0x00ac01, 0x00ac1b, EGCB_LVT }, {0x00ac1c, 0x00ac1c, EGCB_LV }, {0x00ac1d, 0x00ac37, EGCB_LVT }, {0x00ac38, 0x00ac38, EGCB_LV }, {0x00ac39, 0x00ac53, EGCB_LVT }, {0x00ac54, 0x00ac54, EGCB_LV }, {0x00ac55, 0x00ac6f, EGCB_LVT }, {0x00ac70, 0x00ac70, EGCB_LV }, {0x00ac71, 0x00ac8b, EGCB_LVT }, {0x00ac8c, 0x00ac8c, EGCB_LV }, {0x00ac8d, 0x00aca7, EGCB_LVT }, {0x00aca8, 0x00aca8, EGCB_LV }, {0x00aca9, 0x00acc3, EGCB_LVT }, {0x00acc4, 0x00acc4, EGCB_LV }, {0x00acc5, 0x00acdf, EGCB_LVT }, {0x00ace0, 0x00ace0, EGCB_LV }, {0x00ace1, 0x00acfb, EGCB_LVT }, {0x00acfc, 0x00acfc, EGCB_LV }, {0x00acfd, 0x00ad17, EGCB_LVT }, {0x00ad18, 0x00ad18, EGCB_LV }, {0x00ad19, 0x00ad33, EGCB_LVT }, {0x00ad34, 0x00ad34, EGCB_LV }, {0x00ad35, 0x00ad4f, EGCB_LVT }, {0x00ad50, 0x00ad50, EGCB_LV }, {0x00ad51, 0x00ad6b, EGCB_LVT }, {0x00ad6c, 0x00ad6c, EGCB_LV }, {0x00ad6d, 0x00ad87, EGCB_LVT }, {0x00ad88, 0x00ad88, EGCB_LV }, {0x00ad89, 0x00ada3, EGCB_LVT }, {0x00ada4, 0x00ada4, EGCB_LV }, {0x00ada5, 0x00adbf, EGCB_LVT }, {0x00adc0, 0x00adc0, EGCB_LV }, {0x00adc1, 0x00addb, EGCB_LVT }, {0x00addc, 0x00addc, EGCB_LV }, {0x00addd, 0x00adf7, EGCB_LVT }, {0x00adf8, 0x00adf8, EGCB_LV }, {0x00adf9, 0x00ae13, EGCB_LVT }, {0x00ae14, 0x00ae14, EGCB_LV }, {0x00ae15, 0x00ae2f, EGCB_LVT }, {0x00ae30, 0x00ae30, EGCB_LV }, {0x00ae31, 0x00ae4b, EGCB_LVT }, {0x00ae4c, 0x00ae4c, EGCB_LV }, {0x00ae4d, 0x00ae67, EGCB_LVT }, {0x00ae68, 0x00ae68, EGCB_LV }, {0x00ae69, 0x00ae83, EGCB_LVT }, {0x00ae84, 0x00ae84, EGCB_LV }, {0x00ae85, 0x00ae9f, EGCB_LVT }, {0x00aea0, 0x00aea0, EGCB_LV }, {0x00aea1, 0x00aebb, EGCB_LVT }, {0x00aebc, 0x00aebc, EGCB_LV }, {0x00aebd, 0x00aed7, EGCB_LVT }, {0x00aed8, 0x00aed8, EGCB_LV }, {0x00aed9, 0x00aef3, EGCB_LVT }, {0x00aef4, 0x00aef4, EGCB_LV }, {0x00aef5, 0x00af0f, EGCB_LVT }, {0x00af10, 0x00af10, EGCB_LV }, {0x00af11, 0x00af2b, EGCB_LVT }, {0x00af2c, 0x00af2c, EGCB_LV }, {0x00af2d, 0x00af47, EGCB_LVT }, {0x00af48, 0x00af48, EGCB_LV }, {0x00af49, 0x00af63, EGCB_LVT }, {0x00af64, 0x00af64, EGCB_LV }, {0x00af65, 0x00af7f, EGCB_LVT }, {0x00af80, 0x00af80, EGCB_LV }, {0x00af81, 0x00af9b, EGCB_LVT }, {0x00af9c, 0x00af9c, EGCB_LV }, {0x00af9d, 0x00afb7, EGCB_LVT }, {0x00afb8, 0x00afb8, EGCB_LV }, {0x00afb9, 0x00afd3, EGCB_LVT }, {0x00afd4, 0x00afd4, EGCB_LV }, {0x00afd5, 0x00afef, EGCB_LVT }, {0x00aff0, 0x00aff0, EGCB_LV }, {0x00aff1, 0x00b00b, EGCB_LVT }, {0x00b00c, 0x00b00c, EGCB_LV }, {0x00b00d, 0x00b027, EGCB_LVT }, {0x00b028, 0x00b028, EGCB_LV }, {0x00b029, 0x00b043, EGCB_LVT }, {0x00b044, 0x00b044, EGCB_LV }, {0x00b045, 0x00b05f, EGCB_LVT }, {0x00b060, 0x00b060, EGCB_LV }, {0x00b061, 0x00b07b, EGCB_LVT }, {0x00b07c, 0x00b07c, EGCB_LV }, {0x00b07d, 0x00b097, EGCB_LVT }, {0x00b098, 0x00b098, EGCB_LV }, {0x00b099, 0x00b0b3, EGCB_LVT }, {0x00b0b4, 0x00b0b4, EGCB_LV }, {0x00b0b5, 0x00b0cf, EGCB_LVT }, {0x00b0d0, 0x00b0d0, EGCB_LV }, {0x00b0d1, 0x00b0eb, EGCB_LVT }, {0x00b0ec, 0x00b0ec, EGCB_LV }, {0x00b0ed, 0x00b107, EGCB_LVT }, {0x00b108, 0x00b108, EGCB_LV }, {0x00b109, 0x00b123, EGCB_LVT }, {0x00b124, 0x00b124, EGCB_LV }, {0x00b125, 0x00b13f, EGCB_LVT }, {0x00b140, 0x00b140, EGCB_LV }, {0x00b141, 0x00b15b, EGCB_LVT }, {0x00b15c, 0x00b15c, EGCB_LV }, {0x00b15d, 0x00b177, EGCB_LVT }, {0x00b178, 0x00b178, EGCB_LV }, {0x00b179, 0x00b193, EGCB_LVT }, {0x00b194, 0x00b194, EGCB_LV }, {0x00b195, 0x00b1af, EGCB_LVT }, {0x00b1b0, 0x00b1b0, EGCB_LV }, {0x00b1b1, 0x00b1cb, EGCB_LVT }, {0x00b1cc, 0x00b1cc, EGCB_LV }, {0x00b1cd, 0x00b1e7, EGCB_LVT }, {0x00b1e8, 0x00b1e8, EGCB_LV }, {0x00b1e9, 0x00b203, EGCB_LVT }, {0x00b204, 0x00b204, EGCB_LV }, {0x00b205, 0x00b21f, EGCB_LVT }, {0x00b220, 0x00b220, EGCB_LV }, {0x00b221, 0x00b23b, EGCB_LVT }, {0x00b23c, 0x00b23c, EGCB_LV }, {0x00b23d, 0x00b257, EGCB_LVT }, {0x00b258, 0x00b258, EGCB_LV }, {0x00b259, 0x00b273, EGCB_LVT }, {0x00b274, 0x00b274, EGCB_LV }, {0x00b275, 0x00b28f, EGCB_LVT }, {0x00b290, 0x00b290, EGCB_LV }, {0x00b291, 0x00b2ab, EGCB_LVT }, {0x00b2ac, 0x00b2ac, EGCB_LV }, {0x00b2ad, 0x00b2c7, EGCB_LVT }, {0x00b2c8, 0x00b2c8, EGCB_LV }, {0x00b2c9, 0x00b2e3, EGCB_LVT }, {0x00b2e4, 0x00b2e4, EGCB_LV }, {0x00b2e5, 0x00b2ff, EGCB_LVT }, {0x00b300, 0x00b300, EGCB_LV }, {0x00b301, 0x00b31b, EGCB_LVT }, {0x00b31c, 0x00b31c, EGCB_LV }, {0x00b31d, 0x00b337, EGCB_LVT }, {0x00b338, 0x00b338, EGCB_LV }, {0x00b339, 0x00b353, EGCB_LVT }, {0x00b354, 0x00b354, EGCB_LV }, {0x00b355, 0x00b36f, EGCB_LVT }, {0x00b370, 0x00b370, EGCB_LV }, {0x00b371, 0x00b38b, EGCB_LVT }, {0x00b38c, 0x00b38c, EGCB_LV }, {0x00b38d, 0x00b3a7, EGCB_LVT }, {0x00b3a8, 0x00b3a8, EGCB_LV }, {0x00b3a9, 0x00b3c3, EGCB_LVT }, {0x00b3c4, 0x00b3c4, EGCB_LV }, {0x00b3c5, 0x00b3df, EGCB_LVT }, {0x00b3e0, 0x00b3e0, EGCB_LV }, {0x00b3e1, 0x00b3fb, EGCB_LVT }, {0x00b3fc, 0x00b3fc, EGCB_LV }, {0x00b3fd, 0x00b417, EGCB_LVT }, {0x00b418, 0x00b418, EGCB_LV }, {0x00b419, 0x00b433, EGCB_LVT }, {0x00b434, 0x00b434, EGCB_LV }, {0x00b435, 0x00b44f, EGCB_LVT }, {0x00b450, 0x00b450, EGCB_LV }, {0x00b451, 0x00b46b, EGCB_LVT }, {0x00b46c, 0x00b46c, EGCB_LV }, {0x00b46d, 0x00b487, EGCB_LVT }, {0x00b488, 0x00b488, EGCB_LV }, {0x00b489, 0x00b4a3, EGCB_LVT }, {0x00b4a4, 0x00b4a4, EGCB_LV }, {0x00b4a5, 0x00b4bf, EGCB_LVT }, {0x00b4c0, 0x00b4c0, EGCB_LV }, {0x00b4c1, 0x00b4db, EGCB_LVT }, {0x00b4dc, 0x00b4dc, EGCB_LV }, {0x00b4dd, 0x00b4f7, EGCB_LVT }, {0x00b4f8, 0x00b4f8, EGCB_LV }, {0x00b4f9, 0x00b513, EGCB_LVT }, {0x00b514, 0x00b514, EGCB_LV }, {0x00b515, 0x00b52f, EGCB_LVT }, {0x00b530, 0x00b530, EGCB_LV }, {0x00b531, 0x00b54b, EGCB_LVT }, {0x00b54c, 0x00b54c, EGCB_LV }, {0x00b54d, 0x00b567, EGCB_LVT }, {0x00b568, 0x00b568, EGCB_LV }, {0x00b569, 0x00b583, EGCB_LVT }, {0x00b584, 0x00b584, EGCB_LV }, {0x00b585, 0x00b59f, EGCB_LVT }, {0x00b5a0, 0x00b5a0, EGCB_LV }, {0x00b5a1, 0x00b5bb, EGCB_LVT }, {0x00b5bc, 0x00b5bc, EGCB_LV }, {0x00b5bd, 0x00b5d7, EGCB_LVT }, {0x00b5d8, 0x00b5d8, EGCB_LV }, {0x00b5d9, 0x00b5f3, EGCB_LVT }, {0x00b5f4, 0x00b5f4, EGCB_LV }, {0x00b5f5, 0x00b60f, EGCB_LVT }, {0x00b610, 0x00b610, EGCB_LV }, {0x00b611, 0x00b62b, EGCB_LVT }, {0x00b62c, 0x00b62c, EGCB_LV }, {0x00b62d, 0x00b647, EGCB_LVT }, {0x00b648, 0x00b648, EGCB_LV }, {0x00b649, 0x00b663, EGCB_LVT }, {0x00b664, 0x00b664, EGCB_LV }, {0x00b665, 0x00b67f, EGCB_LVT }, {0x00b680, 0x00b680, EGCB_LV }, {0x00b681, 0x00b69b, EGCB_LVT }, {0x00b69c, 0x00b69c, EGCB_LV }, {0x00b69d, 0x00b6b7, EGCB_LVT }, {0x00b6b8, 0x00b6b8, EGCB_LV }, {0x00b6b9, 0x00b6d3, EGCB_LVT }, {0x00b6d4, 0x00b6d4, EGCB_LV }, {0x00b6d5, 0x00b6ef, EGCB_LVT }, {0x00b6f0, 0x00b6f0, EGCB_LV }, {0x00b6f1, 0x00b70b, EGCB_LVT }, {0x00b70c, 0x00b70c, EGCB_LV }, {0x00b70d, 0x00b727, EGCB_LVT }, {0x00b728, 0x00b728, EGCB_LV }, {0x00b729, 0x00b743, EGCB_LVT }, {0x00b744, 0x00b744, EGCB_LV }, {0x00b745, 0x00b75f, EGCB_LVT }, {0x00b760, 0x00b760, EGCB_LV }, {0x00b761, 0x00b77b, EGCB_LVT }, {0x00b77c, 0x00b77c, EGCB_LV }, {0x00b77d, 0x00b797, EGCB_LVT }, {0x00b798, 0x00b798, EGCB_LV }, {0x00b799, 0x00b7b3, EGCB_LVT }, {0x00b7b4, 0x00b7b4, EGCB_LV }, {0x00b7b5, 0x00b7cf, EGCB_LVT }, {0x00b7d0, 0x00b7d0, EGCB_LV }, {0x00b7d1, 0x00b7eb, EGCB_LVT }, {0x00b7ec, 0x00b7ec, EGCB_LV }, {0x00b7ed, 0x00b807, EGCB_LVT }, {0x00b808, 0x00b808, EGCB_LV }, {0x00b809, 0x00b823, EGCB_LVT }, {0x00b824, 0x00b824, EGCB_LV }, {0x00b825, 0x00b83f, EGCB_LVT }, {0x00b840, 0x00b840, EGCB_LV }, {0x00b841, 0x00b85b, EGCB_LVT }, {0x00b85c, 0x00b85c, EGCB_LV }, {0x00b85d, 0x00b877, EGCB_LVT }, {0x00b878, 0x00b878, EGCB_LV }, {0x00b879, 0x00b893, EGCB_LVT }, {0x00b894, 0x00b894, EGCB_LV }, {0x00b895, 0x00b8af, EGCB_LVT }, {0x00b8b0, 0x00b8b0, EGCB_LV }, {0x00b8b1, 0x00b8cb, EGCB_LVT }, {0x00b8cc, 0x00b8cc, EGCB_LV }, {0x00b8cd, 0x00b8e7, EGCB_LVT }, {0x00b8e8, 0x00b8e8, EGCB_LV }, {0x00b8e9, 0x00b903, EGCB_LVT }, {0x00b904, 0x00b904, EGCB_LV }, {0x00b905, 0x00b91f, EGCB_LVT }, {0x00b920, 0x00b920, EGCB_LV }, {0x00b921, 0x00b93b, EGCB_LVT }, {0x00b93c, 0x00b93c, EGCB_LV }, {0x00b93d, 0x00b957, EGCB_LVT }, {0x00b958, 0x00b958, EGCB_LV }, {0x00b959, 0x00b973, EGCB_LVT }, {0x00b974, 0x00b974, EGCB_LV }, {0x00b975, 0x00b98f, EGCB_LVT }, {0x00b990, 0x00b990, EGCB_LV }, {0x00b991, 0x00b9ab, EGCB_LVT }, {0x00b9ac, 0x00b9ac, EGCB_LV }, {0x00b9ad, 0x00b9c7, EGCB_LVT }, {0x00b9c8, 0x00b9c8, EGCB_LV }, {0x00b9c9, 0x00b9e3, EGCB_LVT }, {0x00b9e4, 0x00b9e4, EGCB_LV }, {0x00b9e5, 0x00b9ff, EGCB_LVT }, {0x00ba00, 0x00ba00, EGCB_LV }, {0x00ba01, 0x00ba1b, EGCB_LVT }, {0x00ba1c, 0x00ba1c, EGCB_LV }, {0x00ba1d, 0x00ba37, EGCB_LVT }, {0x00ba38, 0x00ba38, EGCB_LV }, {0x00ba39, 0x00ba53, EGCB_LVT }, {0x00ba54, 0x00ba54, EGCB_LV }, {0x00ba55, 0x00ba6f, EGCB_LVT }, {0x00ba70, 0x00ba70, EGCB_LV }, {0x00ba71, 0x00ba8b, EGCB_LVT }, {0x00ba8c, 0x00ba8c, EGCB_LV }, {0x00ba8d, 0x00baa7, EGCB_LVT }, {0x00baa8, 0x00baa8, EGCB_LV }, {0x00baa9, 0x00bac3, EGCB_LVT }, {0x00bac4, 0x00bac4, EGCB_LV }, {0x00bac5, 0x00badf, EGCB_LVT }, {0x00bae0, 0x00bae0, EGCB_LV }, {0x00bae1, 0x00bafb, EGCB_LVT }, {0x00bafc, 0x00bafc, EGCB_LV }, {0x00bafd, 0x00bb17, EGCB_LVT }, {0x00bb18, 0x00bb18, EGCB_LV }, {0x00bb19, 0x00bb33, EGCB_LVT }, {0x00bb34, 0x00bb34, EGCB_LV }, {0x00bb35, 0x00bb4f, EGCB_LVT }, {0x00bb50, 0x00bb50, EGCB_LV }, {0x00bb51, 0x00bb6b, EGCB_LVT }, {0x00bb6c, 0x00bb6c, EGCB_LV }, {0x00bb6d, 0x00bb87, EGCB_LVT }, {0x00bb88, 0x00bb88, EGCB_LV }, {0x00bb89, 0x00bba3, EGCB_LVT }, {0x00bba4, 0x00bba4, EGCB_LV }, {0x00bba5, 0x00bbbf, EGCB_LVT }, {0x00bbc0, 0x00bbc0, EGCB_LV }, {0x00bbc1, 0x00bbdb, EGCB_LVT }, {0x00bbdc, 0x00bbdc, EGCB_LV }, {0x00bbdd, 0x00bbf7, EGCB_LVT }, {0x00bbf8, 0x00bbf8, EGCB_LV }, {0x00bbf9, 0x00bc13, EGCB_LVT }, {0x00bc14, 0x00bc14, EGCB_LV }, {0x00bc15, 0x00bc2f, EGCB_LVT }, {0x00bc30, 0x00bc30, EGCB_LV }, {0x00bc31, 0x00bc4b, EGCB_LVT }, {0x00bc4c, 0x00bc4c, EGCB_LV }, {0x00bc4d, 0x00bc67, EGCB_LVT }, {0x00bc68, 0x00bc68, EGCB_LV }, {0x00bc69, 0x00bc83, EGCB_LVT }, {0x00bc84, 0x00bc84, EGCB_LV }, {0x00bc85, 0x00bc9f, EGCB_LVT }, {0x00bca0, 0x00bca0, EGCB_LV }, {0x00bca1, 0x00bcbb, EGCB_LVT }, {0x00bcbc, 0x00bcbc, EGCB_LV }, {0x00bcbd, 0x00bcd7, EGCB_LVT }, {0x00bcd8, 0x00bcd8, EGCB_LV }, {0x00bcd9, 0x00bcf3, EGCB_LVT }, {0x00bcf4, 0x00bcf4, EGCB_LV }, {0x00bcf5, 0x00bd0f, EGCB_LVT }, {0x00bd10, 0x00bd10, EGCB_LV }, {0x00bd11, 0x00bd2b, EGCB_LVT }, {0x00bd2c, 0x00bd2c, EGCB_LV }, {0x00bd2d, 0x00bd47, EGCB_LVT }, {0x00bd48, 0x00bd48, EGCB_LV }, {0x00bd49, 0x00bd63, EGCB_LVT }, {0x00bd64, 0x00bd64, EGCB_LV }, {0x00bd65, 0x00bd7f, EGCB_LVT }, {0x00bd80, 0x00bd80, EGCB_LV }, {0x00bd81, 0x00bd9b, EGCB_LVT }, {0x00bd9c, 0x00bd9c, EGCB_LV }, {0x00bd9d, 0x00bdb7, EGCB_LVT }, {0x00bdb8, 0x00bdb8, EGCB_LV }, {0x00bdb9, 0x00bdd3, EGCB_LVT }, {0x00bdd4, 0x00bdd4, EGCB_LV }, {0x00bdd5, 0x00bdef, EGCB_LVT }, {0x00bdf0, 0x00bdf0, EGCB_LV }, {0x00bdf1, 0x00be0b, EGCB_LVT }, {0x00be0c, 0x00be0c, EGCB_LV }, {0x00be0d, 0x00be27, EGCB_LVT }, {0x00be28, 0x00be28, EGCB_LV }, {0x00be29, 0x00be43, EGCB_LVT }, {0x00be44, 0x00be44, EGCB_LV }, {0x00be45, 0x00be5f, EGCB_LVT }, {0x00be60, 0x00be60, EGCB_LV }, {0x00be61, 0x00be7b, EGCB_LVT }, {0x00be7c, 0x00be7c, EGCB_LV }, {0x00be7d, 0x00be97, EGCB_LVT }, {0x00be98, 0x00be98, EGCB_LV }, {0x00be99, 0x00beb3, EGCB_LVT }, {0x00beb4, 0x00beb4, EGCB_LV }, {0x00beb5, 0x00becf, EGCB_LVT }, {0x00bed0, 0x00bed0, EGCB_LV }, {0x00bed1, 0x00beeb, EGCB_LVT }, {0x00beec, 0x00beec, EGCB_LV }, {0x00beed, 0x00bf07, EGCB_LVT }, {0x00bf08, 0x00bf08, EGCB_LV }, {0x00bf09, 0x00bf23, EGCB_LVT }, {0x00bf24, 0x00bf24, EGCB_LV }, {0x00bf25, 0x00bf3f, EGCB_LVT }, {0x00bf40, 0x00bf40, EGCB_LV }, {0x00bf41, 0x00bf5b, EGCB_LVT }, {0x00bf5c, 0x00bf5c, EGCB_LV }, {0x00bf5d, 0x00bf77, EGCB_LVT }, {0x00bf78, 0x00bf78, EGCB_LV }, {0x00bf79, 0x00bf93, EGCB_LVT }, {0x00bf94, 0x00bf94, EGCB_LV }, {0x00bf95, 0x00bfaf, EGCB_LVT }, {0x00bfb0, 0x00bfb0, EGCB_LV }, {0x00bfb1, 0x00bfcb, EGCB_LVT }, {0x00bfcc, 0x00bfcc, EGCB_LV }, {0x00bfcd, 0x00bfe7, EGCB_LVT }, {0x00bfe8, 0x00bfe8, EGCB_LV }, {0x00bfe9, 0x00c003, EGCB_LVT }, {0x00c004, 0x00c004, EGCB_LV }, {0x00c005, 0x00c01f, EGCB_LVT }, {0x00c020, 0x00c020, EGCB_LV }, {0x00c021, 0x00c03b, EGCB_LVT }, {0x00c03c, 0x00c03c, EGCB_LV }, {0x00c03d, 0x00c057, EGCB_LVT }, {0x00c058, 0x00c058, EGCB_LV }, {0x00c059, 0x00c073, EGCB_LVT }, {0x00c074, 0x00c074, EGCB_LV }, {0x00c075, 0x00c08f, EGCB_LVT }, {0x00c090, 0x00c090, EGCB_LV }, {0x00c091, 0x00c0ab, EGCB_LVT }, {0x00c0ac, 0x00c0ac, EGCB_LV }, {0x00c0ad, 0x00c0c7, EGCB_LVT }, {0x00c0c8, 0x00c0c8, EGCB_LV }, {0x00c0c9, 0x00c0e3, EGCB_LVT }, {0x00c0e4, 0x00c0e4, EGCB_LV }, {0x00c0e5, 0x00c0ff, EGCB_LVT }, {0x00c100, 0x00c100, EGCB_LV }, {0x00c101, 0x00c11b, EGCB_LVT }, {0x00c11c, 0x00c11c, EGCB_LV }, {0x00c11d, 0x00c137, EGCB_LVT }, {0x00c138, 0x00c138, EGCB_LV }, {0x00c139, 0x00c153, EGCB_LVT }, {0x00c154, 0x00c154, EGCB_LV }, {0x00c155, 0x00c16f, EGCB_LVT }, {0x00c170, 0x00c170, EGCB_LV }, {0x00c171, 0x00c18b, EGCB_LVT }, {0x00c18c, 0x00c18c, EGCB_LV }, {0x00c18d, 0x00c1a7, EGCB_LVT }, {0x00c1a8, 0x00c1a8, EGCB_LV }, {0x00c1a9, 0x00c1c3, EGCB_LVT }, {0x00c1c4, 0x00c1c4, EGCB_LV }, {0x00c1c5, 0x00c1df, EGCB_LVT }, {0x00c1e0, 0x00c1e0, EGCB_LV }, {0x00c1e1, 0x00c1fb, EGCB_LVT }, {0x00c1fc, 0x00c1fc, EGCB_LV }, {0x00c1fd, 0x00c217, EGCB_LVT }, {0x00c218, 0x00c218, EGCB_LV }, {0x00c219, 0x00c233, EGCB_LVT }, {0x00c234, 0x00c234, EGCB_LV }, {0x00c235, 0x00c24f, EGCB_LVT }, {0x00c250, 0x00c250, EGCB_LV }, {0x00c251, 0x00c26b, EGCB_LVT }, {0x00c26c, 0x00c26c, EGCB_LV }, {0x00c26d, 0x00c287, EGCB_LVT }, {0x00c288, 0x00c288, EGCB_LV }, {0x00c289, 0x00c2a3, EGCB_LVT }, {0x00c2a4, 0x00c2a4, EGCB_LV }, {0x00c2a5, 0x00c2bf, EGCB_LVT }, {0x00c2c0, 0x00c2c0, EGCB_LV }, {0x00c2c1, 0x00c2db, EGCB_LVT }, {0x00c2dc, 0x00c2dc, EGCB_LV }, {0x00c2dd, 0x00c2f7, EGCB_LVT }, {0x00c2f8, 0x00c2f8, EGCB_LV }, {0x00c2f9, 0x00c313, EGCB_LVT }, {0x00c314, 0x00c314, EGCB_LV }, {0x00c315, 0x00c32f, EGCB_LVT }, {0x00c330, 0x00c330, EGCB_LV }, {0x00c331, 0x00c34b, EGCB_LVT }, {0x00c34c, 0x00c34c, EGCB_LV }, {0x00c34d, 0x00c367, EGCB_LVT }, {0x00c368, 0x00c368, EGCB_LV }, {0x00c369, 0x00c383, EGCB_LVT }, {0x00c384, 0x00c384, EGCB_LV }, {0x00c385, 0x00c39f, EGCB_LVT }, {0x00c3a0, 0x00c3a0, EGCB_LV }, {0x00c3a1, 0x00c3bb, EGCB_LVT }, {0x00c3bc, 0x00c3bc, EGCB_LV }, {0x00c3bd, 0x00c3d7, EGCB_LVT }, {0x00c3d8, 0x00c3d8, EGCB_LV }, {0x00c3d9, 0x00c3f3, EGCB_LVT }, {0x00c3f4, 0x00c3f4, EGCB_LV }, {0x00c3f5, 0x00c40f, EGCB_LVT }, {0x00c410, 0x00c410, EGCB_LV }, {0x00c411, 0x00c42b, EGCB_LVT }, {0x00c42c, 0x00c42c, EGCB_LV }, {0x00c42d, 0x00c447, EGCB_LVT }, {0x00c448, 0x00c448, EGCB_LV }, {0x00c449, 0x00c463, EGCB_LVT }, {0x00c464, 0x00c464, EGCB_LV }, {0x00c465, 0x00c47f, EGCB_LVT }, {0x00c480, 0x00c480, EGCB_LV }, {0x00c481, 0x00c49b, EGCB_LVT }, {0x00c49c, 0x00c49c, EGCB_LV }, {0x00c49d, 0x00c4b7, EGCB_LVT }, {0x00c4b8, 0x00c4b8, EGCB_LV }, {0x00c4b9, 0x00c4d3, EGCB_LVT }, {0x00c4d4, 0x00c4d4, EGCB_LV }, {0x00c4d5, 0x00c4ef, EGCB_LVT }, {0x00c4f0, 0x00c4f0, EGCB_LV }, {0x00c4f1, 0x00c50b, EGCB_LVT }, {0x00c50c, 0x00c50c, EGCB_LV }, {0x00c50d, 0x00c527, EGCB_LVT }, {0x00c528, 0x00c528, EGCB_LV }, {0x00c529, 0x00c543, EGCB_LVT }, {0x00c544, 0x00c544, EGCB_LV }, {0x00c545, 0x00c55f, EGCB_LVT }, {0x00c560, 0x00c560, EGCB_LV }, {0x00c561, 0x00c57b, EGCB_LVT }, {0x00c57c, 0x00c57c, EGCB_LV }, {0x00c57d, 0x00c597, EGCB_LVT }, {0x00c598, 0x00c598, EGCB_LV }, {0x00c599, 0x00c5b3, EGCB_LVT }, {0x00c5b4, 0x00c5b4, EGCB_LV }, {0x00c5b5, 0x00c5cf, EGCB_LVT }, {0x00c5d0, 0x00c5d0, EGCB_LV }, {0x00c5d1, 0x00c5eb, EGCB_LVT }, {0x00c5ec, 0x00c5ec, EGCB_LV }, {0x00c5ed, 0x00c607, EGCB_LVT }, {0x00c608, 0x00c608, EGCB_LV }, {0x00c609, 0x00c623, EGCB_LVT }, {0x00c624, 0x00c624, EGCB_LV }, {0x00c625, 0x00c63f, EGCB_LVT }, {0x00c640, 0x00c640, EGCB_LV }, {0x00c641, 0x00c65b, EGCB_LVT }, {0x00c65c, 0x00c65c, EGCB_LV }, {0x00c65d, 0x00c677, EGCB_LVT }, {0x00c678, 0x00c678, EGCB_LV }, {0x00c679, 0x00c693, EGCB_LVT }, {0x00c694, 0x00c694, EGCB_LV }, {0x00c695, 0x00c6af, EGCB_LVT }, {0x00c6b0, 0x00c6b0, EGCB_LV }, {0x00c6b1, 0x00c6cb, EGCB_LVT }, {0x00c6cc, 0x00c6cc, EGCB_LV }, {0x00c6cd, 0x00c6e7, EGCB_LVT }, {0x00c6e8, 0x00c6e8, EGCB_LV }, {0x00c6e9, 0x00c703, EGCB_LVT }, {0x00c704, 0x00c704, EGCB_LV }, {0x00c705, 0x00c71f, EGCB_LVT }, {0x00c720, 0x00c720, EGCB_LV }, {0x00c721, 0x00c73b, EGCB_LVT }, {0x00c73c, 0x00c73c, EGCB_LV }, {0x00c73d, 0x00c757, EGCB_LVT }, {0x00c758, 0x00c758, EGCB_LV }, {0x00c759, 0x00c773, EGCB_LVT }, {0x00c774, 0x00c774, EGCB_LV }, {0x00c775, 0x00c78f, EGCB_LVT }, {0x00c790, 0x00c790, EGCB_LV }, {0x00c791, 0x00c7ab, EGCB_LVT }, {0x00c7ac, 0x00c7ac, EGCB_LV }, {0x00c7ad, 0x00c7c7, EGCB_LVT }, {0x00c7c8, 0x00c7c8, EGCB_LV }, {0x00c7c9, 0x00c7e3, EGCB_LVT }, {0x00c7e4, 0x00c7e4, EGCB_LV }, {0x00c7e5, 0x00c7ff, EGCB_LVT }, {0x00c800, 0x00c800, EGCB_LV }, {0x00c801, 0x00c81b, EGCB_LVT }, {0x00c81c, 0x00c81c, EGCB_LV }, {0x00c81d, 0x00c837, EGCB_LVT }, {0x00c838, 0x00c838, EGCB_LV }, {0x00c839, 0x00c853, EGCB_LVT }, {0x00c854, 0x00c854, EGCB_LV }, {0x00c855, 0x00c86f, EGCB_LVT }, {0x00c870, 0x00c870, EGCB_LV }, {0x00c871, 0x00c88b, EGCB_LVT }, {0x00c88c, 0x00c88c, EGCB_LV }, {0x00c88d, 0x00c8a7, EGCB_LVT }, {0x00c8a8, 0x00c8a8, EGCB_LV }, {0x00c8a9, 0x00c8c3, EGCB_LVT }, {0x00c8c4, 0x00c8c4, EGCB_LV }, {0x00c8c5, 0x00c8df, EGCB_LVT }, {0x00c8e0, 0x00c8e0, EGCB_LV }, {0x00c8e1, 0x00c8fb, EGCB_LVT }, {0x00c8fc, 0x00c8fc, EGCB_LV }, {0x00c8fd, 0x00c917, EGCB_LVT }, {0x00c918, 0x00c918, EGCB_LV }, {0x00c919, 0x00c933, EGCB_LVT }, {0x00c934, 0x00c934, EGCB_LV }, {0x00c935, 0x00c94f, EGCB_LVT }, {0x00c950, 0x00c950, EGCB_LV }, {0x00c951, 0x00c96b, EGCB_LVT }, {0x00c96c, 0x00c96c, EGCB_LV }, {0x00c96d, 0x00c987, EGCB_LVT }, {0x00c988, 0x00c988, EGCB_LV }, {0x00c989, 0x00c9a3, EGCB_LVT }, {0x00c9a4, 0x00c9a4, EGCB_LV }, {0x00c9a5, 0x00c9bf, EGCB_LVT }, {0x00c9c0, 0x00c9c0, EGCB_LV }, {0x00c9c1, 0x00c9db, EGCB_LVT }, {0x00c9dc, 0x00c9dc, EGCB_LV }, {0x00c9dd, 0x00c9f7, EGCB_LVT }, {0x00c9f8, 0x00c9f8, EGCB_LV }, {0x00c9f9, 0x00ca13, EGCB_LVT }, {0x00ca14, 0x00ca14, EGCB_LV }, {0x00ca15, 0x00ca2f, EGCB_LVT }, {0x00ca30, 0x00ca30, EGCB_LV }, {0x00ca31, 0x00ca4b, EGCB_LVT }, {0x00ca4c, 0x00ca4c, EGCB_LV }, {0x00ca4d, 0x00ca67, EGCB_LVT }, {0x00ca68, 0x00ca68, EGCB_LV }, {0x00ca69, 0x00ca83, EGCB_LVT }, {0x00ca84, 0x00ca84, EGCB_LV }, {0x00ca85, 0x00ca9f, EGCB_LVT }, {0x00caa0, 0x00caa0, EGCB_LV }, {0x00caa1, 0x00cabb, EGCB_LVT }, {0x00cabc, 0x00cabc, EGCB_LV }, {0x00cabd, 0x00cad7, EGCB_LVT }, {0x00cad8, 0x00cad8, EGCB_LV }, {0x00cad9, 0x00caf3, EGCB_LVT }, {0x00caf4, 0x00caf4, EGCB_LV }, {0x00caf5, 0x00cb0f, EGCB_LVT }, {0x00cb10, 0x00cb10, EGCB_LV }, {0x00cb11, 0x00cb2b, EGCB_LVT }, {0x00cb2c, 0x00cb2c, EGCB_LV }, {0x00cb2d, 0x00cb47, EGCB_LVT }, {0x00cb48, 0x00cb48, EGCB_LV }, {0x00cb49, 0x00cb63, EGCB_LVT }, {0x00cb64, 0x00cb64, EGCB_LV }, {0x00cb65, 0x00cb7f, EGCB_LVT }, {0x00cb80, 0x00cb80, EGCB_LV }, {0x00cb81, 0x00cb9b, EGCB_LVT }, {0x00cb9c, 0x00cb9c, EGCB_LV }, {0x00cb9d, 0x00cbb7, EGCB_LVT }, {0x00cbb8, 0x00cbb8, EGCB_LV }, {0x00cbb9, 0x00cbd3, EGCB_LVT }, {0x00cbd4, 0x00cbd4, EGCB_LV }, {0x00cbd5, 0x00cbef, EGCB_LVT }, {0x00cbf0, 0x00cbf0, EGCB_LV }, {0x00cbf1, 0x00cc0b, EGCB_LVT }, {0x00cc0c, 0x00cc0c, EGCB_LV }, {0x00cc0d, 0x00cc27, EGCB_LVT }, {0x00cc28, 0x00cc28, EGCB_LV }, {0x00cc29, 0x00cc43, EGCB_LVT }, {0x00cc44, 0x00cc44, EGCB_LV }, {0x00cc45, 0x00cc5f, EGCB_LVT }, {0x00cc60, 0x00cc60, EGCB_LV }, {0x00cc61, 0x00cc7b, EGCB_LVT }, {0x00cc7c, 0x00cc7c, EGCB_LV }, {0x00cc7d, 0x00cc97, EGCB_LVT }, {0x00cc98, 0x00cc98, EGCB_LV }, {0x00cc99, 0x00ccb3, EGCB_LVT }, {0x00ccb4, 0x00ccb4, EGCB_LV }, {0x00ccb5, 0x00cccf, EGCB_LVT }, {0x00ccd0, 0x00ccd0, EGCB_LV }, {0x00ccd1, 0x00cceb, EGCB_LVT }, {0x00ccec, 0x00ccec, EGCB_LV }, {0x00cced, 0x00cd07, EGCB_LVT }, {0x00cd08, 0x00cd08, EGCB_LV }, {0x00cd09, 0x00cd23, EGCB_LVT }, {0x00cd24, 0x00cd24, EGCB_LV }, {0x00cd25, 0x00cd3f, EGCB_LVT }, {0x00cd40, 0x00cd40, EGCB_LV }, {0x00cd41, 0x00cd5b, EGCB_LVT }, {0x00cd5c, 0x00cd5c, EGCB_LV }, {0x00cd5d, 0x00cd77, EGCB_LVT }, {0x00cd78, 0x00cd78, EGCB_LV }, {0x00cd79, 0x00cd93, EGCB_LVT }, {0x00cd94, 0x00cd94, EGCB_LV }, {0x00cd95, 0x00cdaf, EGCB_LVT }, {0x00cdb0, 0x00cdb0, EGCB_LV }, {0x00cdb1, 0x00cdcb, EGCB_LVT }, {0x00cdcc, 0x00cdcc, EGCB_LV }, {0x00cdcd, 0x00cde7, EGCB_LVT }, {0x00cde8, 0x00cde8, EGCB_LV }, {0x00cde9, 0x00ce03, EGCB_LVT }, {0x00ce04, 0x00ce04, EGCB_LV }, {0x00ce05, 0x00ce1f, EGCB_LVT }, {0x00ce20, 0x00ce20, EGCB_LV }, {0x00ce21, 0x00ce3b, EGCB_LVT }, {0x00ce3c, 0x00ce3c, EGCB_LV }, {0x00ce3d, 0x00ce57, EGCB_LVT }, {0x00ce58, 0x00ce58, EGCB_LV }, {0x00ce59, 0x00ce73, EGCB_LVT }, {0x00ce74, 0x00ce74, EGCB_LV }, {0x00ce75, 0x00ce8f, EGCB_LVT }, {0x00ce90, 0x00ce90, EGCB_LV }, {0x00ce91, 0x00ceab, EGCB_LVT }, {0x00ceac, 0x00ceac, EGCB_LV }, {0x00cead, 0x00cec7, EGCB_LVT }, {0x00cec8, 0x00cec8, EGCB_LV }, {0x00cec9, 0x00cee3, EGCB_LVT }, {0x00cee4, 0x00cee4, EGCB_LV }, {0x00cee5, 0x00ceff, EGCB_LVT }, {0x00cf00, 0x00cf00, EGCB_LV }, {0x00cf01, 0x00cf1b, EGCB_LVT }, {0x00cf1c, 0x00cf1c, EGCB_LV }, {0x00cf1d, 0x00cf37, EGCB_LVT }, {0x00cf38, 0x00cf38, EGCB_LV }, {0x00cf39, 0x00cf53, EGCB_LVT }, {0x00cf54, 0x00cf54, EGCB_LV }, {0x00cf55, 0x00cf6f, EGCB_LVT }, {0x00cf70, 0x00cf70, EGCB_LV }, {0x00cf71, 0x00cf8b, EGCB_LVT }, {0x00cf8c, 0x00cf8c, EGCB_LV }, {0x00cf8d, 0x00cfa7, EGCB_LVT }, {0x00cfa8, 0x00cfa8, EGCB_LV }, {0x00cfa9, 0x00cfc3, EGCB_LVT }, {0x00cfc4, 0x00cfc4, EGCB_LV }, {0x00cfc5, 0x00cfdf, EGCB_LVT }, {0x00cfe0, 0x00cfe0, EGCB_LV }, {0x00cfe1, 0x00cffb, EGCB_LVT }, {0x00cffc, 0x00cffc, EGCB_LV }, {0x00cffd, 0x00d017, EGCB_LVT }, {0x00d018, 0x00d018, EGCB_LV }, {0x00d019, 0x00d033, EGCB_LVT }, {0x00d034, 0x00d034, EGCB_LV }, {0x00d035, 0x00d04f, EGCB_LVT }, {0x00d050, 0x00d050, EGCB_LV }, {0x00d051, 0x00d06b, EGCB_LVT }, {0x00d06c, 0x00d06c, EGCB_LV }, {0x00d06d, 0x00d087, EGCB_LVT }, {0x00d088, 0x00d088, EGCB_LV }, {0x00d089, 0x00d0a3, EGCB_LVT }, {0x00d0a4, 0x00d0a4, EGCB_LV }, {0x00d0a5, 0x00d0bf, EGCB_LVT }, {0x00d0c0, 0x00d0c0, EGCB_LV }, {0x00d0c1, 0x00d0db, EGCB_LVT }, {0x00d0dc, 0x00d0dc, EGCB_LV }, {0x00d0dd, 0x00d0f7, EGCB_LVT }, {0x00d0f8, 0x00d0f8, EGCB_LV }, {0x00d0f9, 0x00d113, EGCB_LVT }, {0x00d114, 0x00d114, EGCB_LV }, {0x00d115, 0x00d12f, EGCB_LVT }, {0x00d130, 0x00d130, EGCB_LV }, {0x00d131, 0x00d14b, EGCB_LVT }, {0x00d14c, 0x00d14c, EGCB_LV }, {0x00d14d, 0x00d167, EGCB_LVT }, {0x00d168, 0x00d168, EGCB_LV }, {0x00d169, 0x00d183, EGCB_LVT }, {0x00d184, 0x00d184, EGCB_LV }, {0x00d185, 0x00d19f, EGCB_LVT }, {0x00d1a0, 0x00d1a0, EGCB_LV }, {0x00d1a1, 0x00d1bb, EGCB_LVT }, {0x00d1bc, 0x00d1bc, EGCB_LV }, {0x00d1bd, 0x00d1d7, EGCB_LVT }, {0x00d1d8, 0x00d1d8, EGCB_LV }, {0x00d1d9, 0x00d1f3, EGCB_LVT }, {0x00d1f4, 0x00d1f4, EGCB_LV }, {0x00d1f5, 0x00d20f, EGCB_LVT }, {0x00d210, 0x00d210, EGCB_LV }, {0x00d211, 0x00d22b, EGCB_LVT }, {0x00d22c, 0x00d22c, EGCB_LV }, {0x00d22d, 0x00d247, EGCB_LVT }, {0x00d248, 0x00d248, EGCB_LV }, {0x00d249, 0x00d263, EGCB_LVT }, {0x00d264, 0x00d264, EGCB_LV }, {0x00d265, 0x00d27f, EGCB_LVT }, {0x00d280, 0x00d280, EGCB_LV }, {0x00d281, 0x00d29b, EGCB_LVT }, {0x00d29c, 0x00d29c, EGCB_LV }, {0x00d29d, 0x00d2b7, EGCB_LVT }, {0x00d2b8, 0x00d2b8, EGCB_LV }, {0x00d2b9, 0x00d2d3, EGCB_LVT }, {0x00d2d4, 0x00d2d4, EGCB_LV }, {0x00d2d5, 0x00d2ef, EGCB_LVT }, {0x00d2f0, 0x00d2f0, EGCB_LV }, {0x00d2f1, 0x00d30b, EGCB_LVT }, {0x00d30c, 0x00d30c, EGCB_LV }, {0x00d30d, 0x00d327, EGCB_LVT }, {0x00d328, 0x00d328, EGCB_LV }, {0x00d329, 0x00d343, EGCB_LVT }, {0x00d344, 0x00d344, EGCB_LV }, {0x00d345, 0x00d35f, EGCB_LVT }, {0x00d360, 0x00d360, EGCB_LV }, {0x00d361, 0x00d37b, EGCB_LVT }, {0x00d37c, 0x00d37c, EGCB_LV }, {0x00d37d, 0x00d397, EGCB_LVT }, {0x00d398, 0x00d398, EGCB_LV }, {0x00d399, 0x00d3b3, EGCB_LVT }, {0x00d3b4, 0x00d3b4, EGCB_LV }, {0x00d3b5, 0x00d3cf, EGCB_LVT }, {0x00d3d0, 0x00d3d0, EGCB_LV }, {0x00d3d1, 0x00d3eb, EGCB_LVT }, {0x00d3ec, 0x00d3ec, EGCB_LV }, {0x00d3ed, 0x00d407, EGCB_LVT }, {0x00d408, 0x00d408, EGCB_LV }, {0x00d409, 0x00d423, EGCB_LVT }, {0x00d424, 0x00d424, EGCB_LV }, {0x00d425, 0x00d43f, EGCB_LVT }, {0x00d440, 0x00d440, EGCB_LV }, {0x00d441, 0x00d45b, EGCB_LVT }, {0x00d45c, 0x00d45c, EGCB_LV }, {0x00d45d, 0x00d477, EGCB_LVT }, {0x00d478, 0x00d478, EGCB_LV }, {0x00d479, 0x00d493, EGCB_LVT }, {0x00d494, 0x00d494, EGCB_LV }, {0x00d495, 0x00d4af, EGCB_LVT }, {0x00d4b0, 0x00d4b0, EGCB_LV }, {0x00d4b1, 0x00d4cb, EGCB_LVT }, {0x00d4cc, 0x00d4cc, EGCB_LV }, {0x00d4cd, 0x00d4e7, EGCB_LVT }, {0x00d4e8, 0x00d4e8, EGCB_LV }, {0x00d4e9, 0x00d503, EGCB_LVT }, {0x00d504, 0x00d504, EGCB_LV }, {0x00d505, 0x00d51f, EGCB_LVT }, {0x00d520, 0x00d520, EGCB_LV }, {0x00d521, 0x00d53b, EGCB_LVT }, {0x00d53c, 0x00d53c, EGCB_LV }, {0x00d53d, 0x00d557, EGCB_LVT }, {0x00d558, 0x00d558, EGCB_LV }, {0x00d559, 0x00d573, EGCB_LVT }, {0x00d574, 0x00d574, EGCB_LV }, {0x00d575, 0x00d58f, EGCB_LVT }, {0x00d590, 0x00d590, EGCB_LV }, {0x00d591, 0x00d5ab, EGCB_LVT }, {0x00d5ac, 0x00d5ac, EGCB_LV }, {0x00d5ad, 0x00d5c7, EGCB_LVT }, {0x00d5c8, 0x00d5c8, EGCB_LV }, {0x00d5c9, 0x00d5e3, EGCB_LVT }, {0x00d5e4, 0x00d5e4, EGCB_LV }, {0x00d5e5, 0x00d5ff, EGCB_LVT }, {0x00d600, 0x00d600, EGCB_LV }, {0x00d601, 0x00d61b, EGCB_LVT }, {0x00d61c, 0x00d61c, EGCB_LV }, {0x00d61d, 0x00d637, EGCB_LVT }, {0x00d638, 0x00d638, EGCB_LV }, {0x00d639, 0x00d653, EGCB_LVT }, {0x00d654, 0x00d654, EGCB_LV }, {0x00d655, 0x00d66f, EGCB_LVT }, {0x00d670, 0x00d670, EGCB_LV }, {0x00d671, 0x00d68b, EGCB_LVT }, {0x00d68c, 0x00d68c, EGCB_LV }, {0x00d68d, 0x00d6a7, EGCB_LVT }, {0x00d6a8, 0x00d6a8, EGCB_LV }, {0x00d6a9, 0x00d6c3, EGCB_LVT }, {0x00d6c4, 0x00d6c4, EGCB_LV }, {0x00d6c5, 0x00d6df, EGCB_LVT }, {0x00d6e0, 0x00d6e0, EGCB_LV }, {0x00d6e1, 0x00d6fb, EGCB_LVT }, {0x00d6fc, 0x00d6fc, EGCB_LV }, {0x00d6fd, 0x00d717, EGCB_LVT }, {0x00d718, 0x00d718, EGCB_LV }, {0x00d719, 0x00d733, EGCB_LVT }, {0x00d734, 0x00d734, EGCB_LV }, {0x00d735, 0x00d74f, EGCB_LVT }, {0x00d750, 0x00d750, EGCB_LV }, {0x00d751, 0x00d76b, EGCB_LVT }, {0x00d76c, 0x00d76c, EGCB_LV }, {0x00d76d, 0x00d787, EGCB_LVT }, {0x00d788, 0x00d788, EGCB_LV }, {0x00d789, 0x00d7a3, EGCB_LVT }, {0x00d7b0, 0x00d7c6, EGCB_V }, {0x00d7cb, 0x00d7fb, EGCB_T }, {0x00fb1e, 0x00fb1e, EGCB_Extend }, {0x00fe00, 0x00fe0f, EGCB_Extend }, {0x00fe20, 0x00fe2f, EGCB_Extend }, {0x00feff, 0x00feff, EGCB_Control }, {0x00ff9e, 0x00ff9f, EGCB_Extend }, {0x00fff0, 0x00fffb, EGCB_Control }, {0x0101fd, 0x0101fd, EGCB_Extend }, {0x0102e0, 0x0102e0, EGCB_Extend }, {0x010376, 0x01037a, EGCB_Extend }, {0x010a01, 0x010a03, EGCB_Extend }, {0x010a05, 0x010a06, EGCB_Extend }, {0x010a0c, 0x010a0f, EGCB_Extend }, {0x010a38, 0x010a3a, EGCB_Extend }, {0x010a3f, 0x010a3f, EGCB_Extend }, {0x010ae5, 0x010ae6, EGCB_Extend }, {0x010d24, 0x010d27, EGCB_Extend }, {0x010d69, 0x010d6d, EGCB_Extend }, {0x010eab, 0x010eac, EGCB_Extend }, {0x010efc, 0x010eff, EGCB_Extend }, {0x010f46, 0x010f50, EGCB_Extend }, {0x010f82, 0x010f85, EGCB_Extend }, {0x011000, 0x011000, EGCB_SpacingMark }, {0x011001, 0x011001, EGCB_Extend }, {0x011002, 0x011002, EGCB_SpacingMark }, {0x011038, 0x011046, EGCB_Extend }, {0x011070, 0x011070, EGCB_Extend }, {0x011073, 0x011074, EGCB_Extend }, {0x01107f, 0x011081, EGCB_Extend }, {0x011082, 0x011082, EGCB_SpacingMark }, {0x0110b0, 0x0110b2, EGCB_SpacingMark }, {0x0110b3, 0x0110b6, EGCB_Extend }, {0x0110b7, 0x0110b8, EGCB_SpacingMark }, {0x0110b9, 0x0110ba, EGCB_Extend }, {0x0110bd, 0x0110bd, EGCB_Prepend }, {0x0110c2, 0x0110c2, EGCB_Extend }, {0x0110cd, 0x0110cd, EGCB_Prepend }, {0x011100, 0x011102, EGCB_Extend }, {0x011127, 0x01112b, EGCB_Extend }, {0x01112c, 0x01112c, EGCB_SpacingMark }, {0x01112d, 0x011134, EGCB_Extend }, {0x011145, 0x011146, EGCB_SpacingMark }, {0x011173, 0x011173, EGCB_Extend }, {0x011180, 0x011181, EGCB_Extend }, {0x011182, 0x011182, EGCB_SpacingMark }, {0x0111b3, 0x0111b5, EGCB_SpacingMark }, {0x0111b6, 0x0111be, EGCB_Extend }, {0x0111bf, 0x0111bf, EGCB_SpacingMark }, {0x0111c0, 0x0111c0, EGCB_Extend }, {0x0111c2, 0x0111c3, EGCB_Prepend }, {0x0111c9, 0x0111cc, EGCB_Extend }, {0x0111ce, 0x0111ce, EGCB_SpacingMark }, {0x0111cf, 0x0111cf, EGCB_Extend }, {0x01122c, 0x01122e, EGCB_SpacingMark }, {0x01122f, 0x011231, EGCB_Extend }, {0x011232, 0x011233, EGCB_SpacingMark }, {0x011234, 0x011237, EGCB_Extend }, {0x01123e, 0x01123e, EGCB_Extend }, {0x011241, 0x011241, EGCB_Extend }, {0x0112df, 0x0112df, EGCB_Extend }, {0x0112e0, 0x0112e2, EGCB_SpacingMark }, {0x0112e3, 0x0112ea, EGCB_Extend }, {0x011300, 0x011301, EGCB_Extend }, {0x011302, 0x011303, EGCB_SpacingMark }, {0x01133b, 0x01133c, EGCB_Extend }, {0x01133e, 0x01133e, EGCB_Extend }, {0x01133f, 0x01133f, EGCB_SpacingMark }, {0x011340, 0x011340, EGCB_Extend }, {0x011341, 0x011344, EGCB_SpacingMark }, {0x011347, 0x011348, EGCB_SpacingMark }, {0x01134b, 0x01134c, EGCB_SpacingMark }, {0x01134d, 0x01134d, EGCB_Extend }, {0x011357, 0x011357, EGCB_Extend }, {0x011362, 0x011363, EGCB_SpacingMark }, {0x011366, 0x01136c, EGCB_Extend }, {0x011370, 0x011374, EGCB_Extend }, {0x0113b8, 0x0113b8, EGCB_Extend }, {0x0113b9, 0x0113ba, EGCB_SpacingMark }, {0x0113bb, 0x0113c0, EGCB_Extend }, {0x0113c2, 0x0113c2, EGCB_Extend }, {0x0113c5, 0x0113c5, EGCB_Extend }, {0x0113c7, 0x0113c9, EGCB_Extend }, {0x0113ca, 0x0113ca, EGCB_SpacingMark }, {0x0113cc, 0x0113cd, EGCB_SpacingMark }, {0x0113ce, 0x0113d0, EGCB_Extend }, {0x0113d1, 0x0113d1, EGCB_Prepend }, {0x0113d2, 0x0113d2, EGCB_Extend }, {0x0113e1, 0x0113e2, EGCB_Extend }, {0x011435, 0x011437, EGCB_SpacingMark }, {0x011438, 0x01143f, EGCB_Extend }, {0x011440, 0x011441, EGCB_SpacingMark }, {0x011442, 0x011444, EGCB_Extend }, {0x011445, 0x011445, EGCB_SpacingMark }, {0x011446, 0x011446, EGCB_Extend }, {0x01145e, 0x01145e, EGCB_Extend }, {0x0114b0, 0x0114b0, EGCB_Extend }, {0x0114b1, 0x0114b2, EGCB_SpacingMark }, {0x0114b3, 0x0114b8, EGCB_Extend }, {0x0114b9, 0x0114b9, EGCB_SpacingMark }, {0x0114ba, 0x0114ba, EGCB_Extend }, {0x0114bb, 0x0114bc, EGCB_SpacingMark }, {0x0114bd, 0x0114bd, EGCB_Extend }, {0x0114be, 0x0114be, EGCB_SpacingMark }, {0x0114bf, 0x0114c0, EGCB_Extend }, {0x0114c1, 0x0114c1, EGCB_SpacingMark }, {0x0114c2, 0x0114c3, EGCB_Extend }, {0x0115af, 0x0115af, EGCB_Extend }, {0x0115b0, 0x0115b1, EGCB_SpacingMark }, {0x0115b2, 0x0115b5, EGCB_Extend }, {0x0115b8, 0x0115bb, EGCB_SpacingMark }, {0x0115bc, 0x0115bd, EGCB_Extend }, {0x0115be, 0x0115be, EGCB_SpacingMark }, {0x0115bf, 0x0115c0, EGCB_Extend }, {0x0115dc, 0x0115dd, EGCB_Extend }, {0x011630, 0x011632, EGCB_SpacingMark }, {0x011633, 0x01163a, EGCB_Extend }, {0x01163b, 0x01163c, EGCB_SpacingMark }, {0x01163d, 0x01163d, EGCB_Extend }, {0x01163e, 0x01163e, EGCB_SpacingMark }, {0x01163f, 0x011640, EGCB_Extend }, {0x0116ab, 0x0116ab, EGCB_Extend }, {0x0116ac, 0x0116ac, EGCB_SpacingMark }, {0x0116ad, 0x0116ad, EGCB_Extend }, {0x0116ae, 0x0116af, EGCB_SpacingMark }, {0x0116b0, 0x0116b7, EGCB_Extend }, {0x01171d, 0x01171d, EGCB_Extend }, {0x01171e, 0x01171e, EGCB_SpacingMark }, {0x01171f, 0x01171f, EGCB_Extend }, {0x011722, 0x011725, EGCB_Extend }, {0x011726, 0x011726, EGCB_SpacingMark }, {0x011727, 0x01172b, EGCB_Extend }, {0x01182c, 0x01182e, EGCB_SpacingMark }, {0x01182f, 0x011837, EGCB_Extend }, {0x011838, 0x011838, EGCB_SpacingMark }, {0x011839, 0x01183a, EGCB_Extend }, {0x011930, 0x011930, EGCB_Extend }, {0x011931, 0x011935, EGCB_SpacingMark }, {0x011937, 0x011938, EGCB_SpacingMark }, {0x01193b, 0x01193e, EGCB_Extend }, {0x01193f, 0x01193f, EGCB_Prepend }, {0x011940, 0x011940, EGCB_SpacingMark }, {0x011941, 0x011941, EGCB_Prepend }, {0x011942, 0x011942, EGCB_SpacingMark }, {0x011943, 0x011943, EGCB_Extend }, {0x0119d1, 0x0119d3, EGCB_SpacingMark }, {0x0119d4, 0x0119d7, EGCB_Extend }, {0x0119da, 0x0119db, EGCB_Extend }, {0x0119dc, 0x0119df, EGCB_SpacingMark }, {0x0119e0, 0x0119e0, EGCB_Extend }, {0x0119e4, 0x0119e4, EGCB_SpacingMark }, {0x011a01, 0x011a0a, EGCB_Extend }, {0x011a33, 0x011a38, EGCB_Extend }, {0x011a39, 0x011a39, EGCB_SpacingMark }, {0x011a3a, 0x011a3a, EGCB_Prepend }, {0x011a3b, 0x011a3e, EGCB_Extend }, {0x011a47, 0x011a47, EGCB_Extend }, {0x011a51, 0x011a56, EGCB_Extend }, {0x011a57, 0x011a58, EGCB_SpacingMark }, {0x011a59, 0x011a5b, EGCB_Extend }, {0x011a84, 0x011a89, EGCB_Prepend }, {0x011a8a, 0x011a96, EGCB_Extend }, {0x011a97, 0x011a97, EGCB_SpacingMark }, {0x011a98, 0x011a99, EGCB_Extend }, {0x011c2f, 0x011c2f, EGCB_SpacingMark }, {0x011c30, 0x011c36, EGCB_Extend }, {0x011c38, 0x011c3d, EGCB_Extend }, {0x011c3e, 0x011c3e, EGCB_SpacingMark }, {0x011c3f, 0x011c3f, EGCB_Extend }, {0x011c92, 0x011ca7, EGCB_Extend }, {0x011ca9, 0x011ca9, EGCB_SpacingMark }, {0x011caa, 0x011cb0, EGCB_Extend }, {0x011cb1, 0x011cb1, EGCB_SpacingMark }, {0x011cb2, 0x011cb3, EGCB_Extend }, {0x011cb4, 0x011cb4, EGCB_SpacingMark }, {0x011cb5, 0x011cb6, EGCB_Extend }, {0x011d31, 0x011d36, EGCB_Extend }, {0x011d3a, 0x011d3a, EGCB_Extend }, {0x011d3c, 0x011d3d, EGCB_Extend }, {0x011d3f, 0x011d45, EGCB_Extend }, {0x011d46, 0x011d46, EGCB_Prepend }, {0x011d47, 0x011d47, EGCB_Extend }, {0x011d8a, 0x011d8e, EGCB_SpacingMark }, {0x011d90, 0x011d91, EGCB_Extend }, {0x011d93, 0x011d94, EGCB_SpacingMark }, {0x011d95, 0x011d95, EGCB_Extend }, {0x011d96, 0x011d96, EGCB_SpacingMark }, {0x011d97, 0x011d97, EGCB_Extend }, {0x011ef3, 0x011ef4, EGCB_Extend }, {0x011ef5, 0x011ef6, EGCB_SpacingMark }, {0x011f00, 0x011f01, EGCB_Extend }, {0x011f02, 0x011f02, EGCB_Prepend }, {0x011f03, 0x011f03, EGCB_SpacingMark }, {0x011f34, 0x011f35, EGCB_SpacingMark }, {0x011f36, 0x011f3a, EGCB_Extend }, {0x011f3e, 0x011f3f, EGCB_SpacingMark }, {0x011f40, 0x011f42, EGCB_Extend }, {0x011f5a, 0x011f5a, EGCB_Extend }, {0x013430, 0x01343f, EGCB_Control }, {0x013440, 0x013440, EGCB_Extend }, {0x013447, 0x013455, EGCB_Extend }, {0x01611e, 0x016129, EGCB_Extend }, {0x01612a, 0x01612c, EGCB_SpacingMark }, {0x01612d, 0x01612f, EGCB_Extend }, {0x016af0, 0x016af4, EGCB_Extend }, {0x016b30, 0x016b36, EGCB_Extend }, {0x016d63, 0x016d63, EGCB_V }, {0x016d67, 0x016d6a, EGCB_V }, {0x016f4f, 0x016f4f, EGCB_Extend }, {0x016f51, 0x016f87, EGCB_SpacingMark }, {0x016f8f, 0x016f92, EGCB_Extend }, {0x016fe4, 0x016fe4, EGCB_Extend }, {0x016ff0, 0x016ff1, EGCB_Extend }, {0x01bc9d, 0x01bc9e, EGCB_Extend }, {0x01bca0, 0x01bca3, EGCB_Control }, {0x01cf00, 0x01cf2d, EGCB_Extend }, {0x01cf30, 0x01cf46, EGCB_Extend }, {0x01d165, 0x01d169, EGCB_Extend }, {0x01d16d, 0x01d172, EGCB_Extend }, {0x01d173, 0x01d17a, EGCB_Control }, {0x01d17b, 0x01d182, EGCB_Extend }, {0x01d185, 0x01d18b, EGCB_Extend }, {0x01d1aa, 0x01d1ad, EGCB_Extend }, {0x01d242, 0x01d244, EGCB_Extend }, {0x01da00, 0x01da36, EGCB_Extend }, {0x01da3b, 0x01da6c, EGCB_Extend }, {0x01da75, 0x01da75, EGCB_Extend }, {0x01da84, 0x01da84, EGCB_Extend }, {0x01da9b, 0x01da9f, EGCB_Extend }, {0x01daa1, 0x01daaf, EGCB_Extend }, {0x01e000, 0x01e006, EGCB_Extend }, {0x01e008, 0x01e018, EGCB_Extend }, {0x01e01b, 0x01e021, EGCB_Extend }, {0x01e023, 0x01e024, EGCB_Extend }, {0x01e026, 0x01e02a, EGCB_Extend }, {0x01e08f, 0x01e08f, EGCB_Extend }, {0x01e130, 0x01e136, EGCB_Extend }, {0x01e2ae, 0x01e2ae, EGCB_Extend }, {0x01e2ec, 0x01e2ef, EGCB_Extend }, {0x01e4ec, 0x01e4ef, EGCB_Extend }, {0x01e5ee, 0x01e5ef, EGCB_Extend }, {0x01e8d0, 0x01e8d6, EGCB_Extend }, {0x01e944, 0x01e94a, EGCB_Extend }, {0x01f1e6, 0x01f1ff, EGCB_Regional_Indicator }, {0x01f3fb, 0x01f3ff, EGCB_Extend }, {0x0e0000, 0x0e001f, EGCB_Control }, {0x0e0020, 0x0e007f, EGCB_Extend }, {0x0e0080, 0x0e00ff, EGCB_Control }, {0x0e0100, 0x0e01ef, EGCB_Extend }, {0x0e01f0, 0x0e0fff, EGCB_Control } }; jq-1.8.2/vendor/oniguruma/src/Makefile.in0000644000175100017510000010451715215513553013773 # Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_POSIX_API_TRUE@am__append_1 = $(posix_headers) @ENABLE_POSIX_API_TRUE@am__append_2 = -DUSE_POSIX_API @ENABLE_BINARY_COMPATIBLE_POSIX_API_TRUE@am__append_3 = -DUSE_BINARY_COMPATIBLE_POSIX_API @USE_LIBONIG_DEF_FILE_TRUE@am__append_4 = -Wl,--output-def,$(LIBONIG_DEF_FILE) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__include_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libonig_la_LIBADD = am__libonig_la_SOURCES_DIST = regint.h regparse.h regenc.h st.h \ regparse.c regcomp.c regexec.c regenc.c regerror.c regext.c \ regsyntax.c regtrav.c regversion.c st.c reggnu.c regposix.c \ regposerr.c unicode.c unicode_unfold_key.c unicode_fold1_key.c \ unicode_fold2_key.c unicode_fold3_key.c ascii.c utf8.c \ utf16_be.c utf16_le.c utf32_be.c utf32_le.c euc_jp.c \ euc_jp_prop.c sjis.c sjis_prop.c iso8859_1.c iso8859_2.c \ iso8859_3.c iso8859_4.c iso8859_5.c iso8859_6.c iso8859_7.c \ iso8859_8.c iso8859_9.c iso8859_10.c iso8859_11.c iso8859_13.c \ iso8859_14.c iso8859_15.c iso8859_16.c euc_tw.c euc_kr.c \ big5.c gb18030.c koi8_r.c cp1251.c onig_init.c @ENABLE_POSIX_API_TRUE@am__objects_1 = regposix.lo regposerr.lo am_libonig_la_OBJECTS = regparse.lo regcomp.lo regexec.lo regenc.lo \ regerror.lo regext.lo regsyntax.lo regtrav.lo regversion.lo \ st.lo reggnu.lo $(am__objects_1) unicode.lo \ unicode_unfold_key.lo unicode_fold1_key.lo \ unicode_fold2_key.lo unicode_fold3_key.lo ascii.lo utf8.lo \ utf16_be.lo utf16_le.lo utf32_be.lo utf32_le.lo euc_jp.lo \ euc_jp_prop.lo sjis.lo sjis_prop.lo iso8859_1.lo iso8859_2.lo \ iso8859_3.lo iso8859_4.lo iso8859_5.lo iso8859_6.lo \ iso8859_7.lo iso8859_8.lo iso8859_9.lo iso8859_10.lo \ iso8859_11.lo iso8859_13.lo iso8859_14.lo iso8859_15.lo \ iso8859_16.lo euc_tw.lo euc_kr.lo big5.lo gb18030.lo koi8_r.lo \ cp1251.lo onig_init.lo libonig_la_OBJECTS = $(am_libonig_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libonig_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libonig_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/ascii.Plo ./$(DEPDIR)/big5.Plo \ ./$(DEPDIR)/cp1251.Plo ./$(DEPDIR)/euc_jp.Plo \ ./$(DEPDIR)/euc_jp_prop.Plo ./$(DEPDIR)/euc_kr.Plo \ ./$(DEPDIR)/euc_tw.Plo ./$(DEPDIR)/gb18030.Plo \ ./$(DEPDIR)/iso8859_1.Plo ./$(DEPDIR)/iso8859_10.Plo \ ./$(DEPDIR)/iso8859_11.Plo ./$(DEPDIR)/iso8859_13.Plo \ ./$(DEPDIR)/iso8859_14.Plo ./$(DEPDIR)/iso8859_15.Plo \ ./$(DEPDIR)/iso8859_16.Plo ./$(DEPDIR)/iso8859_2.Plo \ ./$(DEPDIR)/iso8859_3.Plo ./$(DEPDIR)/iso8859_4.Plo \ ./$(DEPDIR)/iso8859_5.Plo ./$(DEPDIR)/iso8859_6.Plo \ ./$(DEPDIR)/iso8859_7.Plo ./$(DEPDIR)/iso8859_8.Plo \ ./$(DEPDIR)/iso8859_9.Plo ./$(DEPDIR)/koi8_r.Plo \ ./$(DEPDIR)/onig_init.Plo ./$(DEPDIR)/regcomp.Plo \ ./$(DEPDIR)/regenc.Plo ./$(DEPDIR)/regerror.Plo \ ./$(DEPDIR)/regexec.Plo ./$(DEPDIR)/regext.Plo \ ./$(DEPDIR)/reggnu.Plo ./$(DEPDIR)/regparse.Plo \ ./$(DEPDIR)/regposerr.Plo ./$(DEPDIR)/regposix.Plo \ ./$(DEPDIR)/regsyntax.Plo ./$(DEPDIR)/regtrav.Plo \ ./$(DEPDIR)/regversion.Plo ./$(DEPDIR)/sjis.Plo \ ./$(DEPDIR)/sjis_prop.Plo ./$(DEPDIR)/st.Plo \ ./$(DEPDIR)/unicode.Plo ./$(DEPDIR)/unicode_fold1_key.Plo \ ./$(DEPDIR)/unicode_fold2_key.Plo \ ./$(DEPDIR)/unicode_fold3_key.Plo \ ./$(DEPDIR)/unicode_unfold_key.Plo ./$(DEPDIR)/utf16_be.Plo \ ./$(DEPDIR)/utf16_le.Plo ./$(DEPDIR)/utf32_be.Plo \ ./$(DEPDIR)/utf32_le.Plo ./$(DEPDIR)/utf8.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libonig_la_SOURCES) DIST_SOURCES = $(am__libonig_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__include_HEADERS_DIST = oniguruma.h oniggnu.h onigposix.h HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXTRA_LIBONIG_LDFLAGS = @EXTRA_LIBONIG_LDFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBONIG_DEF_FILE = @LIBONIG_DEF_FILE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LTVERSION = @LTVERSION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ libname = libonig.la AM_CFLAGS = -Wall $(am__append_2) $(am__append_3) AM_CPPFLAGS = -I$(top_srcdir) include_HEADERS = oniguruma.h oniggnu.h $(am__append_1) posix_headers = onigposix.h @ENABLE_POSIX_API_FALSE@posix_sources = @ENABLE_POSIX_API_TRUE@posix_sources = regposix.c regposerr.c lib_LTLIBRARIES = $(libname) libonig_la_SOURCES = regint.h regparse.h regenc.h st.h \ regparse.c regcomp.c regexec.c \ regenc.c regerror.c regext.c regsyntax.c regtrav.c regversion.c st.c \ reggnu.c \ $(posix_sources) \ unicode.c \ unicode_unfold_key.c \ unicode_fold1_key.c \ unicode_fold2_key.c \ unicode_fold3_key.c \ ascii.c utf8.c \ utf16_be.c utf16_le.c \ utf32_be.c utf32_le.c \ euc_jp.c euc_jp_prop.c \ sjis.c sjis_prop.c \ iso8859_1.c \ iso8859_2.c iso8859_3.c \ iso8859_4.c iso8859_5.c \ iso8859_6.c iso8859_7.c \ iso8859_8.c iso8859_9.c \ iso8859_10.c iso8859_11.c \ iso8859_13.c iso8859_14.c \ iso8859_15.c iso8859_16.c \ euc_tw.c euc_kr.c big5.c \ gb18030.c koi8_r.c cp1251.c \ onig_init.c EXTRA_DIST = koi8.c mktable.c \ unicode_fold_data.c unicode_property_data.c \ unicode_property_data_posix.c \ unicode_egcb_data.c unicode_wb_data.c libonig_la_LDFLAGS = $(EXTRA_LIBONIG_LDFLAGS) -version-info \ $(LTVERSION) $(am__append_4) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libonig.la: $(libonig_la_OBJECTS) $(libonig_la_DEPENDENCIES) $(EXTRA_libonig_la_DEPENDENCIES) $(AM_V_CCLD)$(libonig_la_LINK) -rpath $(libdir) $(libonig_la_OBJECTS) $(libonig_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big5.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cp1251.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/euc_jp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/euc_jp_prop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/euc_kr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/euc_tw.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gb18030.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_1.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_10.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_11.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_13.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_14.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_15.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_16.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_3.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_4.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_5.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_6.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_7.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_8.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iso8859_9.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/koi8_r.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/onig_init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regcomp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regenc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regerror.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexec.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reggnu.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regparse.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regposerr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regposix.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regsyntax.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regtrav.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regversion.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sjis.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sjis_prop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/st.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode_fold1_key.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode_fold2_key.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode_fold3_key.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode_unfold_key.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf16_be.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf16_le.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf32_be.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf32_le.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @USE_LIBONIG_DEF_FILE_FALSE@install-data-hook: @USE_LIBONIG_DEF_FILE_FALSE@uninstall-hook: clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/ascii.Plo -rm -f ./$(DEPDIR)/big5.Plo -rm -f ./$(DEPDIR)/cp1251.Plo -rm -f ./$(DEPDIR)/euc_jp.Plo -rm -f ./$(DEPDIR)/euc_jp_prop.Plo -rm -f ./$(DEPDIR)/euc_kr.Plo -rm -f ./$(DEPDIR)/euc_tw.Plo -rm -f ./$(DEPDIR)/gb18030.Plo -rm -f ./$(DEPDIR)/iso8859_1.Plo -rm -f ./$(DEPDIR)/iso8859_10.Plo -rm -f ./$(DEPDIR)/iso8859_11.Plo -rm -f ./$(DEPDIR)/iso8859_13.Plo -rm -f ./$(DEPDIR)/iso8859_14.Plo -rm -f ./$(DEPDIR)/iso8859_15.Plo -rm -f ./$(DEPDIR)/iso8859_16.Plo -rm -f ./$(DEPDIR)/iso8859_2.Plo -rm -f ./$(DEPDIR)/iso8859_3.Plo -rm -f ./$(DEPDIR)/iso8859_4.Plo -rm -f ./$(DEPDIR)/iso8859_5.Plo -rm -f ./$(DEPDIR)/iso8859_6.Plo -rm -f ./$(DEPDIR)/iso8859_7.Plo -rm -f ./$(DEPDIR)/iso8859_8.Plo -rm -f ./$(DEPDIR)/iso8859_9.Plo -rm -f ./$(DEPDIR)/koi8_r.Plo -rm -f ./$(DEPDIR)/onig_init.Plo -rm -f ./$(DEPDIR)/regcomp.Plo -rm -f ./$(DEPDIR)/regenc.Plo -rm -f ./$(DEPDIR)/regerror.Plo -rm -f ./$(DEPDIR)/regexec.Plo -rm -f ./$(DEPDIR)/regext.Plo -rm -f ./$(DEPDIR)/reggnu.Plo -rm -f ./$(DEPDIR)/regparse.Plo -rm -f ./$(DEPDIR)/regposerr.Plo -rm -f ./$(DEPDIR)/regposix.Plo -rm -f ./$(DEPDIR)/regsyntax.Plo -rm -f ./$(DEPDIR)/regtrav.Plo -rm -f ./$(DEPDIR)/regversion.Plo -rm -f ./$(DEPDIR)/sjis.Plo -rm -f ./$(DEPDIR)/sjis_prop.Plo -rm -f ./$(DEPDIR)/st.Plo -rm -f ./$(DEPDIR)/unicode.Plo -rm -f ./$(DEPDIR)/unicode_fold1_key.Plo -rm -f ./$(DEPDIR)/unicode_fold2_key.Plo -rm -f ./$(DEPDIR)/unicode_fold3_key.Plo -rm -f ./$(DEPDIR)/unicode_unfold_key.Plo -rm -f ./$(DEPDIR)/utf16_be.Plo -rm -f ./$(DEPDIR)/utf16_le.Plo -rm -f ./$(DEPDIR)/utf32_be.Plo -rm -f ./$(DEPDIR)/utf32_le.Plo -rm -f ./$(DEPDIR)/utf8.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/ascii.Plo -rm -f ./$(DEPDIR)/big5.Plo -rm -f ./$(DEPDIR)/cp1251.Plo -rm -f ./$(DEPDIR)/euc_jp.Plo -rm -f ./$(DEPDIR)/euc_jp_prop.Plo -rm -f ./$(DEPDIR)/euc_kr.Plo -rm -f ./$(DEPDIR)/euc_tw.Plo -rm -f ./$(DEPDIR)/gb18030.Plo -rm -f ./$(DEPDIR)/iso8859_1.Plo -rm -f ./$(DEPDIR)/iso8859_10.Plo -rm -f ./$(DEPDIR)/iso8859_11.Plo -rm -f ./$(DEPDIR)/iso8859_13.Plo -rm -f ./$(DEPDIR)/iso8859_14.Plo -rm -f ./$(DEPDIR)/iso8859_15.Plo -rm -f ./$(DEPDIR)/iso8859_16.Plo -rm -f ./$(DEPDIR)/iso8859_2.Plo -rm -f ./$(DEPDIR)/iso8859_3.Plo -rm -f ./$(DEPDIR)/iso8859_4.Plo -rm -f ./$(DEPDIR)/iso8859_5.Plo -rm -f ./$(DEPDIR)/iso8859_6.Plo -rm -f ./$(DEPDIR)/iso8859_7.Plo -rm -f ./$(DEPDIR)/iso8859_8.Plo -rm -f ./$(DEPDIR)/iso8859_9.Plo -rm -f ./$(DEPDIR)/koi8_r.Plo -rm -f ./$(DEPDIR)/onig_init.Plo -rm -f ./$(DEPDIR)/regcomp.Plo -rm -f ./$(DEPDIR)/regenc.Plo -rm -f ./$(DEPDIR)/regerror.Plo -rm -f ./$(DEPDIR)/regexec.Plo -rm -f ./$(DEPDIR)/regext.Plo -rm -f ./$(DEPDIR)/reggnu.Plo -rm -f ./$(DEPDIR)/regparse.Plo -rm -f ./$(DEPDIR)/regposerr.Plo -rm -f ./$(DEPDIR)/regposix.Plo -rm -f ./$(DEPDIR)/regsyntax.Plo -rm -f ./$(DEPDIR)/regtrav.Plo -rm -f ./$(DEPDIR)/regversion.Plo -rm -f ./$(DEPDIR)/sjis.Plo -rm -f ./$(DEPDIR)/sjis_prop.Plo -rm -f ./$(DEPDIR)/st.Plo -rm -f ./$(DEPDIR)/unicode.Plo -rm -f ./$(DEPDIR)/unicode_fold1_key.Plo -rm -f ./$(DEPDIR)/unicode_fold2_key.Plo -rm -f ./$(DEPDIR)/unicode_fold3_key.Plo -rm -f ./$(DEPDIR)/unicode_unfold_key.Plo -rm -f ./$(DEPDIR)/utf16_be.Plo -rm -f ./$(DEPDIR)/utf16_le.Plo -rm -f ./$(DEPDIR)/utf32_be.Plo -rm -f ./$(DEPDIR)/utf32_le.Plo -rm -f ./$(DEPDIR)/utf8.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: all install-am install-data-am install-strip uninstall-am .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-data-hook install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-hook \ uninstall-includeHEADERS uninstall-libLTLIBRARIES .PRECIOUS: Makefile @USE_LIBONIG_DEF_FILE_TRUE@install-data-hook: @USE_LIBONIG_DEF_FILE_TRUE@ echo "$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_DATA) $(LIBONIG_DEF_FILE) $(DESTDIR)$(libdir)"; \ @USE_LIBONIG_DEF_FILE_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_DATA) $(LIBONIG_DEF_FILE) $(DESTDIR)$(libdir) || exit 1 @USE_LIBONIG_DEF_FILE_TRUE@uninstall-hook: @USE_LIBONIG_DEF_FILE_TRUE@ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$(LIBONIG_DEF_FILE)'"; \ @USE_LIBONIG_DEF_FILE_TRUE@ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$(LIBONIG_DEF_FILE)" dll: $(CXX) -shared -Wl,--output-def,libonig.def -o libonig.dll *.o \ $(LIBS) strip libonig.dll # character-types-table source generator mktable: mktable.c regenc.h $(CC) -I$(top_srcdir) -o mktable mktable.c # 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: jq-1.8.2/vendor/oniguruma/src/iso8859_10.c0000644000175100017510000002127215215513537013520 /********************************************************************** iso8859_10.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2020 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_ISO_8859_10_TO_LOWER_CASE(c) EncISO_8859_10_ToLowerCaseTable[c] #define ENC_IS_ISO_8859_10_CTYPE(code,ctype) \ ((EncISO_8859_10_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const UChar EncISO_8859_10_ToLowerCaseTable[256] = { '\000', '\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', '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', '\240', '\261', '\262', '\263', '\264', '\265', '\266', '\247', '\270', '\271', '\272', '\273', '\274', '\255', '\276', '\277', '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; static const unsigned short EncISO_8859_10_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2, 0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x30e2, 0x30e2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2 }; static int mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } if (CASE_FOLD_IS_NOT_ASCII_ONLY(flag) || ONIGENC_IS_ASCII_CODE(*p)) *lower = ENC_ISO_8859_10_TO_LOWER_CASE(*p); else *lower = *p; (*pp)++; return 1; } static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_10_CTYPE(code, ctype); else return FALSE; } static const OnigPairCaseFoldCodes CaseFoldMap[] = { { 0xa1, 0xb1 }, { 0xa2, 0xb2 }, { 0xa3, 0xb3 }, { 0xa4, 0xb4 }, { 0xa5, 0xb5 }, { 0xa6, 0xb6 }, { 0xa8, 0xb8 }, { 0xa9, 0xb9 }, { 0xaa, 0xba }, { 0xab, 0xbb }, { 0xac, 0xbc }, { 0xae, 0xbe }, { 0xaf, 0xbf }, { 0xc0, 0xe0 }, { 0xc1, 0xe1 }, { 0xc2, 0xe2 }, { 0xc3, 0xe3 }, { 0xc4, 0xe4 }, { 0xc5, 0xe5 }, { 0xc6, 0xe6 }, { 0xc7, 0xe7 }, { 0xc8, 0xe8 }, { 0xc9, 0xe9 }, { 0xca, 0xea }, { 0xcb, 0xeb }, { 0xcc, 0xec }, { 0xcd, 0xed }, { 0xce, 0xee }, { 0xcf, 0xef }, { 0xd0, 0xf0 }, { 0xd1, 0xf1 }, { 0xd2, 0xf2 }, { 0xd3, 0xf3 }, { 0xd4, 0xf4 }, { 0xd5, 0xf5 }, { 0xd6, 0xf6 }, { 0xd7, 0xf7 }, { 0xd8, 0xf8 }, { 0xd9, 0xf9 }, { 0xda, 0xfa }, { 0xdb, 0xfb }, { 0xdc, 0xfc }, { 0xdd, 0xfd }, { 0xde, 0xfe } }; static int apply_all_case_fold(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg) { return onigenc_apply_all_case_fold_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, f, arg); } static int get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1, flag, p, end, items); } OnigEncodingType OnigEncodingISO_8859_10 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-10", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, mbc_case_fold, apply_all_case_fold, get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/iso8859_11.c0000644000175100017510000001132215215513537013514 /********************************************************************** iso8859_11.c - Oniguruma (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2019 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regenc.h" #define ENC_IS_ISO_8859_11_CTYPE(code,ctype) \ ((EncISO_8859_11_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0) static const unsigned short EncISO_8859_11_CtypeTable[256] = { 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0, 0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0284, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x30a2, 0x0000, 0x0000, 0x0000, 0x0000 }; static int is_code_ctype(OnigCodePoint code, unsigned int ctype) { if (code < 256) return ENC_IS_ISO_8859_11_CTYPE(code, ctype); else return FALSE; } OnigEncodingType OnigEncodingISO_8859_11 = { onigenc_single_byte_mbc_enc_len, "ISO-8859-11", /* name */ 1, /* max enc length */ 1, /* min enc length */ onigenc_is_mbc_newline_0x0a, onigenc_single_byte_mbc_to_code, onigenc_single_byte_code_to_mbclen, onigenc_single_byte_code_to_mbc, onigenc_ascii_mbc_case_fold, onigenc_ascii_apply_all_case_fold, onigenc_ascii_get_case_fold_codes_by_str, onigenc_minimum_property_name_to_ctype, is_code_ctype, onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, NULL, /* init */ NULL, /* is_initialized */ onigenc_always_true_is_valid_mbc_string, ENC_FLAG_ASCII_COMPATIBLE|ENC_FLAG_SKIP_OFFSET_1, 0, 0 }; jq-1.8.2/vendor/oniguruma/src/config.h.cmake.in0000644000175100017510000000350315215513537015023 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #cmakedefine CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #cmakedefine C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #cmakedefine HAVE_ALLOCA ${HAVE_ALLOCA} /* Define to 1 if you have and it should be used (not on Ultrix). */ #cmakedefine HAVE_ALLOCA_H ${HAVE_ALLOCA_H} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TIMES_H ${HAVE_SYS_TIMES_H} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} /* Define to 1 if you have the header file. */ #cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H} /* Name of package */ #cmakedefine PACKAGE ${PACKAGE} /* Define to the version of this package. */ #cmakedefine PACKAGE_VERSION ${PACKAGE_VERSION} /* The size of `int', as computed by sizeof. */ #cmakedefine SIZEOF_INT ${SIZEOF_INT} /* The size of `long', as computed by sizeof. */ #cmakedefine SIZEOF_LONG ${SIZEOF_LONG} /* The size of `long long', as computed by sizeof. */ #cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG} /* The size of `void*', as computed by sizeof. */ #cmakedefine SIZEOF_VOIDP ${SIZEOF_VOIDP} /* Define if enable CR+NL as line terminator */ #cmakedefine USE_CRNL_AS_LINE_TERMINATOR ${USE_CRNL_AS_LINE_TERMINATOR} /* Version number of package */ #cmakedefine VERSION ${VERSION} jq-1.8.2/vendor/oniguruma/src/unicode_fold2_key.c0000644000175100017510000001055315215513537015454 /* This file was converted by gperf_fold_key_conv.py from gperf output file. */ /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -n -C -T -c -t -j1 -L ANSI-C -F,-1 -N onigenc_unicode_fold2_key unicode_fold2_key.gperf */ /* Computed positions: -k'3,6' */ /* This gperf source file was generated by make_unicode_fold_data.py */ /*- * Copyright (c) 2017-2024 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #define TOTAL_KEYWORDS 59 #define MIN_WORD_LENGTH 6 #define MAX_WORD_LENGTH 6 #define MIN_HASH_VALUE 0 #define MAX_HASH_VALUE 58 /* maximum key range = 59, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif /*ARGSUSED*/ static unsigned int hash(OnigCodePoint codes[]) { static const unsigned char asso_values[] = { 58, 57, 56, 55, 54, 53, 52, 16, 50, 59, 15, 59, 25, 59, 59, 59, 59, 59, 59, 3, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 49, 48, 47, 46, 45, 44, 43, 42, 59, 59, 59, 59, 59, 59, 59, 59, 59, 21, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 2, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 40, 20, 39, 38, 37, 14, 5, 36, 20, 7, 25, 34, 29, 32, 16, 59, 31, 59, 59, 2, 1, 59, 25, 15, 59, 14, 59, 59, 28, 59, 2, 59, 59, 59, 11, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 24, 59, 22, 59, 59, 11, 59, 59, 59, 59, 59, 7, 59, 0, 59, 59, 16, 59, 1, 59, 59, 16, 59, 59, 59, 15, 59, 59, 59, 6, 59, 59, 59, 59, 0, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 }; return asso_values[(unsigned char)onig_codes_byte_at(codes, 5)] + asso_values[(unsigned char)onig_codes_byte_at(codes, 2)]; } int onigenc_unicode_fold2_key(OnigCodePoint codes[]) { static const short int wordlist[] = { 101, 253, 76, 29, 24, 239, 96, 71, 92, 67, 4, 62, 8, 58, 234, 109, 164, 88, 84, 80, 214, 0, 54, 261, 50, 105, 121, 125, 257, 42, 38, 249, 46, 117, 12, 113, 244, 229, 224, 219, 209, 16, 204, 199, 194, 189, 184, 179, 174, 169, 20, 34, 159, 154, 149, 144, 139, 134, 129 }; { int key = hash(codes); if (key <= MAX_HASH_VALUE) { int index = wordlist[key]; if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds2 + index, 2) == 0) return index; } } return -1; } jq-1.8.2/vendor/oniguruma/onig-config.in0000644000175100017510000000253615215513537013666 #!/bin/sh # Copyright (C) 2006 K.Kosako ONIG_VERSION=@PACKAGE_VERSION@ show_usage() { cat < #include "oniguruma.h" #include #define SLEN(s) strlen(s) static int nsucc = 0; static int nfail = 0; static int nerror = 0; #ifdef __TRUSTINSOFT_ANALYZER__ static int nall = 0; #endif static FILE* err_file; static OnigRegion* region; static void xx(char* pattern, char* str, int from, int to, int mem, int not, int error_no, int line_no) { #ifdef __TRUSTINSOFT_ANALYZER__ if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; #endif int r; regex_t* reg; OnigErrorInfo einfo; r = onig_new(®, (UChar* )pattern, (UChar* )(pattern + SLEN(pattern)), ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, &einfo); if (r) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(err_file, "ERROR: %s /%s/ #%d\n", s, pattern, line_no); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ %d #%d\n", pattern, r, line_no); nsucc++; } else { fprintf(stdout, "FAIL(ERROR): /%s/ '%s', %d, %d #%d\n", pattern, str, error_no, r, line_no); nfail++; } } return ; } r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, ONIG_OPTION_NONE); if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r); fprintf(err_file, "ERROR: %s /%s/ #%d\n", s, pattern, line_no); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ '%s', %d #%d\n", pattern, str, r, line_no); nsucc++; } else { fprintf(stdout, "FAIL ERROR NO: /%s/ '%s', %d, %d #%d\n", pattern, str, error_no, r, line_no); nfail++; } } return ; } if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s' #%d\n", pattern, str, line_no); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' #%d\n", pattern, str, line_no); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s' #%d\n", pattern, str, line_no); nfail++; } else { if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: /%s/ '%s' #%d\n", pattern, str, line_no); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d #%d\n", pattern, str, from, to, region->beg[mem], region->end[mem], line_no); nfail++; } } } onig_free(reg); } static void xx2(char* pattern, char* str, int from, int to, int line_no) { xx(pattern, str, from, to, 0, 0, 0, line_no); } static void xx3(char* pattern, char* str, int from, int to, int mem, int line_no) { xx(pattern, str, from, to, mem, 0, 0, line_no); } static void xn(char* pattern, char* str, int line_no) { xx(pattern, str, 0, 0, 0, 1, 0, line_no); } static void xe(char* pattern, char* str, int error_no, int line_no) { xx(pattern, str, 0, 0, 0, 0, error_no, line_no); } #define x2(p,s,f,t) xx2(p,s,f,t, __LINE__) #define x3(p,s,f,t,m) xx3(p,s,f,t,m, __LINE__) #define n(p,s) xn(p,s, __LINE__) #define e(p,s,en) xe(p,s,en, __LINE__) extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_UTF8; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); err_file = stdout; region = onig_region_new(); x2("", "", 0, 0); x2("^", "", 0, 0); x2("^a", "\na", 1, 2); x2("$", "", 0, 0); x2("$\\O", "bb\n", 2, 3); x2("\\G", "", 0, 0); x2("\\A", "", 0, 0); x2("\\Z", "", 0, 0); x2("\\z", "", 0, 0); x2("^$", "", 0, 0); x2("\\ca", "\001", 0, 1); x2("\\C-b", "\002", 0, 1); x2("\\c\\\\", "\034", 0, 1); x2("q[\\c\\\\]", "q\034", 0, 2); x2("", "a", 0, 0); x2("a", "a", 0, 1); x2("\\x61", "a", 0, 1); x2("aa", "aa", 0, 2); x2("aaa", "aaa", 0, 3); x2("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 35); x2("ab", "ab", 0, 2); x2("b", "ab", 1, 2); x2("bc", "abc", 1, 3); x2("(?i:#RET#)", "#INS##RET#", 5, 10); x2("\\17", "\017", 0, 1); x2("\\x1f", "\x1f", 0, 1); x2("a(?#....\\\\JJJJ)b", "ab", 0, 2); x2("(?x) G (o O(?-x)oO) g L", "GoOoOgLe", 0, 7); x2(".", "a", 0, 1); n(".", ""); x2("..", "ab", 0, 2); x2("\\w", "e", 0, 1); n("\\W", "e"); x2("\\s", " ", 0, 1); x2("\\S", "b", 0, 1); x2("\\d", "4", 0, 1); n("\\D", "4"); x2("\\b", "z ", 0, 0); x2("\\b", " z", 1, 1); x2("\\b", " z ", 2, 2); x2("\\B", "zz ", 1, 1); x2("\\B", "z ", 2, 2); x2("\\B", " z", 0, 0); x2("[ab]", "b", 0, 1); n("[ab]", "c"); x2("[a-z]", "t", 0, 1); n("[^a]", "a"); x2("[^a]", "\n", 0, 1); x2("[]]", "]", 0, 1); n("[^]]", "]"); x2("[\\^]+", "0^^1", 1, 3); x2("[b-]", "b", 0, 1); x2("[b-]", "-", 0, 1); x2("[\\w]", "z", 0, 1); n("[\\w]", " "); x2("[\\W]", "b$", 1, 2); x2("[\\d]", "5", 0, 1); n("[\\d]", "e"); x2("[\\D]", "t", 0, 1); n("[\\D]", "3"); x2("[\\s]", " ", 0, 1); n("[\\s]", "a"); x2("[\\S]", "b", 0, 1); n("[\\S]", " "); x2("[\\w\\d]", "2", 0, 1); n("[\\w\\d]", " "); x2("[[:upper:]]", "B", 0, 1); x2("[*[:xdigit:]+]", "+", 0, 1); x2("[*[:xdigit:]+]", "GHIKK-9+*", 6, 7); x2("[*[:xdigit:]+]", "-@^+", 3, 4); n("[[:upper]]", "A"); x2("[[:upper]]", ":", 0, 1); n("[[:upper:]]", "a"); x2("[[:^upper:]]", "a", 0, 1); n("[[:lower:]]", "A"); x2("[[:^lower:]]", "A", 0, 1); // Issue #253 e("[[:::]", ":[", ONIGERR_PREMATURE_END_OF_CHAR_CLASS); e("[[:\\]:]", ":]", ONIGERR_PREMATURE_END_OF_CHAR_CLASS); e("[[:\\[:]", ":[", ONIGERR_PREMATURE_END_OF_CHAR_CLASS); e("[[:\\]]", ":]", ONIGERR_PREMATURE_END_OF_CHAR_CLASS); e("[[:u:]]", "", ONIGERR_INVALID_POSIX_BRACKET_TYPE); e("[[:upp:]]", "", ONIGERR_INVALID_POSIX_BRACKET_TYPE); e("[[:uppers:]]", "", ONIGERR_INVALID_POSIX_BRACKET_TYPE); x2("[[:upper\\] :]]", "]", 0, 1); x2("[[::]]", ":", 0, 1); x2("[[:::]]", ":", 0, 1); x2("[[:\\]:]]*", ":]", 0, 2); x2("[[:\\[:]]*", ":[", 0, 2); x2("[[:\\]]]*", ":]", 0, 2); x2("[\\044-\\047]", "\046", 0, 1); x2("[\\x5a-\\x5c]", "\x5b", 0, 1); x2("[\\x6A-\\x6D]", "\x6c", 0, 1); n("[\\x6A-\\x6D]", "\x6E"); n("^[0-9A-F]+ 0+ UNDEF ", "75F 00000000 SECT14A notype () External | _rb_apply"); x2("[\\[]", "[", 0, 1); x2("[\\]]", "]", 0, 1); x2("[&]", "&", 0, 1); x2("[[ab]]", "b", 0, 1); x2("[[ab]c]", "c", 0, 1); n("[[^a]]", "a"); n("[^[a]]", "a"); x2("[[ab]&&bc]", "b", 0, 1); n("[[ab]&&bc]", "a"); n("[[ab]&&bc]", "c"); x2("[a-z&&b-y&&c-x]", "w", 0, 1); n("[^a-z&&b-y&&c-x]", "w"); x2("[[^a&&a]&&a-z]", "b", 0, 1); n("[[^a&&a]&&a-z]", "a"); x2("[[^a-z&&bcdef]&&[^c-g]]", "h", 0, 1); n("[[^a-z&&bcdef]&&[^c-g]]", "c"); x2("[^[^abc]&&[^cde]]", "c", 0, 1); x2("[^[^abc]&&[^cde]]", "e", 0, 1); n("[^[^abc]&&[^cde]]", "f"); x2("[a-&&-a]", "-", 0, 1); n("[a\\-&&\\-a]", "&"); n("\\wabc", " abc"); x2("a\\Wbc", "a bc", 0, 4); x2("a.b.c", "aabbc", 0, 5); x2(".\\wb\\W..c", "abb bcc", 0, 7); x2("\\s\\wzzz", " zzzz", 0, 5); x2("aa.b", "aabb", 0, 4); n(".a", "ab"); x2(".a", "aa", 0, 2); x2("^a", "a", 0, 1); x2("^a$", "a", 0, 1); x2("^\\w$", "a", 0, 1); n("^\\w$", " "); x2("^\\wab$", "zab", 0, 3); x2("^\\wabcdef$", "zabcdef", 0, 7); x2("^\\w...def$", "zabcdef", 0, 7); x2("\\w\\w\\s\\Waaa\\d", "aa aaa4", 0, 8); x2("\\A\\Z", "", 0, 0); x2("\\Axyz", "xyz", 0, 3); x2("xyz\\Z", "xyz", 0, 3); x2("xyz\\z", "xyz", 0, 3); x2("a\\Z", "a", 0, 1); x2("\\Gaz", "az", 0, 2); n("\\Gz", "bza"); n("az\\G", "az"); n("az\\A", "az"); n("a\\Az", "az"); x2("\\^\\$", "^$", 0, 2); x2("^x?y", "xy", 0, 2); x2("^(x?y)", "xy", 0, 2); x2("\\w", "_", 0, 1); n("\\W", "_"); x2("(?=z)z", "z", 0, 1); n("(?=z).", "a"); x2("(?!z)a", "a", 0, 1); n("(?!z)a", "z"); x2("(?i:a)", "a", 0, 1); x2("(?i:a)", "A", 0, 1); x2("(?i:A)", "a", 0, 1); x2("(?i:i)", "I", 0, 1); x2("(?i:I)", "i", 0, 1); x2("(?i:[A-Z])", "i", 0, 1); x2("(?i:[a-z])", "I", 0, 1); n("(?i:A)", "b"); x2("(?i:ss)", "ss", 0, 2); x2("(?i:ss)", "Ss", 0, 2); x2("(?i:ss)", "SS", 0, 2); /* 0xc5,0xbf == 017F: # LATIN SMALL LETTER LONG S */ x2("(?i:ss)", "\xc5\xbfS", 0, 3); x2("(?i:ss)", "s\xc5\xbf", 0, 3); /* 0xc3,0x9f == 00DF: # LATIN SMALL LETTER SHARP S */ x2("(?i:ss)", "\xc3\x9f", 0, 2); /* 0xe1,0xba,0x9e == 1E9E # LATIN CAPITAL LETTER SHARP S */ x2("(?i:ss)", "\xe1\xba\x9e", 0, 3); x2("(?i:xssy)", "xssy", 0, 4); x2("(?i:xssy)", "xSsy", 0, 4); x2("(?i:xssy)", "xSSy", 0, 4); x2("(?i:xssy)", "x\xc5\xbfSy", 0, 5); x2("(?i:xssy)", "xs\xc5\xbfy", 0, 5); x2("(?i:xssy)", "x\xc3\x9fy", 0, 4); x2("(?i:xssy)", "x\xe1\xba\x9ey", 0, 5); x2("(?i:x\xc3\x9fy)", "xssy", 0, 4); x2("(?i:x\xc3\x9fy)", "xSSy", 0, 4); x2("(?i:\xc3\x9f)", "ss", 0, 2); x2("(?i:\xc3\x9f)", "SS", 0, 2); x2("(?i:[\xc3\x9f])", "ss", 0, 2); x2("(?i:[\xc3\x9f])", "SS", 0, 2); x2("(?i)(?a|abd)c", "abdc"); x2("(?>abd|a)c", "abdc", 0, 4); x2("a?|b", "a", 0, 1); x2("a?|b", "b", 0, 0); x2("a?|b", "", 0, 0); x2("a*|b", "aa", 0, 2); x2("a*|b*", "ba", 0, 0); x2("a*|b*", "ab", 0, 1); x2("a+|b*", "", 0, 0); x2("a+|b*", "bbb", 0, 3); x2("a+|b*", "abbb", 0, 1); n("a+|b+", ""); x2("(a|b)?", "b", 0, 1); x2("(a|b)*", "ba", 0, 2); x2("(a|b)+", "bab", 0, 3); x2("(ab|ca)+", "caabbc", 0, 4); x2("(ab|ca)+", "aabca", 1, 5); x2("(ab|ca)+", "abzca", 0, 2); x2("(a|bab)+", "ababa", 0, 5); x2("(a|bab)+", "ba", 1, 2); x2("(a|bab)+", "baaaba", 1, 4); x2("(?:a|b)(?:a|b)", "ab", 0, 2); x2("(?:a*|b*)(?:a*|b*)", "aaabbb", 0, 3); x2("(?:a*|b*)(?:a+|b+)", "aaabbb", 0, 6); x2("(?:a+|b+){2}", "aaabbb", 0, 6); x2("h{0,}", "hhhh", 0, 4); x2("(?:a+|b+){1,2}", "aaabbb", 0, 6); n("ax{2}*a", "0axxxa1"); n("a.{0,2}a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXXa0"); x2("^a{2,}?a$", "aaa", 0, 3); x2("^[a-z]{2,}?$", "aaa", 0, 3); x2("(?:a+|\\Ab*)cc", "cc", 0, 2); n("(?:a+|\\Ab*)cc", "abcc"); x2("(?:^a+|b+)*c", "aabbbabc", 6, 8); x2("(?:^a+|b+)*c", "aabbbbc", 0, 7); x2("a|(?i)c", "C", 0, 1); x2("(?i)c|a", "C", 0, 1); x2("(?i)c|a", "A", 0, 1); x2("a(?i)b|c", "aB", 0, 2); x2("a(?i)b|c", "aC", 0, 2); n("a(?i)b|c", "AC"); n("a(?:(?i)b)|c", "aC"); x2("(?i:c)|a", "C", 0, 1); n("(?i:c)|a", "A"); x2("[abc]?", "abc", 0, 1); x2("[abc]*", "abc", 0, 3); x2("[^abc]*", "abc", 0, 0); n("[^abc]+", "abc"); x2("a?\?", "aaa", 0, 0); x2("ba?\?b", "bab", 0, 3); x2("a*?", "aaa", 0, 0); x2("ba*?", "baa", 0, 1); x2("ba*?b", "baab", 0, 4); x2("a+?", "aaa", 0, 1); x2("ba+?", "baa", 0, 2); x2("ba+?b", "baab", 0, 4); x2("(?:a?)?\?", "a", 0, 0); x2("(?:a?\?)?", "a", 0, 0); x2("(?:a?)+?", "aaa", 0, 1); x2("(?:a+)?\?", "aaa", 0, 0); x2("(?:a+)?\?b", "aaab", 0, 4); x2("(?:ab)?{2}", "", 0, 0); x2("(?:ab)?{2}", "ababa", 0, 4); x2("(?:ab)*{0}", "ababa", 0, 0); x2("(?:ab){3,}", "abababab", 0, 8); n("(?:ab){3,}", "abab"); x2("(?:ab){2,4}", "ababab", 0, 6); x2("(?:ab){2,4}", "ababababab", 0, 8); x2("(?:ab){2,4}?", "ababababab", 0, 4); x2("(?:ab){,}", "ab{,}", 0, 5); x2("(?:abc)+?{2}", "abcabcabc", 0, 6); x2("(?:X*)(?i:xa)", "XXXa", 0, 4); x2("(d+)([^abc]z)", "dddz", 0, 4); x2("([^abc]*)([^abc]z)", "dddz", 0, 4); x2("(\\w+)(\\wz)", "dddz", 0, 4); x3("(a)", "a", 0, 1, 1); x3("(ab)", "ab", 0, 2, 1); x2("((ab))", "ab", 0, 2); x3("((ab))", "ab", 0, 2, 1); x3("((ab))", "ab", 0, 2, 2); x3("((((((((((((((((((((ab))))))))))))))))))))", "ab", 0, 2, 20); x3("(ab)(cd)", "abcd", 0, 2, 1); x3("(ab)(cd)", "abcd", 2, 4, 2); x3("()(a)bc(def)ghijk", "abcdefghijk", 3, 6, 3); x3("(()(a)bc(def)ghijk)", "abcdefghijk", 3, 6, 4); x2("(^a)", "a", 0, 1); x3("(a)|(a)", "ba", 1, 2, 1); x3("(^a)|(a)", "ba", 1, 2, 2); x3("(a?)", "aaa", 0, 1, 1); x3("(a*)", "aaa", 0, 3, 1); x3("(a*)", "", 0, 0, 1); x3("(a+)", "aaaaaaa", 0, 7, 1); x3("(a+|b*)", "bbbaa", 0, 3, 1); x3("(a+|b?)", "bbbaa", 0, 1, 1); x3("(abc)?", "abc", 0, 3, 1); x3("(abc)*", "abc", 0, 3, 1); x3("(abc)+", "abc", 0, 3, 1); x3("(xyz|abc)+", "abc", 0, 3, 1); x3("([xyz][abc]|abc)+", "abc", 0, 3, 1); x3("((?i:abc))", "AbC", 0, 3, 1); x2("(abc)(?i:\\1)", "abcABC", 0, 6); x3("((?m:a.c))", "a\nc", 0, 3, 1); x3("((?=az)a)", "azb", 0, 1, 1); x3("abc|(.abd)", "zabd", 0, 4, 1); x2("(?:abc)|(ABC)", "abc", 0, 3); x3("(?i:(abc))|(zzz)", "ABC", 0, 3, 1); x3("a*(.)", "aaaaz", 4, 5, 1); x3("a*?(.)", "aaaaz", 0, 1, 1); x3("a*?(c)", "aaaac", 4, 5, 1); x3("[bcd]a*(.)", "caaaaz", 5, 6, 1); x3("(\\Abb)cc", "bbcc", 0, 2, 1); n("(\\Abb)cc", "zbbcc"); x3("(^bb)cc", "bbcc", 0, 2, 1); n("(^bb)cc", "zbbcc"); x3("cc(bb$)", "ccbb", 2, 4, 1); n("cc(bb$)", "ccbbb"); n("(\\1)", ""); n("\\1(a)", "aa"); n("(a(b)\\1)\\2+", "ababb"); n("(?:(?:\\1|z)(a))+$", "zaa"); x2("(?:(?:\\1|z)(a))+$", "zaaa", 0, 4); x2("(a)(?=\\1)", "aa", 0, 1); n("(a)$|\\1", "az"); x2("(a)\\1", "aa", 0, 2); n("(a)\\1", "ab"); x2("(a?)\\1", "aa", 0, 2); x2("(a?\?)\\1", "aa", 0, 0); x2("(a*)\\1", "aaaaa", 0, 4); x3("(a*)\\1", "aaaaa", 0, 2, 1); x2("a(b*)\\1", "abbbb", 0, 5); x2("a(b*)\\1", "ab", 0, 1); x2("(a*)(b*)\\1\\2", "aaabbaaabb", 0, 10); x2("(a*)(b*)\\2", "aaabbbb", 0, 7); x2("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 8); x3("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 3, 7); x2("(a)(b)(c)\\2\\1\\3", "abcbac", 0, 6); x2("([a-d])\\1", "cc", 0, 2); x2("(\\w\\d\\s)\\1", "f5 f5 ", 0, 6); n("(\\w\\d\\s)\\1", "f5 f5"); x2("(who|[a-c]{3})\\1", "whowho", 0, 6); x2("...(who|[a-c]{3})\\1", "abcwhowho", 0, 9); x2("(who|[a-c]{3})\\1", "cbccbc", 0, 6); x2("(^a)\\1", "aa", 0, 2); n("(^a)\\1", "baa"); n("(a$)\\1", "aa"); n("(ab\\Z)\\1", "ab"); x2("(a*\\Z)\\1", "a", 1, 1); x2(".(a*\\Z)\\1", "ba", 1, 2); x3("(.(abc)\\2)", "zabcabc", 0, 7, 1); x3("(.(..\\d.)\\2)", "z12341234", 0, 9, 1); x2("((?i:az))\\1", "AzAz", 0, 4); n("((?i:az))\\1", "Azaz"); x2("(?<=a)b", "ab", 1, 2); n("(?<=a)b", "bb"); x2("(?<=a|b)b", "bb", 1, 2); x2("(?<=a|bc)b", "bcb", 2, 3); x2("(?<=a|bc)b", "ab", 1, 2); x2("(?<=a|bc||defghij|klmnopq|r)z", "rz", 1, 2); x3("(?<=(abc))d", "abcd", 0, 3, 1); x2("(?<=(?i:abc))d", "ABCd", 3, 4); x2("(?<=^|b)c", " cbc", 3, 4); x2("(?<=a|^|b)c", " cbc", 3, 4); x2("(?<=a|(^)|b)c", " cbc", 3, 4); x2("(?<=a|(^)|b)c", "cbc", 0, 1); n("(Q)|(?<=a|(?(1))|b)c", "czc"); x2("(Q)(?<=a|(?(1))|b)c", "cQc", 1, 3); x2("(?<=a|(?~END)|b)c", "ENDc", 3, 4); n("(?", "aa", 0, 2); x2("(?a)", "a", 0, 1); x2("(?ab)\\g", "abab", 0, 4); x2("(?.zv.)\\k", "azvbazvb", 0, 8); x2("(?<=\\g)|-\\zEND (?XyZ)", "XyZ", 3, 3); x2("(?|a\\g)+", "", 0, 0); x2("(?|\\(\\g\\))+$", "()(())", 0, 6); x3("\\g(?.){0}", "X", 0, 1, 1); x2("\\g(abc|df(?.YZ){2,8}){0}", "XYZ", 0, 3); x2("\\A(?(a\\g)|)\\z", "aaaa", 0, 4); x2("(?|\\g\\g)\\z|\\zEND (?a|(b)\\g)", "bbbbabba", 0, 8); x2("(?\\w+\\sx)a+\\k", " fg xaaaaaaaafg x", 2, 18); x3("(z)()()(?<_9>a)\\g<_9>", "zaa", 2, 3, 1); x2("(.)(((?<_>a)))\\k<_>", "zaa", 0, 3); x2("((?\\d)|(?\\w))(\\k|\\k)", "ff", 0, 2); x2("(?:(?)|(?efg))\\k", "", 0, 0); x2("(?:(?abc)|(?efg))\\k", "abcefgefg", 3, 9); n("(?:(?abc)|(?efg))\\k", "abcefg"); x2("(?x)(?xx)\\k", "xxxx", 0, 4); x2("(?x)(?xx)\\k", "xxxxz", 0, 4); x2("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "a-pyumpyum", 2, 10); x3("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "xxxxabcdefghijklmnabcdefghijklmn", 4, 18, 14); x3("(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?aaa)(?)$", "aaa", 0, 3, 16); x2("(?a|\\(\\g\\))", "a", 0, 1); x2("(?a|\\(\\g\\))", "((((((a))))))", 0, 13); x3("(?a|\\(\\g\\))", "((((((((a))))))))", 0, 17, 1); x2("\\g|\\zEND(?.*abc$)", "abcxxxabc", 0, 9); x2("\\g<1>|\\zEND(.a.)", "bac", 0, 3); x3("\\g<_A>\\g<_A>|\\zEND(.a.)(?<_A>.b.)", "xbxyby", 3, 6, 1); x2("\\A(?:\\g|\\g|\\zEND (?a|c\\gc)(?b|d\\gd))$", "cdcbcdc", 0, 7); x2("\\A(?|a\\g)\\z|\\zEND (?\\g)", "aaaa", 0, 4); x2("(?(a|b\\gc){3,5})", "baaaaca", 1, 5); x2("(?(a|b\\gc){3,5})", "baaaacaaaaa", 0, 10); x2("(?\\(([^\\(\\)]++|\\g)*+\\))", "((a))", 0, 5); x2("()*\\1", "", 0, 0); x2("(?:()|())*\\1\\2", "", 0, 0); x2("(?:a*|b*)*c", "abadc", 4, 5); x3("(?:\\1a|())*", "a", 0, 0, 1); x2("x((.)*)*x", "0x1x2x3", 1, 6); x2("x((.)*)*x(?i:\\1)\\Z", "0x1x2x1X2", 1, 9); x2("(?:()|()|()|()|()|())*\\2\\5", "", 0, 0); x2("(?:()|()|()|(x)|()|())*\\2b\\5", "b", 0, 1); x2("[0-9-a]", "-", 0, 1); // PR#44 n("[0-9-a]", ":"); // PR#44 x3("(\\(((?:[^(]|\\g<1>)*)\\))", "(abc)(abc)", 1, 4, 2); // PR#43 x2("\\o{101}", "A", 0, 1); x2("\\A(a|b\\g<1>c)\\k<1+3>\\z", "bbacca", 0, 6); n("\\A(a|b\\g<1>c)\\k<1+3>\\z", "bbaccb"); x2("(?i)\\A(a|b\\g<1>c)\\k<1+2>\\z", "bBACcbac", 0, 8); x2("(?i)(?aa)|(?bb)\\k", "BBbb", 0, 4); x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 0, 5); x3("(A\\g'0')|B", "AAAAB", 0, 5, 1); x2("(a*)(?(1))aa", "aaaaa", 0, 5); x2("(a*)(?(-1))aa", "aaaaa", 0, 5); x2("(?aaa)(?('name'))aa", "aaaaa", 0, 5); x2("(a)(?(1)aa|bb)a", "aaaaa", 0, 4); x2("(?:aa|())(?(<1>)aa|bb)a", "aabba", 0, 5); x2("(?:aa|())(?('1')aa|bb|cc)a", "aacca", 0, 5); x3("(a*)(?(1)aa|a)b", "aaab", 0, 1, 1); n("(a)(?(1)a|b)c", "abc"); x2("(a)(?(1)|)c", "ac", 0, 2); n("(?()aaa|bbb)", "bbb"); x2("(a)(?(1+0)b|c)d", "abd", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "ace", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "bce", 0, 3); x2("\\R", "\r\n", 0, 2); x2("\\R", "\r", 0, 1); x2("\\R", "\n", 0, 1); x2("\\R", "\x0b", 0, 1); n("\\R\\n", "\r\n"); x2("\\R", "\xc2\x85", 0, 2); x2("\\N", "a", 0, 1); n("\\N", "\n"); n("(?m:\\N)", "\n"); n("(?-m:\\N)", "\n"); x2("\\O", "a", 0, 1); x2("\\O", "\n", 0, 1); x2("(?m:\\O)", "\n", 0, 1); x2("(?-m:\\O)", "\n", 0, 1); x2("\\K", "a", 0, 0); x2("a\\K", "a", 1, 1); x2("a\\Kb", "ab", 1, 2); x2("(a\\Kb|ac\\Kd)", "acd", 2, 3); x2("(a\\Kb|\\Kac\\K)*", "acababacab", 9, 10); x2("(?:()|())*\\1", "abc", 0, 0); x2("(?:()|())*\\2", "abc", 0, 0); x2("(?:()|()|())*\\3\\1", "abc", 0, 0); x2("(|(?:a(?:\\g'1')*))b|", "abc", 0, 2); x2("^(\"|)(.*)\\1$", "XX", 0, 2); x2("(abc|def|ghi|jkl|mno|pqr|stu){0,10}?\\z", "admno", 2, 5); x2("(abc|(def|ghi|jkl|mno|pqr){0,7}?){5}\\z", "adpqrpqrpqr", 2, 11); // cover OP_REPEAT_INC_NG_SG x2("(?!abc).*\\z", "abcde", 1, 5); // cover OP_PREC_READ_NOT_END x2("(.{2,})?", "abcde", 0, 5); // up coverage x2("((a|b|c|d|e|f|g|h|i|j|k|l|m|n)+)?", "abcde", 0, 5); // up coverage x2("((a|b|c|d|e|f|g|h|i|j|k|l|m|n){3,})?", "abcde", 0, 5); // up coverage x2("((?:a(?:b|c|d|e|f|g|h|i|j|k|l|m|n))+)?", "abacadae", 0, 8); // up coverage x2("((?:a(?:b|c|d|e|f|g|h|i|j|k|l|m|n))+?)?z", "abacadaez", 0, 9); // up coverage x2("\\A((a|b)\?\?)?z", "bz", 0, 2); // up coverage x2("((?abc){0}a\\gd)+", "aabcd", 0, 5); // up coverage x2("((?(abc)true|false))+", "false", 0, 5); // up coverage x2("((?i:abc)d)+", "abcdABCd", 0, 8); // up coverage x2("((?ab)(?()a|b)", "aba", 0, 3); // up coverage x2("(?<=a.b)c", "azbc", 3, 4); // up coverage n("(?<=(?:abcde){30})z", "abc"); // up coverage x2("(?<=(?(a)a|bb))z", "aaz", 2, 3); // up coverage x2("[a]*\\W", "aa@", 0, 3); // up coverage x2("[a]*[b]", "aab", 0, 3); // up coverage n("a*\\W", "aaa"); // up coverage n("(?W)a*\\W", "aaa"); // up coverage x2("(?<=ab(?<=ab))", "ab", 2, 2); // up coverage x2("(?a)(?b)(\\k)+", "abbaab", 0, 6); // up coverage x2("()(\\1)(\\2)", "abc", 0, 0); // up coverage x2("((?(a)b|c))(\\1)", "abab", 0, 4); // up coverage x2("(?$|b\\g)", "bbb", 0, 3); // up coverage x2("(?(?(a)a|b)|c\\g)", "cccb", 0, 4); // up coverage x2("(a)(?(1)a*|b*)+", "aaaa", 0, 4); // up coverage x2("[[^abc]&&cde]*", "de", 0, 2); // up coverage n("(a){10}{10}", "aa"); // up coverage x2("(?:a?)+", "aa", 0, 2); // up coverage x2("(?:a?)*?", "a", 0, 0); // up coverage x2("(?:a*)*?", "a", 0, 0); // up coverage x2("(?:a+?)*", "a", 0, 1); // up coverage x2("\\h", "5", 0, 1); // up coverage x2("\\H", "z", 0, 1); // up coverage x2("[\\h]", "5", 0, 1); // up coverage x2("[\\H]", "z", 0, 1); // up coverage x2("[\\o{101}]", "A", 0, 1); // up coverage x2("[\\u0041]", "A", 0, 1); // up coverage x2("(?~)", "", 0, 0); x2("(?~)", "A", 0, 0); x2("(?~ab)", "abc", 0, 0); x2("(?~abc)", "abc", 0, 0); x2("(?~abc|ab)", "abc", 0, 0); x2("(?~ab|abc)", "abc", 0, 0); x2("(?~a.c)", "abc", 0, 0); x2("(?~a.c|ab)", "abc", 0, 0); x2("(?~ab|a.c)", "abc", 0, 0); x2("aaaaa(?~)", "aaaaaaaaaa", 0, 5); x2("(?~(?:|aaa))", "aaa", 0, 0); x2("(?~aaa|)", "aaa", 0, 0); x2("a(?~(?~)).", "abcdefghijklmnopqrstuvwxyz", 0, 26); // nested absent functions cause strange result x2("/\\*(?~\\*/)\\*/", "/* */ */", 0, 5); x2("(?~\\w+)zzzzz", "zzzzz", 0, 5); x2("(?~\\w*)zzzzz", "zzzzz", 0, 5); x2("(?~A.C|B)", "ABC", 0, 0); x2("(?~XYZ|ABC)a", "ABCa", 1, 4); x2("(?~XYZ|ABC)a", "aABCa", 0, 1); x2("<[^>]*>(?~[<>])]*>", "vvv ", 0, 10); x2("(?~ab)", "ccc\ndab", 0, 5); x2("(?m:(?~ab))", "ccc\ndab", 0, 5); x2("(?-m:(?~ab))", "ccc\ndab", 0, 5); x2("(?~abc)xyz", "xyz012345678901234567890123456789abc", 0, 3); // absent with expr x2("(?~|78|\\d*)", "123456789", 0, 6); x2("(?~|def|(?:abc|de|f){0,100})", "abcdedeabcfdefabc", 0, 11); x2("(?~|ab|.*)", "ccc\nddd", 0, 3); x2("(?~|ab|\\O*)", "ccc\ndab", 0, 5); x2("(?~|ab|\\O{2,10})", "ccc\ndab", 0, 5); x2("(?~|ab|\\O{1,10})", "ab", 1, 2); n("(?~|ab|\\O{2,10})", "ab"); x2("(?~|abc|\\O{1,10})", "abc", 1, 3); x2("(?~|ab|\\O{5,10})|abc", "abc", 0, 3); x2("(?~|ab|\\O{1,10})", "cccccccccccab", 0, 10); x2("(?~|aaa|)", "aaa", 0, 0); x2("(?~||a*)", "aaaaaa", 0, 0); x2("(?~||a*?)", "aaaaaa", 0, 0); x2("(a)(?~|b|\\1)", "aaaaaa", 0, 2); x2("(a)(?~|bb|(?:a\\1)*)", "aaaaaa", 0, 5); x2("(b|c)(?~|abac|(?:a\\1)*)", "abababacabab", 1, 4); n("(?~|c|a*+)a", "aaaaa"); x2("(?~|aaaaa|a*+)", "aaaaa", 0, 0); x2("(?~|aaaaaa|a*+)b", "aaaaaab", 1, 7); x2("(?~|abcd|(?>))", "zzzabcd", 0, 0); x2("(?~|abc|a*?)", "aaaabc", 0, 0); // absent range cutter x2("(?~|abc)a*", "aaaaaabc", 0, 5); x2("(?~|abc)a*z|aaaaaabc", "aaaaaabc", 0, 8); x2("(?~|aaaaaa)a*", "aaaaaa", 0, 0); x2("(?~|abc)aaaa|aaaabc", "aaaabc", 0, 6); x2("(?>(?~|abc))aaaa|aaaabc", "aaaabc", 0, 6); x2("(?~|)a", "a", 0, 1); n("(?~|a)a", "a"); x2("(?~|a)(?~|)a", "a", 0, 1); x2("(?~|a).*(?~|)a", "bbbbbbbbbbbbbbbbbbbba", 0, 21); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaapqrabc", 0, 16); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaaabcpqrabc", 11, 19); n("\\A(?~|abc).*(xyz|pqrabc)(?~|)abc", "aaaaxyzaaaabcpqrabcabc"); x2("", "あ", 0, 0); x2("あ", "あ", 0, 3); n("い", "あ"); x2("うう", "うう", 0, 6); x2("あいう", "あいう", 0, 9); x2("こここここここここここここここここここここここここここここここここここ", "こここここここここここここここここここここここここここここここここここ", 0, 105); x2("あ", "いあ", 3, 6); x2("いう", "あいう", 3, 9); x2("\\xca\\xb8", "\xca\xb8", 0, 2); x2(".", "あ", 0, 3); x2("..", "かき", 0, 6); x2("\\w", "お", 0, 3); n("\\W", "あ"); x2("[\\W]", "う$", 3, 4); x2("\\S", "そ", 0, 3); x2("\\S", "漢", 0, 3); x2("\\b", "気 ", 0, 0); x2("\\b", " ほ", 1, 1); x2("\\B", "せそ ", 3, 3); x2("\\B", "う ", 4, 4); x2("\\B", " い", 0, 0); x2("[たち]", "ち", 0, 3); n("[なに]", "ぬ"); x2("[う-お]", "え", 0, 3); n("[^け]", "け"); x2("[\\w]", "ね", 0, 3); n("[\\d]", "ふ"); x2("[\\D]", "は", 0, 3); n("[\\s]", "く"); x2("[\\S]", "へ", 0, 3); x2("[\\w\\d]", "よ", 0, 3); x2("[\\w\\d]", " よ", 3, 6); n("\\w鬼車", " 鬼車"); x2("鬼\\W車", "鬼 車", 0, 7); x2("あ.い.う", "ああいいう", 0, 15); x2(".\\wう\\W..ぞ", "えうう うぞぞ", 0, 19); x2("\\s\\wこここ", " ここここ", 0, 13); x2("ああ.け", "ああけけ", 0, 12); n(".い", "いえ"); x2(".お", "おお", 0, 6); x2("^あ", "あ", 0, 3); x2("^む$", "む", 0, 3); x2("^\\w$", "に", 0, 3); x2("^\\wかきくけこ$", "zかきくけこ", 0, 16); x2("^\\w...うえお$", "zあいううえお", 0, 19); x2("\\w\\w\\s\\Wおおお\\d", "aお おおお4", 0, 16); x2("\\Aたちつ", "たちつ", 0, 9); x2("むめも\\Z", "むめも", 0, 9); x2("かきく\\z", "かきく", 0, 9); x2("かきく\\Z", "かきく\n", 0, 9); x2("\\Gぽぴ", "ぽぴ", 0, 6); n("\\Gえ", "うえお"); n("とて\\G", "とて"); n("まみ\\A", "まみ"); n("ま\\Aみ", "まみ"); x2("(?=せ)せ", "せ", 0, 3); n("(?=う).", "い"); x2("(?!う)か", "か", 0, 3); n("(?!と)あ", "と"); x2("(?i:あ)", "あ", 0, 3); x2("(?i:ぶべ)", "ぶべ", 0, 6); n("(?i:い)", "う"); x2("(?m:よ.)", "よ\n", 0, 4); x2("(?m:.め)", "ま\nめ", 3, 7); x2("あ?", "", 0, 0); x2("変?", "化", 0, 0); x2("変?", "変", 0, 3); x2("量*", "", 0, 0); x2("量*", "量", 0, 3); x2("子*", "子子子", 0, 9); x2("馬*", "鹿馬馬馬馬", 0, 0); n("山+", ""); x2("河+", "河", 0, 3); x2("時+", "時時時時", 0, 12); x2("え+", "ええううう", 0, 6); x2("う+", "おうううう", 3, 15); x2(".?", "た", 0, 3); x2(".*", "ぱぴぷぺ", 0, 12); x2(".+", "ろ", 0, 3); x2(".+", "いうえか\n", 0, 12); x2("あ|い", "あ", 0, 3); x2("あ|い", "い", 0, 3); x2("あい|いう", "あい", 0, 6); x2("あい|いう", "いう", 0, 6); x2("を(?:かき|きく)", "をかき", 0, 9); x2("を(?:かき|きく)け", "をきくけ", 0, 12); x2("あい|(?:あう|あを)", "あを", 0, 6); x2("あ|い|う", "えう", 3, 6); x2("あ|い|うえ|おかき|く|けこさ|しすせ|そ|たち|つてとなに|ぬね", "しすせ", 0, 9); n("あ|い|うえ|おかき|く|けこさ|しすせ|そ|たち|つてとなに|ぬね", "すせ"); x2("あ|^わ", "ぶあ", 3, 6); x2("あ|^を", "をあ", 0, 3); x2("鬼|\\G車", "け車鬼", 6, 9); x2("鬼|\\G車", "車鬼", 0, 3); x2("鬼|\\A車", "b車鬼", 4, 7); x2("鬼|\\A車", "車", 0, 3); x2("鬼|車\\Z", "車鬼", 3, 6); x2("鬼|車\\Z", "車", 0, 3); x2("鬼|車\\Z", "車\n", 0, 3); x2("鬼|車\\z", "車鬼", 3, 6); x2("鬼|車\\z", "車", 0, 3); x2("\\w|\\s", "お", 0, 3); x2("\\w|%", "%お", 0, 1); x2("\\w|[&$]", "う&", 0, 3); x2("[い-け]", "う", 0, 3); x2("[い-け]|[^か-こ]", "あ", 0, 3); x2("[い-け]|[^か-こ]", "か", 0, 3); x2("[^あ]", "\n", 0, 1); x2("(?:あ|[う-き])|いを", "うを", 0, 3); x2("(?:あ|[う-き])|いを", "いを", 0, 6); x2("あいう|(?=けけ)..ほ", "けけほ", 0, 9); x2("あいう|(?!けけ)..ほ", "あいほ", 0, 9); x2("(?=をあ)..あ|(?=をを)..あ", "ををあ", 0, 9); x2("(?<=あ|いう)い", "いうい", 6, 9); n("(?>あ|あいえ)う", "あいえう"); x2("(?>あいえ|あ)う", "あいえう", 0, 12); x2("あ?|い", "あ", 0, 3); x2("あ?|い", "い", 0, 0); x2("あ?|い", "", 0, 0); x2("あ*|い", "ああ", 0, 6); x2("あ*|い*", "いあ", 0, 0); x2("あ*|い*", "あい", 0, 3); x2("[aあ]*|い*", "aあいいい", 0, 4); x2("あ+|い*", "", 0, 0); x2("あ+|い*", "いいい", 0, 9); x2("あ+|い*", "あいいい", 0, 3); x2("あ+|い*", "aあいいい", 0, 0); n("あ+|い+", ""); x2("(あ|い)?", "い", 0, 3); x2("(あ|い)*", "いあ", 0, 6); x2("(あ|い)+", "いあい", 0, 9); x2("(あい|うあ)+", "うああいうえ", 0, 12); x2("(あい|うえ)+", "うああいうえ", 6, 18); x2("(あい|うあ)+", "ああいうあ", 3, 15); x2("(あい|うあ)+", "あいをうあ", 0, 6); x2("(あい|うあ)+", "$$zzzzあいをうあ", 6, 12); x2("(あ|いあい)+", "あいあいあ", 0, 15); x2("(あ|いあい)+", "いあ", 3, 6); x2("(あ|いあい)+", "いあああいあ", 3, 12); x2("(?:あ|い)(?:あ|い)", "あい", 0, 6); x2("(?:あ*|い*)(?:あ*|い*)", "あああいいい", 0, 9); x2("(?:あ*|い*)(?:あ+|い+)", "あああいいい", 0, 18); x2("(?:あ+|い+){2}", "あああいいい", 0, 18); x2("(?:あ+|い+){1,2}", "あああいいい", 0, 18); x2("(?:あ+|\\Aい*)うう", "うう", 0, 6); n("(?:あ+|\\Aい*)うう", "あいうう"); x2("(?:^あ+|い+)*う", "ああいいいあいう", 18, 24); x2("(?:^あ+|い+)*う", "ああいいいいう", 0, 21); x2("う{0,}", "うううう", 0, 12); x2("あ|(?i)c", "C", 0, 1); x2("(?i)c|あ", "C", 0, 1); x2("(?i:あ)|a", "a", 0, 1); n("(?i:あ)|a", "A"); x2("[あいう]?", "あいう", 0, 3); x2("[あいう]*", "あいう", 0, 9); x2("[^あいう]*", "あいう", 0, 0); n("[^あいう]+", "あいう"); x2("あ?\?", "あああ", 0, 0); x2("いあ?\?い", "いあい", 0, 9); x2("あ*?", "あああ", 0, 0); x2("いあ*?", "いああ", 0, 3); x2("いあ*?い", "いああい", 0, 12); x2("あ+?", "あああ", 0, 3); x2("いあ+?", "いああ", 0, 6); x2("いあ+?い", "いああい", 0, 12); x2("(?:天?)?\?", "天", 0, 0); x2("(?:天?\?)?", "天", 0, 0); x2("(?:夢?)+?", "夢夢夢", 0, 3); x2("(?:風+)?\?", "風風風", 0, 0); x2("(?:雪+)?\?霜", "雪雪雪霜", 0, 12); x2("(?:あい)?{2}", "", 0, 0); x2("(?:鬼車)?{2}", "鬼車鬼車鬼", 0, 12); x2("(?:鬼車)*{0}", "鬼車鬼車鬼", 0, 0); x2("(?:鬼車){3,}", "鬼車鬼車鬼車鬼車", 0, 24); n("(?:鬼車){3,}", "鬼車鬼車"); x2("(?:鬼車){2,4}", "鬼車鬼車鬼車", 0, 18); x2("(?:鬼車){2,4}", "鬼車鬼車鬼車鬼車鬼車", 0, 24); x2("(?:鬼車){2,4}?", "鬼車鬼車鬼車鬼車鬼車", 0, 12); x2("(?:鬼車){,}", "鬼車{,}", 0, 9); x2("(?:かきく)+?{2}", "かきくかきくかきく", 0, 18); x3("(火)", "火", 0, 3, 1); x3("(火水)", "火水", 0, 6, 1); x2("((時間))", "時間", 0, 6); x3("((風水))", "風水", 0, 6, 1); x3("((昨日))", "昨日", 0, 6, 2); x3("((((((((((((((((((((量子))))))))))))))))))))", "量子", 0, 6, 20); x3("(あい)(うえ)", "あいうえ", 0, 6, 1); x3("(あい)(うえ)", "あいうえ", 6, 12, 2); x3("()(あ)いう(えおか)きくけこ", "あいうえおかきくけこ", 9, 18, 3); x3("(()(あ)いう(えおか)きくけこ)", "あいうえおかきくけこ", 9, 18, 4); x3(".*(フォ)ン・マ(ン()シュタ)イン", "フォン・マンシュタイン", 15, 27, 2); x2("(^あ)", "あ", 0, 3); x3("(あ)|(あ)", "いあ", 3, 6, 1); x3("(^あ)|(あ)", "いあ", 3, 6, 2); x3("(あ?)", "あああ", 0, 3, 1); x3("(ま*)", "ままま", 0, 9, 1); x3("(と*)", "", 0, 0, 1); x3("(る+)", "るるるるるるる", 0, 21, 1); x3("(ふ+|へ*)", "ふふふへへ", 0, 9, 1); x3("(あ+|い?)", "いいいああ", 0, 3, 1); x3("(あいう)?", "あいう", 0, 9, 1); x3("(あいう)*", "あいう", 0, 9, 1); x3("(あいう)+", "あいう", 0, 9, 1); x3("(さしす|あいう)+", "あいう", 0, 9, 1); x3("([なにぬ][かきく]|かきく)+", "かきく", 0, 9, 1); x3("((?i:あいう))", "あいう", 0, 9, 1); x3("((?m:あ.う))", "あ\nう", 0, 7, 1); x3("((?=あん)あ)", "あんい", 0, 3, 1); x3("あいう|(.あいえ)", "んあいえ", 0, 12, 1); x3("あ*(.)", "ああああん", 12, 15, 1); x3("あ*?(.)", "ああああん", 0, 3, 1); x3("あ*?(ん)", "ああああん", 12, 15, 1); x3("[いうえ]あ*(.)", "えああああん", 15, 18, 1); x3("(\\Aいい)うう", "いいうう", 0, 6, 1); n("(\\Aいい)うう", "んいいうう"); x3("(^いい)うう", "いいうう", 0, 6, 1); n("(^いい)うう", "んいいうう"); x3("ろろ(るる$)", "ろろるる", 6, 12, 1); n("ろろ(るる$)", "ろろるるる"); x2("(無)\\1", "無無", 0, 6); n("(無)\\1", "無武"); x2("(空?)\\1", "空空", 0, 6); x2("(空?\?)\\1", "空空", 0, 0); x2("(空*)\\1", "空空空空空", 0, 12); x3("(空*)\\1", "空空空空空", 0, 6, 1); x2("あ(い*)\\1", "あいいいい", 0, 15); x2("あ(い*)\\1", "あい", 0, 3); x2("(あ*)(い*)\\1\\2", "あああいいあああいい", 0, 30); x2("(あ*)(い*)\\2", "あああいいいい", 0, 21); x3("(あ*)(い*)\\2", "あああいいいい", 9, 15, 2); x2("(((((((ぽ*)ぺ))))))ぴ\\7", "ぽぽぽぺぴぽぽぽ", 0, 24); x3("(((((((ぽ*)ぺ))))))ぴ\\7", "ぽぽぽぺぴぽぽぽ", 0, 9, 7); x2("(は)(ひ)(ふ)\\2\\1\\3", "はひふひはふ", 0, 18); x2("([き-け])\\1", "くく", 0, 6); x2("(\\w\\d\\s)\\1", "あ5 あ5 ", 0, 10); n("(\\w\\d\\s)\\1", "あ5 あ5"); x2("(誰?|[あ-う]{3})\\1", "誰?誰?", 0, 12); x2("...(誰?|[あ-う]{3})\\1", "あaあ誰?誰?", 0, 19); x2("(誰?|[あ-う]{3})\\1", "ういうういう", 0, 18); x2("(^こ)\\1", "ここ", 0, 6); n("(^む)\\1", "めむむ"); n("(あ$)\\1", "ああ"); n("(あい\\Z)\\1", "あい"); x2("(あ*\\Z)\\1", "あ", 3, 3); x2(".(あ*\\Z)\\1", "いあ", 3, 6); x3("(.(やいゆ)\\2)", "zやいゆやいゆ", 0, 19, 1); x3("(.(..\\d.)\\2)", "あ12341234", 0, 11, 1); x2("((?i:あvず))\\1", "あvずあvず", 0, 14); x2("(?<愚か>変|\\(\\g<愚か>\\))", "((((((変))))))", 0, 15); x2("\\A(?:\\g<阿_1>|\\g<云_2>|\\z終了 (?<阿_1>観|自\\g<云_2>自)(?<云_2>在|菩薩\\g<阿_1>菩薩))$", "菩薩自菩薩自在自菩薩自菩薩", 0, 39); x2("[[ひふ]]", "ふ", 0, 3); x2("[[いおう]か]", "か", 0, 3); n("[[^あ]]", "あ"); n("[^[あ]]", "あ"); x2("[^[^あ]]", "あ", 0, 3); x2("[[かきく]&&きく]", "く", 0, 3); n("[[かきく]&&きく]", "か"); n("[[かきく]&&きく]", "け"); x2("[あ-ん&&い-を&&う-ゑ]", "ゑ", 0, 3); n("[^あ-ん&&い-を&&う-ゑ]", "ゑ"); x2("[[^あ&&あ]&&あ-ん]", "い", 0, 3); n("[[^あ&&あ]&&あ-ん]", "あ"); x2("[[^あ-ん&&いうえお]&&[^う-か]]", "き", 0, 3); n("[[^あ-ん&&いうえお]&&[^う-か]]", "い"); x2("[^[^あいう]&&[^うえお]]", "う", 0, 3); x2("[^[^あいう]&&[^うえお]]", "え", 0, 3); n("[^[^あいう]&&[^うえお]]", "か"); x2("[あ-&&-あ]", "-", 0, 1); x2("[^[^a-zあいう]&&[^bcdefgうえお]q-w]", "え", 0, 3); x2("[^[^a-zあいう]&&[^bcdefgうえお]g-w]", "f", 0, 1); x2("[^[^a-zあいう]&&[^bcdefgうえお]g-w]", "g", 0, 1); n("[^[^a-zあいう]&&[^bcdefgうえお]g-w]", "2"); x2("aバージョンのダウンロード<\\/b>", "aバージョンのダウンロード", 0, 44); x2(".バージョンのダウンロード<\\/b>", "aバージョンのダウンロード", 0, 44); x2("\\n?\\z", "こんにちは", 15, 15); x2("(?m).*", "青赤黄", 0, 9); x2("(?m).*a", "青赤黄a", 0, 10); x2("\\p{Hiragana}", "ぴ", 0, 3); n("\\P{Hiragana}", "ぴ"); x2("\\p{Emoji}", "\xE2\xAD\x90", 0, 3); x2("\\p{^Emoji}", "\xEF\xBC\x93", 0, 3); x2("\\p{Extended_Pictographic}", "\xE2\x9A\xA1", 0, 3); n("\\p{Extended_Pictographic}", "\xE3\x81\x82"); x2("\\p{Word}", "こ", 0, 3); n("\\p{^Word}", "こ"); x2("[\\p{Word}]", "こ", 0, 3); n("[\\p{^Word}]", "こ"); n("[^\\p{Word}]", "こ"); x2("[^\\p{^Word}]", "こ", 0, 3); x2("[^\\p{^Word}&&\\p{ASCII}]", "こ", 0, 3); x2("[^\\p{^Word}&&\\p{ASCII}]", "a", 0, 1); n("[^\\p{^Word}&&\\p{ASCII}]", "#"); x2("[^[\\p{^Word}]&&[\\p{ASCII}]]", "こ", 0, 3); x2("[^[\\p{ASCII}]&&[^\\p{Word}]]", "こ", 0, 3); n("[[\\p{ASCII}]&&[^\\p{Word}]]", "こ"); x2("[^[\\p{^Word}]&&[^\\p{ASCII}]]", "こ", 0, 3); x2("[^\\x{104a}]", "こ", 0, 3); x2("[^\\p{^Word}&&[^\\x{104a}]]", "こ", 0, 3); x2("[^[\\p{^Word}]&&[^\\x{104a}]]", "こ", 0, 3); n("[^\\p{Word}||[^\\x{104a}]]", "こ"); x2("\\p{^Cntrl}", "こ", 0, 3); n("\\p{Cntrl}", "こ"); x2("[\\p{^Cntrl}]", "こ", 0, 3); n("[\\p{Cntrl}]", "こ"); n("[^\\p{^Cntrl}]", "こ"); x2("[^\\p{Cntrl}]", "こ", 0, 3); x2("[^\\p{Cntrl}&&\\p{ASCII}]", "こ", 0, 3); x2("[^\\p{Cntrl}&&\\p{ASCII}]", "a", 0, 1); n("[^\\p{^Cntrl}&&\\p{ASCII}]", "#"); x2("[^[\\p{^Cntrl}]&&[\\p{ASCII}]]", "こ", 0, 3); x2("[^[\\p{ASCII}]&&[^\\p{Cntrl}]]", "こ", 0, 3); n("[[\\p{ASCII}]&&[^\\p{Cntrl}]]", "こ"); n("[^[\\p{^Cntrl}]&&[^\\p{ASCII}]]", "こ"); n("[^\\p{^Cntrl}&&[^\\x{104a}]]", "こ"); n("[^[\\p{^Cntrl}]&&[^\\x{104a}]]", "こ"); n("[^\\p{Cntrl}||[^\\x{104a}]]", "こ"); x2("(?-W:\\p{Word})", "こ", 0, 3); n("(?W:\\p{Word})", "こ"); x2("(?W:\\p{Word})", "k", 0, 1); x2("(?-W:[[:word:]])", "こ", 0, 3); n("(?W:[[:word:]])", "こ"); x2("(?-D:\\p{Digit})", "3", 0, 3); n("(?D:\\p{Digit})", "3"); x2("(?-S:\\p{Space})", "\xc2\x85", 0, 2); n("(?S:\\p{Space})", "\xc2\x85"); x2("(?-P:\\p{Word})", "こ", 0, 3); n("(?P:\\p{Word})", "こ"); x2("(?-W:\\w)", "こ", 0, 3); n("(?W:\\w)", "こ"); x2("(?-W:\\w)", "k", 0, 1); x2("(?W:\\w)", "k", 0, 1); n("(?-W:\\W)", "こ"); x2("(?W:\\W)", "こ", 0, 3); n("(?-W:\\W)", "k"); n("(?W:\\W)", "k"); x2("(?-W:\\b)", "こ", 0, 0); n("(?W:\\b)", "こ"); x2("(?-W:\\b)", "h", 0, 0); x2("(?W:\\b)", "h", 0, 0); n("(?-W:\\B)", "こ"); x2("(?W:\\B)", "こ", 0, 0); n("(?-W:\\B)", "h"); n("(?W:\\B)", "h"); x2("(?-P:\\b)", "こ", 0, 0); n("(?P:\\b)", "こ"); x2("(?-P:\\b)", "h", 0, 0); x2("(?P:\\b)", "h", 0, 0); n("(?-P:\\B)", "こ"); x2("(?P:\\B)", "こ", 0, 0); n("(?-P:\\B)", "h"); n("(?P:\\B)", "h"); x2("\\p{InBasicLatin}", "\x41", 0, 1); //x2("\\p{Grapheme_Cluster_Break_Regional_Indicator}", "\xF0\x9F\x87\xA9", 0, 4); //n("\\p{Grapheme_Cluster_Break_Regional_Indicator}", "\xF0\x9F\x87\xA5"); // extended grapheme cluster // CR + LF n(".\\y\\O", "\x0d\x0a"); x2(".\\Y\\O", "\x0d\x0a", 0, 2); // LATIN SMALL LETTER G, COMBINING DIAERESIS n("^.\\y.$", "\x67\xCC\x88"); x2(".\\Y.", "\x67\xCC\x88", 0, 3); x2("\\y.\\Y.\\y", "\x67\xCC\x88", 0, 3); // HANGUL SYLLABLE GAG x2("\\y.\\y", "\xEA\xB0\x81", 0, 3); // HANGUL CHOSEONG KIYEOK, HANGUL JUNGSEONG A, HANGUL JONGSEONG KIYEOK x2("^.\\Y.\\Y.$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8", 0, 9); n("^.\\y.\\Y.$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8"); // TAMIL LETTER NA, TAMIL VOWEL SIGN I, x2(".\\Y.", "\xE0\xAE\xA8\xE0\xAE\xBF", 0, 6); n(".\\y.", "\xE0\xAE\xA8\xE0\xAE\xBF"); // THAI CHARACTER KO KAI, THAI CHARACTER SARA AM x2(".\\Y.", "\xE0\xB8\x81\xE0\xB8\xB3", 0, 6); n(".\\y.", "\xE0\xB8\x81\xE0\xB8\xB3"); // DEVANAGARI LETTER SSA, DEVANAGARI VOWEL SIGN I x2(".\\Y.", "\xE0\xA4\xB7\xE0\xA4\xBF", 0, 6); n(".\\y.", "\xE0\xA4\xB7\xE0\xA4\xBF"); // {Extended_Pictographic} Extend* ZWJ x {Extended_Pictographic} x2("..\\Y.", "\xE3\x80\xB0\xE2\x80\x8D\xE2\xAD\x95", 0, 9); x2("...\\Y.", "\xE3\x80\xB0\xCC\x82\xE2\x80\x8D\xE2\xAD\x95", 0, 11); n("...\\Y.", "\xE3\x80\xB0\xCD\xB0\xE2\x80\x8D\xE2\xAD\x95"); // CR + LF n("^\\X\\X$", "\x0d\x0a"); x2("^\\X$", "\x0d\x0a", 0, 2); // LATIN SMALL LETTER G, COMBINING DIAERESIS n("^\\X\\X.$", "\x67\xCC\x88"); x2("^\\X$", "\x67\xCC\x88", 0, 3); // HANGUL CHOSEONG KIYEOK, HANGUL JUNGSEONG A, HANGUL JONGSEONG KIYEOK x2("^\\X$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8", 0, 9); n("^\\X\\X\\X$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8"); // TAMIL LETTER NA, TAMIL VOWEL SIGN I, x2("^\\X$", "\xE0\xAE\xA8\xE0\xAE\xBF", 0, 6); n("\\X\\X", "\xE0\xAE\xA8\xE0\xAE\xBF"); // THAI CHARACTER KO KAI, THAI CHARACTER SARA AM x2("^\\X$", "\xE0\xB8\x81\xE0\xB8\xB3", 0, 6); n("\\X\\X", "\xE0\xB8\x81\xE0\xB8\xB3"); // DEVANAGARI LETTER SSA, DEVANAGARI VOWEL SIGN I x2("^\\X$", "\xE0\xA4\xB7\xE0\xA4\xBF", 0, 6); n("\\X\\X", "\xE0\xA4\xB7\xE0\xA4\xBF"); n("^\\X.$", "\xE0\xAE\xA8\xE0\xAE\xBF"); // a + COMBINING GRAVE ACCENT (U+0300) x2("h\\Xllo", "ha\xCC\x80llo", 0, 7); // Text Segment: Extended Grapheme Cluster <-> Word Boundary x2("(?y{g})\\yabc\\y", "abc", 0, 3); x2("(?y{g})\\y\\X\\y", "abc", 0, 1); x2("(?y{w})\\yabc\\y", "abc", 0, 3); // WB1, WB2 x2("(?y{w})\\X", "\r\n", 0, 2); // WB3 x2("(?y{w})\\X", "\x0cz", 0, 1); // WB3a x2("(?y{w})\\X", "q\x0c", 0, 1); // WB3b x2("(?y{w})\\X", "\xE2\x80\x8D\xE2\x9D\x87", 0, 6); // WB3c x2("(?y{w})\\X", "\x20\x20", 0, 2); // WB3d x2("(?y{w})\\X", "a\xE2\x80\x8D", 0, 4); // WB4 x2("(?y{w})\\y\\X\\y", "abc", 0, 3); // WB5 x2("(?y{w})\\y\\X\\y", "v\xCE\x87w", 0, 4); // WB6, WB7 x2("(?y{w})\\y\\X\\y", "\xD7\x93\x27", 0, 3); // WB7a x2("(?y{w})\\y\\X\\y", "\xD7\x93\x22\xD7\x93", 0, 5); // WB7b, WB7c x2("(?y{w})\\X", "14 45", 0, 2); // WB8 x2("(?y{w})\\X", "a14", 0, 3); // WB9 x2("(?y{w})\\X", "832e", 0, 4); // WB10 x2("(?y{w})\\X", "8\xEF\xBC\x8C\xDB\xB0", 0, 6); // WB11, WB12 x2("(?y{w})\\y\\X\\y", "ケン", 0, 6); // WB13 x2("(?y{w})\\y\\X\\y", "ケン\xE2\x80\xAFタ", 0, 12); // WB13a, WB13b x2("(?y{w})\\y\\X\\y", "\x21\x23", 0, 1); // WB999 x2("(?y{w})\\y\\X\\y", "山ア", 0, 3); x2("(?y{w})\\X", "3.14", 0, 4); x2("(?y{w})\\X", "3 14", 0, 1); x2("\\x40", "@", 0, 1); x2("\\x1", "\x01", 0, 1); x2("\\x{1}", "\x01", 0, 1); x2("\\x{4E38}", "\xE4\xB8\xB8", 0, 3); x2("\\u4E38", "\xE4\xB8\xB8", 0, 3); x2("\\u0040", "@", 0, 1); x2("c.*\\b", "abc", 2, 3); x2("\\b.*abc.*\\b", "abc", 0, 3); x2("((?()0+)+++(((0\\g<0>)0)|())++++((?(1)(0\\g<0>))++++++0*())++++((?(1)(0\\g<1>)+)++++++++++*())++++((?(1)((0)\\g<0>)+)++())+0++*+++(((0\\g<0>))*())++++((?(1)(0\\g<0>)+)++++++++++*|)++++*+++((?(1)((0)\\g<0>)+)+++++++++())++*|)++++((?()0))|", "abcde", 0, 0); // #139 n("(*FAIL)", "abcdefg"); n("abcd(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)", "abcdefg"); x2("(?:[ab]|(*MAX{2}).)*", "abcbaaccaaa", 0, 7); x2("(?:(*COUNT[AB]{X})[ab]|(*COUNT[CD]{X})[cd])*(*CMP{AB,<,CD})", "abababcdab", 5, 8); x2("(?(?{....})123|456)", "123", 0, 3); x2("(?(*FAIL)123|456)", "456", 0, 3); x2("\\g'0'++{,0}", "abcdefgh", 0, 0); x2("\\g'0'++{,0}?", "abcdefgh", 0, 0); x2("\\g'0'++{,0}b", "abcdefgh", 1, 2); x2("\\g'0'++{,0}?def", "abcdefgh", 3, 6); x2("a{1,3}?", "aaa", 0, 1); x2("a{3}", "aaa", 0, 3); x2("a{3}?", "aaa", 0, 3); x2("a{3}?", "aa", 0, 0); x2("a{3,3}?", "aaa", 0, 3); n("a{3,3}?", "aa"); x2("a{1,3}+", "aaaaaa", 0, 6); x2("a{3}+", "aaaaaa", 0, 6); x2("a{3,3}+", "aaaaaa", 0, 6); n("a{2,3}?", "a"); n("a{3,2}a", "aaa"); x2("a{3,2}b", "aaab", 0, 4); x2("a{3,2}b", "aaaab", 1, 5); x2("a{3,2}b", "aab", 0, 3); x2("a{3,2}?", "", 0, 0); /* == (?:a{3,2})?*/ x2("a{2,3}+a", "aaa", 0, 3); /* == (?:a{2,3})+*/ x2("[\\x{0}-\\x{7fffffff}]", "a", 0, 1); x2("[\\x{7f}-\\x{7fffffff}]", "\xe5\xae\xb6", 0, 3); x2("[a[cdef]]", "a", 0, 1); n("[a[xyz]-c]", "b"); x2("[a[xyz]-c]", "a", 0, 1); x2("[a[xyz]-c]", "-", 0, 1); x2("[a[xyz]-c]", "c", 0, 1); x2("(a.c|def)(.{4})(?<=\\1)", "abcdabc", 0, 7); x2("(a.c|de)(.{4})(?<=\\1)", "abcdabc", 0, 7); x2("(a.c|def)(.{5})(?<=d\\1e)", "abcdabce", 0, 8); x2("(a.c|.)d(?<=\\k<1>d)", "zzzzzabcdabc", 5, 9); x2("(?<=az*)abc", "azzzzzzzzzzabcdabcabc", 11, 14); x2("(?<=ab|abc|abcd)ef", "abcdef", 4, 6); x2("(?<=ta+|tb+|tc+|td+)zz", "tcccccccccczz", 11, 13); x2("(?<=t.{7}|t.{5}|t.{2}|t.)zz", "tczz", 2, 4); x2("(?<=t.{7}|t.{5}|t.{2})zz", "tczzzz", 3, 5); x2("(?<=t.{7}|t.{5}|t.{3})zz", "tczzazzbzz", 8, 10); n("(?<=t.{7}|t.{5}|t.{3})zz", "tczzazzbczz"); x2("(?<=(ab|abc|abcd))ef", "abcdef", 4, 6); x2("(?<=(ta+|tb+|tc+|td+))zz", "tcccccccccczz", 11, 13); x2("(?<=(t.{7}|t.{5}|t.{2}|t.))zz", "tczz", 2, 4); x2("(?<=(t.{7}|t.{5}|t.{2}))zz", "tczzzz", 3, 5); x2("(?<=(t.{7}|t.{5}|t.{3}))zz", "tczzazzbzz", 8, 10); n("(?<=(t.{7}|t.{5}|t.{3}))zz", "tczzazzbczz"); x2("(.{1,4})(.{1,4})(?<=\\2\\1)", "abaaba", 0, 6); x2("(.{1,4})(.{1,4})(?<=\\2\\1)", "ababab", 0, 6); n("(.{1,4})(.{1,4})(?<=\\2\\1)", "abcdabce"); x2("(.{1,4})(.{1,4})(?<=\\2\\1)", "abcdabceabce", 4, 12); x2("(?<=a)", "a", 1, 1); x2("(?<=a.*\\w)z", "abbbz", 4, 5); n("(?<=a.*\\w)z", "abb z"); x2("(?<=a.*\\W)z", "abb z", 4, 5); x2("(?<=a.*\\b)z", "abb z", 4, 5); x2("(?<=(?>abc))", "abc", 3, 3); x2("(?<=a\\Xz)", "abz", 3, 3); n("(?<=^a*)bc", "zabc"); n("(?<=a*\\b)b", "abc"); x2("(?<=a+.*[efg])z", "abcdfz", 5, 6); x2("(?<=a+.*[efg])z", "abcdfgz", 6, 7); n("(?<=a+.*[efg])z", "bcdfz"); x2("(?<=a*.*[efg])z", "bcdfz", 4, 5); n("(?<=a+.*[efg])z", "abcdz"); x2("(?<=v|t|a+.*[efg])z", "abcdfz", 5, 6); x2("(?<=v|t|^a+.*[efg])z", "abcdfz", 5, 6); x2("(?<=^(?:v|t|a+.*[efg]))z", "abcdfz", 5, 6); x2("(?<=v|^t|a+.*[efg])z", "uabcdfz", 6, 7); n("^..(?<=(a{,2}))\\1z", "aaaaz"); // !!! look-behind is shortest priority x2("^..(?<=(a{,2}))\\1z", "aaz", 0, 3); // shortest priority e("(?<=(?~|zoo)a.*z)", "abcdefz", ONIGERR_INVALID_LOOK_BEHIND_PATTERN); e("(?<=(?~|)a.*z)", "abcdefz", ONIGERR_INVALID_LOOK_BEHIND_PATTERN); e("(a(?~|boo)z){0}(?<=\\g<1>)", "abcdefz", ONIGERR_INVALID_LOOK_BEHIND_PATTERN); x2("(?<=(?<= )| )", "abcde fg", 6, 6); // #173 x2("(?<=D|)(?<=@!nnnnnnnnnIIIIn;{1}D?()|;{1}x)", "(?<=D|)(?<=@!nnnnnnnnnIIIIn;{1}D?()|;{1}x)", 55, 55); // #173 x2("(?<=;()|)\\g<1>", "", 0, 0); // reduced #173 x2("(?<=;()|)\\k<1>", ";", 1, 1); x2("(())\\g<3>{0}(?<=|())", "abc", 0, 0); // #175 x2("(?<=()|)\\1{0}", "abc", 0, 0); e("(?)|(?<=(\\k<1>))", ""); x2("(a|\\k<2>)|(?<=(\\k<1>))", "a", 0, 1); x2("(a|\\k<2>)|(?<=b(\\k<1>))", "ba", 1, 2); // #295 n("(?|b))", "aab", 0, 3); x2("((?(a)\\g<1>))", "aab", 0, 2); x2("((?(a)\\g<1>))", "", 0, 0); x2("(b(?(a)|\\g<1>))", "bba", 0, 3); e("(()(?(2)\\g<1>))", "", ONIGERR_NEVER_ENDING_RECURSION); x2("(?(a)(?:b|c))", "ac", 0, 2); x2("(?(a)(?:b|c))", "", 0, 0); x2("(?(a)b)", "", 0, 0); n("^(?(a)b|c)", "ac"); x2("(?i)a|b", "B", 0, 1); n("((?i)a|b.)|c", "C"); n("c(?i)a.|b.", "Caz"); x2("c(?i)a|b", "cB", 0, 2); /* == c(?i:a|b) */ x2("c(?i)a.|b.", "cBb", 0, 3); x2("(?i)st", "st", 0, 2); x2("(?i)st", "St", 0, 2); x2("(?i)st", "sT", 0, 2); x2("(?i)st", "\xC5\xBFt", 0, 3); // U+017F x2("(?i)st", "\xEF\xAC\x85", 0, 3); // U+FB05 x2("(?i)st", "\xEF\xAC\x86", 0, 3); // U+FB06 x2("(?i)ast", "Ast", 0, 3); x2("(?i)ast", "ASt", 0, 3); x2("(?i)ast", "AsT", 0, 3); x2("(?i)ast", "A\xC5\xBFt", 0, 4); // U+017F x2("(?i)ast", "A\xEF\xAC\x85", 0, 4); // U+FB05 x2("(?i)ast", "A\xEF\xAC\x86", 0, 4); // U+FB06 x2("(?i)stZ", "stz", 0, 3); x2("(?i)stZ", "Stz", 0, 3); x2("(?i)stZ", "sTz", 0, 3); x2("(?i)stZ", "\xC5\xBFtz", 0, 4); // U+017F x2("(?i)stZ", "\xEF\xAC\x85z", 0, 4); // U+FB05 x2("(?i)stZ", "\xEF\xAC\x86z", 0, 4); // U+FB06 x2("(?i)BstZ", "bstz", 0, 4); x2("(?i)BstZ", "bStz", 0, 4); x2("(?i)BstZ", "bsTz", 0, 4); x2("(?i)BstZ", "b\xC5\xBFtz", 0, 5); // U+017F x2("(?i)BstZ", "b\xEF\xAC\x85z", 0, 5); // U+FB05 x2("(?i)BstZ", "b\xEF\xAC\x86z", 0, 5); // U+FB06 x2("(?i).*st\\z", "tttssss\xC5\xBFt", 0, 10); // U+017F x2("(?i).*st\\z", "tttssss\xEF\xAC\x85", 0, 10); // U+FB05 x2("(?i).*st\\z", "tttssss\xEF\xAC\x86", 0, 10); // U+FB06 x2("(?i).*あstい\\z", "tttssssあ\xC5\xBFtい", 0, 16); // U+017F x2("(?i).*あstい\\z", "tttssssあ\xEF\xAC\x85い", 0, 16); // U+FB05 x2("(?i).*あstい\\z", "tttssssあ\xEF\xAC\x86い", 0, 16); // U+FB06 x2("(?i).*\xC5\xBFt\\z", "tttssssst", 0, 9); // U+017F x2("(?i).*\xEF\xAC\x85\\z", "tttssssあst", 0, 12); // U+FB05 x2("(?i).*\xEF\xAC\x86い\\z", "tttssssstい", 0, 12); // U+FB06 x2("(?i).*\xEF\xAC\x85\\z", "tttssssあ\xEF\xAC\x85", 0, 13); x2("(?i).*ss", "abcdefghijklmnopqrstuvwxyz\xc3\x9f", 0, 28); // U+00DF x2("(?i).*ss.*", "abcdefghijklmnopqrstuvwxyz\xc3\x9fxyz", 0, 31); // U+00DF x2("(?i).*\xc3\x9f", "abcdefghijklmnopqrstuvwxyzss", 0, 28); // U+00DF x2("(?i).*ss.*", "abcdefghijklmnopqrstuvwxyzSSxyz", 0, 31); x2("(?i)ssv", "\xc3\x9fv", 0, 3); // U+00DF x2("(?i)(?<=ss)v", "SSv", 2, 3); x2("(?i)(?<=\xc3\x9f)v", "\xc3\x9fv", 2, 3); //x2("(?i)(?<=\xc3\x9f)v", "ssv", 2, 3); //x2("(?i)(?<=ss)v", "\xc3\x9fv", 2, 3); /* #156 U+01F0 (UTF-8: C7 B0) */ x2("(?i).+Isssǰ", ".+Isssǰ", 0, 8); x2(".+Isssǰ", ".+Isssǰ", 0, 8); x2("(?i)ǰ", "ǰ", 0, 2); x2("(?i)ǰ", "j\xcc\x8c", 0, 3); x2("(?i)j\xcc\x8c", "ǰ", 0, 2); x2("(?i)5ǰ", "5ǰ", 0, 3); x2("(?i)5ǰ", "5j\xcc\x8c", 0, 4); x2("(?i)5j\xcc\x8c", "5ǰ", 0, 3); x2("(?i)ǰv", "ǰV", 0, 3); x2("(?i)ǰv", "j\xcc\x8cV", 0, 4); x2("(?i)j\xcc\x8cv", "ǰV", 0, 3); x2("(?i)[ǰ]", "ǰ", 0, 2); x2("(?i)[ǰ]", "j\xcc\x8c", 0, 3); //x2("(?i)[j]\xcc\x8c", "ǰ", 0, 2); x2("(?i)\ufb00a", "ffa", 0, 3); x2("(?i)ffz", "\xef\xac\x80z", 0, 4); x2("(?i)\u2126", "\xcf\x89", 0, 2); x2("a(?i)\u2126", "a\xcf\x89", 0, 3); x2("(?i)A\u2126", "a\xcf\x89", 0, 3); x2("(?i)A\u2126=", "a\xcf\x89=", 0, 4); x2("(?i:ss)=1234567890", "\xc5\xbf\xc5\xbf=1234567890", 0, 15); x2("\\x{000A}", "\x0a", 0, 1); x2("\\x{000A 002f}", "\x0a\x2f", 0, 2); x2("\\x{000A 002f }", "\x0a\x2f", 0, 2); x2("\\x{007C 001b}", "\x7c\x1b", 0, 2); x2("\\x{1 2 3 4 5 6 7 8 9 a b c d e f}", "\x01\x02\x3\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 0, 15); x2("a\\x{000A 002f}@", "a\x0a\x2f@", 0, 4); x2("a\\x{0060\n0063}@", "a\x60\x63@", 0, 4); e("\\x{00000001 000000012}", "", ONIGERR_TOO_LONG_WIDE_CHAR_VALUE); e("\\x{000A 00000002f}", "", ONIGERR_TOO_LONG_WIDE_CHAR_VALUE); e("\\x{000A 002f/", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\x{000A 002f /", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\x{000A", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\x{000A ", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\x{000A 002f ", "", ONIGERR_INVALID_CODE_POINT_VALUE); x2("\\o{102}", "B", 0, 1); x2("\\o{102 103}", "BC", 0, 2); x2("\\o{0160 0000161}", "pq", 0, 2); x2("\\o{1 2 3 4 5 6 7 10 11 12 13 14 15 16 17}", "\x01\x02\x3\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 0, 15); x2("\\o{0007 0010 }", "\x07\x08", 0, 2); e("\\o{0000 0015/", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\o{0000 0015 /", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\o{0015", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\o{0015 ", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\o{0007 002f}", "", ONIGERR_INVALID_CODE_POINT_VALUE); x2("[\\x{000A}]", "\x0a", 0, 1); x2("[\\x{000A 002f}]+", "\x0a\x2f\x2e", 0, 2); x2("[\\x{01 0F 1A 2c 4B}]+", "\x20\x01\x0f\x1a\x2c\x4b\x1b", 1, 6); x2("[\\x{0020 0024}-\\x{0026}]+", "\x25\x24\x26\x23", 0, 3); x2("[\\x{0030}-\\x{0033 005a}]+", "\x30\x31\x32\x33\x5a\34", 0, 5); e("[\\x{000A]", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{000A ]", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{000A }]", "", ONIGERR_INVALID_CODE_POINT_VALUE); x2("[\\o{102}]", "B", 0, 1); x2("[\\o{102 103}]*", "BC", 0, 2); e("[a\\o{002 003]bcde|zzz", "", ONIGERR_INVALID_CODE_POINT_VALUE); x2("[\\x{0030-0039}]+", "abc0123456789def", 3, 13); x2("[\\x{0030 - 0039 }]+", "abc0123456789def", 3, 13); x2("[\\x{0030 - 0039 0063 0064}]+", "abc0123456789def", 2, 14); x2("[\\x{0030 - 0039 0063-0065}]+", "acde019b", 1, 7); e("[\\x{0030 - 0039-0063 0064}]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{0030 - }]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{0030 -- 0040}]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{0030--0040}]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{0030 - - 0040}]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{0030 0044 - }]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[a-\\x{0070 - 0039}]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); x2("[a-\\x{0063 0071}]+", "dabcqz", 1, 5); x2("[-\\x{0063-0065}]+", "ace-df", 1, 5); x2("[\\x61-\\x{0063 0065}]+", "abced", 0, 4); e("[\\x61-\\x{0063-0065}]+", "", ONIGERR_INVALID_CODE_POINT_VALUE); x2("[t\\x{0063 0071}]+", "tcqb", 0, 3); x2("[\\W\\x{0063 0071}]+", "*cqa", 0, 3); x2("(\\O|(?=z\\g<2>*))(\\g<0>){0}", "a", 0, 1); /* whole options */ x2("(?Ii)abc", "abc", 0, 3); x2("(?Ii)abc", "ABC", 0, 3); x2("(?Ii:abc)", "abc", 0, 3); x2("(?Ii)xyz|abc", "aBc", 0, 3); x2("(?Ii:zz|abc|AZ)", "ABc", 0, 3); e("(?Ii:abc)d", "abc", ONIGERR_INVALID_GROUP_OPTION); e("(?-Ii:abc)", "abc", ONIGERR_INVALID_GROUP_OPTION); x2("(?I-i:abc)", "abc", 0, 3); e("(?i-I:abc)", "abc", ONIGERR_INVALID_GROUP_OPTION); x2("(?i)\xe2\x84\xaa", "k", 0, 1); n("(?Ii)\xe2\x84\xaa", "k"); e("((?Ii)abc)", "", ONIGERR_INVALID_GROUP_OPTION); x2("(?:(?Ii)abc)", "ABC", 0, 3); x2("(?:(?:(?Ii)abc))", "ABC", 0, 3); e("x(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION); e("()(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION); e("(?:)(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION); e("^(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION); x2("(?Ii)$", "", 0, 0); x2("(?Ii)|", "", 0, 0); e("(?Ii)|(?Ii)", "", ONIGERR_INVALID_GROUP_OPTION); x2("a*", "aabcaaa", 0, 2); x2("(?L)a*", "aabcaaa", 4, 7); x2("(?L)a{4}|a{3}|b*", "baaaaabbb", 1, 5); x2("(?L)a{3}|a{4}|b*", "baaaaabbb", 1, 5); e("x(?L)xxxxx", "", ONIGERR_INVALID_GROUP_OPTION); e("(?-L)x", "", ONIGERR_INVALID_GROUP_OPTION); x3("(..)\\1", "abab", 0, 2, 1); e("(?C)(..)\\1", "abab", ONIGERR_INVALID_BACKREF); e("(?-C)", "", ONIGERR_INVALID_GROUP_OPTION); e("(?C)(.)(.)(.)(?.)\\1", "abcdd", ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); x2("(?L)z|a\\g<0>a", "aazaa", 0, 5); x2("(?Li)z|a\\g<0>a", "aazAA", 0, 5); x2("(?Li:z|a\\g<0>a)", "aazAA", 0, 5); x2("(?L)z|a\\g<0>a", "aazaaaazaaaa", 3, 12); // Issue #264 n("(?iI)s", "\xc5\xbf"); n("(?iI)[s]", "\xc5\xbf"); // FAIL n("(?iI:s)", "\xc5\xbf"); n("(?iI:[s])", "\xc5\xbf"); // FAIL x2("(?iI)(?:[[:word:]])", "\xc5\xbf", 0, 2); n("(?iI)(?W:[[:word:]])", "\xc5\xbf"); // FAIL n("(?iI)(?W:\\w)", "\xc5\xbf"); n("(?iI)(?W:[\\w])", "\xc5\xbf"); // FAIL n("(?iI)(?W:\\p{Word})", "\xc5\xbf"); n("(?iI)(?W:[\\p{Word}])", "\xc5\xbf"); // FAIL x2("(?iW:[[:word:]])", "\xc5\xbf", 0, 2); x2("(?iW:[\\p{Word}])", "\xc5\xbf", 0, 2); x2("(?iW:[\\w])", "\xc5\xbf", 0, 2); n("(?iW:\\p{Word})", "\xc5\xbf"); n("(?iW:\\w)", "\xc5\xbf"); x2("(?i)\\p{Word}", "\xc5\xbf", 0, 2); x2("(?i)\\w", "\xc5\xbf", 0, 2); x2("(?iW:[[:^word:]])", "\xc5\xbf", 0, 2); x2("(?iW:[\\P{Word}])", "\xc5\xbf", 0, 2); x2("(?iW:[\\W])", "\xc5\xbf", 0, 2); x2("(?iW:\\P{Word})", "\xc5\xbf", 0, 2); x2("(?iW:\\W)", "\xc5\xbf", 0, 2); n("(?i)\\P{Word}", "\xc5\xbf"); n("(?i)\\W", "\xc5\xbf"); x2("(?iW:[[:^word:]])", "s", 0, 1); x2("(?iW:[\\P{Word}])", "s", 0, 1); x2("(?iW:[\\W])", "s", 0, 1); n("(?iW:\\P{Word})", "s"); n("(?iW:\\W)", "s"); n("(?i)\\P{Word}", "s"); n("(?i)\\W", "s"); x2("[[:punct:]]", ":", 0, 1); x2("[[:punct:]]", "$", 0, 1); x2("[[:punct:]]+", "$+<=>^`|~", 0, 9); n("[[:punct:]]", "a"); n("[[:punct:]]", "7"); x2("\\p{PosixPunct}+", "$¦", 0, 3); x2("\\A.*\\R", "\n", 0, 1); x2("\\A\\O*\\R", "\n", 0, 1); x2("\\A\\n*\\R", "\n", 0, 1); x2("\\A\\R*\\R", "\n", 0, 1); x2("\\At*\\R", "\n", 0, 1); x2("\\A.{0,99}\\R", "\n", 0, 1); x2("\\A\\O{0,99}\\R", "\n", 0, 1); x2("\\A\\n{0,99}\\R", "\n", 0, 1); x2("\\A\\R{0,99}\\R", "\n", 0, 1); x2("\\At{0,99}\\R", "\n", 0, 1); x2("\\A.*\\n", "\n", 0, 1); // \n x2("\\A.{0,99}\\n", "\n", 0, 1); x2("\\A.*\\O", "\n", 0, 1); // \O x2("\\A.{0,99}\\O", "\n", 0, 1); x2("\\A.*\\s", "\n", 0, 1); // \s x2("\\A.{0,99}\\s", "\n", 0, 1); n("a(b|)+d", "abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcd"); /* https://www.haijin-boys.com/discussions/5079 */ n(" \xfd", ""); /* https://bugs.php.net/bug.php?id=77370 */ /* can't use \xfc00.. because compiler error: hex escape sequence out of range */ n("()0\\xfc00000\\xfc00000\\xfc00000\xfc", ""); /* https://bugs.php.net/bug.php?id=77371 */ x2("000||0\xfa", "0", 0, 0); /* https://bugs.php.net/bug.php?id=77381 */ e("(?i)000000000000000000000\xf0", "", ONIGERR_INVALID_CODE_POINT_VALUE); /* https://bugs.php.net/bug.php?id=77382 */ n("0000\\\xf5", "0"); /* https://bugs.php.net/bug.php?id=77385 */ n("(?i)FFF00000000000000000\xfd", ""); /* https://bugs.php.net/bug.php?id=77394 */ n("(?x)\n (?:*]|&&|\\|\\||\\?|\\*\\/|^await|[^\\._$[:alnum:]]await|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^yield|[^\\._$[:alnum:]]yield|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))", " while (i < len && f(array[i]))"); /* Issue #192 */ x2("aaaaaaaaaaaaaaaaaaaaaaaあb", "aaaaaaaaaaaaaaaaaaaaaaaあb", 0, 27); /* Issue #221 */ n("d{65538}+{61533} ", "d{65538}+{61533} "); e("x{55380}{77590}", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); e("(xyz){40000}{99999}(?vv)", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); e("f{90000,90000}{80000,80000}", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); n("f{90000,90000}{80000,80001}", ""); x2("\\p{Common}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ x2("\\p{In_Enclosed_CJK_Letters_and_Months}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ e("\\x{7fffffff}", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{7fffffff}]", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\u040", "@", ONIGERR_INVALID_CODE_POINT_VALUE); e("(?\\g)", "zzzz", ONIGERR_NEVER_ENDING_RECURSION); e("(*FOO)", "abcdefg", ONIGERR_UNDEFINED_CALLOUT_NAME); e("*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("|*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("(?i)*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("(?:*)", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("(?m:*)", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); x2("(?:)*", "abc", 0, 0); e("^*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID); e("abc|?", "", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); onig_region_free(region, 1); onig_end(); return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/test_back.c0000644000175100017510000015446415215513537014231 /* * test_back.c * Copyright (c) 2020-2024 K.Kosako */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION #endif #include #include "oniguruma.h" #include #define SLEN(s) strlen(s) static int nsucc = 0; static int nfail = 0; static int nerror = 0; #ifdef __TRUSTINSOFT_ANALYZER__ static int nall = 0; #endif static FILE* err_file; static OnigRegion* region; static void xx(char* pattern, char* str, int from, int to, int mem, int not, int error_no, int line_no) { #ifdef __TRUSTINSOFT_ANALYZER__ if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; #endif int r; regex_t* reg; OnigErrorInfo einfo; r = onig_new(®, (UChar* )pattern, (UChar* )(pattern + SLEN(pattern)), ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, &einfo); if (r) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(err_file, "ERROR: %s /%s/ #%d\n", s, pattern, line_no); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ %d #%d\n", pattern, r, line_no); nsucc++; } else { fprintf(stdout, "FAIL(ERROR): /%s/ '%s', %d, %d #%d\n", pattern, str, error_no, r, line_no); nfail++; } } return ; } r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )(str + SLEN(str)), (UChar* )str, region, ONIG_OPTION_NONE); if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r); fprintf(err_file, "ERROR: %s /%s/ #%d\n", s, pattern, line_no); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ '%s', %d #%d\n", pattern, str, r, line_no); nsucc++; } else { fprintf(stdout, "FAIL ERROR NO: /%s/ '%s', %d, %d #%d\n", pattern, str, error_no, r, line_no); nfail++; } } return ; } if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s' #%d\n", pattern, str, line_no); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' #%d\n", pattern, str, line_no); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s' #%d\n", pattern, str, line_no); nfail++; } else { if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: /%s/ '%s' #%d\n", pattern, str, line_no); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d #%d\n", pattern, str, from, to, region->beg[mem], region->end[mem], line_no); nfail++; } } } onig_free(reg); } static void xx2(char* pattern, char* str, int from, int to, int line_no) { xx(pattern, str, from, to, 0, 0, 0, line_no); } static void xx3(char* pattern, char* str, int from, int to, int mem, int line_no) { xx(pattern, str, from, to, mem, 0, 0, line_no); } static void xn(char* pattern, char* str, int line_no) { xx(pattern, str, 0, 0, 0, 1, 0, line_no); } static void xe(char* pattern, char* str, int error_no, int line_no) { xx(pattern, str, 0, 0, 0, 0, error_no, line_no); } #define x2(p,s,f,t) xx2(p,s,f,t, __LINE__) #define x3(p,s,f,t,m) xx3(p,s,f,t,m, __LINE__) #define n(p,s) xn(p,s, __LINE__) #define e(p,s,en) xe(p,s,en, __LINE__) extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_UTF8; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); err_file = stdout; region = onig_region_new(); x2("", "", 0, 0); x2("^", "", 0, 0); x2("^a", "\na", 1, 2); x2("$", "", 0, 0); x2("$\\O", "bb\n", 2, 3); x2("\\G", "", 0, 0); x2("\\A", "", 0, 0); x2("\\Z", "", 0, 0); x2("\\z", "", 0, 0); x2("^$", "", 0, 0); x2("\\ca", "\001", 0, 1); x2("\\C-b", "\002", 0, 1); x2("\\c\\\\", "\034", 0, 1); x2("q[\\c\\\\]", "q\034", 0, 2); x2("", "a", 1, 1); x2("a", "a", 0, 1); x2("\\x61", "a", 0, 1); x2("aa", "aa", 0, 2); x2("aaa", "aaa", 0, 3); x2("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 35); x2("ab", "ab", 0, 2); x2("b", "ab", 1, 2); x2("bc", "abc", 1, 3); x2("(?i:#RET#)", "#INS##RET#", 5, 10); x2("\\17", "\017", 0, 1); x2("\\x1f", "\x1f", 0, 1); x2("a(?#....\\\\JJJJ)b", "ab", 0, 2); x2("(?x) G (o O(?-x)oO) g L", "GoOoOgLe", 0, 7); x2(".", "a", 0, 1); n(".", ""); x2("..", "ab", 0, 2); x2("\\w", "e", 0, 1); n("\\W", "e"); x2("\\s", " ", 0, 1); x2("\\S", "b", 0, 1); x2("\\d", "4", 0, 1); n("\\D", "4"); x2("\\b", "z ", 1, 1); x2("\\b", " z", 2, 2); x2("\\b", " z ", 3, 3); x2("\\B", "zz ", 3, 3); x2("\\B", "z ", 2, 2); x2("\\B", " z", 0, 0); x2("[ab]", "b", 0, 1); n("[ab]", "c"); x2("[a-z]", "t", 0, 1); n("[^a]", "a"); x2("[^a]", "\n", 0, 1); x2("[]]", "]", 0, 1); n("[^]]", "]"); x2("[\\^]+", "0^^1", 2, 3); x2("[b-]", "b", 0, 1); x2("[b-]", "-", 0, 1); x2("[\\w]", "z", 0, 1); n("[\\w]", " "); x2("[\\W]", "b$", 1, 2); x2("[\\d]", "5", 0, 1); n("[\\d]", "e"); x2("[\\D]", "t", 0, 1); n("[\\D]", "3"); x2("[\\s]", " ", 0, 1); n("[\\s]", "a"); x2("[\\S]", "b", 0, 1); n("[\\S]", " "); x2("[\\w\\d]", "2", 0, 1); n("[\\w\\d]", " "); x2("[[:upper:]]", "B", 0, 1); x2("[*[:xdigit:]+]", "+", 0, 1); x2("[*[:xdigit:]+]", "GHIKK-9+*", 8, 9); x2("[*[:xdigit:]+]", "-@^+", 3, 4); n("[[:upper]]", "A"); x2("[[:upper]]", ":", 0, 1); x2("[\\044-\\047]", "\046", 0, 1); x2("[\\x5a-\\x5c]", "\x5b", 0, 1); x2("[\\x6A-\\x6D]", "\x6c", 0, 1); n("[\\x6A-\\x6D]", "\x6E"); n("^[0-9A-F]+ 0+ UNDEF ", "75F 00000000 SECT14A notype () External | _rb_apply"); x2("[\\[]", "[", 0, 1); x2("[\\]]", "]", 0, 1); x2("[&]", "&", 0, 1); x2("[[ab]]", "b", 0, 1); x2("[[ab]c]", "c", 0, 1); n("[[^a]]", "a"); n("[^[a]]", "a"); x2("[[ab]&&bc]", "b", 0, 1); n("[[ab]&&bc]", "a"); n("[[ab]&&bc]", "c"); x2("[a-z&&b-y&&c-x]", "w", 0, 1); n("[^a-z&&b-y&&c-x]", "w"); x2("[[^a&&a]&&a-z]", "b", 0, 1); n("[[^a&&a]&&a-z]", "a"); x2("[[^a-z&&bcdef]&&[^c-g]]", "h", 0, 1); n("[[^a-z&&bcdef]&&[^c-g]]", "c"); x2("[^[^abc]&&[^cde]]", "c", 0, 1); x2("[^[^abc]&&[^cde]]", "e", 0, 1); n("[^[^abc]&&[^cde]]", "f"); x2("[a-&&-a]", "-", 0, 1); n("[a\\-&&\\-a]", "&"); n("\\wabc", " abc"); x2("a\\Wbc", "a bc", 0, 4); x2("a.b.c", "aabbc", 0, 5); x2(".\\wb\\W..c", "abb bcc", 0, 7); x2("\\s\\wzzz", " zzzz", 0, 5); x2("aa.b", "aabb", 0, 4); n(".a", "ab"); x2(".a", "aa", 0, 2); x2("^a", "a", 0, 1); x2("^a$", "a", 0, 1); x2("^\\w$", "a", 0, 1); n("^\\w$", " "); x2("^\\wab$", "zab", 0, 3); x2("^\\wabcdef$", "zabcdef", 0, 7); x2("^\\w...def$", "zabcdef", 0, 7); x2("\\w\\w\\s\\Waaa\\d", "aa aaa4", 0, 8); x2("\\A\\Z", "", 0, 0); x2("\\Axyz", "xyz", 0, 3); x2("xyz\\Z", "xyz", 0, 3); x2("xyz\\z", "xyz", 0, 3); x2("a\\Z", "a", 0, 1); n("\\Gaz", "az"); n("\\Gz", "bza"); x2("az\\G", "az", 0, 2); n("az\\A", "az"); n("a\\Az", "az"); x2("\\^\\$", "^$", 0, 2); x2("^x?y", "xy", 0, 2); x2("^(x?y)", "xy", 0, 2); x2("\\w", "_", 0, 1); n("\\W", "_"); x2("(?=z)z", "z", 0, 1); n("(?=z).", "a"); x2("(?!z)a", "a", 0, 1); n("(?!z)a", "z"); x2("(?i:a)", "a", 0, 1); x2("(?i:a)", "A", 0, 1); x2("(?i:A)", "a", 0, 1); x2("(?i:i)", "I", 0, 1); x2("(?i:I)", "i", 0, 1); x2("(?i:[A-Z])", "i", 0, 1); x2("(?i:[a-z])", "I", 0, 1); n("(?i:A)", "b"); x2("(?i:ss)", "ss", 0, 2); x2("(?i:ss)", "Ss", 0, 2); x2("(?i:ss)", "SS", 0, 2); /* 0xc5,0xbf == 017F: # LATIN SMALL LETTER LONG S */ x2("(?i:ss)", "\xc5\xbfS", 0, 3); x2("(?i:ss)", "s\xc5\xbf", 0, 3); /* 0xc3,0x9f == 00DF: # LATIN SMALL LETTER SHARP S */ x2("(?i:ss)", "\xc3\x9f", 0, 2); /* 0xe1,0xba,0x9e == 1E9E # LATIN CAPITAL LETTER SHARP S */ x2("(?i:ss)", "\xe1\xba\x9e", 0, 3); x2("(?i:xssy)", "xssy", 0, 4); x2("(?i:xssy)", "xSsy", 0, 4); x2("(?i:xssy)", "xSSy", 0, 4); x2("(?i:xssy)", "x\xc5\xbfSy", 0, 5); x2("(?i:xssy)", "xs\xc5\xbfy", 0, 5); x2("(?i:xssy)", "x\xc3\x9fy", 0, 4); x2("(?i:xssy)", "x\xe1\xba\x9ey", 0, 5); x2("(?i:x\xc3\x9fy)", "xssy", 0, 4); x2("(?i:x\xc3\x9fy)", "xSSy", 0, 4); x2("(?i:\xc3\x9f)", "ss", 0, 2); x2("(?i:\xc3\x9f)", "SS", 0, 2); x2("(?i:[\xc3\x9f])", "ss", 0, 2); x2("(?i:[\xc3\x9f])", "SS", 0, 2); x2("(?i)(?a|abd)c", "abdc"); x2("(?>abd|a)c", "abdc", 0, 4); x2("a?|b", "a", 1, 1); x2("a?|b", "b", 1, 1); x2("a?|b", "", 0, 0); x2("a*|b", "aa", 2, 2); x2("a*|b*", "ba", 2, 2); x2("a*|b*", "ab", 2, 2); x2("a+|b*", "", 0, 0); x2("a+|b*", "bbb", 3, 3); x2("a+|b*", "abbb", 4, 4); n("a+|b+", ""); x2("(a|b)?", "b", 1, 1); x2("(a|b)*", "ba", 2, 2); x2("(a|b)+", "bab", 2, 3); x2("(ab|ca)+", "caabbc", 2, 4); x2("(ab|ca)+", "aabca", 3, 5); x2("(ab|ca)+", "abzca", 3, 5); x2("(a|bab)+", "ababa", 4, 5); x2("(a|bab)+", "ba", 1, 2); x2("(a|bab)+", "baaaba", 5, 6); x2("(?:a|b)(?:a|b)", "ab", 0, 2); x2("(?:a*|b*)(?:a*|b*)", "aaabbb", 6, 6); x2("(?:a*|b*)(?:a+|b+)", "aaabbb", 5, 6); x2("(?:a+|b+){2}", "aaabbb", 4, 6); x2("h{0,}", "hhhh", 4, 4); x2("(?:a+|b+){1,2}", "aaabbb", 5, 6); n("ax{2}*a", "0axxxa1"); n("a.{0,2}a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXXa0"); x2("^a{2,}?a$", "aaa", 0, 3); x2("^[a-z]{2,}?$", "aaa", 0, 3); x2("(?:a+|\\Ab*)cc", "cc", 0, 2); n("(?:a+|\\Ab*)cc", "abcc"); x2("(?:^a+|b+)*c", "aabbbabc", 7, 8); x2("(?:^a+|b+)*c", "aabbbbc", 6, 7); x2("a|(?i)c", "C", 0, 1); x2("(?i)c|a", "C", 0, 1); x2("(?i)c|a", "A", 0, 1); x2("a(?i)b|c", "aB", 0, 2); x2("a(?i)b|c", "aC", 0, 2); n("a(?i)b|c", "AC"); n("a(?:(?i)b)|c", "aC"); x2("(?i:c)|a", "C", 0, 1); n("(?i:c)|a", "A"); x2("[abc]?", "abc", 3, 3); x2("[abc]*", "abc", 3, 3); x2("[^abc]*", "abc", 3, 3); n("[^abc]+", "abc"); x2("a?\?", "aaa", 3, 3); x2("ba?\?b", "bab", 0, 3); x2("a*?", "aaa", 3, 3); x2("ba*?", "baa", 0, 1); x2("ba*?b", "baab", 0, 4); x2("a+?", "aaa", 2, 3); x2("ba+?", "baa", 0, 2); x2("ba+?b", "baab", 0, 4); x2("(?:a?)?\?", "a", 1, 1); x2("(?:a?\?)?", "a", 1, 1); x2("(?:a?)+?", "aaa", 3, 3); x2("(?:a+)?\?", "aaa", 3, 3); x2("(?:a+)?\?b", "aaab", 3, 4); x2("(?:ab)?{2}", "", 0, 0); x2("(?:ab)?{2}", "ababa", 5, 5); x2("(?:ab)*{0}", "ababa", 5, 5); x2("(?:ab){3,}", "abababab", 2, 8); n("(?:ab){3,}", "abab"); x2("(?:ab){2,4}", "ababab", 2, 6); x2("(?:ab){2,4}", "ababababab", 6, 10); x2("(?:ab){2,4}?", "ababababab", 6, 10); x2("(?:ab){,}", "ab{,}", 0, 5); x2("(?:abc)+?{2}", "abcabcabc", 3, 9); x2("(?:X*)(?i:xa)", "XXXa", 2, 4); x2("(d+)([^abc]z)", "dddz", 1, 4); x2("([^abc]*)([^abc]z)", "dddz", 2, 4); x2("(\\w+)(\\wz)", "dddz", 1, 4); x3("(a)", "a", 0, 1, 1); x3("(ab)", "ab", 0, 2, 1); x2("((ab))", "ab", 0, 2); x3("((ab))", "ab", 0, 2, 1); x3("((ab))", "ab", 0, 2, 2); x3("((((((((((((((((((((ab))))))))))))))))))))", "ab", 0, 2, 20); x3("(ab)(cd)", "abcd", 0, 2, 1); x3("(ab)(cd)", "abcd", 2, 4, 2); x3("()(a)bc(def)ghijk", "abcdefghijk", 3, 6, 3); x3("(()(a)bc(def)ghijk)", "abcdefghijk", 3, 6, 4); x2("(^a)", "a", 0, 1); x3("(a)|(a)", "ba", 1, 2, 1); x3("(^a)|(a)", "ba", 1, 2, 2); x3("(a?)", "aaa", 3, 3, 1); x3("(a*)", "aaa", 3, 3, 1); x3("(a*)", "", 0, 0, 1); x3("(a+)", "aaaaaaa", 6, 7, 1); x3("(a+|b*)", "bbbaa", 5, 5, 1); x3("(a+|b?)", "bbbaa", 5, 5, 1); x3("(abc)?", "abc", -1, -1, 1); x3("(abc)*", "abc", -1, -1, 1); x3("(abc)+", "abc", 0, 3, 1); x3("(xyz|abc)+", "abc", 0, 3, 1); x3("([xyz][abc]|abc)+", "abc", 0, 3, 1); x3("((?i:abc))", "AbC", 0, 3, 1); x2("(abc)(?i:\\1)", "abcABC", 0, 6); x3("((?m:a.c))", "a\nc", 0, 3, 1); x3("((?=az)a)", "azb", 0, 1, 1); x3("abc|(.abd)", "zabd", 0, 4, 1); x2("(?:abc)|(ABC)", "abc", 0, 3); x3("(?i:(abc))|(zzz)", "ABC", 0, 3, 1); x3("a*(.)", "aaaaz", 4, 5, 1); x3("a*?(.)", "aaaaz", 4, 5, 1); x3("a*?(c)", "aaaac", 4, 5, 1); x3("[bcd]a*(.)", "caaaaz", 5, 6, 1); x3("(\\Abb)cc", "bbcc", 0, 2, 1); n("(\\Abb)cc", "zbbcc"); x3("(^bb)cc", "bbcc", 0, 2, 1); n("(^bb)cc", "zbbcc"); x3("cc(bb$)", "ccbb", 2, 4, 1); n("cc(bb$)", "ccbbb"); n("(\\1)", ""); n("\\1(a)", "aa"); n("(a(b)\\1)\\2+", "ababb"); n("(?:(?:\\1|z)(a))+$", "zaa"); x2("(?:(?:\\1|z)(a))+$", "zaaa", 0, 4); x2("(a)(?=\\1)", "aa", 0, 1); n("(a)$|\\1", "az"); x2("(a)\\1", "aa", 0, 2); n("(a)\\1", "ab"); x2("(a?)\\1", "aa", 2, 2); x2("(a?\?)\\1", "aa", 2, 2); x2("(a*)\\1", "aaaaa", 5, 5); x3("(a*)\\1", "aaaaa", 5, 5, 1); x2("a(b*)\\1", "abbbb", 0, 5); x2("a(b*)\\1", "ab", 0, 1); x2("(a*)(b*)\\1\\2", "aaabbaaabb", 10, 10); x2("(a*)(b*)\\2", "aaabbbb", 7, 7); x2("(((((((a*)b))))))c\\7", "aaabcaaa", 3, 5); x3("(((((((a*)b))))))c\\7", "aaabcaaa", 3, 3, 7); x2("(a)(b)(c)\\2\\1\\3", "abcbac", 0, 6); x2("([a-d])\\1", "cc", 0, 2); x2("(\\w\\d\\s)\\1", "f5 f5 ", 0, 6); n("(\\w\\d\\s)\\1", "f5 f5"); x2("(who|[a-c]{3})\\1", "whowho", 0, 6); x2("...(who|[a-c]{3})\\1", "abcwhowho", 0, 9); x2("(who|[a-c]{3})\\1", "cbccbc", 0, 6); x2("(^a)\\1", "aa", 0, 2); n("(^a)\\1", "baa"); n("(a$)\\1", "aa"); n("(ab\\Z)\\1", "ab"); x2("(a*\\Z)\\1", "a", 1, 1); x2(".(a*\\Z)\\1", "ba", 1, 2); x3("(.(abc)\\2)", "zabcabc", 0, 7, 1); x3("(.(..\\d.)\\2)", "z12341234", 0, 9, 1); x2("((?i:az))\\1", "AzAz", 0, 4); n("((?i:az))\\1", "Azaz"); x2("(?<=a)b", "ab", 1, 2); n("(?<=a)b", "bb"); x2("(?<=a|b)b", "bb", 1, 2); x2("(?<=a|bc)b", "bcb", 2, 3); x2("(?<=a|bc)b", "ab", 1, 2); x2("(?<=a|bc||defghij|klmnopq|r)z", "rz", 1, 2); x3("(?<=(abc))d", "abcd", 0, 3, 1); x2("(?<=(?i:abc))d", "ABCd", 3, 4); x2("(a)\\g<1>", "aa", 0, 2); x2("(?a)", "a", 0, 1); x2("(?ab)\\g", "abab", 0, 4); x2("(?.zv.)\\k", "azvbazvb", 0, 8); x2("(?<=\\g)|-\\zEND (?XyZ)", "XyZ", 3, 3); x2("(?|a\\g)+", "", 0, 0); x2("(?|\\(\\g\\))+$", "()(())", 6, 6); x3("\\g(?.){0}", "X", 0, 1, 1); x2("\\g(abc|df(?.YZ){2,8}){0}", "XYZ", 0, 3); x2("\\A(?(a\\g)|)\\z", "aaaa", 0, 4); x2("(?|\\g\\g)\\z|\\zEND (?a|(b)\\g)", "bbbbabba", 8, 8); x2("(?\\w+\\sx)a+\\k", " fg xaaaaaaaafg x", 2, 18); x3("(z)()()(?<_9>a)\\g<_9>", "zaa", 2, 3, 1); x2("(.)(((?<_>a)))\\k<_>", "zaa", 0, 3); x2("((?\\d)|(?\\w))(\\k|\\k)", "ff", 0, 2); x2("(?:(?)|(?efg))\\k", "", 0, 0); x2("(?:(?abc)|(?efg))\\k", "abcefgefg", 3, 9); n("(?:(?abc)|(?efg))\\k", "abcefg"); x2("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "a-pyumpyum", 2, 10); x3("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "xxxxabcdefghijklmnabcdefghijklmn", 4, 18, 14); x3("(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?aaa)(?)$", "aaa", 0, 3, 16); x2("(?a|\\(\\g\\))", "a", 0, 1); x2("(?a|\\(\\g\\))", "((((((a))))))", 6, 7); x3("(?a|\\(\\g\\))", "((((((((a))))))))", 8, 9, 1); x2("\\g|\\zEND(?.*abc$)", "abcxxxabc", 6, 9); x2("\\g<1>|\\zEND(.a.)", "bac", 0, 3); x3("\\g<_A>\\g<_A>|\\zEND(.a.)(?<_A>.b.)", "xbxyby", 3, 6, 1); x2("\\A(?:\\g|\\g|\\zEND (?a|c\\gc)(?b|d\\gd))$", "cdcbcdc", 0, 7); x2("\\A(?|a\\g)\\z|\\zEND (?\\g)", "aaaa", 0, 4); x2("(?(a|b\\gc){3,5})", "baaaaca", 2, 5); x2("(?(a|b\\gc){3,5})", "baaaacaaaaa", 8, 11); x2("(?\\(([^\\(\\)]++|\\g)*+\\))", "((a))", 1, 4); x2("()*\\1", "", 0, 0); x2("(?:()|())*\\1\\2", "", 0, 0); x2("(?:a*|b*)*c", "abadc", 4, 5); x3("(?:\\1a|())*", "a", 1, 1, 1); x2("x((.)*)*x", "0x1x2x3", 3, 6); x2("x((.)*)*x(?i:\\1)\\Z", "0x1x2x1X2", 1, 9); x2("(?:()|()|()|()|()|())*\\2\\5", "", 0, 0); x2("(?:()|()|()|(x)|()|())*\\2b\\5", "b", 0, 1); x2("[0-9-a]", "-", 0, 1); // PR#44 n("[0-9-a]", ":"); // PR#44 x3("(\\(((?:[^(]|\\g<1>)*)\\))", "(abc)(abc)", 6, 9, 2); // PR#43 x2("\\o{101}", "A", 0, 1); x2("\\A(a|b\\g<1>c)\\k<1+3>\\z", "bbacca", 0, 6); n("\\A(a|b\\g<1>c)\\k<1+3>\\z", "bbaccb"); x2("(?i)\\A(a|b\\g<1>c)\\k<1+2>\\z", "bBACcbac", 0, 8); x2("(?i)(?aa)|(?bb)\\k", "BBbb", 0, 4); x2("(?:\\k'+1'B|(A)C)*", "ACAB", 4, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 4, 5); x3("(A\\g'0')|B", "AAAAB", -1, -1, 1); x2("(a*)(?(1))aa", "aaaaa", 3, 5); x2("(a*)(?(-1))aa", "aaaaa", 3, 5); x2("(?aaa)(?('name'))aa", "aaaaa", 0, 5); x2("(a)(?(1)aa|bb)a", "aaaaa", 1, 5); x2("(?:aa|())(?(<1>)aa|bb)a", "aabba", 0, 5); x2("(?:aa|())(?('1')aa|bb|cc)a", "aacca", 0, 5); x3("(a*)(?(1)aa|a)b", "aaab", 1, 1, 1); n("(a)(?(1)a|b)c", "abc"); x2("(a)(?(1)|)c", "ac", 0, 2); n("(?()aaa|bbb)", "bbb"); x2("(a)(?(1+0)b|c)d", "abd", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "ace", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "bce", 0, 3); x2("\\R", "\r\n", 1, 2); x2("\\R", "\r", 0, 1); x2("\\R", "\n", 0, 1); x2("\\R", "\x0b", 0, 1); n("\\R\\n", "\r\n"); x2("\\R", "\xc2\x85", 0, 2); x2("\\N", "a", 0, 1); n("\\N", "\n"); n("(?m:\\N)", "\n"); n("(?-m:\\N)", "\n"); x2("\\O", "a", 0, 1); x2("\\O", "\n", 0, 1); x2("(?m:\\O)", "\n", 0, 1); x2("(?-m:\\O)", "\n", 0, 1); x2("\\K", "a", 1, 1); x2("a\\K", "a", 1, 1); x2("a\\Kb", "ab", 1, 2); x2("(a\\Kb|ac\\Kd)", "acd", 2, 3); x2("(a\\Kb|\\Kac\\K)*", "acababacab", 10, 10); x2("(?:()|())*\\1", "abc", 3, 3); x2("(?:()|())*\\2", "abc", 3, 3); x2("(?:()|()|())*\\3\\1", "abc", 3, 3); x2("(|(?:a(?:\\g'1')*))b|", "abc", 3, 3); x2("^(\"|)(.*)\\1$", "XX", 0, 2); x2("(abc|def|ghi|jkl|mno|pqr|stu){0,10}?\\z", "admno", 5, 5); x2("(abc|(def|ghi|jkl|mno|pqr){0,7}?){5}\\z", "adpqrpqrpqr", 11, 11); // cover OP_REPEAT_INC_NG_SG x2("(?!abc).*\\z", "abcde", 5, 5); // cover OP_PREC_READ_NOT_END x2("(.{2,})?", "abcde", 5, 5); // up coverage x2("((a|b|c|d|e|f|g|h|i|j|k|l|m|n)+)?", "abcde", 5, 5); // up coverage x2("((a|b|c|d|e|f|g|h|i|j|k|l|m|n){3,})?", "abcde", 5, 5); // up coverage x2("((?:a(?:b|c|d|e|f|g|h|i|j|k|l|m|n))+)?", "abacadae", 8, 8); // up coverage x2("((?:a(?:b|c|d|e|f|g|h|i|j|k|l|m|n))+?)?z", "abacadaez", 8, 9); // up coverage x2("\\A((a|b)\?\?)?z", "bz", 0, 2); // up coverage x2("((?abc){0}a\\gd)+", "aabcd", 0, 5); // up coverage x2("((?(abc)true|false))+", "false", 0, 5); // up coverage x2("((?i:abc)d)+", "abcdABCd", 4, 8); // up coverage x2("((?ab)(?()a|b)", "aba", 0, 3); // up coverage x2("(?<=a.b)c", "azbc", 3, 4); // up coverage n("(?<=(?:abcde){30})z", "abc"); // up coverage x2("(?<=(?(a)a|bb))z", "aaz", 2, 3); // up coverage x2("[a]*\\W", "aa@", 2, 3); // up coverage x2("[a]*[b]", "aab", 2, 3); // up coverage n("a*\\W", "aaa"); // up coverage n("(?W)a*\\W", "aaa"); // up coverage x2("(?<=ab(?<=ab))", "ab", 2, 2); // up coverage x2("(?a)(?b)(\\k)+", "abbaab", 0, 6); // up coverage x2("()(\\1)(\\2)", "abc", 3, 3); // up coverage x2("((?(a)b|c))(\\1)", "abab", 0, 4); // up coverage x2("(?$|b\\g)", "bbb", 3, 3); // up coverage x2("(?(?(a)a|b)|c\\g)", "cccb", 3, 4); // up coverage x2("(a)(?(1)a*|b*)+", "aaaa", 3, 4); // up coverage x2("[[^abc]&&cde]*", "de", 2, 2); // up coverage n("(a){10}{10}", "aa"); // up coverage x2("(?:a?)+", "aa", 2, 2); // up coverage x2("(?:a?)*?", "a", 1, 1); // up coverage x2("(?:a*)*?", "a", 1, 1); // up coverage x2("(?:a+?)*", "a", 1, 1); // up coverage x2("\\h", "5", 0, 1); // up coverage x2("\\H", "z", 0, 1); // up coverage x2("[\\h]", "5", 0, 1); // up coverage x2("[\\H]", "z", 0, 1); // up coverage x2("[\\o{101}]", "A", 0, 1); // up coverage x2("[\\u0041]", "A", 0, 1); // up coverage x2("(?~)", "", 0, 0); x2("(?~)", "A", 1, 1); x2("aaaaa(?~)", "aaaaaaaaaa", 5, 10); x2("(?~(?:|aaa))", "aaa", 3, 3); x2("(?~aaa|)", "aaa", 3, 3); x2("a(?~(?~)).", "abcdefghijklmnopqrstuvwxyz", 0, 26); // !!! x2("/\\*(?~\\*/)\\*/", "/* */ */", 0, 5); x2("(?~\\w+)zzzzz", "zzzzz", 0, 5); x2("(?~\\w*)zzzzz", "zzzzz", 0, 5); x2("(?~A.C|B)", "ABC", 3, 3); x2("(?~XYZ|ABC)a", "ABCa", 3, 4); x2("(?~XYZ|ABC)a", "aABCa", 4, 5); x2("<[^>]*>(?~[<>])]*>", "vvv ", 13, 22); x2("(?~ab)", "ccc\ndab", 7, 7); x2("(?m:(?~ab))", "ccc\ndab", 7, 7); x2("(?-m:(?~ab))", "ccc\ndab", 7, 7); x2("(?~abc)xyz", "xyz012345678901234567890123456789abc", 0, 3); // absent with expr x2("(?~|78|\\d*)", "123456789", 9, 9); x2("(?~|def|(?:abc|de|f){0,100})", "abcdedeabcfdefabc", 17, 17); x2("(?~|ab|.*)", "ccc\nddd", 7, 7); x2("(?~|ab|\\O*)", "ccc\ndab", 7, 7); x2("(?~|ab|\\O{2,10})", "ccc\ndab", 3, 5); x2("(?~|ab|\\O{1,10})", "ab", 1, 2); n("(?~|ab|\\O{2,10})", "ab"); x2("(?~|abc|\\O{1,10})", "abc", 2, 3); x2("(?~|ab|\\O{5,10})|abc", "abc", 0, 3); x2("(?~|ab|\\O{1,10})", "cccccccccccab", 12, 13); x2("(?~|aaa|)", "aaa", 3, 3); x2("(?~||a*)", "aaaaaa", 6, 6); x2("(?~||a*?)", "aaaaaa", 6, 6); x2("(a)(?~|b|\\1)", "aaaaaa", 4, 6); x2("(a)(?~|bb|(?:a\\1)*)", "aaaaaa", 5, 6); x2("(b|c)(?~|abac|(?:a\\1)*)", "abababacabab", 11, 12); n("(?~|c|a*+)a", "aaaaa"); x2("(?~|aaaaa|a*+)", "aaaaa", 5, 5); x2("(?~|aaaaaa|a*+)b", "aaaaaab", 6, 7); x2("(?~|abcd|(?>))", "zzzabcd", 7, 7); x2("(?~|abc|a*?)", "aaaabc", 6, 6); // absent range cutter x2("(?~|abc)a*", "aaaaaabc", 8, 8); x2("(?~|abc)a*z|aaaaaabc", "aaaaaabc", 0, 8); x2("(?~|aaaaaa)a*", "aaaaaa", 6, 6); x2("(?~|abc)aaaa|aaaabc", "aaaabc", 0, 6); x2("(?>(?~|abc))aaaa|aaaabc", "aaaabc", 0, 6); x2("(?~|)a", "a", 0, 1); n("(?~|a)a", "a"); x2("(?~|a)(?~|)a", "a", 0, 1); x2("(?~|a).*(?~|)a", "bbbbbbbbbbbbbbbbbbbba", 20, 21); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaapqrabc", 10, 16); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaaabcpqrabc", 13, 19); n("\\A(?~|abc).*(xyz|pqrabc)(?~|)abc", "aaaaxyzaaaabcpqrabcabc"); x2("", "あ", 3, 3); x2("あ", "あ", 0, 3); n("い", "あ"); x2("うう", "うう", 0, 6); x2("あいう", "あいう", 0, 9); x2("こここここここここここここここここここここここここここここここここここ", "こここここここここここここここここここここここここここここここここここ", 0, 105); x2("あ", "いあ", 3, 6); x2("いう", "あいう", 3, 9); x2("\\xca\\xb8", "\xca\xb8", 0, 2); x2(".", "あ", 0, 3); x2("..", "かき", 0, 6); x2("\\w", "お", 0, 3); n("\\W", "あ"); x2("[\\W]", "う$", 3, 4); x2("\\S", "そ", 0, 3); x2("\\S", "漢", 0, 3); x2("\\b", "気 ", 3, 3); x2("\\b", " ほ", 4, 4); x2("\\B", "せそ ", 7, 7); x2("\\B", "う ", 4, 4); x2("\\B", " い", 0, 0); x2("[たち]", "ち", 0, 3); n("[なに]", "ぬ"); x2("[う-お]", "え", 0, 3); n("[^け]", "け"); x2("[\\w]", "ね", 0, 3); n("[\\d]", "ふ"); x2("[\\D]", "は", 0, 3); n("[\\s]", "く"); x2("[\\S]", "へ", 0, 3); x2("[\\w\\d]", "よ", 0, 3); x2("[\\w\\d]", " よ", 3, 6); n("\\w鬼車", " 鬼車"); x2("鬼\\W車", "鬼 車", 0, 7); x2("あ.い.う", "ああいいう", 0, 15); x2(".\\wう\\W..ぞ", "えうう うぞぞ", 0, 19); x2("\\s\\wこここ", " ここここ", 0, 13); x2("ああ.け", "ああけけ", 0, 12); n(".い", "いえ"); x2(".お", "おお", 0, 6); x2("^あ", "あ", 0, 3); x2("^む$", "む", 0, 3); x2("^\\w$", "に", 0, 3); x2("^\\wかきくけこ$", "zかきくけこ", 0, 16); x2("^\\w...うえお$", "zあいううえお", 0, 19); x2("\\w\\w\\s\\Wおおお\\d", "aお おおお4", 0, 16); x2("\\Aたちつ", "たちつ", 0, 9); x2("むめも\\Z", "むめも", 0, 9); x2("かきく\\z", "かきく", 0, 9); x2("かきく\\Z", "かきく\n", 0, 9); n("\\Gぽぴ", "ぽぴ"); n("\\Gえ", "うえお"); x2("とて\\G", "とて", 0, 6); n("まみ\\A", "まみ"); n("ま\\Aみ", "まみ"); x2("(?=せ)せ", "せ", 0, 3); n("(?=う).", "い"); x2("(?!う)か", "か", 0, 3); n("(?!と)あ", "と"); x2("(?i:あ)", "あ", 0, 3); x2("(?i:ぶべ)", "ぶべ", 0, 6); n("(?i:い)", "う"); x2("(?m:よ.)", "よ\n", 0, 4); x2("(?m:.め)", "ま\nめ", 3, 7); x2("あ?", "", 0, 0); x2("変?", "化", 3, 3); x2("変?", "変", 3, 3); x2("量*", "", 0, 0); x2("量*", "量", 3, 3); x2("子*", "子子子", 9, 9); x2("馬*", "鹿馬馬馬馬", 15, 15); n("山+", ""); x2("河+", "河", 0, 3); x2("時+", "時時時時", 9, 12); x2("え+", "ええううう", 3, 6); x2("う+", "おうううう", 12, 15); x2(".?", "た", 3, 3); x2(".*", "ぱぴぷぺ", 12, 12); x2(".+", "ろ", 0, 3); x2(".+", "いうえか\n", 9, 12); x2("あ|い", "あ", 0, 3); x2("あ|い", "い", 0, 3); x2("あい|いう", "あい", 0, 6); x2("あい|いう", "いう", 0, 6); x2("を(?:かき|きく)", "をかき", 0, 9); x2("を(?:かき|きく)け", "をきくけ", 0, 12); x2("あい|(?:あう|あを)", "あを", 0, 6); x2("あ|い|う", "えう", 3, 6); x2("あ|い|うえ|おかき|く|けこさ|しすせ|そ|たち|つてとなに|ぬね", "しすせ", 0, 9); n("あ|い|うえ|おかき|く|けこさ|しすせ|そ|たち|つてとなに|ぬね", "すせ"); x2("あ|^わ", "ぶあ", 3, 6); x2("あ|^を", "をあ", 3, 6); x2("鬼|\\G車", "け車鬼", 6, 9); x2("鬼|\\G車", "車鬼", 3, 6); x2("鬼|\\A車", "b車鬼", 4, 7); x2("鬼|\\A車", "車", 0, 3); x2("鬼|車\\Z", "車鬼", 3, 6); x2("鬼|車\\Z", "車", 0, 3); x2("鬼|車\\Z", "車\n", 0, 3); x2("鬼|車\\z", "車鬼", 3, 6); x2("鬼|車\\z", "車", 0, 3); x2("\\w|\\s", "お", 0, 3); x2("\\w|%", "%お", 1, 4); x2("\\w|[&$]", "う&", 3, 4); x2("[い-け]", "う", 0, 3); x2("[い-け]|[^か-こ]", "あ", 0, 3); x2("[い-け]|[^か-こ]", "か", 0, 3); x2("[^あ]", "\n", 0, 1); x2("(?:あ|[う-き])|いを", "うを", 0, 3); x2("(?:あ|[う-き])|いを", "いを", 0, 6); x2("あいう|(?=けけ)..ほ", "けけほ", 0, 9); x2("あいう|(?!けけ)..ほ", "あいほ", 0, 9); x2("(?=をあ)..あ|(?=をを)..あ", "ををあ", 0, 9); x2("(?<=あ|いう)い", "いうい", 6, 9); n("(?>あ|あいえ)う", "あいえう"); x2("(?>あいえ|あ)う", "あいえう", 0, 12); x2("あ?|い", "あ", 3, 3); x2("あ?|い", "い", 3, 3); x2("あ?|い", "", 0, 0); x2("あ*|い", "ああ", 6, 6); x2("あ*|い*", "いあ", 6, 6); x2("あ*|い*", "あい", 6, 6); x2("[aあ]*|い*", "aあいいい", 13, 13); x2("あ+|い*", "", 0, 0); x2("あ+|い*", "いいい", 9, 9); x2("あ+|い*", "あいいい", 12, 12); x2("あ+|い*", "aあいいい", 13, 13); n("あ+|い+", ""); x2("(あ|い)?", "い", 3, 3); x2("(あ|い)*", "いあ", 6, 6); x2("(あ|い)+", "いあい", 6, 9); x2("(あい|うあ)+", "うああいうえ", 6, 12); x2("(あい|うえ)+", "うああいうえ", 12, 18); x2("(あい|うあ)+", "ああいうあ", 9, 15); x2("(あい|うあ)+", "あいをうあ", 9, 15); x2("(あい|うあ)+", "$$zzzzあいをうあ", 15, 21); x2("(あ|いあい)+", "あいあいあ", 12, 15); x2("(あ|いあい)+", "いあ", 3, 6); x2("(あ|いあい)+", "いあああいあ", 15, 18); x2("(?:あ|い)(?:あ|い)", "あい", 0, 6); x2("(?:あ*|い*)(?:あ*|い*)", "あああいいい", 18, 18); x2("(?:あ*|い*)(?:あ+|い+)", "あああいいい", 15, 18); x2("(?:あ+|い+){2}", "あああいいい", 12, 18); x2("(?:あ+|い+){1,2}", "あああいいい", 15, 18); x2("(?:あ+|\\Aい*)うう", "うう", 0, 6); n("(?:あ+|\\Aい*)うう", "あいうう"); x2("(?:^あ+|い+)*う", "ああいいいあいう", 21, 24); x2("(?:^あ+|い+)*う", "ああいいいいう", 18, 21); x2("う{0,}", "うううう", 12, 12); x2("あ|(?i)c", "C", 0, 1); x2("(?i)c|あ", "C", 0, 1); x2("(?i:あ)|a", "a", 0, 1); n("(?i:あ)|a", "A"); x2("[あいう]?", "あいう", 9, 9); x2("[あいう]*", "あいう", 9, 9); x2("[^あいう]*", "あいう", 9, 9); n("[^あいう]+", "あいう"); x2("あ?\?", "あああ", 9, 9); x2("いあ?\?い", "いあい", 0, 9); x2("あ*?", "あああ", 9, 9); x2("いあ*?", "いああ", 0, 3); x2("いあ*?い", "いああい", 0, 12); x2("あ+?", "あああ", 6, 9); x2("いあ+?", "いああ", 0, 6); x2("いあ+?い", "いああい", 0, 12); x2("(?:天?)?\?", "天", 3, 3); x2("(?:天?\?)?", "天", 3, 3); x2("(?:夢?)+?", "夢夢夢", 9, 9); x2("(?:風+)?\?", "風風風", 9, 9); x2("(?:雪+)?\?霜", "雪雪雪霜", 9, 12); x2("(?:あい)?{2}", "", 0, 0); x2("(?:鬼車)?{2}", "鬼車鬼車鬼", 15, 15); x2("(?:鬼車)*{0}", "鬼車鬼車鬼", 15, 15); x2("(?:鬼車){3,}", "鬼車鬼車鬼車鬼車", 6, 24); n("(?:鬼車){3,}", "鬼車鬼車"); x2("(?:鬼車){2,4}", "鬼車鬼車鬼車", 6, 18); x2("(?:鬼車){2,4}", "鬼車鬼車鬼車鬼車鬼車", 18, 30); x2("(?:鬼車){2,4}?", "鬼車鬼車鬼車鬼車鬼車", 18, 30); x2("(?:鬼車){,}", "鬼車{,}", 0, 9); x2("(?:かきく)+?{2}", "かきくかきくかきく", 9, 27); x3("(火)", "火", 0, 3, 1); x3("(火水)", "火水", 0, 6, 1); x2("((時間))", "時間", 0, 6); x3("((風水))", "風水", 0, 6, 1); x3("((昨日))", "昨日", 0, 6, 2); x3("((((((((((((((((((((量子))))))))))))))))))))", "量子", 0, 6, 20); x3("(あい)(うえ)", "あいうえ", 0, 6, 1); x3("(あい)(うえ)", "あいうえ", 6, 12, 2); x3("()(あ)いう(えおか)きくけこ", "あいうえおかきくけこ", 9, 18, 3); x3("(()(あ)いう(えおか)きくけこ)", "あいうえおかきくけこ", 9, 18, 4); x3(".*(フォ)ン・マ(ン()シュタ)イン", "フォン・マンシュタイン", 15, 27, 2); x2("(^あ)", "あ", 0, 3); x3("(あ)|(あ)", "いあ", 3, 6, 1); x3("(^あ)|(あ)", "いあ", 3, 6, 2); x3("(あ?)", "あああ", 9, 9, 1); x3("(ま*)", "ままま", 9, 9, 1); x3("(と*)", "", 0, 0, 1); x3("(る+)", "るるるるるるる", 18, 21, 1); x3("(ふ+|へ*)", "ふふふへへ", 15, 15, 1); x3("(あ+|い?)", "いいいああ", 15, 15, 1); x3("(あいう)?", "あいう", -1, -1, 1); x3("(あいう)*", "あいう", -1, -1, 1); x3("(あいう)+", "あいう", 0, 9, 1); x3("(さしす|あいう)+", "あいう", 0, 9, 1); x3("([なにぬ][かきく]|かきく)+", "かきく", 0, 9, 1); x3("((?i:あいう))", "あいう", 0, 9, 1); x3("((?m:あ.う))", "あ\nう", 0, 7, 1); x3("((?=あん)あ)", "あんい", 0, 3, 1); x3("あいう|(.あいえ)", "んあいえ", 0, 12, 1); x3("あ*(.)", "ああああん", 12, 15, 1); x3("あ*?(.)", "ああああん", 12, 15, 1); x3("あ*?(ん)", "ああああん", 12, 15, 1); x3("[いうえ]あ*(.)", "えああああん", 15, 18, 1); x3("(\\Aいい)うう", "いいうう", 0, 6, 1); n("(\\Aいい)うう", "んいいうう"); x3("(^いい)うう", "いいうう", 0, 6, 1); n("(^いい)うう", "んいいうう"); x3("ろろ(るる$)", "ろろるる", 6, 12, 1); n("ろろ(るる$)", "ろろるるる"); x2("(無)\\1", "無無", 0, 6); n("(無)\\1", "無武"); x2("(空?)\\1", "空空", 6, 6); x2("(空?\?)\\1", "空空", 6, 6); x2("(空*)\\1", "空空空空空", 15, 15); x3("(空*)\\1", "空空空空空", 15, 15, 1); x2("あ(い*)\\1", "あいいいい", 0, 15); x2("あ(い*)\\1", "あい", 0, 3); x2("(あ*)(い*)\\1\\2", "あああいいあああいい", 30, 30); x2("(あ*)(い*)\\2", "あああいいいい", 21, 21); x3("(あ*)(い*)\\2", "あああいいいい", 21, 21, 2); x2("(((((((ぽ*)ぺ))))))ぴ\\7", "ぽぽぽぺぴぽぽぽ", 9, 15); x3("(((((((ぽ*)ぺ))))))ぴ\\7", "ぽぽぽぺぴぽぽぽ", 9, 9, 7); x2("(は)(ひ)(ふ)\\2\\1\\3", "はひふひはふ", 0, 18); x2("([き-け])\\1", "くく", 0, 6); x2("(\\w\\d\\s)\\1", "あ5 あ5 ", 0, 10); n("(\\w\\d\\s)\\1", "あ5 あ5"); x2("(誰?|[あ-う]{3})\\1", "誰?誰?", 0, 12); x2("...(誰?|[あ-う]{3})\\1", "あaあ誰?誰?", 0, 19); x2("(誰?|[あ-う]{3})\\1", "ういうういう", 0, 18); x2("(^こ)\\1", "ここ", 0, 6); n("(^む)\\1", "めむむ"); n("(あ$)\\1", "ああ"); n("(あい\\Z)\\1", "あい"); x2("(あ*\\Z)\\1", "あ", 3, 3); x2(".(あ*\\Z)\\1", "いあ", 3, 6); x3("(.(やいゆ)\\2)", "zやいゆやいゆ", 0, 19, 1); x3("(.(..\\d.)\\2)", "あ12341234", 0, 11, 1); x2("((?i:あvず))\\1", "あvずあvず", 0, 14); x2("(?<愚か>変|\\(\\g<愚か>\\))", "((((((変))))))", 6, 9); x2("\\A(?:\\g<阿_1>|\\g<云_2>|\\z終了 (?<阿_1>観|自\\g<云_2>自)(?<云_2>在|菩薩\\g<阿_1>菩薩))$", "菩薩自菩薩自在自菩薩自菩薩", 0, 39); x2("[[ひふ]]", "ふ", 0, 3); x2("[[いおう]か]", "か", 0, 3); n("[[^あ]]", "あ"); n("[^[あ]]", "あ"); x2("[^[^あ]]", "あ", 0, 3); x2("[[かきく]&&きく]", "く", 0, 3); n("[[かきく]&&きく]", "か"); n("[[かきく]&&きく]", "け"); x2("[あ-ん&&い-を&&う-ゑ]", "ゑ", 0, 3); n("[^あ-ん&&い-を&&う-ゑ]", "ゑ"); x2("[[^あ&&あ]&&あ-ん]", "い", 0, 3); n("[[^あ&&あ]&&あ-ん]", "あ"); x2("[[^あ-ん&&いうえお]&&[^う-か]]", "き", 0, 3); n("[[^あ-ん&&いうえお]&&[^う-か]]", "い"); x2("[^[^あいう]&&[^うえお]]", "う", 0, 3); x2("[^[^あいう]&&[^うえお]]", "え", 0, 3); n("[^[^あいう]&&[^うえお]]", "か"); x2("[あ-&&-あ]", "-", 0, 1); x2("[^[^a-zあいう]&&[^bcdefgうえお]q-w]", "え", 0, 3); x2("[^[^a-zあいう]&&[^bcdefgうえお]g-w]", "f", 0, 1); x2("[^[^a-zあいう]&&[^bcdefgうえお]g-w]", "g", 0, 1); n("[^[^a-zあいう]&&[^bcdefgうえお]g-w]", "2"); x2("aバージョンのダウンロード<\\/b>", "aバージョンのダウンロード", 0, 44); x2(".バージョンのダウンロード<\\/b>", "aバージョンのダウンロード", 0, 44); x2("\\n?\\z", "こんにちは", 15, 15); x2("(?m).*", "青赤黄", 9, 9); x2("(?m).*a", "青赤黄a", 9, 10); x2("\\p{Hiragana}", "ぴ", 0, 3); n("\\P{Hiragana}", "ぴ"); x2("\\p{Emoji}", "\xE2\xAD\x90", 0, 3); x2("\\p{^Emoji}", "\xEF\xBC\x93", 0, 3); x2("\\p{Extended_Pictographic}", "\xE2\x9A\xA1", 0, 3); n("\\p{Extended_Pictographic}", "\xE3\x81\x82"); x2("\\p{Word}", "こ", 0, 3); n("\\p{^Word}", "こ"); x2("[\\p{Word}]", "こ", 0, 3); n("[\\p{^Word}]", "こ"); n("[^\\p{Word}]", "こ"); x2("[^\\p{^Word}]", "こ", 0, 3); x2("[^\\p{^Word}&&\\p{ASCII}]", "こ", 0, 3); x2("[^\\p{^Word}&&\\p{ASCII}]", "a", 0, 1); n("[^\\p{^Word}&&\\p{ASCII}]", "#"); x2("[^[\\p{^Word}]&&[\\p{ASCII}]]", "こ", 0, 3); x2("[^[\\p{ASCII}]&&[^\\p{Word}]]", "こ", 0, 3); n("[[\\p{ASCII}]&&[^\\p{Word}]]", "こ"); x2("[^[\\p{^Word}]&&[^\\p{ASCII}]]", "こ", 0, 3); x2("[^\\x{104a}]", "こ", 0, 3); x2("[^\\p{^Word}&&[^\\x{104a}]]", "こ", 0, 3); x2("[^[\\p{^Word}]&&[^\\x{104a}]]", "こ", 0, 3); n("[^\\p{Word}||[^\\x{104a}]]", "こ"); x2("\\p{^Cntrl}", "こ", 0, 3); n("\\p{Cntrl}", "こ"); x2("[\\p{^Cntrl}]", "こ", 0, 3); n("[\\p{Cntrl}]", "こ"); n("[^\\p{^Cntrl}]", "こ"); x2("[^\\p{Cntrl}]", "こ", 0, 3); x2("[^\\p{Cntrl}&&\\p{ASCII}]", "こ", 0, 3); x2("[^\\p{Cntrl}&&\\p{ASCII}]", "a", 0, 1); n("[^\\p{^Cntrl}&&\\p{ASCII}]", "#"); x2("[^[\\p{^Cntrl}]&&[\\p{ASCII}]]", "こ", 0, 3); x2("[^[\\p{ASCII}]&&[^\\p{Cntrl}]]", "こ", 0, 3); n("[[\\p{ASCII}]&&[^\\p{Cntrl}]]", "こ"); n("[^[\\p{^Cntrl}]&&[^\\p{ASCII}]]", "こ"); n("[^\\p{^Cntrl}&&[^\\x{104a}]]", "こ"); n("[^[\\p{^Cntrl}]&&[^\\x{104a}]]", "こ"); n("[^\\p{Cntrl}||[^\\x{104a}]]", "こ"); x2("(?-W:\\p{Word})", "こ", 0, 3); n("(?W:\\p{Word})", "こ"); x2("(?W:\\p{Word})", "k", 0, 1); x2("(?-W:[[:word:]])", "こ", 0, 3); n("(?W:[[:word:]])", "こ"); x2("(?-D:\\p{Digit})", "3", 0, 3); n("(?D:\\p{Digit})", "3"); x2("(?-S:\\p{Space})", "\xc2\x85", 0, 2); n("(?S:\\p{Space})", "\xc2\x85"); x2("(?-P:\\p{Word})", "こ", 0, 3); n("(?P:\\p{Word})", "こ"); x2("(?-W:\\w)", "こ", 0, 3); n("(?W:\\w)", "こ"); x2("(?-W:\\w)", "k", 0, 1); x2("(?W:\\w)", "k", 0, 1); n("(?-W:\\W)", "こ"); x2("(?W:\\W)", "こ", 0, 3); n("(?-W:\\W)", "k"); n("(?W:\\W)", "k"); x2("(?-W:\\b)", "こ", 3, 3); n("(?W:\\b)", "こ"); x2("(?-W:\\b)", "h", 1, 1); x2("(?W:\\b)", "h", 1, 1); n("(?-W:\\B)", "こ"); x2("(?W:\\B)", "こ", 3, 3); n("(?-W:\\B)", "h"); n("(?W:\\B)", "h"); x2("(?-P:\\b)", "こ", 3, 3); n("(?P:\\b)", "こ"); x2("(?-P:\\b)", "h", 1, 1); x2("(?P:\\b)", "h", 1, 1); n("(?-P:\\B)", "こ"); x2("(?P:\\B)", "こ", 3, 3); n("(?-P:\\B)", "h"); n("(?P:\\B)", "h"); x2("\\p{InBasicLatin}", "\x41", 0, 1); //x2("\\p{Grapheme_Cluster_Break_Regional_Indicator}", "\xF0\x9F\x87\xA9", 0, 4); //n("\\p{Grapheme_Cluster_Break_Regional_Indicator}", "\xF0\x9F\x87\xA5"); // extended grapheme cluster // CR + LF n(".\\y\\O", "\x0d\x0a"); x2(".\\Y\\O", "\x0d\x0a", 0, 2); // LATIN SMALL LETTER G, COMBINING DIAERESIS n("^.\\y.$", "\x67\xCC\x88"); x2(".\\Y.", "\x67\xCC\x88", 0, 3); x2("\\y.\\Y.\\y", "\x67\xCC\x88", 0, 3); // HANGUL SYLLABLE GAG x2("\\y.\\y", "\xEA\xB0\x81", 0, 3); // HANGUL CHOSEONG KIYEOK, HANGUL JUNGSEONG A, HANGUL JONGSEONG KIYEOK x2("^.\\Y.\\Y.$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8", 0, 9); n("^.\\y.\\Y.$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8"); // TAMIL LETTER NA, TAMIL VOWEL SIGN I, x2(".\\Y.", "\xE0\xAE\xA8\xE0\xAE\xBF", 0, 6); n(".\\y.", "\xE0\xAE\xA8\xE0\xAE\xBF"); // THAI CHARACTER KO KAI, THAI CHARACTER SARA AM x2(".\\Y.", "\xE0\xB8\x81\xE0\xB8\xB3", 0, 6); n(".\\y.", "\xE0\xB8\x81\xE0\xB8\xB3"); // DEVANAGARI LETTER SSA, DEVANAGARI VOWEL SIGN I x2(".\\Y.", "\xE0\xA4\xB7\xE0\xA4\xBF", 0, 6); n(".\\y.", "\xE0\xA4\xB7\xE0\xA4\xBF"); // {Extended_Pictographic} Extend* ZWJ x {Extended_Pictographic} x2("..\\Y.", "\xE3\x80\xB0\xE2\x80\x8D\xE2\xAD\x95", 0, 9); x2("...\\Y.", "\xE3\x80\xB0\xCC\x82\xE2\x80\x8D\xE2\xAD\x95", 0, 11); n("...\\Y.", "\xE3\x80\xB0\xCD\xB0\xE2\x80\x8D\xE2\xAD\x95"); // CR + LF n("^\\X\\X$", "\x0d\x0a"); x2("^\\X$", "\x0d\x0a", 0, 2); // LATIN SMALL LETTER G, COMBINING DIAERESIS n("^\\X\\X.$", "\x67\xCC\x88"); x2("^\\X$", "\x67\xCC\x88", 0, 3); // HANGUL CHOSEONG KIYEOK, HANGUL JUNGSEONG A, HANGUL JONGSEONG KIYEOK x2("^\\X$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8", 0, 9); n("^\\X\\X\\X$", "\xE1\x84\x80\xE1\x85\xA1\xE1\x86\xA8"); // TAMIL LETTER NA, TAMIL VOWEL SIGN I, x2("^\\X$", "\xE0\xAE\xA8\xE0\xAE\xBF", 0, 6); n("\\X\\X", "\xE0\xAE\xA8\xE0\xAE\xBF"); // THAI CHARACTER KO KAI, THAI CHARACTER SARA AM x2("^\\X$", "\xE0\xB8\x81\xE0\xB8\xB3", 0, 6); n("\\X\\X", "\xE0\xB8\x81\xE0\xB8\xB3"); // DEVANAGARI LETTER SSA, DEVANAGARI VOWEL SIGN I x2("^\\X$", "\xE0\xA4\xB7\xE0\xA4\xBF", 0, 6); n("\\X\\X", "\xE0\xA4\xB7\xE0\xA4\xBF"); n("^\\X.$", "\xE0\xAE\xA8\xE0\xAE\xBF"); // a + COMBINING GRAVE ACCENT (U+0300) x2("h\\Xllo", "ha\xCC\x80llo", 0, 7); // Text Segment: Extended Grapheme Cluster <-> Word Boundary x2("(?y{g})\\yabc\\y", "abc", 0, 3); x2("(?y{g})\\y\\X\\y", "abc", 2, 3); x2("(?y{w})\\yabc\\y", "abc", 0, 3); // WB1, WB2 x2("(?y{w})\\y\\X", "\r\n", 0, 2); // WB3 x2("(?y{w})\\X", "\x0cz", 1, 2); // WB3a x2("(?y{w})\\X", "q\x0c", 1, 2); // WB3b x2("(?y{w})\\y\\X", "\xE2\x80\x8D\xE2\x9D\x87", 0, 6); // WB3c x2("(?y{w})\\y\\X", "\x20\x20", 0, 2); // WB3d x2("(?y{w})\\y\\X", "a\xE2\x80\x8D", 0, 4); // WB4 x2("(?y{w})\\y\\X\\y", "abc", 0, 3); // WB5 x2("(?y{w})\\y\\X\\y", "v\xCE\x87w", 0, 4); // WB6, WB7 x2("(?y{w})\\y\\X\\y", "\xD7\x93\x27", 0, 3); // WB7a x2("(?y{w})\\y\\X\\y", "\xD7\x93\x22\xD7\x93", 0, 5); // WB7b, WB7c x2("(?y{w})\\y\\X", "14 45", 3, 5); // WB8 x2("(?y{w})\\y\\X", "a14", 0, 3); // WB9 x2("(?y{w})\\y\\X", "832e", 0, 4); // WB10 x2("(?y{w})\\y\\X", "8\xEF\xBC\x8C\xDB\xB0", 0, 6); // WB11, WB12 x2("(?y{w})\\y\\X\\y", "ケン", 0, 6); // WB13 x2("(?y{w})\\y\\X\\y", "ケン\xE2\x80\xAFタ", 0, 12); // WB13a, WB13b x2("(?y{w})\\y\\X\\y", "\x21\x23", 1, 2); // WB999 x2("(?y{w})\\y\\X\\y", "山ア", 3, 6); x2("(?y{w})\\y\\X", "3.14", 0, 4); x2("(?y{w})\\y\\X", "3 14", 2, 4); x2("\\x40", "@", 0, 1); x2("\\x1", "\x01", 0, 1); x2("\\x{1}", "\x01", 0, 1); x2("\\x{4E38}", "\xE4\xB8\xB8", 0, 3); x2("\\u4E38", "\xE4\xB8\xB8", 0, 3); x2("\\u0040", "@", 0, 1); x2("c.*\\b", "abc", 2, 3); x2("\\b.*abc.*\\b", "abc", 0, 3); x2("((?()0+)+++(((0\\g<0>)0)|())++++((?(1)(0\\g<0>))++++++0*())++++((?(1)(0\\g<1>)+)++++++++++*())++++((?(1)((0)\\g<0>)+)++())+0++*+++(((0\\g<0>))*())++++((?(1)(0\\g<0>)+)++++++++++*|)++++*+++((?(1)((0)\\g<0>)+)+++++++++())++*|)++++((?()0))|", "abcde", 5, 5); // #139 n("(*FAIL)", "abcdefg"); n("abcd(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)(*FAIL)", "abcdefg"); x2("(?:[ab]|(*MAX{2}).)*", "abcbaaccaaa", 11, 11); x2("(?:(*COUNT[AB]{X})[ab]|(*COUNT[CD]{X})[cd])*(*CMP{AB,<,CD})", "abababcdab", 7, 8); x2("(?(?{....})123|456)", "123", 0, 3); x2("(?(*FAIL)123|456)", "456", 0, 3); x2("\\g'0'++{,0}", "abcdefgh", 8, 8); x2("\\g'0'++{,0}?", "abcdefgh", 8, 8); x2("\\g'0'++{,0}b", "abcdefgh", 1, 2); x2("\\g'0'++{,0}?def", "abcdefgh", 3, 6); x2("a{1,3}?", "aaa", 2, 3); x2("a{3}", "aaa", 0, 3); x2("a{3}?", "aaa", 3, 3); x2("a{3}?", "aa", 2, 2); x2("a{3,3}?", "aaa", 0, 3); n("a{3,3}?", "aa"); x2("a{1,3}+", "aaaaaa", 5, 6); x2("a{3}+", "aaaaaa", 3, 6); x2("a{3,3}+", "aaaaaa", 3, 6); n("a{2,3}?", "a"); n("a{3,2}a", "aaa"); x2("a{3,2}b", "aaab", 1, 4); x2("a{3,2}b", "aaaab", 2, 5); x2("a{3,2}b", "aab", 0, 3); x2("a{3,2}?", "", 0, 0); /* == (?:a{3,2})?*/ x2("a{2,3}+a", "aaa", 0, 3); /* == (?:a{2,3})+*/ x2("[\\x{0}-\\x{7fffffff}]", "a", 0, 1); x2("[\\x{7f}-\\x{7fffffff}]", "\xe5\xae\xb6", 0, 3); x2("[a[cdef]]", "a", 0, 1); n("[a[xyz]-c]", "b"); x2("[a[xyz]-c]", "a", 0, 1); x2("[a[xyz]-c]", "-", 0, 1); x2("[a[xyz]-c]", "c", 0, 1); x2("(a.c|def)(.{4})(?<=\\1)", "abcdabc", 0, 7); x2("(a.c|de)(.{4})(?<=\\1)", "abcdabc", 0, 7); x2("(a.c|def)(.{5})(?<=d\\1e)", "abcdabce", 0, 8); x2("(a.c|.)d(?<=\\k<1>d)", "zzzzzabcdabc", 7, 9); x2("(?<=az*)abc", "azzzzzzzzzzabcdabcabc", 11, 14); x2("(?<=ab|abc|abcd)ef", "abcdef", 4, 6); x2("(?<=ta+|tb+|tc+|td+)zz", "tcccccccccczz", 11, 13); x2("(?<=t.{7}|t.{5}|t.{2}|t.)zz", "tczz", 2, 4); x2("(?<=t.{7}|t.{5}|t.{2})zz", "tczzzz", 3, 5); x2("(?<=t.{7}|t.{5}|t.{3})zz", "tczzazzbzz", 8, 10); n("(?<=t.{7}|t.{5}|t.{3})zz", "tczzazzbczz"); x2("(?<=(ab|abc|abcd))ef", "abcdef", 4, 6); x2("(?<=(ta+|tb+|tc+|td+))zz", "tcccccccccczz", 11, 13); x2("(?<=(t.{7}|t.{5}|t.{2}|t.))zz", "tczz", 2, 4); x2("(?<=(t.{7}|t.{5}|t.{2}))zz", "tczzzz", 3, 5); x2("(?<=(t.{7}|t.{5}|t.{3}))zz", "tczzazzbzz", 8, 10); n("(?<=(t.{7}|t.{5}|t.{3}))zz", "tczzazzbczz"); x2("(.{1,4})(.{1,4})(?<=\\2\\1)", "abaaba", 2, 4); x2("(.{1,4})(.{1,4})(?<=\\2\\1)", "ababab", 2, 6); n("(.{1,4})(.{1,4})(?<=\\2\\1)", "abcdabce"); x2("(.{1,4})(.{1,4})(?<=\\2\\1)", "abcdabceabce", 4, 12); x2("(?<=a)", "a", 1, 1); x2("(?<=a.*\\w)z", "abbbz", 4, 5); n("(?<=a.*\\w)z", "abb z"); x2("(?<=a.*\\W)z", "abb z", 4, 5); x2("(?<=a.*\\b)z", "abb z", 4, 5); x2("(?<=(?>abc))", "abc", 3, 3); x2("(?<=a\\Xz)", "abz", 3, 3); n("(?<=^a*)bc", "zabc"); n("(?<=a*\\b)b", "abc"); x2("(?<=a+.*[efg])z", "abcdfz", 5, 6); x2("(?<=a+.*[efg])z", "abcdfgz", 6, 7); n("(?<=a+.*[efg])z", "bcdfz"); x2("(?<=a*.*[efg])z", "bcdfz", 4, 5); n("(?<=a+.*[efg])z", "abcdz"); x2("(?<=v|t|a+.*[efg])z", "abcdfz", 5, 6); x2("(?<=v|t|^a+.*[efg])z", "abcdfz", 5, 6); x2("(?<=^(?:v|t|a+.*[efg]))z", "abcdfz", 5, 6); x2("(?<=v|^t|a+.*[efg])z", "uabcdfz", 6, 7); n("^..(?<=(a{,2}))\\1z", "aaaaz"); // !!! look-behind is shortest priority x2("^..(?<=(a{,2}))\\1z", "aaz", 0, 3); // shortest priority e("(?<=(?~|zoo)a.*z)", "abcdefz", ONIGERR_INVALID_LOOK_BEHIND_PATTERN); e("(?<=(?~|)a.*z)", "abcdefz", ONIGERR_INVALID_LOOK_BEHIND_PATTERN); e("(a(?~|boo)z){0}(?<=\\g<1>)", "abcdefz", ONIGERR_INVALID_LOOK_BEHIND_PATTERN); x2("(?<=(?<= )| )", "abcde fg", 6, 6); // #173 x2("(?<=D|)(?<=@!nnnnnnnnnIIIIn;{1}D?()|;{1}x)", "(?<=D|)(?<=@!nnnnnnnnnIIIIn;{1}D?()|;{1}x)", 55, 55); // #173 x2("(?<=;()|)\\g<1>", "", 0, 0); // reduced #173 x2("(?<=;()|)\\k<1>", ";", 1, 1); x2("(())\\g<3>{0}(?<=|())", "abc", 3, 3); // #175 x2("(?<=()|)\\1{0}", "abc", 3, 3); e("(?|b))", "aab", 2, 3); x2("((?(a)\\g<1>))", "aab", 3, 3); x2("(b(?(a)|\\g<1>))", "bba", 1, 3); e("(()(?(2)\\g<1>))", "", ONIGERR_NEVER_ENDING_RECURSION); x2("(?(a)(?:b|c))", "ac", 2, 2); n("^(?(a)b|c)", "ac"); x2("(?i)a|b", "B", 0, 1); n("((?i)a|b.)|c", "C"); n("c(?i)a.|b.", "Caz"); x2("c(?i)a|b", "cB", 0, 2); /* == c(?i:a|b) */ x2("c(?i)a.|b.", "cBb", 0, 3); x2("(?i)st", "st", 0, 2); x2("(?i)st", "St", 0, 2); x2("(?i)st", "sT", 0, 2); x2("(?i)st", "\xC5\xBFt", 0, 3); // U+017F x2("(?i)st", "\xEF\xAC\x85", 0, 3); // U+FB05 x2("(?i)st", "\xEF\xAC\x86", 0, 3); // U+FB06 x2("(?i)ast", "Ast", 0, 3); x2("(?i)ast", "ASt", 0, 3); x2("(?i)ast", "AsT", 0, 3); x2("(?i)ast", "A\xC5\xBFt", 0, 4); // U+017F x2("(?i)ast", "A\xEF\xAC\x85", 0, 4); // U+FB05 x2("(?i)ast", "A\xEF\xAC\x86", 0, 4); // U+FB06 x2("(?i)stZ", "stz", 0, 3); x2("(?i)stZ", "Stz", 0, 3); x2("(?i)stZ", "sTz", 0, 3); x2("(?i)stZ", "\xC5\xBFtz", 0, 4); // U+017F x2("(?i)stZ", "\xEF\xAC\x85z", 0, 4); // U+FB05 x2("(?i)stZ", "\xEF\xAC\x86z", 0, 4); // U+FB06 x2("(?i)BstZ", "bstz", 0, 4); x2("(?i)BstZ", "bStz", 0, 4); x2("(?i)BstZ", "bsTz", 0, 4); x2("(?i)BstZ", "b\xC5\xBFtz", 0, 5); // U+017F x2("(?i)BstZ", "b\xEF\xAC\x85z", 0, 5); // U+FB05 x2("(?i)BstZ", "b\xEF\xAC\x86z", 0, 5); // U+FB06 x2("(?i).*st\\z", "tttssss\xC5\xBFt", 7, 10); // U+017F x2("(?i).*st\\z", "tttssss\xEF\xAC\x85", 7, 10); // U+FB05 x2("(?i).*st\\z", "tttssss\xEF\xAC\x86", 7, 10); // U+FB06 x2("(?i).*あstい\\z", "tttssssあ\xC5\xBFtい", 7, 16); // U+017F x2("(?i).*あstい\\z", "tttssssあ\xEF\xAC\x85い", 7, 16); // U+FB05 x2("(?i).*あstい\\z", "tttssssあ\xEF\xAC\x86い", 7, 16); // U+FB06 x2("(?i).*\xC5\xBFt\\z", "tttssssst", 7, 9); // U+017F x2("(?i).*\xEF\xAC\x85\\z", "tttssssあst", 10, 12); // U+FB05 x2("(?i).*\xEF\xAC\x86い\\z", "tttssssstい", 7, 12); // U+FB06 x2("(?i).*\xEF\xAC\x85\\z", "tttssssあ\xEF\xAC\x85", 10, 13); x2("(?i).*ss", "abcdefghijklmnopqrstuvwxyz\xc3\x9f", 26, 28); // U+00DF x2("(?i).*ss.*", "abcdefghijklmnopqrstuvwxyz\xc3\x9fxyz", 26, 31); // U+00DF x2("(?i).*\xc3\x9f", "abcdefghijklmnopqrstuvwxyzss", 26, 28); // U+00DF x2("(?i).*ss.*", "abcdefghijklmnopqrstuvwxyzSSxyz", 26, 31); x2("(?i)ssv", "\xc3\x9fv", 0, 3); // U+00DF x2("(?i)(?<=ss)v", "SSv", 2, 3); x2("(?i)(?<=\xc3\x9f)v", "\xc3\x9fv", 2, 3); //x2("(?i)(?<=\xc3\x9f)v", "ssv", 2, 3); //x2("(?i)(?<=ss)v", "\xc3\x9fv", 2, 3); /* #156 U+01F0 (UTF-8: C7 B0) */ x2("(?i).+Isssǰ", ".+Isssǰ", 1, 8); x2(".+Isssǰ", ".+Isssǰ", 1, 8); x2("(?i)ǰ", "ǰ", 0, 2); x2("(?i)ǰ", "j\xcc\x8c", 0, 3); x2("(?i)j\xcc\x8c", "ǰ", 0, 2); x2("(?i)5ǰ", "5ǰ", 0, 3); x2("(?i)5ǰ", "5j\xcc\x8c", 0, 4); x2("(?i)5j\xcc\x8c", "5ǰ", 0, 3); x2("(?i)ǰv", "ǰV", 0, 3); x2("(?i)ǰv", "j\xcc\x8cV", 0, 4); x2("(?i)j\xcc\x8cv", "ǰV", 0, 3); x2("(?i)[ǰ]", "ǰ", 0, 2); x2("(?i)[ǰ]", "j\xcc\x8c", 0, 3); //x2("(?i)[j]\xcc\x8c", "ǰ", 0, 2); x2("(?i)\ufb00a", "ffa", 0, 3); x2("(?i)ffz", "\xef\xac\x80z", 0, 4); x2("(?i)\u2126", "\xcf\x89", 0, 2); x2("a(?i)\u2126", "a\xcf\x89", 0, 3); x2("(?i)A\u2126", "a\xcf\x89", 0, 3); x2("(?i)A\u2126=", "a\xcf\x89=", 0, 4); x2("(?i:ss)=1234567890", "\xc5\xbf\xc5\xbf=1234567890", 0, 15); n("a(b|)+d", "abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcd"); /* https://www.haijin-boys.com/discussions/5079 */ n(" \xfd", ""); /* https://bugs.php.net/bug.php?id=77370 */ /* can't use \xfc00.. because compiler error: hex escape sequence out of range */ n("()0\\xfc00000\\xfc00000\\xfc00000\xfc", ""); /* https://bugs.php.net/bug.php?id=77371 */ x2("000||0\xfa", "0", 1, 1); e("(?i)000000000000000000000\xf0", "", ONIGERR_INVALID_CODE_POINT_VALUE); /* https://bugs.php.net/bug.php?id=77382 */ n("0000\\\xf5", "0"); /* https://bugs.php.net/bug.php?id=77385 */ n("(?i)FFF00000000000000000\xfd", ""); /* https://bugs.php.net/bug.php?id=77394 */ e("x{55380}{77590}", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); e("(xyz){40000}{99999}(?vv)", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); e("f{90000,90000}{80000,80000}", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); n("f{90000,90000}{80000,80001}", ""); x2("\\p{Common}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ x2("\\p{In_Enclosed_CJK_Letters_and_Months}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ e("\\x{7fffffff}", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{7fffffff}]", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\u040", "@", ONIGERR_INVALID_CODE_POINT_VALUE); e("(?\\g)", "zzzz", ONIGERR_NEVER_ENDING_RECURSION); e("(*FOO)", "abcdefg", ONIGERR_UNDEFINED_CALLOUT_NAME); e("*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("|*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("(?i)*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("(?:*)", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); e("(?m:*)", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); x2("(?:)*", "abc", 3, 3); e("^*", "abc", ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); onig_region_free(region, 1); onig_end(); return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/test_regset.c0000644000175100017510000002356415215513537014616 /* * test_regset.c --- test for regset API * Copyright (c) 2019 K.Kosako */ #include #include #include #include #include "oniguruma.h" static int nsucc = 0; static int nfail = 0; static int nerror = 0; static int make_regset(int line_no, int n, char* pat[], OnigRegSet** rset, int error_no) { int r; int i; OnigRegSet* set; regex_t* reg; OnigErrorInfo einfo; *rset = NULL; r = onig_regset_new(&set, 0, NULL); if (r != 0) return r; for (i = 0; i < n; i++) { r = onig_new(®, (UChar* )pat[i], (UChar* )(pat[i] + strlen(pat[i])), ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, &einfo); if (r != 0) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %d: %s /%s/\n", line_no, s, pat[i]); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): %d: /%s/ %d\n", line_no, pat[i], r); nsucc++; } else { fprintf(stdout, "FAIL(ERROR): %d: /%s/ %d, %d\n", line_no, pat[i], error_no, r); nfail++; } } onig_regset_free(set); return r; } r = onig_regset_add(set, reg); if (r != 0) { onig_regset_free(set); fprintf(stderr, "ERROR: %d: onig_regset_add(): /%s/\n", line_no, pat[i]); nerror++; return r; } } *rset = set; return 0; } static double get_sec(clock_t start, clock_t end) { double t; t = (double )(end - start) / CLOCKS_PER_SEC; return t; } /* use clock(), because clock_gettime() doesn't exist in Windows and old Unix. */ static int time_test(int repeat, int n, char* ps[], char* s, char* end, double* rt_set, double* rt_reg) { int r; int i; int match_pos; OnigRegSet* set; clock_t ts1, ts2; double t_set, t_reg; r = make_regset(0, n, ps, &set, 0); if (r != 0) return r; ts1 = clock(); for (i = 0; i < repeat; i++) { r = onig_regset_search(set, (UChar* )s, (UChar* )end, (UChar* )s, (UChar* )end, ONIG_REGSET_POSITION_LEAD, ONIG_OPTION_NONE, &match_pos); if (r < 0) { fprintf(stderr, "FAIL onig_regset_search(POSITION_LEAD): %d\n", r); onig_regset_free(set); return r; } } ts2 = clock(); t_set = get_sec(ts1, ts2); ts1 = clock(); for (i = 0; i < repeat; i++) { r = onig_regset_search(set, (UChar* )s, (UChar* )end, (UChar* )s, (UChar* )end, ONIG_REGSET_REGEX_LEAD, ONIG_OPTION_NONE, &match_pos); if (r < 0) { fprintf(stderr, "FAIL onig_regset_search(REGEX_LEAD): %d\n", r); onig_regset_free(set); return r; } } ts2 = clock(); t_reg = get_sec(ts1, ts2); onig_regset_free(set); *rt_set = t_set; *rt_reg = t_reg; return 0; } static void fisher_yates_shuffle(int n, char* ps[], char* cps[]) { #define GET_RAND(n) (rand()%(n+1)) #define SWAP(a,b) { char* tmp = a; a = b; b = tmp; } int i; for (i = 0; i < n; i++) cps[i] = ps[i]; for (i = n - 1; i > 0; i--) { int x = GET_RAND(i); SWAP(cps[i], cps[x]); } } static void time_compare(int n, char* ps[], char* s, char* end) { int r; int i; int repeat; double t_set, t_reg; double total_set, total_reg; char** cps; cps = (char** )malloc(sizeof(char*) * n); if (cps == 0) return ; repeat = 100 / n; total_set = total_reg = 0.0; for (i = 0; i < n; i++) { fisher_yates_shuffle(n, ps, cps); r = time_test(repeat, n, cps, s, end, &t_set, &t_reg); if (r != 0) { free(cps); return ; } total_set += t_set; total_reg += t_reg; } free(cps); fprintf(stdout, "POS lead: %6.2lfmsec. REG lead: %6.2lfmsec.\n", total_set * 1000.0, total_reg * 1000.0); } static OnigRegSetLead XX_LEAD = ONIG_REGSET_POSITION_LEAD; static void xx(int line_no, int n, char* ps[], char* s, int from, int to, int mem, int not, int error_no) { int r; int match_pos; int match_index; OnigRegSet* set; char *end; r = make_regset(line_no, n, ps, &set, error_no); if (r != 0) return ; end = s + strlen(s); r = onig_regset_search(set, (UChar* )s, (UChar* )end, (UChar* )s, (UChar* )end, XX_LEAD, ONIG_OPTION_NONE, &match_pos); if (r < 0) { if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): %d\n", line_no); nsucc++; } else { fprintf(stdout, "FAIL: %d\n", line_no); nfail++; } } else { if (error_no == 0) { char buf[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )buf, r); fprintf(stderr, "ERROR: %d: %s\n", line_no, buf); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): %d: %d\n", line_no, r); nsucc++; } else { fprintf(stdout, "FAIL ERROR NO: %d: %d, %d\n", line_no, error_no, r); nfail++; } } } } else { if (not) { fprintf(stdout, "FAIL(N): %d\n", line_no); nfail++; } else { OnigRegion* region; match_index = r; region = onig_regset_get_region(set, match_index); if (region == 0) { fprintf(stderr, "ERROR: %d: can't get region.\n", line_no); nerror++; onig_regset_free(set); return ; } if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: %d\n", line_no); nsucc++; } else { char buf[1000]; int len; len = region->end[mem] - region->beg[mem]; strncpy(buf, s + region->beg[mem], len); buf[len] = '\0'; fprintf(stdout, "FAIL: %d: %d-%d : %d-%d (%s)\n", line_no, from, to, region->beg[mem], region->end[mem], buf); nfail++; } } } onig_regset_free(set); } static void x2(int line_no, int n, char* ps[], char* s, int from, int to) { xx(line_no, n, ps, s, from, to, 0, 0, 0); } static void x3(int line_no, int n, char* ps[], char* s, int from, int to, int mem) { xx(line_no, n, ps, s, from, to, mem, 0, 0); } static void n(int line_no, int n, char* ps[], char* s) { xx(line_no, n, ps, s, 0, 0, 0, 1, 0); } #define ASIZE(a) sizeof(a)/sizeof(a[0]) #define X2(ps,s,from,to) x2(__LINE__,ASIZE(ps),ps,s,from,to) #define X3(ps,s,from,to,mem) x3(__LINE__,ASIZE(ps),ps,s,from,to,mem) #define N(ps,s) n(__LINE__,ASIZE(ps),ps,s) #define NZERO(s) n(__LINE__,0,(char** )0,s) #ifndef _WIN32 /* getdelim() doesn't exist in Windows */ static int get_all_content_of_file(char* path, char** rs, char** rend) { ssize_t len; size_t n; char* line; FILE* fp; fp = fopen(path, "r"); if (fp == 0) return -1; n = 0; line = NULL; len = getdelim(&line, &n, EOF, fp); fclose(fp); if (len < 0) return -2; *rs = line; *rend = line + len; return 0; } #endif #define TEXT_PATH "kofu-utf8.txt" /* --- To get kofu.txt --- $ wget https://www.aozora.gr.jp/cards/000148/files/774_ruby_1640.zip $ unzip 774_ruby_1640.zip $ nkf -Lu -w8 kofu.txt > kofu-utf8.txt (convert encoding to utf-8 with BOM and line terminator to be Unix-form) */ static char* p1[] = { "abc", "(bca)", "(cab)" }; static char* p2[] = { "小説", "9", "夏目漱石", }; static char* p3[] = { "^いる。", "^校正", "^底本", "^ 翌日", }; static char* p4[] = { "《[^》]{5}》", "《[^》]{6}》", "《[^》]{7}》", "《[^》]{8}》", "《[^》]{9}》", "《[^》]{10}》", "《[^》]{11}》", "《[^》]{12}》", "《[^》]{13}》", "《[^》]{14}》", "《[^》]{15}》", "《[^》]{16}》", "《[^》]{17}》", "《[^》]{18}》", "《[^》]{19}》", "《[^》]{20}》", }; static char* p5[] = { "小室圭", "bbbbbb", "ドナルド・トランプ", "筑摩書房", "松原", "aaaaaaaaa", "bbbbbbbbb", "ccccc", "ddddddddddd", "eee", "ffffffffffff", "gggggggggg", "hhhhhhhhhhhhhh", "iiiiiii", }; static char* p6[] = { "^.{1000,}", "松原", "小室圭", "ドナルド・トランプ", "筑摩書房", }; static char* p7[] = { "0+", "1+", "2+", "3+", "4+", "5+", "6+", "7+", "8+", "9+", }; static char* p8[] = {"a", ".*"}; extern int main(int argc, char* argv[]) { #ifndef _WIN32 int file_exist; #endif int r; char *s, *end; OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_UTF8; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); srand(12345); XX_LEAD = ONIG_REGSET_POSITION_LEAD; NZERO(" abab bccab ca"); X2(p1, " abab bccab ca", 8, 11); X3(p1, " abab bccab ca", 8, 11, 1); N(p2, " XXXX AAA 1223 012345678bbb"); X2(p2, "0123456789", 9, 10); X2(p7, "abcde 555 qwert", 6, 9); X2(p8, "", 0, 0); XX_LEAD = ONIG_REGSET_REGEX_LEAD; NZERO(" abab bccab ca"); X2(p1, " abab bccab ca", 8, 11); X3(p1, " abab bccab ca", 8, 11, 1); N(p2, " XXXX AAA 1223 012345678bbb"); X2(p2, "0123456789", 9, 10); X2(p7, "abcde 555 qwert", 6, 9); #ifndef _WIN32 r = get_all_content_of_file(TEXT_PATH, &s, &end); if (r == 0) { fprintf(stdout, "FILE: %s, size: %d\n", TEXT_PATH, (int )(end - s)); file_exist = 1; } else { fprintf(stdout, "Ignore %s\n", TEXT_PATH); file_exist = 0; } if (file_exist != 0) { X2(p2, s, 10, 22); X2(p3, s, 496079, 496088); X2(p4, s, 1294, 1315); } #endif fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); #ifndef _WIN32 if (file_exist != 0) { fprintf(stdout, "\n"); time_compare(ASIZE(p2), p2, s, end); time_compare(ASIZE(p3), p3, s, end); time_compare(ASIZE(p4), p4, s, end); time_compare(ASIZE(p5), p5, s, end); time_compare(ASIZE(p6), p6, s, end); fprintf(stdout, "\n"); free(s); } #endif onig_end(); return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/test_options.c0000644000175100017510000001475515215513537015022 /* * test_options.c * Copyright (c) 2020-2024 K.Kosako */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION #endif #include #include "oniguruma.h" #include #define SLEN(s) strlen(s) static int nsucc = 0; static int nfail = 0; static int nerror = 0; #ifdef __TRUSTINSOFT_ANALYZER__ static int nall = 0; #endif static FILE* err_file; static OnigRegion* region; static void xx(OnigOptionType options, char* pattern, char* str, int from, int to, int mem, int not, int error_no, int line_no) { #ifdef __TRUSTINSOFT_ANALYZER__ if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; #endif int r; regex_t* reg; OnigErrorInfo einfo; r = onig_new(®, (UChar* )pattern, (UChar* )(pattern + SLEN(pattern)), options, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, &einfo); if (r) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(err_file, "ERROR: %s /%s/ #%d\n", s, pattern, line_no); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ %d #%d\n", pattern, r, line_no); nsucc++; } else { fprintf(stdout, "FAIL(ERROR): /%s/ '%s', %d, %d #%d\n", pattern, str, error_no, r, line_no); nfail++; } } return ; } r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, options); if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r); fprintf(err_file, "ERROR: %s /%s/ #%d\n", s, pattern, line_no); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ '%s', %d #%d\n", pattern, str, r, line_no); nsucc++; } else { fprintf(stdout, "FAIL ERROR NO: /%s/ '%s', %d, %d #%d\n", pattern, str, error_no, r, line_no); nfail++; } } return ; } if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s' #%d\n", pattern, str, line_no); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' #%d\n", pattern, str, line_no); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s' #%d\n", pattern, str, line_no); nfail++; } else { if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: /%s/ '%s' #%d\n", pattern, str, line_no); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d #%d\n", pattern, str, from, to, region->beg[mem], region->end[mem], line_no); nfail++; } } } onig_free(reg); } static void xx2(OnigOptionType options, char* pattern, char* str, int from, int to, int line_no) { xx(options, pattern, str, from, to, 0, 0, 0, line_no); } static void xx3(OnigOptionType options, char* pattern, char* str, int from, int to, int mem, int line_no) { xx(options, pattern, str, from, to, mem, 0, 0, line_no); } static void xn(OnigOptionType options, char* pattern, char* str, int line_no) { xx(options, pattern, str, 0, 0, 0, 1, 0, line_no); } #if 0 static void xe(OnigOptionType options, char* pattern, char* str, int error_no, int line_no) { xx(options, pattern, str, 0, 0, 0, 0, error_no, line_no); } #endif #define x2(o,p,s,f,t) xx2(o,p,s,f,t, __LINE__) #define x3(o,p,s,f,t,m) xx3(o,p,s,f,t,m, __LINE__) #define n(o,p,s) xn(o,p,s, __LINE__) #define e(o,p,s,en) xe(o,p,s,en, __LINE__) #define OIA (ONIG_OPTION_IGNORECASE | ONIG_OPTION_IGNORECASE_IS_ASCII) extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_UTF8; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); err_file = stdout; region = onig_region_new(); x2(ONIG_OPTION_IGNORECASE, "a", "A", 0, 1); n(ONIG_OPTION_IGNORECASE_IS_ASCII, "a", "A"); /* KELVIN SIGN */ x2(ONIG_OPTION_IGNORECASE, "\xe2\x84\xaa", "k", 0, 1); x2(ONIG_OPTION_IGNORECASE, "k", "\xe2\x84\xaa", 0, 3); n(OIA, "\xe2\x84\xaa", "k"); n(OIA, "k", "\xe2\x84\xaa"); x2(OIA, "a", "a", 0, 1); x2(OIA, "A", "A", 0, 1); x2(OIA, "a", "A", 0, 1); x2(OIA, "A", "a", 0, 1); x2(OIA, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz", 0, 26); x2(OIA, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 26); x2(OIA, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ABCabcdefghijklmnopqrstuvwxyz", 3, 29); x2(OIA, "abcdefghijklmnopqrstuvwxyz", "abcABCDEFGHIJKLMNOPQRSTUVWXYZ", 3, 29); x3(OIA, "#%(a!;)(b&)", "#%A!;B&", 5, 7, 2); x2(ONIG_OPTION_IGNORECASE, "ss", "\xc3\x9f", 0, 2); x2(ONIG_OPTION_IGNORECASE, "\xc3\x9f", "SS", 0, 2); n(OIA, "ss", "\xc3\x9f"); n(OIA, "\xc3\x9f", "ss"); x2(OIA, "ss", "SS", 0, 2); x2(OIA, "Ss", "sS", 0, 2); n(ONIG_OPTION_NOTBOL, "^ab", "ab"); n(ONIG_OPTION_NOTBOL, "\\Aab", "ab"); n(ONIG_OPTION_NOTEOL, "ab$", "ab"); n(ONIG_OPTION_NOTEOL, "ab\\z", "ab"); n(ONIG_OPTION_NOTEOL, "ab\\Z", "ab"); n(ONIG_OPTION_NOTEOL, "ab\\Z", "ab\n"); n(ONIG_OPTION_NOT_BEGIN_STRING, "\\Aab", "ab"); n(ONIG_OPTION_NOT_END_STRING, "ab\\z", "ab"); n(ONIG_OPTION_NOT_END_STRING, "ab\\Z", "ab"); n(ONIG_OPTION_NOT_END_STRING, "ab\\Z", "ab\n"); x2(ONIG_OPTION_NONE, "a|abc", "abc", 0, 1); x2(ONIG_OPTION_NONE, "(a|abc)\\Z", "abc", 0, 3); x2(ONIG_OPTION_MATCH_WHOLE_STRING, "a|abc", "abc", 0, 3); x2(ONIG_OPTION_MATCH_WHOLE_STRING, "a|abc", "a", 0, 1); x2(ONIG_OPTION_WORD_IS_ASCII, "\\w", "@g", 1, 2); n(ONIG_OPTION_WORD_IS_ASCII, "\\w", "あ"); x2(ONIG_OPTION_NONE, "\\d", "1", 0, 3); n(ONIG_OPTION_DIGIT_IS_ASCII, "\\d", "1"); x2(ONIG_OPTION_SPACE_IS_ASCII, "\\s", " ", 0, 1); x2(ONIG_OPTION_NONE, "\\s", " ", 0, 3); n(ONIG_OPTION_SPACE_IS_ASCII, "\\s", " "); x2(ONIG_OPTION_POSIX_IS_ASCII, "\\w\\d\\s", "c3 ", 0, 3); n(ONIG_OPTION_POSIX_IS_ASCII, "\\w|\\d|\\s", "あ4 "); x2(ONIG_OPTION_EXTEND, " abc \n def", "abcdef", 0, 6); x2(ONIG_OPTION_FIND_LONGEST, "\\w+", "abc defg hij", 4, 8); x2(ONIG_OPTION_FIND_NOT_EMPTY, "\\w*", "@@@ abc defg hij", 4, 7); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); onig_region_free(region, 1); onig_end(); return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/testc.c0000644000175100017510000007427015215513537013410 /* * testc.c * Copyright (c) 2019-2021 K.Kosako */ #include #include #include "oniguruma.h" #define SLEN(s) strlen(s) static int nsucc = 0; static int nfail = 0; static int nerror = 0; #ifdef __TRUSTINSOFT_ANALYZER__ static int nall = 0; #endif static FILE* err_file; static OnigRegion* region; static void xx(char* pattern, char* str, int from, int to, int mem, int not) { #ifdef __TRUSTINSOFT_ANALYZER__ if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; #endif int r; regex_t* reg; OnigErrorInfo einfo; r = onig_new(®, (UChar* )pattern, (UChar* )(pattern + SLEN(pattern)), ONIG_OPTION_DEFAULT, ONIG_ENCODING_EUC_JP, ONIG_SYNTAX_DEFAULT, &einfo); if (r) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(err_file, "ERROR: %s\n", s); nerror++; return ; } r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, ONIG_OPTION_NONE); if (r < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(err_file, "ERROR: %s\n", s); nerror++; return ; } if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s'\n", pattern, str); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s'\n", pattern, str); nfail++; } else { if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", pattern, str, from, to, region->beg[mem], region->end[mem]); nfail++; } } } onig_free(reg); } static void x2(char* pattern, char* str, int from, int to) { xx(pattern, str, from, to, 0, 0); } static void x3(char* pattern, char* str, int from, int to, int mem) { xx(pattern, str, from, to, mem, 0); } static void n(char* pattern, char* str) { xx(pattern, str, 0, 0, 0, 1); } extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_EUC_JP; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); err_file = stdout; region = onig_region_new(); x2("", "", 0, 0); x2("^", "", 0, 0); x2("$", "", 0, 0); x2("\\G", "", 0, 0); x2("\\A", "", 0, 0); x2("\\Z", "", 0, 0); x2("\\z", "", 0, 0); x2("^$", "", 0, 0); x2("\\ca", "\001", 0, 1); x2("\\C-b", "\002", 0, 1); x2("\\c\\\\", "\034", 0, 1); x2("q[\\c\\\\]", "q\034", 0, 2); x2("", "a", 0, 0); x2("a", "a", 0, 1); x2("\\x61", "a", 0, 1); x2("aa", "aa", 0, 2); x2("aaa", "aaa", 0, 3); x2("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 35); x2("ab", "ab", 0, 2); x2("b", "ab", 1, 2); x2("bc", "abc", 1, 3); x2("(?i:#RET#)", "#INS##RET#", 5, 10); x2("\\17", "\017", 0, 1); x2("\\x1f", "\x1f", 0, 1); x2("a(?#....\\\\JJJJ)b", "ab", 0, 2); x2("(?x) G (o O(?-x)oO) g L", "GoOoOgLe", 0, 7); x2(".", "a", 0, 1); n(".", ""); x2("..", "ab", 0, 2); x2("\\w", "e", 0, 1); n("\\W", "e"); x2("\\s", " ", 0, 1); x2("\\S", "b", 0, 1); x2("\\d", "4", 0, 1); n("\\D", "4"); x2("\\b", "z ", 0, 0); x2("\\b", " z", 1, 1); x2("\\B", "zz ", 1, 1); x2("\\B", "z ", 2, 2); x2("\\B", " z", 0, 0); x2("[ab]", "b", 0, 1); n("[ab]", "c"); x2("[a-z]", "t", 0, 1); n("[^a]", "a"); x2("[^a]", "\n", 0, 1); x2("[]]", "]", 0, 1); n("[^]]", "]"); x2("[\\^]+", "0^^1", 1, 3); x2("[b-]", "b", 0, 1); x2("[b-]", "-", 0, 1); x2("[\\w]", "z", 0, 1); n("[\\w]", " "); x2("[\\W]", "b$", 1, 2); x2("[\\d]", "5", 0, 1); n("[\\d]", "e"); x2("[\\D]", "t", 0, 1); n("[\\D]", "3"); x2("[\\s]", " ", 0, 1); n("[\\s]", "a"); x2("[\\S]", "b", 0, 1); n("[\\S]", " "); x2("[\\w\\d]", "2", 0, 1); n("[\\w\\d]", " "); x2("[[:upper:]]", "B", 0, 1); x2("[*[:xdigit:]+]", "+", 0, 1); x2("[*[:xdigit:]+]", "GHIKK-9+*", 6, 7); x2("[*[:xdigit:]+]", "-@^+", 3, 4); n("[[:upper]]", "A"); x2("[[:upper]]", ":", 0, 1); x2("[\\044-\\047]", "\046", 0, 1); x2("[\\x5a-\\x5c]", "\x5b", 0, 1); x2("[\\x6A-\\x6D]", "\x6c", 0, 1); n("[\\x6A-\\x6D]", "\x6E"); n("^[0-9A-F]+ 0+ UNDEF ", "75F 00000000 SECT14A notype () External | _rb_apply"); x2("[\\[]", "[", 0, 1); x2("[\\]]", "]", 0, 1); x2("[&]", "&", 0, 1); x2("[[ab]]", "b", 0, 1); x2("[[ab]c]", "c", 0, 1); n("[[^a]]", "a"); n("[^[a]]", "a"); x2("[[ab]&&bc]", "b", 0, 1); n("[[ab]&&bc]", "a"); n("[[ab]&&bc]", "c"); x2("[a-z&&b-y&&c-x]", "w", 0, 1); n("[^a-z&&b-y&&c-x]", "w"); x2("[[^a&&a]&&a-z]", "b", 0, 1); n("[[^a&&a]&&a-z]", "a"); x2("[[^a-z&&bcdef]&&[^c-g]]", "h", 0, 1); n("[[^a-z&&bcdef]&&[^c-g]]", "c"); x2("[^[^abc]&&[^cde]]", "c", 0, 1); x2("[^[^abc]&&[^cde]]", "e", 0, 1); n("[^[^abc]&&[^cde]]", "f"); x2("[a-&&-a]", "-", 0, 1); n("[a\\-&&\\-a]", "&"); n("\\wabc", " abc"); x2("a\\Wbc", "a bc", 0, 4); x2("a.b.c", "aabbc", 0, 5); x2(".\\wb\\W..c", "abb bcc", 0, 7); x2("\\s\\wzzz", " zzzz", 0, 5); x2("aa.b", "aabb", 0, 4); n(".a", "ab"); x2(".a", "aa", 0, 2); x2("^a", "a", 0, 1); x2("^a$", "a", 0, 1); x2("^\\w$", "a", 0, 1); n("^\\w$", " "); x2("^\\wab$", "zab", 0, 3); x2("^\\wabcdef$", "zabcdef", 0, 7); x2("^\\w...def$", "zabcdef", 0, 7); x2("\\w\\w\\s\\Waaa\\d", "aa aaa4", 0, 8); x2("\\A\\Z", "", 0, 0); x2("\\Axyz", "xyz", 0, 3); x2("xyz\\Z", "xyz", 0, 3); x2("xyz\\z", "xyz", 0, 3); x2("a\\Z", "a", 0, 1); x2("\\Gaz", "az", 0, 2); n("\\Gz", "bza"); n("az\\G", "az"); n("az\\A", "az"); n("a\\Az", "az"); x2("\\^\\$", "^$", 0, 2); x2("^x?y", "xy", 0, 2); x2("^(x?y)", "xy", 0, 2); x2("\\w", "_", 0, 1); n("\\W", "_"); x2("(?=z)z", "z", 0, 1); n("(?=z).", "a"); x2("(?!z)a", "a", 0, 1); n("(?!z)a", "z"); x2("(?i:a)", "a", 0, 1); x2("(?i:a)", "A", 0, 1); x2("(?i:A)", "a", 0, 1); n("(?i:A)", "b"); x2("(?i:[A-Z])", "a", 0, 1); x2("(?i:[f-m])", "H", 0, 1); x2("(?i:[f-m])", "h", 0, 1); n("(?i:[f-m])", "e"); x2("(?i:[A-c])", "D", 0, 1); n("(?i:[^a-z])", "A"); n("(?i:[^a-z])", "a"); x2("(?i:[!-k])", "Z", 0, 1); x2("(?i:[!-k])", "7", 0, 1); x2("(?i:[T-}])", "b", 0, 1); x2("(?i:[T-}])", "{", 0, 1); x2("(?i:\\?a)", "?A", 0, 2); x2("(?i:\\*A)", "*a", 0, 2); n(".", "\n"); x2("(?m:.)", "\n", 0, 1); x2("(?m:a.)", "a\n", 0, 2); x2("(?m:.b)", "a\nb", 1, 3); x2(".*abc", "dddabdd\nddabc", 8, 13); x2("(?m:.*abc)", "dddabddabc", 0, 10); n("(?i)(?-i)a", "A"); n("(?i)(?-i:a)", "A"); x2("a?", "", 0, 0); x2("a?", "b", 0, 0); x2("a?", "a", 0, 1); x2("a*", "", 0, 0); x2("a*", "a", 0, 1); x2("a*", "aaa", 0, 3); x2("a*", "baaaa", 0, 0); n("a+", ""); x2("a+", "a", 0, 1); x2("a+", "aaaa", 0, 4); x2("a+", "aabbb", 0, 2); x2("a+", "baaaa", 1, 5); x2(".?", "", 0, 0); x2(".?", "f", 0, 1); x2(".?", "\n", 0, 0); x2(".*", "", 0, 0); x2(".*", "abcde", 0, 5); x2(".+", "z", 0, 1); x2(".+", "zdswer\n", 0, 6); x2("(.*)a\\1f", "babfbac", 0, 4); x2("(.*)a\\1f", "bacbabf", 3, 7); x2("((.*)a\\2f)", "bacbabf", 3, 7); x2("(.*)a\\1f", "baczzzzzz\nbazz\nzzzzbabf", 19, 23); x2("a|b", "a", 0, 1); x2("a|b", "b", 0, 1); x2("|a", "a", 0, 0); x2("(|a)", "a", 0, 0); x2("ab|bc", "ab", 0, 2); x2("ab|bc", "bc", 0, 2); x2("z(?:ab|bc)", "zbc", 0, 3); x2("a(?:ab|bc)c", "aabc", 0, 4); x2("ab|(?:ac|az)", "az", 0, 2); x2("a|b|c", "dc", 1, 2); x2("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "pqr", 0, 2); n("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "mn"); x2("a|^z", "ba", 1, 2); x2("a|^z", "za", 0, 1); x2("a|\\Gz", "bza", 2, 3); x2("a|\\Gz", "za", 0, 1); x2("a|\\Az", "bza", 2, 3); x2("a|\\Az", "za", 0, 1); x2("a|b\\Z", "ba", 1, 2); x2("a|b\\Z", "b", 0, 1); x2("a|b\\z", "ba", 1, 2); x2("a|b\\z", "b", 0, 1); x2("\\w|\\s", " ", 0, 1); n("\\w|\\w", " "); x2("\\w|%", "%", 0, 1); x2("\\w|[&$]", "&", 0, 1); x2("[b-d]|[^e-z]", "a", 0, 1); x2("(?:a|[c-f])|bz", "dz", 0, 1); x2("(?:a|[c-f])|bz", "bz", 0, 2); x2("abc|(?=zz)..f", "zzf", 0, 3); x2("abc|(?!zz)..f", "abf", 0, 3); x2("(?=za)..a|(?=zz)..a", "zza", 0, 3); n("(?>a|abd)c", "abdc"); x2("(?>abd|a)c", "abdc", 0, 4); x2("a?|b", "a", 0, 1); x2("a?|b", "b", 0, 0); x2("a?|b", "", 0, 0); x2("a*|b", "aa", 0, 2); x2("a*|b*", "ba", 0, 0); x2("a*|b*", "ab", 0, 1); x2("a+|b*", "", 0, 0); x2("a+|b*", "bbb", 0, 3); x2("a+|b*", "abbb", 0, 1); n("a+|b+", ""); x2("(a|b)?", "b", 0, 1); x2("(a|b)*", "ba", 0, 2); x2("(a|b)+", "bab", 0, 3); x2("(ab|ca)+", "caabbc", 0, 4); x2("(ab|ca)+", "aabca", 1, 5); x2("(ab|ca)+", "abzca", 0, 2); x2("(a|bab)+", "ababa", 0, 5); x2("(a|bab)+", "ba", 1, 2); x2("(a|bab)+", "baaaba", 1, 4); x2("(?:a|b)(?:a|b)", "ab", 0, 2); x2("(?:a*|b*)(?:a*|b*)", "aaabbb", 0, 3); x2("(?:a*|b*)(?:a+|b+)", "aaabbb", 0, 6); x2("(?:a+|b+){2}", "aaabbb", 0, 6); x2("h{0,}", "hhhh", 0, 4); x2("(?:a+|b+){1,2}", "aaabbb", 0, 6); n("ax{2}*a", "0axxxa1"); n("a.{0,2}a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXXa0"); x2("^a{2,}?a$", "aaa", 0, 3); x2("^[a-z]{2,}?$", "aaa", 0, 3); x2("(?:a+|\\Ab*)cc", "cc", 0, 2); n("(?:a+|\\Ab*)cc", "abcc"); x2("(?:^a+|b+)*c", "aabbbabc", 6, 8); x2("(?:^a+|b+)*c", "aabbbbc", 0, 7); x2("a|(?i)c", "C", 0, 1); x2("(?i)c|a", "C", 0, 1); x2("(?i)c|a", "A", 0, 1); x2("(?i:c)|a", "C", 0, 1); n("(?i:c)|a", "A"); x2("[abc]?", "abc", 0, 1); x2("[abc]*", "abc", 0, 3); x2("[^abc]*", "abc", 0, 0); n("[^abc]+", "abc"); x2("a?\?", "aaa", 0, 0); x2("ba?\?b", "bab", 0, 3); x2("a*?", "aaa", 0, 0); x2("ba*?", "baa", 0, 1); x2("ba*?b", "baab", 0, 4); x2("a+?", "aaa", 0, 1); x2("ba+?", "baa", 0, 2); x2("ba+?b", "baab", 0, 4); x2("(?:a?)?\?", "a", 0, 0); x2("(?:a?\?)?", "a", 0, 0); x2("(?:a?)+?", "aaa", 0, 1); x2("(?:a+)?\?", "aaa", 0, 0); x2("(?:a+)?\?b", "aaab", 0, 4); x2("(?:ab)?{2}", "", 0, 0); x2("(?:ab)?{2}", "ababa", 0, 4); x2("(?:ab)*{0}", "ababa", 0, 0); x2("(?:ab){3,}", "abababab", 0, 8); n("(?:ab){3,}", "abab"); x2("(?:ab){2,4}", "ababab", 0, 6); x2("(?:ab){2,4}", "ababababab", 0, 8); x2("(?:ab){2,4}?", "ababababab", 0, 4); x2("(?:ab){,}", "ab{,}", 0, 5); x2("(?:abc)+?{2}", "abcabcabc", 0, 6); x2("(?:X*)(?i:xa)", "XXXa", 0, 4); x2("(d+)([^abc]z)", "dddz", 0, 4); x2("([^abc]*)([^abc]z)", "dddz", 0, 4); x2("(\\w+)(\\wz)", "dddz", 0, 4); x3("(a)", "a", 0, 1, 1); x3("(ab)", "ab", 0, 2, 1); x2("((ab))", "ab", 0, 2); x3("((ab))", "ab", 0, 2, 1); x3("((ab))", "ab", 0, 2, 2); x3("((((((((((((((((((((ab))))))))))))))))))))", "ab", 0, 2, 20); x3("(ab)(cd)", "abcd", 0, 2, 1); x3("(ab)(cd)", "abcd", 2, 4, 2); x3("()(a)bc(def)ghijk", "abcdefghijk", 3, 6, 3); x3("(()(a)bc(def)ghijk)", "abcdefghijk", 3, 6, 4); x2("(^a)", "a", 0, 1); x3("(a)|(a)", "ba", 1, 2, 1); x3("(^a)|(a)", "ba", 1, 2, 2); x3("(a?)", "aaa", 0, 1, 1); x3("(a*)", "aaa", 0, 3, 1); x3("(a*)", "", 0, 0, 1); x3("(a+)", "aaaaaaa", 0, 7, 1); x3("(a+|b*)", "bbbaa", 0, 3, 1); x3("(a+|b?)", "bbbaa", 0, 1, 1); x3("(abc)?", "abc", 0, 3, 1); x3("(abc)*", "abc", 0, 3, 1); x3("(abc)+", "abc", 0, 3, 1); x3("(xyz|abc)+", "abc", 0, 3, 1); x3("([xyz][abc]|abc)+", "abc", 0, 3, 1); x3("((?i:abc))", "AbC", 0, 3, 1); x2("(abc)(?i:\\1)", "abcABC", 0, 6); x3("((?m:a.c))", "a\nc", 0, 3, 1); x3("((?=az)a)", "azb", 0, 1, 1); x3("abc|(.abd)", "zabd", 0, 4, 1); x2("(?:abc)|(ABC)", "abc", 0, 3); x3("(?i:(abc))|(zzz)", "ABC", 0, 3, 1); x3("a*(.)", "aaaaz", 4, 5, 1); x3("a*?(.)", "aaaaz", 0, 1, 1); x3("a*?(c)", "aaaac", 4, 5, 1); x3("[bcd]a*(.)", "caaaaz", 5, 6, 1); x3("(\\Abb)cc", "bbcc", 0, 2, 1); n("(\\Abb)cc", "zbbcc"); x3("(^bb)cc", "bbcc", 0, 2, 1); n("(^bb)cc", "zbbcc"); x3("cc(bb$)", "ccbb", 2, 4, 1); n("cc(bb$)", "ccbbb"); n("(\\1)", ""); n("\\1(a)", "aa"); n("(a(b)\\1)\\2+", "ababb"); n("(?:(?:\\1|z)(a))+$", "zaa"); x2("(?:(?:\\1|z)(a))+$", "zaaa", 0, 4); x2("(a)(?=\\1)", "aa", 0, 1); n("(a)$|\\1", "az"); x2("(a)\\1", "aa", 0, 2); n("(a)\\1", "ab"); x2("(a?)\\1", "aa", 0, 2); x2("(a?\?)\\1", "aa", 0, 0); x2("(a*)\\1", "aaaaa", 0, 4); x3("(a*)\\1", "aaaaa", 0, 2, 1); x2("a(b*)\\1", "abbbb", 0, 5); x2("a(b*)\\1", "ab", 0, 1); x2("(a*)(b*)\\1\\2", "aaabbaaabb", 0, 10); x2("(a*)(b*)\\2", "aaabbbb", 0, 7); x2("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 8); x3("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 3, 7); x2("(a)(b)(c)\\2\\1\\3", "abcbac", 0, 6); x2("([a-d])\\1", "cc", 0, 2); x2("(\\w\\d\\s)\\1", "f5 f5 ", 0, 6); n("(\\w\\d\\s)\\1", "f5 f5"); x2("(who|[a-c]{3})\\1", "whowho", 0, 6); x2("...(who|[a-c]{3})\\1", "abcwhowho", 0, 9); x2("(who|[a-c]{3})\\1", "cbccbc", 0, 6); x2("(^a)\\1", "aa", 0, 2); n("(^a)\\1", "baa"); n("(a$)\\1", "aa"); n("(ab\\Z)\\1", "ab"); x2("(a*\\Z)\\1", "a", 1, 1); x2(".(a*\\Z)\\1", "ba", 1, 2); x3("(.(abc)\\2)", "zabcabc", 0, 7, 1); x3("(.(..\\d.)\\2)", "z12341234", 0, 9, 1); x2("((?i:az))\\1", "AzAz", 0, 4); n("((?i:az))\\1", "Azaz"); x2("(?<=a)b", "ab", 1, 2); n("(?<=a)b", "bb"); x2("(?<=a|b)b", "bb", 1, 2); x2("(?<=a|bc)b", "bcb", 2, 3); x2("(?<=a|bc)b", "ab", 1, 2); x2("(?<=a|bc||defghij|klmnopq|r)z", "rz", 1, 2); x2("(a)\\g<1>", "aa", 0, 2); x2("(?a)", "a", 0, 1); x2("(?ab)\\g", "abab", 0, 4); x2("(?.zv.)\\k", "azvbazvb", 0, 8); x2("(?<=\\g)|-\\zEND (?XyZ)", "XyZ", 3, 3); x2("(?|a\\g)+", "", 0, 0); x2("(?|\\(\\g\\))+$", "()(())", 0, 6); x3("\\g(?.){0}", "X", 0, 1, 1); x2("\\g(abc|df(?.YZ){2,8}){0}", "XYZ", 0, 3); x2("\\A(?(a\\g)|)\\z", "aaaa", 0, 4); x2("(?|\\g\\g)\\z|\\zEND (?a|(b)\\g)", "bbbbabba", 0, 8); x2("(?\\w+\\sx)a+\\k", " fg xaaaaaaaafg x", 2, 18); x3("(z)()()(?<_9>a)\\g<_9>", "zaa", 2, 3, 1); x2("(.)(((?<_>a)))\\k<_>", "zaa", 0, 3); x2("((?\\d)|(?\\w))(\\k|\\k)", "ff", 0, 2); x2("(?:(?)|(?efg))\\k", "", 0, 0); x2("(?:(?abc)|(?efg))\\k", "abcefgefg", 3, 9); n("(?:(?abc)|(?efg))\\k", "abcefg"); x2("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "a-pyumpyum", 2, 10); x3("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "xxxxabcdefghijklmnabcdefghijklmn", 4, 18, 14); x3("(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?aaa)(?)$", "aaa", 0, 3, 16); x2("(?a|\\(\\g\\))", "a", 0, 1); x2("(?a|\\(\\g\\))", "((((((a))))))", 0, 13); x3("(?a|\\(\\g\\))", "((((((((a))))))))", 0, 17, 1); x2("\\g|\\zEND(?.*abc$)", "abcxxxabc", 0, 9); x2("\\g<1>|\\zEND(.a.)", "bac", 0, 3); x3("\\g<_A>\\g<_A>|\\zEND(.a.)(?<_A>.b.)", "xbxyby", 3, 6, 1); x2("\\A(?:\\g|\\g|\\zEND (?a|c\\gc)(?b|d\\gd))$", "cdcbcdc", 0, 7); x2("\\A(?|a\\g)\\z|\\zEND (?\\g)", "aaaa", 0, 4); x2("(?(a|b\\gc){3,5})", "baaaaca", 1, 5); x2("(?(a|b\\gc){3,5})", "baaaacaaaaa", 0, 10); x2("(?\\(([^\\(\\)]++|\\g)*+\\))", "((a))", 0, 5); x2("()*\\1", "", 0, 0); x2("(?:()|())*\\1\\2", "", 0, 0); x3("(?:\\1a|())*", "a", 0, 0, 1); x2("x((.)*)*x", "0x1x2x3", 1, 6); x2("x((.)*)*x(?i:\\1)\\Z", "0x1x2x1X2", 1, 9); x2("(?:()|()|()|()|()|())*\\2\\5", "", 0, 0); x2("(?:()|()|()|(x)|()|())*\\2b\\5", "b", 0, 1); x2("\\xED\\xF2", "\xed\xf2", 0, 2); x2("[0-9-a]", "-", 0, 1); // PR#44 n("[0-9-a]", ":"); // PR#44 x3("(\\(((?:[^(]|\\g<1>)*)\\))", "(abc)(abc)", 1, 4, 2); // PR#43 x2("\\o{101}", "A", 0, 1); x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 0, 5); x3("(A\\g'0')|B", "AAAAB", 0, 5, 1); x2("(a*)(?(1))aa", "aaaaa", 0, 5); x2("(a*)(?(-1))aa", "aaaaa", 0, 5); x2("(?aaa)(?('name'))aa", "aaaaa", 0, 5); x2("(a)(?(1)aa|bb)a", "aaaaa", 0, 4); x2("(?:aa|())(?(<1>)aa|bb)a", "aabba", 0, 5); x2("(?:aa|())(?('1')aa|bb|cc)a", "aacca", 0, 5); x3("(a*)(?(1)aa|a)b", "aaab", 0, 1, 1); n("(a)(?(1)a|b)c", "abc"); x2("(a)(?(1)|)c", "ac", 0, 2); n("(?()aaa|bbb)", "bbb"); x2("(a)(?(1+0)b|c)d", "abd", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "ace", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "bce", 0, 3); x2("\\R", "\r\n", 0, 2); x2("\\R", "\r", 0, 1); x2("\\R", "\n", 0, 1); x2("\\R", "\x0b", 0, 1); n("\\R\\n", "\r\n"); n("\\R", "\xc2\x85"); // because euc-jp is not Unicode x2("\\N", "a", 0, 1); n("\\N", "\n"); n("(?m:\\N)", "\n"); n("(?-m:\\N)", "\n"); x2("\\O", "a", 0, 1); x2("\\O", "\n", 0, 1); x2("(?m:\\O)", "\n", 0, 1); x2("(?-m:\\O)", "\n", 0, 1); x2("\\K", "a", 0, 0); x2("a\\K", "a", 1, 1); x2("a\\Kb", "ab", 1, 2); x2("(a\\Kb|ac\\Kd)", "acd", 2, 3); x2("(a\\Kb|\\Kac\\K)*", "acababacab", 9, 10); x2("(?~)", "", 0, 0); x2("(?~)", "A", 0, 0); x2("aaaaa(?~)", "aaaaaaaaaa", 0, 5); x2("(?~(?:|aaa))", "aaa", 0, 0); x2("(?~aaa|)", "aaa", 0, 0); x2("a(?~(?~)).", "abcdefghijklmnopqrstuvwxyz", 0, 26); // !!! x2("/\\*(?~\\*/)\\*/", "/* */ */", 0, 5); x2("(?~\\w+)zzzzz", "zzzzz", 0, 5); x2("(?~\\w*)zzzzz", "zzzzz", 0, 5); x2("(?~A.C|B)", "ABC", 0, 0); x2("(?~XYZ|ABC)a", "ABCa", 1, 4); x2("(?~XYZ|ABC)a", "aABCa", 0, 1); x2("<[^>]*>(?~[<>])]*>", "vvv ", 0, 10); x2("(?~ab)", "ccc\ndab", 0, 5); x2("(?m:(?~ab))", "ccc\ndab", 0, 5); x2("(?-m:(?~ab))", "ccc\ndab", 0, 5); x2("(?~abc)xyz", "xyz012345678901234567890123456789abc", 0, 3); // absent with expr x2("(?~|78|\\d*)", "123456789", 0, 6); x2("(?~|def|(?:abc|de|f){0,100})", "abcdedeabcfdefabc", 0, 11); x2("(?~|ab|.*)", "ccc\nddd", 0, 3); x2("(?~|ab|\\O*)", "ccc\ndab", 0, 5); x2("(?~|ab|\\O{2,10})", "ccc\ndab", 0, 5); x2("(?~|ab|\\O{1,10})", "ab", 1, 2); n("(?~|ab|\\O{2,10})", "ab"); x2("(?~|abc|\\O{1,10})", "abc", 1, 3); x2("(?~|ab|\\O{5,10})|abc", "abc", 0, 3); x2("(?~|ab|\\O{1,10})", "cccccccccccab", 0, 10); x2("(?~|aaa|)", "aaa", 0, 0); x2("(?~||a*)", "aaaaaa", 0, 0); x2("(?~||a*?)", "aaaaaa", 0, 0); x2("(a)(?~|b|\\1)", "aaaaaa", 0, 2); x2("(a)(?~|bb|(?:a\\1)*)", "aaaaaa", 0, 5); x2("(b|c)(?~|abac|(?:a\\1)*)", "abababacabab", 1, 4); n("(?~|c|a*+)a", "aaaaa"); x2("(?~|aaaaa|a*+)", "aaaaa", 0, 0); x2("(?~|aaaaaa|a*+)b", "aaaaaab", 1, 7); x2("(?~|abcd|(?>))", "zzzabcd", 0, 0); x2("(?~|abc|a*?)", "aaaabc", 0, 0); // absent stopper x2("(?~|abc)a*", "aaaaaabc", 0, 5); x2("(?~|abc)a*z|aaaaaabc", "aaaaaabc", 0, 8); x2("(?~|aaaaaa)a*", "aaaaaa", 0, 0); x2("(?~|abc)aaaa|aaaabc", "aaaabc", 0, 6); x2("(?>(?~|abc))aaaa|aaaabc", "aaaabc", 0, 6); x2("(?~|)a", "a", 0, 1); n("(?~|a)a", "a"); x2("(?~|a)(?~|)a", "a", 0, 1); x2("(?~|a).*(?~|)a", "bbbbbbbbbbbbbbbbbbbba", 0, 21); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaapqrabc", 0, 16); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaaabcpqrabc", 11, 19); n("\\A(?~|abc).*(xyz|pqrabc)(?~|)abc", "aaaaxyzaaaabcpqrabcabc"); x2("(?~|a)(?~|)c|ab|a|", "ab", 0, 2); x2("(?~|a)((?~|)c|ab|a|)", "ab", 0, 0); x2("(?~|a)((?>(?~|))c|ab|a|)", "ab", 0, 0); // extended grapheme cluster // CR + LF n(".\\y\\O", "\x0d\x0a"); x2(".\\Y\\O", "\x0d\x0a", 0, 2); n("\\X\\X", "\x0d\x0a"); x2("^\\X$", "\x0d\x0a", 0, 2); x2("^\\X\\X\\X$", "ab\x0d\x0a", 0, 4); x2("", "¤¢", 0, 0); x2("¤¢", "¤¢", 0, 2); n("¤¤", "¤¢"); x2("¤¦¤¦", "¤¦¤¦", 0, 4); x2("¤¢¤¤¤¦", "¤¢¤¤¤¦", 0, 6); x2("¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³", "¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³¤³", 0, 70); x2("¤¢", "¤¤¤¢", 2, 4); x2("¤¤¤¦", "¤¢¤¤¤¦", 2, 6); x2("\\xca\\xb8", "\xca\xb8", 0, 2); x2(".", "¤¢", 0, 2); x2("..", "¤«¤­", 0, 4); x2("\\w", "¤ª", 0, 2); n("\\W", "¤¢"); x2("[\\W]", "¤¦$", 2, 3); x2("\\S", "¤½", 0, 2); x2("\\S", "´Á", 0, 2); x2("\\b", "µ¤ ", 0, 0); x2("\\b", " ¤Û", 1, 1); x2("\\B", "¤»¤½ ", 2, 2); x2("\\B", "¤¦ ", 3, 3); x2("\\B", " ¤¤", 0, 0); x2("[¤¿¤Á]", "¤Á", 0, 2); n("[¤ʤË]", "¤Ì"); x2("[¤¦-¤ª]", "¤¨", 0, 2); n("[^¤±]", "¤±"); x2("[\\w]", "¤Í", 0, 2); n("[\\d]", "¤Õ"); x2("[\\D]", "¤Ï", 0, 2); n("[\\s]", "¤¯"); x2("[\\S]", "¤Ø", 0, 2); x2("[\\w\\d]", "¤è", 0, 2); x2("[\\w\\d]", " ¤è", 3, 5); n("\\wµ´¼Ö", " µ´¼Ö"); x2("µ´\\W¼Ö", "µ´ ¼Ö", 0, 5); x2("¤¢.¤¤.¤¦", "¤¢¤¢¤¤¤¤¤¦", 0, 10); x2(".\\w¤¦\\W..¤¾", "¤¨¤¦¤¦ ¤¦¤¾¤¾", 0, 13); x2("\\s\\w¤³¤³¤³", " ¤³¤³¤³¤³", 0, 9); x2("¤¢¤¢.¤±", "¤¢¤¢¤±¤±", 0, 8); n(".¤¤", "¤¤¤¨"); x2(".¤ª", "¤ª¤ª", 0, 4); x2("^¤¢", "¤¢", 0, 2); x2("^¤à$", "¤à", 0, 2); x2("^\\w$", "¤Ë", 0, 2); x2("^\\w¤«¤­¤¯¤±¤³$", "z¤«¤­¤¯¤±¤³", 0, 11); x2("^\\w...¤¦¤¨¤ª$", "z¤¢¤¤¤¦¤¦¤¨¤ª", 0, 13); x2("\\w\\w\\s\\W¤ª¤ª¤ª\\d", "a¤ª ¤ª¤ª¤ª4", 0, 12); x2("\\A¤¿¤Á¤Ä", "¤¿¤Á¤Ä", 0, 6); x2("¤à¤á¤â\\Z", "¤à¤á¤â", 0, 6); x2("¤«¤­¤¯\\z", "¤«¤­¤¯", 0, 6); x2("¤«¤­¤¯\\Z", "¤«¤­¤¯\n", 0, 6); x2("\\G¤ݤÔ", "¤ݤÔ", 0, 4); n("\\G¤¨", "¤¦¤¨¤ª"); n("¤ȤÆ\\G", "¤ȤÆ"); n("¤ޤß\\A", "¤ޤß"); n("¤Þ\\A¤ß", "¤ޤß"); x2("(?=¤»)¤»", "¤»", 0, 2); n("(?=¤¦).", "¤¤"); x2("(?!¤¦)¤«", "¤«", 0, 2); n("(?!¤È)¤¢", "¤È"); x2("(?i:¤¢)", "¤¢", 0, 2); x2("(?i:¤֤Ù)", "¤֤Ù", 0, 4); n("(?i:¤¤)", "¤¦"); x2("(?m:¤è.)", "¤è\n", 0, 3); x2("(?m:.¤á)", "¤Þ\n¤á", 2, 5); x2("¤¢?", "", 0, 0); x2("ÊÑ?", "²½", 0, 0); x2("ÊÑ?", "ÊÑ", 0, 2); x2("ÎÌ*", "", 0, 0); x2("ÎÌ*", "ÎÌ", 0, 2); x2("»Ò*", "»һһÒ", 0, 6); x2("ÇÏ*", "¼¯ÇÏÇÏÇÏÇÏ", 0, 0); n("»³+", ""); x2("²Ï+", "²Ï", 0, 2); x2("»þ+", "»þ»þ»þ»þ", 0, 8); x2("¤¨+", "¤¨¤¨¤¦¤¦¤¦", 0, 4); x2("¤¦+", "¤ª¤¦¤¦¤¦¤¦", 2, 10); x2(".?", "¤¿", 0, 2); x2(".*", "¤ѤԤפÚ", 0, 8); x2(".+", "¤í", 0, 2); x2(".+", "¤¤¤¦¤¨¤«\n", 0, 8); x2("¤¢|¤¤", "¤¢", 0, 2); x2("¤¢|¤¤", "¤¤", 0, 2); x2("¤¢¤¤|¤¤¤¦", "¤¢¤¤", 0, 4); x2("¤¢¤¤|¤¤¤¦", "¤¤¤¦", 0, 4); x2("¤ò(?:¤«¤­|¤­¤¯)", "¤򤫤­", 0, 6); x2("¤ò(?:¤«¤­|¤­¤¯)¤±", "¤򤭤¯¤±", 0, 8); x2("¤¢¤¤|(?:¤¢¤¦|¤¢¤ò)", "¤¢¤ò", 0, 4); x2("¤¢|¤¤|¤¦", "¤¨¤¦", 2, 4); x2("¤¢|¤¤|¤¦¤¨|¤ª¤«¤­|¤¯|¤±¤³¤µ|¤·¤¹¤»|¤½|¤¿¤Á|¤ĤƤȤʤË|¤̤Í", "¤·¤¹¤»", 0, 6); n("¤¢|¤¤|¤¦¤¨|¤ª¤«¤­|¤¯|¤±¤³¤µ|¤·¤¹¤»|¤½|¤¿¤Á|¤ĤƤȤʤË|¤̤Í", "¤¹¤»"); x2("¤¢|^¤ï", "¤֤¢", 2, 4); x2("¤¢|^¤ò", "¤ò¤¢", 0, 2); x2("µ´|\\G¼Ö", "¤±¼ֵ´", 4, 6); x2("µ´|\\G¼Ö", "¼ֵ´", 0, 2); x2("µ´|\\A¼Ö", "b¼ֵ´", 3, 5); x2("µ´|\\A¼Ö", "¼Ö", 0, 2); x2("µ´|¼Ö\\Z", "¼ֵ´", 2, 4); x2("µ´|¼Ö\\Z", "¼Ö", 0, 2); x2("µ´|¼Ö\\Z", "¼Ö\n", 0, 2); x2("µ´|¼Ö\\z", "¼ֵ´", 2, 4); x2("µ´|¼Ö\\z", "¼Ö", 0, 2); x2("\\w|\\s", "¤ª", 0, 2); x2("\\w|%", "%¤ª", 0, 1); x2("\\w|[&$]", "¤¦&", 0, 2); x2("[¤¤-¤±]", "¤¦", 0, 2); x2("[¤¤-¤±]|[^¤«-¤³]", "¤¢", 0, 2); x2("[¤¤-¤±]|[^¤«-¤³]", "¤«", 0, 2); x2("[^¤¢]", "\n", 0, 1); x2("(?:¤¢|[¤¦-¤­])|¤¤¤ò", "¤¦¤ò", 0, 2); x2("(?:¤¢|[¤¦-¤­])|¤¤¤ò", "¤¤¤ò", 0, 4); x2("¤¢¤¤¤¦|(?=¤±¤±)..¤Û", "¤±¤±¤Û", 0, 6); x2("¤¢¤¤¤¦|(?!¤±¤±)..¤Û", "¤¢¤¤¤Û", 0, 6); x2("(?=¤ò¤¢)..¤¢|(?=¤ò¤ò)..¤¢", "¤ò¤ò¤¢", 0, 6); x2("(?<=¤¢|¤¤¤¦)¤¤", "¤¤¤¦¤¤", 4, 6); n("(?>¤¢|¤¢¤¤¤¨)¤¦", "¤¢¤¤¤¨¤¦"); x2("(?>¤¢¤¤¤¨|¤¢)¤¦", "¤¢¤¤¤¨¤¦", 0, 8); x2("¤¢?|¤¤", "¤¢", 0, 2); x2("¤¢?|¤¤", "¤¤", 0, 0); x2("¤¢?|¤¤", "", 0, 0); x2("¤¢*|¤¤", "¤¢¤¢", 0, 4); x2("¤¢*|¤¤*", "¤¤¤¢", 0, 0); x2("¤¢*|¤¤*", "¤¢¤¤", 0, 2); x2("[a¤¢]*|¤¤*", "a¤¢¤¤¤¤¤¤", 0, 3); x2("¤¢+|¤¤*", "", 0, 0); x2("¤¢+|¤¤*", "¤¤¤¤¤¤", 0, 6); x2("¤¢+|¤¤*", "¤¢¤¤¤¤¤¤", 0, 2); x2("¤¢+|¤¤*", "a¤¢¤¤¤¤¤¤", 0, 0); n("¤¢+|¤¤+", ""); x2("(¤¢|¤¤)?", "¤¤", 0, 2); x2("(¤¢|¤¤)*", "¤¤¤¢", 0, 4); x2("(¤¢|¤¤)+", "¤¤¤¢¤¤", 0, 6); x2("(¤¢¤¤|¤¦¤¢)+", "¤¦¤¢¤¢¤¤¤¦¤¨", 0, 8); x2("(¤¢¤¤|¤¦¤¨)+", "¤¦¤¢¤¢¤¤¤¦¤¨", 4, 12); x2("(¤¢¤¤|¤¦¤¢)+", "¤¢¤¢¤¤¤¦¤¢", 2, 10); x2("(¤¢¤¤|¤¦¤¢)+", "¤¢¤¤¤򤦤¢", 0, 4); x2("(¤¢¤¤|¤¦¤¢)+", "$$zzzz¤¢¤¤¤򤦤¢", 6, 10); x2("(¤¢|¤¤¤¢¤¤)+", "¤¢¤¤¤¢¤¤¤¢", 0, 10); x2("(¤¢|¤¤¤¢¤¤)+", "¤¤¤¢", 2, 4); x2("(¤¢|¤¤¤¢¤¤)+", "¤¤¤¢¤¢¤¢¤¤¤¢", 2, 8); x2("(?:¤¢|¤¤)(?:¤¢|¤¤)", "¤¢¤¤", 0, 4); x2("(?:¤¢*|¤¤*)(?:¤¢*|¤¤*)", "¤¢¤¢¤¢¤¤¤¤¤¤", 0, 6); x2("(?:¤¢*|¤¤*)(?:¤¢+|¤¤+)", "¤¢¤¢¤¢¤¤¤¤¤¤", 0, 12); x2("(?:¤¢+|¤¤+){2}", "¤¢¤¢¤¢¤¤¤¤¤¤", 0, 12); x2("(?:¤¢+|¤¤+){1,2}", "¤¢¤¢¤¢¤¤¤¤¤¤", 0, 12); x2("(?:¤¢+|\\A¤¤*)¤¦¤¦", "¤¦¤¦", 0, 4); n("(?:¤¢+|\\A¤¤*)¤¦¤¦", "¤¢¤¤¤¦¤¦"); x2("(?:^¤¢+|¤¤+)*¤¦", "¤¢¤¢¤¤¤¤¤¤¤¢¤¤¤¦", 12, 16); x2("(?:^¤¢+|¤¤+)*¤¦", "¤¢¤¢¤¤¤¤¤¤¤¤¤¦", 0, 14); x2("¤¦{0,}", "¤¦¤¦¤¦¤¦", 0, 8); x2("¤¢|(?i)c", "C", 0, 1); x2("(?i)c|¤¢", "C", 0, 1); x2("(?i:¤¢)|a", "a", 0, 1); n("(?i:¤¢)|a", "A"); x2("[¤¢¤¤¤¦]?", "¤¢¤¤¤¦", 0, 2); x2("[¤¢¤¤¤¦]*", "¤¢¤¤¤¦", 0, 6); x2("[^¤¢¤¤¤¦]*", "¤¢¤¤¤¦", 0, 0); n("[^¤¢¤¤¤¦]+", "¤¢¤¤¤¦"); x2("¤¢?\?", "¤¢¤¢¤¢", 0, 0); x2("¤¤¤¢?\?¤¤", "¤¤¤¢¤¤", 0, 6); x2("¤¢*?", "¤¢¤¢¤¢", 0, 0); x2("¤¤¤¢*?", "¤¤¤¢¤¢", 0, 2); x2("¤¤¤¢*?¤¤", "¤¤¤¢¤¢¤¤", 0, 8); x2("¤¢+?", "¤¢¤¢¤¢", 0, 2); x2("¤¤¤¢+?", "¤¤¤¢¤¢", 0, 4); x2("¤¤¤¢+?¤¤", "¤¤¤¢¤¢¤¤", 0, 8); x2("(?:ŷ?)?\?", "ŷ", 0, 0); x2("(?:ŷ?\?)?", "ŷ", 0, 0); x2("(?:̴?)+?", "̴̴̴", 0, 2); x2("(?:É÷+)?\?", "É÷É÷É÷", 0, 0); x2("(?:Àã+)?\?Áú", "ÀãÀãÀãÁú", 0, 8); x2("(?:¤¢¤¤)?{2}", "", 0, 0); x2("(?:µ´¼Ö)?{2}", "µ´¼ֵ´¼ֵ´", 0, 8); x2("(?:µ´¼Ö)*{0}", "µ´¼ֵ´¼ֵ´", 0, 0); x2("(?:µ´¼Ö){3,}", "µ´¼ֵ´¼ֵ´¼ֵ´¼Ö", 0, 16); n("(?:µ´¼Ö){3,}", "µ´¼ֵ´¼Ö"); x2("(?:µ´¼Ö){2,4}", "µ´¼ֵ´¼ֵ´¼Ö", 0, 12); x2("(?:µ´¼Ö){2,4}", "µ´¼ֵ´¼ֵ´¼ֵ´¼ֵ´¼Ö", 0, 16); x2("(?:µ´¼Ö){2,4}?", "µ´¼ֵ´¼ֵ´¼ֵ´¼ֵ´¼Ö", 0, 8); x2("(?:µ´¼Ö){,}", "µ´¼Ö{,}", 0, 7); x2("(?:¤«¤­¤¯)+?{2}", "¤«¤­¤¯¤«¤­¤¯¤«¤­¤¯", 0, 12); x3("(²Ð)", "²Ð", 0, 2, 1); x3("(²пå)", "²пå", 0, 4, 1); x2("((»þ´Ö))", "»þ´Ö", 0, 4); x3("((É÷¿å))", "É÷¿å", 0, 4, 1); x3("((ºòÆü))", "ºòÆü", 0, 4, 2); x3("((((((((((((((((((((Î̻Ò))))))))))))))))))))", "Î̻Ò", 0, 4, 20); x3("(¤¢¤¤)(¤¦¤¨)", "¤¢¤¤¤¦¤¨", 0, 4, 1); x3("(¤¢¤¤)(¤¦¤¨)", "¤¢¤¤¤¦¤¨", 4, 8, 2); x3("()(¤¢)¤¤¤¦(¤¨¤ª¤«)¤­¤¯¤±¤³", "¤¢¤¤¤¦¤¨¤ª¤«¤­¤¯¤±¤³", 6, 12, 3); x3("(()(¤¢)¤¤¤¦(¤¨¤ª¤«)¤­¤¯¤±¤³)", "¤¢¤¤¤¦¤¨¤ª¤«¤­¤¯¤±¤³", 6, 12, 4); x3(".*(¥ե©)¥󡦥Þ(¥ó()¥·¥奿)¥¤¥ó", "¥ե©¥󡦥ޥ󥷥奿¥¤¥ó", 10, 18, 2); x2("(^¤¢)", "¤¢", 0, 2); x3("(¤¢)|(¤¢)", "¤¤¤¢", 2, 4, 1); x3("(^¤¢)|(¤¢)", "¤¤¤¢", 2, 4, 2); x3("(¤¢?)", "¤¢¤¢¤¢", 0, 2, 1); x3("(¤Þ*)", "¤ޤޤÞ", 0, 6, 1); x3("(¤È*)", "", 0, 0, 1); x3("(¤ë+)", "¤ë¤ë¤ë¤ë¤ë¤ë¤ë", 0, 14, 1); x3("(¤Õ+|¤Ø*)", "¤դդդؤØ", 0, 6, 1); x3("(¤¢+|¤¤?)", "¤¤¤¤¤¤¤¢¤¢", 0, 2, 1); x3("(¤¢¤¤¤¦)?", "¤¢¤¤¤¦", 0, 6, 1); x3("(¤¢¤¤¤¦)*", "¤¢¤¤¤¦", 0, 6, 1); x3("(¤¢¤¤¤¦)+", "¤¢¤¤¤¦", 0, 6, 1); x3("(¤µ¤·¤¹|¤¢¤¤¤¦)+", "¤¢¤¤¤¦", 0, 6, 1); x3("([¤ʤˤÌ][¤«¤­¤¯]|¤«¤­¤¯)+", "¤«¤­¤¯", 0, 6, 1); x3("((?i:¤¢¤¤¤¦))", "¤¢¤¤¤¦", 0, 6, 1); x3("((?m:¤¢.¤¦))", "¤¢\n¤¦", 0, 5, 1); x3("((?=¤¢¤ó)¤¢)", "¤¢¤ó¤¤", 0, 2, 1); x3("¤¢¤¤¤¦|(.¤¢¤¤¤¨)", "¤󤢤¤¤¨", 0, 8, 1); x3("¤¢*(.)", "¤¢¤¢¤¢¤¢¤ó", 8, 10, 1); x3("¤¢*?(.)", "¤¢¤¢¤¢¤¢¤ó", 0, 2, 1); x3("¤¢*?(¤ó)", "¤¢¤¢¤¢¤¢¤ó", 8, 10, 1); x3("[¤¤¤¦¤¨]¤¢*(.)", "¤¨¤¢¤¢¤¢¤¢¤ó", 10, 12, 1); x3("(\\A¤¤¤¤)¤¦¤¦", "¤¤¤¤¤¦¤¦", 0, 4, 1); n("(\\A¤¤¤¤)¤¦¤¦", "¤󤤤¤¤¦¤¦"); x3("(^¤¤¤¤)¤¦¤¦", "¤¤¤¤¤¦¤¦", 0, 4, 1); n("(^¤¤¤¤)¤¦¤¦", "¤󤤤¤¤¦¤¦"); x3("¤í¤í(¤ë¤ë$)", "¤í¤í¤ë¤ë", 4, 8, 1); n("¤í¤í(¤ë¤ë$)", "¤í¤í¤ë¤ë¤ë"); x2("(̵)\\1", "̵̵", 0, 4); n("(̵)\\1", "̵Éð"); x2("(¶õ?)\\1", "¶õ¶õ", 0, 4); x2("(¶õ?\?)\\1", "¶õ¶õ", 0, 0); x2("(¶õ*)\\1", "¶õ¶õ¶õ¶õ¶õ", 0, 8); x3("(¶õ*)\\1", "¶õ¶õ¶õ¶õ¶õ", 0, 4, 1); x2("¤¢(¤¤*)\\1", "¤¢¤¤¤¤¤¤¤¤", 0, 10); x2("¤¢(¤¤*)\\1", "¤¢¤¤", 0, 2); x2("(¤¢*)(¤¤*)\\1\\2", "¤¢¤¢¤¢¤¤¤¤¤¢¤¢¤¢¤¤¤¤", 0, 20); x2("(¤¢*)(¤¤*)\\2", "¤¢¤¢¤¢¤¤¤¤¤¤¤¤", 0, 14); x3("(¤¢*)(¤¤*)\\2", "¤¢¤¢¤¢¤¤¤¤¤¤¤¤", 6, 10, 2); x2("(((((((¤Ý*)¤Ú))))))¤Ô\\7", "¤ݤݤݤڤԤݤݤÝ", 0, 16); x3("(((((((¤Ý*)¤Ú))))))¤Ô\\7", "¤ݤݤݤڤԤݤݤÝ", 0, 6, 7); x2("(¤Ï)(¤Ò)(¤Õ)\\2\\1\\3", "¤ϤҤդҤϤÕ", 0, 12); x2("([¤­-¤±])\\1", "¤¯¤¯", 0, 4); x2("(\\w\\d\\s)\\1", "¤¢5 ¤¢5 ", 0, 8); n("(\\w\\d\\s)\\1", "¤¢5 ¤¢5"); x2("(ï¡©|[¤¢-¤¦]{3})\\1", "ï¡©ï¡©", 0, 8); x2("...(ï¡©|[¤¢-¤¦]{3})\\1", "¤¢a¤¢ï¡©ï¡©", 0, 13); x2("(ï¡©|[¤¢-¤¦]{3})\\1", "¤¦¤¤¤¦¤¦¤¤¤¦", 0, 12); x2("(^¤³)\\1", "¤³¤³", 0, 4); n("(^¤à)\\1", "¤á¤à¤à"); n("(¤¢$)\\1", "¤¢¤¢"); n("(¤¢¤¤\\Z)\\1", "¤¢¤¤"); x2("(¤¢*\\Z)\\1", "¤¢", 2, 2); x2(".(¤¢*\\Z)\\1", "¤¤¤¢", 2, 4); x3("(.(¤䤤¤æ)\\2)", "z¤䤤¤æ¤䤤¤æ", 0, 13, 1); x3("(.(..\\d.)\\2)", "¤¢12341234", 0, 10, 1); x2("((?i:¤¢v¤º))\\1", "¤¢v¤º¤¢v¤º", 0, 10); x2("(?<¶ò¤«>ÊÑ|\\(\\g<¶ò¤«>\\))", "((((((ÊÑ))))))", 0, 14); x2("\\A(?:\\g<°¤_1>|\\g<±¾_2>|\\z½ªλ (?<°¤_1>´Ñ|¼«\\g<±¾_2>¼«)(?<±¾_2>ºß|Ê\\g<°¤_1>Ê))$", "Ê¼«Ê¼«º߼«Ê¼«Ê", 0, 26); x2("[[¤ҤÕ]]", "¤Õ", 0, 2); x2("[[¤¤¤ª¤¦]¤«]", "¤«", 0, 2); n("[[^¤¢]]", "¤¢"); n("[^[¤¢]]", "¤¢"); x2("[^[^¤¢]]", "¤¢", 0, 2); x2("[[¤«¤­¤¯]&&¤­¤¯]", "¤¯", 0, 2); n("[[¤«¤­¤¯]&&¤­¤¯]", "¤«"); n("[[¤«¤­¤¯]&&¤­¤¯]", "¤±"); x2("[¤¢-¤ó&&¤¤-¤ò&&¤¦-¤ñ]", "¤ñ", 0, 2); n("[^¤¢-¤ó&&¤¤-¤ò&&¤¦-¤ñ]", "¤ñ"); x2("[[^¤¢&&¤¢]&&¤¢-¤ó]", "¤¤", 0, 2); n("[[^¤¢&&¤¢]&&¤¢-¤ó]", "¤¢"); x2("[[^¤¢-¤ó&&¤¤¤¦¤¨¤ª]&&[^¤¦-¤«]]", "¤­", 0, 2); n("[[^¤¢-¤ó&&¤¤¤¦¤¨¤ª]&&[^¤¦-¤«]]", "¤¤"); x2("[^[^¤¢¤¤¤¦]&&[^¤¦¤¨¤ª]]", "¤¦", 0, 2); x2("[^[^¤¢¤¤¤¦]&&[^¤¦¤¨¤ª]]", "¤¨", 0, 2); n("[^[^¤¢¤¤¤¦]&&[^¤¦¤¨¤ª]]", "¤«"); x2("[¤¢-&&-¤¢]", "-", 0, 1); x2("[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]q-w]", "¤¨", 0, 2); x2("[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]g-w]", "f", 0, 1); x2("[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]g-w]", "g", 0, 1); n("[^[^a-z¤¢¤¤¤¦]&&[^bcdefg¤¦¤¨¤ª]g-w]", "2"); x2("a¥С¼¥¸¥ç¥ó¤ΥÀ¥¦¥ó¥í¡¼¥É<\\/b>", "a¥С¼¥¸¥ç¥ó¤ΥÀ¥¦¥ó¥í¡¼¥É", 0, 32); x2(".¥С¼¥¸¥ç¥ó¤ΥÀ¥¦¥ó¥í¡¼¥É<\\/b>", "a¥С¼¥¸¥ç¥ó¤ΥÀ¥¦¥ó¥í¡¼¥É", 0, 32); x2("\\n?\\z", "¤³¤ó¤ˤÁ¤Ï", 10, 10); x2("\\p{Hiragana}", "¤Ô", 0, 2); n("\\P{Hiragana}", "¤Ô"); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); onig_region_free(region, 1); onig_end(); return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/Makefile.am0000644000175100017510000000400115215513537014137 ## Makefile.am for Oniguruma lib_onig = ../src/libonig.la AM_LDFLAGS = -L$(libdir) AM_CFLAGS = -Wall -Wno-invalid-source-encoding AM_CPPFLAGS = -I$(top_srcdir)/src if ENABLE_POSIX_API TESTS = test_utf8 test_syntax test_options testc testp testcu test_regset test_back else TESTS = test_utf8 test_syntax test_options testc testcu test_regset test_back endif check_PROGRAMS = $(TESTS) test: test_uchar test_regex_t $(TESTS) @echo "[Oniguruma API, UTF-8 check]" @./test_utf8 | grep RESULT @echo "[Oniguruma API, SYNTAX check]" @./test_syntax | grep RESULT @echo "[Oniguruma API, Options check]" @./test_options | grep RESULT @echo "[Oniguruma API, EUC-JP check]" @./testc | grep RESULT if ENABLE_POSIX_API @echo "[POSIX API, UTF-8 check]" @./testp | grep RESULT endif @echo "[Oniguruma API, UTF-16 check]" @./testcu | grep RESULT @echo "" @echo "[Oniguruma API, regset check]" @./test_regset @echo "[Oniguruma API, backward search check]" @./test_back | grep RESULT test_uchar: @echo "[UChar in oniguruma.h check]" @grep "\(^\|[^g]\)UChar" $(top_srcdir)/src/oniguruma.h @echo "" test_regex_t: @echo "[regex_t in oniguruma.h check]" @grep "\(^\|[^[:alnum:]]\)regex_t" $(top_srcdir)/src/oniguruma.h @echo "" test_utf8_SOURCES = test_utf8.c test_utf8_LDADD = $(lib_onig) test_syntax_SOURCES = test_syntax.c test_syntax_LDADD = $(lib_onig) test_options_SOURCES = test_options.c test_options_LDADD = $(lib_onig) testc_SOURCES = testc.c testc_LDADD = $(lib_onig) testp_SOURCES = testp.c testp_LDADD = $(lib_onig) testcu_SOURCES = testu.c testcu_LDADD = $(lib_onig) test_regset_SOURCES = test_regset.c test_regset_LDADD = $(lib_onig) test_back_SOURCES = test_back.c test_back_LDADD = $(lib_onig) gcov: make CFLAGS="--coverage" test_utf8 make CFLAGS="--coverage" test_syntax make CFLAGS="--coverage" test_options make CFLAGS="--coverage" testc if ENABLE_POSIX_API make CFLAGS="--coverage" testp endif make CFLAGS="--coverage" testcu make CFLAGS="--coverage" test_regset make CFLAGS="--coverage" test_back jq-1.8.2/vendor/oniguruma/test/testp.c0000644000175100017510000004654115215513537013425 /* * testp.c * Copyright (c) 2020-2021 K.Kosako */ #include #include #include "onigposix.h" #define SLEN(s) strlen(s) static int nsucc = 0; static int nfail = 0; static int nerror = 0; static FILE* err_file; static void xx(char* pattern, char* str, int from, int to, int mem, int not) { int r; regex_t reg; char buf[200]; regmatch_t pmatch[25]; r = regcomp(®, pattern, REG_EXTENDED | REG_NEWLINE); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(err_file, "ERROR: %s\n", buf); nerror++; return ; } r = regexec(®, str, reg.re_nsub + 1, pmatch, 0); if (r != 0 && r != REG_NOMATCH) { regerror(r, ®, buf, sizeof(buf)); fprintf(err_file, "ERROR: %s\n", buf); nerror++; return ; } if (r == REG_NOMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s'\n", pattern, str); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s'\n", pattern, str); nfail++; } else { if (pmatch[mem].rm_so == from && pmatch[mem].rm_eo == to) { fprintf(stdout, "OK: /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", pattern, str, from, to, pmatch[mem].rm_so, pmatch[mem].rm_eo); nfail++; } } } regfree(®); } static void x2(char* pattern, char* str, int from, int to) { xx(pattern, str, from, to, 0, 0); } static void x3(char* pattern, char* str, int from, int to, int mem) { xx(pattern, str, from, to, mem, 0); } static void n(char* pattern, char* str) { xx(pattern, str, 0, 0, 0, 1); } extern int main(int argc, char* argv[]) { err_file = stdout; reg_set_encoding(REG_POSIX_ENCODING_UTF8); x2("", "", 0, 0); x2("^", "", 0, 0); x2("$", "", 0, 0); x2("\\G", "", 0, 0); x2("\\A", "", 0, 0); x2("\\Z", "", 0, 0); x2("\\z", "", 0, 0); x2("^$", "", 0, 0); x2("\\ca", "\001", 0, 1); x2("\\C-b", "\002", 0, 1); x2("\\c\\\\", "\034", 0, 1); x2("q[\\c\\\\]", "q\034", 0, 2); x2("", "a", 0, 0); x2("a", "a", 0, 1); x2("\\x61", "a", 0, 1); x2("aa", "aa", 0, 2); x2("aaa", "aaa", 0, 3); x2("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 35); x2("ab", "ab", 0, 2); x2("b", "ab", 1, 2); x2("bc", "abc", 1, 3); x2("(?i:#RET#)", "#INS##RET#", 5, 10); x2("\\17", "\017", 0, 1); x2("\\x1f", "\x1f", 0, 1); x2("a(?#....\\\\JJJJ)b", "ab", 0, 2); x2("(?x) G (o O(?-x)oO) g L", "GoOoOgLe", 0, 7); x2(".", "a", 0, 1); n(".", ""); x2("..", "ab", 0, 2); x2("\\w", "e", 0, 1); n("\\W", "e"); x2("\\s", " ", 0, 1); x2("\\S", "b", 0, 1); x2("\\d", "4", 0, 1); n("\\D", "4"); x2("\\b", "z ", 0, 0); x2("\\b", " z", 1, 1); x2("\\B", "zz ", 1, 1); x2("\\B", "z ", 2, 2); x2("\\B", " z", 0, 0); x2("[ab]", "b", 0, 1); n("[ab]", "c"); x2("[a-z]", "t", 0, 1); n("[^a]", "a"); x2("[^a]", "\n", 0, 1); x2("[]]", "]", 0, 1); n("[^]]", "]"); x2("[\\^]+", "0^^1", 1, 3); x2("[b-]", "b", 0, 1); x2("[b-]", "-", 0, 1); x2("[\\w]", "z", 0, 1); n("[\\w]", " "); x2("[\\W]", "b$", 1, 2); x2("[\\d]", "5", 0, 1); n("[\\d]", "e"); x2("[\\D]", "t", 0, 1); n("[\\D]", "3"); x2("[\\s]", " ", 0, 1); n("[\\s]", "a"); x2("[\\S]", "b", 0, 1); n("[\\S]", " "); x2("[\\w\\d]", "2", 0, 1); n("[\\w\\d]", " "); x2("[[:upper:]]", "B", 0, 1); x2("[*[:xdigit:]+]", "+", 0, 1); x2("[*[:xdigit:]+]", "GHIKK-9+*", 6, 7); x2("[*[:xdigit:]+]", "-@^+", 3, 4); n("[[:upper]]", "A"); x2("[[:upper]]", ":", 0, 1); x2("[\\044-\\047]", "\046", 0, 1); x2("[\\x5a-\\x5c]", "\x5b", 0, 1); x2("[\\x6A-\\x6D]", "\x6c", 0, 1); n("[\\x6A-\\x6D]", "\x6E"); n("^[0-9A-F]+ 0+ UNDEF ", "75F 00000000 SECT14A notype () External | _rb_apply"); x2("[\\[]", "[", 0, 1); x2("[\\]]", "]", 0, 1); x2("[&]", "&", 0, 1); x2("[[ab]]", "b", 0, 1); x2("[[ab]c]", "c", 0, 1); n("[[^a]]", "a"); n("[^[a]]", "a"); x2("[[ab]&&bc]", "b", 0, 1); n("[[ab]&&bc]", "a"); n("[[ab]&&bc]", "c"); x2("[a-z&&b-y&&c-x]", "w", 0, 1); n("[^a-z&&b-y&&c-x]", "w"); x2("[[^a&&a]&&a-z]", "b", 0, 1); n("[[^a&&a]&&a-z]", "a"); x2("[[^a-z&&bcdef]&&[^c-g]]", "h", 0, 1); n("[[^a-z&&bcdef]&&[^c-g]]", "c"); x2("[^[^abc]&&[^cde]]", "c", 0, 1); x2("[^[^abc]&&[^cde]]", "e", 0, 1); n("[^[^abc]&&[^cde]]", "f"); x2("[a-&&-a]", "-", 0, 1); n("[a\\-&&\\-a]", "&"); n("\\wabc", " abc"); x2("a\\Wbc", "a bc", 0, 4); x2("a.b.c", "aabbc", 0, 5); x2(".\\wb\\W..c", "abb bcc", 0, 7); x2("\\s\\wzzz", " zzzz", 0, 5); x2("aa.b", "aabb", 0, 4); n(".a", "ab"); x2(".a", "aa", 0, 2); x2("^a", "a", 0, 1); x2("^a$", "a", 0, 1); x2("^\\w$", "a", 0, 1); n("^\\w$", " "); x2("^\\wab$", "zab", 0, 3); x2("^\\wabcdef$", "zabcdef", 0, 7); x2("^\\w...def$", "zabcdef", 0, 7); x2("\\w\\w\\s\\Waaa\\d", "aa aaa4", 0, 8); x2("\\A\\Z", "", 0, 0); x2("\\Axyz", "xyz", 0, 3); x2("xyz\\Z", "xyz", 0, 3); x2("xyz\\z", "xyz", 0, 3); x2("a\\Z", "a", 0, 1); x2("\\Gaz", "az", 0, 2); n("\\Gz", "bza"); n("az\\G", "az"); n("az\\A", "az"); n("a\\Az", "az"); x2("\\^\\$", "^$", 0, 2); x2("^x?y", "xy", 0, 2); x2("^(x?y)", "xy", 0, 2); x2("\\w", "_", 0, 1); n("\\W", "_"); x2("(?=z)z", "z", 0, 1); n("(?=z).", "a"); x2("(?!z)a", "a", 0, 1); n("(?!z)a", "z"); x2("(?i:a)", "a", 0, 1); x2("(?i:a)", "A", 0, 1); x2("(?i:A)", "a", 0, 1); n("(?i:A)", "b"); x2("(?i:[A-Z])", "a", 0, 1); x2("(?i:[f-m])", "H", 0, 1); x2("(?i:[f-m])", "h", 0, 1); n("(?i:[f-m])", "e"); x2("(?i:[A-c])", "D", 0, 1); n("(?i:[^a-z])", "A"); n("(?i:[^a-z])", "a"); x2("(?i:[!-k])", "Z", 0, 1); x2("(?i:[!-k])", "7", 0, 1); x2("(?i:[T-}])", "b", 0, 1); x2("(?i:[T-}])", "{", 0, 1); x2("(?i:\\?a)", "?A", 0, 2); x2("(?i:\\*A)", "*a", 0, 2); n(".", "\n"); x2("(?m:.)", "\n", 0, 1); x2("(?m:a.)", "a\n", 0, 2); x2("(?m:.b)", "a\nb", 1, 3); x2(".*abc", "dddabdd\nddabc", 8, 13); x2("(?m:.*abc)", "dddabddabc", 0, 10); n("(?i)(?-i)a", "A"); n("(?i)(?-i:a)", "A"); x2("a?", "", 0, 0); x2("a?", "b", 0, 0); x2("a?", "a", 0, 1); x2("a*", "", 0, 0); x2("a*", "a", 0, 1); x2("a*", "aaa", 0, 3); x2("a*", "baaaa", 0, 0); n("a+", ""); x2("a+", "a", 0, 1); x2("a+", "aaaa", 0, 4); x2("a+", "aabbb", 0, 2); x2("a+", "baaaa", 1, 5); x2(".?", "", 0, 0); x2(".?", "f", 0, 1); x2(".?", "\n", 0, 0); x2(".*", "", 0, 0); x2(".*", "abcde", 0, 5); x2(".+", "z", 0, 1); x2(".+", "zdswer\n", 0, 6); x2("(.*)a\\1f", "babfbac", 0, 4); x2("(.*)a\\1f", "bacbabf", 3, 7); x2("((.*)a\\2f)", "bacbabf", 3, 7); x2("(.*)a\\1f", "baczzzzzz\nbazz\nzzzzbabf", 19, 23); x2("a|b", "a", 0, 1); x2("a|b", "b", 0, 1); x2("|a", "a", 0, 0); x2("(|a)", "a", 0, 0); x2("ab|bc", "ab", 0, 2); x2("ab|bc", "bc", 0, 2); x2("z(?:ab|bc)", "zbc", 0, 3); x2("a(?:ab|bc)c", "aabc", 0, 4); x2("ab|(?:ac|az)", "az", 0, 2); x2("a|b|c", "dc", 1, 2); x2("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "pqr", 0, 2); n("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "mn"); x2("a|^z", "ba", 1, 2); x2("a|^z", "za", 0, 1); x2("a|\\Gz", "bza", 2, 3); x2("a|\\Gz", "za", 0, 1); x2("a|\\Az", "bza", 2, 3); x2("a|\\Az", "za", 0, 1); x2("a|b\\Z", "ba", 1, 2); x2("a|b\\Z", "b", 0, 1); x2("a|b\\z", "ba", 1, 2); x2("a|b\\z", "b", 0, 1); x2("\\w|\\s", " ", 0, 1); n("\\w|\\w", " "); x2("\\w|%", "%", 0, 1); x2("\\w|[&$]", "&", 0, 1); x2("[b-d]|[^e-z]", "a", 0, 1); x2("(?:a|[c-f])|bz", "dz", 0, 1); x2("(?:a|[c-f])|bz", "bz", 0, 2); x2("abc|(?=zz)..f", "zzf", 0, 3); x2("abc|(?!zz)..f", "abf", 0, 3); x2("(?=za)..a|(?=zz)..a", "zza", 0, 3); n("(?>a|abd)c", "abdc"); x2("(?>abd|a)c", "abdc", 0, 4); x2("a?|b", "a", 0, 1); x2("a?|b", "b", 0, 0); x2("a?|b", "", 0, 0); x2("a*|b", "aa", 0, 2); x2("a*|b*", "ba", 0, 0); x2("a*|b*", "ab", 0, 1); x2("a+|b*", "", 0, 0); x2("a+|b*", "bbb", 0, 3); x2("a+|b*", "abbb", 0, 1); n("a+|b+", ""); x2("(a|b)?", "b", 0, 1); x2("(a|b)*", "ba", 0, 2); x2("(a|b)+", "bab", 0, 3); x2("(ab|ca)+", "caabbc", 0, 4); x2("(ab|ca)+", "aabca", 1, 5); x2("(ab|ca)+", "abzca", 0, 2); x2("(a|bab)+", "ababa", 0, 5); x2("(a|bab)+", "ba", 1, 2); x2("(a|bab)+", "baaaba", 1, 4); x2("(?:a|b)(?:a|b)", "ab", 0, 2); x2("(?:a*|b*)(?:a*|b*)", "aaabbb", 0, 3); x2("(?:a*|b*)(?:a+|b+)", "aaabbb", 0, 6); x2("(?:a+|b+){2}", "aaabbb", 0, 6); x2("h{0,}", "hhhh", 0, 4); x2("(?:a+|b+){1,2}", "aaabbb", 0, 6); n("ax{2}*a", "0axxxa1"); n("a.{0,2}a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXXa0"); x2("^a{2,}?a$", "aaa", 0, 3); x2("^[a-z]{2,}?$", "aaa", 0, 3); x2("(?:a+|\\Ab*)cc", "cc", 0, 2); n("(?:a+|\\Ab*)cc", "abcc"); x2("(?:^a+|b+)*c", "aabbbabc", 6, 8); x2("(?:^a+|b+)*c", "aabbbbc", 0, 7); x2("a|(?i)c", "C", 0, 1); x2("(?i)c|a", "C", 0, 1); x2("(?i)c|a", "A", 0, 1); x2("(?i:c)|a", "C", 0, 1); n("(?i:c)|a", "A"); x2("[abc]?", "abc", 0, 1); x2("[abc]*", "abc", 0, 3); x2("[^abc]*", "abc", 0, 0); n("[^abc]+", "abc"); x2("a?\?", "aaa", 0, 0); x2("ba?\?b", "bab", 0, 3); x2("a*?", "aaa", 0, 0); x2("ba*?", "baa", 0, 1); x2("ba*?b", "baab", 0, 4); x2("a+?", "aaa", 0, 1); x2("ba+?", "baa", 0, 2); x2("ba+?b", "baab", 0, 4); x2("(?:a?)?\?", "a", 0, 0); x2("(?:a?\?)?", "a", 0, 0); x2("(?:a?)+?", "aaa", 0, 1); x2("(?:a+)?\?", "aaa", 0, 0); x2("(?:a+)?\?b", "aaab", 0, 4); x2("(?:ab)?{2}", "", 0, 0); x2("(?:ab)?{2}", "ababa", 0, 4); x2("(?:ab)*{0}", "ababa", 0, 0); x2("(?:ab){3,}", "abababab", 0, 8); n("(?:ab){3,}", "abab"); x2("(?:ab){2,4}", "ababab", 0, 6); x2("(?:ab){2,4}", "ababababab", 0, 8); x2("(?:ab){2,4}?", "ababababab", 0, 4); x2("(?:ab){,}", "ab{,}", 0, 5); x2("(?:abc)+?{2}", "abcabcabc", 0, 6); x2("(?:X*)(?i:xa)", "XXXa", 0, 4); x2("(d+)([^abc]z)", "dddz", 0, 4); x2("([^abc]*)([^abc]z)", "dddz", 0, 4); x2("(\\w+)(\\wz)", "dddz", 0, 4); x3("(a)", "a", 0, 1, 1); x3("(ab)", "ab", 0, 2, 1); x2("((ab))", "ab", 0, 2); x3("((ab))", "ab", 0, 2, 1); x3("((ab))", "ab", 0, 2, 2); x3("((((((((((((((((((((ab))))))))))))))))))))", "ab", 0, 2, 20); x3("(ab)(cd)", "abcd", 0, 2, 1); x3("(ab)(cd)", "abcd", 2, 4, 2); x3("()(a)bc(def)ghijk", "abcdefghijk", 3, 6, 3); x3("(()(a)bc(def)ghijk)", "abcdefghijk", 3, 6, 4); x2("(^a)", "a", 0, 1); x3("(a)|(a)", "ba", 1, 2, 1); x3("(^a)|(a)", "ba", 1, 2, 2); x3("(a?)", "aaa", 0, 1, 1); x3("(a*)", "aaa", 0, 3, 1); x3("(a*)", "", 0, 0, 1); x3("(a+)", "aaaaaaa", 0, 7, 1); x3("(a+|b*)", "bbbaa", 0, 3, 1); x3("(a+|b?)", "bbbaa", 0, 1, 1); x3("(abc)?", "abc", 0, 3, 1); x3("(abc)*", "abc", 0, 3, 1); x3("(abc)+", "abc", 0, 3, 1); x3("(xyz|abc)+", "abc", 0, 3, 1); x3("([xyz][abc]|abc)+", "abc", 0, 3, 1); x3("((?i:abc))", "AbC", 0, 3, 1); x2("(abc)(?i:\\1)", "abcABC", 0, 6); x3("((?m:a.c))", "a\nc", 0, 3, 1); x3("((?=az)a)", "azb", 0, 1, 1); x3("abc|(.abd)", "zabd", 0, 4, 1); x2("(?:abc)|(ABC)", "abc", 0, 3); x3("(?i:(abc))|(zzz)", "ABC", 0, 3, 1); x3("a*(.)", "aaaaz", 4, 5, 1); x3("a*?(.)", "aaaaz", 0, 1, 1); x3("a*?(c)", "aaaac", 4, 5, 1); x3("[bcd]a*(.)", "caaaaz", 5, 6, 1); x3("(\\Abb)cc", "bbcc", 0, 2, 1); n("(\\Abb)cc", "zbbcc"); x3("(^bb)cc", "bbcc", 0, 2, 1); n("(^bb)cc", "zbbcc"); x3("cc(bb$)", "ccbb", 2, 4, 1); n("cc(bb$)", "ccbbb"); n("(\\1)", ""); n("\\1(a)", "aa"); n("(a(b)\\1)\\2+", "ababb"); n("(?:(?:\\1|z)(a))+$", "zaa"); x2("(?:(?:\\1|z)(a))+$", "zaaa", 0, 4); x2("(a)(?=\\1)", "aa", 0, 1); n("(a)$|\\1", "az"); x2("(a)\\1", "aa", 0, 2); n("(a)\\1", "ab"); x2("(a?)\\1", "aa", 0, 2); x2("(a?\?)\\1", "aa", 0, 0); x2("(a*)\\1", "aaaaa", 0, 4); x3("(a*)\\1", "aaaaa", 0, 2, 1); x2("a(b*)\\1", "abbbb", 0, 5); x2("a(b*)\\1", "ab", 0, 1); x2("(a*)(b*)\\1\\2", "aaabbaaabb", 0, 10); x2("(a*)(b*)\\2", "aaabbbb", 0, 7); x2("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 8); x3("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 3, 7); x2("(a)(b)(c)\\2\\1\\3", "abcbac", 0, 6); x2("([a-d])\\1", "cc", 0, 2); x2("(\\w\\d\\s)\\1", "f5 f5 ", 0, 6); n("(\\w\\d\\s)\\1", "f5 f5"); x2("(who|[a-c]{3})\\1", "whowho", 0, 6); x2("...(who|[a-c]{3})\\1", "abcwhowho", 0, 9); x2("(who|[a-c]{3})\\1", "cbccbc", 0, 6); x2("(^a)\\1", "aa", 0, 2); n("(^a)\\1", "baa"); n("(a$)\\1", "aa"); n("(ab\\Z)\\1", "ab"); x2("(a*\\Z)\\1", "a", 1, 1); x2(".(a*\\Z)\\1", "ba", 1, 2); x3("(.(abc)\\2)", "zabcabc", 0, 7, 1); x3("(.(..\\d.)\\2)", "z12341234", 0, 9, 1); x2("((?i:az))\\1", "AzAz", 0, 4); n("((?i:az))\\1", "Azaz"); x2("(?<=a)b", "ab", 1, 2); n("(?<=a)b", "bb"); x2("(?<=a|b)b", "bb", 1, 2); x2("(?<=a|bc)b", "bcb", 2, 3); x2("(?<=a|bc)b", "ab", 1, 2); x2("(?<=a|bc||defghij|klmnopq|r)z", "rz", 1, 2); x2("(a)\\g<1>", "aa", 0, 2); x2("(?a)", "a", 0, 1); x2("(?ab)\\g", "abab", 0, 4); x2("(?.zv.)\\k", "azvbazvb", 0, 8); x2("(?<=\\g)|-\\zEND (?XyZ)", "XyZ", 3, 3); x2("(?|a\\g)+", "", 0, 0); x2("(?|\\(\\g\\))+$", "()(())", 0, 6); x3("\\g(?.){0}", "X", 0, 1, 1); x2("\\g(abc|df(?.YZ){2,8}){0}", "XYZ", 0, 3); x2("\\A(?(a\\g)|)\\z", "aaaa", 0, 4); x2("(?|\\g\\g)\\z|\\zEND (?a|(b)\\g)", "bbbbabba", 0, 8); x2("(?\\w+\\sx)a+\\k", " fg xaaaaaaaafg x", 2, 18); x3("(z)()()(?<_9>a)\\g<_9>", "zaa", 2, 3, 1); x2("(.)(((?<_>a)))\\k<_>", "zaa", 0, 3); x2("((?\\d)|(?\\w))(\\k|\\k)", "ff", 0, 2); x2("(?:(?)|(?efg))\\k", "", 0, 0); x2("(?:(?abc)|(?efg))\\k", "abcefgefg", 3, 9); n("(?:(?abc)|(?efg))\\k", "abcefg"); x2("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "a-pyumpyum", 2, 10); x3("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "xxxxabcdefghijklmnabcdefghijklmn", 4, 18, 14); x3("(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?aaa)(?)$", "aaa", 0, 3, 16); x2("(?a|\\(\\g\\))", "a", 0, 1); x2("(?a|\\(\\g\\))", "((((((a))))))", 0, 13); x3("(?a|\\(\\g\\))", "((((((((a))))))))", 0, 17, 1); x2("\\g|\\zEND(?.*abc$)", "abcxxxabc", 0, 9); x2("\\g<1>|\\zEND(.a.)", "bac", 0, 3); x3("\\g<_A>\\g<_A>|\\zEND(.a.)(?<_A>.b.)", "xbxyby", 3, 6, 1); x2("\\A(?:\\g|\\g|\\zEND (?a|c\\gc)(?b|d\\gd))$", "cdcbcdc", 0, 7); x2("\\A(?|a\\g)\\z|\\zEND (?\\g)", "aaaa", 0, 4); x2("(?(a|b\\gc){3,5})", "baaaaca", 1, 5); x2("(?(a|b\\gc){3,5})", "baaaacaaaaa", 0, 10); x2("(?\\(([^\\(\\)]++|\\g)*+\\))", "((a))", 0, 5); x2("()*\\1", "", 0, 0); x2("(?:()|())*\\1\\2", "", 0, 0); x3("(?:\\1a|())*", "a", 0, 0, 1); x2("x((.)*)*x", "0x1x2x3", 1, 6); x2("x((.)*)*x(?i:\\1)\\Z", "0x1x2x1X2", 1, 9); x2("(?:()|()|()|()|()|())*\\2\\5", "", 0, 0); x2("(?:()|()|()|(x)|()|())*\\2b\\5", "b", 0, 1); x2("[0-9-a]", "-", 0, 1); // PR#44 n("[0-9-a]", ":"); // PR#44 x3("(\\(((?:[^(]|\\g<1>)*)\\))", "(abc)(abc)", 1, 4, 2); // PR#43 x2("\\o{101}", "A", 0, 1); x2("(?:\\k'+1'B|(A)C)*", "ACAB", 0, 4); // relative backref by positive number x2("\\g<+2>(abc)(ABC){0}", "ABCabc", 0, 6); // relative call by positive number x2("A\\g'0'|B()", "AAAAB", 0, 5); x3("(A\\g'0')|B", "AAAAB", 0, 5, 1); x2("(a*)(?(1))aa", "aaaaa", 0, 5); x2("(a*)(?(-1))aa", "aaaaa", 0, 5); x2("(?aaa)(?('name'))aa", "aaaaa", 0, 5); x2("(a)(?(1)aa|bb)a", "aaaaa", 0, 4); x2("(?:aa|())(?(<1>)aa|bb)a", "aabba", 0, 5); x2("(?:aa|())(?('1')aa|bb|cc)a", "aacca", 0, 5); x3("(a*)(?(1)aa|a)b", "aaab", 0, 1, 1); n("(a)(?(1)a|b)c", "abc"); x2("(a)(?(1)|)c", "ac", 0, 2); n("(?()aaa|bbb)", "bbb"); x2("(a)(?(1+0)b|c)d", "abd", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "ace", 0, 3); x2("(?:(?'name'a)|(?'name'b))(?('name')c|d)e", "bce", 0, 3); x2("\\R", "\r\n", 0, 2); x2("\\R", "\r", 0, 1); x2("\\R", "\n", 0, 1); x2("\\R", "\x0b", 0, 1); n("\\R\\n", "\r\n"); x2("\\N", "a", 0, 1); n("\\N", "\n"); n("(?m:\\N)", "\n"); n("(?-m:\\N)", "\n"); x2("\\O", "a", 0, 1); x2("\\O", "\n", 0, 1); x2("(?m:\\O)", "\n", 0, 1); x2("(?-m:\\O)", "\n", 0, 1); x2("\\K", "a", 0, 0); x2("a\\K", "a", 1, 1); x2("a\\Kb", "ab", 1, 2); x2("(a\\Kb|ac\\Kd)", "acd", 2, 3); x2("(a\\Kb|\\Kac\\K)*", "acababacab", 9, 10); x2("(?~)", "", 0, 0); x2("(?~)", "A", 0, 0); x2("aaaaa(?~)", "aaaaaaaaaa", 0, 5); x2("(?~(?:|aaa))", "aaa", 0, 0); x2("(?~aaa|)", "aaa", 0, 0); x2("a(?~(?~)).", "abcdefghijklmnopqrstuvwxyz", 0, 26); // !!! x2("/\\*(?~\\*/)\\*/", "/* */ */", 0, 5); x2("(?~\\w+)zzzzz", "zzzzz", 0, 5); x2("(?~\\w*)zzzzz", "zzzzz", 0, 5); x2("(?~A.C|B)", "ABC", 0, 0); x2("(?~XYZ|ABC)a", "ABCa", 1, 4); x2("(?~XYZ|ABC)a", "aABCa", 0, 1); x2("<[^>]*>(?~[<>])]*>", "vvv ", 0, 10); x2("(?~ab)", "ccc\ndab", 0, 5); x2("(?m:(?~ab))", "ccc\ndab", 0, 5); x2("(?-m:(?~ab))", "ccc\ndab", 0, 5); x2("(?~abc)xyz", "xyz012345678901234567890123456789abc", 0, 3); // absent with expr x2("(?~|78|\\d*)", "123456789", 0, 6); x2("(?~|def|(?:abc|de|f){0,100})", "abcdedeabcfdefabc", 0, 11); x2("(?~|ab|.*)", "ccc\nddd", 0, 3); x2("(?~|ab|\\O*)", "ccc\ndab", 0, 5); x2("(?~|ab|\\O{2,10})", "ccc\ndab", 0, 5); x2("(?~|ab|\\O{1,10})", "ab", 1, 2); n("(?~|ab|\\O{2,10})", "ab"); x2("(?~|abc|\\O{1,10})", "abc", 1, 3); x2("(?~|ab|\\O{5,10})|abc", "abc", 0, 3); x2("(?~|ab|\\O{1,10})", "cccccccccccab", 0, 10); x2("(?~|aaa|)", "aaa", 0, 0); x2("(?~||a*)", "aaaaaa", 0, 0); x2("(?~||a*?)", "aaaaaa", 0, 0); x2("(a)(?~|b|\\1)", "aaaaaa", 0, 2); x2("(a)(?~|bb|(?:a\\1)*)", "aaaaaa", 0, 5); x2("(b|c)(?~|abac|(?:a\\1)*)", "abababacabab", 1, 4); n("(?~|c|a*+)a", "aaaaa"); x2("(?~|aaaaa|a*+)", "aaaaa", 0, 0); x2("(?~|aaaaaa|a*+)b", "aaaaaab", 1, 7); x2("(?~|abcd|(?>))", "zzzabcd", 0, 0); x2("(?~|abc|a*?)", "aaaabc", 0, 0); // absent stopper x2("(?~|abc)a*", "aaaaaabc", 0, 5); x2("(?~|abc)a*z|aaaaaabc", "aaaaaabc", 0, 8); x2("(?~|aaaaaa)a*", "aaaaaa", 0, 0); x2("(?~|abc)aaaa|aaaabc", "aaaabc", 0, 6); x2("(?>(?~|abc))aaaa|aaaabc", "aaaabc", 0, 6); x2("(?~|)a", "a", 0, 1); n("(?~|a)a", "a"); x2("(?~|a)(?~|)a", "a", 0, 1); x2("(?~|a).*(?~|)a", "bbbbbbbbbbbbbbbbbbbba", 0, 21); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaapqrabc", 0, 16); x2("(?~|abc).*(xyz|pqr)(?~|)abc", "aaaaxyzaaaabcpqrabc", 11, 19); n("\\A(?~|abc).*(xyz|pqrabc)(?~|)abc", "aaaaxyzaaaabcpqrabcabc"); x2("(?~|a)(?~|)c|ab|a|", "ab", 0, 2); x2("(?~|a)((?~|)c|ab|a|)", "ab", 0, 0); x2("(?~|a)((?>(?~|))c|ab|a|)", "ab", 0, 0); // extended grapheme cluster // CR + LF n(".\\y\\O", "\x0d\x0a"); x2(".\\Y\\O", "\x0d\x0a", 0, 2); n("\\X\\X", "\x0d\x0a"); x2("^\\X$", "\x0d\x0a", 0, 2); x2("^\\X\\X\\X$", "ab\x0d\x0a", 0, 4); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/test_syntax.c0000644000175100017510000002311415215513537014642 /* * test_syntax.c * Copyright (c) 2019-2024 K.Kosako */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION #endif #include #include #include "oniguruma.h" #define SLEN(s) strlen(s) static int nsucc = 0; static int nfail = 0; static int nerror = 0; #ifdef __TRUSTINSOFT_ANALYZER__ static int nall = 0; #endif static FILE* err_file; static OnigRegion* region; static OnigSyntaxType* Syntax; static void xx(char* pattern, char* str, int from, int to, int mem, int not, int error_no) { #ifdef __TRUSTINSOFT_ANALYZER__ if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; #endif int r; regex_t* reg; OnigErrorInfo einfo; r = onig_new(®, (UChar* )pattern, (UChar* )(pattern + SLEN(pattern)), ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, Syntax, &einfo); if (r) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(err_file, "ERROR: %s /%s/\n", s, pattern); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ %d\n", pattern, r); nsucc++; } else { fprintf(stdout, "FAIL(ERROR): /%s/ '%s', %d, %d\n", pattern, str, error_no, r); nfail++; } } return ; } r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, ONIG_OPTION_NONE); if (r < ONIG_MISMATCH || error_no < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; if (error_no == 0) { onig_error_code_to_str((UChar* )s, r); fprintf(err_file, "ERROR: %s /%s/\n", s, pattern); nerror++; } else { if (r == error_no) { fprintf(stdout, "OK(ERROR): /%s/ '%s', %d\n", pattern, str, r); nsucc++; } else { fprintf(stdout, "FAIL ERROR NO: /%s/ '%s', %d, %d\n", pattern, str, error_no, r); nfail++; } } return ; } if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s'\n", pattern, str); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s'\n", pattern, str); nfail++; } else { if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", pattern, str, from, to, region->beg[mem], region->end[mem]); nfail++; } } } onig_free(reg); } static void x2(char* pattern, char* str, int from, int to) { xx(pattern, str, from, to, 0, 0, 0); } static void x3(char* pattern, char* str, int from, int to, int mem) { xx(pattern, str, from, to, mem, 0, 0); } static void n(char* pattern, char* str) { xx(pattern, str, 0, 0, 0, 1, 0); } static void e(char* pattern, char* str, int error_no) { xx(pattern, str, 0, 0, 0, 0, error_no); } static int test_reluctant_interval() { x2("a{1,3}?", "aaa", 0, 1); x2("a{3}", "aaa", 0, 3); x2("a{3}?", "aaa", 0, 3); n("a{3}?", "aa"); x2("a{3,3}?", "aaa", 0, 3); n("a{3,3}?", "aa"); return 0; } static int test_possessive_interval() { x2("a{1,3}+", "aaaaaa", 0, 3); x2("a{3}+", "aaaaaa", 0, 3); x2("a{3,3}+", "aaaaaa", 0, 3); return 0; } static int test_isolated_option() { x2("", "", 0, 0); x2("^", "", 0, 0); n("^a", "\na"); n(".", "\n"); x2("(?s:.)", "\n", 0, 1); x2("(?s).", "\n", 0, 1); x2("(?s)a|.", "\n", 0, 1); n("(?s:a)|.", "\n"); x2("b(?s)a|.", "\n", 0, 1); n("((?s)a)|.", "\n"); n("b(?:(?s)a)|z|.", "\n"); n(".|b(?s)a", "\n"); n(".(?s)", "\n"); n("(?s)(?-s)a|.", "\n"); x2("(?s)a|.(?-s)", "\n", 0, 1); x2("(?s)a|((?-s)).", "\n", 0, 1); x2("(?s)a|(?:(?-s)).", "\n", 0, 1); // !!! Perl 5.26.1 returns empty match x2("(?s)a|(?:).", "\n", 0, 1); // !!! Perl 5.26.1 returns empty match x2("(?s)a|(?:.)", "\n", 0, 1); x2("(?s)a|(?:a*).", "\n", 0, 1); n("a|(?:).", "\n"); // !!! Perl 5.26.1 returns empty match n("a|(?:)(.)", "\n"); x2("(?s)a|(?:)(.)", "\n", 0, 1); x2("b(?s)a|(?:)(.)", "\n", 0, 1); n("b((?s)a)|(?:)(.)", "\n"); return 0; } static int test_prec_read() { x2("(?=a).b", "ab", 0, 2); x2("(?=ab|(.))\\1", "ab", 1, 2); // doesn't backtrack if success once in prec-read n("(?!(.)z)a\\1", "aa"); // ! Perl 5.26.1 match with "aa" return 0; } static int test_look_behind() { x2("(?<=a)b", "ab", 1, 2); x2("(?<=a|b)c", "abc", 2, 3); x2("(?<=a|(.))\\1", "abcc", 3, 4); // #295 n("(?abc)", "abc", 0, 3); x2("(?Pabc)(?P=name)", "abcabc", 0, 6); x2("(?Pabc){0}(?P>name)", "abc", 0, 3); x2("(?P[^()]+|\\((?P>expr)\\)){0}(?P>expr)", "((((xyz))))", 0, 11); x2("\\u0041", "A", 0, 1); x2("\\U00000041", "A", 0, 1); e("\\U0041", "A", ONIGERR_INVALID_CODE_POINT_VALUE); Syntax = ONIG_SYNTAX_POSIX_BASIC; test_BRE_anchors(); Syntax = ONIG_SYNTAX_GREP; test_BRE_anchors(); x2("zz\\|^ab", "ab", 0, 2); x2("ab$\\|zz", "ab", 0, 2); x2("*", "*", 0, 1); x2("^*", "*", 0, 1); x2("abc\\|?", "?", 0, 1); x2("\\{1\\}", "{1}", 0, 3); x2("^\\{1\\}", "{1}", 0, 3); x2("\\(\\{1\\}\\)", "{1}", 0, 3); x2("^\\(\\{1\\}\\)", "{1}", 0, 3); x2("{1}", "{1}", 0, 3); x2("^{1}", "{1}", 0, 3); x2("\\({1}\\)", "{1}", 0, 3); x2("^\\({1}\\)", "{1}", 0, 3); x2("{1,2}", "{1,2}", 0, 5); x2("^{1,2}", "{1,2}", 0, 5); x2("\\({1,2}\\)", "{1,2}", 0, 5); x2("^\\({1,2}\\)", "{1,2}", 0, 5); Syntax = ONIG_SYNTAX_EMACS; x2("\\(abc\\)", "abc", 0, 3); x2("\\(?:abc\\)", "abc", 0, 3); x3("\\(?:abc\\)\\(xyz\\)", "abcxyz", 3, 6, 1); Syntax = ONIG_SYNTAX_PERL_NG; x2("(?i)test", "test", 0, 4); x2("(?-i)test", "test", 0, 4); x2("(?i)test", "TEST", 0, 4); n("(?-i)test", "teSt"); x2("(?i)te(?-i)st", "TEst", 0, 4); n("(?i)te(?-i)st", "TesT"); x2("(abc)(?-1)", "abcabc", 0, 6); x2("(?+1)(abc)", "abcabc", 0, 6); x2("(abc)(?1)", "abcabc", 0, 6); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); onig_region_free(region, 1); onig_end(); return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/testu.c0000644000175100017510000022060715215513537013427 /* * testu.c * Copyright (c) 2019 K.Kosako */ #include #ifdef POSIX_TEST #include "onigposix.h" #else #include "oniguruma.h" #endif static int nsucc = 0; static int nfail = 0; static int nerror = 0; #ifdef __TRUSTINSOFT_ANALYZER__ static int nall = 0; #endif static FILE* err_file; #ifndef POSIX_TEST static OnigRegion* region; static OnigEncoding ENC; #endif #define ulen(p) onigenc_str_bytelen_null(ENC, (UChar* )p) static void uconv(char* from, char* to, int len) { int i; unsigned char c; char *q; q = to; for (i = 0; i < len; i += 2) { c = (unsigned char )from[i]; if (c == 0) { c = (unsigned char )from[i+1]; if (c < 0x20 || c >= 0x7f || c == 0x5c || c == 0x22) { sprintf(q, "\\%03o", (unsigned int )c); q += 4; } else { sprintf(q, "%c", c); q++; } } else { sprintf(q, "\\%03o", (unsigned int )c); q += 4; c = (unsigned char )from[i+1]; sprintf(q, "\\%03o", (unsigned int )c); q += 4; } } *q = 0; } static void xx(char* pattern, char* str, int from, int to, int mem, int not) { #ifdef __TRUSTINSOFT_ANALYZER__ if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; #endif int r; char cpat[4000], cstr[4000]; #ifdef POSIX_TEST regex_t reg; char buf[200]; regmatch_t pmatch[20]; uconv(pattern, cpat, ulen(pattern)); uconv(str, cstr, ulen(str)); r = regcomp(®, pattern, REG_EXTENDED | REG_NEWLINE); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(err_file, "ERROR: %s\n", buf); nerror++; return ; } r = regexec(®, str, reg.re_nsub + 1, pmatch, 0); if (r != 0 && r != REG_NOMATCH) { regerror(r, ®, buf, sizeof(buf)); fprintf(err_file, "ERROR: %s\n", buf); nerror++; return ; } if (r == REG_NOMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s'\n", cpat, cstr); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s'\n", cpat, cstr); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s'\n", cpat, cstr); nfail++; } else { if (pmatch[mem].rm_so == from && pmatch[mem].rm_eo == to) { fprintf(stdout, "OK: /%s/ '%s'\n", cpat, cstr); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", cpat, cstr, from, to, pmatch[mem].rm_so, pmatch[mem].rm_eo); nfail++; } } } regfree(®); #else regex_t* reg; OnigErrorInfo einfo; uconv(pattern, cpat, ulen(pattern)); uconv(str, cstr, ulen(str)); r = onig_new(®, (UChar* )pattern, (UChar* )(pattern + ulen(pattern)), ONIG_OPTION_DEFAULT, ENC, ONIG_SYNTAX_DEFAULT, &einfo); if (r) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(err_file, "ERROR: %s\n", s); nerror++; return ; } r = onig_search(reg, (UChar* )str, (UChar* )(str + ulen(str)), (UChar* )str, (UChar* )(str + ulen(str)), region, ONIG_OPTION_NONE); if (r < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(err_file, "ERROR: %s\n", s); nerror++; return ; } if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s'\n", cpat, cstr); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s'\n", cpat, cstr); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s'\n", cpat, cstr); nfail++; } else { if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: /%s/ '%s'\n", cpat, cstr); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", cpat, cstr, from, to, region->beg[mem], region->end[mem]); nfail++; } } } onig_free(reg); #endif } static void x2(char* pattern, char* str, int from, int to) { xx(pattern, str, from, to, 0, 0); } static void x3(char* pattern, char* str, int from, int to, int mem) { xx(pattern, str, from, to, mem, 0); } static void n(char* pattern, char* str) { xx(pattern, str, 0, 0, 0, 1); } extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_UTF16_BE; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); err_file = stdout; #ifndef POSIX_TEST region = onig_region_new(); #endif #ifdef POSIX_TEST reg_set_encoding(REG_POSIX_ENCODING_UTF16_BE); #else ENC = ONIG_ENCODING_UTF16_BE; #endif x2("\000\000", "\000\000", 0, 0); x2("\000^\000\000", "\000\000", 0, 0); x2("\000$\000\000", "\000\000", 0, 0); x2("\000\134\000G\000\000", "\000\000", 0, 0); x2("\000\134\000A\000\000", "\000\000", 0, 0); x2("\000\134\000Z\000\000", "\000\000", 0, 0); x2("\000\134\000z\000\000", "\000\000", 0, 0); x2("\000^\000$\000\000", "\000\000", 0, 0); x2("\000\134\000c\000a\000\000", "\000\001\000\000", 0, 2); x2("\000\134\000C\000-\000b\000\000", "\000\002\000\000", 0, 2); x2("\000\134\000c\000\134\000\134\000\000", "\000\034\000\000", 0, 2); x2("\000q\000[\000\134\000c\000\134\000\134\000]\000\000", "\000q\000\034\000\000", 0, 4); x2("\000\000", "\000a\000\000", 0, 0); x2("\000a\000\000", "\000a\000\000", 0, 2); x2("\000\134\000x\0000\0000\000\134\000x\0006\0001\000\000", "\000a\000\000", 0, 2); x2("\000a\000a\000\000", "\000a\000a\000\000", 0, 4); x2("\000a\000a\000a\000\000", "\000a\000a\000a\000\000", 0, 6); x2("\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000\000", "\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000a\000\000", 0, 70); x2("\000a\000b\000\000", "\000a\000b\000\000", 0, 4); x2("\000b\000\000", "\000a\000b\000\000", 2, 4); x2("\000b\000c\000\000", "\000a\000b\000c\000\000", 2, 6); x2("\000(\000?\000i\000:\000#\000R\000E\000T\000#\000)\000\000", "\000#\000I\000N\000S\000#\000#\000R\000E\000T\000#\000\000", 10, 20); x2("\000\134\0000\0000\0000\000\134\0001\0007\000\000", "\000\017\000\000", 0, 2); x2("\000\134\000x\0000\0000\000\134\000x\0001\000f\000\000", "\000\037\000\000", 0, 2); x2("\000a\000(\000?\000#\000.\000.\000.\000.\000\134\000\134\000J\000J\000J\000J\000)\000b\000\000", "\000a\000b\000\000", 0, 4); x2("\000(\000?\000x\000)\000 \000 \000G\000 \000(\000o\000 \000O\000(\000?\000-\000x\000)\000o\000O\000)\000 \000g\000 \000L\000\000", "\000G\000o\000O\000o\000O\000g\000L\000e\000\000", 0, 14); x2("\000.\000\000", "\000a\000\000", 0, 2); n("\000.\000\000", "\000\000"); x2("\000.\000.\000\000", "\000a\000b\000\000", 0, 4); x2("\000\134\000w\000\000", "\000e\000\000", 0, 2); n("\000\134\000W\000\000", "\000e\000\000"); x2("\000\134\000s\000\000", "\000 \000\000", 0, 2); x2("\000\134\000S\000\000", "\000b\000\000", 0, 2); x2("\000\134\000d\000\000", "\0004\000\000", 0, 2); n("\000\134\000D\000\000", "\0004\000\000"); x2("\000\134\000b\000\000", "\000z\000 \000\000", 0, 0); x2("\000\134\000b\000\000", "\000 \000z\000\000", 2, 2); x2("\000\134\000B\000\000", "\000z\000z\000 \000\000", 2, 2); x2("\000\134\000B\000\000", "\000z\000 \000\000", 4, 4); x2("\000\134\000B\000\000", "\000 \000z\000\000", 0, 0); x2("\000[\000a\000b\000]\000\000", "\000b\000\000", 0, 2); n("\000[\000a\000b\000]\000\000", "\000c\000\000"); x2("\000[\000a\000-\000z\000]\000\000", "\000t\000\000", 0, 2); n("\000[\000^\000a\000]\000\000", "\000a\000\000"); x2("\000[\000^\000a\000]\000\000", "\000\012\000\000", 0, 2); x2("\000[\000]\000]\000\000", "\000]\000\000", 0, 2); n("\000[\000^\000]\000]\000\000", "\000]\000\000"); x2("\000[\000\134\000^\000]\000+\000\000", "\0000\000^\000^\0001\000\000", 2, 6); x2("\000[\000b\000-\000]\000\000", "\000b\000\000", 0, 2); x2("\000[\000b\000-\000]\000\000", "\000-\000\000", 0, 2); x2("\000[\000\134\000w\000]\000\000", "\000z\000\000", 0, 2); n("\000[\000\134\000w\000]\000\000", "\000 \000\000"); x2("\000[\000\134\000W\000]\000\000", "\000b\000$\000\000", 2, 4); x2("\000[\000\134\000d\000]\000\000", "\0005\000\000", 0, 2); n("\000[\000\134\000d\000]\000\000", "\000e\000\000"); x2("\000[\000\134\000D\000]\000\000", "\000t\000\000", 0, 2); n("\000[\000\134\000D\000]\000\000", "\0003\000\000"); x2("\000[\000\134\000s\000]\000\000", "\000 \000\000", 0, 2); n("\000[\000\134\000s\000]\000\000", "\000a\000\000"); x2("\000[\000\134\000S\000]\000\000", "\000b\000\000", 0, 2); n("\000[\000\134\000S\000]\000\000", "\000 \000\000"); x2("\000[\000\134\000w\000\134\000d\000]\000\000", "\0002\000\000", 0, 2); n("\000[\000\134\000w\000\134\000d\000]\000\000", "\000 \000\000"); x2("\000[\000[\000:\000u\000p\000p\000e\000r\000:\000]\000]\000\000", "\000B\000\000", 0, 2); x2("\000[\000*\000[\000:\000x\000d\000i\000g\000i\000t\000:\000]\000+\000]\000\000", "\000+\000\000", 0, 2); x2("\000[\000*\000[\000:\000x\000d\000i\000g\000i\000t\000:\000]\000+\000]\000\000", "\000G\000H\000I\000K\000K\000-\0009\000+\000*\000\000", 12, 14); x2("\000[\000*\000[\000:\000x\000d\000i\000g\000i\000t\000:\000]\000+\000]\000\000", "\000-\000@\000^\000+\000\000", 6, 8); n("\000[\000[\000:\000u\000p\000p\000e\000r\000]\000]\000\000", "\000A\000\000"); x2("\000[\000[\000:\000u\000p\000p\000e\000r\000]\000]\000\000", "\000:\000\000", 0, 2); x2("\000[\000\134\0000\0000\0000\000\134\0000\0004\0004\000-\000\134\0000\0000\0000\000\134\0000\0004\0007\000]\000\000", "\000&\000\000", 0, 2); x2("\000[\000\134\000x\0000\0000\000\134\000x\0005\000a\000-\000\134\000x\0000\0000\000\134\000x\0005\000c\000]\000\000", "\000[\000\000", 0, 2); x2("\000[\000\134\000x\0000\0000\000\134\000x\0006\000A\000-\000\134\000x\0000\0000\000\134\000x\0006\000D\000]\000\000", "\000l\000\000", 0, 2); n("\000[\000\134\000x\0000\0000\000\134\000x\0006\000A\000-\000\134\000x\0000\0000\000\134\000x\0006\000D\000]\000\000", "\000n\000\000"); n("\000^\000[\0000\000-\0009\000A\000-\000F\000]\000+\000 \0000\000+\000 \000U\000N\000D\000E\000F\000 \000\000", "\0007\0005\000F\000 \0000\0000\0000\0000\0000\0000\0000\0000\000 \000S\000E\000C\000T\0001\0004\000A\000 \000n\000o\000t\000y\000p\000e\000 \000(\000)\000 \000 \000 \000 \000E\000x\000t\000e\000r\000n\000a\000l\000 \000 \000 \000 \000|\000 \000_\000r\000b\000_\000a\000p\000p\000l\000y\000\000"); x2("\000[\000\134\000[\000]\000\000", "\000[\000\000", 0, 2); x2("\000[\000\134\000]\000]\000\000", "\000]\000\000", 0, 2); x2("\000[\000&\000]\000\000", "\000&\000\000", 0, 2); x2("\000[\000[\000a\000b\000]\000]\000\000", "\000b\000\000", 0, 2); x2("\000[\000[\000a\000b\000]\000c\000]\000\000", "\000c\000\000", 0, 2); n("\000[\000[\000^\000a\000]\000]\000\000", "\000a\000\000"); n("\000[\000^\000[\000a\000]\000]\000\000", "\000a\000\000"); x2("\000[\000[\000a\000b\000]\000&\000&\000b\000c\000]\000\000", "\000b\000\000", 0, 2); n("\000[\000[\000a\000b\000]\000&\000&\000b\000c\000]\000\000", "\000a\000\000"); n("\000[\000[\000a\000b\000]\000&\000&\000b\000c\000]\000\000", "\000c\000\000"); x2("\000[\000a\000-\000z\000&\000&\000b\000-\000y\000&\000&\000c\000-\000x\000]\000\000", "\000w\000\000", 0, 2); n("\000[\000^\000a\000-\000z\000&\000&\000b\000-\000y\000&\000&\000c\000-\000x\000]\000\000", "\000w\000\000"); x2("\000[\000[\000^\000a\000&\000&\000a\000]\000&\000&\000a\000-\000z\000]\000\000", "\000b\000\000", 0, 2); n("\000[\000[\000^\000a\000&\000&\000a\000]\000&\000&\000a\000-\000z\000]\000\000", "\000a\000\000"); x2("\000[\000[\000^\000a\000-\000z\000&\000&\000b\000c\000d\000e\000f\000]\000&\000&\000[\000^\000c\000-\000g\000]\000]\000\000", "\000h\000\000", 0, 2); n("\000[\000[\000^\000a\000-\000z\000&\000&\000b\000c\000d\000e\000f\000]\000&\000&\000[\000^\000c\000-\000g\000]\000]\000\000", "\000c\000\000"); x2("\000[\000^\000[\000^\000a\000b\000c\000]\000&\000&\000[\000^\000c\000d\000e\000]\000]\000\000", "\000c\000\000", 0, 2); x2("\000[\000^\000[\000^\000a\000b\000c\000]\000&\000&\000[\000^\000c\000d\000e\000]\000]\000\000", "\000e\000\000", 0, 2); n("\000[\000^\000[\000^\000a\000b\000c\000]\000&\000&\000[\000^\000c\000d\000e\000]\000]\000\000", "\000f\000\000"); x2("\000[\000a\000-\000&\000&\000-\000a\000]\000\000", "\000-\000\000", 0, 2); n("\000[\000a\000\134\000-\000&\000&\000\134\000-\000a\000]\000\000", "\000&\000\000"); n("\000\134\000w\000a\000b\000c\000\000", "\000 \000a\000b\000c\000\000"); x2("\000a\000\134\000W\000b\000c\000\000", "\000a\000 \000b\000c\000\000", 0, 8); x2("\000a\000.\000b\000.\000c\000\000", "\000a\000a\000b\000b\000c\000\000", 0, 10); x2("\000.\000\134\000w\000b\000\134\000W\000.\000.\000c\000\000", "\000a\000b\000b\000 \000b\000c\000c\000\000", 0, 14); x2("\000\134\000s\000\134\000w\000z\000z\000z\000\000", "\000 \000z\000z\000z\000z\000\000", 0, 10); x2("\000a\000a\000.\000b\000\000", "\000a\000a\000b\000b\000\000", 0, 8); n("\000.\000a\000\000", "\000a\000b\000\000"); x2("\000.\000a\000\000", "\000a\000a\000\000", 0, 4); x2("\000^\000a\000\000", "\000a\000\000", 0, 2); x2("\000^\000a\000$\000\000", "\000a\000\000", 0, 2); x2("\000^\000\134\000w\000$\000\000", "\000a\000\000", 0, 2); n("\000^\000\134\000w\000$\000\000", "\000 \000\000"); x2("\000^\000\134\000w\000a\000b\000$\000\000", "\000z\000a\000b\000\000", 0, 6); x2("\000^\000\134\000w\000a\000b\000c\000d\000e\000f\000$\000\000", "\000z\000a\000b\000c\000d\000e\000f\000\000", 0, 14); x2("\000^\000\134\000w\000.\000.\000.\000d\000e\000f\000$\000\000", "\000z\000a\000b\000c\000d\000e\000f\000\000", 0, 14); x2("\000\134\000w\000\134\000w\000\134\000s\000\134\000W\000a\000a\000a\000\134\000d\000\000", "\000a\000a\000 \000 \000a\000a\000a\0004\000\000", 0, 16); x2("\000\134\000A\000\134\000Z\000\000", "\000\000", 0, 0); x2("\000\134\000A\000x\000y\000z\000\000", "\000x\000y\000z\000\000", 0, 6); x2("\000x\000y\000z\000\134\000Z\000\000", "\000x\000y\000z\000\000", 0, 6); x2("\000x\000y\000z\000\134\000z\000\000", "\000x\000y\000z\000\000", 0, 6); x2("\000a\000\134\000Z\000\000", "\000a\000\000", 0, 2); x2("\000\134\000G\000a\000z\000\000", "\000a\000z\000\000", 0, 4); n("\000\134\000G\000z\000\000", "\000b\000z\000a\000\000"); n("\000a\000z\000\134\000G\000\000", "\000a\000z\000\000"); n("\000a\000z\000\134\000A\000\000", "\000a\000z\000\000"); n("\000a\000\134\000A\000z\000\000", "\000a\000z\000\000"); x2("\000\134\000^\000\134\000$\000\000", "\000^\000$\000\000", 0, 4); x2("\000^\000x\000?\000y\000\000", "\000x\000y\000\000", 0, 4); x2("\000^\000(\000x\000?\000y\000)\000\000", "\000x\000y\000\000", 0, 4); x2("\000\134\000w\000\000", "\000_\000\000", 0, 2); n("\000\134\000W\000\000", "\000_\000\000"); x2("\000(\000?\000=\000z\000)\000z\000\000", "\000z\000\000", 0, 2); n("\000(\000?\000=\000z\000)\000.\000\000", "\000a\000\000"); x2("\000(\000?\000!\000z\000)\000a\000\000", "\000a\000\000", 0, 2); n("\000(\000?\000!\000z\000)\000a\000\000", "\000z\000\000"); x2("\000(\000?\000i\000:\000a\000)\000\000", "\000a\000\000", 0, 2); x2("\000(\000?\000i\000:\000a\000)\000\000", "\000A\000\000", 0, 2); x2("\000(\000?\000i\000:\000A\000)\000\000", "\000a\000\000", 0, 2); n("\000(\000?\000i\000:\000A\000)\000\000", "\000b\000\000"); x2("\000(\000?\000i\000:\000[\000A\000-\000Z\000]\000)\000\000", "\000a\000\000", 0, 2); x2("\000(\000?\000i\000:\000[\000f\000-\000m\000]\000)\000\000", "\000H\000\000", 0, 2); x2("\000(\000?\000i\000:\000[\000f\000-\000m\000]\000)\000\000", "\000h\000\000", 0, 2); n("\000(\000?\000i\000:\000[\000f\000-\000m\000]\000)\000\000", "\000e\000\000"); x2("\000(\000?\000i\000:\000[\000A\000-\000c\000]\000)\000\000", "\000D\000\000", 0, 2); n("\000(\000?\000i\000:\000[\000^\000a\000-\000z\000]\000)\000\000", "\000A\000\000"); n("\000(\000?\000i\000:\000[\000^\000a\000-\000z\000]\000)\000\000", "\000a\000\000"); x2("\000(\000?\000i\000:\000[\000!\000-\000k\000]\000)\000\000", "\000Z\000\000", 0, 2); x2("\000(\000?\000i\000:\000[\000!\000-\000k\000]\000)\000\000", "\0007\000\000", 0, 2); x2("\000(\000?\000i\000:\000[\000T\000-\000}\000]\000)\000\000", "\000b\000\000", 0, 2); x2("\000(\000?\000i\000:\000[\000T\000-\000}\000]\000)\000\000", "\000{\000\000", 0, 2); x2("\000(\000?\000i\000:\000\134\000?\000a\000)\000\000", "\000?\000A\000\000", 0, 4); x2("\000(\000?\000i\000:\000\134\000*\000A\000)\000\000", "\000*\000a\000\000", 0, 4); n("\000.\000\000", "\000\012\000\000"); x2("\000(\000?\000m\000:\000.\000)\000\000", "\000\012\000\000", 0, 2); x2("\000(\000?\000m\000:\000a\000.\000)\000\000", "\000a\000\012\000\000", 0, 4); x2("\000(\000?\000m\000:\000.\000b\000)\000\000", "\000a\000\012\000b\000\000", 2, 6); x2("\000.\000*\000a\000b\000c\000\000", "\000d\000d\000d\000a\000b\000d\000d\000\012\000d\000d\000a\000b\000c\000\000", 16, 26); x2("\000(\000?\000m\000:\000.\000*\000a\000b\000c\000)\000\000", "\000d\000d\000d\000a\000b\000d\000d\000a\000b\000c\000\000", 0, 20); n("\000(\000?\000i\000)\000(\000?\000-\000i\000)\000a\000\000", "\000A\000\000"); n("\000(\000?\000i\000)\000(\000?\000-\000i\000:\000a\000)\000\000", "\000A\000\000"); x2("\000a\000?\000\000", "\000\000", 0, 0); x2("\000a\000?\000\000", "\000b\000\000", 0, 0); x2("\000a\000?\000\000", "\000a\000\000", 0, 2); x2("\000a\000*\000\000", "\000\000", 0, 0); x2("\000a\000*\000\000", "\000a\000\000", 0, 2); x2("\000a\000*\000\000", "\000a\000a\000a\000\000", 0, 6); x2("\000a\000*\000\000", "\000b\000a\000a\000a\000a\000\000", 0, 0); n("\000a\000+\000\000", "\000\000"); x2("\000a\000+\000\000", "\000a\000\000", 0, 2); x2("\000a\000+\000\000", "\000a\000a\000a\000a\000\000", 0, 8); x2("\000a\000+\000\000", "\000a\000a\000b\000b\000b\000\000", 0, 4); x2("\000a\000+\000\000", "\000b\000a\000a\000a\000a\000\000", 2, 10); x2("\000.\000?\000\000", "\000\000", 0, 0); x2("\000.\000?\000\000", "\000f\000\000", 0, 2); x2("\000.\000?\000\000", "\000\012\000\000", 0, 0); x2("\000.\000*\000\000", "\000\000", 0, 0); x2("\000.\000*\000\000", "\000a\000b\000c\000d\000e\000\000", 0, 10); x2("\000.\000+\000\000", "\000z\000\000", 0, 2); x2("\000.\000+\000\000", "\000z\000d\000s\000w\000e\000r\000\012\000\000", 0, 12); x2("\000(\000.\000*\000)\000a\000\134\0001\000f\000\000", "\000b\000a\000b\000f\000b\000a\000c\000\000", 0, 8); x2("\000(\000.\000*\000)\000a\000\134\0001\000f\000\000", "\000b\000a\000c\000b\000a\000b\000f\000\000", 6, 14); x2("\000(\000(\000.\000*\000)\000a\000\134\0002\000f\000)\000\000", "\000b\000a\000c\000b\000a\000b\000f\000\000", 6, 14); x2("\000(\000.\000*\000)\000a\000\134\0001\000f\000\000", "\000b\000a\000c\000z\000z\000z\000z\000z\000z\000\012\000b\000a\000z\000z\000\012\000z\000z\000z\000z\000b\000a\000b\000f\000\000", 38, 46); x2("\000a\000|\000b\000\000", "\000a\000\000", 0, 2); x2("\000a\000|\000b\000\000", "\000b\000\000", 0, 2); x2("\000|\000a\000\000", "\000a\000\000", 0, 0); x2("\000(\000|\000a\000)\000\000", "\000a\000\000", 0, 0); x2("\000a\000b\000|\000b\000c\000\000", "\000a\000b\000\000", 0, 4); x2("\000a\000b\000|\000b\000c\000\000", "\000b\000c\000\000", 0, 4); x2("\000z\000(\000?\000:\000a\000b\000|\000b\000c\000)\000\000", "\000z\000b\000c\000\000", 0, 6); x2("\000a\000(\000?\000:\000a\000b\000|\000b\000c\000)\000c\000\000", "\000a\000a\000b\000c\000\000", 0, 8); x2("\000a\000b\000|\000(\000?\000:\000a\000c\000|\000a\000z\000)\000\000", "\000a\000z\000\000", 0, 4); x2("\000a\000|\000b\000|\000c\000\000", "\000d\000c\000\000", 2, 4); x2("\000a\000|\000b\000|\000c\000d\000|\000e\000f\000g\000|\000h\000|\000i\000j\000k\000|\000l\000m\000n\000|\000o\000|\000p\000q\000|\000r\000s\000t\000u\000v\000w\000x\000|\000y\000z\000\000", "\000p\000q\000r\000\000", 0, 4); n("\000a\000|\000b\000|\000c\000d\000|\000e\000f\000g\000|\000h\000|\000i\000j\000k\000|\000l\000m\000n\000|\000o\000|\000p\000q\000|\000r\000s\000t\000u\000v\000w\000x\000|\000y\000z\000\000", "\000m\000n\000\000"); x2("\000a\000|\000^\000z\000\000", "\000b\000a\000\000", 2, 4); x2("\000a\000|\000^\000z\000\000", "\000z\000a\000\000", 0, 2); x2("\000a\000|\000\134\000G\000z\000\000", "\000b\000z\000a\000\000", 4, 6); x2("\000a\000|\000\134\000G\000z\000\000", "\000z\000a\000\000", 0, 2); x2("\000a\000|\000\134\000A\000z\000\000", "\000b\000z\000a\000\000", 4, 6); x2("\000a\000|\000\134\000A\000z\000\000", "\000z\000a\000\000", 0, 2); x2("\000a\000|\000b\000\134\000Z\000\000", "\000b\000a\000\000", 2, 4); x2("\000a\000|\000b\000\134\000Z\000\000", "\000b\000\000", 0, 2); x2("\000a\000|\000b\000\134\000z\000\000", "\000b\000a\000\000", 2, 4); x2("\000a\000|\000b\000\134\000z\000\000", "\000b\000\000", 0, 2); x2("\000\134\000w\000|\000\134\000s\000\000", "\000 \000\000", 0, 2); n("\000\134\000w\000|\000\134\000w\000\000", "\000 \000\000"); x2("\000\134\000w\000|\000%\000\000", "\000%\000\000", 0, 2); x2("\000\134\000w\000|\000[\000&\000$\000]\000\000", "\000&\000\000", 0, 2); x2("\000[\000b\000-\000d\000]\000|\000[\000^\000e\000-\000z\000]\000\000", "\000a\000\000", 0, 2); x2("\000(\000?\000:\000a\000|\000[\000c\000-\000f\000]\000)\000|\000b\000z\000\000", "\000d\000z\000\000", 0, 2); x2("\000(\000?\000:\000a\000|\000[\000c\000-\000f\000]\000)\000|\000b\000z\000\000", "\000b\000z\000\000", 0, 4); x2("\000a\000b\000c\000|\000(\000?\000=\000z\000z\000)\000.\000.\000f\000\000", "\000z\000z\000f\000\000", 0, 6); x2("\000a\000b\000c\000|\000(\000?\000!\000z\000z\000)\000.\000.\000f\000\000", "\000a\000b\000f\000\000", 0, 6); x2("\000(\000?\000=\000z\000a\000)\000.\000.\000a\000|\000(\000?\000=\000z\000z\000)\000.\000.\000a\000\000", "\000z\000z\000a\000\000", 0, 6); n("\000(\000?\000>\000a\000|\000a\000b\000d\000)\000c\000\000", "\000a\000b\000d\000c\000\000"); x2("\000(\000?\000>\000a\000b\000d\000|\000a\000)\000c\000\000", "\000a\000b\000d\000c\000\000", 0, 8); x2("\000a\000?\000|\000b\000\000", "\000a\000\000", 0, 2); x2("\000a\000?\000|\000b\000\000", "\000b\000\000", 0, 0); x2("\000a\000?\000|\000b\000\000", "\000\000", 0, 0); x2("\000a\000*\000|\000b\000\000", "\000a\000a\000\000", 0, 4); x2("\000a\000*\000|\000b\000*\000\000", "\000b\000a\000\000", 0, 0); x2("\000a\000*\000|\000b\000*\000\000", "\000a\000b\000\000", 0, 2); x2("\000a\000+\000|\000b\000*\000\000", "\000\000", 0, 0); x2("\000a\000+\000|\000b\000*\000\000", "\000b\000b\000b\000\000", 0, 6); x2("\000a\000+\000|\000b\000*\000\000", "\000a\000b\000b\000b\000\000", 0, 2); n("\000a\000+\000|\000b\000+\000\000", "\000\000"); x2("\000(\000a\000|\000b\000)\000?\000\000", "\000b\000\000", 0, 2); x2("\000(\000a\000|\000b\000)\000*\000\000", "\000b\000a\000\000", 0, 4); x2("\000(\000a\000|\000b\000)\000+\000\000", "\000b\000a\000b\000\000", 0, 6); x2("\000(\000a\000b\000|\000c\000a\000)\000+\000\000", "\000c\000a\000a\000b\000b\000c\000\000", 0, 8); x2("\000(\000a\000b\000|\000c\000a\000)\000+\000\000", "\000a\000a\000b\000c\000a\000\000", 2, 10); x2("\000(\000a\000b\000|\000c\000a\000)\000+\000\000", "\000a\000b\000z\000c\000a\000\000", 0, 4); x2("\000(\000a\000|\000b\000a\000b\000)\000+\000\000", "\000a\000b\000a\000b\000a\000\000", 0, 10); x2("\000(\000a\000|\000b\000a\000b\000)\000+\000\000", "\000b\000a\000\000", 2, 4); x2("\000(\000a\000|\000b\000a\000b\000)\000+\000\000", "\000b\000a\000a\000a\000b\000a\000\000", 2, 8); x2("\000(\000?\000:\000a\000|\000b\000)\000(\000?\000:\000a\000|\000b\000)\000\000", "\000a\000b\000\000", 0, 4); x2("\000(\000?\000:\000a\000*\000|\000b\000*\000)\000(\000?\000:\000a\000*\000|\000b\000*\000)\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 6); x2("\000(\000?\000:\000a\000*\000|\000b\000*\000)\000(\000?\000:\000a\000+\000|\000b\000+\000)\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 12); x2("\000(\000?\000:\000a\000+\000|\000b\000+\000)\000{\0002\000}\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 12); x2("\000h\000{\0000\000,\000}\000\000", "\000h\000h\000h\000h\000\000", 0, 8); x2("\000(\000?\000:\000a\000+\000|\000b\000+\000)\000{\0001\000,\0002\000}\000\000", "\000a\000a\000a\000b\000b\000b\000\000", 0, 12); n("\000a\000x\000{\0002\000}\000*\000a\000\000", "\0000\000a\000x\000x\000x\000a\0001\000\000"); n("\000a\000.\000{\0000\000,\0002\000}\000a\000\000", "\0000\000a\000X\000X\000X\000a\0000\000\000"); n("\000a\000.\000{\0000\000,\0002\000}\000?\000a\000\000", "\0000\000a\000X\000X\000X\000a\0000\000\000"); n("\000a\000.\000{\0000\000,\0002\000}\000?\000a\000\000", "\0000\000a\000X\000X\000X\000X\000a\0000\000\000"); x2("\000^\000a\000{\0002\000,\000}\000?\000a\000$\000\000", "\000a\000a\000a\000\000", 0, 6); x2("\000^\000[\000a\000-\000z\000]\000{\0002\000,\000}\000?\000$\000\000", "\000a\000a\000a\000\000", 0, 6); x2("\000(\000?\000:\000a\000+\000|\000\134\000A\000b\000*\000)\000c\000c\000\000", "\000c\000c\000\000", 0, 4); n("\000(\000?\000:\000a\000+\000|\000\134\000A\000b\000*\000)\000c\000c\000\000", "\000a\000b\000c\000c\000\000"); x2("\000(\000?\000:\000^\000a\000+\000|\000b\000+\000)\000*\000c\000\000", "\000a\000a\000b\000b\000b\000a\000b\000c\000\000", 12, 16); x2("\000(\000?\000:\000^\000a\000+\000|\000b\000+\000)\000*\000c\000\000", "\000a\000a\000b\000b\000b\000b\000c\000\000", 0, 14); x2("\000a\000|\000(\000?\000i\000)\000c\000\000", "\000C\000\000", 0, 2); x2("\000(\000?\000i\000)\000c\000|\000a\000\000", "\000C\000\000", 0, 2); x2("\000(\000?\000i\000)\000c\000|\000a\000\000", "\000A\000\000", 0, 2); x2("\000(\000?\000i\000:\000c\000)\000|\000a\000\000", "\000C\000\000", 0, 2); n("\000(\000?\000i\000:\000c\000)\000|\000a\000\000", "\000A\000\000"); x2("\000[\000a\000b\000c\000]\000?\000\000", "\000a\000b\000c\000\000", 0, 2); x2("\000[\000a\000b\000c\000]\000*\000\000", "\000a\000b\000c\000\000", 0, 6); x2("\000[\000^\000a\000b\000c\000]\000*\000\000", "\000a\000b\000c\000\000", 0, 0); n("\000[\000^\000a\000b\000c\000]\000+\000\000", "\000a\000b\000c\000\000"); x2("\000a\000?\000?\000\000", "\000a\000a\000a\000\000", 0, 0); x2("\000b\000a\000?\000?\000b\000\000", "\000b\000a\000b\000\000", 0, 6); x2("\000a\000*\000?\000\000", "\000a\000a\000a\000\000", 0, 0); x2("\000b\000a\000*\000?\000\000", "\000b\000a\000a\000\000", 0, 2); x2("\000b\000a\000*\000?\000b\000\000", "\000b\000a\000a\000b\000\000", 0, 8); x2("\000a\000+\000?\000\000", "\000a\000a\000a\000\000", 0, 2); x2("\000b\000a\000+\000?\000\000", "\000b\000a\000a\000\000", 0, 4); x2("\000b\000a\000+\000?\000b\000\000", "\000b\000a\000a\000b\000\000", 0, 8); x2("\000(\000?\000:\000a\000?\000)\000?\000?\000\000", "\000a\000\000", 0, 0); x2("\000(\000?\000:\000a\000?\000?\000)\000?\000\000", "\000a\000\000", 0, 0); x2("\000(\000?\000:\000a\000?\000)\000+\000?\000\000", "\000a\000a\000a\000\000", 0, 2); x2("\000(\000?\000:\000a\000+\000)\000?\000?\000\000", "\000a\000a\000a\000\000", 0, 0); x2("\000(\000?\000:\000a\000+\000)\000?\000?\000b\000\000", "\000a\000a\000a\000b\000\000", 0, 8); x2("\000(\000?\000:\000a\000b\000)\000?\000{\0002\000}\000\000", "\000\000", 0, 0); x2("\000(\000?\000:\000a\000b\000)\000?\000{\0002\000}\000\000", "\000a\000b\000a\000b\000a\000\000", 0, 8); x2("\000(\000?\000:\000a\000b\000)\000*\000{\0000\000}\000\000", "\000a\000b\000a\000b\000a\000\000", 0, 0); x2("\000(\000?\000:\000a\000b\000)\000{\0003\000,\000}\000\000", "\000a\000b\000a\000b\000a\000b\000a\000b\000\000", 0, 16); n("\000(\000?\000:\000a\000b\000)\000{\0003\000,\000}\000\000", "\000a\000b\000a\000b\000\000"); x2("\000(\000?\000:\000a\000b\000)\000{\0002\000,\0004\000}\000\000", "\000a\000b\000a\000b\000a\000b\000\000", 0, 12); x2("\000(\000?\000:\000a\000b\000)\000{\0002\000,\0004\000}\000\000", "\000a\000b\000a\000b\000a\000b\000a\000b\000a\000b\000\000", 0, 16); x2("\000(\000?\000:\000a\000b\000)\000{\0002\000,\0004\000}\000?\000\000", "\000a\000b\000a\000b\000a\000b\000a\000b\000a\000b\000\000", 0, 8); x2("\000(\000?\000:\000a\000b\000)\000{\000,\000}\000\000", "\000a\000b\000{\000,\000}\000\000", 0, 10); x2("\000(\000?\000:\000a\000b\000c\000)\000+\000?\000{\0002\000}\000\000", "\000a\000b\000c\000a\000b\000c\000a\000b\000c\000\000", 0, 12); x2("\000(\000?\000:\000X\000*\000)\000(\000?\000i\000:\000x\000a\000)\000\000", "\000X\000X\000X\000a\000\000", 0, 8); x2("\000(\000d\000+\000)\000(\000[\000^\000a\000b\000c\000]\000z\000)\000\000", "\000d\000d\000d\000z\000\000", 0, 8); x2("\000(\000[\000^\000a\000b\000c\000]\000*\000)\000(\000[\000^\000a\000b\000c\000]\000z\000)\000\000", "\000d\000d\000d\000z\000\000", 0, 8); x2("\000(\000\134\000w\000+\000)\000(\000\134\000w\000z\000)\000\000", "\000d\000d\000d\000z\000\000", 0, 8); x3("\000(\000a\000)\000\000", "\000a\000\000", 0, 2, 1); x3("\000(\000a\000b\000)\000\000", "\000a\000b\000\000", 0, 4, 1); x2("\000(\000(\000a\000b\000)\000)\000\000", "\000a\000b\000\000", 0, 4); x3("\000(\000(\000a\000b\000)\000)\000\000", "\000a\000b\000\000", 0, 4, 1); x3("\000(\000(\000a\000b\000)\000)\000\000", "\000a\000b\000\000", 0, 4, 2); x3("\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000a\000b\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000\000", "\000a\000b\000\000", 0, 4, 20); x3("\000(\000a\000b\000)\000(\000c\000d\000)\000\000", "\000a\000b\000c\000d\000\000", 0, 4, 1); x3("\000(\000a\000b\000)\000(\000c\000d\000)\000\000", "\000a\000b\000c\000d\000\000", 4, 8, 2); x3("\000(\000)\000(\000a\000)\000b\000c\000(\000d\000e\000f\000)\000g\000h\000i\000j\000k\000\000", "\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000\000", 6, 12, 3); x3("\000(\000(\000)\000(\000a\000)\000b\000c\000(\000d\000e\000f\000)\000g\000h\000i\000j\000k\000)\000\000", "\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000\000", 6, 12, 4); x2("\000(\000^\000a\000)\000\000", "\000a\000\000", 0, 2); x3("\000(\000a\000)\000|\000(\000a\000)\000\000", "\000b\000a\000\000", 2, 4, 1); x3("\000(\000^\000a\000)\000|\000(\000a\000)\000\000", "\000b\000a\000\000", 2, 4, 2); x3("\000(\000a\000?\000)\000\000", "\000a\000a\000a\000\000", 0, 2, 1); x3("\000(\000a\000*\000)\000\000", "\000a\000a\000a\000\000", 0, 6, 1); x3("\000(\000a\000*\000)\000\000", "\000\000", 0, 0, 1); x3("\000(\000a\000+\000)\000\000", "\000a\000a\000a\000a\000a\000a\000a\000\000", 0, 14, 1); x3("\000(\000a\000+\000|\000b\000*\000)\000\000", "\000b\000b\000b\000a\000a\000\000", 0, 6, 1); x3("\000(\000a\000+\000|\000b\000?\000)\000\000", "\000b\000b\000b\000a\000a\000\000", 0, 2, 1); x3("\000(\000a\000b\000c\000)\000?\000\000", "\000a\000b\000c\000\000", 0, 6, 1); x3("\000(\000a\000b\000c\000)\000*\000\000", "\000a\000b\000c\000\000", 0, 6, 1); x3("\000(\000a\000b\000c\000)\000+\000\000", "\000a\000b\000c\000\000", 0, 6, 1); x3("\000(\000x\000y\000z\000|\000a\000b\000c\000)\000+\000\000", "\000a\000b\000c\000\000", 0, 6, 1); x3("\000(\000[\000x\000y\000z\000]\000[\000a\000b\000c\000]\000|\000a\000b\000c\000)\000+\000\000", "\000a\000b\000c\000\000", 0, 6, 1); x3("\000(\000(\000?\000i\000:\000a\000b\000c\000)\000)\000\000", "\000A\000b\000C\000\000", 0, 6, 1); x2("\000(\000a\000b\000c\000)\000(\000?\000i\000:\000\134\0001\000)\000\000", "\000a\000b\000c\000A\000B\000C\000\000", 0, 12); x3("\000(\000(\000?\000m\000:\000a\000.\000c\000)\000)\000\000", "\000a\000\012\000c\000\000", 0, 6, 1); x3("\000(\000(\000?\000=\000a\000z\000)\000a\000)\000\000", "\000a\000z\000b\000\000", 0, 2, 1); x3("\000a\000b\000c\000|\000(\000.\000a\000b\000d\000)\000\000", "\000z\000a\000b\000d\000\000", 0, 8, 1); x2("\000(\000?\000:\000a\000b\000c\000)\000|\000(\000A\000B\000C\000)\000\000", "\000a\000b\000c\000\000", 0, 6); x3("\000(\000?\000i\000:\000(\000a\000b\000c\000)\000)\000|\000(\000z\000z\000z\000)\000\000", "\000A\000B\000C\000\000", 0, 6, 1); x3("\000a\000*\000(\000.\000)\000\000", "\000a\000a\000a\000a\000z\000\000", 8, 10, 1); x3("\000a\000*\000?\000(\000.\000)\000\000", "\000a\000a\000a\000a\000z\000\000", 0, 2, 1); x3("\000a\000*\000?\000(\000c\000)\000\000", "\000a\000a\000a\000a\000c\000\000", 8, 10, 1); x3("\000[\000b\000c\000d\000]\000a\000*\000(\000.\000)\000\000", "\000c\000a\000a\000a\000a\000z\000\000", 10, 12, 1); x3("\000(\000\134\000A\000b\000b\000)\000c\000c\000\000", "\000b\000b\000c\000c\000\000", 0, 4, 1); n("\000(\000\134\000A\000b\000b\000)\000c\000c\000\000", "\000z\000b\000b\000c\000c\000\000"); x3("\000(\000^\000b\000b\000)\000c\000c\000\000", "\000b\000b\000c\000c\000\000", 0, 4, 1); n("\000(\000^\000b\000b\000)\000c\000c\000\000", "\000z\000b\000b\000c\000c\000\000"); x3("\000c\000c\000(\000b\000b\000$\000)\000\000", "\000c\000c\000b\000b\000\000", 4, 8, 1); n("\000c\000c\000(\000b\000b\000$\000)\000\000", "\000c\000c\000b\000b\000b\000\000"); n("\000(\000\134\0001\000)\000\000", "\000\000"); n("\000\134\0001\000(\000a\000)\000\000", "\000a\000a\000\000"); n("\000(\000a\000(\000b\000)\000\134\0001\000)\000\134\0002\000+\000\000", "\000a\000b\000a\000b\000b\000\000"); n("\000(\000?\000:\000(\000?\000:\000\134\0001\000|\000z\000)\000(\000a\000)\000)\000+\000$\000\000", "\000z\000a\000a\000\000"); x2("\000(\000?\000:\000(\000?\000:\000\134\0001\000|\000z\000)\000(\000a\000)\000)\000+\000$\000\000", "\000z\000a\000a\000a\000\000", 0, 8); x2("\000(\000a\000)\000(\000?\000=\000\134\0001\000)\000\000", "\000a\000a\000\000", 0, 2); n("\000(\000a\000)\000$\000|\000\134\0001\000\000", "\000a\000z\000\000"); x2("\000(\000a\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 4); n("\000(\000a\000)\000\134\0001\000\000", "\000a\000b\000\000"); x2("\000(\000a\000?\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 4); x2("\000(\000a\000?\000?\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 0); x2("\000(\000a\000*\000)\000\134\0001\000\000", "\000a\000a\000a\000a\000a\000\000", 0, 8); x3("\000(\000a\000*\000)\000\134\0001\000\000", "\000a\000a\000a\000a\000a\000\000", 0, 4, 1); x2("\000a\000(\000b\000*\000)\000\134\0001\000\000", "\000a\000b\000b\000b\000b\000\000", 0, 10); x2("\000a\000(\000b\000*\000)\000\134\0001\000\000", "\000a\000b\000\000", 0, 2); x2("\000(\000a\000*\000)\000(\000b\000*\000)\000\134\0001\000\134\0002\000\000", "\000a\000a\000a\000b\000b\000a\000a\000a\000b\000b\000\000", 0, 20); x2("\000(\000a\000*\000)\000(\000b\000*\000)\000\134\0002\000\000", "\000a\000a\000a\000b\000b\000b\000b\000\000", 0, 14); x2("\000(\000(\000(\000(\000(\000(\000(\000a\000*\000)\000b\000)\000)\000)\000)\000)\000)\000c\000\134\0007\000\000", "\000a\000a\000a\000b\000c\000a\000a\000a\000\000", 0, 16); x3("\000(\000(\000(\000(\000(\000(\000(\000a\000*\000)\000b\000)\000)\000)\000)\000)\000)\000c\000\134\0007\000\000", "\000a\000a\000a\000b\000c\000a\000a\000a\000\000", 0, 6, 7); x2("\000(\000a\000)\000(\000b\000)\000(\000c\000)\000\134\0002\000\134\0001\000\134\0003\000\000", "\000a\000b\000c\000b\000a\000c\000\000", 0, 12); x2("\000(\000[\000a\000-\000d\000]\000)\000\134\0001\000\000", "\000c\000c\000\000", 0, 4); x2("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "\000f\0005\000 \000f\0005\000 \000\000", 0, 12); n("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "\000f\0005\000 \000f\0005\000\000"); x2("\000(\000w\000h\000o\000|\000[\000a\000-\000c\000]\000{\0003\000}\000)\000\134\0001\000\000", "\000w\000h\000o\000w\000h\000o\000\000", 0, 12); x2("\000.\000.\000.\000(\000w\000h\000o\000|\000[\000a\000-\000c\000]\000{\0003\000}\000)\000\134\0001\000\000", "\000a\000b\000c\000w\000h\000o\000w\000h\000o\000\000", 0, 18); x2("\000(\000w\000h\000o\000|\000[\000a\000-\000c\000]\000{\0003\000}\000)\000\134\0001\000\000", "\000c\000b\000c\000c\000b\000c\000\000", 0, 12); x2("\000(\000^\000a\000)\000\134\0001\000\000", "\000a\000a\000\000", 0, 4); n("\000(\000^\000a\000)\000\134\0001\000\000", "\000b\000a\000a\000\000"); n("\000(\000a\000$\000)\000\134\0001\000\000", "\000a\000a\000\000"); n("\000(\000a\000b\000\134\000Z\000)\000\134\0001\000\000", "\000a\000b\000\000"); x2("\000(\000a\000*\000\134\000Z\000)\000\134\0001\000\000", "\000a\000\000", 2, 2); x2("\000.\000(\000a\000*\000\134\000Z\000)\000\134\0001\000\000", "\000b\000a\000\000", 2, 4); x3("\000(\000.\000(\000a\000b\000c\000)\000\134\0002\000)\000\000", "\000z\000a\000b\000c\000a\000b\000c\000\000", 0, 14, 1); x3("\000(\000.\000(\000.\000.\000\134\000d\000.\000)\000\134\0002\000)\000\000", "\000z\0001\0002\0003\0004\0001\0002\0003\0004\000\000", 0, 18, 1); x2("\000(\000(\000?\000i\000:\000a\000z\000)\000)\000\134\0001\000\000", "\000A\000z\000A\000z\000\000", 0, 8); n("\000(\000(\000?\000i\000:\000a\000z\000)\000)\000\134\0001\000\000", "\000A\000z\000a\000z\000\000"); x2("\000(\000?\000<\000=\000a\000)\000b\000\000", "\000a\000b\000\000", 2, 4); n("\000(\000?\000<\000=\000a\000)\000b\000\000", "\000b\000b\000\000"); x2("\000(\000?\000<\000=\000a\000|\000b\000)\000b\000\000", "\000b\000b\000\000", 2, 4); x2("\000(\000?\000<\000=\000a\000|\000b\000c\000)\000b\000\000", "\000b\000c\000b\000\000", 4, 6); x2("\000(\000?\000<\000=\000a\000|\000b\000c\000)\000b\000\000", "\000a\000b\000\000", 2, 4); x2("\000(\000?\000<\000=\000a\000|\000b\000c\000|\000|\000d\000e\000f\000g\000h\000i\000j\000|\000k\000l\000m\000n\000o\000p\000q\000|\000r\000)\000z\000\000", "\000r\000z\000\000", 2, 4); x2("\000(\000a\000)\000\134\000g\000<\0001\000>\000\000", "\000a\000a\000\000", 0, 4); x2("\000(\000?\000<\000!\000a\000)\000b\000\000", "\000c\000b\000\000", 2, 4); n("\000(\000?\000<\000!\000a\000)\000b\000\000", "\000a\000b\000\000"); x2("\000(\000?\000<\000!\000a\000|\000b\000c\000)\000b\000\000", "\000b\000b\000b\000\000", 0, 2); n("\000(\000?\000<\000!\000a\000|\000b\000c\000)\000z\000\000", "\000b\000c\000z\000\000"); x2("\000(\000?\000<\000n\000a\000m\000e\0001\000>\000a\000)\000\000", "\000a\000\000", 0, 2); x2("\000(\000?\000<\000n\000a\000m\000e\000_\0002\000>\000a\000b\000)\000\134\000g\000<\000n\000a\000m\000e\000_\0002\000>\000\000", "\000a\000b\000a\000b\000\000", 0, 8); x2("\000(\000?\000<\000n\000a\000m\000e\000_\0003\000>\000.\000z\000v\000.\000)\000\134\000k\000<\000n\000a\000m\000e\000_\0003\000>\000\000", "\000a\000z\000v\000b\000a\000z\000v\000b\000\000", 0, 16); x2("\000(\000?\000<\000=\000\134\000g\000<\000a\000b\000>\000)\000|\000-\000\134\000z\000E\000N\000D\000 \000(\000?\000<\000a\000b\000>\000X\000y\000Z\000)\000\000", "\000X\000y\000Z\000\000", 6, 6); x2("\000(\000?\000<\000n\000>\000|\000a\000\134\000g\000<\000n\000>\000)\000+\000\000", "\000\000", 0, 0); x2("\000(\000?\000<\000n\000>\000|\000\134\000(\000\134\000g\000<\000n\000>\000\134\000)\000)\000+\000$\000\000", "\000(\000)\000(\000(\000)\000)\000\000", 0, 12); x3("\000\134\000g\000<\000n\000>\000(\000?\000<\000n\000>\000.\000)\000{\0000\000}\000\000", "\000X\000\000", 0, 2, 1); x2("\000\134\000g\000<\000n\000>\000(\000a\000b\000c\000|\000d\000f\000(\000?\000<\000n\000>\000.\000Y\000Z\000)\000{\0002\000,\0008\000}\000)\000{\0000\000}\000\000", "\000X\000Y\000Z\000\000", 0, 6); x2("\000\134\000A\000(\000?\000<\000n\000>\000(\000a\000\134\000g\000<\000n\000>\000)\000|\000)\000\134\000z\000\000", "\000a\000a\000a\000a\000\000", 0, 8); x2("\000(\000?\000<\000n\000>\000|\000\134\000g\000<\000m\000>\000\134\000g\000<\000n\000>\000)\000\134\000z\000|\000\134\000z\000E\000N\000D\000 \000(\000?\000<\000m\000>\000a\000|\000(\000b\000)\000\134\000g\000<\000m\000>\000)\000\000", "\000b\000b\000b\000b\000a\000b\000b\000a\000\000", 0, 16); x2("\000(\000?\000<\000n\000a\000m\000e\0001\0002\0004\0000\000>\000\134\000w\000+\000\134\000s\000x\000)\000a\000+\000\134\000k\000<\000n\000a\000m\000e\0001\0002\0004\0000\000>\000\000", "\000 \000 \000f\000g\000 \000x\000a\000a\000a\000a\000a\000a\000a\000a\000f\000g\000 \000x\000\000", 4, 36); x3("\000(\000z\000)\000(\000)\000(\000)\000(\000?\000<\000_\0009\000>\000a\000)\000\134\000g\000<\000_\0009\000>\000\000", "\000z\000a\000a\000\000", 4, 6, 1); x2("\000(\000.\000)\000(\000(\000(\000?\000<\000_\000>\000a\000)\000)\000)\000\134\000k\000<\000_\000>\000\000", "\000z\000a\000a\000\000", 0, 6); x2("\000(\000(\000?\000<\000n\000a\000m\000e\0001\000>\000\134\000d\000)\000|\000(\000?\000<\000n\000a\000m\000e\0002\000>\000\134\000w\000)\000)\000(\000\134\000k\000<\000n\000a\000m\000e\0001\000>\000|\000\134\000k\000<\000n\000a\000m\000e\0002\000>\000)\000\000", "\000f\000f\000\000", 0, 4); x2("\000(\000?\000:\000(\000?\000<\000x\000>\000)\000|\000(\000?\000<\000x\000>\000e\000f\000g\000)\000)\000\134\000k\000<\000x\000>\000\000", "\000\000", 0, 0); x2("\000(\000?\000:\000(\000?\000<\000x\000>\000a\000b\000c\000)\000|\000(\000?\000<\000x\000>\000e\000f\000g\000)\000)\000\134\000k\000<\000x\000>\000\000", "\000a\000b\000c\000e\000f\000g\000e\000f\000g\000\000", 6, 18); n("\000(\000?\000:\000(\000?\000<\000x\000>\000a\000b\000c\000)\000|\000(\000?\000<\000x\000>\000e\000f\000g\000)\000)\000\134\000k\000<\000x\000>\000\000", "\000a\000b\000c\000e\000f\000g\000\000"); x2("\000(\000?\000:\000(\000?\000<\000n\0001\000>\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000)\000\134\000k\000<\000n\0001\000>\000$\000\000", "\000a\000-\000p\000y\000u\000m\000p\000y\000u\000m\000\000", 4, 20); x3("\000(\000?\000:\000(\000?\000<\000n\0001\000>\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000|\000(\000?\000<\000n\0001\000>\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000.\000)\000)\000\134\000k\000<\000n\0001\000>\000$\000\000", "\000x\000x\000x\000x\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000l\000m\000n\000a\000b\000c\000d\000e\000f\000g\000h\000i\000j\000k\000l\000m\000n\000\000", 8, 36, 14); x3("\000(\000?\000<\000n\000a\000m\000e\0001\000>\000)\000(\000?\000<\000n\000a\000m\000e\0002\000>\000)\000(\000?\000<\000n\000a\000m\000e\0003\000>\000)\000(\000?\000<\000n\000a\000m\000e\0004\000>\000)\000(\000?\000<\000n\000a\000m\000e\0005\000>\000)\000(\000?\000<\000n\000a\000m\000e\0006\000>\000)\000(\000?\000<\000n\000a\000m\000e\0007\000>\000)\000(\000?\000<\000n\000a\000m\000e\0008\000>\000)\000(\000?\000<\000n\000a\000m\000e\0009\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0000\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0001\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0002\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0003\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0004\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0005\000>\000)\000(\000?\000<\000n\000a\000m\000e\0001\0006\000>\000a\000a\000a\000)\000(\000?\000<\000n\000a\000m\000e\0001\0007\000>\000)\000$\000\000", "\000a\000a\000a\000\000", 0, 6, 16); x2("\000(\000?\000<\000f\000o\000o\000>\000a\000|\000\134\000(\000\134\000g\000<\000f\000o\000o\000>\000\134\000)\000)\000\000", "\000a\000\000", 0, 2); x2("\000(\000?\000<\000f\000o\000o\000>\000a\000|\000\134\000(\000\134\000g\000<\000f\000o\000o\000>\000\134\000)\000)\000\000", "\000(\000(\000(\000(\000(\000(\000a\000)\000)\000)\000)\000)\000)\000\000", 0, 26); x3("\000(\000?\000<\000f\000o\000o\000>\000a\000|\000\134\000(\000\134\000g\000<\000f\000o\000o\000>\000\134\000)\000)\000\000", "\000(\000(\000(\000(\000(\000(\000(\000(\000a\000)\000)\000)\000)\000)\000)\000)\000)\000\000", 0, 34, 1); x2("\000\134\000g\000<\000b\000a\000r\000>\000|\000\134\000z\000E\000N\000D\000(\000?\000<\000b\000a\000r\000>\000.\000*\000a\000b\000c\000$\000)\000\000", "\000a\000b\000c\000x\000x\000x\000a\000b\000c\000\000", 0, 18); x2("\000\134\000g\000<\0001\000>\000|\000\134\000z\000E\000N\000D\000(\000.\000a\000.\000)\000\000", "\000b\000a\000c\000\000", 0, 6); x3("\000\134\000g\000<\000_\000A\000>\000\134\000g\000<\000_\000A\000>\000|\000\134\000z\000E\000N\000D\000(\000.\000a\000.\000)\000(\000?\000<\000_\000A\000>\000.\000b\000.\000)\000\000", "\000x\000b\000x\000y\000b\000y\000\000", 6, 12, 1); x2("\000\134\000A\000(\000?\000:\000\134\000g\000<\000p\000o\000n\000>\000|\000\134\000g\000<\000p\000a\000n\000>\000|\000\134\000z\000E\000N\000D\000 \000 \000(\000?\000<\000p\000a\000n\000>\000a\000|\000c\000\134\000g\000<\000p\000o\000n\000>\000c\000)\000(\000?\000<\000p\000o\000n\000>\000b\000|\000d\000\134\000g\000<\000p\000a\000n\000>\000d\000)\000)\000$\000\000", "\000c\000d\000c\000b\000c\000d\000c\000\000", 0, 14); x2("\000\134\000A\000(\000?\000<\000n\000>\000|\000a\000\134\000g\000<\000m\000>\000)\000\134\000z\000|\000\134\000z\000E\000N\000D\000 \000(\000?\000<\000m\000>\000\134\000g\000<\000n\000>\000)\000\000", "\000a\000a\000a\000a\000\000", 0, 8); x2("\000(\000?\000<\000n\000>\000(\000a\000|\000b\000\134\000g\000<\000n\000>\000c\000)\000{\0003\000,\0005\000}\000)\000\000", "\000b\000a\000a\000a\000a\000c\000a\000\000", 2, 10); x2("\000(\000?\000<\000n\000>\000(\000a\000|\000b\000\134\000g\000<\000n\000>\000c\000)\000{\0003\000,\0005\000}\000)\000\000", "\000b\000a\000a\000a\000a\000c\000a\000a\000a\000a\000a\000\000", 0, 20); x2("\000(\000?\000<\000p\000a\000r\000e\000>\000\134\000(\000(\000[\000^\000\134\000(\000\134\000)\000]\000+\000+\000|\000\134\000g\000<\000p\000a\000r\000e\000>\000)\000*\000+\000\134\000)\000)\000\000", "\000(\000(\000a\000)\000)\000\000", 0, 10); x2("\000(\000)\000*\000\134\0001\000\000", "\000\000", 0, 0); x2("\000(\000?\000:\000(\000)\000|\000(\000)\000)\000*\000\134\0001\000\134\0002\000\000", "\000\000", 0, 0); x3("\000(\000?\000:\000\134\0001\000a\000|\000(\000)\000)\000*\000\000", "\000a\000\000", 0, 0, 1); x2("\000x\000(\000(\000.\000)\000*\000)\000*\000x\000\000", "\0000\000x\0001\000x\0002\000x\0003\000\000", 2, 12); x2("\000x\000(\000(\000.\000)\000*\000)\000*\000x\000(\000?\000i\000:\000\134\0001\000)\000\134\000Z\000\000", "\0000\000x\0001\000x\0002\000x\0001\000X\0002\000\000", 2, 18); x2("\000(\000?\000:\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000)\000)\000*\000\134\0002\000\134\0005\000\000", "\000\000", 0, 0); x2("\000(\000?\000:\000(\000)\000|\000(\000)\000|\000(\000)\000|\000(\000x\000)\000|\000(\000)\000|\000(\000)\000)\000*\000\134\0002\000b\000\134\0005\000\000", "\000b\000\000", 0, 2); x2("\217\372\000\000", "\217\372\000\000", 0, 2); x2("\000\000", "0B\000\000", 0, 0); x2("0B\000\000", "0B\000\000", 0, 2); n("0D\000\000", "0B\000\000"); x2("0F0F\000\000", "0F0F\000\000", 0, 4); x2("0B0D0F\000\000", "0B0D0F\000\000", 0, 6); x2("0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S\000\000", "0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S0S\000\000", 0, 70); x2("0B\000\000", "0D0B\000\000", 2, 4); x2("0D0F\000\000", "0B0D0F\000\000", 2, 6); x2("e\207\000\000", "e\207\000\000", 0, 2); x2("\000.\000\000", "0B\000\000", 0, 2); x2("\000.\000.\000\000", "0K0M\000\000", 0, 4); x2("\000\134\000w\000\000", "0J\000\000", 0, 2); n("\000\134\000W\000\000", "0B\000\000"); x2("\000[\000\134\000W\000]\000\000", "0F\000$\000\000", 2, 4); x2("\000\134\000S\000\000", "0]\000\000", 0, 2); x2("\000\134\000S\000\000", "o\042\000\000", 0, 2); x2("\000\134\000b\000\000", "l\027\000 \000\000", 0, 0); x2("\000\134\000b\000\000", "\000 0{\000\000", 2, 2); x2("\000\134\000B\000\000", "0[0]\000 \000\000", 2, 2); x2("\000\134\000B\000\000", "0F\000 \000\000", 4, 4); x2("\000\134\000B\000\000", "\000 0D\000\000", 0, 0); x2("\000[0_0a\000]\000\000", "0a\000\000", 0, 2); n("\000[0j0k\000]\000\000", "0l\000\000"); x2("\000[0F\000-0J\000]\000\000", "0H\000\000", 0, 2); n("\000[\000^0Q\000]\000\000", "0Q\000\000"); x2("\000[\000\134\000w\000]\000\000", "0m\000\000", 0, 2); n("\000[\000\134\000d\000]\000\000", "0u\000\000"); x2("\000[\000\134\000D\000]\000\000", "0o\000\000", 0, 2); n("\000[\000\134\000s\000]\000\000", "0O\000\000"); x2("\000[\000\134\000S\000]\000\000", "0x\000\000", 0, 2); x2("\000[\000\134\000w\000\134\000d\000]\000\000", "0\210\000\000", 0, 2); x2("\000[\000\134\000w\000\134\000d\000]\000\000", "\000 \000 \000 0\210\000\000", 6, 8); n("\000\134\000w\233<\216\312\000\000", "\000 \233<\216\312\000\000"); x2("\233<\000\134\000W\216\312\000\000", "\233<\000 \216\312\000\000", 0, 6); x2("0B\000.0D\000.0F\000\000", "0B0B0D0D0F\000\000", 0, 10); x2("\000.\000\134\000w0F\000\134\000W\000.\000.0^\000\000", "0H0F0F\000 0F0^0^\000\000", 0, 14); x2("\000\134\000s\000\134\000w0S0S0S\000\000", "\000 0S0S0S0S\000\000", 0, 10); x2("0B0B\000.0Q\000\000", "0B0B0Q0Q\000\000", 0, 8); n("\000.0D\000\000", "0D0H\000\000"); x2("\000.0J\000\000", "0J0J\000\000", 0, 4); x2("\000^0B\000\000", "0B\000\000", 0, 2); x2("\000^0\200\000$\000\000", "0\200\000\000", 0, 2); x2("\000^\000\134\000w\000$\000\000", "0k\000\000", 0, 2); x2("\000^\000\134\000w0K0M0O0Q0S\000$\000\000", "\000z0K0M0O0Q0S\000\000", 0, 12); x2("\000^\000\134\000w\000.\000.\000.0F0H0J\000$\000\000", "\000z0B0D0F0F0H0J\000\000", 0, 14); x2("\000\134\000w\000\134\000w\000\134\000s\000\134\000W0J0J0J\000\134\000d\000\000", "\000a0J\000 \000 0J0J0J\0004\000\000", 0, 16); x2("\000\134\000A0_0a0d\000\000", "0_0a0d\000\000", 0, 6); x2("0\2000\2010\202\000\134\000Z\000\000", "0\2000\2010\202\000\000", 0, 6); x2("0K0M0O\000\134\000z\000\000", "0K0M0O\000\000", 0, 6); x2("0K0M0O\000\134\000Z\000\000", "0K0M0O\000\012\000\000", 0, 6); x2("\000\134\000G0}0t\000\000", "0}0t\000\000", 0, 4); n("\000\134\000G0H\000\000", "0F0H0J\000\000"); n("0h0f\000\134\000G\000\000", "0h0f\000\000"); n("0~0\177\000\134\000A\000\000", "0~0\177\000\000"); n("0~\000\134\000A0\177\000\000", "0~0\177\000\000"); x2("\000(\000?\000=0[\000)0[\000\000", "0[\000\000", 0, 2); n("\000(\000?\000=0F\000)\000.\000\000", "0D\000\000"); x2("\000(\000?\000!0F\000)0K\000\000", "0K\000\000", 0, 2); n("\000(\000?\000!0h\000)0B\000\000", "0h\000\000"); x2("\000(\000?\000i\000:0B\000)\000\000", "0B\000\000", 0, 2); x2("\000(\000?\000i\000:0v0y\000)\000\000", "0v0y\000\000", 0, 4); n("\000(\000?\000i\000:0D\000)\000\000", "0F\000\000"); x2("\000(\000?\000m\000:0\210\000.\000)\000\000", "0\210\000\012\000\000", 0, 4); x2("\000(\000?\000m\000:\000.0\201\000)\000\000", "0~\000\0120\201\000\000", 2, 6); x2("0B\000?\000\000", "\000\000", 0, 0); x2("Y\011\000?\000\000", "S\026\000\000", 0, 0); x2("Y\011\000?\000\000", "Y\011\000\000", 0, 2); x2("\221\317\000*\000\000", "\000\000", 0, 0); x2("\221\317\000*\000\000", "\221\317\000\000", 0, 2); x2("[P\000*\000\000", "[P[P[P\000\000", 0, 6); x2("\231\254\000*\000\000", "\236\177\231\254\231\254\231\254\231\254\000\000", 0, 0); n("\134q\000+\000\000", "\000\000"); x2("l\263\000+\000\000", "l\263\000\000", 0, 2); x2("fB\000+\000\000", "fBfBfBfB\000\000", 0, 8); x2("0H\000+\000\000", "0H0H0F0F0F\000\000", 0, 4); x2("0F\000+\000\000", "0J0F0F0F0F\000\000", 2, 10); x2("\000.\000?\000\000", "0_\000\000", 0, 2); x2("\000.\000*\000\000", "0q0t0w0z\000\000", 0, 8); x2("\000.\000+\000\000", "0\215\000\000", 0, 2); x2("\000.\000+\000\000", "0D0F0H0K\000\012\000\000", 0, 8); x2("0B\000|0D\000\000", "0B\000\000", 0, 2); x2("0B\000|0D\000\000", "0D\000\000", 0, 2); x2("0B0D\000|0D0F\000\000", "0B0D\000\000", 0, 4); x2("0B0D\000|0D0F\000\000", "0D0F\000\000", 0, 4); x2("0\222\000(\000?\000:0K0M\000|0M0O\000)\000\000", "0\2220K0M\000\000", 0, 6); x2("0\222\000(\000?\000:0K0M\000|0M0O\000)0Q\000\000", "0\2220M0O0Q\000\000", 0, 8); x2("0B0D\000|\000(\000?\000:0B0F\000|0B0\222\000)\000\000", "0B0\222\000\000", 0, 4); x2("0B\000|0D\000|0F\000\000", "0H0F\000\000", 2, 4); x2("0B\000|0D\000|0F0H\000|0J0K0M\000|0O\000|0Q0S0U\000|0W0Y0[\000|0]\000|0_0a\000|0d0f0h0j0k\000|0l0m\000\000", "0W0Y0[\000\000", 0, 6); n("0B\000|0D\000|0F0H\000|0J0K0M\000|0O\000|0Q0S0U\000|0W0Y0[\000|0]\000|0_0a\000|0d0f0h0j0k\000|0l0m\000\000", "0Y0[\000\000"); x2("0B\000|\000^0\217\000\000", "0v0B\000\000", 2, 4); x2("0B\000|\000^0\222\000\000", "0\2220B\000\000", 0, 2); x2("\233<\000|\000\134\000G\216\312\000\000", "0Q\216\312\233<\000\000", 4, 6); x2("\233<\000|\000\134\000G\216\312\000\000", "\216\312\233<\000\000", 0, 2); x2("\233<\000|\000\134\000A\216\312\000\000", "\000b\216\312\233<\000\000", 4, 6); x2("\233<\000|\000\134\000A\216\312\000\000", "\216\312\000\000", 0, 2); x2("\233<\000|\216\312\000\134\000Z\000\000", "\216\312\233<\000\000", 2, 4); x2("\233<\000|\216\312\000\134\000Z\000\000", "\216\312\000\000", 0, 2); x2("\233<\000|\216\312\000\134\000Z\000\000", "\216\312\000\012\000\000", 0, 2); x2("\233<\000|\216\312\000\134\000z\000\000", "\216\312\233<\000\000", 2, 4); x2("\233<\000|\216\312\000\134\000z\000\000", "\216\312\000\000", 0, 2); x2("\000\134\000w\000|\000\134\000s\000\000", "0J\000\000", 0, 2); x2("\000\134\000w\000|\000%\000\000", "\000%0J\000\000", 0, 2); x2("\000\134\000w\000|\000[\000&\000$\000]\000\000", "0F\000&\000\000", 0, 2); x2("\000[0D\000-0Q\000]\000\000", "0F\000\000", 0, 2); x2("\000[0D\000-0Q\000]\000|\000[\000^0K\000-0S\000]\000\000", "0B\000\000", 0, 2); x2("\000[0D\000-0Q\000]\000|\000[\000^0K\000-0S\000]\000\000", "0K\000\000", 0, 2); x2("\000[\000^0B\000]\000\000", "\000\012\000\000", 0, 2); x2("\000(\000?\000:0B\000|\000[0F\000-0M\000]\000)\000|0D0\222\000\000", "0F0\222\000\000", 0, 2); x2("\000(\000?\000:0B\000|\000[0F\000-0M\000]\000)\000|0D0\222\000\000", "0D0\222\000\000", 0, 4); x2("0B0D0F\000|\000(\000?\000=0Q0Q\000)\000.\000.0{\000\000", "0Q0Q0{\000\000", 0, 6); x2("0B0D0F\000|\000(\000?\000!0Q0Q\000)\000.\000.0{\000\000", "0B0D0{\000\000", 0, 6); x2("\000(\000?\000=0\2220B\000)\000.\000.0B\000|\000(\000?\000=0\2220\222\000)\000.\000.0B\000\000", "0\2220\2220B\000\000", 0, 6); x2("\000(\000?\000<\000=0B\000|0D0F\000)0D\000\000", "0D0F0D\000\000", 4, 6); n("\000(\000?\000>0B\000|0B0D0H\000)0F\000\000", "0B0D0H0F\000\000"); x2("\000(\000?\000>0B0D0H\000|0B\000)0F\000\000", "0B0D0H0F\000\000", 0, 8); x2("0B\000?\000|0D\000\000", "0B\000\000", 0, 2); x2("0B\000?\000|0D\000\000", "0D\000\000", 0, 0); x2("0B\000?\000|0D\000\000", "\000\000", 0, 0); x2("0B\000*\000|0D\000\000", "0B0B\000\000", 0, 4); x2("0B\000*\000|0D\000*\000\000", "0D0B\000\000", 0, 0); x2("0B\000*\000|0D\000*\000\000", "0B0D\000\000", 0, 2); x2("\000[\000a0B\000]\000*\000|0D\000*\000\000", "\000a0B0D0D0D\000\000", 0, 4); x2("0B\000+\000|0D\000*\000\000", "\000\000", 0, 0); x2("0B\000+\000|0D\000*\000\000", "0D0D0D\000\000", 0, 6); x2("0B\000+\000|0D\000*\000\000", "0B0D0D0D\000\000", 0, 2); x2("0B\000+\000|0D\000*\000\000", "\000a0B0D0D0D\000\000", 0, 0); n("0B\000+\000|0D\000+\000\000", "\000\000"); x2("\000(0B\000|0D\000)\000?\000\000", "0D\000\000", 0, 2); x2("\000(0B\000|0D\000)\000*\000\000", "0D0B\000\000", 0, 4); x2("\000(0B\000|0D\000)\000+\000\000", "0D0B0D\000\000", 0, 6); x2("\000(0B0D\000|0F0B\000)\000+\000\000", "0F0B0B0D0F0H\000\000", 0, 8); x2("\000(0B0D\000|0F0H\000)\000+\000\000", "0F0B0B0D0F0H\000\000", 4, 12); x2("\000(0B0D\000|0F0B\000)\000+\000\000", "0B0B0D0F0B\000\000", 2, 10); x2("\000(0B0D\000|0F0B\000)\000+\000\000", "0B0D0\2220F0B\000\000", 0, 4); x2("\000(0B0D\000|0F0B\000)\000+\000\000", "\000$\000$\000z\000z\000z\000z0B0D0\2220F0B\000\000", 12, 16); x2("\000(0B\000|0D0B0D\000)\000+\000\000", "0B0D0B0D0B\000\000", 0, 10); x2("\000(0B\000|0D0B0D\000)\000+\000\000", "0D0B\000\000", 2, 4); x2("\000(0B\000|0D0B0D\000)\000+\000\000", "0D0B0B0B0D0B\000\000", 2, 8); x2("\000(\000?\000:0B\000|0D\000)\000(\000?\000:0B\000|0D\000)\000\000", "0B0D\000\000", 0, 4); x2("\000(\000?\000:0B\000*\000|0D\000*\000)\000(\000?\000:0B\000*\000|0D\000*\000)\000\000", "0B0B0B0D0D0D\000\000", 0, 6); x2("\000(\000?\000:0B\000*\000|0D\000*\000)\000(\000?\000:0B\000+\000|0D\000+\000)\000\000", "0B0B0B0D0D0D\000\000", 0, 12); x2("\000(\000?\000:0B\000+\000|0D\000+\000)\000{\0002\000}\000\000", "0B0B0B0D0D0D\000\000", 0, 12); x2("\000(\000?\000:0B\000+\000|0D\000+\000)\000{\0001\000,\0002\000}\000\000", "0B0B0B0D0D0D\000\000", 0, 12); x2("\000(\000?\000:0B\000+\000|\000\134\000A0D\000*\000)0F0F\000\000", "0F0F\000\000", 0, 4); n("\000(\000?\000:0B\000+\000|\000\134\000A0D\000*\000)0F0F\000\000", "0B0D0F0F\000\000"); x2("\000(\000?\000:\000^0B\000+\000|0D\000+\000)\000*0F\000\000", "0B0B0D0D0D0B0D0F\000\000", 12, 16); x2("\000(\000?\000:\000^0B\000+\000|0D\000+\000)\000*0F\000\000", "0B0B0D0D0D0D0F\000\000", 0, 14); x2("0F\000{\0000\000,\000}\000\000", "0F0F0F0F\000\000", 0, 8); x2("0B\000|\000(\000?\000i\000)\000c\000\000", "\000C\000\000", 0, 2); x2("\000(\000?\000i\000)\000c\000|0B\000\000", "\000C\000\000", 0, 2); x2("\000(\000?\000i\000:0B\000)\000|\000a\000\000", "\000a\000\000", 0, 2); n("\000(\000?\000i\000:0B\000)\000|\000a\000\000", "\000A\000\000"); x2("\000[0B0D0F\000]\000?\000\000", "0B0D0F\000\000", 0, 2); x2("\000[0B0D0F\000]\000*\000\000", "0B0D0F\000\000", 0, 6); x2("\000[\000^0B0D0F\000]\000*\000\000", "0B0D0F\000\000", 0, 0); n("\000[\000^0B0D0F\000]\000+\000\000", "0B0D0F\000\000"); x2("0B\000?\000?\000\000", "0B0B0B\000\000", 0, 0); x2("0D0B\000?\000?0D\000\000", "0D0B0D\000\000", 0, 6); x2("0B\000*\000?\000\000", "0B0B0B\000\000", 0, 0); x2("0D0B\000*\000?\000\000", "0D0B0B\000\000", 0, 2); x2("0D0B\000*\000?0D\000\000", "0D0B0B0D\000\000", 0, 8); x2("0B\000+\000?\000\000", "0B0B0B\000\000", 0, 2); x2("0D0B\000+\000?\000\000", "0D0B0B\000\000", 0, 4); x2("0D0B\000+\000?0D\000\000", "0D0B0B0D\000\000", 0, 8); x2("\000(\000?\000:Y)\000?\000)\000?\000?\000\000", "Y)\000\000", 0, 0); x2("\000(\000?\000:Y)\000?\000?\000)\000?\000\000", "Y)\000\000", 0, 0); x2("\000(\000?\000:Y\042\000?\000)\000+\000?\000\000", "Y\042Y\042Y\042\000\000", 0, 2); x2("\000(\000?\000:\230\250\000+\000)\000?\000?\000\000", "\230\250\230\250\230\250\000\000", 0, 0); x2("\000(\000?\000:\226\352\000+\000)\000?\000?\227\034\000\000", "\226\352\226\352\226\352\227\034\000\000", 0, 8); x2("\000(\000?\000:0B0D\000)\000?\000{\0002\000}\000\000", "\000\000", 0, 0); x2("\000(\000?\000:\233<\216\312\000)\000?\000{\0002\000}\000\000", "\233<\216\312\233<\216\312\233<\000\000", 0, 8); x2("\000(\000?\000:\233<\216\312\000)\000*\000{\0000\000}\000\000", "\233<\216\312\233<\216\312\233<\000\000", 0, 0); x2("\000(\000?\000:\233<\216\312\000)\000{\0003\000,\000}\000\000", "\233<\216\312\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 16); n("\000(\000?\000:\233<\216\312\000)\000{\0003\000,\000}\000\000", "\233<\216\312\233<\216\312\000\000"); x2("\000(\000?\000:\233<\216\312\000)\000{\0002\000,\0004\000}\000\000", "\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 12); x2("\000(\000?\000:\233<\216\312\000)\000{\0002\000,\0004\000}\000\000", "\233<\216\312\233<\216\312\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 16); x2("\000(\000?\000:\233<\216\312\000)\000{\0002\000,\0004\000}\000?\000\000", "\233<\216\312\233<\216\312\233<\216\312\233<\216\312\233<\216\312\000\000", 0, 8); x2("\000(\000?\000:\233<\216\312\000)\000{\000,\000}\000\000", "\233<\216\312\000{\000,\000}\000\000", 0, 10); x2("\000(\000?\000:0K0M0O\000)\000+\000?\000{\0002\000}\000\000", "0K0M0O0K0M0O0K0M0O\000\000", 0, 12); x3("\000(pk\000)\000\000", "pk\000\000", 0, 2, 1); x3("\000(pkl4\000)\000\000", "pkl4\000\000", 0, 4, 1); x2("\000(\000(fB\225\223\000)\000)\000\000", "fB\225\223\000\000", 0, 4); x3("\000(\000(\230\250l4\000)\000)\000\000", "\230\250l4\000\000", 0, 4, 1); x3("\000(\000(f(e\345\000)\000)\000\000", "f(e\345\000\000", 0, 4, 2); x3("\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\000(\221\317[P\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000)\000\000", "\221\317[P\000\000", 0, 4, 20); x3("\000(0B0D\000)\000(0F0H\000)\000\000", "0B0D0F0H\000\000", 0, 4, 1); x3("\000(0B0D\000)\000(0F0H\000)\000\000", "0B0D0F0H\000\000", 4, 8, 2); x3("\000(\000)\000(0B\000)0D0F\000(0H0J0K\000)0M0O0Q0S\000\000", "0B0D0F0H0J0K0M0O0Q0S\000\000", 6, 12, 3); x3("\000(\000(\000)\000(0B\000)0D0F\000(0H0J0K\000)0M0O0Q0S\000)\000\000", "0B0D0F0H0J0K0M0O0Q0S\000\000", 6, 12, 4); x3("\000.\000*\000(0\3250\251\000)0\3630\3730\336\000(0\363\000(\000)0\2670\3450\277\000)0\2440\363\000\000", "0\3250\2510\3630\3730\3360\3630\2670\3450\2770\2440\363\000\000", 10, 18, 2); x2("\000(\000^0B\000)\000\000", "0B\000\000", 0, 2); x3("\000(0B\000)\000|\000(0B\000)\000\000", "0D0B\000\000", 2, 4, 1); x3("\000(\000^0B\000)\000|\000(0B\000)\000\000", "0D0B\000\000", 2, 4, 2); x3("\000(0B\000?\000)\000\000", "0B0B0B\000\000", 0, 2, 1); x3("\000(0~\000*\000)\000\000", "0~0~0~\000\000", 0, 6, 1); x3("\000(0h\000*\000)\000\000", "\000\000", 0, 0, 1); x3("\000(0\213\000+\000)\000\000", "0\2130\2130\2130\2130\2130\2130\213\000\000", 0, 14, 1); x3("\000(0u\000+\000|0x\000*\000)\000\000", "0u0u0u0x0x\000\000", 0, 6, 1); x3("\000(0B\000+\000|0D\000?\000)\000\000", "0D0D0D0B0B\000\000", 0, 2, 1); x3("\000(0B0D0F\000)\000?\000\000", "0B0D0F\000\000", 0, 6, 1); x3("\000(0B0D0F\000)\000*\000\000", "0B0D0F\000\000", 0, 6, 1); x3("\000(0B0D0F\000)\000+\000\000", "0B0D0F\000\000", 0, 6, 1); x3("\000(0U0W0Y\000|0B0D0F\000)\000+\000\000", "0B0D0F\000\000", 0, 6, 1); x3("\000(\000[0j0k0l\000]\000[0K0M0O\000]\000|0K0M0O\000)\000+\000\000", "0K0M0O\000\000", 0, 6, 1); x3("\000(\000(\000?\000i\000:0B0D0F\000)\000)\000\000", "0B0D0F\000\000", 0, 6, 1); x3("\000(\000(\000?\000m\000:0B\000.0F\000)\000)\000\000", "0B\000\0120F\000\000", 0, 6, 1); x3("\000(\000(\000?\000=0B0\223\000)0B\000)\000\000", "0B0\2230D\000\000", 0, 2, 1); x3("0B0D0F\000|\000(\000.0B0D0H\000)\000\000", "0\2230B0D0H\000\000", 0, 8, 1); x3("0B\000*\000(\000.\000)\000\000", "0B0B0B0B0\223\000\000", 8, 10, 1); x3("0B\000*\000?\000(\000.\000)\000\000", "0B0B0B0B0\223\000\000", 0, 2, 1); x3("0B\000*\000?\000(0\223\000)\000\000", "0B0B0B0B0\223\000\000", 8, 10, 1); x3("\000[0D0F0H\000]0B\000*\000(\000.\000)\000\000", "0H0B0B0B0B0\223\000\000", 10, 12, 1); x3("\000(\000\134\000A0D0D\000)0F0F\000\000", "0D0D0F0F\000\000", 0, 4, 1); n("\000(\000\134\000A0D0D\000)0F0F\000\000", "0\2230D0D0F0F\000\000"); x3("\000(\000^0D0D\000)0F0F\000\000", "0D0D0F0F\000\000", 0, 4, 1); n("\000(\000^0D0D\000)0F0F\000\000", "0\2230D0D0F0F\000\000"); x3("0\2150\215\000(0\2130\213\000$\000)\000\000", "0\2150\2150\2130\213\000\000", 4, 8, 1); n("0\2150\215\000(0\2130\213\000$\000)\000\000", "0\2150\2150\2130\2130\213\000\000"); x2("\000(q!\000)\000\134\0001\000\000", "q!q!\000\000", 0, 4); n("\000(q!\000)\000\134\0001\000\000", "q!kf\000\000"); x2("\000(zz\000?\000)\000\134\0001\000\000", "zzzz\000\000", 0, 4); x2("\000(zz\000?\000?\000)\000\134\0001\000\000", "zzzz\000\000", 0, 0); x2("\000(zz\000*\000)\000\134\0001\000\000", "zzzzzzzzzz\000\000", 0, 8); x3("\000(zz\000*\000)\000\134\0001\000\000", "zzzzzzzzzz\000\000", 0, 4, 1); x2("0B\000(0D\000*\000)\000\134\0001\000\000", "0B0D0D0D0D\000\000", 0, 10); x2("0B\000(0D\000*\000)\000\134\0001\000\000", "0B0D\000\000", 0, 2); x2("\000(0B\000*\000)\000(0D\000*\000)\000\134\0001\000\134\0002\000\000", "0B0B0B0D0D0B0B0B0D0D\000\000", 0, 20); x2("\000(0B\000*\000)\000(0D\000*\000)\000\134\0002\000\000", "0B0B0B0D0D0D0D\000\000", 0, 14); x3("\000(0B\000*\000)\000(0D\000*\000)\000\134\0002\000\000", "0B0B0B0D0D0D0D\000\000", 6, 10, 2); x2("\000(\000(\000(\000(\000(\000(\000(0}\000*\000)0z\000)\000)\000)\000)\000)\000)0t\000\134\0007\000\000", "0}0}0}0z0t0}0}0}\000\000", 0, 16); x3("\000(\000(\000(\000(\000(\000(\000(0}\000*\000)0z\000)\000)\000)\000)\000)\000)0t\000\134\0007\000\000", "0}0}0}0z0t0}0}0}\000\000", 0, 6, 7); x2("\000(0o\000)\000(0r\000)\000(0u\000)\000\134\0002\000\134\0001\000\134\0003\000\000", "0o0r0u0r0o0u\000\000", 0, 12); x2("\000(\000[0M\000-0Q\000]\000)\000\134\0001\000\000", "0O0O\000\000", 0, 4); x2("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "0B\0005\000 0B\0005\000 \000\000", 0, 12); n("\000(\000\134\000w\000\134\000d\000\134\000s\000)\000\134\0001\000\000", "0B\0005\000 0B\0005\000\000"); x2("\000(\212\260\377\037\000|\000[0B\000-0F\000]\000{\0003\000}\000)\000\134\0001\000\000", "\212\260\377\037\212\260\377\037\000\000", 0, 8); x2("\000.\000.\000.\000(\212\260\377\037\000|\000[0B\000-0F\000]\000{\0003\000}\000)\000\134\0001\000\000", "0B\000a0B\212\260\377\037\212\260\377\037\000\000", 0, 14); x2("\000(\212\260\377\037\000|\000[0B\000-0F\000]\000{\0003\000}\000)\000\134\0001\000\000", "0F0D0F0F0D0F\000\000", 0, 12); x2("\000(\000^0S\000)\000\134\0001\000\000", "0S0S\000\000", 0, 4); n("\000(\000^0\200\000)\000\134\0001\000\000", "0\2010\2000\200\000\000"); n("\000(0B\000$\000)\000\134\0001\000\000", "0B0B\000\000"); n("\000(0B0D\000\134\000Z\000)\000\134\0001\000\000", "0B0D\000\000"); x2("\000(0B\000*\000\134\000Z\000)\000\134\0001\000\000", "0B\000\000", 2, 2); x2("\000.\000(0B\000*\000\134\000Z\000)\000\134\0001\000\000", "0D0B\000\000", 2, 4); x3("\000(\000.\000(0\2040D0\206\000)\000\134\0002\000)\000\000", "\000z0\2040D0\2060\2040D0\206\000\000", 0, 14, 1); x3("\000(\000.\000(\000.\000.\000\134\000d\000.\000)\000\134\0002\000)\000\000", "0B\0001\0002\0003\0004\0001\0002\0003\0004\000\000", 0, 18, 1); x2("\000(\000(\000?\000i\000:0B\000v0Z\000)\000)\000\134\0001\000\000", "0B\000v0Z0B\000v0Z\000\000", 0, 12); x2("\000(\000?\000Y\011\000|\000\134\000(\000\134\000g\000\000\134\000)\000)\000\000", "\000(\000(\000(\000(\000(\000(Y\011\000)\000)\000)\000)\000)\000)\000\000", 0, 26); x2("\000\134\000A\000(\000?\000:\000\134\000g\000<\226?\000_\0001\000>\000|\000\134\000g\000\000|\000\134\000z}BN\206\000 \000 \000(\000?\000<\226?\000_\0001\000>\211\263\000|\201\352\000\134\000g\000\201\352\000)\000(\000?\000W(\000|\203\351\205\251\000\134\000g\000<\226?\000_\0001\000>\203\351\205\251\000)\000)\000$\000\000", "\203\351\205\251\201\352\203\351\205\251\201\352W(\201\352\203\351\205\251\201\352\203\351\205\251\000\000", 0, 26); x2("\000[\000[0r0u\000]\000]\000\000", "0u\000\000", 0, 2); x2("\000[\000[0D0J0F\000]0K\000]\000\000", "0K\000\000", 0, 2); n("\000[\000[\000^0B\000]\000]\000\000", "0B\000\000"); n("\000[\000^\000[0B\000]\000]\000\000", "0B\000\000"); x2("\000[\000^\000[\000^0B\000]\000]\000\000", "0B\000\000", 0, 2); x2("\000[\000[0K0M0O\000]\000&\000&0M0O\000]\000\000", "0O\000\000", 0, 2); n("\000[\000[0K0M0O\000]\000&\000&0M0O\000]\000\000", "0K\000\000"); n("\000[\000[0K0M0O\000]\000&\000&0M0O\000]\000\000", "0Q\000\000"); x2("\000[0B\000-0\223\000&\000&0D\000-0\222\000&\000&0F\000-0\221\000]\000\000", "0\221\000\000", 0, 2); n("\000[\000^0B\000-0\223\000&\000&0D\000-0\222\000&\000&0F\000-0\221\000]\000\000", "0\221\000\000"); x2("\000[\000[\000^0B\000&\000&0B\000]\000&\000&0B\000-0\223\000]\000\000", "0D\000\000", 0, 2); n("\000[\000[\000^0B\000&\000&0B\000]\000&\000&0B\000-0\223\000]\000\000", "0B\000\000"); x2("\000[\000[\000^0B\000-0\223\000&\000&0D0F0H0J\000]\000&\000&\000[\000^0F\000-0K\000]\000]\000\000", "0M\000\000", 0, 2); n("\000[\000[\000^0B\000-0\223\000&\000&0D0F0H0J\000]\000&\000&\000[\000^0F\000-0K\000]\000]\000\000", "0D\000\000"); x2("\000[\000^\000[\000^0B0D0F\000]\000&\000&\000[\000^0F0H0J\000]\000]\000\000", "0F\000\000", 0, 2); x2("\000[\000^\000[\000^0B0D0F\000]\000&\000&\000[\000^0F0H0J\000]\000]\000\000", "0H\000\000", 0, 2); n("\000[\000^\000[\000^0B0D0F\000]\000&\000&\000[\000^0F0H0J\000]\000]\000\000", "0K\000\000"); x2("\000[0B\000-\000&\000&\000-0B\000]\000\000", "\000-\000\000", 0, 2); x2("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000q\000-\000w\000]\000\000", "0H\000\000", 0, 2); x2("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000g\000-\000w\000]\000\000", "\000f\000\000", 0, 2); x2("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000g\000-\000w\000]\000\000", "\000g\000\000", 0, 2); n("\000[\000^\000[\000^\000a\000-\000z0B0D0F\000]\000&\000&\000[\000^\000b\000c\000d\000e\000f\000g0F0H0J\000]\000g\000-\000w\000]\000\000", "\0002\000\000"); x2("\000a\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000\134\000/\000b\000>\000\000", "\000a\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000/\000b\000>\000\000", 0, 40); x2("\000.\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000\134\000/\000b\000>\000\000", "\000a\000<\000b\000>0\3200\3740\2700\3470\3630n0\3000\2460\3630\3550\3740\311\000<\000/\000b\000>\000\000", 0, 40); x2("\000^\000\\\000p\000{\000K\000a\000t\000a\000k\000a\000n\000a\000}\000$\000\000", "\060\277\000\000", 0, 2); x2("\000\\\000o\000{\0001\0000\0001\000}\000\000", "\000A\000\000", 0, 2); x2("\000\\\000o\000{\0001\0001\0000\0007\0002\0001\000}\000\000", "\221\321\000\000", 0, 2); x2("\000\\\000R\000\000", "\000\015\000\012\000\000", 0, 4); // \R: general newline x2("\000\\\000R\000\000", "\000\012\000\000", 0, 2); x2("\000\\\000R\000\000", "\000\015\000\000", 0, 2); x2("\000\\\000R\000\000", "\000\013\000\000", 0, 2); n("\000\\\000R\000\012\000\000", "\000\015\000\012\000\000"); x2("\000\\\000R\000\000", "\x00\x85\000\000", 0, 2); x2("\000\\\000R\000\000", "\x20\x28\000\000", 0, 2); x2("\000\\\000R\000\000", "\x20\x29\000\000", 0, 2); n("\000\\\000R\000\000", "\x20\x2a\000\000"); x2("\000\\\000w\000\000", "\x01\x00\000\000", 0, 2); n("\000\\\000W\000\000", "\x01\x00\000\000"); x2("\000\\\000d\000\000", "\x0b\x66\000\000", 0, 2); n("\000\\\000D\000\000", "\x0b\x66\000\000"); x2("\000\\\000s\000\000", "\x20\x01\000\000", 0, 2); n("\000\\\000S\000\000", "\x20\x01\000\000"); x2("\000\\\000b\000\000", "\x00\x20\x01\x00\000\000", 2, 2); n("\000\\\000B\000\000", "\x01\x00\000\000"); x2("\000\\\000B\000\000", "\x00\x20\000\000", 0, 0); x2("\000[\000[\000:\000g\000r\000a\000p\000h\000:\000]\000]\000\000", "\x0d\x30\000\000", 0, 2); n("\000[\000[\000:\000g\000r\000a\000p\000h\000:\000]\000]\000\000", "\x0a\x00\000\000"); // extended grapheme cluster // CR + LF n("\000.\000\\\000y\000\\\000O\000\000", "\x00\x0d\x00\x0a\000\000"); x2("\000.\000\\\000Y\000\\\000O\000\000", "\x00\x0d\x00\x0a\000\000", 0, 4); // LATIN SMALL LETTER G, COMBINING DIAERESIS n("\000^\000.\000\\\000y\000.\000$\000\000", "\x00\x67\x03\x08\000\000"); x2("\000.\000\\\000Y\000.\000\000", "\x00\x67\x03\x08\000\000", 0, 4); x2("\000\\\000y\000.\000\\\000Y\000.\000\\\000y\000\000", "\x00\x67\x03\x08\000\000", 0, 4); // TAMIL LETTER NA, TAMIL VOWEL SIGN I, x2("\000.\000\\\000Y\000.\000\000", "\x0B\xA8\x0B\xBF\000\000", 0, 4); n("\000.\000\\\000y\000.\000\000", "\x0B\xA8\x0B\xBF\000\000"); // CR + LF n("\000\\\000X\000\\\000X\000\000", "\x00\x0d\x00\x0a\000\000"); x2("\000^\000\\\000X\000$\000\000", "\x00\x0d\x00\x0a\000\000", 0, 4); // LATIN SMALL LETTER G, COMBINING DIAERESIS n("\000\\\000X\000\\\000X\000\000", "\x00\x67\x03\x08\000\000"); x2("\000^\000\\\000X\000$\000\000", "\x00\x67\x03\x08\000\000", 0, 4); // TAMIL LETTER NA, TAMIL VOWEL SIGN I, x2("\000^\000\\\000X\000$\000\000", "\x0B\xA8\x0B\xBF\000\000", 0, 4); n("\000\\\000X\000\\\000X\000\000", "\x0B\xA8\x0B\xBF\000\000"); fprintf(stdout, "\nRESULT SUCC: %4d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); #ifndef POSIX_TEST onig_region_free(region, 1); onig_end(); #endif return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/test/test.sh0000755000175100017510000000071415215513537013430 #!/bin/sh echo "[Oniguruma API, UTF-8 check]" ./test_utf8 | grep RESULT echo "[Oniguruma API, SYNTAX check]" ./test_syntax | grep RESULT echo "[Oniguruma API, Options check]" ./test_options | grep RESULT echo "[Oniguruma API, EUC-JP check]" ./testc | grep RESULT echo "[Oniguruma API, UTF-16 check]" ./testcu | grep RESULT echo "" echo "[Oniguruma API, regset check]" ./test_regset echo "[Oniguruma API, backward search check]" ./test_back | grep RESULT jq-1.8.2/vendor/oniguruma/test/CMakeLists.txt0000644000175100017510000000244715215513537014657 if(MSVC) if(MSVC_VERSION LESS "1900") # < VS2015, no "/utf-8" option, can not build test return() endif() endif() enable_testing() add_executable(test_utf8 test_utf8.c) target_link_libraries(test_utf8 onig) if(MSVC) target_compile_options(test_utf8 PRIVATE /utf-8) endif(MSVC) add_executable(test_syntax test_syntax.c) target_link_libraries(test_syntax onig) if(MSVC) target_compile_options(test_syntax PRIVATE /utf-8) endif(MSVC) add_executable(test_options test_options.c) target_link_libraries(test_options onig) if(MSVC) target_compile_options(test_options PRIVATE /utf-8) endif(MSVC) if(NOT MSVC) # EUC add_executable(testc testc.c) target_link_libraries(testc onig) if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") target_compile_options(testc PRIVATE -Wall -Wno-invalid-source-encoding) endif() endif(NOT MSVC) if(ENABLE_POSIX_API) add_executable(testp testp.c) target_link_libraries(testp onig) endif() add_executable(testcu testu.c) target_link_libraries(testcu onig) add_executable(test_regset test_regset.c) target_link_libraries(test_regset onig) if(MSVC) target_compile_options(test_regset PRIVATE /utf-8) endif(MSVC) add_executable(test_back test_back.c) target_link_libraries(test_back onig) if(MSVC) target_compile_options(test_back PRIVATE /utf-8) endif(MSVC) jq-1.8.2/vendor/oniguruma/test/Makefile.in0000644000175100017510000011652415215513553014164 # Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_POSIX_API_FALSE@TESTS = test_utf8$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ test_syntax$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ test_options$(EXEEXT) testc$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ testcu$(EXEEXT) test_regset$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ test_back$(EXEEXT) @ENABLE_POSIX_API_TRUE@TESTS = test_utf8$(EXEEXT) test_syntax$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ test_options$(EXEEXT) testc$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ testp$(EXEEXT) testcu$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ test_regset$(EXEEXT) test_back$(EXEEXT) check_PROGRAMS = $(am__EXEEXT_1) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_POSIX_API_FALSE@am__EXEEXT_1 = test_utf8$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ test_syntax$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ test_options$(EXEEXT) testc$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ testcu$(EXEEXT) test_regset$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ test_back$(EXEEXT) @ENABLE_POSIX_API_TRUE@am__EXEEXT_1 = test_utf8$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ test_syntax$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ test_options$(EXEEXT) testc$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ testp$(EXEEXT) testcu$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ test_regset$(EXEEXT) test_back$(EXEEXT) am_test_back_OBJECTS = test_back.$(OBJEXT) test_back_OBJECTS = $(am_test_back_OBJECTS) test_back_DEPENDENCIES = $(lib_onig) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_test_options_OBJECTS = test_options.$(OBJEXT) test_options_OBJECTS = $(am_test_options_OBJECTS) test_options_DEPENDENCIES = $(lib_onig) am_test_regset_OBJECTS = test_regset.$(OBJEXT) test_regset_OBJECTS = $(am_test_regset_OBJECTS) test_regset_DEPENDENCIES = $(lib_onig) am_test_syntax_OBJECTS = test_syntax.$(OBJEXT) test_syntax_OBJECTS = $(am_test_syntax_OBJECTS) test_syntax_DEPENDENCIES = $(lib_onig) am_test_utf8_OBJECTS = test_utf8.$(OBJEXT) test_utf8_OBJECTS = $(am_test_utf8_OBJECTS) test_utf8_DEPENDENCIES = $(lib_onig) am_testc_OBJECTS = testc.$(OBJEXT) testc_OBJECTS = $(am_testc_OBJECTS) testc_DEPENDENCIES = $(lib_onig) am_testcu_OBJECTS = testu.$(OBJEXT) testcu_OBJECTS = $(am_testcu_OBJECTS) testcu_DEPENDENCIES = $(lib_onig) am_testp_OBJECTS = testp.$(OBJEXT) testp_OBJECTS = $(am_testp_OBJECTS) testp_DEPENDENCIES = $(lib_onig) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/test_back.Po \ ./$(DEPDIR)/test_options.Po ./$(DEPDIR)/test_regset.Po \ ./$(DEPDIR)/test_syntax.Po ./$(DEPDIR)/test_utf8.Po \ ./$(DEPDIR)/testc.Po ./$(DEPDIR)/testp.Po ./$(DEPDIR)/testu.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(test_back_SOURCES) $(test_options_SOURCES) \ $(test_regset_SOURCES) $(test_syntax_SOURCES) \ $(test_utf8_SOURCES) $(testc_SOURCES) $(testcu_SOURCES) \ $(testp_SOURCES) DIST_SOURCES = $(test_back_SOURCES) $(test_options_SOURCES) \ $(test_regset_SOURCES) $(test_syntax_SOURCES) \ $(test_utf8_SOURCES) $(testc_SOURCES) $(testcu_SOURCES) \ $(testp_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXTRA_LIBONIG_LDFLAGS = @EXTRA_LIBONIG_LDFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBONIG_DEF_FILE = @LIBONIG_DEF_FILE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LTVERSION = @LTVERSION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_onig = ../src/libonig.la AM_LDFLAGS = -L$(libdir) AM_CFLAGS = -Wall -Wno-invalid-source-encoding AM_CPPFLAGS = -I$(top_srcdir)/src test_utf8_SOURCES = test_utf8.c test_utf8_LDADD = $(lib_onig) test_syntax_SOURCES = test_syntax.c test_syntax_LDADD = $(lib_onig) test_options_SOURCES = test_options.c test_options_LDADD = $(lib_onig) testc_SOURCES = testc.c testc_LDADD = $(lib_onig) testp_SOURCES = testp.c testp_LDADD = $(lib_onig) testcu_SOURCES = testu.c testcu_LDADD = $(lib_onig) test_regset_SOURCES = test_regset.c test_regset_LDADD = $(lib_onig) test_back_SOURCES = test_back.c test_back_LDADD = $(lib_onig) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list test_back$(EXEEXT): $(test_back_OBJECTS) $(test_back_DEPENDENCIES) $(EXTRA_test_back_DEPENDENCIES) @rm -f test_back$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_back_OBJECTS) $(test_back_LDADD) $(LIBS) test_options$(EXEEXT): $(test_options_OBJECTS) $(test_options_DEPENDENCIES) $(EXTRA_test_options_DEPENDENCIES) @rm -f test_options$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_options_OBJECTS) $(test_options_LDADD) $(LIBS) test_regset$(EXEEXT): $(test_regset_OBJECTS) $(test_regset_DEPENDENCIES) $(EXTRA_test_regset_DEPENDENCIES) @rm -f test_regset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_regset_OBJECTS) $(test_regset_LDADD) $(LIBS) test_syntax$(EXEEXT): $(test_syntax_OBJECTS) $(test_syntax_DEPENDENCIES) $(EXTRA_test_syntax_DEPENDENCIES) @rm -f test_syntax$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_syntax_OBJECTS) $(test_syntax_LDADD) $(LIBS) test_utf8$(EXEEXT): $(test_utf8_OBJECTS) $(test_utf8_DEPENDENCIES) $(EXTRA_test_utf8_DEPENDENCIES) @rm -f test_utf8$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_utf8_OBJECTS) $(test_utf8_LDADD) $(LIBS) testc$(EXEEXT): $(testc_OBJECTS) $(testc_DEPENDENCIES) $(EXTRA_testc_DEPENDENCIES) @rm -f testc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testc_OBJECTS) $(testc_LDADD) $(LIBS) testcu$(EXEEXT): $(testcu_OBJECTS) $(testcu_DEPENDENCIES) $(EXTRA_testcu_DEPENDENCIES) @rm -f testcu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testcu_OBJECTS) $(testcu_LDADD) $(LIBS) testp$(EXEEXT): $(testp_OBJECTS) $(testp_DEPENDENCIES) $(EXTRA_testp_DEPENDENCIES) @rm -f testp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testp_OBJECTS) $(testp_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_back.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_options.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_regset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_syntax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_utf8.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testu.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? test_utf8.log: test_utf8$(EXEEXT) @p='test_utf8$(EXEEXT)'; \ b='test_utf8'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_syntax.log: test_syntax$(EXEEXT) @p='test_syntax$(EXEEXT)'; \ b='test_syntax'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_options.log: test_options$(EXEEXT) @p='test_options$(EXEEXT)'; \ b='test_options'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) testc.log: testc$(EXEEXT) @p='testc$(EXEEXT)'; \ b='testc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) testcu.log: testcu$(EXEEXT) @p='testcu$(EXEEXT)'; \ b='testcu'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_regset.log: test_regset$(EXEEXT) @p='test_regset$(EXEEXT)'; \ b='test_regset'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_back.log: test_back$(EXEEXT) @p='test_back$(EXEEXT)'; \ b='test_back'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) testp.log: testp$(EXEEXT) @p='testp$(EXEEXT)'; \ b='testp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/test_back.Po -rm -f ./$(DEPDIR)/test_options.Po -rm -f ./$(DEPDIR)/test_regset.Po -rm -f ./$(DEPDIR)/test_syntax.Po -rm -f ./$(DEPDIR)/test_utf8.Po -rm -f ./$(DEPDIR)/testc.Po -rm -f ./$(DEPDIR)/testp.Po -rm -f ./$(DEPDIR)/testu.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/test_back.Po -rm -f ./$(DEPDIR)/test_options.Po -rm -f ./$(DEPDIR)/test_regset.Po -rm -f ./$(DEPDIR)/test_syntax.Po -rm -f ./$(DEPDIR)/test_utf8.Po -rm -f ./$(DEPDIR)/testc.Po -rm -f ./$(DEPDIR)/testp.Po -rm -f ./$(DEPDIR)/testu.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile test: test_uchar test_regex_t $(TESTS) @echo "[Oniguruma API, UTF-8 check]" @./test_utf8 | grep RESULT @echo "[Oniguruma API, SYNTAX check]" @./test_syntax | grep RESULT @echo "[Oniguruma API, Options check]" @./test_options | grep RESULT @echo "[Oniguruma API, EUC-JP check]" @./testc | grep RESULT @ENABLE_POSIX_API_TRUE@ @echo "[POSIX API, UTF-8 check]" @ENABLE_POSIX_API_TRUE@ @./testp | grep RESULT @echo "[Oniguruma API, UTF-16 check]" @./testcu | grep RESULT @echo "" @echo "[Oniguruma API, regset check]" @./test_regset @echo "[Oniguruma API, backward search check]" @./test_back | grep RESULT test_uchar: @echo "[UChar in oniguruma.h check]" @grep "\(^\|[^g]\)UChar" $(top_srcdir)/src/oniguruma.h @echo "" test_regex_t: @echo "[regex_t in oniguruma.h check]" @grep "\(^\|[^[:alnum:]]\)regex_t" $(top_srcdir)/src/oniguruma.h @echo "" gcov: make CFLAGS="--coverage" test_utf8 make CFLAGS="--coverage" test_syntax make CFLAGS="--coverage" test_options make CFLAGS="--coverage" testc @ENABLE_POSIX_API_TRUE@ make CFLAGS="--coverage" testp make CFLAGS="--coverage" testcu make CFLAGS="--coverage" test_regset make CFLAGS="--coverage" test_back # 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: jq-1.8.2/vendor/oniguruma/install-sh0000755000175100017510000003577615215513537013157 #!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/vendor/oniguruma/depcomp0000755000175100017510000005602015215513537012511 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/vendor/oniguruma/README_japanese0000644000175100017510000001516115215513537013663 README.ja 2017/08/25 鬼車 ---- (C) K.Kosako https://github.com/kkos/oniguruma 鬼車は正規表現ライブラリである。 このライブラリの特長は、それぞれの正規表現オブジェクトごとに 文字エンコーディングを指定できることである。 サポートしている文字エンコーディング: ASCII, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, EUC-JP, EUC-TW, EUC-KR, EUC-CN, Shift_JIS, Big5, GB18030, KOI8-R, CP1251, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16 * GB18030: 久保健洋氏提供 * CP1251: Byte氏提供 ------------------------------------------------------------ ライセンス BSDライセンス インストール ケース1: UnixとCygwin環境 1. autoreconf -vfi (* configureスクリプトがないときだけ) 2. ./configure 3. make 4. make install アンインストール make uninstall 構成確認 onig-config --cflags onig-config --libs onig-config --prefix onig-config --exec-prefix ケース2: Windows 64/32bit (Visual Studio)環境 make_win64 あるいは make_win32 を実行 onig_s.lib: static link library onig.dll: dynamic link library * 動作テスト (ASCII/Shift_JIS) 1. cd src 2. copy ..\windows\testc.c . 3. nmake -f Makefile.windows ctest (Visual Studio Community 2015 で動作確認) 正規表現 doc/RE.jaを参照 使用方法 使用するプログラムで、oniguruma.hをインクルードする(Oniguruma APIの場合)。 Oniguruma APIについては、doc/API.jaを参照。 oniguruma.hで定義されている型名UChar(== unsigned char)を無効にしたい場合 には、ONIG_ESCAPE_UCHAR_COLLISIONをdefineしてからoniguruma.hをインクルード すること。このときにはUCharは定義されず、OnigUCharという名前の定義のみが 有効になる。 oniguruma.hで定義されている型名regex_tを無効にしたい場合には、 ONIG_ESCAPE_REGEX_T_COLLISIONをdefineしてからoniguruma.hをインクルード すること。このときにはregex_tは定義されず、OnigRegexType, OnigRegexという 名前の定義のみが有効になる。 Unix/Cygwin上でコンパイル、リンクする場合の例: (prefixが/usr/localのとき) cc sample.c -L/usr/local/lib -lonig GNU libtoolを使用しているので、プラットフォームが共有ライブラリをサポートして いれば、使用できるようになっている。 静的ライブラリと共有ライブラリのどちらを使用するかを指定する方法、実行時点での 環境設定方法については、自分で調べて下さい。 Win32でスタティックリンクライブラリ(onig_s.lib)をリンクする場合には、 コンパイルするときに -DONIG_EXTERN=extern をコンパイル引数に追加すること。 使用例プログラム sample/simple.c 最小例 (Oniguruma API) sample/names.c 名前付きグループコールバック使用例 sample/encode.c 幾つかの文字エンコーディング使用例 sample/listcap.c 捕獲履歴機能の使用例 sample/posix.c POSIX API使用例 sample/sql.c 可変メタ文字機能使用例 (SQL-like パターン) sample/user_property.c ユーザ定義Unicodeプロパティの使用例 テストプログラム sample/syntax.c Perl、Java、ASIS文法のテスト sample/crnl.c --enable-crnl-as-line-terminator テスト ソースファイル oniguruma.h 鬼車APIヘッダ (公開) onig-config.in onig-configプログラム テンプレート regenc.h 文字エンコーディング枠組みヘッダ regint.h 内部宣言 regparse.h regparse.cとregcomp.cのための内部宣言 regcomp.c コンパイル、最適化関数 regenc.c 文字エンコーディング枠組み regerror.c エラーメッセージ関数 regext.c 拡張API関数 regexec.c 検索、照合関数 regparse.c 正規表現パターン解析関数 regsyntax.c 正規表現パターン文法関数、組込み文法定義 regtrav.c 捕獲履歴木巡回関数 regversion.c 版情報関数 st.h ハッシュテーブル関数宣言 st.c ハッシュテーブル関数 oniggnu.h GNU regex APIヘッダ (公開) reggnu.c GNU regex API関数 onigposix.h POSIX APIヘッダ (公開) regposerr.c POSIX APIエラーメッセージ関数 regposix.c POSIX API関数 mktable.c 文字タイプテーブル生成プログラム ascii.c ASCII エンコーディング euc_jp.c EUC-JP エンコーディング euc_tw.c EUC-TW エンコーディング euc_kr.c EUC-KR, EUC-CN エンコーディング sjis.c Shift_JIS エンコーディング big5.c Big5 エンコーディング gb18030.c GB18030 エンコーディング koi8.c KOI8 エンコーディング koi8_r.c KOI8-R エンコーディング cp1251.c CP1251 エンコーディング iso8859_1.c ISO-8859-1 (Latin-1) iso8859_2.c ISO-8859-2 (Latin-2) iso8859_3.c ISO-8859-3 (Latin-3) iso8859_4.c ISO-8859-4 (Latin-4) iso8859_5.c ISO-8859-5 (Cyrillic) iso8859_6.c ISO-8859-6 (Arabic) iso8859_7.c ISO-8859-7 (Greek) iso8859_8.c ISO-8859-8 (Hebrew) iso8859_9.c ISO-8859-9 (Latin-5 または Turkish) iso8859_10.c ISO-8859-10 (Latin-6 または Nordic) iso8859_11.c ISO-8859-11 (Thai) iso8859_13.c ISO-8859-13 (Latin-7 または Baltic Rim) iso8859_14.c ISO-8859-14 (Latin-8 または Celtic) iso8859_15.c ISO-8859-15 (Latin-9 または West European with Euro) iso8859_16.c ISO-8859-16 (Latin-10 または South-Eastern European with Euro) utf8.c UTF-8 エンコーディング utf16_be.c UTF-16BE エンコーディング utf16_le.c UTF-16LE エンコーディング utf32_be.c UTF-32BE エンコーディング utf32_le.c UTF-32LE エンコーディング unicode.c Unicodeエンコーディングの共通処理 win32/Makefile Win32用 Makefile (for VC++) win32/config.h Win32用 config.h and I'm thankful to Akinori MUSHA. jq-1.8.2/vendor/oniguruma/configure0000755000175100017510000160700415215513553013046 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for onig 6.9.10. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; 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 # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (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 \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='onig' PACKAGE_TARNAME='onig' PACKAGE_VERSION='6.9.10' PACKAGE_STRING='onig 6.9.10' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS LIBONIG_DEF_FILE USE_LIBONIG_DEF_FILE_FALSE USE_LIBONIG_DEF_FILE_TRUE EXTRA_LIBONIG_LDFLAGS ALLOCA LTVERSION LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP FILECMD LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC ENABLE_POSIX_API_FALSE ENABLE_POSIX_API_TRUE ENABLE_BINARY_COMPATIBLE_POSIX_API_FALSE ENABLE_BINARY_COMPATIBLE_POSIX_API_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules with_statistics enable_posix_api enable_binary_compatible_posix_api enable_crnl_as_line_terminator enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures onig 6.9.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/onig] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of onig 6.9.10:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-posix-api turn on to include POSIX API [default=no] --enable-binary-compatible-posix-api turn on to Binary compatible POSIX API [default=no] --enable-crnl-as-line-terminator deprecated --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-statistics take matching time statistical data --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF onig configure 6.9.10 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. */ #include #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid; break else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=$ac_mid; break else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done else $as_nop ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval (void) { return $2; } static unsigned long int ulongval (void) { return $2; } #include #include int main (void) { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : echo >>conftest.val; read $3 &5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by onig $as_me 6.9.10, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" # Auxiliary files required by this configure script. ac_aux_files="config.guess config.sub ltmain.sh compile missing install-sh" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else $as_nop if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='onig' VERSION='6.9.10' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_config_headers="$ac_config_headers src/config.h" # Check whether --with-statistics was given. if test ${with_statistics+y} then : withval=$with_statistics; as_fn_append CFLAGS " -DONIG_DEBUG_STATISTICS" fi # Check whether --enable-posix-api was given. if test ${enable_posix_api+y} then : enableval=$enable_posix_api; \ case "${enableval}" in yes) enable_posix_api=yes ;; no) enable_posix_api=no ;; *) as_fn_error $? "bad value for --enable-posix-api" "$LINENO" 5 ;; esac else $as_nop enable_posix_api=no fi # Check whether --enable-binary-compatible-posix-api was given. if test ${enable_binary_compatible_posix_api+y} then : enableval=$enable_binary_compatible_posix_api; \ case "${enableval}" in yes) enable_binary_compatible_posix_api=yes; enable_posix_api=yes ;; no) enable_binary_compatible_posix_api=no ;; *) as_fn_error $? "bad value for --enable-binary-compatible-posix-api" "$LINENO" 5 ;; esac else $as_nop enable_binary_compatible_posix_api=no fi if test x"${enable_binary_compatible_posix_api}" = xyes; then ENABLE_BINARY_COMPATIBLE_POSIX_API_TRUE= ENABLE_BINARY_COMPATIBLE_POSIX_API_FALSE='#' else ENABLE_BINARY_COMPATIBLE_POSIX_API_TRUE='#' ENABLE_BINARY_COMPATIBLE_POSIX_API_FALSE= fi if test x"${enable_posix_api}" = xyes; then ENABLE_POSIX_API_TRUE= ENABLE_POSIX_API_FALSE='#' else ENABLE_POSIX_API_TRUE='#' ENABLE_POSIX_API_FALSE= fi # Check whether --enable-crnl-as-line-terminator was given. if test ${enable_crnl_as_line_terminator+y} then : enableval=$enable_crnl_as_line_terminator; crnl_as_line_terminator=$enableval fi if test "${crnl_as_line_terminator}" = yes; then printf "%s\n" "#define USE_CRNL_AS_LINE_TERMINATOR 1" >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi case `pwd` in *\ * | *\ *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.7' macro_revision='2.4.7' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 printf "%s\n" "printf" >&6; } ;; print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 printf "%s\n" "print -r" >&6; } ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 printf "%s\n" "cat" >&6; } ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in sed gsed do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 printf %s "checking for grep that handles long lines and -e... " >&6; } if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 printf %s "checking for egrep... " >&6; } if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 printf %s "checking for fgrep... " >&6; } if test ${ac_cv_path_FGREP+y} then : printf %s "(cached) " >&6 else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in fgrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test ${lt_cv_path_LD+y} then : printf %s "(cached) " >&6 else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${lt_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test ${lt_cv_path_NM+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 printf "%s\n" "$DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DUMPBIN+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 printf %s "checking the name lister ($NM) interface... " >&6; } if test ${lt_cv_nm_interface+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 printf "%s\n" "$lt_cv_nm_interface" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 printf "%s\n" "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 printf %s "checking the maximum length of command line arguments... " >&6; } if test ${lt_cv_sys_max_cmd_len+y} then : printf %s "(cached) " >&6 else $as_nop i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 printf %s "checking how to convert $build file names to $host format... " >&6; } if test ${lt_cv_to_host_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 printf %s "checking how to convert $build file names to toolchain format... " >&6; } if test ${lt_cv_to_tool_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 printf %s "checking for $LD option to reload object files... " >&6; } if test ${lt_cv_ld_reload_flag+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_reload_flag='-r' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. set dummy ${ac_tool_prefix}file; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_FILECMD+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$FILECMD"; then ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_FILECMD="${ac_tool_prefix}file" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi FILECMD=$ac_cv_prog_FILECMD if test -n "$FILECMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 printf "%s\n" "$FILECMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_FILECMD"; then ac_ct_FILECMD=$FILECMD # Extract the first word of "file", so it can be a program name with args. set dummy file; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_FILECMD+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_FILECMD"; then ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_FILECMD="file" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD if test -n "$ac_ct_FILECMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 printf "%s\n" "$ac_ct_FILECMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_FILECMD" = x; then FILECMD=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac FILECMD=$ac_ct_FILECMD fi else FILECMD="$ac_cv_prog_FILECMD" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 printf "%s\n" "$OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OBJDUMP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 printf %s "checking how to recognize dependent libraries... " >&6; } if test ${lt_cv_deplibs_check_method+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='$FILECMD -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly* | midnightbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=$FILECMD case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=$FILECMD lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 printf "%s\n" "$DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DLLTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 printf %s "checking how to associate runtime and link libraries... " >&6; } if test ${lt_cv_sharedlib_from_linklib_cmd+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} # Use ARFLAGS variable as AR's operation code to sync the variable naming with # Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have # higher priority because thats what people were doing historically (setting # ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS # variable obsoleted/removed. test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} lt_ar_flags=$AR_FLAGS # Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override # by AR_FLAGS because that was never working and AR_FLAGS is about to die. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 printf %s "checking for archiver @FILE support... " >&6; } if test ${lt_cv_ar_at_file+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 printf %s "checking command to parse $NM output from $compiler object... " >&6; } if test ${lt_cv_sys_global_symbol_pipe+y} then : printf %s "(cached) " >&6 else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 printf "%s\n" "failed" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 printf "%s\n" "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test ${with_sysroot+y} then : withval=$with_sysroot; else $as_nop with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 printf "%s\n" "${lt_sysroot:-no}" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 printf %s "checking for a working dd... " >&6; } if test ${ac_cv_path_lt_DD+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in dd do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 printf "%s\n" "$ac_cv_path_lt_DD" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 printf %s "checking how to truncate binary pipes... " >&6; } if test ${lt_cv_truncate_bin+y} then : printf %s "(cached) " >&6 else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 printf "%s\n" "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test ${enable_libtool_lock+y} then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `$FILECMD conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `$FILECMD conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `$FILECMD conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `$FILECMD conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `$FILECMD conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 printf %s "checking whether the C compiler needs -belf... " >&6; } if test ${lt_cv_cc_needs_belf+y} then : printf %s "(cached) " >&6 else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_cc_needs_belf=yes else $as_nop lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `$FILECMD conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 printf "%s\n" "$MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if test ${lt_cv_path_mainfest_tool+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 printf "%s\n" "$DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 printf "%s\n" "$NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_NMEDIT+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 printf "%s\n" "$ac_ct_NMEDIT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 printf "%s\n" "$LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_LIPO+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 printf "%s\n" "$ac_ct_LIPO" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 printf "%s\n" "$OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 printf "%s\n" "$ac_ct_OTOOL" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 printf "%s\n" "$OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_OTOOL64+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 printf "%s\n" "$ac_ct_OTOOL64" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 printf %s "checking for -single_module linker flag... " >&6; } if test ${lt_cv_apple_cc_single_mod+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 printf %s "checking for -exported_symbols_list linker flag... " >&6; } if test ${lt_cv_ld_exported_symbols_list+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_ld_exported_symbols_list=yes else $as_nop lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 printf %s "checking for -force_load linker flag... " >&6; } if test ${lt_cv_ld_force_load+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 $AR $AR_FLAGS libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) case $MACOSX_DEPLOYMENT_TARGET,$host in 10.[012],*|,*powerpc*-darwin[5-8]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes then : printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test ${enable_shared+y} then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_shared=yes fi # Check whether --enable-static was given. if test ${enable_static+y} then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_static=yes fi # Check whether --with-pic was given. if test ${with_pic+y} then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop pic_mode=default fi # Check whether --enable-fast-install was given. if test ${enable_fast_install+y} then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else $as_nop enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test ${with_aix_soname+y} then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else $as_nop if test ${lt_cv_with_aix_soname+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 printf %s "checking for objdir... " >&6; } if test ${lt_cv_objdir+y} then : printf %s "(cached) " >&6 else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC and # ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 printf %s "checking for ${ac_tool_prefix}file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 printf %s "checking for file... " >&6; } if test ${lt_cv_path_MAGIC_CMD+y} then : printf %s "(cached) " >&6 else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 printf "%s\n" "$MAGIC_CMD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test ${lt_cv_prog_compiler_rtti_exceptions+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # flang / f18. f95 an alias for gfortran or flang on Debian flang* | f18* | f95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | $SED 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 printf %s "checking for $compiler option to produce PIC... " >&6; } if test ${lt_cv_prog_compiler_pic+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test ${lt_cv_prog_compiler_pic_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test ${lt_cv_prog_compiler_static_works+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test ${lt_cv_prog_compiler_c_o+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | $SED 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if test ${lt_cv_aix_libpath_+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl* | icl*) # Native MSVC or ICC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC and ICC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly* | midnightbsd*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 printf %s "checking if $CC understands -b... " >&6; } if test ${lt_cv_prog_compiler__b+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if test ${lt_cv_irix_exported_symbol+y} then : printf %s "(cached) " >&6 else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : lt_cv_irix_exported_symbol=yes else $as_nop lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' ;; esac ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes file_list_spec='@' ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 printf %s "checking whether -lc should be explicitly linked in... " >&6; } if test ${lt_cv_archive_cmds_need_lc+y} then : printf %s "(cached) " >&6 else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl* | *,icl*) # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly* | midnightbsd*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if test ${lt_cv_shlibpath_overrides_runpath+y} then : printf %s "(cached) " >&6 else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes then : lt_cv_dlopen=shl_load else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 printf %s "checking for shl_load in -ldld... " >&6; } if test ${ac_cv_lib_dld_shl_load+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char shl_load (); int main (void) { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_shl_load=yes else $as_nop ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes then : lt_cv_dlopen=dlopen else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 printf %s "checking for dlopen in -ldl... " >&6; } if test ${ac_cv_lib_dl_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dl_dlopen=yes else $as_nop ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 printf %s "checking for dlopen in -lsvld... " >&6; } if test ${ac_cv_lib_svld_dlopen+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dlopen (); int main (void) { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_svld_dlopen=yes else $as_nop ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 printf %s "checking for dld_link in -ldld... " >&6; } if test ${ac_cv_lib_dld_dld_link+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char dld_link (); int main (void) { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dld_dld_link=yes else $as_nop ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 printf %s "checking whether a program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 printf %s "checking whether a statically linked program can dlopen itself... " >&6; } if test ${lt_cv_dlopen_self_static+y} then : printf %s "(cached) " >&6 else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 printf %s "checking whether stripping libraries is possible... " >&6; } if test -z "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } else if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else case $host_os in darwin*) # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; freebsd*) if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac fi fi # Report what library types will actually be built { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 printf %s "checking if libtool supports shared libraries... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 printf "%s\n" "$can_build_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 printf "%s\n" "$enable_shared" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 printf "%s\n" "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: LTVERSION="10:0:5" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes then : printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/times.h" "ac_cv_header_sys_times_h" "$ac_includes_default" if test "x$ac_cv_header_sys_times_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TIMES_H 1" >>confdefs.h fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 printf %s "checking size of int... " >&6; } if test ${ac_cv_sizeof_int+y} then : printf %s "(cached) " >&6 else $as_nop if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default" then : else $as_nop if test "$ac_cv_type_int" = yes; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 printf "%s\n" "$ac_cv_sizeof_int" >&6; } printf "%s\n" "#define SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 printf %s "checking size of long... " >&6; } if test ${ac_cv_sizeof_long+y} then : printf %s "(cached) " >&6 else $as_nop if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default" then : else $as_nop if test "$ac_cv_type_long" = yes; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 printf "%s\n" "$ac_cv_sizeof_long" >&6; } printf "%s\n" "#define SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 printf %s "checking size of long long... " >&6; } if test ${ac_cv_sizeof_long_long+y} then : printf %s "(cached) " >&6 else $as_nop if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default" then : else $as_nop if test "$ac_cv_type_long_long" = yes; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 printf "%s\n" "$ac_cv_sizeof_long_long" >&6; } printf "%s\n" "#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long" >>confdefs.h # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of void*" >&5 printf %s "checking size of void*... " >&6; } if test ${ac_cv_sizeof_voidp+y} then : printf %s "(cached) " >&6 else $as_nop if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void*))" "ac_cv_sizeof_voidp" "$ac_includes_default" then : else $as_nop if test "$ac_cv_type_voidp" = yes; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void*) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_voidp=0 fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_voidp" >&5 printf "%s\n" "$ac_cv_sizeof_voidp" >&6; } printf "%s\n" "#define SIZEOF_VOIDP $ac_cv_sizeof_voidp" >>confdefs.h ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 printf %s "checking for working alloca.h... " >&6; } if test ${ac_cv_working_alloca_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_working_alloca_h=yes else $as_nop ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 printf "%s\n" "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 printf %s "checking for alloca... " >&6; } if test ${ac_cv_func_alloca_works+y} then : printf %s "(cached) " >&6 else $as_nop if test $ac_cv_working_alloca_h = yes; then ac_cv_func_alloca_works=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef alloca # ifdef __GNUC__ # define alloca __builtin_alloca # elif defined _MSC_VER # include # define alloca _alloca # else # ifdef __cplusplus extern "C" # endif void *alloca (size_t); # endif #endif int main (void) { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_func_alloca_works=yes else $as_nop ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 printf "%s\n" "$ac_cv_func_alloca_works" >&6; } fi if test $ac_cv_func_alloca_works = yes; then printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 printf %s "checking stack direction for C alloca... " >&6; } if test ${ac_cv_c_stack_direction+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_c_stack_direction=0 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_c_stack_direction=1 else $as_nop ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 printf "%s\n" "$ac_cv_c_stack_direction" >&6; } printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h fi ac_config_files="$ac_config_files Makefile src/Makefile test/Makefile sample/Makefile onig-config" ac_config_commands="$ac_config_commands default" # for Issue #220 LIBONIG_DEF_FILE= FIX_TO_LDFLAGS= case $host_os in cygwin* | mingw* ) if test X"$enable_shared" = Xyes; then LIBONIG_DEF_FILE=libonig.def FIX_TO_LDFLAGS="-no-undefined" fi ;; esac EXTRA_LIBONIG_LDFLAGS="$EXTRA_LIBONIG_LDFLAGS $FIX_TO_LDFLAGS" if test -n "${LIBONIG_DEF_FILE}"; then USE_LIBONIG_DEF_FILE_TRUE= USE_LIBONIG_DEF_FILE_FALSE='#' else USE_LIBONIG_DEF_FILE_TRUE='#' USE_LIBONIG_DEF_FILE_FALSE= fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${ENABLE_BINARY_COMPATIBLE_POSIX_API_TRUE}" && test -z "${ENABLE_BINARY_COMPATIBLE_POSIX_API_FALSE}"; then as_fn_error $? "conditional \"ENABLE_BINARY_COMPATIBLE_POSIX_API\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_POSIX_API_TRUE}" && test -z "${ENABLE_POSIX_API_FALSE}"; then as_fn_error $? "conditional \"ENABLE_POSIX_API\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LIBONIG_DEF_FILE_TRUE}" && test -z "${USE_LIBONIG_DEF_FILE_FALSE}"; then as_fn_error $? "conditional \"USE_LIBONIG_DEF_FILE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; 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 # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by onig $as_me 6.9.10, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ onig config.status 6.9.10 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ FILECMD \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "sample/Makefile") CONFIG_FILES="$CONFIG_FILES sample/Makefile" ;; "onig-config") CONFIG_FILES="$CONFIG_FILES onig-config" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # A file(cmd) program that detects file types. FILECMD=$lt_FILECMD # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive (by configure). lt_ar_flags=$lt_ar_flags # Flags to create an archive. AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? $SED '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "default":C) chmod +x onig-config ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi jq-1.8.2/vendor/oniguruma/config.guess0000755000175100017510000013746215215513537013466 #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2020 Free Software Foundation, Inc. timestamp='2020-08-17' # 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/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . 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-2020 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 # 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 { 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/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl 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". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; 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. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; *:OS108:*:*) echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Twizzler:*:*) echo "$UNAME_MACHINE"-unknown-twizzler exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) 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 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if 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 echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if 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 echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; 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 echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-pc-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 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 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) 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 eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI="$LIBC"x32 fi fi echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; arm64:Darwin:*:*) echo aarch64-apple-darwin"$UNAME_RELEASE" exit ;; *: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 echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; *:Unleashed:*:*) echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" exit ;; esac # 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: jq-1.8.2/vendor/oniguruma/onig-config.cmake.in0000644000175100017510000000264715215513537014750 #!/bin/sh # Copyright (C) 2006 K.Kosako ONIG_VERSION=@PACKAGE_VERSION@ show_usage() { cat < (K.Kosako) jq-1.8.2/vendor/oniguruma/NEWS0000644000175100017510000000000015215513537011616 jq-1.8.2/vendor/oniguruma/sample/0000755000175100017510000000000015215513666012475 5jq-1.8.2/vendor/oniguruma/sample/callback_each_match.c0000644000175100017510000001066515215513537016456 /* * callback_each_match.c */ #include #include #include "oniguruma.h" static int each_match_callback(const UChar* str, const UChar* end, const UChar* match_start, OnigRegion* region, void* user_data) { #if 1 fprintf(stdout, "each_match_callback:\n"); fprintf(stdout, " match at: %ld - %d: %p\n", match_start - str, region->end[0], user_data); fprintf(stdout, " region[0]: %d - %d\n", region->beg[0], region->end[0]); #else int i; i = region->beg[0]; fputc('<', stdout); while (i < region->end[0]) { fputc((int )str[i], stdout); i++; } fputc('>', stdout); #endif #if 0 /* terminate match/search if returns error code < 0 */ return ONIG_ABORT; #endif return ONIG_NORMAL; } static int search(UChar* pattern, UChar* str, OnigOptionType options, OnigOptionType runtime_options) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; OnigMatchParam* mp; void* user_data; r = onig_new(®, pattern, pattern + strlen((char* )pattern), options, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; mp = onig_new_match_param(); if (mp == 0) return -2; user_data = (void* )0x1234; onig_set_callout_user_data_of_match_param(mp, user_data); r = onig_search_with_param(reg, str, end, start, range, region, runtime_options, mp); onig_free_match_param(mp); if (r >= 0) { /* If ONIG_OPTION_CALLBACK_EACH_MATCH is used with ONIG_OPTION_FIND_LONGEST, it may also return positive value. */ fprintf(stdout, "\nr: %d\n", r); } else if (r == ONIG_MISMATCH) { /* always return ONIG_MISMATCH if ONIG_OPTION_CALLBACK_EACH_MATCH */ fprintf(stdout, "\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return -1; } return 0; } static int match(UChar* pattern, UChar* str, UChar* at, OnigOptionType options, OnigOptionType runtime_options) { int r; unsigned char *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; OnigMatchParam* mp; void* user_data; r = onig_new(®, pattern, pattern + strlen((char* )pattern), options, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } region = onig_region_new(); end = str + strlen((char* )str); mp = onig_new_match_param(); if (mp == 0) return -2; user_data = (void* )0x1234; onig_set_callout_user_data_of_match_param(mp, user_data); r = onig_match_with_param(reg, str, end, at, region, runtime_options, mp); onig_free_match_param(mp); if (r >= 0) { /* If ONIG_OPTION_CALLBACK_EACH_MATCH is used with ONIG_OPTION_FIND_LONGEST, it may also return positive value. */ fprintf(stdout, "\nr: %d\n", r); } else if (r == ONIG_MISMATCH) { /* always return ONIG_MISMATCH if ONIG_OPTION_CALLBACK_EACH_MATCH */ fprintf(stdout, "\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return -1; } return 0; } extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; static UChar* pattern = (UChar* )"a(.*)\\Kb|[e-f]+"; static UChar* str = (UChar* )"zzzzafffb"; use_encs[0] = ONIG_ENCODING_ASCII; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); onig_set_callback_each_match(each_match_callback); fprintf(stdout, "\n"); search(pattern, str, ONIG_OPTION_NONE, ONIG_OPTION_CALLBACK_EACH_MATCH); fprintf(stdout, "\n"); search(pattern, str, ONIG_OPTION_FIND_LONGEST, ONIG_OPTION_CALLBACK_EACH_MATCH); fprintf(stdout, "\n"); match(pattern, str, str + 5, ONIG_OPTION_NONE, ONIG_OPTION_CALLBACK_EACH_MATCH); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/syntax.c0000644000175100017510000000377615215513537014121 /* * syntax.c */ #include #include #include "oniguruma.h" extern int exec(OnigSyntaxType* syntax, char* apattern, char* astr) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; UChar* pattern = (UChar* )apattern; UChar* str = (UChar* )astr; r = onig_new(®, pattern, pattern + strlen((char* )pattern), ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, syntax, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); return 0; } extern int main(int argc, char* argv[]) { int r; OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_ASCII; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); r = exec(ONIG_SYNTAX_PERL, "\\p{XDigit}\\P{XDigit}\\p{^XDigit}\\P{^XDigit}\\p{XDigit}", "bgh3a"); r = exec(ONIG_SYNTAX_JAVA, "\\p{XDigit}\\P{XDigit}[a-c&&b-g]", "bgc"); r = exec(ONIG_SYNTAX_ASIS, "abc def* e+ g?ddd[a-rvvv] (vv){3,7}hv\\dvv(?:aczui ss)\\W\\w$", "abc def* e+ g?ddd[a-rvvv] (vv){3,7}hv\\dvv(?:aczui ss)\\W\\w$"); onig_end(); return r; } jq-1.8.2/vendor/oniguruma/sample/posix.c0000644000175100017510000000503115215513537013717 /* * posix.c */ #include #include "onigposix.h" typedef unsigned char UChar; static int x(regex_t* reg, unsigned char* pattern, unsigned char* str) { int r, i; char buf[200]; regmatch_t pmatch[20]; r = regexec(reg, (char* )str, reg->re_nsub + 1, pmatch, 0); if (r != 0 && r != REG_NOMATCH) { regerror(r, reg, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); regfree(reg); return -1; } if (r == REG_NOMATCH) { fprintf(stderr, "FAIL: /%s/ '%s'\n", pattern, str); } else { fprintf(stderr, "OK: /%s/ '%s'\n", pattern, str); for (i = 0; i <= (int )reg->re_nsub; i++) { fprintf(stderr, "%d: %d-%d\n", i, pmatch[i].rm_so, pmatch[i].rm_eo); } } regfree(reg); return 0; } extern int main(int argc, char* argv[]) { int r; char buf[200]; regex_t reg; UChar* pattern; reg_set_encoding(REG_POSIX_ENCODING_ASCII); /* default syntax (ONIG_SYNTAX_ONIGURUMA) */ pattern = (UChar* )"^a+b{2,7}[c-f]?$|uuu"; r = regcomp(®, (char* )pattern, REG_EXTENDED); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); regfree(®); onig_end(); return -1; } x(®, pattern, (UChar* )"aaabbbbd"); /* POSIX Basic RE (REG_EXTENDED is not specified.) */ pattern = (UChar* )"^a+b{2,7}[c-f]?|uuu"; r = regcomp(®, (char* )pattern, 0); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); regfree(®); onig_end(); return -1; } x(®, pattern, (UChar* )"a+b{2,7}d?|uuu"); /* POSIX Basic RE (REG_EXTENDED is not specified.) */ pattern = (UChar* )"^a*b\\{2,7\\}\\([c-f]\\)$"; r = regcomp(®, (char* )pattern, 0); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); regfree(®); onig_end(); return -1; } x(®, pattern, (UChar* )"aaaabbbbbbd"); /* POSIX Extended RE */ onig_set_default_syntax(ONIG_SYNTAX_POSIX_EXTENDED); pattern = (UChar* )"^a+b{2,7}[c-f]?)$|uuu"; r = regcomp(®, (char* )pattern, REG_EXTENDED); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); regfree(®); onig_end(); return -1; } x(®, pattern, (UChar* )"aaabbbbd)"); pattern = (UChar* )"^b."; r = regcomp(®, (char* )pattern, REG_EXTENDED | REG_NEWLINE); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); regfree(®); onig_end(); return -1; } x(®, pattern, (UChar* )"a\nb\n"); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/simple.c0000644000175100017510000000313415215513537014050 /* * simple.c */ #include #include #include "oniguruma.h" extern int main(int argc, char* argv[]) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; OnigEncoding use_encs[1]; static UChar* pattern = (UChar* )"a(.*)b|[e-f]+"; static UChar* str = (UChar* )"zzzzaffffffffb"; use_encs[0] = ONIG_ENCODING_ASCII; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); r = onig_new(®, pattern, pattern + strlen((char* )pattern), ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/names.c0000644000175100017510000000417615215513537013671 /* * names.c -- example of group name callback. */ #include #include #include "oniguruma.h" static int name_callback(const UChar* name, const UChar* name_end, int ngroup_num, int* group_nums, regex_t* reg, void* arg) { int i, gn, ref; char* s; OnigRegion *region = (OnigRegion* )arg; for (i = 0; i < ngroup_num; i++) { gn = group_nums[i]; ref = onig_name_to_backref_number(reg, name, name_end, region); s = (ref == gn ? "*" : ""); fprintf(stderr, "%s (%d): ", name, gn); fprintf(stderr, "(%d-%d) %s\n", region->beg[gn], region->end[gn], s); } return 0; /* 0: continue */ } extern int main(int argc, char* argv[]) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; OnigEncoding use_encs[1]; static UChar* pattern = (UChar* )"(?a*)(?b*)(?c*)"; static UChar* str = (UChar* )"aaabbbbcc"; use_encs[0] = ONIG_ENCODING_ASCII; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); r = onig_new(®, pattern, pattern + strlen((char* )pattern), ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } fprintf(stderr, "number of names: %d\n", onig_number_of_names(reg)); region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { fprintf(stderr, "match at %d\n\n", r); r = onig_foreach_name(reg, name_callback, (void* )region); } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/listcap.c0000644000175100017510000000621115215513537014215 /* * listcap.c * * capture history (?@...) sample. */ #include #include #include "oniguruma.h" static int node_callback(int group, int beg, int end, int level, int at, void* arg) { int i; if (at != ONIG_TRAVERSE_CALLBACK_AT_FIRST) return -1; /* error */ /* indent */ for (i = 0; i < level * 2; i++) fputc(' ', stderr); fprintf(stderr, "%d: (%d-%d)\n", group, beg, end); return 0; } extern int ex(unsigned char* str, unsigned char* pattern, OnigSyntaxType* syntax, OnigOptionType options) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; r = onig_new(®, pattern, pattern + strlen((char* )pattern), options, ONIG_ENCODING_ASCII, syntax, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } fprintf(stderr, "number of captures: %d\n", onig_number_of_captures(reg)); fprintf(stderr, "number of capture histories: %d\n", onig_number_of_capture_histories(reg)); region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } fprintf(stderr, "\n"); r = onig_capture_tree_traverse(region, ONIG_TRAVERSE_CALLBACK_AT_FIRST, node_callback, (void* )0); } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); return 0; } extern int main(int argc, char* argv[]) { int r; OnigSyntaxType syn; OnigEncoding use_encs[1]; static UChar* str1 = (UChar* )"((())())"; static UChar* pattern1 = (UChar* )"\\g

(?@

\\(\\g\\)){0}(?@(?:\\g

)*|){0}"; static UChar* str2 = (UChar* )"x00x00x00"; static UChar* pattern2 = (UChar* )"(?@x(?@\\d+))+"; static UChar* str3 = (UChar* )"0123"; static UChar* pattern3 = (UChar* )"(?@.)(?@.)(?@.)(?@.)"; static UChar* str4 = (UChar* )"(((a))(a)) ((((a))(a)))"; static UChar* pattern4 = (UChar* )"\\g

(?@

\\(\\g\\)){0}(?@(?:\\g

)*|a){0}"; use_encs[0] = ONIG_ENCODING_ASCII; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); /* enable capture history */ onig_copy_syntax(&syn, ONIG_SYNTAX_DEFAULT); onig_set_syntax_op2(&syn, onig_get_syntax_op2(&syn) | ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY); r = ex(str1, pattern1, &syn, ONIG_OPTION_NONE); r = ex(str2, pattern2, &syn, ONIG_OPTION_NONE); r = ex(str3, pattern3, &syn, ONIG_OPTION_NONE); r = ex(str4, pattern4, &syn, ONIG_OPTION_FIND_LONGEST); onig_end(); return r; } jq-1.8.2/vendor/oniguruma/sample/callout.c0000644000175100017510000001710415215513537014224 /* * callout.c */ #include #include #include #include "oniguruma.h" static int callout_body(OnigCalloutArgs* args, void* user_data) { int r; int i; int n; int begin, end; int used_num; int used_bytes; OnigCalloutIn in; int name_id; const UChar* contents; const UChar* start; const UChar* current; regex_t* regex; in = onig_get_callout_in_by_callout_args(args); name_id = onig_get_name_id_by_callout_args(args); start = onig_get_start_by_callout_args(args); current = onig_get_current_by_callout_args(args); regex = onig_get_regex_by_callout_args(args); contents = onig_get_contents_by_callout_args(args); if (name_id != ONIG_NON_NAME_ID) { UChar* name = onig_get_callout_name_by_name_id(name_id); fprintf(stdout, "name: %s\n", name); } fprintf(stdout, "%s %s: contents: \"%s\", start: \"%s\", current: \"%s\"\n", contents != 0 ? "CONTENTS" : "NAME", in == ONIG_CALLOUT_IN_PROGRESS ? "PROGRESS" : "RETRACTION", contents, start, current); fprintf(stdout, "user_data: %s\n", (char* )user_data); (void )onig_get_used_stack_size_in_callout(args, &used_num, &used_bytes); fprintf(stdout, "stack: used_num: %d, used_bytes: %d\n", used_num, used_bytes); n = onig_number_of_captures(regex); for (i = 1; i <= n; i++) { r = onig_get_capture_range_in_callout(args, i, &begin, &end); if (r != ONIG_NORMAL) return r; fprintf(stdout, "capture %d: (%d-%d)\n", i, begin, end); } fflush(stdout); return ONIG_CALLOUT_SUCCESS; } static int progress_callout_func(OnigCalloutArgs* args, void* user_data) { return callout_body(args, user_data); } static int retraction_callout_func(OnigCalloutArgs* args, void* user_data) { return callout_body(args, user_data); } static int foo(OnigCalloutArgs* args, void* user_data) { return callout_body(args, user_data); } static int bar(OnigCalloutArgs* args, void* user_data) { int r; int i; int n; OnigType type; OnigValue val; fprintf(stdout, "bar called.\n"); n = onig_get_args_num_by_callout_args(args); if (n < 0) { fprintf(stderr, "FAIL: onig_get_args_num_by_callout_args(): %d\n", n); return n; } for (i = 0; i < n; i++) { r = onig_get_arg_by_callout_args(args, i, &type, &val); if (r != 0) { fprintf(stderr, "FAIL: onig_get_arg_by_callout_args(): %d\n", r); return r; } fprintf(stdout, "arg[%d]: ", i); switch (type) { case ONIG_TYPE_LONG: fprintf(stdout, "%ld\n", val.l); break; case ONIG_TYPE_CHAR: fprintf(stdout, "0x%06x\n", val.c); break; case ONIG_TYPE_STRING: fprintf(stdout, "'%s'\n", val.s.start); break; default: /* Never come here. But escape warning. */ break; }; } return ONIG_CALLOUT_SUCCESS; } static int test(OnigEncoding enc, OnigMatchParam* mp, char* in_pattern, char* in_str) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; UChar* pattern; UChar* str; pattern = (UChar* )in_pattern; str = (UChar* )in_str; r = onig_new(®, pattern, pattern + strlen((char* )pattern), ONIG_OPTION_DEFAULT, enc, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "COMPILE ERROR: %d: %s\n", r, s); return -1; } region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search_with_param(reg, str, end, start, range, region, ONIG_OPTION_NONE, mp); if (r >= 0) { int i; fprintf(stderr, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "SEARCH ERROR: %d: %s\n", r, s); } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); return r; } extern int main(int argc, char* argv[]) { int r; int id; void* user_data; UChar* name; OnigEncoding use_encs[1]; unsigned int arg_types[4]; OnigValue opt_defaults[4]; OnigEncoding enc; OnigMatchParam* mp; enc = ONIG_ENCODING_UTF8; use_encs[0] = enc; r = onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); if (r != ONIG_NORMAL) return -1; /* monitor on */ r = onig_setup_builtin_monitors_by_ascii_encoded_name(stdout); if (r != ONIG_NORMAL) return -1; name = (UChar* )"foo"; id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE, name, name + strlen((char* )name), ONIG_CALLOUT_IN_BOTH, foo, 0, 0, 0, 0, 0); if (id < 0) { fprintf(stderr, "ERROR: fail to set callout of name: %s\n", name); //return -1; } name = (UChar* )"bar"; arg_types[0] = ONIG_TYPE_LONG; arg_types[1] = ONIG_TYPE_STRING; arg_types[2] = ONIG_TYPE_CHAR; opt_defaults[0].s.start = (UChar* )"I am a option argument's default value."; opt_defaults[0].s.end = opt_defaults[0].s.start + strlen((char* )opt_defaults[0].s.start); opt_defaults[1].c = 0x4422; id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE, name, name + strlen((char* )name), ONIG_CALLOUT_IN_PROGRESS, bar, 0, 3, arg_types, 2, opt_defaults); if (id < 0) { fprintf(stderr, "ERROR: fail to set callout of name: %s\n", name); //return -1; } (void)onig_set_progress_callout(progress_callout_func); (void)onig_set_retraction_callout(retraction_callout_func); mp = onig_new_match_param(); user_data = (void* )"something data"; r = onig_set_callout_user_data_of_match_param(mp, user_data); if (r != ONIG_NORMAL) { fprintf(stderr, "ERROR: fail onig_set_callout_user_data_of_match_param(): %d\n", r); } /* callout of contents */ test(enc, mp, "a+(?{foo bar baz...}X)$", "aaab"); test(enc, mp, "(?{{!{}#$%&'()=-~^|[_]`@*:+;<>?/.\\,}}[symbols])c", "abc"); test(enc, mp, "\\A(...)(?{{{booooooooooooo{{ooo}}ooooooooooz}}}<)", "aaab"); test(enc, mp, "\\A(?!a(?{in prec-read-not}[xxx]X)b)", "ac"); test(enc, mp, "(?=,4})", "abababcabababaa"); test(enc, mp, "(?:(*MAX[T]{3})a)*(?:(*MAX{T})c)*", "aaccc"); /* callouts in condition */ test(enc, mp, "\\A(?(?{in condition})then|else)\\z", "then"); test(enc, mp, "\\A(?(*FAIL)then|else)\\z", "else"); /* monitor test */ test(enc, mp, "(?:(*MON{X})(*FAIL)|.{,3}(*MON[FOO])k)", "abcdefghijk"); onig_free_match_param(mp); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/bug_fix.c0000644000175100017510000000446115215513537014206 /* * bug_fix.c */ #include #include "oniguruma.h" static int search(regex_t* reg, unsigned char* str, unsigned char* end) { int r; unsigned char *start, *range; OnigRegion *region; region = onig_region_new(); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d (%s)\n", r, ONIGENC_NAME(onig_get_encoding(reg))); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail (%s)\n", ONIGENC_NAME(onig_get_encoding(reg))); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); fprintf(stderr, " (%s)\n", ONIGENC_NAME(onig_get_encoding(reg))); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); return 0; } static int exec(OnigEncoding enc, OnigOptionType options, char* apattern, char* astr) { int r; unsigned char *end; regex_t* reg; OnigErrorInfo einfo; UChar* pattern = (UChar* )apattern; UChar* str = (UChar* )astr; r = onig_new(®, pattern, pattern + onigenc_str_bytelen_null(enc, pattern), options, enc, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } end = str + onigenc_str_bytelen_null(enc, str); r = search(reg, str, end); onig_free(reg); return 0; } extern int main(int argc, char* argv[]) { OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_UTF8; onig_initialize(use_encs, 1); /* fix ignore case in look-behind commit: 3340ec2cc5627172665303fe248c9793354d2251 */ exec(ONIG_ENCODING_UTF8, ONIG_OPTION_IGNORECASE, "\305\211a", "\312\274na"); /* \u{0149}a \u{02bc}na */ exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE, "(\\2)(\\1)", "aa"); /* fail. */ exec(ONIG_ENCODING_UTF8, ONIG_OPTION_FIND_LONGEST, "a*", "aa aaa aaaa aaaaa "); /* match 12-17 */ onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/Makefile.am0000644000175100017510000000246015215513537014450 #noinst_PROGRAMS = encode listcap names posix simple sql syntax crnl lib_onig = ../src/libonig.la LDADD = $(lib_onig) AM_CFLAGS = -Wall AM_LDFLAGS = -L$(libdir) AM_CPPFLAGS = -I$(top_srcdir)/src if ENABLE_POSIX_API TESTS = encode listcap names posix simple sql syntax user_property callout echo count bug_fix regset scan callback_each_match else TESTS = encode listcap names simple sql syntax user_property callout echo count bug_fix regset scan callback_each_match endif check_PROGRAMS = $(TESTS) encode_SOURCES = encode.c listcap_SOURCES = listcap.c names_SOURCES = names.c posix_SOURCES = posix.c simple_SOURCES = simple.c sql_SOURCES = sql.c syntax_SOURCES = syntax.c user_property_SOURCES = user_property.c callout_SOURCES = callout.c echo_SOURCES = echo.c count_SOURCES = count.c bug_fix = bug_fix.c regset_SOURCES = regset.c scan_SOURCES = scan.c callback_each_match_SOURCES = callback_each_match.c sampledir = . test: $(TESTS) $(sampledir)/encode $(sampledir)/listcap $(sampledir)/names if ENABLE_POSIX_API $(sampledir)/posix endif $(sampledir)/simple $(sampledir)/sql $(sampledir)/syntax $(sampledir)/user_property $(sampledir)/callout $(sampledir)/echo $(sampledir)/count $(sampledir)/bug_fix $(sampledir)/regset $(sampledir)/scan $(sampledir)/callback_each_match jq-1.8.2/vendor/oniguruma/sample/scan.c0000644000175100017510000000470415215513537013507 /* * scan.c */ #include #include #include "oniguruma.h" static int scan_callback(int n, int r, OnigRegion* region, void* arg) { int i; fprintf(stdout, "scan: %d\n", n); fprintf(stdout, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stdout, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } return 0; } static int scan(regex_t* reg, OnigOptionType options, unsigned char* str, unsigned char* end) { int r; OnigRegion *region; region = onig_region_new(); r = onig_scan(reg, str, end, region, options, scan_callback, NULL); if (r >= 0) { fprintf(stdout, "total: %d match\n", r); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((OnigUChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); return 0; } static int exec(OnigEncoding enc, OnigOptionType options, OnigOptionType runtime_options, char* apattern, char* astr) { int r; unsigned char *end; regex_t* reg; OnigErrorInfo einfo; UChar* pattern_end; UChar* pattern = (UChar* )apattern; UChar* str = (UChar* )astr; onig_initialize(&enc, 1); pattern_end = pattern + onigenc_str_bytelen_null(enc, pattern); r = onig_new(®, pattern, pattern_end, options, enc, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((OnigUChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); onig_end(); return -1; } end = str + onigenc_str_bytelen_null(enc, str); r = scan(reg, runtime_options, str, end); onig_free(reg); onig_end(); return 0; } extern int main(int argc, char* argv[]) { exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE, ONIG_OPTION_NONE, "\\Ga+\\s*", "a aa aaa baaa"); fprintf(stdout, "\n"); exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE, ONIG_OPTION_NOT_BEGIN_POSITION, "\\Ga+\\s*", "a aa aaa baaa"); fprintf(stdout, "\n"); exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE, ONIG_OPTION_NONE, "(?!\\G)a+\\s*", "a aa aaa baaa"); fprintf(stdout, "\n"); exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE, ONIG_OPTION_NOT_BEGIN_POSITION, "(?!\\G)a+\\s*", "a aa aaa baaa"); fprintf(stdout, "\n"); exec(ONIG_ENCODING_UTF8, ONIG_OPTION_NONE, ONIG_OPTION_NONE, "a+\\s*", "a aa aaa baaa"); return 0; } jq-1.8.2/vendor/oniguruma/sample/echo.c0000644000175100017510000000627215215513537013503 /* * echo.c */ #include #include #include #include "oniguruma.h" static int echo(OnigCalloutArgs* args, void* user_data) { int r; OnigCalloutIn in; OnigType type; OnigValue val; FILE* fp; fp = stdout; in = onig_get_callout_in_by_callout_args(args); r = onig_get_arg_by_callout_args(args, 1, &type, &val); if (r != ONIG_NORMAL) return r; if (in == ONIG_CALLOUT_IN_PROGRESS) { if (val.c == '<') return ONIG_CALLOUT_SUCCESS; } else { if (val.c != 'X' && val.c != '<') return ONIG_CALLOUT_SUCCESS; } r = onig_get_arg_by_callout_args(args, 0, &type, &val); if (r != ONIG_NORMAL) return r; fprintf(fp, "%s %s\n", (in == ONIG_CALLOUT_IN_PROGRESS ? "=>" : "<="), val.s.start); fflush(fp); return ONIG_CALLOUT_SUCCESS; } static int test(OnigEncoding enc, char* in_pattern, char* in_str) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; UChar* pattern; UChar* str; pattern = (UChar* )in_pattern; str = (UChar* )in_str; r = onig_new(®, pattern, pattern + strlen((char* )pattern), ONIG_OPTION_DEFAULT, enc, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "COMPILE ERROR: %d: %s\n", r, s); return -1; } region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "SEARCH ERROR: %d: %s\n", r, s); } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); return r; } extern int main(int argc, char* argv[]) { int r; int id; UChar* name; OnigEncoding use_encs[1]; OnigType arg_types[4]; OnigValue opt_defaults[4]; OnigEncoding enc; enc = ONIG_ENCODING_UTF8; use_encs[0] = enc; r = onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); if (r != ONIG_NORMAL) return -1; name = (UChar* )"echo"; arg_types[0] = ONIG_TYPE_STRING; arg_types[1] = ONIG_TYPE_CHAR; opt_defaults[0].s.start = (UChar* )"echo"; opt_defaults[0].s.end = opt_defaults[0].s.start + strlen((char* )opt_defaults[0].s.start); opt_defaults[1].c = '>'; id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE, name, name + strlen((char* )name), ONIG_CALLOUT_IN_BOTH, echo, 0, 2, arg_types, 2, opt_defaults); if (id < 0) { fprintf(stderr, "ERROR: fail to set callout of name: %s\n", name); return -1; } test(enc, "(?:(*echo{abc!!!})a|b)*", "abba"); test(enc, "(?:(*echo{xyz,X})a|b)*", "abba"); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/user_property.c0000644000175100017510000000465715215513537015514 /* * user_property.c */ #include #include #include "oniguruma.h" extern int main(int argc, char* argv[]) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; OnigEncoding use_encs[1]; static OnigCodePoint handakuon_hiragana[] = { 5, /* number of ranges */ 0x3071, 0x3071, /* PA */ 0x3074, 0x3074, /* PI */ 0x3077, 0x3077, /* PU */ 0x307a, 0x307a, /* PE */ 0x307d, 0x307d /* PO */ }; static UChar* pattern = (UChar* )"\\A(\\p{HandakuonHiragana}{5})\\p{^HandakuonHiragana}\\z"; //static UChar* pattern = (UChar* )"\\p{Handakuon_Hiragana}{5}\\P{Handakuon Hiragana}"; /* "PA PI PU PE PO a" */ static UChar* str = (UChar* )"\343\201\261\343\201\264\343\201\267\343\201\272\343\201\275a"; use_encs[0] = ONIG_ENCODING_UTF8; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); r = onig_unicode_define_user_property("HandakuonHiragana", handakuon_hiragana); if (r == ONIG_NORMAL) { fprintf(stdout, "define HandakuonHiragana\n"); } else { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_end(); return -1; } r = onig_new(®, pattern, pattern + strlen((char* )pattern), ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, &einfo); if (r == ONIG_NORMAL) { fprintf(stdout, "onig_new: success.\n"); } else { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "onig_new: ERROR: %s\n", s); onig_end(); return -1; } region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/encode.c0000644000175100017510000001624015215513537014016 /* * encode.c */ #include #include "oniguruma.h" static int search(regex_t* reg, unsigned char* str, unsigned char* end) { int r; unsigned char *start, *range; OnigRegion *region; region = onig_region_new(); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d (%s)\n", r, ONIGENC_NAME(onig_get_encoding(reg))); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail (%s)\n", ONIGENC_NAME(onig_get_encoding(reg))); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); fprintf(stderr, " (%s)\n", ONIGENC_NAME(onig_get_encoding(reg))); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); return 0; } static int exec(OnigEncoding enc, OnigOptionType options, char* apattern, char* astr) { int r; unsigned char *end; regex_t* reg; OnigErrorInfo einfo; UChar* pattern = (UChar* )apattern; UChar* str = (UChar* )astr; onig_initialize(&enc, 1); r = onig_new(®, pattern, pattern + onigenc_str_bytelen_null(enc, pattern), options, enc, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); return -1; } end = str + onigenc_str_bytelen_null(enc, str); r = search(reg, str, end); onig_free(reg); onig_end(); return 0; } extern int main(int argc, char* argv[]) { int r; /* ISO 8859-1 test */ static unsigned char str[] = { 0xc7, 0xd6, 0xfe, 0xea, 0xe0, 0xe2, 0x00 }; static unsigned char pattern[] = { 0xe7, 0xf6, 0xde, '\\', 'w', '+', 0x00 }; r = exec(ONIG_ENCODING_SJIS, ONIG_OPTION_NONE, "^a\\p{Hiragana}c$", "a\202\274c"); r = exec(ONIG_ENCODING_EUC_JP, ONIG_OPTION_NONE, "^a\\p{Hiragana}c$", "a\244\276c"); r = exec(ONIG_ENCODING_CP1251, ONIG_OPTION_IGNORECASE, "aBc", " AbC"); r = exec(ONIG_ENCODING_ISO_8859_1, ONIG_OPTION_IGNORECASE, " [a-c\337z] ", " SS "); r = exec(ONIG_ENCODING_ISO_8859_1, ONIG_OPTION_IGNORECASE, " [\330-\341] ", " SS "); r = exec(ONIG_ENCODING_ISO_8859_2, ONIG_OPTION_IGNORECASE, "\337 ", " Ss "); r = exec(ONIG_ENCODING_ISO_8859_2, ONIG_OPTION_IGNORECASE, "SS ", " \337 "); r = exec(ONIG_ENCODING_ISO_8859_2, ONIG_OPTION_IGNORECASE, "\\A\\S\\z", "ss"); r = exec(ONIG_ENCODING_ISO_8859_2, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_3, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_4, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_5, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_6, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_7, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_8, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_9, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_10, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_11, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_13, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_14, ONIG_OPTION_IGNORECASE, "[ac]+", "bbbaAaCCC"); r = exec(ONIG_ENCODING_ISO_8859_15, ONIG_OPTION_IGNORECASE, (char* )pattern, (char* )str); r = exec(ONIG_ENCODING_ISO_8859_16, ONIG_OPTION_IGNORECASE, (char* )pattern, (char* )str); r = exec(ONIG_ENCODING_KOI8_R, ONIG_OPTION_NONE, "a+", "bbbaaaccc"); r = exec(ONIG_ENCODING_EUC_TW, ONIG_OPTION_NONE, "b*a+?c+", "bbbaaaccc"); r = exec(ONIG_ENCODING_EUC_KR, ONIG_OPTION_NONE, "a+", "bbbaaaccc"); r = exec(ONIG_ENCODING_EUC_CN, ONIG_OPTION_NONE, "c+", "bbbaaaccc"); r = exec(ONIG_ENCODING_BIG5, ONIG_OPTION_NONE, "a+", "bbbaaaccc"); r = exec(ONIG_ENCODING_ISO_8859_1, ONIG_OPTION_IGNORECASE, "\337", "SS"); r = exec(ONIG_ENCODING_ISO_8859_1, ONIG_OPTION_IGNORECASE, "SS", "\337"); r = exec(ONIG_ENCODING_ISO_8859_1, ONIG_OPTION_IGNORECASE, "SSb\337ssc", "a\337bSS\337cd"); r = exec(ONIG_ENCODING_ISO_8859_1, ONIG_OPTION_IGNORECASE, "[a\337]{0,2}", "aSS"); r = exec(ONIG_ENCODING_ISO_8859_1, ONIG_OPTION_IGNORECASE, "is", "iss"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_NONE, "\000[\000[\000:\000a\000l\000n\000u\000m\000:\000]\000]\000+\000\000", "\000#\002\120\000a\000Z\012\077\012\076\012\075\000\000"); /* 0x0a3d == \012\075 : is not alnum */ /* 0x0a3e == \012\076 : is alnum */ r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_NONE, "\000\\\000d\000+\000\000", "\0003\0001\377\020\377\031\377\032\000\000"); r = exec(ONIG_ENCODING_GB18030, ONIG_OPTION_IGNORECASE, "(Aa\\d)+", "BaA5Aa0234"); r = exec(ONIG_ENCODING_GB18030, ONIG_OPTION_NONE, "[[^\\w]]+[^\xee\xef]\xee\xef", "[[^\\w]]+[^\xee\xef]\xee\xef"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, "\000[\000\337\000]\000\000", "\000S\000S\000\000"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, "\000[\000\337\000]\000\000", "\000s\000S\000\000"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, "\000^\000[\000\001\000-\377\375\000]\000$\000\000", "\000s\000S\000\000"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, "\000S\000S\000\000", "\000S\000T\000\337\000\000"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, "\000S\000T\000S\000S\000\000", "\000S\000t\000s\000S\000\000"); { UChar pat[] = { 0x1f, 0xfc, 0x00, 0x00 }; UChar str1[] = { 0x21, 0x26, 0x1f, 0xbe, 0x00, 0x00 }; UChar str2[] = { 0x1f, 0xf3, 0x00, 0x00 }; r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, (char* )pat, (char* )str1); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, (char* )pat, (char* )str2); } #if 0 /* You should define USE_UNICODE_CASE_FOLD_TURKISH_AZERI in regenc.h. */ set_case_fold(ONIGENC_CASE_FOLD_TURKISH_AZERI); r = exec(ONIG_ENCODING_UTF8, ONIG_ENCODING_UTF8, ONIG_OPTION_IGNORECASE, "Ii", "\304\261\304\260"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, "\000I\000i\000\000", "\001\061\001\060\000\000"); r = exec(ONIG_ENCODING_UTF16_BE, ONIG_OPTION_IGNORECASE, "\001\061\001\060\000\000", "\000I\000i\000\000"); set_case_fold(ONIGENC_CASE_FOLD_MIN); #endif return r; } jq-1.8.2/vendor/oniguruma/sample/regset.c0000644000175100017510000000435015215513537014051 /* * regset.c */ #include #include #include "oniguruma.h" extern int main(int argc, char* argv[]) { int r; int i, n; int match_pos; unsigned char *start, *range, *end; OnigRegSet* set; OnigRegSetLead lead; regex_t* reg; OnigErrorInfo einfo; char ebuf[ONIG_MAX_ERROR_MESSAGE_LEN]; OnigEncoding use_encs[1]; static UChar* str = (UChar* )"aaaaaaaaaaaaaaaaaaaaaaca"; static char* pat[] = { "a(.*)b|a(.)c", "^(abc)", "a(.....)c" }; use_encs[0] = ONIG_ENCODING_UTF8; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); r = onig_regset_new(&set, 0, NULL); if (r != ONIG_NORMAL) { onig_error_code_to_str((UChar* )ebuf, r); fprintf(stderr, "ERROR: %s\n", ebuf); onig_end(); return -1; } n = sizeof(pat) / sizeof(pat[0]); for (i = 0; i < n; i++) { r = onig_new(®, (UChar* )pat[i], (UChar* )(pat[i] + strlen(pat[i])), ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { onig_error_code_to_str((UChar* )ebuf, r, &einfo); fprintf(stderr, "ERROR: %s\n", ebuf); onig_regset_free(set); onig_end(); return -1; } r = onig_regset_add(set, reg); if (r != ONIG_NORMAL) { onig_free(reg); onig_regset_free(set); onig_end(); return -1; } } end = str + strlen((char* )str); start = str; range = end; lead = ONIG_REGSET_POSITION_LEAD; //lead = ONIG_REGSET_PRIORITY_TO_REGEX_ORDER; r = onig_regset_search(set, str, end, start, range, lead, ONIG_OPTION_NONE, &match_pos); if (r >= 0) { OnigRegion *region; fprintf(stderr, "match regex index: %d\n", r); fprintf(stderr, "match position: %d\n", match_pos); region = onig_regset_get_region(set, r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ onig_error_code_to_str((UChar* )ebuf, r); fprintf(stderr, "ERROR: %s\n", ebuf); onig_regset_free(set); onig_end(); return -1; } onig_regset_free(set); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/count.c0000644000175100017510000000655415215513537013720 /* * count.c */ #include #include #include #include "oniguruma.h" #define ulen(enc, p) onigenc_str_bytelen_null(enc, (UChar* )p) static int test(OnigEncoding enc, OnigMatchParam* mp, char* in_pattern, char* in_str) { int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; UChar* pattern; UChar* str; pattern = (UChar* )in_pattern; str = (UChar* )in_str; r = onig_new(®, pattern, pattern + ulen(enc, pattern), ONIG_OPTION_DEFAULT, enc, ONIG_SYNTAX_DEFAULT, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "COMPILE ERROR: %d: %s\n", r, s); return -1; } region = onig_region_new(); end = str + ulen(enc, str); start = str; range = end; r = onig_search_with_param(reg, str, end, start, range, region, ONIG_OPTION_NONE, mp); if (r >= 0) { int slot; OnigValue val; char* tag; int tag_len; fprintf(stdout, "match at %d\n", r); show_count: if (enc == ONIG_ENCODING_UTF16_BE) { tag = "\000x\000\000"; } else if (enc == ONIG_ENCODING_UTF16_LE) { tag = "x\000\000\000"; } else { tag = "x"; } tag_len = ulen(enc, tag); slot = 0; r = onig_get_callout_data_by_tag_dont_clear_old(reg, mp, (UChar* )tag, (UChar* )tag + tag_len, slot, 0, &val); if (r < ONIG_NORMAL) goto err; else if (r == ONIG_VALUE_IS_NOT_SET) { fprintf(stdout, "COUNT[x]: NO DATA\n"); } else { fprintf(stdout, "COUNT[x]: %ld\n", val.l); } } else if (r == ONIG_MISMATCH) { fprintf(stdout, "search fail\n"); goto show_count; } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; err: onig_error_code_to_str((UChar* )s, r); fprintf(stdout, "SEARCH ERROR: %d: %s\n", r, s); } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); return r; } extern int main(int argc, char* argv[]) { int r; OnigMatchParam* mp; OnigEncoding encs[3]; encs[0] = ONIG_ENCODING_UTF8; encs[1] = ONIG_ENCODING_UTF16_BE; encs[2] = ONIG_ENCODING_UTF16_LE; r = onig_initialize(encs, sizeof(encs)/sizeof(encs[0])); if (r != ONIG_NORMAL) { fprintf(stderr, "FAIL: onig_initialize(): %d\n", r); return -1; } mp = onig_new_match_param(); test(encs[0], mp, "abc(.(*COUNT[x]))*(*FAIL)", "abcdefg"); test(encs[0], mp, "abc(.(*COUNT[_any_]))*(.(*COUNT[x]))*d", "abcdefg"); /* fail count */ test(encs[0], mp, "abc(.(*COUNT[x]{<}))*f", "abcdefg"); /* success count */ test(encs[0], mp, "abc(.(*COUNT[x]{X}))*f", "abcdefg"); /* passed count */ test(encs[0], mp, "abc(.(*COUNT[x]))*f", "abcdefg"); test(encs[0], mp, "a(.(*COUNT[x]))*z", "abcd\nabcdz"); /* total count */ test(encs[0], mp, "a(.(*TOTAL_COUNT[x]))*z", "abcd\nabcdz"); test(encs[1], mp, "\000a\000b\000c\000(\000.\000(\000*\000C\000O\000U\000N\000T\000[\000x\000]\000)\000)\000*\000(\000*\000F\000A\000I\000L\000)\000\000", "\000a\000b\000c\000d\000e\000f\000g\000\000"); test(encs[2], mp, "a\000b\000c\000(\000.\000(\000*\000C\000O\000U\000N\000T\000[\000x\000]\000)\000)\000*\000(\000*\000F\000A\000I\000L\000)\000\000\000", "a\000b\000c\000d\000e\000f\000g\000\000\000"); onig_free_match_param(mp); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/sample/Makefile.in0000644000175100017510000013150115215513553014456 # Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ #noinst_PROGRAMS = encode listcap names posix simple sql syntax crnl VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_POSIX_API_FALSE@TESTS = encode$(EXEEXT) listcap$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ names$(EXEEXT) simple$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ sql$(EXEEXT) syntax$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ user_property$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ callout$(EXEEXT) echo$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ count$(EXEEXT) bug_fix$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ regset$(EXEEXT) scan$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ callback_each_match$(EXEEXT) @ENABLE_POSIX_API_TRUE@TESTS = encode$(EXEEXT) listcap$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ names$(EXEEXT) posix$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ simple$(EXEEXT) sql$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ syntax$(EXEEXT) user_property$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ callout$(EXEEXT) echo$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ count$(EXEEXT) bug_fix$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ regset$(EXEEXT) scan$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ callback_each_match$(EXEEXT) check_PROGRAMS = $(am__EXEEXT_1) subdir = sample ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_POSIX_API_FALSE@am__EXEEXT_1 = encode$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ listcap$(EXEEXT) names$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ simple$(EXEEXT) sql$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ syntax$(EXEEXT) user_property$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ callout$(EXEEXT) echo$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ count$(EXEEXT) bug_fix$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ regset$(EXEEXT) scan$(EXEEXT) \ @ENABLE_POSIX_API_FALSE@ callback_each_match$(EXEEXT) @ENABLE_POSIX_API_TRUE@am__EXEEXT_1 = encode$(EXEEXT) listcap$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ names$(EXEEXT) posix$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ simple$(EXEEXT) sql$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ syntax$(EXEEXT) user_property$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ callout$(EXEEXT) echo$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ count$(EXEEXT) bug_fix$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ regset$(EXEEXT) scan$(EXEEXT) \ @ENABLE_POSIX_API_TRUE@ callback_each_match$(EXEEXT) bug_fix_SOURCES = bug_fix.c bug_fix_OBJECTS = bug_fix.$(OBJEXT) bug_fix_LDADD = $(LDADD) bug_fix_DEPENDENCIES = $(lib_onig) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_callback_each_match_OBJECTS = callback_each_match.$(OBJEXT) callback_each_match_OBJECTS = $(am_callback_each_match_OBJECTS) callback_each_match_LDADD = $(LDADD) callback_each_match_DEPENDENCIES = $(lib_onig) am_callout_OBJECTS = callout.$(OBJEXT) callout_OBJECTS = $(am_callout_OBJECTS) callout_LDADD = $(LDADD) callout_DEPENDENCIES = $(lib_onig) am_count_OBJECTS = count.$(OBJEXT) count_OBJECTS = $(am_count_OBJECTS) count_LDADD = $(LDADD) count_DEPENDENCIES = $(lib_onig) am_echo_OBJECTS = echo.$(OBJEXT) echo_OBJECTS = $(am_echo_OBJECTS) echo_LDADD = $(LDADD) echo_DEPENDENCIES = $(lib_onig) am_encode_OBJECTS = encode.$(OBJEXT) encode_OBJECTS = $(am_encode_OBJECTS) encode_LDADD = $(LDADD) encode_DEPENDENCIES = $(lib_onig) am_listcap_OBJECTS = listcap.$(OBJEXT) listcap_OBJECTS = $(am_listcap_OBJECTS) listcap_LDADD = $(LDADD) listcap_DEPENDENCIES = $(lib_onig) am_names_OBJECTS = names.$(OBJEXT) names_OBJECTS = $(am_names_OBJECTS) names_LDADD = $(LDADD) names_DEPENDENCIES = $(lib_onig) am_posix_OBJECTS = posix.$(OBJEXT) posix_OBJECTS = $(am_posix_OBJECTS) posix_LDADD = $(LDADD) posix_DEPENDENCIES = $(lib_onig) am_regset_OBJECTS = regset.$(OBJEXT) regset_OBJECTS = $(am_regset_OBJECTS) regset_LDADD = $(LDADD) regset_DEPENDENCIES = $(lib_onig) am_scan_OBJECTS = scan.$(OBJEXT) scan_OBJECTS = $(am_scan_OBJECTS) scan_LDADD = $(LDADD) scan_DEPENDENCIES = $(lib_onig) am_simple_OBJECTS = simple.$(OBJEXT) simple_OBJECTS = $(am_simple_OBJECTS) simple_LDADD = $(LDADD) simple_DEPENDENCIES = $(lib_onig) am_sql_OBJECTS = sql.$(OBJEXT) sql_OBJECTS = $(am_sql_OBJECTS) sql_LDADD = $(LDADD) sql_DEPENDENCIES = $(lib_onig) am_syntax_OBJECTS = syntax.$(OBJEXT) syntax_OBJECTS = $(am_syntax_OBJECTS) syntax_LDADD = $(LDADD) syntax_DEPENDENCIES = $(lib_onig) am_user_property_OBJECTS = user_property.$(OBJEXT) user_property_OBJECTS = $(am_user_property_OBJECTS) user_property_LDADD = $(LDADD) user_property_DEPENDENCIES = $(lib_onig) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bug_fix.Po \ ./$(DEPDIR)/callback_each_match.Po ./$(DEPDIR)/callout.Po \ ./$(DEPDIR)/count.Po ./$(DEPDIR)/echo.Po ./$(DEPDIR)/encode.Po \ ./$(DEPDIR)/listcap.Po ./$(DEPDIR)/names.Po \ ./$(DEPDIR)/posix.Po ./$(DEPDIR)/regset.Po ./$(DEPDIR)/scan.Po \ ./$(DEPDIR)/simple.Po ./$(DEPDIR)/sql.Po ./$(DEPDIR)/syntax.Po \ ./$(DEPDIR)/user_property.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = bug_fix.c $(callback_each_match_SOURCES) $(callout_SOURCES) \ $(count_SOURCES) $(echo_SOURCES) $(encode_SOURCES) \ $(listcap_SOURCES) $(names_SOURCES) $(posix_SOURCES) \ $(regset_SOURCES) $(scan_SOURCES) $(simple_SOURCES) \ $(sql_SOURCES) $(syntax_SOURCES) $(user_property_SOURCES) DIST_SOURCES = bug_fix.c $(callback_each_match_SOURCES) \ $(callout_SOURCES) $(count_SOURCES) $(echo_SOURCES) \ $(encode_SOURCES) $(listcap_SOURCES) $(names_SOURCES) \ $(posix_SOURCES) $(regset_SOURCES) $(scan_SOURCES) \ $(simple_SOURCES) $(sql_SOURCES) $(syntax_SOURCES) \ $(user_property_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXTRA_LIBONIG_LDFLAGS = @EXTRA_LIBONIG_LDFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBONIG_DEF_FILE = @LIBONIG_DEF_FILE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LTVERSION = @LTVERSION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_onig = ../src/libonig.la LDADD = $(lib_onig) AM_CFLAGS = -Wall AM_LDFLAGS = -L$(libdir) AM_CPPFLAGS = -I$(top_srcdir)/src encode_SOURCES = encode.c listcap_SOURCES = listcap.c names_SOURCES = names.c posix_SOURCES = posix.c simple_SOURCES = simple.c sql_SOURCES = sql.c syntax_SOURCES = syntax.c user_property_SOURCES = user_property.c callout_SOURCES = callout.c echo_SOURCES = echo.c count_SOURCES = count.c bug_fix = bug_fix.c regset_SOURCES = regset.c scan_SOURCES = scan.c callback_each_match_SOURCES = callback_each_match.c sampledir = . all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sample/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu sample/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list bug_fix$(EXEEXT): $(bug_fix_OBJECTS) $(bug_fix_DEPENDENCIES) $(EXTRA_bug_fix_DEPENDENCIES) @rm -f bug_fix$(EXEEXT) $(AM_V_CCLD)$(LINK) $(bug_fix_OBJECTS) $(bug_fix_LDADD) $(LIBS) callback_each_match$(EXEEXT): $(callback_each_match_OBJECTS) $(callback_each_match_DEPENDENCIES) $(EXTRA_callback_each_match_DEPENDENCIES) @rm -f callback_each_match$(EXEEXT) $(AM_V_CCLD)$(LINK) $(callback_each_match_OBJECTS) $(callback_each_match_LDADD) $(LIBS) callout$(EXEEXT): $(callout_OBJECTS) $(callout_DEPENDENCIES) $(EXTRA_callout_DEPENDENCIES) @rm -f callout$(EXEEXT) $(AM_V_CCLD)$(LINK) $(callout_OBJECTS) $(callout_LDADD) $(LIBS) count$(EXEEXT): $(count_OBJECTS) $(count_DEPENDENCIES) $(EXTRA_count_DEPENDENCIES) @rm -f count$(EXEEXT) $(AM_V_CCLD)$(LINK) $(count_OBJECTS) $(count_LDADD) $(LIBS) echo$(EXEEXT): $(echo_OBJECTS) $(echo_DEPENDENCIES) $(EXTRA_echo_DEPENDENCIES) @rm -f echo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(echo_OBJECTS) $(echo_LDADD) $(LIBS) encode$(EXEEXT): $(encode_OBJECTS) $(encode_DEPENDENCIES) $(EXTRA_encode_DEPENDENCIES) @rm -f encode$(EXEEXT) $(AM_V_CCLD)$(LINK) $(encode_OBJECTS) $(encode_LDADD) $(LIBS) listcap$(EXEEXT): $(listcap_OBJECTS) $(listcap_DEPENDENCIES) $(EXTRA_listcap_DEPENDENCIES) @rm -f listcap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(listcap_OBJECTS) $(listcap_LDADD) $(LIBS) names$(EXEEXT): $(names_OBJECTS) $(names_DEPENDENCIES) $(EXTRA_names_DEPENDENCIES) @rm -f names$(EXEEXT) $(AM_V_CCLD)$(LINK) $(names_OBJECTS) $(names_LDADD) $(LIBS) posix$(EXEEXT): $(posix_OBJECTS) $(posix_DEPENDENCIES) $(EXTRA_posix_DEPENDENCIES) @rm -f posix$(EXEEXT) $(AM_V_CCLD)$(LINK) $(posix_OBJECTS) $(posix_LDADD) $(LIBS) regset$(EXEEXT): $(regset_OBJECTS) $(regset_DEPENDENCIES) $(EXTRA_regset_DEPENDENCIES) @rm -f regset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(regset_OBJECTS) $(regset_LDADD) $(LIBS) scan$(EXEEXT): $(scan_OBJECTS) $(scan_DEPENDENCIES) $(EXTRA_scan_DEPENDENCIES) @rm -f scan$(EXEEXT) $(AM_V_CCLD)$(LINK) $(scan_OBJECTS) $(scan_LDADD) $(LIBS) simple$(EXEEXT): $(simple_OBJECTS) $(simple_DEPENDENCIES) $(EXTRA_simple_DEPENDENCIES) @rm -f simple$(EXEEXT) $(AM_V_CCLD)$(LINK) $(simple_OBJECTS) $(simple_LDADD) $(LIBS) sql$(EXEEXT): $(sql_OBJECTS) $(sql_DEPENDENCIES) $(EXTRA_sql_DEPENDENCIES) @rm -f sql$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sql_OBJECTS) $(sql_LDADD) $(LIBS) syntax$(EXEEXT): $(syntax_OBJECTS) $(syntax_DEPENDENCIES) $(EXTRA_syntax_DEPENDENCIES) @rm -f syntax$(EXEEXT) $(AM_V_CCLD)$(LINK) $(syntax_OBJECTS) $(syntax_LDADD) $(LIBS) user_property$(EXEEXT): $(user_property_OBJECTS) $(user_property_DEPENDENCIES) $(EXTRA_user_property_DEPENDENCIES) @rm -f user_property$(EXEEXT) $(AM_V_CCLD)$(LINK) $(user_property_OBJECTS) $(user_property_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bug_fix.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callback_each_match.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callout.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/count.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/echo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encode.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listcap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/names.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syntax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user_property.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? encode.log: encode$(EXEEXT) @p='encode$(EXEEXT)'; \ b='encode'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) listcap.log: listcap$(EXEEXT) @p='listcap$(EXEEXT)'; \ b='listcap'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) names.log: names$(EXEEXT) @p='names$(EXEEXT)'; \ b='names'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) simple.log: simple$(EXEEXT) @p='simple$(EXEEXT)'; \ b='simple'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) sql.log: sql$(EXEEXT) @p='sql$(EXEEXT)'; \ b='sql'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) syntax.log: syntax$(EXEEXT) @p='syntax$(EXEEXT)'; \ b='syntax'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) user_property.log: user_property$(EXEEXT) @p='user_property$(EXEEXT)'; \ b='user_property'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) callout.log: callout$(EXEEXT) @p='callout$(EXEEXT)'; \ b='callout'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) echo.log: echo$(EXEEXT) @p='echo$(EXEEXT)'; \ b='echo'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) count.log: count$(EXEEXT) @p='count$(EXEEXT)'; \ b='count'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bug_fix.log: bug_fix$(EXEEXT) @p='bug_fix$(EXEEXT)'; \ b='bug_fix'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) regset.log: regset$(EXEEXT) @p='regset$(EXEEXT)'; \ b='regset'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) scan.log: scan$(EXEEXT) @p='scan$(EXEEXT)'; \ b='scan'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) callback_each_match.log: callback_each_match$(EXEEXT) @p='callback_each_match$(EXEEXT)'; \ b='callback_each_match'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) posix.log: posix$(EXEEXT) @p='posix$(EXEEXT)'; \ b='posix'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/bug_fix.Po -rm -f ./$(DEPDIR)/callback_each_match.Po -rm -f ./$(DEPDIR)/callout.Po -rm -f ./$(DEPDIR)/count.Po -rm -f ./$(DEPDIR)/echo.Po -rm -f ./$(DEPDIR)/encode.Po -rm -f ./$(DEPDIR)/listcap.Po -rm -f ./$(DEPDIR)/names.Po -rm -f ./$(DEPDIR)/posix.Po -rm -f ./$(DEPDIR)/regset.Po -rm -f ./$(DEPDIR)/scan.Po -rm -f ./$(DEPDIR)/simple.Po -rm -f ./$(DEPDIR)/sql.Po -rm -f ./$(DEPDIR)/syntax.Po -rm -f ./$(DEPDIR)/user_property.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/bug_fix.Po -rm -f ./$(DEPDIR)/callback_each_match.Po -rm -f ./$(DEPDIR)/callout.Po -rm -f ./$(DEPDIR)/count.Po -rm -f ./$(DEPDIR)/echo.Po -rm -f ./$(DEPDIR)/encode.Po -rm -f ./$(DEPDIR)/listcap.Po -rm -f ./$(DEPDIR)/names.Po -rm -f ./$(DEPDIR)/posix.Po -rm -f ./$(DEPDIR)/regset.Po -rm -f ./$(DEPDIR)/scan.Po -rm -f ./$(DEPDIR)/simple.Po -rm -f ./$(DEPDIR)/sql.Po -rm -f ./$(DEPDIR)/syntax.Po -rm -f ./$(DEPDIR)/user_property.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile test: $(TESTS) $(sampledir)/encode $(sampledir)/listcap $(sampledir)/names @ENABLE_POSIX_API_TRUE@ $(sampledir)/posix $(sampledir)/simple $(sampledir)/sql $(sampledir)/syntax $(sampledir)/user_property $(sampledir)/callout $(sampledir)/echo $(sampledir)/count $(sampledir)/bug_fix $(sampledir)/regset $(sampledir)/scan $(sampledir)/callback_each_match # 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: jq-1.8.2/vendor/oniguruma/sample/sql.c0000644000175100017510000000471215215513537013361 /* * sql.c */ #include #include #include "oniguruma.h" extern int main(int argc, char* argv[]) { static OnigSyntaxType SQLSyntax; int r; unsigned char *start, *range, *end; regex_t* reg; OnigErrorInfo einfo; OnigRegion *region; OnigEncoding use_encs[1]; static UChar* pattern = (UChar* )"\\_%\\\\__zz"; static UChar* str = (UChar* )"a_abcabcabc\\ppzz"; use_encs[0] = ONIG_ENCODING_ASCII; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); onig_set_syntax_op (&SQLSyntax, ONIG_SYN_OP_VARIABLE_META_CHARACTERS); onig_set_syntax_op2 (&SQLSyntax, 0); onig_set_syntax_behavior(&SQLSyntax, 0); onig_set_syntax_options (&SQLSyntax, ONIG_OPTION_MULTILINE); onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ESCAPE, (OnigCodePoint )'\\'); onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ANYCHAR, (OnigCodePoint )'_'); onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ANYTIME, ONIG_INEFFECTIVE_META_CHAR); onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ZERO_OR_ONE_TIME, ONIG_INEFFECTIVE_META_CHAR); onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ONE_OR_MORE_TIME, ONIG_INEFFECTIVE_META_CHAR); onig_set_meta_char(&SQLSyntax, ONIG_META_CHAR_ANYCHAR_ANYTIME, (OnigCodePoint )'%'); r = onig_new(®, pattern, pattern + strlen((char* )pattern), ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, &SQLSyntax, &einfo); if (r != ONIG_NORMAL) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(stderr, "ERROR: %s\n", s); onig_end(); return -1; } region = onig_region_new(); end = str + strlen((char* )str); start = str; range = end; r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE); if (r >= 0) { int i; fprintf(stderr, "match at %d\n", r); for (i = 0; i < region->num_regs; i++) { fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]); } } else if (r == ONIG_MISMATCH) { fprintf(stderr, "search fail\n"); } else { /* error */ char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(stderr, "ERROR: %s\n", s); onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return -1; } onig_region_free(region, 1 /* 1:free self, 0:free contents only */); onig_free(reg); onig_end(); return 0; } jq-1.8.2/vendor/oniguruma/configure.ac0000644000175100017510000000514515215513537013424 dnl Process this file with autoconf to produce a configure script. AC_INIT(onig, 6.9.10) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([-Wno-portability]) AC_CONFIG_HEADERS([src/config.h]) AC_ARG_WITH([statistics], [AS_HELP_STRING([--with-statistics], [take matching time statistical data])], AS_VAR_APPEND([CFLAGS], [" -DONIG_DEBUG_STATISTICS"])) dnl check for POSIX API AC_ARG_ENABLE([posix-api], [AS_HELP_STRING([--enable-posix-api], [turn on to include POSIX API [default=no]])], [\ case "${enableval}" in yes) enable_posix_api=yes ;; no) enable_posix_api=no ;; *) AC_MSG_ERROR(bad value for --enable-posix-api) ;; esac], enable_posix_api=no) dnl check for Binary compatible POSIX API AC_ARG_ENABLE([binary-compatible-posix-api], [AS_HELP_STRING([--enable-binary-compatible-posix-api], [turn on to Binary compatible POSIX API [default=no]])], [\ case "${enableval}" in yes) enable_binary_compatible_posix_api=yes; enable_posix_api=yes ;; no) enable_binary_compatible_posix_api=no ;; *) AC_MSG_ERROR(bad value for --enable-binary-compatible-posix-api) ;; esac], enable_binary_compatible_posix_api=no) AM_CONDITIONAL(ENABLE_BINARY_COMPATIBLE_POSIX_API, test x"${enable_binary_compatible_posix_api}" = xyes) AM_CONDITIONAL(ENABLE_POSIX_API, test x"${enable_posix_api}" = xyes) dnl check for CRNL_AS_LINE_TERMINATOR AC_ARG_ENABLE([crnl-as-line-terminator], [AS_HELP_STRING([--enable-crnl-as-line-terminator], [deprecated])], [crnl_as_line_terminator=$enableval]) if test "${crnl_as_line_terminator}" = yes; then AC_DEFINE(USE_CRNL_AS_LINE_TERMINATOR,1,[Define if enable CR+NL as line terminator]) fi dnl Checks for programs. AC_PROG_CC LT_INIT LTVERSION="10:0:5" AC_SUBST(LTVERSION) AC_PROG_INSTALL AC_PROG_MAKE_SET dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(sys/time.h unistd.h sys/times.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([long long]) AC_CHECK_SIZEOF([void*]) dnl Checks for library functions. AC_FUNC_ALLOCA AC_CONFIG_FILES([Makefile src/Makefile test/Makefile sample/Makefile onig-config]) AC_CONFIG_COMMANDS([default],[chmod +x onig-config],[]) # for Issue #220 LIBONIG_DEF_FILE= FIX_TO_LDFLAGS= case $host_os in cygwin* | mingw* ) if test X"$enable_shared" = Xyes; then LIBONIG_DEF_FILE=libonig.def FIX_TO_LDFLAGS="-no-undefined" fi ;; esac EXTRA_LIBONIG_LDFLAGS="$EXTRA_LIBONIG_LDFLAGS $FIX_TO_LDFLAGS" AC_SUBST(EXTRA_LIBONIG_LDFLAGS) AM_CONDITIONAL(USE_LIBONIG_DEF_FILE, test -n "${LIBONIG_DEF_FILE}") AC_SUBST(LIBONIG_DEF_FILE) AC_OUTPUT jq-1.8.2/vendor/oniguruma/README0000644000175100017510000001445615215513537012023 README 2018/04/05 Oniguruma ---- (C) K.Kosako https://github.com/kkos/oniguruma FIXED Security Issues (in Oniguruma 6.3.0): CVE-2017-9224, CVE-2017-9225, CVE-2017-9226 CVE-2017-9227, CVE-2017-9228, CVE-2017-9229 --- Oniguruma is a modern and flexible regular expressions library. It encompasses features from different regular expression implementations that traditionally exist in different languages. It comes close to being a complete superset of all regular expression features found in other regular expression implementations. Its features include: * Character encoding can be specified per regular expression object. * Several regular expression types are supported: * POSIX * Grep * GNU Regex * Perl * Java * Ruby * Emacs Supported character encodings: ASCII, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, EUC-JP, EUC-TW, EUC-KR, EUC-CN, Shift_JIS, Big5, GB18030, KOI8-R, CP1251, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10, ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16 * GB18030: contributed by KUBO Takehiro * CP1251: contributed by Byte ------------------------------------------------------------ License BSD license. Install Case 1: Linux distribution packages * Fedora: dnf install oniguruma-devel * RHEL/CentOS: yum install oniguruma * Debian/Ubuntu: apt install libonig5 * Arch: pacman -S oniguruma * openSUSE: zypper install oniguruma Case 2: Manual compilation on Linux, Unix, and Cygwin platform 1. autoreconf -vfi (* case: configure script is not found.) 2. ./configure 3. make 4. make install * uninstall make uninstall * configuration check onig-config --cflags onig-config --libs onig-config --prefix onig-config --exec-prefix Case 3: Windows 64/32bit platform (Visual Studio) execute make_win64 or make_win32 src/onig_s.lib: static link library src/onig.dll: dynamic link library * test (ASCII/Shift_JIS) 1. cd src 2. copy ..\windows\testc.c . 3. nmake -f Makefile.windows ctest (I have checked by Visual Studio Community 2015) Regular Expressions See doc/RE (or doc/RE.ja for Japanese). Usage Include oniguruma.h in your program. (Oniguruma API) See doc/API for Oniguruma API. If you want to disable UChar type (== unsigned char) definition in oniguruma.h, define ONIG_ESCAPE_UCHAR_COLLISION and then include oniguruma.h. If you want to disable regex_t type definition in oniguruma.h, define ONIG_ESCAPE_REGEX_T_COLLISION and then include oniguruma.h. Example of the compiling/linking command line in Unix or Cygwin, (prefix == /usr/local case) cc sample.c -L/usr/local/lib -lonig If you want to use static link library(onig_s.lib) in Win32, add option -DONIG_EXTERN=extern to C compiler. Sample Programs sample/simple.c example of the minimum (Oniguruma API) sample/names.c example of the named group callback. sample/encode.c example of some encodings. sample/listcap.c example of the capture history. sample/posix.c POSIX API sample. sample/sql.c example of the variable meta characters. (SQL-like pattern matching) sample/user_property.c example of user defined Unicode property. Test Programs sample/syntax.c Perl, Java and ASIS syntax test. sample/crnl.c --enable-crnl-as-line-terminator test Source Files oniguruma.h Oniguruma API header file. (public) onig-config.in configuration check program template. regenc.h character encodings framework header file. regint.h internal definitions regparse.h internal definitions for regparse.c and regcomp.c regcomp.c compiling and optimization functions regenc.c character encodings framework. regerror.c error message function regext.c extended API functions. (deluxe version API) regexec.c search and match functions regparse.c parsing functions. regsyntax.c pattern syntax functions and built-in syntax definitions. regtrav.c capture history tree data traverse functions. regversion.c version info function. st.h hash table functions header file st.c hash table functions oniggnu.h GNU regex API header file. (public) reggnu.c GNU regex API functions onigposix.h POSIX API header file. (public) regposerr.c POSIX error message function. regposix.c POSIX API functions. mktable.c character type table generator. ascii.c ASCII encoding. euc_jp.c EUC-JP encoding. euc_tw.c EUC-TW encoding. euc_kr.c EUC-KR, EUC-CN encoding. sjis.c Shift_JIS encoding. big5.c Big5 encoding. gb18030.c GB18030 encoding. koi8.c KOI8 encoding. koi8_r.c KOI8-R encoding. cp1251.c CP1251 encoding. iso8859_1.c ISO-8859-1 encoding. (Latin-1) iso8859_2.c ISO-8859-2 encoding. (Latin-2) iso8859_3.c ISO-8859-3 encoding. (Latin-3) iso8859_4.c ISO-8859-4 encoding. (Latin-4) iso8859_5.c ISO-8859-5 encoding. (Cyrillic) iso8859_6.c ISO-8859-6 encoding. (Arabic) iso8859_7.c ISO-8859-7 encoding. (Greek) iso8859_8.c ISO-8859-8 encoding. (Hebrew) iso8859_9.c ISO-8859-9 encoding. (Latin-5 or Turkish) iso8859_10.c ISO-8859-10 encoding. (Latin-6 or Nordic) iso8859_11.c ISO-8859-11 encoding. (Thai) iso8859_13.c ISO-8859-13 encoding. (Latin-7 or Baltic Rim) iso8859_14.c ISO-8859-14 encoding. (Latin-8 or Celtic) iso8859_15.c ISO-8859-15 encoding. (Latin-9 or West European with Euro) iso8859_16.c ISO-8859-16 encoding. (Latin-10 or South-Eastern European with Euro) utf8.c UTF-8 encoding. utf16_be.c UTF-16BE encoding. utf16_le.c UTF-16LE encoding. utf32_be.c UTF-32BE encoding. utf32_le.c UTF-32LE encoding. unicode.c common codes of Unicode encoding. win32/Makefile Makefile for Win32 (VC++) win32/config.h config.h for Win32 and I'm thankful to Akinori MUSHA. jq-1.8.2/vendor/oniguruma/test-driver0000755000175100017510000001112715215513537013331 #! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2020 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 tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/vendor/oniguruma/Makefile.am0000644000175100017510000000443515215513537013173 ## Makefile.am for Oniguruma ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src test sample EXTRA_DIST = oniguruma.pc.in HISTORY README_japanese README.md \ index.html index_ja.html make_win.bat \ CMakeLists.txt oniguruma.pc.cmake.in cmake/Config.cmake.in \ onig-config.cmake.in src/config.h.cmake.in \ doc/API doc/API.ja doc/RE doc/RE.ja doc/FAQ doc/FAQ.ja \ doc/CALLOUTS.BUILTIN doc/CALLOUTS.BUILTIN.ja \ doc/CALLOUTS.API doc/CALLOUTS.API.ja \ doc/SYNTAX.md doc/onig_syn_md.c doc/UNICODE_PROPERTIES \ src/Makefile.windows src/config.h.windows.in \ src/config.h.win32 src/config.h.win64 \ test/test.sh test/CMakeLists.txt \ windows/testc.c windows/CMakeLists.txt bin_SCRIPTS = onig-config onig-config: onig-config.in do_subst = sed \ -e 's,[@]datadir[@],$(datadir),g' \ -e 's,[@]datarootdir[@],$(datarootdir),g' \ -e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \ -e 's,[@]prefix[@],$(prefix),g' \ -e 's,[@]exec_prefix[@],$(exec_prefix),g' \ -e 's,[@]libdir[@],$(libdir),g' \ -e 's,[@]includedir[@],$(includedir),g' oniguruma.pc: $(srcdir)/oniguruma.pc.in Makefile $(do_subst) < $(srcdir)/oniguruma.pc.in > $(@) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = oniguruma.pc DISTCLEANFILES = oniguruma.pc all-test: cd test; make test archive: git archive --format=tar --prefix=oniguruma/ HEAD | gzip > ../oniguruma-archive.tar.gz tar: cd ..; tar cvf oniguruma-`date +%Y%m%d`.tar oniguruma; gzip oniguruma-`date +%Y%m%d`.tar debug: make clean ./configure CFLAGS="-O0 -g" make debug_out: make clean ./configure CFLAGS="-O0 -g -DONIG_DEBUG_PARSE -DONIG_DEBUG_COMPILE" make sanitize: make clean ./configure CFLAGS="-O -g -fsanitize=address" LDFLAGS="-fsanitize=address" make make all-test debug_out_sanitize: make clean ./configure CFLAGS="-O0 -g -fsanitize=address -DONIG_DEBUG_PARSE -DONIG_DEBUG_COMPILE" LDFLAGS="-fsanitize=address" make cov: make lcov-clear cd test; make CFLAGS="--coverage" test make lcov gcov: make CFLAGS="--coverage" lcov: lcov -c -d src/.libs -o coverage.info genhtml -o coverage coverage.info lcov-clear: lcov -z -d . cov-clean: clean rm -rf coverage coverage.info find . -name '*.gcno' | xargs rm -f jq-1.8.2/vendor/oniguruma/index.html0000644000175100017510000002060715215513537013133 Oniguruma

Oniguruma

(Japanese)

(c) K.Kosako, updated at: 2019/08/05

What's new
  • 2019/08/06: Version 6.9.3 released.
  • 2019/05/07: Version 6.9.2 released.
  • 2018/12/11: Version 6.9.1 released.
  • 2018/09/03: Version 6.9.0 released.
  • 2018/04/17: Version 6.8.2 released.
  • 2018/03/19: Version 6.8.1 released.
  • 2018/03/16: Version 6.8.0 released.
  • 2018/01/26: Version 6.7.1 released.
  • 2017/12/11: Version 6.7.0 released.
  • 2017/08/30: Version 6.6.1 released.
  • 2017/08/28: Version 6.6.0 released.
  • 2017/08/03: Version 6.5.0 released.
  • 2017/07/03: Version 6.4.0 released.
  • 2017/05/29: Version 6.3.0 released.
  • 2017/04/08: Version 6.2.0 released.
  • 2016/12/11: Version 6.1.3 released.

Oniguruma is a regular expressions library.
The characteristics of this library is that different character encoding
for every regular expression object can be specified.
(supported APIs: GNU regex, POSIX and Oniguruma native)

Supported character encodings:
ASCII, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE,
EUC-JP, EUC-TW, EUC-KR, EUC-CN,
Shift_JIS, Big5, GB18030, KOI8-R, CP1251,
ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5,
ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-10,
ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16
(GB18030 encoding was contributed by KUBO Takehiro)
(CP1251 encoding was contributed by Byte)


License: BSD license.
Platform:
  • Unix (include Mac OS X)
  • Cygwin
  • Win32

Maintainer of 2.x was changed to Hannes Wyss <hwyss AT ywesee.com>.
About 2.x, please contact him.
* 5.x supports Unicode Property/Script.
* 2.x supports Ruby1.6/1.8.

Documents: (version 6.1.0)
Sample Programs:
Site Links:
Links:
References:

and I'm thankful to Akinori MUSHA.


Other Libraries:
jq-1.8.2/vendor/oniguruma/COPYING0000644000175100017510000000247415215513537012173 Oniguruma LICENSE ----------------- Copyright (c) 2002-2021 K.Kosako All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. jq-1.8.2/vendor/oniguruma/ltmain.sh0000755000175100017510000121237515215513552012764 #! /usr/bin/env sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2019-02-19.15 # libtool (GNU libtool) 2.4.7 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2019, 2021-2022 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.7 Debian-2.4.7-7build1" package_revision=2.4.7 ## ------ ## ## 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=2019-02-19.15; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2004-2019, 2021 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # ## ------ ## ## 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 # These NLS vars are set unconditionally (bootstrap issue #24). Unset those # in case the environment reset is needed later and the $save_* variant is not # defined (see the code above). LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL # 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 # func_unset VAR # -------------- # Portably unset VAR. # In some shells, an 'unset VAR' statement leaves a non-zero return # status if VAR is already unset, which might be problematic if the # statement is used at the end of a function (thus poisoning its return # value) or when 'set -e' is active (causing even a spurious abort of # the script in this case). func_unset () { { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } } # Make sure CDPATH doesn't cause `cd` commands to output the target dir. func_unset CDPATH # Make sure ${,E,F}GREP behave sanely. func_unset GREP_OPTIONS ## ------------------------- ## ## 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" # require_check_ifs_backslash # --------------------------- # Check if we can use backslash as IFS='\' separator, and set # $check_ifs_backshlash_broken to ':' or 'false'. require_check_ifs_backslash=func_require_check_ifs_backslash func_require_check_ifs_backslash () { _G_save_IFS=$IFS IFS='\' _G_check_ifs_backshlash='a\\b' for _G_i in $_G_check_ifs_backshlash do case $_G_i in a) check_ifs_backshlash_broken=false ;; '') break ;; *) check_ifs_backshlash_broken=: break ;; esac done IFS=$_G_save_IFS require_check_ifs_backslash=: } ## ----------------- ## ## 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='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. # _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. if test -z "$_G_HAVE_PLUSEQ_OP" && \ __PLUSEQ_TEST="a" && \ __PLUSEQ_TEST+=" b" 2>/dev/null && \ test "a b" = "$__PLUSEQ_TEST"; then _G_HAVE_PLUSEQ_OP=yes fi 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_arg pretty "$2" eval "$1+=\\ \$func_quote_arg_result" }' else func_append_quoted () { $debug_cmd func_quote_arg pretty "$2" eval "$1=\$$1\\ \$func_quote_arg_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_portable EVAL ARG # ---------------------------- # Internal function to portably implement func_quote_arg. Note that we still # keep attention to performance here so we as much as possible try to avoid # calling sed binary (so far O(N) complexity as long as func_append is O(1)). func_quote_portable () { $debug_cmd $require_check_ifs_backslash func_quote_portable_result=$2 # one-time-loop (easy break) while true do if $1; then func_quote_portable_result=`$ECHO "$2" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` break fi # Quote for eval. case $func_quote_portable_result in *[\\\`\"\$]*) # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string # contains the shell wildcard characters. case $check_ifs_backshlash_broken$func_quote_portable_result in :*|*[\[\*\?]*) func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ | $SED "$sed_quote_subst"` break ;; esac func_quote_portable_old_IFS=$IFS for _G_char in '\' '`' '"' '$' do # STATE($1) PREV($2) SEPARATOR($3) set start "" "" func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy IFS=$_G_char for _G_part in $func_quote_portable_result do case $1 in quote) func_append func_quote_portable_result "$3$2" set quote "$_G_part" "\\$_G_char" ;; start) set first "" "" func_quote_portable_result= ;; first) set quote "$_G_part" "" ;; esac done done IFS=$func_quote_portable_old_IFS ;; *) ;; esac break done func_quote_portable_unquoted_result=$func_quote_portable_result case $func_quote_portable_result 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. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_portable_result=\"$func_quote_portable_result\" ;; esac } # func_quotefast_eval ARG # ----------------------- # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', # but optimized for speed. Result is stored in $func_quotefast_eval. if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then printf -v _GL_test_printf_tilde %q '~' if test '\~' = "$_GL_test_printf_tilde"; then func_quotefast_eval () { printf -v func_quotefast_eval_result %q "$1" } else # Broken older Bash implementations. Make those faster too if possible. func_quotefast_eval () { case $1 in '~'*) func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result ;; *) printf -v func_quotefast_eval_result %q "$1" ;; esac } fi else func_quotefast_eval () { func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result } fi # func_quote_arg MODEs ARG # ------------------------ # Quote one ARG to be evaled later. MODEs argument may contain zero or more # specifiers listed below separated by ',' character. This function returns two # values: # i) func_quote_arg_result # double-quoted (when needed), suitable for a subsequent eval # ii) func_quote_arg_unquoted_result # has all characters that are still active within double # quotes backslashified. Available only if 'unquoted' is specified. # # Available modes: # ---------------- # 'eval' (default) # - escape shell special characters # 'expand' # - the same as 'eval'; but do not quote variable references # 'pretty' # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might # be used later in func_quote to get output like: 'echo "a b"' instead # of 'echo a\ b'. This is slower than default on some shells. # 'unquoted' # - produce also $func_quote_arg_unquoted_result which does not contain # wrapping double-quotes. # # Examples for 'func_quote_arg pretty,unquoted string': # # string | *_result | *_unquoted_result # ------------+-----------------------+------------------- # " | \" | \" # a b | "a b" | a b # "a b" | "\"a b\"" | \"a b\" # * | "*" | * # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" # # Examples for 'func_quote_arg pretty,unquoted,expand string': # # string | *_result | *_unquoted_result # --------------+---------------------+-------------------- # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" func_quote_arg () { _G_quote_expand=false case ,$1, in *,expand,*) _G_quote_expand=: ;; esac case ,$1, in *,pretty,*|*,expand,*|*,unquoted,*) func_quote_portable $_G_quote_expand "$2" func_quote_arg_result=$func_quote_portable_result func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result ;; *) # Faster quote-for-eval for some shells. func_quotefast_eval "$2" func_quote_arg_result=$func_quotefast_eval_result ;; esac } # func_quote MODEs ARGs... # ------------------------ # Quote all ARGs to be evaled later and join them into single command. See # func_quote_arg's description for more info. func_quote () { $debug_cmd _G_func_quote_mode=$1 ; shift func_quote_result= while test 0 -lt $#; do func_quote_arg "$_G_func_quote_mode" "$1" if test -n "$func_quote_result"; then func_append func_quote_result " $func_quote_arg_result" else func_append func_quote_result "$func_quote_arg_result" fi shift done } # 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_arg pretty,expand "$_G_cmd" eval "func_notquiet $func_quote_arg_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_arg expand,pretty "$_G_cmd" eval "func_echo $func_quote_arg_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 # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2010-2019, 2021 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # # Set a version string for this script. scriptversion=2019-02-19.15; # UTC ## ------ ## ## 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 '# Copyright'. # # 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 in 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 # in the main code. A hook is just a list of function names 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 hook functions to be called by # FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_propagate_result FUNC_NAME_A FUNC_NAME_B # --------------------------------------------- # If the *_result variable of FUNC_NAME_A _is set_, assign its value to # *_result variable of FUNC_NAME_B. func_propagate_result () { $debug_cmd func_propagate_result_result=: if eval "test \"\${${1}_result+set}\" = set" then eval "${2}_result=\$${1}_result" else func_propagate_result_result=false fi } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It's 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 _G_rc_run_hooks=false case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook functions." ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do func_unset "${_G_hook}_result" eval $_G_hook '${1+"$@"}' func_propagate_result $_G_hook func_run_hooks if $func_propagate_result_result; then eval set dummy "$func_run_hooks_result"; shift fi done } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list from your hook function. You may remove # or edit any options that you action, and then pass back the remaining # unprocessed options in '_result', escaped # suitably for 'eval'. # # The '_result' variable is automatically unset # before your hook gets called; for best performance, only set the # *_result variable when necessary (i.e. don't call the 'func_quote' # function unnecessarily because it can be an expensive operation on some # machines). # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). Leave # # my_options_prep_result variable intact. # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # 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=: # args_changed=: # ;; # # 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 # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@" in case we need it later, # # if $args_changed was set to 'true'. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # # Only call 'func_quote' here if we processed at least one argument. # if $args_changed; then # func_quote eval ${1+"$@"} # my_silent_option_result=$func_quote_result # fi # } # 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_add_hook func_validate_options my_option_validation # # You'll also 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_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd func_run_hooks func_options ${1+"$@"} func_propagate_result func_run_hooks func_options_finish } # 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 _G_options_quoted=false for my_func in options_prep parse_options validate_options options_finish do func_unset func_${my_func}_result func_unset func_run_hooks_result eval func_$my_func '${1+"$@"}' func_propagate_result func_$my_func func_options if $func_propagate_result_result; then eval set dummy "$func_options_result"; shift _G_options_quoted=: fi done $_G_options_quoted || { # As we (func_options) are top-level options-parser function and # nobody quoted "$@" for us yet, we need to do it explicitly for # caller. func_quote eval ${1+"$@"} func_options_result=$func_quote_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 propagate 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+"$@"} func_propagate_result func_run_hooks func_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd _G_parse_options_requote=false # 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+"$@"} func_propagate_result func_run_hooks func_parse_options if $func_propagate_result_result; then eval set dummy "$func_parse_options_result"; shift # Even though we may have changed "$@", we passed the "$@" array # down into the hook and it quoted it for us (because we are in # this if-branch). No need to quote it again. _G_parse_options_requote=false fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break # We expect that one of the options parsed in this function matches # and thus we remove _G_opt from "$@" and need to re-quote. _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" >&2 $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_parse_options_requote=: break fi 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 ;; --) _G_parse_options_requote=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac if $_G_match_parse_options; then _G_parse_options_requote=: fi done if $_G_parse_options_requote; then # save modified positional parameters for caller func_quote eval ${1+"$@"} func_parse_options_result=$func_quote_result fi } # 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+"$@"} func_propagate_result func_run_hooks func_validate_options # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE } ## ----------------- ## ## 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#*=} if test "x$func_split_equals_lhs" = "x$1"; then func_split_equals_rhs= fi }' 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. # The version message is extracted from the calling file's header # comments, with leading '# ' stripped: # 1. First display the progname and version # 2. Followed by the header comment line matching /^# Written by / # 3. Then a blank line followed by the first following line matching # /^# Copyright / # 4. Immediately followed by any lines between the previous matches, # except lines preceding the intervening completely blank line. # For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /^# Written by /!b s|^# ||; p; n :fwd2blnk /./ { n b fwd2blnk } p; n :holdwrnt s|^# || s|^# *$|| /^Copyright /!{ /./H n b holdwrnt } s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| G s|\(\n\)\n*|\1|g p; q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.7' # 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 $scriptversion Debian-2.4.7-7build1 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= _G_rc_lt_options_prep=: _G_rc_lt_options_prep=: # 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 ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote eval ${1+"$@"} libtool_options_prep_result=$func_quote_result fi } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _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 _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote eval ${1+"$@"} libtool_parse_options_result=$func_quote_result fi } 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 eval ${1+"$@"} libtool_validate_options_result=$func_quote_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_arg pretty "$libobj" test "X$libobj" != "X$func_quote_arg_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_arg pretty "$srcfile" qsrcfile=$func_quote_arg_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 -Xcompiler 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 -Wa,FLAG -Xassembler FLAG pass linker-specific FLAG directly to the assembler -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_arg pretty "$nonopt" install_prog="$func_quote_arg_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_arg pretty "$arg" func_append install_prog "$func_quote_arg_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_arg pretty "$arg" func_append install_prog " $func_quote_arg_result" if test -n "$arg2"; then func_quote_arg pretty "$arg2" fi func_append install_shared_prog " $func_quote_arg_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_arg pretty "$install_override_mode" func_append install_shared_prog " -m $func_quote_arg_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_arg expand,pretty "$relink_command" eval "func_echo $func_quote_arg_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\"" func_quote_arg pretty "$ECHO" qECHO=$func_quote_arg_result $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_arg pretty,unquoted "$arg" qarg=$func_quote_arg_unquoted_result func_append libtool_args " $func_quote_arg_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 ;; xassembler) func_append compiler_flags " -Xassembler $qarg" prev= func_append compile_command " -Xassembler $qarg" func_append finalize_command " -Xassembler $qarg" 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* | *-*-midnightbsd*) # 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* | *-*-midnightbsd*) # 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 ;; # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. -pthread) case $host in *solaris2*) ;; *) case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac ;; esac continue ;; -mt|-mthreads|-kthread|-Kthread|-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_arg pretty "$flag" func_append arg " $func_quote_arg_result" func_append compiler_flags " $func_quote_arg_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_arg pretty "$flag" func_append arg " $wl$func_quote_arg_result" func_append compiler_flags " $wl$func_quote_arg_result" func_append linker_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xassembler) prev=xassembler continue ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_arg pretty "$arg" arg=$func_quote_arg_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 # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC # -static-* direct GCC to link specific libraries statically # -fcilkplus Cilk Plus language extension features for C/C++ # -Wa,* Pass flags directly to the assembler -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=*| \ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Wa,*) func_quote_arg pretty "$arg" arg=$func_quote_arg_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_arg pretty "$arg" arg=$func_quote_arg_result fi ;; # Some other compiler flag. -* | +*) func_quote_arg pretty "$arg" arg=$func_quote_arg_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_arg pretty "$arg" arg=$func_quote_arg_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%" test "X$link_all_deplibs" != Xno && libs="$libs $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" 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 elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi 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|midnightbsd-elf|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 ;; *) func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; 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 | midnightbsd-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* | *-*-midnightbsd*) # 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_arg expand,pretty "$cmd" eval "func_echo $func_quote_arg_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_arg expand,pretty "$cmd" eval "func_echo $func_quote_arg_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_arg pretty "$var_value" relink_command="$var=$func_quote_arg_result; export $var; $relink_command" fi done func_quote eval cd "`pwd`" func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" relink_command=$func_quote_arg_unquoted_result 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_arg pretty,unquoted "$var_value" relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" fi done # Quote the link command for shipping. func_quote eval cd "`pwd`" relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" func_quote_arg pretty,unquoted "$relink_command" relink_command=$func_quote_arg_unquoted_result 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: jq-1.8.2/vendor/oniguruma/ChangeLog0000644000175100017510000000000015215513537012671 jq-1.8.2/vendor/oniguruma/compile0000755000175100017510000001635015215513537012514 #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 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* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/vendor/oniguruma/config.sub0000755000175100017510000010252315215513537013117 #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2020 Free Software Foundation, Inc. timestamp='2020-08-17' # 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/gitweb/?p=config.git;a=blob_plain;f=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. 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-2020 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 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*) 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 ;; # 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 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 caes, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'` ;; nto-qnx*) kernel=nto os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162 IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -uclibc* ) # 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 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; nto-qnx*) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: jq-1.8.2/vendor/oniguruma/doc/0000755000175100017510000000000015215513665011760 5jq-1.8.2/vendor/oniguruma/doc/RE.ja0000644000175100017510000005374615215513537012537 鬼車 正規表現 Version 6.9.9 2024/06/10 使用文法: ONIG_SYNTAX_ONIGURUMA (既定値) 1. 基本要素 \ 退避修飾 (エスケープ) 正規表現記号の有効/無効の制御 | 選択子 (...) 式集合 (グループ) [...] 文字集合 (文字クラス) 2. 文字 \t 水平タブ (0x09) \v 垂直タブ (0x0B) \n 改行 (0x0A) \r 復帰 (0x0D) \b 後退空白 (0x08) \f 改頁 (0x0C) \a 鐘 (0x07) \e 退避修飾 (0x1B) \nnn 八進数表現 符号化バイト値 \xHH 十六進数表現 符号化バイト値 \x{7HHHHHHH} (1-8桁) 拡張十六進数表現 コードポイント値 \o{17777777777} (1-11桁) 拡張八進数表現 コードポイント値 \uHHHH 拡張十六進数表現 コードポイント値 \cx 制御文字表現 コードポイント値 \C-x 制御文字表現 コードポイント値 \M-x 超 (x|0x80) コードポイント値 \M-\C-x 超 + 制御文字表現 コードポイント値 ※ \bは、文字集合内でのみ有効 2.1 コードポイント連続表記 十六進数表現コードポイント (1-8桁) \x{7HHHHHHH 7HHHHHHH ... 7HHHHHHH} 八進数表現コードポイント (1-11桁) \o{17777777777 17777777777 ... 17777777777} 3. 文字種 . 任意文字 (改行を除く: オプションに依存) \w 単語構成文字 Unicode以外の場合: 英数字, "_" および 多バイト文字。 Unicodeの場合: General_Category -- (Letter|Mark|Number|Connector_Punctuation) \W 非単語構成文字 \s 空白文字 Unicode以外の場合: \t, \n, \v, \f, \r, \x20 Unicodeの場合: U+0009, U+000A, U+000B, U+000C, U+000D, U+0085(NEL), General_Category -- Line_Separator -- Paragraph_Separator -- Space_Separator \S 非空白文字 \d 10進数字 Unicodeの場合: General_Category -- Decimal_Number \D 非10進数字 \h 16進数字 [0-9a-fA-F] \H 非16進数字 \R 汎改行 (* 文字集合の中では使用できない) "\r\n" or \n,\v,\f,\r (* 但し \r\nから\rにはバックトラックしない) Unicodeの場合: "\r\n" or \n,\v,\f,\r or U+0085, U+2028, U+2029 \N 非改行文字 (?-m:.) \O 真任意文字 (?m:.) (* 原作) \X 文章区分 \X === (?>\O(?:\Y\O)*) この演算子の意味は、オプション (?y{..})の設定によって変化する。 \Xは照合の開始位置が区分の境界かどうかを確認しない。 それを確実にしたければ、\y\Xと書けば良い。 [拡張書記素房-状態のとき] (デフォルト) Unicodeの場合: 参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] Unicode以外の場合: \X === (?>\r\n|\O) [単語-状態のとき] 現在、Unicodeしかサポートしていない。 参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] Character Property * \p{property-name} * \p{^property-name} (negative) * \P{property-name} (negative) property-name: + 全てのエンコーディングで有効 Alnum, Alpha, Blank, Cntrl, Digit, Graph, Lower, Print, Punct, Space, Upper, XDigit, Word, ASCII, + EUC-JP, Shift_JISで有効 Hiragana, Katakana + UTF8, UTF16, UTF32で有効 doc/UNICODE_PROPERTIES参照 4. 量指定子 欲張り ? 一回または零回 * 零回以上 + 一回以上 {n,m} (n <= m) n回以上 かつ m回以下 {n,} n回以上 {,n} 零回以上n回以下 ({0,n}) {n} n回 無欲 ?? 零回または一回 *? 零回以上 +? 一回以上 {n,m}? (n <= m) n回以上 かつ m回以下 {n,}? n回以上 {,n}? 零回以上n回以下 (== {0,n}?) {n}? はONIG_SYNTAX_JAVAとONIG_SYNTAX_PERLでのみ無欲な指定子 (その場合には、態々そう書く意味はないが) デフォルトの文法では、/a{n}?/ === /(?:a{n})?/ 強欲 (欲張りで、繰り返しに成功した後は回数を減らすような後退再試行をしない) ?+ 一回または零回 *+ 零回以上 ++ 一回以上 {n,m} (n > m) m回以上 かつ n回以下 {n,m}+, {n,}+, {n}+ は、ONIG_SYNTAX_JAVAとONIG_SYNTAX_PERLでのみ 強欲な指定子 例. /a*+/ === /(?>a*)/ 5. 錨 ^ 行頭 $ 行末 \b 単語境界 \B 非単語境界 \A 文字列先頭 \Z 文字列末尾、または文字列末尾の改行の直前 \z 文字列末尾 \G 探索開始位置 \K 保持 (結果の開始位置をこの位置に保つ) \y 文章区分 境界 \Y 文章区分 非境界 この演算子の意味は、オプション (?y{..})の設定によって変化する。 [拡張書記素房-状態のとき] (デフォルト) Unicodeの場合: 参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] Unicode以外の場合: \rと\nの間を除く全ての位置 [単語-状態のとき] 現在、Unicodeしかサポートしていない。 参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] 6. 文字集合 ^... 否定 (最低優先度演算子) x-y 範囲 (xからyまで) [...] 集合 (文字集合内文字集合) ..&&.. 積演算 (^の次に優先度が低い演算子) 例. [a-w&&[^c-g]z] ==> ([a-w] and ([^c-g] or z)) ==> [abh-w] ※ '[', '-', ']'を、文字集合内で通常文字の意味で使用したい場合には、 これらの文字を'\'で退避修飾しなければならない。 POSIXブラケット ([:xxxxx:], 否定 [:^xxxxx:]) Unicode以外の場合: alnum 英数字 alpha 英字 ascii 0 - 127 blank \t, \x20 cntrl digit 0-9 graph 多バイト文字全部を含む lower print 多バイト文字全部を含む punct space \t, \n, \v, \f, \r, \x20 upper xdigit 0-9, a-f, A-F word 英数字, "_" および 多バイト文字 Unicodeの場合: alnum Alphabetic | Decimal_Number alpha Alphabetic ascii U+0000 - U+007F blank Space_Separator | U+0009 cntrl U+0000 - U+001F, U+007F - U+009F digit Decimal_Number graph ^White_Space && ^[[:cntrl:]] && ^Unassigned && ^Surrogate lower Lowercase print [[:graph:]] | Space_Separator punct Punctuation | Symbol space White_Space upper Uppercase xdigit U+0030 - U+0039 | U+0041 - U+0046 | U+0061 - U+0066 (0-9, a-f, A-F) word Alphabetic | Mark | Decimal_Number | Connector_Punctuation 7. 拡張式集合 (?#...) 注釈 (?imxWDSPy-imxWDSP:式) 式オプション i: 大文字小文字照合 m: 複数行 x: 拡張形式 W: wordがASCIIのみ (\w, \p{Word}, [[:word:]]) word境界がASCIIのみ (\b) D: digitがASCIIのみ (\d, \p{Digit}, [[:digit:]]) S: spaceがASCIIのみ (\s, \p{Space}, [[:space:]]) P: POSIXプロパティがASCIIのみ (W,D,Sを全て含んでいる) (alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit, word) y{?}: 文章区分状態 このオプションは\X, \y, \Yの意味を変更する。 現在このオプションはUnicodeでしかサポートしていない y{g}: 拡張書記素房-状態 (デフォルト) y{w}: 単語-状態 参照 [Unicode Standard Annex #29] (?imxWDSPy-imxWDSP) 孤立オプション * これは次の')'またはパターンの終わりまでのグループを形成する /ab(?i)c|def|gh/ == /ab(?i:c|def|gh)/ * (?i)オプションは、wordタイプ(\w, \p{Word})には有効ではない。但しwordタイプが文字クラスの中で使用された場合は有効になる。しかし、このことはwordタイプを(?W)オプションと共に使用した時にしか気にする必要はないであろう。 /(?CIL).../, /(?CIL:...)/ 全体オプション このオプションは、正規表現全体に影響を及ぼす位置 に置かれなければならない C: ONIG_OPTION_DONT_CAPTURE_GROUP I: ONIG_OPTION_IGNORECASE_IS_ASCII L: ONIG_OPTION_FIND_LONGEST (式) 捕獲式集合 (?:式) 非捕獲式集合 (?=式) 先読み (?!式) 否定先読み (?<=式) 戻り読み (?式) 原子的式集合 式全体を通過したとき、式の中での後退再試行を行なわない (?式), (?'name'式) 名前付き捕獲式集合 式集合に名前を割り当てる(定義する)。 (名前は単語構成文字でなければならない。) 名前だけでなく、捕獲式集合と同様に番号も割り当てられる。 番号指定が禁止されていない状態 (10. 捕獲式集合 を参照) のときは、名前を使わないで番号でも参照できる。 複数の式集合に同じ名前を与えることは許されている。 この場合には、この名前を使用した後方参照は可能であるが、 部分式呼出しはできない。 <呼び出し> * 内容の呼び出し (?{...contents...}) 前進中のみの呼び出し (?{...contents...}D) Dは方向指定文字 D = 'X': 前進中および後退中 '<': 後退中のみ '>': 前進中のみ (?{...contents...}[tag]) 名札付き (?{...contents...}[tag]D) * エスケープ文字はcontentsの中で何の機能も持たない * contentsは、'{'文字で始まってはならない (?{{{...contents...}}}) contentsの中のn個連続の'}'は、(n+1)個連続の{{{...}}} の中で許される tagに許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) * 名前の呼び出し (*name) (*name{args...}) 引数付き (*name[tag]) 名札付き (*name[tag]{args...}) nameに許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) tag に許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) <不在機能群> (?~不在) 不在繰り返し (*原案 田中哲) これは .*(より正確には\O*)のように動作するが、<不在>に 適合する文字列を含まない範囲に制限される。 これは(?~|(?:不在)|\O*)の省略表記である。 (?~|不在|式) 不在式 (* 原作) これは<式>のように動作するが、<不在>に適合する文字列を 含まない範囲に制限される。 例 (?~|345|\d*) "12345678" ==> "12", "1", "" (?~|不在) 不在停止 (* 原作) この演算子を通過した後は、対象文字列の適合範囲が <不在>に適合する文字列を含まない範囲に制限される。 (?~|) 範囲消去 不在停止の効果を消して、初期の状態にする。 * 不在機能の入れ子には対応しておらず、その場合の挙動は不定とする。 <条件文> (?(条件式)成功式|失敗式) 条件式が成功すれば成功式、失敗すれば失敗式を実行する この機能の存在理由は、成功式が失敗しても失敗式には 行かないこと。これは他の正規表現で書くことができない。 もうひとつは、条件式が後方参照の番号/名前のとき、 後方参照値の有効性を調べる(文字列と照合はしない) 意味になる。 (?(条件式)成功式) 条件式が成功すれば成功式を実行する (条件式が通常の式のときには、この構文は不必要だが 今のところエラーにはしない。) 条件式は後方参照の番号/名前または普通の式を使用できる。 条件式が後方参照の場合、成功式と失敗式の両方を省略可能であり、 この場合、後方参照値有効性を調べる(成功/失敗)機能のみになる。 [後方参照値有効性確認器] (* 原作) (?(n)), (?(-n)), (?(+n)), (?(n+level)) ... (?()), (?('-n')), (?(<+n>)) ... (?()), (?('name')), (?()) ... 8. 後方参照 \n 番号指定参照 (n >= 1) \k 番号指定参照 (n >= 1) \k'n' 番号指定参照 (n >= 1) \k<-n> 相対番号指定参照 (n >= 1) \k'-n' 相対番号指定参照 (n >= 1) \k<+n> 相対番号指定参照 (n >= 1) \k'+n' 相対番号指定参照 (n >= 1) \k 名前指定参照 \k'name' 名前指定参照 名前指定参照で、その名前が複数の式集合で多重定義されている場合には、 番号の大きい式集合から優先的に参照される。 (マッチしないときには番号の小さい式集合が参照される) ※ 番号指定参照は、名前付き捕獲式集合が定義され、 かつ ONIG_OPTION_CAPTURE_GROUPが指定されていない場合には、 禁止される。(10. 捕獲式集合 を参照) ネストレベル付き後方参照 level: 0, 1, 2, ... \k (n >= 1) \k (n >= 1) \k'n+level' (n >= 1) \k'n-level' (n >= 1) \k \k \k'name+level' \k'name-level' 後方参照の位置から相対的な部分式呼出しネストレベルを指定して、そのレベルでの 捕獲値を参照する。 例-1. /\A(?|.|(?:(?.)\g\k))\z/.match("reer") 例-2. r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED) (? \g \g* \g ){0} (? < \g \s* > ){0} (? [a-zA-Z_:]+ ){0} (? [^<&]+ (\g | [^<&]+)* ){0} (? >){0} \g __REGEXP__ p r.match('fbbbf').captures 9. 部分式呼出し ("田中哲スペシャル") (* 原作) \g 名前指定呼出し \g'name' 名前指定呼出し \g 番号指定呼出し (n >= 1) \g'n' 番号指定呼出し (n >= 1) \g<0> 番号指定呼出し(全体呼び出し) \g'0' 番号指定呼出し(全体呼び出し) \g<-n> 相対番号指定呼出し (n >= 1) \g'-n' 相対番号指定呼出し (n >= 1) \g<+n> 相対番号指定呼出し (n >= 1) \g'+n' 相対番号指定呼出し (n >= 1) ※ 最左位置での再帰呼出しは禁止される。 例. (?a|\gb) => error (?a|b\gc) => OK ※ 番号指定呼出しは、名前付き捕獲式集合が定義され、 かつ ONIG_OPTION_CAPTURE_GROUPが指定されていない場合には、 禁止される。 (10. 捕獲式集合 を参照) ※ 呼び出された式集合のオプション状態が呼出し側のオプション状態と異なっている とき、呼び出された側のオプション状態が有効である。 例. (?-i:\g)(?i:(?a)){0} は "A" に照合成功する。 10. 捕獲式集合 捕獲式集合(...)は、以下の条件に応じて振舞が変化する。 (名前付き捕獲式集合は変化しない) case 1. /.../ (名前付き捕獲式集合は不使用、オプションなし) (...) は、捕獲式集合として扱われる。 case 2. /.../g (名前付き捕獲式集合は不使用、オプション 'g'を指定) (...) は、非捕獲式集合として扱われる。 case 3. /..(?..)../ (名前付き捕獲式集合は使用、オプションなし) (...) は、非捕獲式集合として扱われる。 番号指定参照/呼び出しは不許可。 case 4. /..(?..)../G (名前付き捕獲式集合は使用、オプション 'G'を指定) (...) は、捕獲式集合として扱われる。 番号指定参照/呼び出しは許可。 但し g: ONIG_OPTION_DONT_CAPTURE_GROUP G: ONIG_OPTION_CAPTURE_GROUP ('g'と'G'オプションは、ruby-dev MLで議論された。) これらの振舞の意味は、 名前付き捕獲と名前無し捕獲を同時に使用する必然性のある場面は少ないであろう という理由から考えられたものである。 ----------------------------- 補記 1. 文法依存オプション + ONIG_SYNTAX_ONIGURUMA (?m): 終止符記号(.)は改行と照合成功 + ONIG_SYNTAX_PERL と ONIG_SYNTAX_JAVA (?s): 終止符記号(.)は改行と照合成功 (?m): ^ は改行の直後に照合する、$ は改行の直前に照合する 補記 2. 独自拡張機能 + 16進数数字、非16進数字 \h, \H + 真任意文字 \O + 文章区分境界 \y, \Y + 後方参照値有効性確認器 (?(...)) + 名前付き捕獲式集合 (?...), (?'name'...) + 名前指定後方参照 \k + 部分式呼出し \g, \g + 不在式 (?~|...|...) + 不在停止 (?~|...) 補記 3. Perl 5.8.0と比較して存在しない機能 + \N{name} + \l,\u,\L,\U,\C + (??{code}) * \Q...\E 但しONIG_SYNTAX_PERLとONIG_SYNTAX_JAVAでは有効 補記 4. Ruby 1.8 の日本語化 GNU regex(version 0.12)との違い + 文字Property機能追加 (\p{property}, \P{Property}) + 16進数字タイプ追加 (\h, \H) + 戻り読み機能を追加 + 強欲な繰り返し指定子を追加 (?+, *+, ++) + 文字集合の中の演算子を追加 ([...], &&) ('[' は、文字集合の中で通常の文字として使用するときには 退避修飾しなければならない) + 名前付き捕獲式集合と、部分式呼出し機能追加 + 多バイト文字コードが指定されているとき、 文字集合の中で八進数または十六進数表現の連続は、多バイト符号で表現された 一個の文字と解釈される (例. [\xa1\xa2], [\xa1\xa7-\xa4\xa1]) + 文字集合の中で、一バイト文字と多バイト文字の範囲指定は許される。 ex. /[a-あ]/ + 孤立オプションの有効範囲は、その孤立オプションを含んでいる式集合の 終わりまでである 例. (?:(?i)a|b) は (?:(?i:a|b)) と解釈される、(?:(?i:a)|b)ではない + 孤立オプションはその前の式に対して透過的ではない 例. /a(?i)*/ は文法エラーとなる + 不完全な繰り返し範囲指定子は通常の文字列として許可される 例. /{/, /({)/, /a{2,3/ + 否定的POSIXブラケット [:^xxxx:] を追加 + POSIXブラケット [:ascii:] を追加 + 先読みの繰り返しは不許可 例. /(?=a)*/, /(?!b){5}/ + 数値で指定された文字に対しても、大文字小文字照合オプションは有効 例. /\x61/i =~ "A" + 繰り返し回数指定で、最低回数の省略(0回)ができる /a{,n}/ == /a{0,n}/ 最低回数と最大回数の同時省略は許されない。(/a{,}/) + /a{n}?/は無欲な演算子ではない。 /a{n}?/ == /(?:a{n})?/ + 無効な後方参照をチェックしてエラーにする。 /\1/, /(a)\2/ + 無限繰り返しの中で、長さ零での照合成功は繰り返しを中断させるが、 このとき、中断すべきかどうかの判定として、捕獲式集合の捕獲状態の 変化まで考慮している /(?:()|())*\1\2/ =~ "" /(?:\1a|())*/ =~ "a" 終り jq-1.8.2/vendor/oniguruma/doc/CALLOUTS.API.ja0000644000175100017510000003365215215513537014061 Callouts API Version 6.9.7 2022/02/04 #include (1) 呼び出し関数 (2) 内容の呼び出し関数の設定/取得 (3) 名前の呼び出し関数の設定 (4) ユーザデータ (5) OnigCalloutArgsからの値の取得 (6) 名札 (7) 呼び出しデータ (呼び出し関数内から使用される) (8) 呼び出しデータ (アプリケーションから使用される) (9) その他の関数 (1) 呼び出し関数 型: OnigCalloutFunc typedef int (*OnigCalloutFunc)(OnigCalloutArgs* args, void* user_data); 若し呼び出し関数として0(NULL)がセットされると、呼ばれることはない * 呼び出し関数の戻り値 (int) ONIG_CALLOUT_FAIL (== 1): 失敗 ONIG_CALLOUT_SUCCESS (== 0): 成功 -1未満: エラーコード (検索/照合の終了) ONIG_CALLOUT_FAIL/SUCCESSは、後退中の呼び出しでは無視される。 後退は失敗の回復過程なので。 * 呼び出し関数の例 extern int always_success(OnigCalloutArgs* args, void* user_data) { return ONIG_CALLOUT_SUCCESS; } (2) 内容の呼び出し関数の設定/取得 # OnigCalloutFunc onig_get_progress_callout(void) 内容の呼び出し関数(前進中)を返す # int onig_set_progress_callout(OnigCalloutFunc f) 内容の呼び出し関数(前進中)をセットする。 この値はonig_initialize_match_param()の中でデフォルトの呼び出し関数として セットされる。 正常終了: ONIG_NORMAL # OnigCalloutFunc onig_get_retraction_callout(void) 内容の呼び出し関数(後退中)を返す # int onig_set_retraction_callout(OnigCalloutFunc f) 内容の呼び出し関数(後退中)をセットする。 この値はonig_initialize_match_param()の中でデフォルトの呼び出し関数として セットされる。 正常終了: ONIG_NORMAL # int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) 内容の呼び出し関数(前進中)をセットする。 引数 1 mp: match-paramアドレス 2 f: 関数 正常終了: ONIG_NORMAL # int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) 内容の呼び出し関数(後退中)をセットする。 引数 1 mp: match-paramアドレス 2 f: 関数 正常終了: ONIG_NORMAL (3) 名前の呼び出し関数の設定 # int onig_set_callout_of_name(OnigEncoding enc, OnigCalloutType type, OnigUChar* name, OnigUChar* name_end, int callout_in, OnigCalloutFunc callout, OnigCalloutFunc end_callout, int arg_num, unsigned int arg_types[], int opt_arg_num, OnigValue opt_defaults[]) 名前の呼び出し関数をセットする。 名前に許される文字: _ A-Z a-z 0-9 (* 最初の文字: _ A-Z a-z) (enc, name)のペアが、呼び出し関数を見つけるためのキーとして使用される。 アプリケーションで使用される各エンコーディングに対してこの関数を呼ぶ必要がある。 しかし若しencエンコーディングがASCII互換であり、(enc, name)に対するエントリが 見つからない場合には、(ASCII, name)エントリが参照される。 従って、若しASCII互換エンコーディングのみ使用している場合には、この関数を(ASCII, name) について一回呼べば十分である。 引数 1 enc: 文字エンコーディング 2 type: 呼び出し型 (現在は ONIG_CALLOUT_TYPE_SINGLE のみサポート) 3 name: 名前のアドレス (encでエンコーディングされている文字列) 4 name_end: 名前の終端アドレス 5 callout_in: 方向フラグ (ONIG_CALLOUT_IN_PROGRESS/RETRACTION/BOTH) 6 callout: 呼び出し関数 7 end_callout: *まだ使用していない (0をセット) 8 arg_num: 引数の数 (* 最大値 ONIG_CALLOUT_MAX_ARGS_NUM == 4) 9 arg_types: 引数の型の配列 10 opt_arg_num: オプション引数の数 11 opt_defaults: オプション引数のデフォルト値 正常終了: ONIG_NORMAL error: ONIGERR_INVALID_CALLOUT_NAME ONIGERR_INVALID_ARGUMENT ONIGERR_INVALID_CALLOUT_ARG (4) ユーザデータ # int onig_set_callout_user_data_of_match_param(OnigMatchParam* param, void* user_data) 呼び出し関数の引数として渡されるユーザデータをセットする。 正常終了: ONIG_NORMAL (5) OnigCalloutArgsからの値の取得 # int onig_get_callout_num_by_callout_args(OnigCalloutArgs* args) この呼び出しの呼び出し番号を返す。 "呼び出し番号"とは、正規表現パターンの中の呼び出しに対する識別子である。 # OnigCalloutIn onig_get_callout_in_by_callout_args(OnigCalloutArgs* args) この呼び出しが起きた時の方向(前進中/後退中)を返す。 (ONIG_CALLOUT_IN_PROGRESS か ONIG_CALLOUT_IN_RETRACTION) # int onig_get_name_id_by_callout_args(OnigCalloutArgs* args) この呼び出しの名前(name)の識別子を返す。 若しこの呼び出しが内容の呼び出しのときには、ONIG_NON_NAME_IDが返される。 # const OnigUChar* onig_get_contents_by_callout_args(OnigCalloutArgs* args) この呼び出しの内容文字列(NULL終端あり)を返す。 若しこの呼び出しが名前の呼び出しのときには、NULLを返す。 # const OnigUChar* onig_get_contents_end_by_callout_args(OnigCalloutArgs* args) この呼び出しの内容(contents)の終端を返す。 若しこの呼び出しが名前の呼び出しのときには、NULLを返す。 # int onig_get_args_num_by_callout_args(OnigCalloutArgs* args) この呼び出しの引数の数を返す。 正規表現パターンの中で渡されなかったオプション引数も含む。 若しこの呼び出しが内容の呼び出しのときには、ONIGERR_INVALID_ARGUMENTが返される。 # int onig_get_passed_args_num_by_callout_args(OnigCalloutArgs* args) この呼び出しの本当に渡された引数の数を返す。 若しこの呼び出しが内容の呼び出しのときには、ONIGERR_INVALID_ARGUMENTが返される。 # int onig_get_arg_by_callout_args(OnigCalloutArgs* args, int index, OnigType* type, OnigValue* val) この呼び出しの一個の引数の値と型を返す。 若しこの呼び出しが内容の呼び出しのときには、ONIGERR_INVALID_ARGUMENTが返される。 正常終了: ONIG_NORMAL # const OnigUChar* onig_get_string_by_callout_args(OnigCalloutArgs* args) 対象文字列のアドレスを返す。 onig_search()の二番目の引数(str)である。 # const OnigUChar* onig_get_string_end_by_callout_args(OnigCalloutArgs* args) 対象文字列の終端アドレスを返す。 onig_search()の三番目の引数(end)である。 # const OnigUChar* onig_get_start_by_callout_args(OnigCalloutArgs* args) 対象文字列の現在の照合処理開始アドレスを返す。 # const OnigUChar* onig_get_right_range_by_callout_args(OnigCalloutArgs* args) 対象文字列の現在の照合範囲アドレスを返す。 # const OnigUChar* onig_get_current_by_callout_args(OnigCalloutArgs* args) 対象文字列の現在の照合位置アドレスを返す。 # OnigRegex onig_get_regex_by_callout_args(OnigCalloutArgs* args) この呼び出しの正規表現オブジェクトのアドレスを返す。 # unsigned long onig_get_retry_counter_by_callout_args(OnigCalloutArgs* args) retry-limit-in-matchのためのリトライカウンタの現在値を返す。 (6) 名札 "Tag" (名札)とは、正規表現パターンの中で呼び出しに割り当てられた名前である。 tag文字列に使用できる文字: _ A-Z a-z 0-9 (* 先頭の文字: _ A-Z a-z) # int onig_callout_tag_is_exist_at_callout_num(OnigRegex reg, int callout_num) その呼び出しにtagが割り当てられていれば1を返す、そうでなければ0を返す。 # const OnigUChar* onig_get_callout_tag_start(OnigRegex reg, int callout_num) その呼び出しに対するtag文字列(NULL終端あり)の先頭アドレスを返す。 # const OnigUChar* onig_get_callout_tag_end(OnigRegex reg, int callout_num) その呼び出しに対するtag文字列の終端アドレスを返す。 # int onig_get_callout_num_by_tag(OnigRegex reg, const OnigUChar* tag, const OnigUChar* tag_end) そのtagに対する呼び出し番号を返す。 (7) 呼び出しデータ (呼び出し関数内から使用される) "呼び出しデータ" (callout data)とは、 それぞれの呼び出しに対してそれぞれの検索処理の中で割り当てられた、 ONIG_CALLOUT_DATA_SLOT_NUM(== 5)個の値の領域である。 一個の呼び出しに対する各値の領域は、"スロット"(slot)番号(0 - 4)によって示される。 呼び出しデータは呼び出し関数の実装者によって任意の目的に使用される。 # int onig_get_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType* type, OnigValue* val) callout_num/slotによって示された呼び出しスロットに対するデータの値/型を返す。 ONIG_NORMAL: 正常終了 ONIG_VALUE_IS_NOT_SET: 値が未セット / 型がVOID < 0: エラーコード # int onig_get_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) 自分自身の呼び出しのslotによって示されたスロットに対するデータの値/型を返す。 ONIG_NORMAL: 正常終了 ONIG_VALUE_IS_NOT_SET: 値が未セット / 型がVOID < 0: エラーコード # int onig_set_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType type, OnigValue* val) callout_num/slotによって示された呼び出しスロットに対する値/型をセットする。 ONIG_NORMAL: 正常終了 < 0: エラーコード # int onig_set_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType type, OnigValue* val) 自分自身の呼び出しのslotによって示されたスロットに対する値/型をセットする。 ONIG_NORMAL: 正常終了 < 0: エラーコード # int onig_get_callout_data_by_callout_args_self_dont_clear_old(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) この関数は、onig_get_callout_data_by_callout_args_self()とほぼ同じである。 しかしこの関数は、現在の位置より以前の照合位置の中でセットされた値をクリアしない。(dont_clear_old) 他のonig_get_callout_data_xxxx()関数は、以前の位置の照合処理の中でセットされた値をクリアする。 例えば、組み込み呼び出し(*TOTAL_COUNT)は、検索処理の中の全ての照合処理の積算カウントを 得るためにこの関数を使用して実装されている。 組み込む呼び出し(*COUNT)は、この関数を使用しないので、最後の成功した照合処理だけの カウントを返す。 ONIG_NORMAL: 正常終了 ONIG_VALUE_IS_NOT_SET: 値が未セット / 型がVOID < 0: エラーコード (8) 呼び出しデータ (アプリケーションから使用される) # int onig_get_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) callout_num/slotによって示された呼び出しスロットに対するデータの値/型を返す。 ONIG_NORMAL: 正常終了 ONIG_VALUE_IS_NOT_SET: 値が未セット / 型がVOID < 0: エラーコード # int onig_get_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val) tag/slotによって示された呼び出しスロットに対するデータの値/型を返す。 ONIG_NORMAL: 正常終了 ONIG_VALUE_IS_NOT_SET: 値が未セット / 型がVOID < 0: エラーコード # int onig_set_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType type, OnigValue* val) callout_num/slotによって示された呼び出しスロットに対する値/型をセットする。 ONIG_NORMAL: 正常終了 < 0: エラーコード # int onig_set_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType type, OnigValue* val) tag/slotによって示された呼び出しスロットに対する値/型をセットする。 ONIG_NORMAL: 正常終了 < 0: エラーコード # int onig_get_callout_data_dont_clear_old(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) この関数を使用する必要はないと思われる。 廃止予定。 # int onig_get_callout_data_by_tag_dont_clear_old(regex_t* reg, OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot, OnigType* type, OnigValue* val) tag/slotによって示された呼び出しスロットに対するデータの値/型を返す。 この関数は、現在の位置より以前の照合位置の中でセットされた値をクリアしない。 (dont_clear_old) ONIG_NORMAL: 正常終了 ONIG_VALUE_IS_NOT_SET: 値が未セット / 型がVOID < 0: エラーコード (9) その他の関数 # OnigUChar* onig_get_callout_name_by_name_id(int name_id) 名前の識別子に対する名前を返す。 不正な識別子が渡された場合には0を返す。 # int onig_get_capture_range_in_callout(OnigCalloutArgs* args, int mem_num, int* begin, int* end) 現在の捕獲範囲を返す。 位置は、対象文字列に対するバイト単位で表される。 未捕獲のmem_numに対しては、ONIG_REGION_NOTPOSがセットされる。 # int onig_get_used_stack_size_in_callout(OnigCalloutArgs* args, int* used_num, int* used_bytes) 現在使用されている照合処理用スタックサイズを返す。 used_num: 要素数 used_bytes: バイト数 //END jq-1.8.2/vendor/oniguruma/doc/FAQ.ja0000644000175100017510000000065315215513537012625 FAQ 2022/02/04 1. 最長マッチ onig_new()の中で、ONIG_OPTION_FIND_LONGESTオプション を使用すれば最長マッチになる。 2. CR + LF DOSの改行(CR(0x0d) + LF(0x0a)の連続) regenc.hの中の、以下の部分を有効にする。 /* #define USE_CRNL_AS_LINE_TERMINATOR */ 3. メーリングリスト 鬼車に関するメーリングリストは存在しない。 //END jq-1.8.2/vendor/oniguruma/doc/API.ja0000644000175100017510000011550015215513537012625 鬼車インターフェース Version 6.9.10 2024/05/26 #include # int onig_initialize(OnigEncoding use_encodings[], int num_encodings) ライブラリの初期化 最初に呼び出す必要がある。 * onig_init() は廃止 引数 1 use_encodings: 使用する文字エンコーディングの配列 2 num_encodings: 文字エンコーディングの数 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 # int onig_error_code_to_str(UChar* err_buf, int err_code, ...) エラーメッセージを取得する。 この関数を、onig_new()の結果に対して呼び出す場合には、onig_new()のpattern引数を メモリ解放するよりも前に呼び出さなければならない。 戻り値 正常終了: エラーメッセージ文字列のバイト長 引数 1 err_buf: エラーメッセージを格納する領域 (必要なサイズ: ONIG_MAX_ERROR_MESSAGE_LEN) 2 err_code: エラーコード 3 err_info (optional): onig_new()のerr_info # void onig_set_warn_func(OnigWarnFunc func) 警告通知関数をセットする。 警告: '[', '-', ']' in character class without escape. ']' in pattern without escape. 引数 1 func: 警告関数 void (*func)(char* warning_message) # void onig_set_verb_warn_func(OnigWarnFunc func) 詳細警告通知関数をセットする。 詳細警告: redundant nested repeat operator. 引数 1 func: 詳細警告関数 void (*func)(char* warning_message) # int onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* err_info) 正規表現オブジェクト(regex)を作成する。 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 引数 1 reg: 作成された正規表現オブジェクトを返すアドレス 2 pattern: 正規表現パターン文字列 3 pattern_end: 正規表現パターン文字列の終端アドレス(pattern + pattern length) 4 option: 正規表現コンパイル時オプション ONIG_OPTION_NONE オプションなし ONIG_OPTION_SINGLELINE '^' -> '\A', '$' -> '\Z' ONIG_OPTION_MULTILINE '.'が改行にマッチする ONIG_OPTION_IGNORECASE 曖昧マッチ オン ONIG_OPTION_EXTEND パターン拡張形式 ONIG_OPTION_FIND_LONGEST 最長マッチ ONIG_OPTION_FIND_NOT_EMPTY 空マッチを無視 ONIG_OPTION_NEGATE_SINGLELINE ONIG_SYNTAX_POSIX_BASIC/POSIX_EXTENDED/PERL/PERL_NG/PYTHON/JAVAでデフォルトで有効なONIG_OPTION_SINGLELINEをクリアする。 ONIG_OPTION_DONT_CAPTURE_GROUP 名前付き捕獲式集合のみ捕獲 ONIG_OPTION_CAPTURE_GROUP 名前無し捕獲式集合も捕獲 ONIG_OPTION_IGNORECASE_IS_ASCII IGNORECASE((?i))をASCII文字の範囲に制限する ONIG_OPTION_WORD_IS_ASCII wordがASCIIのみ (\w, \p{Word}, [[:word:]]) word boundがASCIIのみ (\b) ONIG_OPTION_DIGIT_IS_ASCII digitがASCIIのみ (\d, \p{Digit}, [[:digit:]]) ONIG_OPTION_SPACE_IS_ASCII spaceがASCIIのみ (\s, \p{Space}, [[:space:]]) ONIG_OPTION_POSIX_IS_ASCII POSIXプロパティがASCIIのみ (word, digit, spaceを全て含んでいる) (alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit, word) ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER 拡張書記素房モード ONIG_OPTION_TEXT_SEGMENT_WORD 単語モード * ONIG_OPTION_FIND_LONGEST はonig_search()の後方探索では正しく動作しない 5 enc: 文字エンコーディング ONIG_ENCODING_ASCII ASCII ONIG_ENCODING_ISO_8859_1 ISO 8859-1 ONIG_ENCODING_ISO_8859_2 ISO 8859-2 ONIG_ENCODING_ISO_8859_3 ISO 8859-3 ONIG_ENCODING_ISO_8859_4 ISO 8859-4 ONIG_ENCODING_ISO_8859_5 ISO 8859-5 ONIG_ENCODING_ISO_8859_6 ISO 8859-6 ONIG_ENCODING_ISO_8859_7 ISO 8859-7 ONIG_ENCODING_ISO_8859_8 ISO 8859-8 ONIG_ENCODING_ISO_8859_9 ISO 8859-9 ONIG_ENCODING_ISO_8859_10 ISO 8859-10 ONIG_ENCODING_ISO_8859_11 ISO 8859-11 ONIG_ENCODING_ISO_8859_13 ISO 8859-13 ONIG_ENCODING_ISO_8859_14 ISO 8859-14 ONIG_ENCODING_ISO_8859_15 ISO 8859-15 ONIG_ENCODING_ISO_8859_16 ISO 8859-16 ONIG_ENCODING_UTF8 UTF-8 ONIG_ENCODING_UTF16_BE UTF-16BE ONIG_ENCODING_UTF16_LE UTF-16LE ONIG_ENCODING_UTF32_BE UTF-32BE ONIG_ENCODING_UTF32_LE UTF-32LE ONIG_ENCODING_EUC_JP EUC-JP ONIG_ENCODING_EUC_TW EUC-TW ONIG_ENCODING_EUC_KR EUC-KR ONIG_ENCODING_EUC_CN EUC-CN ONIG_ENCODING_SJIS Shift_JIS ONIG_ENCODING_KOI8_R KOI8-R ONIG_ENCODING_CP1251 CP1251 ONIG_ENCODING_BIG5 Big5 ONIG_ENCODING_GB18030 GB18030 または、ユーザが定義したOnigEncodingTypeデータのアドレス 6 syntax: 正規表現パターン文法定義 ONIG_SYNTAX_ASIS plain text ONIG_SYNTAX_POSIX_BASIC POSIX Basic RE ONIG_SYNTAX_POSIX_EXTENDED POSIX Extended RE ONIG_SYNTAX_EMACS Emacs ONIG_SYNTAX_GREP grep ONIG_SYNTAX_GNU_REGEX GNU regex ONIG_SYNTAX_JAVA Java (Sun java.util.regex) ONIG_SYNTAX_PERL Perl ONIG_SYNTAX_PERL_NG Perl + 名前付き捕獲式集合 ONIG_SYNTAX_PYTHON Python ONIG_SYNTAX_ONIGURUMA Oniguruma ONIG_SYNTAX_DEFAULT default (== ONIG_SYNTAX_ONIGURUMA) onig_set_default_syntax() または、ユーザが定義したOnigSyntaxTypeデータのアドレス 7 err_info: エラー情報を返すためのアドレス onig_error_code_to_str()の三番目の引数として使用する # int onig_new_without_alloc(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* err_info) 正規表現オブジェクト(regex)を作成する。 regの領域を内部で割り当てない。 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 # int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo) この関数は廃止(使用不可)。 パターンと対象文字列の文字エンコーディングが異なる場合を許さなくなった。 正規表現オブジェクト(regex)を作成する。 この関数は、onig_new()のデラックス版。 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 引数 1 reg: 作成された正規表現オブジェクトを返すアドレス 2 pattern: 正規表現パターン文字列 3 pattern_end: 正規表現パターン文字列の終端アドレス(pattern + pattern length) 4 ci: コンパイル情報 ci->num_of_elements: ciの要素数 (現在の版では: 5) ci->pattern_enc: パターン文字列の文字エンコーディング ci->target_enc: 対象文字列の文字エンコーディング ci->syntax: 正規表現パターン文法定義 ci->option: 正規表現コンパイル時オプション ci->case_fold_flag: ONIG_OPTION_IGNORECASEモードでの 文字曖昧マッチ指定ビットフラグ ONIGENC_CASE_FOLD_MIN: 最小 ONIGENC_CASE_FOLD_DEFAULT: 最小 onig_set_default_case_fold_flag() 5 err_info: エラー情報を返すためのアドレス onig_error_code_to_str()の三番目の引数として使用する 異なる文字エンコーディングの組み合わせは、以下の場合にのみ許される。 pattern_enc: ASCII, ISO_8859_1 target_enc: UTF16_BE, UTF16_LE, UTF32_BE, UTF32_LE pattern_enc: UTF16_BE/LE target_enc: UTF16_LE/BE pattern_enc: UTF32_BE/LE target_enc: UTF32_LE/BE # void onig_free(regex_t* reg) 正規表現オブジェクトのメモリを解放する。 引数 1 reg: 正規表現オブジェクト # void onig_free_body(regex_t* reg) 正規表現オブジェクトのメモリを解放する。(reg自身の領域を除いて) 引数 1 reg: 正規表現オブジェクト # OnigMatchParam* onig_new_match_param() OnigMatchParamオブジェクトを生成し、onig_initialize_match_param()を使用して 中身を初期化する。 # void onig_free_match_param(OnigMatchParam* mp) OnigMatchParamオブジェクトで使用しているメモリを開放する。 引数 1 mp: OnigMatchParamオブジェクト # void onig_initialize_match_param(OnigMatchParam* mp) マッチパラメタ構造体にデフォルト値をセットする。 マッチパラメタは、onig_match_with_param(), onig_search_with_param()で 使用される。 引数 1 mp: マッチパラメタオブジェクトアドレス # int onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* mp, unsigned int limit) マッチスタックの最大深さをセットする。 0は、無制限を表す。 引数 1 mp: マッチパラメタオブジェクトアドレス 2 limit: 制限数 正常終了戻り値: ONIG_NORMAL # int onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* mp, unsigned long limit) 一回のマッチでのリトライ数の制限値をセットする。 0は無制限を意味する。 引数 1 mp: マッチパラメタオブジェクトアドレス 2 limit: 制限回数 正常終了戻り値: ONIG_NORMAL # int onig_set_retry_limit_in_search_of_match_param(OnigMatchParam* mp, unsigned long limit) 一回の検索でのリトライ数の制限値をセットする。 0は無制限を意味する。 引数 1 mp: マッチパラメタオブジェクトアドレス 2 limit: 制限回数 正常終了戻り値: ONIG_NORMAL # int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) 前進時の内容の呼び出し(callouts)で呼び出される関数をセットする。 もし0(NULL)がセットされると、前進時に呼び出しは起こらない。 引数 1 mp: マッチパラメタオブジェクトアドレス 2 f: 呼び出される関数 正常終了戻り値: ONIG_NORMAL # int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) 後退時の内容の呼び出し(callouts)で呼び出される関数をセットする。 もし0(NULL)がセットされると、後退時に呼び出しは起こらない。 引数 1 mp: マッチパラメタオブジェクトアドレス 2 f: 呼び出される関数 正常終了戻り値: ONIG_NORMAL # int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option) 正規表現で文字列を検索し、検索結果とマッチ領域を返す。 正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。 戻り値 正常終了: マッチ位置 (p - str >= 0) 検索失敗: ONIG_MISMATCH (< 0) * 若しONIG_OPTION_CALLBACK_EACH_MATCHが使用されると、マッチするものがあってもONIG_MISMATCHが返される。 引数 1 reg: 正規表現オブジェクト 2 str: 検索対象文字列 3 end: 検索対象文字列の終端アドレス 4 start: 検索対象文字列の検索先頭位置アドレス 5 range: 検索対象文字列の検索終了位置アドレス 前方探索 (start <= 探索される文字列 < range) 後方探索 (range <= 探索される文字列 <= start) 6 region: マッチ領域情報(region) (NULLも許される) 7 option: 検索時オプション ONIG_OPTION_NOTBOL strの先頭を行頭および文字列先頭と看做さない ONIG_OPTION_NOTEOL endを行末および文字列終端と看做さない ONIG_OPTION_NOT_BEGIN_STRING strの先頭を文字列の先頭と看做さない (\A 失敗) ONIG_OPTION_NOT_END_STRING endを文字列終端と看做さない (\z, \Z 失敗) ONIG_OPTION_NOT_BEGIN_POSITION startを検索開始位置と看做さない (\G 失敗) ONIG_OPTION_CALLBACK_EACH_MATCH 全てのマッチ成功に対してコールバック関数が呼び出される。 (マッチ開始位置が同じものも含めて) ある位置でマッチするものが見つかっても探索が止まることはない。 呼び出されるコールバック関数は、onig_set_callback_each_match()で与える。 コールバック関数に渡される引数の中のuser_dataは、 onig_set_callout_user_data_of_match_param(mp, user_data)で指定する。 このため、user_dataを指定したい場合には、onig_search()ではなく、 onig_search_with_param()を使用することになる。 onig_set_callout_user_data_of_match_param()で指定するuser_dataは、 calloutで使用されるuser_dataと共用される。 ONIG_OPTION_MATCH_WHOLE_STRING マッチした終端の位置がendになることを要求 # int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp) 正規表現で文字列を検索し、検索結果とマッチ領域を返す。 正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。 引数 1-7: onig_search()と同じ 8 mp: マッチパラメタ値 (match_stack_limit, retry_limit_in_match, retry_limit_in_search) # int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option) 文字列の指定位置でマッチングを行い、結果とマッチ領域を返す。 正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。 戻り値 正常終了: マッチしたバイト長 (>= 0) not match: ONIG_MISMATCH ( < 0) * 若しONIG_OPTION_CALLBACK_EACH_MATCHが使用されると、マッチするものがあってもONIG_MISMATCHが返される。 引数 1 reg: 正規表現オブジェクト 2 str: 検索対象文字列 3 end: 検索対象文字列の終端アドレス 4 at: 検索対象文字列の検索アドレス 5 region: マッチ領域情報(region) (NULLも許される) 6 option: 検索時オプション ONIG_OPTION_NOTBOL strの先頭を行頭および文字列先頭と看做さない ONIG_OPTION_NOTEOL endを行末および文字列終端と看做さない ONIG_OPTION_NOT_BEGIN_STRING strの先頭を文字列の先頭と看做さない (\A 失敗) ONIG_OPTION_NOT_END_STRING endを文字列終端と看做さない (\z, \Z 失敗) ONIG_OPTION_NOT_BEGIN_POSITION startを検索開始位置と看做さない (\G 失敗) ONIG_OPTION_CALLBACK_EACH_MATCH 全てのマッチ成功に対してコールバック関数が呼び出される。 ONIG_OPTION_MATCH_WHOLE_STRING マッチした終端の位置がendになることを要求 # int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp) 文字列の指定位置でマッチングを行い、結果とマッチ領域を返す。 正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。 引数 1-6: onig_match()と同じ 7 mp: マッチパラメタ値 (match_stack_limit, retry_limit_in_match, retry_limit_in_search) # int onig_scan(regex_t* reg, const UChar* str, const UChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), void* callback_arg) 正規表現で文字列をスキャンして、マッチングする毎にコールバック関数を呼び出す。 正規表現オブジェクトの文字エンコーディングで、検索文字列として不正な文字列を渡してはいけない。 戻り値 正常終了: マッチ回数 (0回も含める) エラー: エラーコード (< 0) 中断: コールバック関数が0以外の戻り値を返したとき、その値を戻り値として中断 引数 1 reg: 正規表現オブジェクト 2 str: 検索対象文字列 3 end: 検索対象文字列の終端アドレス 4 region: マッチ領域情報(region) (NULLも許される) 5 option: 検索時オプション 6 scan_callback: コールバック関数 7 callback_arg: コールバック関数に渡される付加引数値 # int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[]) regsetオブジェクトを生成する。 全ての正規表現オブジェクトは、同じ文字エンコーディングでなければならない。 全ての正規表現オブジェクトは、ONIG_OPTION_FIND_LONGESTオプションでコンパイルされていてはならない。 引数 1 rset: regsetオブジェクトを返すためのアドレス 2 n: 正規表現の個数 3 regs: 正規表現オブジェクトの配列 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 # int onig_regset_add(OnigRegSet* set, regex_t* reg) regsetオブジェクトに正規表現を追加する。 正規表現オブジェクトは、regsetと同じ文字エンコーディングでなければならない。 正規表現オブジェクトは、ONIG_OPTION_FIND_LONGESTオプションでコンパイルされていてはならない。 引数 1 set: regsetオブジェクト 2 reg: 正規表現オブジェクト 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 # int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg) regsetの中の一個の正規表現オブジェクトを別のものに変更する。 若しreg引数の値がNULLであれば、at番目の正規表現オブジェクトを外す。(そして、以降の正規表現オブジェクトのインデックスは変化する) 引数 1 set: regsetオブジェクト 2 at: 変更する場所のインデックス 3 reg: 正規表現オブジェクト 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 # void onig_regset_free(OnigRegSet* set) regsetオブジェクトとその中の正規表現オブジェクトの使用メモリを開放する。 若し、同一の正規表現オブジェクトを重複して登録していれば、破壊的な状況になる。 引数 1 set: regsetオブジェクト # int onig_regset_number_of_regex(OnigRegSet* set) regsetの中の正規表現オブジェクトの個数を返す。 引数 1 set: regsetオブジェクト # regex_t* onig_regset_get_regex(OnigRegSet* set, int at) regsetのat番目の正規表現を返す。 引数 1 set: regsetオブジェクト 2 at: 正規表現オブジェクトのインデックス (ゼロ開始) # OnigRegion* onig_regset_get_region(OnigRegSet* set, int at) regsetのat番目の正規表現に対応する領域を返す。 引数 1 set: regsetオブジェクト 2 at: 正規表現オブジェクトのインデックス (ゼロ開始) # int onig_regset_search(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos) regsetによる検索を実行する。 戻り値 検索成功: マッチした正規表現オブジェクトのインデックス (ゼロ開始) 検索失敗: ONIG_MISMATCH (< 0) エラー: エラーコード (< 0) 引数 1 set: regsetオブジェクト 2 str: 検索対象文字列 3 end: 検索対象文字列の終端アドレス 4 start: 検索対象文字列の検索先頭位置アドレス 5 range: 検索対象文字列の検索終了位置アドレス (start <= 探索される文字列 < range) 6 lead: 外側のループ要素 ONIG_REGSET_POSITION_LEAD (最左位置でマッチした結果を返す) ONIG_REGSET_REGEX_LEAD (最左位置でマッチした結果を返す) ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (最初にマッチした正規表現の結果を返す) 7 option: 検索時オプション ONIG_OPTION_NOTBOL strの先頭を行頭および文字列先頭と看做さない ONIG_OPTION_NOTEOL endを行末および文字列終端と看做さない ONIG_OPTION_NOT_BEGIN_STRING strの先頭を文字列の先頭と看做さない (\A 失敗) ONIG_OPTION_NOT_END_STRING endを文字列終端と看做さない (\z, \Z 失敗) ONIG_OPTION_NOT_BEGIN_POSITION startを検索開始位置と看做さない (\G 失敗) 8 rmatch_pos: マッチした位置を返すためのアドレス (match_address - str) * ONIG_REGSET_POSITION_LEADとONIG_REGSET_REGEX_LEADは同じ結果を返す。 これらの違いは検索時間にしか現れない。 ほとんどの場合、ONIG_REGSET_POSITION_LEADのほうが速いと思われる。 # int onig_regset_search_with_param(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos) regsetとOnigMatchParamオブジェクトによる検索を実行する。 戻り値 検索成功: マッチした正規表現オブジェクトのインデックス (ゼロ開始) 検索失敗: ONIG_MISMATCH (< 0) エラー: エラーコード (< 0) 引数 1 set: regsetオブジェクト 2 str: 検索対象文字列 3 end: 検索対象文字列の終端アドレス 4 start: 検索対象文字列の検索先頭位置アドレス 5 range: 検索対象文字列の検索終了位置アドレス (start <= 探索される文字列 < range) 6 lead: 外側のループ要素 ONIG_REGSET_POSITION_LEAD (最左位置でマッチした結果を返す) ONIG_REGSET_REGEX_LEAD (最左位置でマッチした結果を返す) ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (最初にマッチした正規表現の結果を返す) 7 option: 検索時オプション ONIG_OPTION_NOTBOL strの先頭を行頭および文字列先頭と看做さない ONIG_OPTION_NOTEOL endを行末および文字列終端と看做さない ONIG_OPTION_NOT_BEGIN_STRING strの先頭を文字列の先頭と看做さない (\A 失敗) ONIG_OPTION_NOT_END_STRING endを文字列終端と看做さない (\z, \Z 失敗) ONIG_OPTION_NOT_BEGIN_POSITION startを検索開始位置と看做さない (\G 失敗) 8 mps: OnigMatchParamオブジェクトの配列 9 rmatch_pos: マッチした位置を返すためのアドレス (match_address - str) # OnigRegion* onig_region_new(void) マッチ領域情報(region)を作成する。 # void onig_region_free(OnigRegion* region, int free_self) マッチ領域情報(region)で使用されているメモリを解放する。 引数 1 region: マッチ領域情報オブジェクト 2 free_self: [1: region自身を含めて全て解放, 0: region自身は解放しない] # void onig_region_copy(OnigRegion* to, OnigRegion* from) マッチ領域情報(region)を複製する。 引数 1 to: 対象領域 2 from: 元領域 # void onig_region_clear(OnigRegion* region) マッチ領域情報(region)の中味をクリアする。 引数 1 region: 対象領域 # int onig_region_resize(OnigRegion* region, int n) マッチ領域情報(region)の捕獲式集合(グループ)数を変更する。 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 引数 1 region: 対象領域 2 n: 新しいサイズ # int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end, int** num_list) 指定した名前に対する名前付き捕獲式集合(グループ)の グループ番号リストを返す。 名前付き捕獲式集合は、(?....)によって定義できる。 戻り値 正常終了: 指定された名前に対するグループ数 (例 /(?..)(?..)/ ==> 2) 名前に対するグループが存在しない: ONIGERR_UNDEFINED_NAME_REFERENCE 引数 1 reg: 正規表現オブジェクト 2 name: 捕獲式集合(グループ)名 3 name_end: 捕獲式集合(グループ)名の終端アドレス 4 num_list: 番号リストを返すアドレス # int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end, OnigRegion *region) 指定された名前の後方参照(\k)に対する捕獲式集合(グループ)の番号を返す。 名前に対して、複数のマッチ領域が有効であれば、その中の最大の番号を返す。 名前に対する捕獲式集合が一個しかないときには、対応するマッチ領域が有効か どうかに関係なく、その番号を返す。(従って、regionにはNULLを渡してもよい。) 戻り値 正常終了: 番号 エラー時: エラーコード < 0 引数 1 reg: 正規表現オブジェクト 2 name: 捕獲式集合(グループ)名 3 name_end: 捕獲式集合(グループ)名の終端アドレス 4 region: search/match結果のマッチ領域 # int onig_foreach_name(regex_t* reg, int (*func)(const UChar*, const UChar*, int,int*,regex_t*,void*), void* arg) 全ての名前に対してコールバック関数呼び出しを実行する。 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: コールバック関数の戻り値 引数 1 reg: 正規表現オブジェクト 2 func: コールバック関数 func(name, name_end, , , reg, arg); funcが0以外の値を返すと、それ以降のコールバックは行なわずに 終了する。 3 arg: funcに対する追加引数 # int onig_number_of_names(regex_t* reg) パターン中で定義された名前の数を返す。 一個の名前の多重定義は一個と看做す。 引数 1 reg: 正規表現オブジェクト # OnigEncoding onig_get_encoding(regex_t* reg) # OnigOptionType onig_get_options(regex_t* reg) # OnigSyntaxType* onig_get_syntax(regex_t* reg) 正規表現オブジェクトに対して、対応する値を返す。 引数 1 reg: 正規表現オブジェクト # OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg) 正規表現オブジェクトに対して、case_fold_flag値を返す。 この関数は廃止予定(非推奨)。 引数 1 reg: 正規表現オブジェクト # int onig_number_of_captures(regex_t* reg) パターン中で定義された捕獲グループの数を返す。 引数 1 reg: 正規表現オブジェクト # OnigCallbackEachMatchFunc onig_get_callback_each_match(void) ONIG_OPTION_CALLBACK_EACH_MATCHに対する現在のコールバック関数を返す。 # int onig_set_callback_each_match(OnigCallbackEachMatchFunc func) ONIG_OPTION_CALLBACK_EACH_MATCHに対するコールバック関数をセットする。 若しNULLがセットされると、コールバックは実行されない。 戻り値 正常終了: ONIG_NORMAL == 0 引数 1 func: コールバック関数 # int onig_number_of_capture_histories(regex_t* reg) パターン中で定義された捕獲履歴(?@...)の数を返す。 使用する文法で捕獲履歴機能が有効(ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY) でなければ、捕獲履歴機能は使用できない。 引数 1 reg: 正規表現オブジェクト # OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region) 捕獲履歴データのルートノードを返す。 マッチが失敗している場合には、この値は不定である。 引数 1 region: マッチ領域 # int onig_capture_tree_traverse(OnigRegion* region, int at, int(*func)(int,int,int,int,int,void*), void* arg) 捕獲履歴データ木を巡回してコールバックする。 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: コールバック関数の戻り値 引数 1 region: マッチ領域 2 at: コールバックを行なうタイミング ONIG_TRAVERSE_CALLBACK_AT_FIRST: 最初にコールバックして、子ノードを巡回 ONIG_TRAVERSE_CALLBACK_AT_LAST: 子ノードを巡回して、コールバック ONIG_TRAVERSE_CALLBACK_AT_BOTH: 最初にコールバックして、子ノードを巡回、最後にもう一度コールバック 3 func: コールバック関数 funcが0以外の値を返すと、それ以降の巡回は行なわずに 終了する。 int func(int group, int beg, int end, int level, int at, void* arg) group: グループ番号 beg: マッチ開始位置 end マッチ終了位置 level: ネストレベル (0から) at: コールバックが呼び出されたタイミング ONIG_TRAVERSE_CALLBACK_AT_FIRST ONIG_TRAVERSE_CALLBACK_AT_LAST arg: 追加引数 4 arg; funcに対する追加引数 # int onig_noname_group_capture_is_active(regex_t* reg) 名前なし式集合の捕獲機能が有効かどうかを返す。 戻り値 有効: 1 無効: 0 引数 1 reg: 正規表現オブジェクト オプションのONIG_OPTION_DONT_CAPTURE_GROUPがON --> 無効 パターンが名前つき式集合を使用している AND 使用文法で、ONIG_SYN_CAPTURE_ONLY_NAMED_GROUPがON AND オプションのONIG_OPTION_CAPTURE_GROUPがOFF --> 無効 上記以外の場合 --> 有効 # UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s) 文字一個分前の文字列位置を返す。 引数 1 enc: 文字エンコーディング 2 start: 文字列の先頭アドレス 3 s: 文字列中の位置 # UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s) 文字の先頭バイト位置になるように左側に調整したアドレスを返す。 引数 1 enc: 文字エンコーディング 2 start: 文字列の先頭アドレス 3 s: 文字列中の位置 # UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s) 文字の先頭バイト位置になるように右側に調整したアドレスを返す。 引数 1 enc: 文字エンコーディング 2 start: 文字列の先頭アドレス 3 s: 文字列中の位置 # int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end) 文字列の文字数を返す。 # int onigenc_strlen_null(OnigEncoding enc, const UChar* s) 文字列の文字数を返す。 文字エンコーディングに対して、不正な文字列を渡してはいけない。 # int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s) 文字列のバイト数を返す。 文字エンコーディングに対して、不正な文字列を渡してはいけない。 # int onig_set_default_syntax(OnigSyntaxType* syntax) デフォルトの正規表現パターン文法をセットする。 引数 1 syntax: 正規表現パターン文法 # void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from) 正規表現パターン文法をコピーする。 引数 1 to: 対象 2 from: 元 # unsigned int onig_get_syntax_op(OnigSyntaxType* syntax) # unsigned int onig_get_syntax_op2(OnigSyntaxType* syntax) # unsigned int onig_get_syntax_behavior(OnigSyntaxType* syntax) # OnigOptionType onig_get_syntax_options(OnigSyntaxType* syntax) # void onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op) # void onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2) # void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior) # void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options) 正規表現パターン文法の要素を参照/取得する。 引数 1 syntax: 正規表現パターン文法 2 op, op2, behavior, options: 要素の値 # void onig_copy_encoding(OnigEncoding to, OnigEncoding from) 文字エンコーディングをコピーする。 引数 1 to: 対象 2 from: 元 # int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code) メタ文字を指定したコードポイント値にセットする。 ONIG_SYN_OP_VARIABLE_META_CHARACTERSが正規表現パターン文法で有効に なっていない場合には、エスケープ文字を除いて、ここで指定したメタ文字は 機能しない。(組込みの文法では有効にしていない。) 正常終了戻り値: ONIG_NORMAL 引数 1 syntax: 対象文法 2 what: メタ文字機能の指定 ONIG_META_CHAR_ESCAPE ONIG_META_CHAR_ANYCHAR ONIG_META_CHAR_ANYTIME ONIG_META_CHAR_ZERO_OR_ONE_TIME ONIG_META_CHAR_ONE_OR_MORE_TIME ONIG_META_CHAR_ANYCHAR_ANYTIME 3 code: メタ文字のコードポイント または ONIG_INEFFECTIVE_META_CHAR. # OnigCaseFoldType onig_get_default_case_fold_flag() デフォルトのcase foldフラグを取得する。 この関数は廃止予定(非推奨)。 # int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag) デフォルトのcase foldフラグをセットする。 この関数は廃止予定(非推奨)。 引数 1 case_fold_flag: case foldフラグ # unsigned int onig_get_match_stack_limit_size(void) マッチスタックサイズの最大値を返す。 (デフォルト: 0 == 無制限) # int onig_set_match_stack_limit_size(unsigned int size) マッチスタックサイズの最大値を指定する。 (size = 0: 無制限) 正常終了戻り値: ONIG_NORMAL # unsigned long onig_get_retry_limit_in_match(void) 一回のマッチングでのリトライ数の制限値を返す。 (デフォルト: 10000000) 正常終了戻り値: 制限値 # unsigned long onig_get_retry_limit_in_search(void) 一回の検索でのリトライ数の制限値を返す。 0は無制限を意味する。 (デフォルト: 0) 正常終了戻り値: 制限値 # int onig_set_retry_limit_in_match(unsigned long limit) 一回のマッチング内でのリトライ数の制限値を指定する。 0は無制限を意味する。 正常終了戻り値: ONIG_NORMAL # int onig_set_retry_limit_in_search(unsigned long limit) 一回の検索でのリトライ数の制限値をセットする。 0は無制限を意味する。 (デフォルト: 0) 正常終了戻り値: ONIG_NORMAL # unsigned long onig_get_subexp_call_limit_in_search(void) 部分式呼出しの呼び出し回数の制限値を返す。 (デフォルト: 0:無制限) 正常終了戻り値: 制限値 # int onig_set_subexp_call_limit_in_search(unsigned long n) 部分式呼出しの呼び出し回数の制限値を指定する。 正常終了戻り値: ONIG_NORMAL # int onig_get_subexp_call_max_nest_level(void) 部分式呼出しのネストレベルの最大値を返す。 (デフォルト: 24) 正常終了戻り値: 制限値 # int onig_set_subexp_call_max_nest_level(int max_level) 部分式呼出しのネストレベルの最大値を指定する。 正常終了戻り値: ONIG_NORMAL # OnigCalloutFunc onig_get_progress_callout(void) 前進時の内容の呼び出しで呼び出される関数を返す。 # int onig_set_progress_callout(OnigCalloutFunc f) 前進時の内容の呼び出しで呼び出される関数を指定する。 もし0(NULL)を指定すると、前進時の内容の呼び出しで呼び出しは起こらない。 正常終了戻り値: ONIG_NORMAL # OnigCalloutFunc onig_get_retraction_callout(void) 後退時の内容の呼び出しで呼び出される関数を返す。 # int onig_set_retraction_callout(OnigCalloutFunc f) 後退時の内容の呼び出しで呼び出される関数を指定する。 もし0(NULL)を指定すると、後退時の内容の呼び出しで呼び出しは起こらない。 正常終了戻り値: ONIG_NORMAL # int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)) 新しいUnicodeプロパティを定義する。 (この関数はスレッドセーフではない) 引数 1 name: プロパティ名 (ASCIIコードのみ。 文字 ' ', '-', '_' は無視される。) 2 ranges: プロパティコードポイント範囲 (最初の要素は範囲の数) [num-of-ranges, 1st-range-start, 1st-range-end, 2nd-range-start... ] * この関数を呼んだ後で、rangesを変更/破壊しないこと 戻り値 正常終了: ONIG_NORMAL == 0 エラー時: エラーコード < 0 # unsigned int onig_get_parse_depth_limit(void) 再帰パース処理の最大深さを返す。 (デフォルト: regint.h で定義されている DEFAULT_PARSE_DEPTH_LIMIT。現在は 4096) # int onig_set_parse_depth_limit(unsigned int depth) 再帰パース処理の最大深さを指定する。 (depth = 0: regint.h で定義されたデフォルト値に設定する。) 正常終了戻り値: ONIG_NORMAL # int onig_end(void) ライブラリの使用を終了する。 正常終了戻り値: ONIG_NORMAL onig_initialize()を再度呼び出しても、以前に作成した正規表現オブジェクト を使用することはできない。 # const char* onig_version(void) バージョン文字列を返す。(例 "5.0.3") // END jq-1.8.2/vendor/oniguruma/doc/CALLOUTS.API0000644000175100017510000003025715215513537013466 Callouts API Version 6.9.7 2021/03/21 #include (1) Callout functions (2) Set/Get functions for Callouts of contents (3) Set functions for Callouts of name (4) User data (5) Get values from OnigCalloutArgs (6) Tag (7) Callout data (used in callout functions) (8) Callout data (used in applications) (9) Miscellaneous functions (1) Callout functions type: OnigCalloutFunc typedef int (*OnigCalloutFunc)(OnigCalloutArgs* args, void* user_data); If 0 (NULL) is set as a callout function value, never called. * Callout function return value (int) ONIG_CALLOUT_FAIL (== 1): fail ONIG_CALLOUT_SUCCESS (== 0): success less than -1: error code (terminate search/match) ONIG_CALLOUT_FAIL/SUCCESS values are ignored in retractions, because retraction is a part of recovery process after failure. * Example of callout function extern int always_success(OnigCalloutArgs* args, void* user_data) { return ONIG_CALLOUT_SUCCESS; } (2) Set/Get functions for Callouts of contents # OnigCalloutFunc onig_get_progress_callout(void) Get a function for callouts of contents in progress. # int onig_set_progress_callout(OnigCalloutFunc f) Set a function for callouts of contents in progress. This value set in onig_initialize_match_param() as a default callout function. normal return: ONIG_NORMAL # OnigCalloutFunc onig_get_retraction_callout(void) Get a function for callouts of contents in retraction (backtrack). # int onig_set_retraction_callout(OnigCalloutFunc f) Set a function for callouts of contents in retraction (backtrack). This value set in onig_initialize_match_param() as a default callout function. normal return: ONIG_NORMAL # int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) Set a function for callouts of contents in progress. arguments 1 mp: match-param pointer 2 f: function normal return: ONIG_NORMAL # int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) Set a function for callouts of contents in retraction (backtrack). arguments 1 mp: match-param pointer 2 f: function normal return: ONIG_NORMAL (3) Set functions for Callouts of name # int onig_set_callout_of_name(OnigEncoding enc, OnigCalloutType type, OnigUChar* name, OnigUChar* name_end, int callout_in, OnigCalloutFunc callout, OnigCalloutFunc end_callout, int arg_num, unsigned int arg_types[], int opt_arg_num, OnigValue opt_defaults[]) Set a function for callouts of name. Allowed name string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) (enc, name) pair is used as key value to find callout function. You have to call this function for every encoding used in your applications. But if enc is ASCII compatible and (enc, name) entry is not found, then (ASCII, name) entry is used. Therefore, if you use ASCII compatible encodings only, it is enough to call this function one time for (ASCII, name). arguments 1 enc: character encoding 2 type: callout type (currently ONIG_CALLOUT_TYPE_SINGLE only supported) 3 name: name string address (the string is encoded by enc) 4 name_end: name string end address 5 callout_in: direction (ONIG_CALLOUT_IN_PROGRESS/RETRACTION/BOTH) 6 callout: callout function 7 end_callout: * not used currently (set 0) 8 arg_num: number of arguments (*limit by ONIG_CALLOUT_MAX_ARGS_NUM == 4) 9 arg_types: type array of arguments 10 opt_arg_num: number of optional arguments 11 opt_defaults: default values array of optional arguments normal return: ONIG_NORMAL error: ONIGERR_INVALID_CALLOUT_NAME ONIGERR_INVALID_ARGUMENT ONIGERR_INVALID_CALLOUT_ARG (4) User data # int onig_set_callout_user_data_of_match_param(OnigMatchParam* param, void* user_data) Set a user_data value which passed as second argument of callout. normal return: ONIG_NORMAL (5) Get values from OnigCalloutArgs # int onig_get_callout_num_by_callout_args(OnigCalloutArgs* args) Returns callout number of this callout. "Callout number" is an identifier of callout in a regex pattern. # OnigCalloutIn onig_get_callout_in_by_callout_args(OnigCalloutArgs* args) Returns the direction of this callout. (ONIG_CALLOUT_IN_PROGRESS or ONIG_CALLOUT_IN_RETRACTION) # int onig_get_name_id_by_callout_args(OnigCalloutArgs* args) Returns the name identifier of this callout. If this callout is callout of contents, then returns ONIG_NON_NAME_ID. # const OnigUChar* onig_get_contents_by_callout_args(OnigCalloutArgs* args) Returns the contents string of this callout. (NULL terminated string) If this callout is callout of name, then returns NULL. # const OnigUChar* onig_get_contents_end_by_callout_args(OnigCalloutArgs* args) Returns the end of contents string of this callout. If this callout is callout of name, then returns NULL. # int onig_get_args_num_by_callout_args(OnigCalloutArgs* args) Returns the number of args of this callout. It includes optional arguments that doesn't passed in regex pattern. If this callout is callout of contents, then returns ONIGERR_INVALID_ARGUMENT. # int onig_get_passed_args_num_by_callout_args(OnigCalloutArgs* args) Returns the number of args that passed really in regex pattern. If this callout is callout of contents, then returns ONIGERR_INVALID_ARGUMENT. # int onig_get_arg_by_callout_args(OnigCalloutArgs* args, int index, OnigType* type, OnigValue* val) Returns a value and a type of the callout argument. If this callout is callout of contents, then returns ONIGERR_INVALID_ARGUMENT. normal return: ONIG_NORMAL # const OnigUChar* onig_get_string_by_callout_args(OnigCalloutArgs* args) Returns the subject string address. This is the second argument(str) of onig_search(). # const OnigUChar* onig_get_string_end_by_callout_args(OnigCalloutArgs* args) Returns the end address of subject string. This is the third argument(end) of onig_search(). # const OnigUChar* onig_get_start_by_callout_args(OnigCalloutArgs* args) Returns the start address of subject string in current match process. # const OnigUChar* onig_get_right_range_by_callout_args(OnigCalloutArgs* args) Returns the right range address of subject string. # const OnigUChar* onig_get_current_by_callout_args(OnigCalloutArgs* args) Returns the current address of subject string in current match process. # OnigRegex onig_get_regex_by_callout_args(OnigCalloutArgs* args) Returns the regex object address of this callout. # unsigned long onig_get_retry_counter_by_callout_args(OnigCalloutArgs* args) Returns the current counter value for retry-limit-in-match. (6) Tag "Tag" is a name assigned to a callout in regexp pattern. Allowed tag string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) # int onig_callout_tag_is_exist_at_callout_num(OnigRegex reg, int callout_num) Returns 1 if tag is assigned for the callout, else returns 0. # int onig_get_callout_num_by_tag(OnigRegex reg, const OnigUChar* tag, const OnigUChar* tag_end) Returns the callout number for the tag. # const OnigUChar* onig_get_callout_tag_start(OnigRegex reg, int callout_num) Returns the start address of tag string for the callout. (NULL terminated string) # const OnigUChar* onig_get_callout_tag_end(OnigRegex reg, int callout_num) Returns the end address of tag string for the callout. (7) Callout data (used in callout functions) "Callout data" is ONIG_CALLOUT_DATA_SLOT_NUM(5) values area for each callout in each search process. Each value area in a callout is indicated by "slot" number (0 - 4). Callout data are used for any purpose by callout function implementers. # int onig_get_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType* type, OnigValue* val) Returns the callout data value/type for a callout slot indicated by callout_num/slot. ONIG_NORMAL: normal return ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID < 0: error code # int onig_get_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) Returns self callout data value/type. ONIG_NORMAL: normal return ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID < 0: error code # int onig_set_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType type, OnigValue* val) Set the callout data value/type for a callout slot indicated by callout_num/slot. ONIG_NORMAL: normal return < 0: error code # int onig_set_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType type, OnigValue* val) Set self callout data value/type for a callout slot indicated by slot. ONIG_NORMAL: normal return < 0: error code # int onig_get_callout_data_by_callout_args_self_dont_clear_old(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val) This function is almost same as onig_get_callout_data_by_callout_args_self(). But this function does not clear the value set in the collation position before the current position. (dont_clear_old) The other onig_get_callout_data_xxxx() function clears the value set in the collation process of the previous position. For example, Builtin callout (*TOTAL_COUNT) is implemented by using this function for accumulate count of all of match processes in a search process. Builtin callout (*COUNT) returns count in last success match process only, because it doesn't use this function. ONIG_NORMAL: normal return ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID < 0: error code (8) Callout data (used in applications) # int onig_get_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) Returns the callout data value/type for a callout slot indicated by callout_num/slot. ONIG_NORMAL: normal return ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID < 0: error code # int onig_get_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val) Returns the callout data value/type for a callout slot indicated by tag/slot. ONIG_NORMAL: normal return ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID < 0: error code # int onig_set_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType type, OnigValue* val) Set the callout data value/type for a callout slot indicated by callout_num/slot. ONIG_NORMAL: normal return < 0: error code # int onig_set_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType type, OnigValue* val) Set the callout data value/type for a callout slot indicated by tag/slot. ONIG_NORMAL: normal return < 0: error code # int onig_get_callout_data_dont_clear_old(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val) No needs to use this function. It will be abolished. # int onig_get_callout_data_by_tag_dont_clear_old(regex_t* reg, OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot, OnigType* type, OnigValue* val) Returns the callout data value/type for a callout slot indicated by tag/slot. This function does not clear the value set in the collation position before the current position. (dont_clear_old) ONIG_NORMAL: 正常終了 ONIG_VALUE_IS_NOT_SET: 値が未セット / 型がVOID < 0: エラーコード (9) Miscellaneous functions # OnigUChar* onig_get_callout_name_by_name_id(int name_id) Returns callout name of the name id. if invalid name id is passed, return 0. # int onig_get_capture_range_in_callout(OnigCalloutArgs* args, int mem_num, int* begin, int* end) Returns current capture range position. Position is byte length offset from subject string. For uncaptured mem_num, ONIG_REGION_NOTPOS is set. # int onig_get_used_stack_size_in_callout(OnigCalloutArgs* args, int* used_num, int* used_bytes) Returns current used match-stack size. used_num: number of match-stack elements used_bytes: used byte size of match-stack //END jq-1.8.2/vendor/oniguruma/doc/SYNTAX.md0000644000175100017510000015122115215513537013250 # Oniguruma syntax (operator) configuration _Documented for Oniguruma 6.9.10 (2024/12/21)_ ---------- ## Overview This document details how to configure Oniguruma's syntax, by describing the desired syntax operators and behaviors in an instance of the OnigSyntaxType struct, just like the built-in Oniguruma syntaxes do. Configuration operators are bit flags, and are broken into multiple groups, somewhat arbitrarily, because Oniguruma takes its configuration as a trio of 32-bit `unsigned int` values, assigned as the first three fields in an `OnigSyntaxType` struct: ```C typedef struct { unsigned int op; unsigned int op2; unsigned int behavior; OnigOptionType options; /* default option */ OnigMetaCharTableType meta_char_table; } OnigSyntaxType; ``` The first group of configuration flags (`op`) roughly corresponds to the configuration for "basic regex." The second group (`op2`) roughly corresponds to the configuration for "advanced regex." And the third group (`behavior`) describes more-or-less what to do for broken input, bad input, or other corner-case regular expressions whose meaning is not well-defined. These three groups of flags are described in full below, and tables of their usages for various syntaxes follow. The `options` field describes the default compile options to use if the caller does not specify any options when invoking `onig_new()`. The `meta_char_table` field is used exclusively by the `ONIG_SYN_OP_VARIABLE_META_CHARACTERS` option, which allows the various regex metacharacters, like `*` and `?`, to be replaced with alternates (for example, SQL typically uses `%` instead of `.*` and `_` instead of `?`). ---------- ## Group One Flags (op) This group contains "basic regex" constructs, features common to most regex systems. ### 0. ONIG_SYN_OP_VARIABLE_META_CHARACTERS _Set in: none_ Enables support for `onig_set_meta_char()`, which allows you to provide alternate characters that will be used instead of the six special characters that are normally these characters below: - `ONIG_META_CHAR_ESCAPE`: `\` - `ONIG_META_CHAR_ANYCHAR`: `.` - `ONIG_META_CHAR_ANYTIME`: `*` - `ONIG_META_CHAR_ZERO_OR_ONE_TIME`: `?` - `ONIG_META_CHAR_ONE_OR_MORE_TIME`: `+` - `ONIG_META_CHAR_ANYCHAR_ANYTIME`: Equivalent in normal regex to `.*`, but supported explicitly so that Oniguruma can support matching SQL `%` wildcards or shell `*` wildcards. If this flag is set, then the values defined using `onig_set_meta_char()` will be used; if this flag is clear, then the default regex characters will be used instead, and data set by `onig_set_meta_char()` will be ignored. ### 1. ONIG_SYN_OP_DOT_ANYCHAR (enable `.`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Grep, Emacs, PosixExtended, PosixBasic_ Enables support for the standard `.` metacharacter, meaning "any one character." You usually want this flag on unless you have turned on `ONIG_SYN_OP_VARIABLE_META_CHARACTERS` so that you can use a metacharacter other than `.` instead. ### 2. ONIG_SYN_OP_ASTERISK_ZERO_INF (enable `r*`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Grep, Emacs, PosixExtended, PosixBasic_ Enables support for the standard `r*` metacharacter, meaning "zero or more r's." You usually want this flag set unless you have turned on `ONIG_SYN_OP_VARIABLE_META_CHARACTERS` so that you can use a metacharacter other than `*` instead. ### 3. ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (enable `r\*`) _Set in: none_ Enables support for an escaped `r\*` metacharacter, meaning "zero or more r's." This is useful if you have disabled support for the normal `r*` metacharacter because you want `*` to simply match a literal `*` character, but you still want some way of activating "zero or more" behavior. ### 4. ONIG_SYN_OP_PLUS_ONE_INF (enable `r+`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Emacs, PosixExtended_ Enables support for the standard `r+` metacharacter, meaning "one or more r's." You usually want this flag set unless you have turned on `ONIG_SYN_OP_VARIABLE_META_CHARACTERS` so that you can use a metacharacter other than `+` instead. ### 5. ONIG_SYN_OP_ESC_PLUS_ONE_INF (enable `r\+`) _Set in: Grep_ Enables support for an escaped `r\+` metacharacter, meaning "one or more r's." This is useful if you have disabled support for the normal `r+` metacharacter because you want `+` to simply match a literal `+` character, but you still want some way of activating "one or more" behavior. ### 6. ONIG_SYN_OP_QMARK_ZERO_ONE (enable `r?`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Emacs, PosixExtended_ Enables support for the standard `r?` metacharacter, meaning "zero or one r" or "an optional r." You usually want this flag set unless you have turned on `ONIG_SYN_OP_VARIABLE_META_CHARACTERS` so that you can use a metacharacter other than `?` instead. ### 7. ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (enable `r\?`) _Set in: Grep_ Enables support for an escaped `r\?` metacharacter, meaning "zero or one r" or "an optional r." This is useful if you have disabled support for the normal `r?` metacharacter because you want `?` to simply match a literal `?` character, but you still want some way of activating "optional" behavior. ### 8. ONIG_SYN_OP_BRACE_INTERVAL (enable `r{l,u}`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, PosixExtended_ Enables support for the `r{lower,upper}` range form, common to more advanced regex engines, which lets you specify precisely a minimum and maximum range on how many r's must match (and not simply "zero or more"). This form also allows `r{count}` to specify a precise count of r's that must match. This form also allows `r{lower,}` to be equivalent to `r{lower,infinity}`. If and only if the `ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV` behavior flag is set, this form also allows `r{,upper}` to be equivalent to `r{0,upper}`; otherwise, `r{,upper}` will be treated as an error. ### 9. ONIG_SYN_OP_ESC_BRACE_INTERVAL (enable `\{` and `\}`) _Set in: Grep, Emacs, PosixBasic_ Enables support for an escaped `r\{lower,upper\}` range form. This is useful if you have disabled support for the normal `r{...}` range form and want curly braces to simply match literal curly brace characters, but you still want some way of activating "range" behavior. ### 10. ONIG_SYN_OP_VBAR_ALT (enable `r|s`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, PosixExtended_ Enables support for the common `r|s` alternation operator. You usually want this flag set. ### 11. ONIG_SYN_OP_ESC_VBAR_ALT (enable `\|`) _Set in: Grep, Emacs_ Enables support for an escaped `r\|s` alternation form. This is useful if you have disabled support for the normal `r|s` alternation form and want `|` to simply match a literal `|` character, but you still want some way of activating "alternate" behavior. ### 12. ONIG_SYN_OP_LPAREN_SUBEXP (enable `(r)`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, PosixExtended_ Enables support for the common `(...)` grouping-and-capturing operators. You usually want this flag set. ### 13. ONIG_SYN_OP_ESC_LPAREN_SUBEXP (enable `\(` and `\)`) _Set in: Grep, Emacs, PosixBasic_ Enables support for escaped `\(...\)` grouping-and-capturing operators. This is useful if you have disabled support for the normal `(...)` grouping-and-capturing operators and want parentheses to simply match literal parenthesis characters, but you still want some way of activating "grouping" or "capturing" behavior. ### 14. ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (enable `\A` and `\Z` and `\z`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex_ Enables support for the anchors `\A` (start-of-string), `\Z` (end-of-string or newline-at-end-of-string), and `\z` (end-of-string) escapes. (If the escape metacharacter has been changed from the default of `\`, this option will recognize that metacharacter instead.) ### 15. ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (enable `\G`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex_ Enables support for the special anchor `\G` (start-of-previous-match). (If the escape metacharacter has been changed from the default of `\`, this option will recognize that metacharacter instead.) Note that `OnigRegex`/`regex_t` are not stateful objects, and do _not_ record the location of the previous match. The `\G` flag uses the `start` parameter explicitly passed to `onig_search()` (or `onig_search_with_param()` to determine the "start of the previous match," so if the caller always passes the start of the entire buffer as the function's `start` parameter, then `\G` will behave exactly the same as `\A`. ### 16. ONIG_SYN_OP_DECIMAL_BACKREF (enable `\num`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Grep, Emacs, PosixExtended, PosixBasic_ Enables support for subsequent matches to back references to prior capture groups `(...)` using the common `\num` syntax (like `\3`). If this flag is clear, then a numeric escape like `\3` will either be treated as a literal `3`, or, if `ONIG_SYN_OP_ESC_OCTAL3` is set, will be treated as an octal character code `\3`. You usually want this enabled, and it is enabled by default in every built-in syntax. ### 17. ONIG_SYN_OP_BRACKET_CC (enable `[...]`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Grep, Emacs, PosixExtended, PosixBasic_ Enables support for recognizing character classes, like `[a-z]`. If this flag is not set, `[` and `]` will be treated as ordinary literal characters instead of as metacharacters. You usually want this enabled, and it is enabled by default in every built-in syntax. ### 18. ONIG_SYN_OP_ESC_W_WORD (enable `\w` and `\W`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Grep_ Enables support for the common `\w` and `\W` shorthand forms. These match "word characters," whose meaning varies depending on the encoding being used. In ASCII encoding, `\w` is equivalent to `[A-Za-z0-9_]`. In most other encodings, `\w` matches many more characters, including accented letters, Greek letters, Cyrillic letters, Braille letters and numbers, Runic letters, Hebrew letters, Arabic letters and numerals, Chinese Han ideographs, Japanese Katakana and Hiragana, Korean Hangul, and generally any symbol that could qualify as a phonetic "letter" or counting "number" in any language. (Note that emoji are _not_ considered "word characters.") `\W` always matches the opposite of whatever `\w` matches. ### 19. ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (enable `\<` and `\>`) _Set in: GnuRegex, Grep_ Enables support for the GNU-specific `\<` and `\>` word-boundary metacharacters. These work like the `\b` word-boundary metacharacter, but only match at one end of the word or the other: `\<` only matches at a transition from a non-word character to a word character (i.e., at the start of a word), and `\>` only matches at a transition from a word character to a non-word character (i.e., at the end of a word). Most regex syntaxes do _not_ support these metacharacters. ### 20. ONIG_SYN_OP_ESC_B_WORD_BOUND (enable `\b` and `\B`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Grep_ Enables support for the common `\b` and `\B` word-boundary metacharacters. The `\b` metacharacter matches a zero-width position at a transition from word-characters to non-word-characters, or vice versa. The `\B` metacharacter matches at all positions _not_ matched by `\b`. See details in `ONIG_SYN_OP_ESC_W_WORD` above for an explanation as to which characters are considered "word characters." ### 21. ONIG_SYN_OP_ESC_S_WHITE_SPACE (enable `\s` and `\S`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex_ Enables support for the common `\s` and `\S` whitespace-matching metacharacters. The `\s` metacharacter in ASCII encoding is exactly equivalent to the character class `[\t\n\v\f\r ]`, or characters codes 9 through 13 (inclusive), and 32. The `\s` metacharacter in Unicode is exactly equivalent to the character class `[\t\n\v\f\r \x85\xA0\x1680\x2000-\x200A\x2028-\x2029\x202F\x205F\x3000]` — that is, it matches the same as ASCII, plus U+0085 (next line), U+00A0 (nonbreaking space), U+1680 (Ogham space mark), U+2000 (en quad) through U+200A (hair space) (this range includes several widths of Unicode spaces), U+2028 (line separator) through U+2029 (paragraph separator), U+202F (narrow no-break space), U+205F (medium mathematical space), and U+3000 (CJK ideographic space). All non-Unicode encodings are handled by converting their code points to the appropriate Unicode-equivalent code points, and then matching according to Unicode rules. `\S` always matches any one character that is _not_ in the set matched by `\s`. ### 22. ONIG_SYN_OP_ESC_D_DIGIT (enable `\d` and `\D`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex_ Enables support for the common `\d` and `\D` digit-matching metacharacters. The `\d` metacharacter in ASCII encoding is exactly equivalent to the character class `[0-9]`, or characters codes 48 through 57 (inclusive). The `\d` metacharacter in Unicode matches `[0-9]`, as well as digits in Arabic, Devanagari, Bengali, Laotian, Mongolian, CJK fullwidth numerals, and many more. All non-Unicode encodings are handled by converting their code points to the appropriate Unicode-equivalent code points, and then matching according to Unicode rules. `\D` always matches any one character that is _not_ in the set matched by `\d`. ### 23. ONIG_SYN_OP_LINE_ANCHOR (enable `^r` and `r$`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, Grep, Emacs, PosixExtended, PosixBasic_ Enables support for the common `^` and `$` line-anchor metacharacters. In single-line mode, `^` matches the start of the input buffer, and `$` matches the end of the input buffer. In multi-line mode, `^` matches if the preceding character is `\n`; and `$` matches if the following character is `\n`. (Note that Oniguruma does not recognize other newline types: It only matches `^` and `$` against `\n`: not `\r`, not `\r\n`, not the U+2028 line separator, and not any other form.) ### 24. ONIG_SYN_OP_POSIX_BRACKET (enable POSIX `[:xxxx:]`) _Set in: Oniguruma, Ruby, Perl_NG, Perl, GnuRegex, Grep, PosixExtended, PosixBasic_ Enables support for the POSIX `[:xxxx:]` character classes, like `[:alpha:]` and `[:digit:]`. The supported POSIX character classes are `alnum`, `alpha`, `blank`, `cntrl`, `digit`, `graph`, `lower`, `print`, `punct`, `space`, `upper`, `xdigit`, `ascii`, `word`. ### 25. ONIG_SYN_OP_QMARK_NON_GREEDY (enable `r??`, `r*?`, `r+?`, and `r{n,m}?`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java_ Enables support for lazy (non-greedy) quantifiers: That is, if you append a `?` after another quantifier such as `?`, `*`, `+`, or `{n,m}`, Oniguruma will try to match as _little_ as possible instead of as _much_ as possible. ### 26. ONIG_SYN_OP_ESC_CONTROL_CHARS (enable `\n`, `\r`, `\t`, etc.) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, Emacs, PosixExtended, PosixBasic_ Enables support for C-style control-code escapes, like `\n` and `\r`. Specifically, this recognizes `\a` (7), `\b` (8), `\t` (9), `\n` (10), `\f` (12), `\r` (13), and `\e` (27). If `ONIG_SYN_OP2_ESC_V_VTAB` is enabled (see below), this also enables support for recognizing `\v` as code point 11. ### 27. ONIG_SYN_OP_ESC_C_CONTROL (enable `\cx` control codes) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java_ Enables support for named control-code escapes, like `\cm` or `\cM` for code-point 13. In this shorthand form, control codes may be specified by `\c` (for "Control") followed by an alphabetic letter, a-z or A-Z, indicating which code point to represent (1 through 26). So `\cA` is code point 1, and `\cZ` is code point 26. ### 28. ONIG_SYN_OP_ESC_OCTAL3 (enable `\OOO` octal codes) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java_ Enables support for octal-style escapes of up to three digits, like `\1` for code point 1, and `\177` for code point 127. Octal values greater than 255 will result in an error message. ### 29. ONIG_SYN_OP_ESC_X_HEX2 (enable `\xHH` hex codes) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java_ Enables support for hexadecimal-style escapes of up to two digits, like `\x1` for code point 1, and `\x7F` for code point 127. ### 30. ONIG_SYN_OP_ESC_X_BRACE_HEX8 (enable `\x{7HHHHHHH}` hex codes) _Set in: Oniguruma, Ruby, Perl_NG, Perl_ Enables support for brace-wrapped hexadecimal-style escapes of up to eight digits, like `\x{1}` for code point 1, and `\x{FFFE}` for code point 65534. ### 31. ONIG_SYN_OP_ESC_O_BRACE_OCTAL (enable `\o{1OOOOOOOOOO}` octal codes) _Set in: Oniguruma, Ruby, Perl_NG, Perl_ Enables support for brace-wrapped octal-style escapes of up to eleven digits, like `\o{1}` for code point 1, and `\o{177776}` for code point 65534. (New feature as of Oniguruma 6.3.) ---------- ## Group Two Flags (op2) This group contains support for lesser-known regex syntax constructs. ### 0. ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (enable `\Q...\E`) _Set in: Perl_NG, Perl, Java_ Enables support for "quoted" parts of a pattern: Between `\Q` and `\E`, all syntax parsing is turned off, so that metacharacters like `*` and `+` will no longer be treated as metacharacters, and instead will be matched as literal `*` and `+`, as if they had been escaped with `\*` and `\+`. ### 1. ONIG_SYN_OP2_QMARK_GROUP_EFFECT (enable `(?...)`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, Emacs_ Enables support for the fairly-common `(?...)` grouping operator, which controls precedence but which does _not_ capture its contents. ### 2. ONIG_SYN_OP2_OPTION_PERL (enable options `(?imsx)` and `(?-imsx)`) _Set in: Python, Perl_NG, Perl, Java_ Enables support of regex options. (i,m,s,x) The supported toggle-able options for this flag are: - `i` - Case-insensitivity - `m` - Multi-line mode (`^` and `$` match at `\n` as well as start/end of buffer) - `s` - Single-line mode (`.` can match `\n`) - `x` - Extended pattern (free-formatting: whitespace will ignored) ### 3. ONIG_SYN_OP2_OPTION_RUBY (enable options `(?imx)` and `(?-imx)`) _Set in: Ruby_ Enables support of regex options. (i,m,x) The supported toggle-able options for this flag are: - `i` - Case-insensitivity - `m` - Multi-line mode (`.` can match `\n`) - `x` - Extended pattern (free-formatting: whitespace will ignored) ### 4. ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (enable `r?+`, `r*+`, and `r++`) _Set in: Oniguruma, Ruby, Perl_NG, Perl, Java_ Enables support for the _possessive_ quantifiers `?+`, `*+`, and `++`, which work similarly to `?` and `*` and `+`, respectively, but which do not backtrack after matching: Like the normal greedy quantifiers, they match as much as possible, but they do not attempt to match _less_ than their maximum possible extent if subsequent parts of the pattern fail to match. ### 5. ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (enable `r{n,m}+`) _Set in: Perl_NG, Perl, Java_ Enables support for the _possessive_ quantifier `{n,m}+`, which works similarly to `{n,m}`, but which does not backtrack after matching: Like the normal greedy quantifier, it matches as much as possible, but it do not attempt to match _less_ than its maximum possible extent if subsequent parts of the pattern fail to match. ### 6. ONIG_SYN_OP2_CCLASS_SET_OP (enable `&&` within `[...]`) _Set in: Oniguruma, Ruby, Java_ Enables support for character-class _intersection_. For example, with this feature enabled, you can write `[a-z&&[^aeiou]]` to produce a character class of only consonants, or `[\0-\37&&[^\n\r]]` to produce a character class of all control codes _except_ newlines. ### 7. ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (enable named captures `(?...)`) _Set in: Oniguruma, Ruby, Perl_NG_ Enables support for _naming_ capture groups, so that instead of having to refer to captures by position (like `\3` or `$3`), you can refer to them by names (like `server` and `path`). This supports the Perl/Ruby naming syntaxes `(?...)` and `(?'name'...)`, but not the Python `(?P...)` syntax. ### 8. ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (enable named backreferences `\k`) _Set in: Oniguruma, Ruby, Perl_NG_ Enables support for substituted backreferences by name, not just by position. This supports using `\k'name'` in addition to supporting `\k`. This also supports an Oniguruma-specific extension that lets you specify the _distance_ of the match, if the capture matched multiple times, by writing `\k` or `\k`. ### 9. ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (enable backreferences `\g` and `\g`) _Set in: Oniguruma, Ruby, Perl_NG_ Enables support for substituted backreferences by both name and position using the same syntax. This supports using `\g'name'` and `\g'1'` in addition to supporting `\g` and `\g<1>`. ### 10. ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (enable `(?@...)` and `(?@...)`) _Set in: none_ Enables support for _capture history_, which can answer via the `onig_*capture*()` functions exactly which captures were matched, how many times, and where in the input they were matched, by placing `?@` in front of the capture. Per Oniguruma's regex syntax documentation (appendix A-5): `/(?@a)*/.match("aaa")` ==> `[<0-1>, <1-2>, <2-3>]` This can require substantial memory, is primarily useful for debugging, and is not enabled by default in any syntax. ### 11. ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (enable `\C-x`) _Set in: Oniguruma, Ruby_ Enables support for Ruby legacy control-code escapes, like `\C-m` or `\C-M` for code-point 13. In this shorthand form, control codes may be specified by `\C-` (for "Control") followed by a single character (or equivalent), indicating which code point to represent, based on that character's lowest five bits. So, like `\c`, you can represent code-point 10 with `\C-j`, but you can also represent it with `\C-*` as well. See also `ONIG_SYN_OP_ESC_C_CONTROL`, which enables the more-common `\cx` syntax. ### 12. ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (enable `\M-x`) _Set in: Oniguruma, Ruby_ Enables support for Ruby legacy meta-code escapes. When you write `\M-x`, Oniguruma will match an `x` whose 8th bit is set (i.e., the character code of `x` will be or'ed with `0x80`). So, for example, you can match `\x81` using `\x81`, or you can write `\M-\1`. This is mostly useful when working with legacy 8-bit character encodings. ### 13. ONIG_SYN_OP2_ESC_V_VTAB (enable `\v` as vertical tab) _Set in: Oniguruma, Python, Ruby, Java_ Enables support for a C-style `\v` escape code, meaning "vertical tab." If enabled, `\v` will be equivalent to ASCII code point 11. ### 14. ONIG_SYN_OP2_ESC_U_HEX4 (enable `\uHHHH` for Unicode) _Set in: Oniguruma, Python, Ruby, Java_ Enables support for a Java-style `\uHHHH` escape code for representing Unicode code-points by number, using up to four hexadecimal digits (up to `\uFFFF`). So, for example, `\u221E` will match an infinity symbol, `∞`. For code points larger than four digits, like the emoji `🚡` (aerial tramway, or code point U+1F6A1), you must either represent the character directly using an encoding like UTF-8, or you must enable support for `ONIG_SYN_OP_ESC_X_BRACE_HEX8` or `ONIG_SYN_OP_ESC_O_BRACE_OCTAL`, which support more than four digits. (New feature as of Oniguruma 6.7.) ### 15. ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (enable ``\` `` and `\'` anchors) _Set in: Emacs_ This flag makes the ``\` `` and `\'` escapes function identically to `\A` and `\z`, respectively (when `ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR` is enabled). These anchor forms are very obscure, and rarely supported by other regex libraries. ### 16. ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (enable `\p{...}` and `\P{...}`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java_ Enables support for an alternate syntax for POSIX character classes; instead of writing `[:alpha:]` when this is enabled, you can instead write `\p{alpha}`. See also `ONIG_SYN_OP_POSIX_BRACKET` for the classic POSIX form. ### 17. ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (enable `\p{^...}` and `\P{^...}`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl_ Enables support for an alternate syntax for POSIX character classes; instead of writing `[:^alpha:]` when this is enabled, you can instead write `\p{^alpha}`. See also `ONIG_SYN_OP_POSIX_BRACKET` for the classic POSIX form. ### 18. ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS _(not presently used)_ ### 19. ONIG_SYN_OP2_ESC_H_XDIGIT (enable `\h` and `\H`) _Set in: Oniguruma, Ruby_ Enables support for the Ruby-specific shorthand `\h` and `\H` metacharacters. Somewhat like `\d` matches decimal digits, `\h` matches hexadecimal digits — that is, characters in `[0-9a-fA-F]`. `\H` matches the opposite of whatever `\h` matches. ### 20. ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (disable `\`) _Set in: ASIS_ If set, this disables all escape codes, shorthands, and metacharacters that start with `\` (or whatever the configured escape character is), allowing `\` to be treated as a literal `\`. You usually do not want this flag to be enabled. ### 21. ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE (enable `(?(...)then|else)`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl_ Enables support for conditional inclusion of subsequent regex patterns based on whether a prior named or numbered capture matched, or based on whether a pattern will match. This supports many different forms, including: - `(?()then|else)` - condition based on a capture by name. - `(?('foo')then|else)` - condition based on a capture by name. - `(?(3)then|else)` - condition based on a capture by number. - `(?(+3)then|else)` - forward conditional to a future match, by relative position. - `(?(-3)then|else)` - backward conditional to a prior match, by relative position. - `(?(foo)then|else)` - this matches a pattern `foo`. (foo is any sub-expression) (New feature as of Oniguruma 6.5.) ### 22. ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP (enable `\K`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl_ Enables support for `\K`, which excludes all content before it from the overall regex match (i.e., capture #0). So, for example, pattern `foo\Kbar` would match `foobar`, but capture #0 would only include `bar`. (New feature as of Oniguruma 6.5.) ### 23. ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE (enable `\R`) _Set in: Oniguruma, Ruby, Perl_NG, Perl_ Enables support for `\R`, the "general newline" shorthand, which matches `(\r\n|[\n\v\f\r\u0085\u2028\u2029])` (obviously, the Unicode values are cannot be matched in ASCII encodings). (New feature as of Oniguruma 6.5.) ### 24. ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT (enable `\N` and `\O`) _Set in: Oniguruma, Perl_NG, Perl_ Enables support for `\N` and `\O`. `\N` is "not a line break," which is much like the standard `.` metacharacter, except that while `.` can be affected by the single-line setting, `\N` always matches exactly one character that is not one of the various line-break characters (like `\n` and `\r`). `\O` matches exactly one character, regardless of whether single-line or multi-line mode are enabled or disabled. (New feature as of Oniguruma 6.5.) ### 25. ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP (enable `(?~...)`) _Set in: Oniguruma, Ruby, Perl_NG, Perl_ Enables support for the `(?~r)` "absent operator" syntax, which matches as much as possible as long as the result _doesn't_ match pattern `r`. This is _not_ the same as negative lookahead or negative lookbehind. Among the most useful examples of this is `\/\*(?~\*\/)\*\/`, which matches C-style comments by simply saying "starts with /*, ends with */, and _doesn't_ contain a */ in between." A full explanation of this feature is complicated, but it is useful, and an excellent article about it is [available on Medium](https://medium.com/rubyinside/the-new-absent-operator-in-ruby-s-regular-expressions-7c3ef6cd0b99). (New feature as of Oniguruma 6.5.) ### 26. ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT (enable `\X` and `\Y` and `\y`) _Set in: Oniguruma, Ruby, Perl_NG, Perl_ `\X` is another variation on `.`, designed to support Unicode, in that it matches a full _grapheme cluster_. In Unicode, `à` can be encoded as one code point, `U+00E0`, or as two, `U+0061 U+0300`. If those are further escaped using UTF-8, the former becomes two bytes, and the latter becomes three. Unfortunately, `.` would naively match only one or two bytes, depending on the encoding, and would likely incorrectly match anything from just `a` to a broken half of a code point. `\X` is designed to fix this: It matches the full `à`, no matter how `à` is encoded or decomposed. `\y` matches a cluster boundary, i.e., a zero-width position between graphemes, somewhat like `\b` matches boundaries between words. `\Y` matches the _opposite_ of `\y`, that is, a zero-width position between code points in the _middle_ of a grapheme. (New feature as of Oniguruma 6.6.) ### 27. ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL (enable `(?R)` and `(?&name)`) _Set in: Perl_NG_ Enables support for substituted backreferences by both name and position using Perl-5-specific syntax. This supports using `(?R3)` and `(?&name)` to reference previous (and future) matches, similar to the more-common `\g<3>` and `\g` backreferences. (New feature as of Oniguruma 6.7.) ### 28. ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS (enable `(?{...})`) _Set in: Oniguruma, Perl_NG, Perl_ Enables support for Perl-style "callouts" — pattern substitutions that result from invoking a callback method. When `(?{foo})` is reached in a pattern, the callback function set in `onig_set_progress_callout()` will be invoked, and be able to perform custom computation during the pattern match (and during backtracking). Full documentation for this advanced feature can be found in the Oniguruma `docs/CALLOUT.md` file, with an example in `samples/callout.c`. (New feature as of Oniguruma 6.8.) ### 29. ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME (enable `(*name)`) _Set in: Oniguruma, Python, Perl_NG, Perl_ Enables support for Perl-style "callouts" — pattern substitutions that result from invoking a callback method. When `(*foo)` is reached in a pattern, the callback function set in `onig_set_callout_of_name()` will be invoked, passing the given name `foo` to it, and it can perform custom computation during the pattern match (and during backtracking). Full documentation for this advanced feature can be found in the Oniguruma `docs/CALLOUT.md` file, with an example in `samples/callout.c`. (New feature as of Oniguruma 6.8.) ### 30. ONIG_SYN_OP2_OPTION_ONIGURUMA (enable options `(?imxWSDPy)` and `(?-imxWDSP)`) _Set in: Oniguruma_ Enables support of regex options. (i,m,x,W,S,D,P,y) (New feature as of Oniguruma 6.9.2) - `i` - Case-insensitivity - `m` - Multi-line mode (`.` can match `\n`) - `x` - Extended pattern (free-formatting: whitespace will ignored) - `W` - ASCII only word. - `D` - ASCII only digit. - `S` - ASCII only space. - `P` - ASCII only POSIX properties. (includes W,D,S) ### 31. ONIG_SYN_OP2_QMARK_CAPITAL_P_NAME (enable `(?P...)` and `(?P=name)`) _Set in: Python_ (New feature as of Oniguruma 6.9.7) ---------- ## Syntax Flags (syn) This group contains rules to handle corner cases and constructs that are errors in some syntaxes but not in others. ### 0. ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (independent `?`, `*`, `+`, `{n,m}`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, PosixExtended_ This flag specifies how to handle operators like `?` and `*` when they aren't directly attached to an operand, as in `^*` or `(*)`: Are they an error, are they discarded, or are they taken as literals? If this flag is clear, they are taken as literals; otherwise, the `ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS` flag determines if they are errors or if they are discarded. ### 1. ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (error or ignore independent operators) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, PosixExtended_ If `ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS` is set, this flag controls what happens when independent operators appear in a pattern: If this flag is set, then independent operators produce an error message; if this flag is clear, then independent operators are silently discarded. ### 2. ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (allow `...)...`) _Set in: PosixExtended_ This flag, if set, causes a `)` character without a preceding `(` to be treated as a literal `)`, equivalent to `\)`. If this flag is clear, then an unmatched `)` character will produce an error message. ### 3. ONIG_SYN_ALLOW_INVALID_INTERVAL (allow `{???`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex_ This flag, if set, causes an invalid range, like `foo{bar}` or `foo{}`, to be silently discarded, as if `foo` had been written instead. If clear, an invalid range will produce an error message. ### 4. ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (allow `{,n}` to mean `{0,n}`) _Set in: Oniguruma, Python, Ruby_ If this flag is set, then `r{,n}` will be treated as equivalent to writing `{0,n}`. If this flag is clear, then `r{,n}` will produce an error message. Note that regardless of whether this flag is set or clear, if `ONIG_SYN_OP_BRACE_INTERVAL` is enabled, then `r{n,}` will always be legal: This flag *only* controls the behavior of the opposite form, `r{,n}`. ### 5. ONIG_SYN_STRICT_CHECK_BACKREF (error on invalid backrefs) _Set in: none_ If this flag is set, an invalid backref, like `\1` in a pattern with no captures, will produce an error. If this flag is clear, then an invalid backref will be equivalent to the empty string. No built-in syntax has this flag enabled. ### 6. ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (allow `(?<=a|bc)`) _Set in: Oniguruma, Ruby, Java_ If this flag is set, lookbehind patterns with alternate options may have differing lengths among those options. If this flag is clear, lookbehind patterns with options must have each option have identical length to the other options. Oniguruma can handle either form, but not all regex engines can, so for compatibility, Oniguruma allows you to cause regexes for other regex engines to fail if they might depend on this rule. ### 7. ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (prefer `\k` over `\3`) _Set in: Oniguruma, Ruby, Perl_NG_ If this flag is set on the syntax *and* `ONIG_OPTION_CAPTURE_GROUP` is set when calling Oniguruma, then if a name is used on any capture, all captures must also use names: A single use of a named capture prohibits the use of numbered captures. ### 8. ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (allow `(?)...(?)`) _Set in: Oniguruma, Ruby, Perl_NG_ If this flag is set, multiple capture groups may use the same name. If this flag is clear, then reuse of a name will produce an error message. ### 9. ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (`a{n}?` is equivalent to `(?:a{n})?`) _Set in: Oniguruma, Ruby_ If this flag is set, then intervals of a fixed size will ignore a lazy (non-greedy) `?` quantifier and treat it as an optional match (an ordinary `r?`), since "match as little as possible" is meaningless for a fixed-size interval. If this flag is clear, then `r{n}?` will mean the same as `r{n}`, and the useless `?` will be discarded. ### 10. ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH (`..(?i)..`) _Set in: Python, Perl_NG, Perl, Java_ If this flag is set, then an isolated option doesn't break the branch and affects until the end of the group (or end of the pattern). If this flag is not set, then an isolated option is interpreted as the starting point of a new branch. `/a(?i)b|c/` ==> `/a(?i:b|c)/` ### 11. ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND (`(?<=...a+...)`) _Set in: Oniguruma, Java_ If this flag is set, then a variable length expressions are allowed in look-behind. ### 12. ONIG_SYN_PYTHON (enable `\UHHHHHHHH` for Unicode) _Set in: Python_ (New feature as of Oniguruma 6.9.7) ### 13. ONIG_SYN_WHOLE_OPTIONS (enable options `(?CLI)`) _Set in: Oniguruma_ (New feature as of Oniguruma 6.9.8) ### 14. ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP (enable `\(^abc$\)`) _Set in: Grep, PosixBasic_ (New feature as of Oniguruma 6.9.9) ### 20. ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (add `\n` to `[^...]`) _Set in: Grep_ If this flag is set, all newline characters (like `\n`) will be excluded from a negative character class automatically, as if the pattern had been written as `[^...\n]`. If this flag is clear, negative character classes do not automatically exclude newlines, and only exclude those characters and ranges written in them. ### 21. ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (allow `[...\w...]`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex_ If this flag is set, shorthands like `\w` are allowed to describe characters in character classes. If this flag is clear, shorthands like `\w` are treated as a redundantly-escaped literal `w`. ### 22. ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (silently discard `[z-a]`) _Set in: Grep, Emacs_ If this flag is set, then character ranges like `[z-a]` that are broken or contain no characters will be silently ignored. If this flag is clear, then broken or empty character ranges will produce an error message. ### 23. ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (treat `[0-9-a]` as `[0-9\-a]`) _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, PosixExtended_ If this flag is set, then a trailing `-` after a character range will be taken as a literal `-`, as if it had been escaped as `\-`. If this flag is clear, then a trailing `-` after a character range will produce an error message. ### 24. ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (warn on `[[...]` and `[-x]`) _Set in: Oniguruma, Ruby_ If this flag is set, Oniguruma will be stricter about warning for bad forms in character classes: `[[...]` will produce a warning, but `[\[...]` will not; `[-x]` will produce a warning, but `[\-x]` will not; `[x&&-y]` will produce a warning, while `[x&&\-y]` will not; and so on. If this flag is clear, all of these warnings will be silently discarded. ### 25. ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (warn on `(?:a*)+`) _Set in: Oniguruma, Ruby_ If this flag is set, Oniguruma will warn about nested repeat operators those have no meaning, like `(?:a*)+`. If this flag is clear, Oniguruma will allow the nested repeat operators without warning about them. ### 26. ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC (allow `[a-\x{7fffffff}]`) _Set in: Oniguruma_ If this flag is set, then invalid code points at the end of range in character class are allowed. ### 27. ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC (allow `[\w-%]` to mean `[\w\-%]`) _Set in: Perl_NG, Perl, Java_ (New feature as of Oniguruma 6.9.10) ### 31. ONIG_SYN_CONTEXT_INDEP_ANCHORS _Set in: Oniguruma, Python, Ruby, Perl_NG, Perl, Java, GnuRegex, PosixExtended_ Not currently used, and does nothing. (But still set in several syntaxes for some reason.) ---------- ## Usage tables These tables show which of the built-in syntaxes use which flags and options, for easy comparison between them. ### Group One Flags (op) | ID | Option | Onig | Pythn | Ruby | PeNG | Perl | Java | Gnu | Grep | Emacs | PosEx | PosB | ASIS | | ----- | ------------------------------------------ | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | | 0 | `ONIG_SYN_OP_VARIABLE_META_CHARACTERS` | - | - | - | - | - | - | - | - | - | - | - | - | | 1 | `ONIG_SYN_OP_DOT_ANYCHAR` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | | 2 | `ONIG_SYN_OP_ASTERISK_ZERO_INF` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | | 3 | `ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF` | - | - | - | - | - | - | - | - | - | - | - | - | | 4 | `ONIG_SYN_OP_PLUS_ONE_INF` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | Yes | Yes | - | - | | 5 | `ONIG_SYN_OP_ESC_PLUS_ONE_INF` | - | - | - | - | - | - | - | Yes | - | - | - | - | | 6 | `ONIG_SYN_OP_QMARK_ZERO_ONE` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | Yes | Yes | - | - | | 7 | `ONIG_SYN_OP_ESC_QMARK_ZERO_ONE` | - | - | - | - | - | - | - | Yes | - | - | - | - | | 8 | `ONIG_SYN_OP_BRACE_INTERVAL` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | | 9 | `ONIG_SYN_OP_ESC_BRACE_INTERVAL` | - | - | - | - | - | - | - | Yes | Yes | - | Yes | - | | 10 | `ONIG_SYN_OP_VBAR_ALT` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | | 11 | `ONIG_SYN_OP_ESC_VBAR_ALT` | - | - | - | - | - | - | - | Yes | Yes | - | - | - | | 12 | `ONIG_SYN_OP_LPAREN_SUBEXP` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | | 13 | `ONIG_SYN_OP_ESC_LPAREN_SUBEXP` | - | - | - | - | - | - | - | Yes | Yes | - | Yes | - | | 14 | `ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | | 15 | `ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | | 16 | `ONIG_SYN_OP_DECIMAL_BACKREF` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | | 17 | `ONIG_SYN_OP_BRACKET_CC` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | | 18 | `ONIG_SYN_OP_ESC_W_WORD` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | | 19 | `ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END` | - | - | - | - | - | - | Yes | Yes | - | - | - | - | | 20 | `ONIG_SYN_OP_ESC_B_WORD_BOUND` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | | 21 | `ONIG_SYN_OP_ESC_S_WHITE_SPACE` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | | 22 | `ONIG_SYN_OP_ESC_D_DIGIT` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | | 23 | `ONIG_SYN_OP_LINE_ANCHOR` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | | 24 | `ONIG_SYN_OP_POSIX_BRACKET` | Yes | - | Yes | Yes | Yes | - | Yes | Yes | - | Yes | Yes | - | | 25 | `ONIG_SYN_OP_QMARK_NON_GREEDY` | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | | 26 | `ONIG_SYN_OP_ESC_CONTROL_CHARS` | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | Yes | Yes | - | | 27 | `ONIG_SYN_OP_ESC_C_CONTROL` | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | | 28 | `ONIG_SYN_OP_ESC_OCTAL3` | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | | 29 | `ONIG_SYN_OP_ESC_X_HEX2` | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | | 30 | `ONIG_SYN_OP_ESC_X_BRACE_HEX8` | Yes | - | Yes | Yes | Yes | - | - | - | - | - | - | - | | 31 | `ONIG_SYN_OP_ESC_O_BRACE_OCTAL` | Yes | - | Yes | Yes | Yes | - | - | - | - | - | - | - | ### Group Two Flags (op2) | ID | Option | Onig | Pythn | Ruby | PeNG | Perl | Java | Gnu | Grep | Emacs | PosEx | PosB | ASIS | | ----- | ---------------------------------------------- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | | 0 | `ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE` | - | - | - | Yes | Yes | Yes | - | - | - | - | - | - | | 1 | `ONIG_SYN_OP2_QMARK_GROUP_EFFECT` | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | - | | 2 | `ONIG_SYN_OP2_OPTION_PERL` | - | Yes | - | Yes | Yes | Yes | - | - | - | - | - | - | | 3 | `ONIG_SYN_OP2_OPTION_RUBY` | - | - | Yes | - | - | - | - | - | - | - | - | - | | 4 | `ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT` | Yes | - | Yes | Yes | Yes | Yes | - | - | - | - | - | - | | 5 | `ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL` | - | - | - | Yes | Yes | Yes | - | - | - | - | - | - | | 6 | `ONIG_SYN_OP2_CCLASS_SET_OP` | Yes | - | Yes | - | - | Yes | - | - | - | - | - | - | | 7 | `ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP` | Yes | - | Yes | Yes | - | - | - | - | - | - | - | - | | 8 | `ONIG_SYN_OP2_ESC_K_NAMED_BACKREF` | Yes | - | Yes | Yes | - | - | - | - | - | - | - | - | | 9 | `ONIG_SYN_OP2_ESC_G_SUBEXP_CALL` | Yes | - | Yes | Yes | - | - | - | - | - | - | - | - | | 10 | `ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY` | - | - | - | - | - | - | - | - | - | - | - | - | | 11 | `ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL` | Yes | - | Yes | - | - | - | - | - | - | - | - | - | | 12 | `ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META` | Yes | - | Yes | - | - | - | - | - | - | - | - | - | | 13 | `ONIG_SYN_OP2_ESC_V_VTAB` | Yes | Yes | Yes | - | - | Yes | - | - | - | - | - | - | | 14 | `ONIG_SYN_OP2_ESC_U_HEX4` | Yes | Yes | Yes | - | - | Yes | - | - | - | - | - | - | | 15 | `ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR` | - | - | - | - | - | - | - | - | Yes | - | - | - | | 16 | `ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY` | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | | 17 | `ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT` | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | - | | 19 | `ONIG_SYN_OP2_ESC_H_XDIGIT` | Yes | - | Yes | - | - | - | - | - | - | - | - | - | | 20 | `ONIG_SYN_OP2_INEFFECTIVE_ESCAPE` | - | - | - | - | - | - | - | - | - | - | - | Yes | | 21 | `ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE` | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | - | | 22 | `ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP` | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | - | - | | 23 | `ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE` | Yes | - | Yes | Yes | Yes | - | - | - | - | - | - | - | | 24 | `ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT` | Yes | - | - | Yes | Yes | - | - | - | - | - | - | - | | 25 | `ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP` | Yes | - | Yes | Yes | Yes | - | - | - | - | - | - | - | | 26 | `ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT` | Yes | - | Yes | Yes | Yes | - | - | - | - | - | - | - | | 27 | `ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL` | - | - | - | Yes | - | - | - | - | - | - | - | - | | 28 | `ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS` | Yes | - | - | Yes | Yes | - | - | - | - | - | - | - | | 29 | `ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME` | Yes | Yes | - | Yes | Yes | - | - | - | - | - | - | - | | 30 | `ONIG_SYN_OP2_OPTION_ONIGURUMA` | Yes | - | - | - | - | - | - | - | - | - | - | - | | 31 | `ONIG_SYN_OP2_QMARK_CAPITAL_P_NAME` | - | Yes | - | - | - | - | - | - | - | - | - | - | ### Syntax Flags (syn) | ID | Option | Onig | Pythn | Ruby | PeNG | Perl | Java | Gnu | Grep | Emacs | PosEx | PosB | ASIS | | ----- | ---------------------------------------------------- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | | 0 | `ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | | 1 | `ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | | 2 | `ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP` | - | - | - | - | - | - | - | - | - | Yes | - | - | | 3 | `ONIG_SYN_ALLOW_INVALID_INTERVAL` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | | 4 | `ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV` | Yes | Yes | Yes | - | - | - | - | - | - | - | - | - | | 5 | `ONIG_SYN_STRICT_CHECK_BACKREF` | - | - | - | - | - | - | - | - | - | - | - | - | | 6 | `ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND` | Yes | - | Yes | - | - | Yes | - | - | - | - | - | - | | 7 | `ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP` | Yes | - | Yes | Yes | - | - | - | - | - | - | - | - | | 8 | `ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME` | Yes | - | Yes | Yes | - | - | - | - | - | - | - | - | | 9 | `ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY` | Yes | - | Yes | - | - | - | - | - | - | - | - | - | | 10 | `ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH` | - | Yes | - | Yes | Yes | Yes | - | - | - | - | - | - | | 11 | `ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND` | Yes | - | - | - | - | Yes | - | - | - | - | - | - | | 12 | `ONIG_SYN_PYTHON` | - | Yes | - | - | - | - | - | - | - | - | - | - | | 13 | `ONIG_SYN_WHOLE_OPTIONS` | Yes | - | - | - | - | - | - | - | - | - | - | - | | 14 | `ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP` | - | - | - | - | - | - | - | Yes | - | - | Yes | - | | 20 | `ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC` | - | - | - | - | - | - | - | Yes | - | - | - | - | | 21 | `ONIG_SYN_BACKSLASH_ESCAPE_IN_CC` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | - | - | - | | 22 | `ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC` | - | - | - | - | - | - | - | Yes | Yes | - | - | - | | 23 | `ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | | 24 | `ONIG_SYN_WARN_CC_OP_NOT_ESCAPED` | Yes | - | Yes | - | - | - | - | - | - | - | - | - | | 25 | `ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT` | Yes | - | Yes | - | - | - | - | - | - | - | - | - | | 26 | `ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC` | Yes | - | - | - | - | - | - | - | - | - | - | - | | 27 | `ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC` | - | - | - | Yes | Yes | Yes | - | - | - | - | - | - | | 31 | `ONIG_SYN_CONTEXT_INDEP_ANCHORS` | Yes | Yes | Yes | Yes | Yes | Yes | Yes | - | - | Yes | - | - | jq-1.8.2/vendor/oniguruma/doc/API0000644000175100017510000010113515215513537012233 Oniguruma API Version 6.9.10 2024/06/26 #include # int onig_initialize(OnigEncoding use_encodings[], int num_encodings) Initialize library. You have to call it explicitly. * onig_init() is deprecated. arguments 1 use_encodings: array of encodings used in application. 2 num_encodings: number of encodings. return value normal: ONIG_NORMAL == 0 error: error code < 0 # int onig_error_code_to_str(UChar* err_buf, int err_code, ...) Get error message string. If this function is used for onig_new(), don't call this after the pattern argument of onig_new() is freed. return value normal: error message string length arguments 1 err_buf: error message string buffer. (required size: ONIG_MAX_ERROR_MESSAGE_LEN) 2 err_code: error code returned by other API functions. 3 err_info (optional): error info returned by onig_new(). # void onig_set_warn_func(OnigWarnFunc func) Set warning function. WARNING: '[', '-', ']' in character class without escape. ']' in pattern without escape. arguments 1 func: function pointer. void (*func)(char* warning_message) # void onig_set_verb_warn_func(OnigWarnFunc func) Set verbose warning function. WARNING: redundant nested repeat operator. arguments 1 func: function pointer. void (*func)(char* warning_message) # int onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* err_info) Create a regex object. return value normal: ONIG_NORMAL == 0 error: error code < 0 arguments 1 reg: return regex object's address. 2 pattern: regex pattern string. 3 pattern_end: terminate address of pattern. (pattern + pattern length) 4 option: compile time options. ONIG_OPTION_NONE no option ONIG_OPTION_SINGLELINE '^' -> '\A', '$' -> '\Z' ONIG_OPTION_MULTILINE '.' match with newline ONIG_OPTION_IGNORECASE ambiguity match on ONIG_OPTION_EXTEND extended pattern form ONIG_OPTION_FIND_LONGEST find longest match ONIG_OPTION_FIND_NOT_EMPTY ignore empty match ONIG_OPTION_NEGATE_SINGLELINE clear ONIG_OPTION_SINGLELINE which is enabled on ONIG_SYNTAX_POSIX_BASIC/POSIX_EXTENDED/PERL/PERL_NG/PYTHON/JAVA ONIG_OPTION_DONT_CAPTURE_GROUP only named group captured. ONIG_OPTION_CAPTURE_GROUP named and no-named group captured. ONIG_OPTION_IGNORECASE_IS_ASCII Limit IGNORECASE((?i)) to a range of ASCII characters ONIG_OPTION_WORD_IS_ASCII ASCII only word (\w, \p{Word}, [[:word:]]) ASCII only word bound (\b) ONIG_OPTION_DIGIT_IS_ASCII ASCII only digit (\d, \p{Digit}, [[:digit:]]) ONIG_OPTION_SPACE_IS_ASCII ASCII only space (\s, \p{Space}, [[:space:]]) ONIG_OPTION_POSIX_IS_ASCII ASCII only POSIX properties (includes word, digit, space) (alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit, word) ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER Extended Grapheme Cluster mode ONIG_OPTION_TEXT_SEGMENT_WORD Word mode * The ONIG_OPTION_FIND_LONGEST option doesn't work properly during backward search of onig_search(). 5 enc: character encoding. ONIG_ENCODING_ASCII ASCII ONIG_ENCODING_ISO_8859_1 ISO 8859-1 ONIG_ENCODING_ISO_8859_2 ISO 8859-2 ONIG_ENCODING_ISO_8859_3 ISO 8859-3 ONIG_ENCODING_ISO_8859_4 ISO 8859-4 ONIG_ENCODING_ISO_8859_5 ISO 8859-5 ONIG_ENCODING_ISO_8859_6 ISO 8859-6 ONIG_ENCODING_ISO_8859_7 ISO 8859-7 ONIG_ENCODING_ISO_8859_8 ISO 8859-8 ONIG_ENCODING_ISO_8859_9 ISO 8859-9 ONIG_ENCODING_ISO_8859_10 ISO 8859-10 ONIG_ENCODING_ISO_8859_11 ISO 8859-11 ONIG_ENCODING_ISO_8859_13 ISO 8859-13 ONIG_ENCODING_ISO_8859_14 ISO 8859-14 ONIG_ENCODING_ISO_8859_15 ISO 8859-15 ONIG_ENCODING_ISO_8859_16 ISO 8859-16 ONIG_ENCODING_UTF8 UTF-8 ONIG_ENCODING_UTF16_BE UTF-16BE ONIG_ENCODING_UTF16_LE UTF-16LE ONIG_ENCODING_UTF32_BE UTF-32BE ONIG_ENCODING_UTF32_LE UTF-32LE ONIG_ENCODING_EUC_JP EUC-JP ONIG_ENCODING_EUC_TW EUC-TW ONIG_ENCODING_EUC_KR EUC-KR ONIG_ENCODING_EUC_CN EUC-CN ONIG_ENCODING_SJIS Shift_JIS ONIG_ENCODING_KOI8_R KOI8-R ONIG_ENCODING_CP1251 CP1251 ONIG_ENCODING_BIG5 Big5 ONIG_ENCODING_GB18030 GB18030 or any OnigEncodingType data address defined by user. 6 syntax: address of pattern syntax definition. ONIG_SYNTAX_ASIS plain text ONIG_SYNTAX_POSIX_BASIC POSIX Basic RE ONIG_SYNTAX_POSIX_EXTENDED POSIX Extended RE ONIG_SYNTAX_EMACS Emacs ONIG_SYNTAX_GREP grep ONIG_SYNTAX_GNU_REGEX GNU regex ONIG_SYNTAX_JAVA Java (Sun java.util.regex) ONIG_SYNTAX_PERL Perl ONIG_SYNTAX_PERL_NG Perl + named group ONIG_SYNTAX_PYTHON Python ONIG_SYNTAX_ONIGURUMA Oniguruma ONIG_SYNTAX_DEFAULT default (== ONIG_SYNTAX_ONIGURUMA) onig_set_default_syntax() or any OnigSyntaxType data address defined by user. 7 err_info: address for return optional error info. Use this value as 3rd argument of onig_error_code_to_str(). # int onig_new_without_alloc(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* err_info) Create a regex object. reg object area is not allocated in this function. return value normal: ONIG_NORMAL == 0 error: error code < 0 # int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo) This function is deprecated, and it does not allow the case where the encoding of pattern and target is different. Create a regex object. This function is deluxe version of onig_new(). return value normal: ONIG_NORMAL == 0 error: error code < 0 arguments 1 reg: return address of regex object. 2 pattern: regex pattern string. 3 pattern_end: terminate address of pattern. (pattern + pattern length) 4 ci: compile time info. ci->num_of_elements: number of elements in ci. (current version: 5) ci->pattern_enc: pattern string character encoding. ci->target_enc: target string character encoding. ci->syntax: address of pattern syntax definition. ci->option: compile time option. ci->case_fold_flag: character matching case fold bit flag for ONIG_OPTION_IGNORECASE mode. ONIGENC_CASE_FOLD_MIN: minimum ONIGENC_CASE_FOLD_DEFAULT: minimum onig_set_default_case_fold_flag() 5 err_info: address for return optional error info. Use this value as 3rd argument of onig_error_code_to_str(). Different character encoding combination is allowed for the following cases only. pattern_enc: ASCII, ISO_8859_1 target_enc: UTF16_BE, UTF16_LE, UTF32_BE, UTF32_LE pattern_enc: UTF16_BE/LE target_enc: UTF16_LE/BE pattern_enc: UTF32_BE/LE target_enc: UTF32_LE/BE # void onig_free(regex_t* reg) Free memory used by regex object. arguments 1 reg: regex object. # void onig_free_body(regex_t* reg) Free memory used by regex object. (Except reg oneself.) arguments 1 reg: regex object. # OnigMatchParam* onig_new_match_param() Allocate a OnigMatchParam object and initialize the contents by onig_initialize_match_param(). # void onig_free_match_param(OnigMatchParam* mp) Free memory used by a OnigMatchParam object. arguments 1 mp: OnigMatchParam object # void onig_initialize_match_param(OnigMatchParam* mp) Set match-param fields to default values. Match-param is used in onig_match_with_param() and onig_search_with_param(). arguments 1 mp: match-param pointer # int onig_set_match_stack_limit_size_of_match_param(OnigMatchParam* mp, unsigned int limit) Set a maximum number of match-stack depth. 0 means unlimited. arguments 1 mp: match-param pointer 2 limit: number of limit normal return: ONIG_NORMAL # int onig_set_retry_limit_in_match_of_match_param(OnigMatchParam* mp, unsigned long limit) Set a retry limit count of a match process. 0 means unlimited. arguments 1 mp: match-param pointer 2 limit: number of limit normal return: ONIG_NORMAL # int onig_set_retry_limit_in_search_of_match_param(OnigMatchParam* mp, unsigned long limit) Set a retry limit count of a search process. 0 means unlimited. arguments 1 mp: match-param pointer 2 limit: number of limit normal return: ONIG_NORMAL # int onig_set_progress_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) Set a function for callouts of contents in progress. If 0 (NULL) is set, never called in progress. arguments 1 mp: match-param pointer 2 f: function normal return: ONIG_NORMAL # int onig_set_retraction_callout_of_match_param(OnigMatchParam* mp, OnigCalloutFunc f) Set a function for callouts of contents in retraction (backtrack). If 0 (NULL) is set, never called in retraction. arguments 1 mp: match-param pointer 2 f: function normal return: ONIG_NORMAL # int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option) Search string and return search result and matching region. Do not pass invalid byte string in the regex character encoding. return value normal: match position offset (i.e. p - str >= 0) not found: ONIG_MISMATCH (< 0) error: error code (< 0) * If option ONIG_OPTION_CALLBACK_EACH_MATCH is used, it will return ONIG_MISMATCH even if there is a match. arguments 1 reg: regex object 2 str: target string 3 end: terminate address of target string 4 start: search start address of target string 5 range: search terminate address of target string in forward search (start <= searched string < range) in backward search (range <= searched string <= start) 6 region: address for return group match range info (NULL is allowed) 7 option: search time option ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A) ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z) ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G) ONIG_OPTION_CALLBACK_EACH_MATCH Call back for all successful matches. (including the case of the same matching start position) The search does not stop when a match is found at a certain position. The callback function to be called is set by onig_set_callback_each_match(). The user_data in the argument passed to the callback function is specified by onig_set_callout_user_data_of_match_param(mp, user_data). Therefore, if you want to specify user_data, use onig_search_with_param() instead of onig_search(). The user_data specified by onig_set_callout_user_data_of_match_param() will be shared with callout. ONIG_OPTION_MATCH_WHOLE_STRING Try to match the whole of (str), rather than returning after the first match is found. # int onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp) Search string and return search result and matching region. Do not pass invalid byte string in the regex character encoding. arguments 1-7: same as onig_search() 8 mp: match parameter values (match_stack_limit, retry_limit_in_match, retry_limit_in_search) # int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option) Match string and return result and matching region. Do not pass invalid byte string in the regex character encoding. return value normal: match length (>= 0) not match: ONIG_MISMATCH (< 0) error: error code (< 0) * If option ONIG_OPTION_CALLBACK_EACH_MATCH is used, it will return ONIG_MISMATCH even if there is a match. arguments 1 reg: regex object 2 str: target string 3 end: terminate address of target string 4 at: match address of target string 5 region: address for return group match range info (NULL is allowed) 6 option: search time option ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A) ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z) ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G) ONIG_OPTION_CALLBACK_EACH_MATCH Call back for all successful matches. ONIG_OPTION_MATCH_WHOLE_STRING Try to match the whole of (str), rather than returning after the first match is found. # int onig_match_with_param(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp) Match string and return result and matching region. Do not pass invalid byte string in the regex character encoding. arguments 1-6: same as onig_match() 7 mp: match parameter values (match_stack_limit, retry_limit_in_match, retry_limit_in_search) # int onig_scan(regex_t* reg, const UChar* str, const UChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), void* callback_arg) Scan string and callback with matching region. Do not pass invalid byte string in the regex character encoding. return value normal: number of matching times error: error code interruption: return value of callback function (!= 0) arguments 1 reg: regex object 2 str: target string 3 end: terminate address of target string 4 region: address for return group match range info (NULL is allowed) 5 option: search time option 6 scan_callback: callback function (defined by user) 7 callback_arg: optional argument passed to callback # int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[]) Create a regset object. All regex objects must have the same character encoding. All regex objects are prohibited from having the ONIG_OPTION_FIND_LONGEST option. arguments 1 rset: return address of regset object 2 n: number of regex in regs 3 regs: array of regex return value normal: ONIG_NORMAL == 0 error: error code < 0 # int onig_regset_add(OnigRegSet* set, regex_t* reg) Add a regex into regset. The regex object must have the same character encoding with the regset. The regex object is prohibited from having the ONIG_OPTION_FIND_LONGEST option. arguments 1 set: regset object 2 reg: regex object return value normal: ONIG_NORMAL == 0 error: error code < 0 # int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg) Replace a regex in regset with another one. If the reg argument value is NULL, then remove at-th regex. (and indexes of other regexes are changed) arguments 1 set: regset object 2 at: index of regex (zero origin) 3 reg: regex object return value normal: ONIG_NORMAL == 0 error: error code < 0 # void onig_regset_free(OnigRegSet* set) Free memory used by regset object and regex objects in the regset. If the same regex object is registered twice, the situation becomes destructive. arguments 1 set: regset object # int onig_regset_number_of_regex(OnigRegSet* set) Returns number of regex objects in the regset. arguments 1 set: regset object # regex_t* onig_regset_get_regex(OnigRegSet* set, int at) Returns the regex object corresponding to the at-th regex. arguments 1 set: regset object 2 at: index of regex array (zero origin) # OnigRegion* onig_regset_get_region(OnigRegSet* set, int at) Returns the region object corresponding to the at-th regex. arguments 1 set: regset object 2 at: index of regex array (zero origin) # int onig_regset_search(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos) Perform a search with regset. return value: normal: index of match regex (zero origin) not found: ONIG_MISMATCH (< 0) error: error code (< 0) arguments 1 set: regset object 2 str: target string 3 end: terminate address of target string 4 start: search start address of target string 5 range: search terminate address of target string 6 lead: outer loop element ONIG_REGSET_POSITION_LEAD (returns most left position) ONIG_REGSET_REGEX_LEAD (returns most left position) ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex) 7 option: search time option ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A) ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z) ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G) 8 rmatch_pos: return address of match position (match_address - str) * ONIG_REGSET_POSITION_LEAD and ONIG_REGSET_REGEX_LEAD return the same result. These differences only appear in search time. In most cases, ONIG_REGSET_POSITION_LEAD seems to be faster. # int onig_regset_search_with_param(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos) Perform a search with regset and match-params. return value: normal: index of match regex (zero origin) not found: ONIG_MISMATCH (< 0) error: error code (< 0) arguments 1 set: regset object 2 str: target string 3 end: terminate address of target string 4 start: search start address of target string 5 range: search terminate address of target string 6 lead: outer loop element ONIG_REGSET_POSITION_LEAD (returns most left position) ONIG_REGSET_REGEX_LEAD (returns most left position) ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex) 7 option: search time option ONIG_OPTION_NOTBOL Do not regard the beginning of the (str) as the beginning of the line and the beginning of the string ONIG_OPTION_NOTEOL Do not regard the (end) as the end of a line and the end of a string ONIG_OPTION_NOT_BEGIN_STRING Do not regard the beginning of the (str) as the beginning of a string (* fail \A) ONIG_OPTION_NOT_END_STRING Do not regard the (end) as a string endpoint (* fail \z, \Z) ONIG_OPTION_NOT_BEGIN_POSITION Do not regard the (start) as start position of search (* fail \G) 8 mps: array of match-params 9 rmatch_pos: return address of match position (match_address - str) # OnigRegion* onig_region_new(void) Create a region. # void onig_region_free(OnigRegion* region, int free_self) Free memory used by region. arguments 1 region: target region 2 free_self: [1: free all, 0: free memory used in region but not self] # void onig_region_copy(OnigRegion* to, OnigRegion* from) Copy contents of region. arguments 1 to: target region 2 from: source region # void onig_region_clear(OnigRegion* region) Clear contents of region. arguments 1 region: target region # int onig_region_resize(OnigRegion* region, int n) Resize group range area of region. return value normal: ONIG_NORMAL == 0 error: error code < 0 arguments 1 region: target region 2 n: new size # int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end, int** num_list) Return the group number list of the name. Named subexp is defined by (?....). return value normal: number of groups for the name. (ex. /(?..)(?..)/ ==> 2) name not found: ONIGERR_UNDEFINED_NAME_REFERENCE arguments 1 reg: regex object. 2 name: group name. 3 name_end: terminate address of group name. 4 num_list: return list of group number. # int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end, OnigRegion *region) Return the group number corresponding to the named backref (\k). If two or more regions for the groups of the name are effective, the greatest number in it is obtained. return value normal: group number error: error code < 0 arguments 1 reg: regex object. 2 name: group name. 3 name_end: terminate address of group name. 4 region: search/match result region. # int onig_foreach_name(regex_t* reg, int (*func)(const UChar*, const UChar*, int,int*,regex_t*,void*), void* arg) Iterate function call for all names. return value normal: 0 error: return value of callback function arguments 1 reg: regex object. 2 func: callback function. func(name, name_end, , , reg, arg); if func does not return 0, then iteration is stopped. 3 arg: argument for func. # int onig_number_of_names(regex_t* reg) Return the number of names defined in the pattern. Multiple definitions of one name is counted as one. arguments 1 reg: regex object. # OnigEncoding onig_get_encoding(regex_t* reg) # OnigOptionType onig_get_options(regex_t* reg) # OnigSyntaxType* onig_get_syntax(regex_t* reg) Return a value of the regex object. arguments 1 reg: regex object. # OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg) Return the case_fold_flag of the regex object. This function is deprecated. arguments 1 reg: regex object. # int onig_number_of_captures(regex_t* reg) Return the number of capture group in the pattern. arguments 1 reg: regex object. # OnigCallbackEachMatchFunc onig_get_callback_each_match(void) Return the current callback function for ONIG_OPTION_CALLBACK_EACH_MATCH. # int onig_set_callback_each_match(OnigCallbackEachMatchFunc func) Set the callback function for ONIG_OPTION_CALLBACK_EACH_MATCH. If NULL is set, the callback will never be executed. return value normal: 0 arguments 1 func: callback function # int onig_number_of_capture_histories(regex_t* reg) Return the number of capture history defined in the pattern. You can't use capture history if ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY is disabled in the pattern syntax.(disabled in the default syntax) arguments 1 reg: regex object. # OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region) Return the root node of capture history data tree. This value is undefined if matching has failed. arguments 1 region: matching result. # int onig_capture_tree_traverse(OnigRegion* region, int at, int(*func)(int,int,int,int,int,void*), void* arg) Traverse and callback in capture history data tree. return value normal: 0 error: return value of callback function arguments 1 region: match region data. 2 at: callback position. ONIG_TRAVERSE_CALLBACK_AT_FIRST: callback first, then traverse children. ONIG_TRAVERSE_CALLBACK_AT_LAST: traverse children first, then callback. ONIG_TRAVERSE_CALLBACK_AT_BOTH: callback first, then traverse children, and at last callback again. 3 func: callback function. if func does not return 0, then traverse is stopped. int func(int group, int beg, int end, int level, int at, void* arg) group: group number beg: capture start position end: capture end position level: nest level (from 0) at: callback position ONIG_TRAVERSE_CALLBACK_AT_FIRST ONIG_TRAVERSE_CALLBACK_AT_LAST arg: optional callback argument 4 arg; optional callback argument. # int onig_noname_group_capture_is_active(regex_t* reg) Return noname group capture activity. return value active: 1 inactive: 0 arguments 1 reg: regex object. if option ONIG_OPTION_DONT_CAPTURE_GROUP == ON --> inactive if the regex pattern have named group and syntax ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP == ON and option ONIG_OPTION_CAPTURE_GROUP == OFF --> inactive else --> active # UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s) Return previous character head address. arguments 1 enc: character encoding 2 start: string address 3 s: target address of string # UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s) Return left-adjusted head address of a character. arguments 1 enc: character encoding 2 start: string address 3 s: target address of string # UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc, const UChar* start, const UChar* s) Return right-adjusted head address of a character. arguments 1 enc: character encoding 2 start: string address 3 s: target address of string # int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end) Return number of characters in the string. # int onigenc_strlen_null(OnigEncoding enc, const UChar* s) Return number of characters in the string. Do not pass invalid byte string in the character encoding. # int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s) Return number of bytes in the string. Do not pass invalid byte string in the character encoding. # int onig_set_default_syntax(OnigSyntaxType* syntax) Set default syntax. arguments 1 syntax: address of pattern syntax definition. # void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from) Copy syntax. arguments 1 to: destination address. 2 from: source address. # unsigned int onig_get_syntax_op(OnigSyntaxType* syntax) # unsigned int onig_get_syntax_op2(OnigSyntaxType* syntax) # unsigned int onig_get_syntax_behavior(OnigSyntaxType* syntax) # OnigOptionType onig_get_syntax_options(OnigSyntaxType* syntax) # void onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op) # void onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2) # void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior) # void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options) Get/Set elements of the syntax. arguments 1 syntax: syntax 2 op, op2, behavior, options: value of element. # void onig_copy_encoding(OnigEncoding to, OnigEncoding from) Copy encoding. arguments 1 to: destination address. 2 from: source address. # int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code) Set a variable meta character to the code point value. Except for an escape character, this meta characters specification is not work, if ONIG_SYN_OP_VARIABLE_META_CHARACTERS is not effective by the syntax. (Build-in syntaxes are not effective.) normal return: ONIG_NORMAL arguments 1 syntax: target syntax 2 what: specifies which meta character it is. ONIG_META_CHAR_ESCAPE ONIG_META_CHAR_ANYCHAR ONIG_META_CHAR_ANYTIME ONIG_META_CHAR_ZERO_OR_ONE_TIME ONIG_META_CHAR_ONE_OR_MORE_TIME ONIG_META_CHAR_ANYCHAR_ANYTIME 3 code: meta character or ONIG_INEFFECTIVE_META_CHAR. # OnigCaseFoldType onig_get_default_case_fold_flag() Get default case fold flag. This function is deprecated. # int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag) Set default case fold flag. This function is deprecated. 1 case_fold_flag: case fold flag # unsigned int onig_get_match_stack_limit_size(void) Return the maximum number of stack size. (default: 0 == unlimited) # int onig_set_match_stack_limit_size(unsigned int size) Set the maximum number of stack size. (size = 0: unlimited) normal return: ONIG_NORMAL # unsigned long onig_get_retry_limit_in_match(void) Return the limit of retry counts in a matching process. (default: 10000000) normal return: current limit value # unsigned long onig_get_retry_limit_in_search(void) Return the limit of retry counts in a search process. 0 means unlimited. (default: 0) normal return: current limit value # int onig_set_retry_limit_in_match(unsigned long limit) Set the limit of retry counts in matching process. 0 means unlimited. normal return: ONIG_NORMAL # int onig_set_retry_limit_in_search(unsigned long limit) Set a retry limit count of a search process. 0 means unlimited. normal return: ONIG_NORMAL # unsigned long onig_get_subexp_call_limit_in_search(void) Return the limit of subexp call count. (default: 0:unlimited) normal return: current limit value # int onig_set_subexp_call_limit_in_search(unsigned long n) Set a limit count of subexp call. normal return: ONIG_NORMAL # int onig_get_subexp_call_max_nest_level(void) Return the limit of subexp call nest level. (default: 24) normal return: current limit value # int onig_set_subexp_call_max_nest_level(int max_level) Set a limit level of subexp call nest level. normal return: ONIG_NORMAL # OnigCalloutFunc onig_get_progress_callout(void) Get a function for callouts of contents in progress. # int onig_set_progress_callout(OnigCalloutFunc f) Set a function for callouts of contents in progress. If 0 (NULL) is set, never called in progress. normal return: ONIG_NORMAL # OnigCalloutFunc onig_get_retraction_callout(void) Get a function for callouts of contents in retraction (backtrack). # int onig_set_retraction_callout(OnigCalloutFunc f) Set a function for callouts of contents in retraction (backtrack). If 0 (NULL) is set, never called in retraction. normal return: ONIG_NORMAL # int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)) Define new Unicode property. (This function is not thread safe.) arguments 1 name: property name (ASCII only. character ' ', '-', '_' are ignored.) 2 ranges: property code point ranges (first element is number of ranges.) [num-of-ranges, 1st-range-start, 1st-range-end, 2nd-range-start... ] * Don't destroy the ranges after having called this function. return value normal: ONIG_NORMAL == 0 error: error code < 0 # unsigned int onig_get_parse_depth_limit(void) Return the maximum depth of parser recursion. (default: DEFAULT_PARSE_DEPTH_LIMIT defined in regint.h. Currently 4096.) # int onig_set_parse_depth_limit(unsigned int depth) Set the maximum depth of parser recursion. (depth = 0: Set to the default value defined in regint.h.) normal return: ONIG_NORMAL # int onig_end(void) The use of this library is finished. normal return: ONIG_NORMAL It is not allowed to use regex objects which created before onig_end() call. # const char* onig_version(void) Return version string. (ex. "5.0.3") // END jq-1.8.2/vendor/oniguruma/doc/onig_syn_md.c0000644000175100017510000004366315215513537014363 /* * onig_syn_md.c * Copyright (c) 2024 K.Kosako * * Oniguruma OWner: K.Kosako https://github.com/kkos/oniguruma * SYNTAX.md : seanofw https://github.com/seanofw * onig_syn_md.c : tonco-miyazawa https://github.com/tonco-miyazawa */ #include #include #include #include "oniguruma.h" #define ONIG_SYN_MD_VERSION_INT (00002) #define TOTAL_NUM_OF_BITS (32) #define PRINT_SEPARATOR (printf("===================================================\n")) #define INPUT_SYNTAX(syn, abb, set_in) { (syn), (#syn), (abb), (set_in) } #define INPUT_FLAG(arg) { (arg), (#arg) } /************************************* Settings *********************************************/ /* NOW_MODE 1: (OP) 2: (OP2) 3: (BEHAVIOR) */ #define NOW_MODE (1) /* #define PRINT_UNDEFINED_FLAG */ /* #define PRINT_SYNTAX_FORWARD_ORDER */ /* #define USE_YOUR_OWN_SYNTAX */ /* #define PRINT_DEBUG_INFO */ #define PRINT_VERSION_INFO #define PRINT_SET_IN_INFO #define PRINT_TABLE_INFO #define WARN_UNDEFINED_FLAG_USED /************************************* Settings *********************************************/ /************************ Switch between OP, OP2, BEHAVIOR **********************************/ #if NOW_MODE == 1 #define SYNTAX_MEMBER_NAME ("op") #define TITLE_STRING ("Group One Flags (op)") #define SYNTAX_MEMBER(syn) ((syn)->op) #define IS_SYNTAX_MEMBER(syn, opm) (((syn)->op & (opm)) != 0) #elif NOW_MODE == 2 #define SYNTAX_MEMBER_NAME ("op2") #define TITLE_STRING ("Group Two Flags (op2)") #define SYNTAX_MEMBER(syn) ((syn)->op2) #define IS_SYNTAX_MEMBER(syn, opm) (((syn)->op2 & (opm)) != 0) #elif NOW_MODE == 3 #define SYNTAX_MEMBER_NAME ("behavior") #define TITLE_STRING ("Syntax Flags (syn)") #define SYNTAX_MEMBER(syn) ((syn)->behavior) #define IS_SYNTAX_MEMBER(syn, opm) (((syn)->behavior & (opm)) != 0) #else #error "Check 'NOW_MODE' value." #endif /************************ Switch between OP, OP2, BEHAVIOR **********************************/ /*********************************** Your own syntax ****************************************/ #ifdef USE_YOUR_OWN_SYNTAX static OnigSyntaxType OnigSyntaxYourOwn; #define ONIG_SYNTAX_YOUROWN (&OnigSyntaxYourOwn) static OnigSyntaxType OnigSyntaxYourOwn = { 0xf0f0f0f0 /* Group One Flags (op) */ , 0xffff0000 /* Group Two Flags (op2) */ , 0x00ff00ff /* Syntax Flags (syn) */ , ONIG_OPTION_NONE , { (OnigCodePoint )'\\' /* esc */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar '.' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anytime '*' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* zero or one time '?' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* one or more time '+' */ , (OnigCodePoint )ONIG_INEFFECTIVE_META_CHAR /* anychar anytime */ } }; #endif /*********************************** Your own syntax ****************************************/ /************************************** syntax data *****************************************/ typedef struct { OnigSyntaxType* syn; char *name; char *abb; char *set_in; } syn_data; static syn_data syn_data_list[] = { /* INPUT_SYNTAX(syn, abb, set_in) ===> { (syn), (#syn), (abb), (set_in) } */ INPUT_SYNTAX( ONIG_SYNTAX_ASIS , "ASIS" , "ASIS" ) , INPUT_SYNTAX( ONIG_SYNTAX_POSIX_BASIC , "PosB" , "PosixBasic" ) , INPUT_SYNTAX( ONIG_SYNTAX_POSIX_EXTENDED , "PosEx", "PosixExtended") , INPUT_SYNTAX( ONIG_SYNTAX_EMACS , "Emacs", "Emacs") , INPUT_SYNTAX( ONIG_SYNTAX_GREP , "Grep" , "Grep" ) , INPUT_SYNTAX( ONIG_SYNTAX_GNU_REGEX , "Gnu" , "GnuRegex" ) , INPUT_SYNTAX( ONIG_SYNTAX_JAVA , "Java" , "Java" ) , INPUT_SYNTAX( ONIG_SYNTAX_PERL , "Perl" , "Perl" ) , INPUT_SYNTAX( ONIG_SYNTAX_PERL_NG , "PeNG" , "Perl_NG" ) , INPUT_SYNTAX( ONIG_SYNTAX_RUBY , "Ruby" , "Ruby" ) , INPUT_SYNTAX( ONIG_SYNTAX_PYTHON , "Pythn", "Python") , INPUT_SYNTAX( ONIG_SYNTAX_ONIGURUMA , "Onig" , "Oniguruma" ) #ifdef USE_YOUR_OWN_SYNTAX , INPUT_SYNTAX( ONIG_SYNTAX_YOUROWN , "Your" , "YourOwn" ) #endif }; static const int num_of_syntax_types = (sizeof syn_data_list /sizeof syn_data_list[0]); static void print_syn_data_list() { int y; PRINT_SEPARATOR; for (y = 0; y < num_of_syntax_types; y++) { printf( "\nsyn_data_list[%d]\n", y); printf( "name='%s'\n" , syn_data_list[y].name); printf( "syn->"); printf( SYNTAX_MEMBER_NAME ); printf( "= 0x%08x\n", SYNTAX_MEMBER(syn_data_list[y].syn) ); printf( "abb='%s'\n" , syn_data_list[y].abb); printf( "set_in='%s'\n" , syn_data_list[y].set_in); }; return ; } /************************************** syntax data *****************************************/ /************************************** flag data *******************************************/ typedef struct { unsigned int num; char *name; } flag_data; /* OP */ #if NOW_MODE == 1 static flag_data flag_data_list[] = { /* The following are no need to sort them in bit order. */ /* INPUT_FLAG(arg) ===> { (arg), (#arg) } */ INPUT_FLAG( ONIG_SYN_OP_VARIABLE_META_CHARACTERS ) , INPUT_FLAG( ONIG_SYN_OP_DOT_ANYCHAR ) , INPUT_FLAG( ONIG_SYN_OP_ASTERISK_ZERO_INF ) , INPUT_FLAG( ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF ) , INPUT_FLAG( ONIG_SYN_OP_PLUS_ONE_INF ) , INPUT_FLAG( ONIG_SYN_OP_ESC_PLUS_ONE_INF ) , INPUT_FLAG( ONIG_SYN_OP_QMARK_ZERO_ONE ) , INPUT_FLAG( ONIG_SYN_OP_ESC_QMARK_ZERO_ONE ) , INPUT_FLAG( ONIG_SYN_OP_BRACE_INTERVAL ) , INPUT_FLAG( ONIG_SYN_OP_ESC_BRACE_INTERVAL ) , INPUT_FLAG( ONIG_SYN_OP_VBAR_ALT ) , INPUT_FLAG( ONIG_SYN_OP_ESC_VBAR_ALT ) , INPUT_FLAG( ONIG_SYN_OP_LPAREN_SUBEXP ) , INPUT_FLAG( ONIG_SYN_OP_ESC_LPAREN_SUBEXP ) , INPUT_FLAG( ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR ) , INPUT_FLAG( ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR ) , INPUT_FLAG( ONIG_SYN_OP_DECIMAL_BACKREF ) , INPUT_FLAG( ONIG_SYN_OP_BRACKET_CC ) , INPUT_FLAG( ONIG_SYN_OP_ESC_W_WORD ) , INPUT_FLAG( ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END ) , INPUT_FLAG( ONIG_SYN_OP_ESC_B_WORD_BOUND ) , INPUT_FLAG( ONIG_SYN_OP_ESC_S_WHITE_SPACE ) , INPUT_FLAG( ONIG_SYN_OP_ESC_D_DIGIT ) , INPUT_FLAG( ONIG_SYN_OP_LINE_ANCHOR ) , INPUT_FLAG( ONIG_SYN_OP_POSIX_BRACKET ) , INPUT_FLAG( ONIG_SYN_OP_QMARK_NON_GREEDY ) , INPUT_FLAG( ONIG_SYN_OP_ESC_CONTROL_CHARS ) , INPUT_FLAG( ONIG_SYN_OP_ESC_C_CONTROL ) , INPUT_FLAG( ONIG_SYN_OP_ESC_OCTAL3 ) , INPUT_FLAG( ONIG_SYN_OP_ESC_X_HEX2 ) , INPUT_FLAG( ONIG_SYN_OP_ESC_X_BRACE_HEX8 ) , INPUT_FLAG( ONIG_SYN_OP_ESC_O_BRACE_OCTAL ) }; #endif /* OP2 */ #if NOW_MODE == 2 static flag_data flag_data_list[] = { INPUT_FLAG( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE ) , INPUT_FLAG( ONIG_SYN_OP2_QMARK_GROUP_EFFECT ) , INPUT_FLAG( ONIG_SYN_OP2_OPTION_PERL ) , INPUT_FLAG( ONIG_SYN_OP2_OPTION_RUBY ) , INPUT_FLAG( ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT ) , INPUT_FLAG( ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL ) , INPUT_FLAG( ONIG_SYN_OP2_CCLASS_SET_OP ) , INPUT_FLAG( ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_K_NAMED_BACKREF ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_G_SUBEXP_CALL ) , INPUT_FLAG( ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_V_VTAB ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_U_HEX4 ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT ) /* , INPUT_FLAG( ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS ) */ , INPUT_FLAG( ONIG_SYN_OP2_ESC_H_XDIGIT ) , INPUT_FLAG( ONIG_SYN_OP2_INEFFECTIVE_ESCAPE ) , INPUT_FLAG( ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE ) , INPUT_FLAG( ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT ) , INPUT_FLAG( ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP ) /* , INPUT_FLAG( ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER ) */ /* obsoleted: use next */ , INPUT_FLAG( ONIG_SYN_OP2_ESC_X_Y_TEXT_SEGMENT ) , INPUT_FLAG( ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL ) , INPUT_FLAG( ONIG_SYN_OP2_QMARK_BRACE_CALLOUT_CONTENTS ) , INPUT_FLAG( ONIG_SYN_OP2_ASTERISK_CALLOUT_NAME ) , INPUT_FLAG( ONIG_SYN_OP2_OPTION_ONIGURUMA ) , INPUT_FLAG( ONIG_SYN_OP2_QMARK_CAPITAL_P_NAME ) }; #endif /* BEHAVIOR */ #if NOW_MODE == 3 static flag_data flag_data_list[] = { INPUT_FLAG( ONIG_SYN_CONTEXT_INDEP_ANCHORS ) , INPUT_FLAG( ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS ) , INPUT_FLAG( ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS ) , INPUT_FLAG( ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP ) , INPUT_FLAG( ONIG_SYN_ALLOW_INVALID_INTERVAL ) , INPUT_FLAG( ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV ) , INPUT_FLAG( ONIG_SYN_STRICT_CHECK_BACKREF ) , INPUT_FLAG( ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND ) , INPUT_FLAG( ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP ) , INPUT_FLAG( ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME ) , INPUT_FLAG( ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY ) , INPUT_FLAG( ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH ) , INPUT_FLAG( ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND ) , INPUT_FLAG( ONIG_SYN_PYTHON ) , INPUT_FLAG( ONIG_SYN_WHOLE_OPTIONS ) , INPUT_FLAG( ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP ) /* syntax (behavior) in char class [...] */ , INPUT_FLAG( ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC ) , INPUT_FLAG( ONIG_SYN_BACKSLASH_ESCAPE_IN_CC ) , INPUT_FLAG( ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC ) , INPUT_FLAG( ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC ) , INPUT_FLAG( ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC ) , INPUT_FLAG( ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC ) /* syntax (behavior) warning */ , INPUT_FLAG( ONIG_SYN_WARN_CC_OP_NOT_ESCAPED ) , INPUT_FLAG( ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT ) }; #endif static const int num_of_flags = (sizeof flag_data_list /sizeof flag_data_list[0]); static int flag_name_max_len = 0; static int flag_name_max_len_int() { int i, n, max_len; max_len = 0; for (i = 0; i < num_of_flags; i++) { n = strlen(flag_data_list[i].name); if ( max_len < n ) { max_len = n; } } /* Debug: printf("max_len=%d\n", max_len); */ return max_len; } static int convert_bit_shift_num_to_flag_data_list_element( int bit_shift_num ) { int i; for (i = 0; i < num_of_flags; i++) { if ( flag_data_list[i].num == (1U << bit_shift_num) ){ #ifdef PRINT_DEBUG_INFO printf("(1U << %d) ===> flag_data_list[%d]\n", bit_shift_num, i ); #endif return i; } } #ifdef PRINT_DEBUG_INFO printf("(1U << %d) ===> ( none )\n", bit_shift_num ); #endif /* If not found, returns "-1". This is not Error. */ return -1; } static int convert_num_to_bit_shift_num(unsigned int arg_num){ int x; for (x = 0; x < TOTAL_NUM_OF_BITS; x++) { if ( arg_num == (1U << x) ) { return x; } } /* Error */ printf(" '0x%08x' is not bit flag.\n", __LINE__, arg_num ); exit(-1); return -1; } static int check_flag_data_duplication() { int i, shift_num; unsigned int used_bits = 0; for (i = 0; i < num_of_flags; i++) { if ( (used_bits & flag_data_list[i].num) != 0 ){ shift_num = convert_num_to_bit_shift_num(flag_data_list[i].num); PRINT_SEPARATOR; fprintf(stderr, "\n The following bit has already been used.\n", __LINE__ ); fprintf(stderr, "flag_data_list[%d] : '%s' ", i, flag_data_list[i].name); fprintf(stderr, "(1U << %d)\n", shift_num); #ifndef PRINT_DEBUG_INFO fprintf(stderr, "\nPlease use '#define PRINT_DEBUG_INFO'.\n"); #endif exit(-1); return -1; } used_bits |= flag_data_list[i].num; } return 0; } static void print_flag_data_list() { int i, shift_num; PRINT_SEPARATOR; for (i = 0; i < num_of_flags; i++) { shift_num = convert_num_to_bit_shift_num( flag_data_list[i].num ); printf( "\nflag_data_list[%d]\n", i); printf( "name='%s' " , flag_data_list[i].name); printf( "(1U << %d)\n" , shift_num); printf( "num=0x%08x\n" , flag_data_list[i].num); } return ; } /************************************** flag data *******************************************/ /************************************** print table *****************************************/ static void print_table_head() { int i, y; printf("\n### "); printf( TITLE_STRING ); printf("\n\n| ID | Option"); for (i = 0; i < (flag_name_max_len - 1); i++) { printf(" "); } printf("|"); /* ex. print "PeNG " */ #ifdef PRINT_SYNTAX_FORWARD_ORDER for (y = 0; y < num_of_syntax_types; y++) #else for (y = num_of_syntax_types -1; y > -1; y--) #endif { printf(" %-5.5s |", syn_data_list[y].abb ); } printf("\n| ----- | "); for (i = 0; i < (flag_name_max_len + 4); i++) { printf("-"); } printf(" |"); for (y = 0; y < num_of_syntax_types; y++) { printf(" ----- |"); } printf("\n"); return ; } static void print_table_body_one_line( int shift_num ) { int i, y, elem, name_chars; elem = convert_bit_shift_num_to_flag_data_list_element(shift_num); printf("| %2d | ", shift_num); if (elem < 0){ name_chars = printf(" `( Undefined )`"); /* elem == -1 */ } else { name_chars = printf("`%s`", flag_data_list[elem].name); } for ( i=0; i < (flag_name_max_len - name_chars + 5); i++){ printf(" "); } printf("|"); /* ex. print ' Yes |' */ #ifdef PRINT_SYNTAX_FORWARD_ORDER for (y = 0; y < num_of_syntax_types; y++) #else for (y = num_of_syntax_types -1; y > -1; y--) #endif { if ( IS_SYNTAX_MEMBER(syn_data_list[y].syn, (1U << shift_num)) ) { printf(" Yes |"); } else { printf(" - |"); } } printf("\n"); return ; } static void print_table_body() { int x, elem; for (x = 0; x < TOTAL_NUM_OF_BITS; x++) { elem = convert_bit_shift_num_to_flag_data_list_element( x ); if (elem < 0) { #if !(defined( PRINT_UNDEFINED_FLAG )) continue; #endif } print_table_body_one_line(x); } return ; } /************************************** print table *****************************************/ /************************************* print Set_in *****************************************/ static void print_set_in_one_line(int shift_num) { int y, elem, count; elem = convert_bit_shift_num_to_flag_data_list_element(shift_num); if (elem < 0) { printf("### %d. ( Undefined )\n", shift_num ); /* elem == -1 */ } else { printf("### %d. %s\n", shift_num, flag_data_list[elem].name ); } count = 0; printf("_Set in: "); #ifdef PRINT_SYNTAX_FORWARD_ORDER for (y = 0; y < num_of_syntax_types; y++) #else for (y = num_of_syntax_types -1; y > -1; y--) #endif { if ( IS_SYNTAX_MEMBER(syn_data_list[y].syn, (1U << shift_num)) ) { if (count > 0){ printf(", "); }; printf("%s", syn_data_list[y].set_in); count++; } } /* for y */ if (count==0){ printf("none"); }; printf("_\n\n"); return ; } static void print_set_in() { int x, elem; PRINT_SEPARATOR; printf("The following are 'Set in' for oniguruma/doc/SYNTAX.md\n\n## "); printf( TITLE_STRING ); printf("\n\n"); for (x = 0; x < TOTAL_NUM_OF_BITS; x++) { elem = convert_bit_shift_num_to_flag_data_list_element( x ); if (elem < 0) { #if !(defined( PRINT_UNDEFINED_FLAG )) continue; #endif } print_set_in_one_line(x); } return ; } /************************************* print Set_in *****************************************/ /************************************** main() *****************************************/ static void print_version() { printf( "[ onig_syn_md.c ver.%05d ] ", ONIG_SYN_MD_VERSION_INT ); printf("The loaded oniguruma is '%d.%d.%d'.\n" , ONIGURUMA_VERSION_MAJOR , ONIGURUMA_VERSION_MINOR , ONIGURUMA_VERSION_TEENY ); return ; } static void print_debug() { int x; print_version(); print_syn_data_list(); print_flag_data_list(); check_flag_data_duplication(); /* print: (1U << x) ===> flag_data_list[elem] */ PRINT_SEPARATOR; printf("\nThe following are the array elements that correspond to each bit.\n\n"); for (x = 0; x < TOTAL_NUM_OF_BITS; x++) { convert_bit_shift_num_to_flag_data_list_element(x); } return ; } static void warn_undefined_flag_used() { int x, y, elem; for (x = 0; x < TOTAL_NUM_OF_BITS; x++) { elem = convert_bit_shift_num_to_flag_data_list_element(x); if (elem < 0){ for (y = 0; y < num_of_syntax_types; y++) { if ( IS_SYNTAX_MEMBER( syn_data_list[y].syn, (1U << x) ) ) { PRINT_SEPARATOR; printf("warning: An undefined bit flag is used."); printf(" (1U << %d)\n\n", x); print_set_in_one_line( x ); #ifndef PRINT_UNDEFINED_FLAG printf("Please use '#define PRINT_UNDEFINED_FLAG'.\n"); #endif return ; } } /* for y */ } /* if elem */ } /* for x */ return ; } extern int main(int argc, char* argv[]) { #ifdef PRINT_DEBUG_INFO print_debug(); return 0; #endif #ifdef PRINT_VERSION_INFO print_version(); #endif flag_name_max_len = flag_name_max_len_int(); check_flag_data_duplication(); #ifdef PRINT_SET_IN_INFO print_set_in(); #endif #ifdef PRINT_TABLE_INFO print_table_head(); print_table_body(); #endif #ifdef WARN_UNDEFINED_FLAG_USED warn_undefined_flag_used(); #endif /* test */ /* printf("\n------ test -------\n"); int test_x = 17; print_set_in_one_line( test_x ); print_table_body_one_line( test_x ); printf("--------------------\n"); */ /* To avoid 'gcc -Wall' warnings. */ if (0) { print_debug(); print_version(); print_set_in(); print_table_head(); print_table_body(); warn_undefined_flag_used(); } return 0; } jq-1.8.2/vendor/oniguruma/doc/CALLOUTS.BUILTIN0000644000175100017510000000447315215513537014164 CALLOUTS.BUILTIN 2024/07/04 * FAIL (progress) (*FAIL) Always fail. * MISMATCH (progress) (*MISMATCH) Terminates Match process. Continues Search process. * ERROR (progress) (*ERROR{n::LONG}) Terminates Search/Match process. Return value is the argument 'n'. (The value must be less than -1) 'n' is an optional argument. (default value is ONIG_ABORT) * MAX (progress/retraction) (*MAX{n::LONG/TAG, c::CHAR}) Restricts the maximum count of success(default), progress or retraction. If 'n' type is tag, slot 0 value of the tag are used. Depends on 'c' argument, the slot 0 value changes. 'c' is an optional argument, default value is 'X'. (* success count = progress count - retraction count) ex. "(?:(*COUNT[T]{X})a)*(?:(*MAX{T})c)*" [callout data] slot 0: '>': progress count, '<': retraction count, 'X': success count (default) * COUNT (progress/retraction) (*COUNT{c::CHAR}) Counter. Depends on 'c' argument, the slot 0 value changes. 'c' is an optional argument, default value is '>'. [callout data] slot 0: '>': progress count (default), '<': retraction count, 'X': success count slot 1: progress count slot 2: retraction count ** If option ONIG_OPTION_FIND_LONGEST or ONIG_OPTION_FIND_NOT_EMPTY is used, counts are not accurate. * TOTAL_COUNT (progress/retraction) (*TOTAL_COUNT{c::CHAR}) It's the almost same as COUNT. But the counts are integrated in a search process. 'c' is an optional argument, default value is '>'. [callout data] slot 0: '>': progress count (default), '<': retraction count, 'X': success count slot 1: progress count slot 2: retraction count ** If option ONIG_OPTION_FIND_LONGEST or ONIG_OPTION_FIND_NOT_EMPTY is used, counts are not accurate. * CMP (progress) (*CMP{x::TAG/LONG, op::STRING, y::TAG/LONG}) Compares x value and y value with op operator. If x and y types are tag, slot 0 value of the tag are used. op: '==', '!=', '>', '<', '>=', '<=' ex. "(?:(*MAX[TA]{7})a|(*MAX[TB]{5})b)*(*CMP{TA,>=,4})" [callout data] slot 0: op value (enum OP_CMP in src/regexec.c) * SKIP (progress) (*SKIP) Advance the position where the current matching fails and the next search begins to the current position. It has no effect on the current matching. //END jq-1.8.2/vendor/oniguruma/doc/UNICODE_PROPERTIES0000644000175100017510000002562515215513537014475 Unicode Properties (Unicode Version: 16.0.0, Emoji: 16.0) ASCII_Hex_Digit Adlam Ahom Alphabetic Anatolian_Hieroglyphs Any Arabic Armenian Assigned Avestan Balinese Bamum Bassa_Vah Batak Bengali Bhaiksuki Bidi_Control Bopomofo Brahmi Braille Buginese Buhid C Canadian_Aboriginal Carian Case_Ignorable Cased Caucasian_Albanian Cc Cf Chakma Cham Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_Titlecased Changes_When_Uppercased Cherokee Chorasmian Cn Co Common Coptic Cs Cuneiform Cypriot Cypro_Minoan Cyrillic Dash Default_Ignorable_Code_Point Deprecated Deseret Devanagari Diacritic Dives_Akuru Dogra Duployan Egyptian_Hieroglyphs Elbasan Elymaic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ethiopic Extended_Pictographic Extender Garay Georgian Glagolitic Gothic Grantha Grapheme_Base Grapheme_Extend Grapheme_Link Greek Gujarati Gunjala_Gondi Gurmukhi Gurung_Khema Han Hangul Hanifi_Rohingya Hanunoo Hatran Hebrew Hex_Digit Hiragana Hyphen IDS_Binary_Operator IDS_Trinary_Operator IDS_Unary_Operator ID_Compat_Math_Continue ID_Compat_Math_Start ID_Continue ID_Start Ideographic Imperial_Aramaic InCB Inherited Inscriptional_Pahlavi Inscriptional_Parthian Javanese Join_Control Kaithi Kannada Katakana Kawi Kayah_Li Kharoshthi Khitan_Small_Script Khmer Khojki Khudawadi Kirat_Rai L LC Lao Latin Lepcha Limbu Linear_A Linear_B Lisu Ll Lm Lo Logical_Order_Exception Lowercase Lt Lu Lycian Lydian M Mahajani Makasar Malayalam Mandaic Manichaean Marchen Masaram_Gondi Math Mc Me Medefaidrin Meetei_Mayek Mende_Kikakui Meroitic_Cursive Meroitic_Hieroglyphs Miao Mn Modi Modifier_Combining_Mark Mongolian Mro Multani Myanmar N Nabataean Nag_Mundari Nandinagari Nd New_Tai_Lue Newa Nko Nl No Noncharacter_Code_Point Nushu Nyiakeng_Puachue_Hmong Ogham Ol_Chiki Ol_Onal Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_Sogdian Old_South_Arabian Old_Turkic Old_Uyghur Oriya Osage Osmanya Other_Alphabetic Other_Default_Ignorable_Code_Point Other_Grapheme_Extend Other_ID_Continue Other_ID_Start Other_Lowercase Other_Math Other_Uppercase P Pahawh_Hmong Palmyrene Pattern_Syntax Pattern_White_Space Pau_Cin_Hau Pc Pd Pe Pf Phags_Pa Phoenician Pi Po Prepended_Concatenation_Mark Ps Psalter_Pahlavi Quotation_Mark Radical Regional_Indicator Rejang Runic S Samaritan Saurashtra Sc Sentence_Terminal Sharada Shavian Siddham SignWriting Sinhala Sk Sm So Soft_Dotted Sogdian Sora_Sompeng Soyombo Sundanese Sunuwar Syloti_Nagri Syriac Tagalog Tagbanwa Tai_Le Tai_Tham Tai_Viet Takri Tamil Tangsa Tangut Telugu Terminal_Punctuation Thaana Thai Tibetan Tifinagh Tirhuta Todhri Toto Tulu_Tigalari Ugaritic Unified_Ideograph Unknown Uppercase Vai Variation_Selector Vithkuqi Wancho Warang_Citi White_Space XID_Continue XID_Start Yezidi Yi Z Zanabazar_Square Zl Zp Zs Adlm Aghb AHex Arab Armi Armn Avst Bali Bamu Bass Batk Beng Bhks Bidi_C Bopo Brah Brai Bugi Buhd Cakm Cans Cari Cased_Letter Cher Chrs CI Close_Punctuation Combining_Mark Connector_Punctuation Control Copt Cpmn Cprt Currency_Symbol CWCF CWCM CWL CWT CWU Cyrl Dash_Punctuation Decimal_Number Dep Deva DI Dia Diak Dogr Dsrt Dupl EBase EComp Egyp Elba Elym EMod Enclosing_Mark EPres Ethi Ext ExtPict Final_Punctuation Format Gara Geor Glag Gong Gonm Goth Gran Gr_Base Grek Gr_Ext Gr_Link Gujr Gukh Guru Hang Hani Hano Hatr Hebr Hex Hira Hluw Hmng Hmnp Hung IDC Ideo IDS IDSB IDST IDSU Initial_Punctuation Ital Java Join_C Kali Kana Khar Khmr Khoj Kits Knda Krai Kthi Lana Laoo Latn Lepc Letter Letter_Number Limb Lina Linb Line_Separator LOE Lowercase_Letter Lyci Lydi Mahj Maka Mand Mani Marc Mark Math_Symbol MCM Medf Mend Merc Mero Mlym Modifier_Letter Modifier_Symbol Mong Mroo Mtei Mult Mymr Nagm Nand Narb Nbat NChar Nkoo Nonspacing_Mark Nshu Number OAlpha ODI Ogam OGr_Ext OIDC OIDS Olck OLower OMath Onao Open_Punctuation Orkh Orya Osge Osma Other Other_Letter Other_Number Other_Punctuation Other_Symbol Ougr OUpper Palm Paragraph_Separator Pat_Syn Pat_WS Pauc PCM Perm Phag Phli Phlp Phnx Plrd Private_Use Prti punct Punctuation Qaac Qaai QMark RI Rjng Rohg Runr Samr Sarb Saur SD Separator Sgnw Shaw Shrd Sidd Sind Sinh Sogd Sogo Sora Soyo Space_Separator Spacing_Mark STerm Sund Sunu Surrogate Sylo Symbol Syrc Tagb Takr Tale Talu Taml Tang Tavt Telu Term Tfng Tglg Thaa Tibt Tirh Titlecase_Letter Tnsa Todr Tutg Ugar UIdeo Unassigned Uppercase_Letter Vaii Vith VS Wara Wcho WSpace XIDC XIDS Xpeo Xsux Yezi Yiii Zanb Zinh Zyyy Zzzz In_Basic_Latin In_Latin_1_Supplement In_Latin_Extended_A In_Latin_Extended_B In_IPA_Extensions In_Spacing_Modifier_Letters In_Combining_Diacritical_Marks In_Greek_and_Coptic In_Cyrillic In_Cyrillic_Supplement In_Armenian In_Hebrew In_Arabic In_Syriac In_Arabic_Supplement In_Thaana In_NKo In_Samaritan In_Mandaic In_Syriac_Supplement In_Arabic_Extended_B In_Arabic_Extended_A In_Devanagari In_Bengali In_Gurmukhi In_Gujarati In_Oriya In_Tamil In_Telugu In_Kannada In_Malayalam In_Sinhala In_Thai In_Lao In_Tibetan In_Myanmar In_Georgian In_Hangul_Jamo In_Ethiopic In_Ethiopic_Supplement In_Cherokee In_Unified_Canadian_Aboriginal_Syllabics In_Ogham In_Runic In_Tagalog In_Hanunoo In_Buhid In_Tagbanwa In_Khmer In_Mongolian In_Unified_Canadian_Aboriginal_Syllabics_Extended In_Limbu In_Tai_Le In_New_Tai_Lue In_Khmer_Symbols In_Buginese In_Tai_Tham In_Combining_Diacritical_Marks_Extended In_Balinese In_Sundanese In_Batak In_Lepcha In_Ol_Chiki In_Cyrillic_Extended_C In_Georgian_Extended In_Sundanese_Supplement In_Vedic_Extensions In_Phonetic_Extensions In_Phonetic_Extensions_Supplement In_Combining_Diacritical_Marks_Supplement In_Latin_Extended_Additional In_Greek_Extended In_General_Punctuation In_Superscripts_and_Subscripts In_Currency_Symbols In_Combining_Diacritical_Marks_for_Symbols In_Letterlike_Symbols In_Number_Forms In_Arrows In_Mathematical_Operators In_Miscellaneous_Technical In_Control_Pictures In_Optical_Character_Recognition In_Enclosed_Alphanumerics In_Box_Drawing In_Block_Elements In_Geometric_Shapes In_Miscellaneous_Symbols In_Dingbats In_Miscellaneous_Mathematical_Symbols_A In_Supplemental_Arrows_A In_Braille_Patterns In_Supplemental_Arrows_B In_Miscellaneous_Mathematical_Symbols_B In_Supplemental_Mathematical_Operators In_Miscellaneous_Symbols_and_Arrows In_Glagolitic In_Latin_Extended_C In_Coptic In_Georgian_Supplement In_Tifinagh In_Ethiopic_Extended In_Cyrillic_Extended_A In_Supplemental_Punctuation In_CJK_Radicals_Supplement In_Kangxi_Radicals In_Ideographic_Description_Characters In_CJK_Symbols_and_Punctuation In_Hiragana In_Katakana In_Bopomofo In_Hangul_Compatibility_Jamo In_Kanbun In_Bopomofo_Extended In_CJK_Strokes In_Katakana_Phonetic_Extensions In_Enclosed_CJK_Letters_and_Months In_CJK_Compatibility In_CJK_Unified_Ideographs_Extension_A In_Yijing_Hexagram_Symbols In_CJK_Unified_Ideographs In_Yi_Syllables In_Yi_Radicals In_Lisu In_Vai In_Cyrillic_Extended_B In_Bamum In_Modifier_Tone_Letters In_Latin_Extended_D In_Syloti_Nagri In_Common_Indic_Number_Forms In_Phags_pa In_Saurashtra In_Devanagari_Extended In_Kayah_Li In_Rejang In_Hangul_Jamo_Extended_A In_Javanese In_Myanmar_Extended_B In_Cham In_Myanmar_Extended_A In_Tai_Viet In_Meetei_Mayek_Extensions In_Ethiopic_Extended_A In_Latin_Extended_E In_Cherokee_Supplement In_Meetei_Mayek In_Hangul_Syllables In_Hangul_Jamo_Extended_B In_High_Surrogates In_High_Private_Use_Surrogates In_Low_Surrogates In_Private_Use_Area In_CJK_Compatibility_Ideographs In_Alphabetic_Presentation_Forms In_Arabic_Presentation_Forms_A In_Variation_Selectors In_Vertical_Forms In_Combining_Half_Marks In_CJK_Compatibility_Forms In_Small_Form_Variants In_Arabic_Presentation_Forms_B In_Halfwidth_and_Fullwidth_Forms In_Specials In_Linear_B_Syllabary In_Linear_B_Ideograms In_Aegean_Numbers In_Ancient_Greek_Numbers In_Ancient_Symbols In_Phaistos_Disc In_Lycian In_Carian In_Coptic_Epact_Numbers In_Old_Italic In_Gothic In_Old_Permic In_Ugaritic In_Old_Persian In_Deseret In_Shavian In_Osmanya In_Osage In_Elbasan In_Caucasian_Albanian In_Vithkuqi In_Todhri In_Linear_A In_Latin_Extended_F In_Cypriot_Syllabary In_Imperial_Aramaic In_Palmyrene In_Nabataean In_Hatran In_Phoenician In_Lydian In_Meroitic_Hieroglyphs In_Meroitic_Cursive In_Kharoshthi In_Old_South_Arabian In_Old_North_Arabian In_Manichaean In_Avestan In_Inscriptional_Parthian In_Inscriptional_Pahlavi In_Psalter_Pahlavi In_Old_Turkic In_Old_Hungarian In_Hanifi_Rohingya In_Garay In_Rumi_Numeral_Symbols In_Yezidi In_Arabic_Extended_C In_Old_Sogdian In_Sogdian In_Old_Uyghur In_Chorasmian In_Elymaic In_Brahmi In_Kaithi In_Sora_Sompeng In_Chakma In_Mahajani In_Sharada In_Sinhala_Archaic_Numbers In_Khojki In_Multani In_Khudawadi In_Grantha In_Tulu_Tigalari In_Newa In_Tirhuta In_Siddham In_Modi In_Mongolian_Supplement In_Takri In_Myanmar_Extended_C In_Ahom In_Dogra In_Warang_Citi In_Dives_Akuru In_Nandinagari In_Zanabazar_Square In_Soyombo In_Unified_Canadian_Aboriginal_Syllabics_Extended_A In_Pau_Cin_Hau In_Devanagari_Extended_A In_Sunuwar In_Bhaiksuki In_Marchen In_Masaram_Gondi In_Gunjala_Gondi In_Makasar In_Kawi In_Lisu_Supplement In_Tamil_Supplement In_Cuneiform In_Cuneiform_Numbers_and_Punctuation In_Early_Dynastic_Cuneiform In_Cypro_Minoan In_Egyptian_Hieroglyphs In_Egyptian_Hieroglyph_Format_Controls In_Egyptian_Hieroglyphs_Extended_A In_Anatolian_Hieroglyphs In_Gurung_Khema In_Bamum_Supplement In_Mro In_Tangsa In_Bassa_Vah In_Pahawh_Hmong In_Kirat_Rai In_Medefaidrin In_Miao In_Ideographic_Symbols_and_Punctuation In_Tangut In_Tangut_Components In_Khitan_Small_Script In_Tangut_Supplement In_Kana_Extended_B In_Kana_Supplement In_Kana_Extended_A In_Small_Kana_Extension In_Nushu In_Duployan In_Shorthand_Format_Controls In_Symbols_for_Legacy_Computing_Supplement In_Znamenny_Musical_Notation In_Byzantine_Musical_Symbols In_Musical_Symbols In_Ancient_Greek_Musical_Notation In_Kaktovik_Numerals In_Mayan_Numerals In_Tai_Xuan_Jing_Symbols In_Counting_Rod_Numerals In_Mathematical_Alphanumeric_Symbols In_Sutton_SignWriting In_Latin_Extended_G In_Glagolitic_Supplement In_Cyrillic_Extended_D In_Nyiakeng_Puachue_Hmong In_Toto In_Wancho In_Nag_Mundari In_Ol_Onal In_Ethiopic_Extended_B In_Mende_Kikakui In_Adlam In_Indic_Siyaq_Numbers In_Ottoman_Siyaq_Numbers In_Arabic_Mathematical_Alphabetic_Symbols In_Mahjong_Tiles In_Domino_Tiles In_Playing_Cards In_Enclosed_Alphanumeric_Supplement In_Enclosed_Ideographic_Supplement In_Miscellaneous_Symbols_and_Pictographs In_Emoticons In_Ornamental_Dingbats In_Transport_and_Map_Symbols In_Alchemical_Symbols In_Geometric_Shapes_Extended In_Supplemental_Arrows_C In_Supplemental_Symbols_and_Pictographs In_Chess_Symbols In_Symbols_and_Pictographs_Extended_A In_Symbols_for_Legacy_Computing In_CJK_Unified_Ideographs_Extension_B In_CJK_Unified_Ideographs_Extension_C In_CJK_Unified_Ideographs_Extension_D In_CJK_Unified_Ideographs_Extension_E In_CJK_Unified_Ideographs_Extension_F In_CJK_Unified_Ideographs_Extension_I In_CJK_Compatibility_Ideographs_Supplement In_CJK_Unified_Ideographs_Extension_G In_CJK_Unified_Ideographs_Extension_H In_Tags In_Variation_Selectors_Supplement In_Supplementary_Private_Use_Area_A In_Supplementary_Private_Use_Area_B In_No_Block jq-1.8.2/vendor/oniguruma/doc/CALLOUTS.BUILTIN.ja0000644000175100017510000000467115215513537014555 CALLOUTS.BUILTIN.ja 2024/07/04 * FAIL (前進) (*FAIL) 常に失敗する * MISMATCH (前進) (*MISMATCH) 照合を中止する 検索は継続する * ERROR (前進) (*ERROR{n::LONG}) 検索/照合を中止する 戻り値は引数'n'の値。(-1より小さい負の値でなければならない) 'n'はオプション引数で、デフォルト値はONIG_ABORT * MAX (前進/後退) (*MAX{n::LONG/TAG, c::CHAR}) 成功(デフォルト)、前進または後退回数を制限する 'n'がTAGのときは、そのTAGのcalloutのslot 0の値が使用される 'c'引数の値によって、slot 0の値が変化する 'c'はオプション引数で、デフォルト値は'X' 例: "(?:(*COUNT[T]{X})a)*(?:(*MAX{T})c)*" [callout data] slot 0: '>': 前進回数, '<': 後退回数, 'X': 成功回数(デフォルト) * COUNT (前進/後退) (*COUNT{c::CHAR}) カウンタ 'c'引数の値によって、slot 0の値が変化する 'c'はオプション引数で、デフォルト値は'>' [callout data] slot 0: '>': 前進回数(デフォルト), '<': 後退回数, 'X': 成功回数 slot 1: 前進回数 slot 2: 後退回数 (* 成功回数 = 前進回数 - 後退回数) ** ONIG_OPTION_FIND_LONGEST または ONIG_OPTION_FIND_NOT_EMPTY が使用されると 正確な動作ができなくなる * TOTAL_COUNT (前進/後退) (*TOTAL_COUNT{c::CHAR}) これはCOUNTとほとんど同じ しかし、カウントが検索過程で積算される 'c'はオプション引数で、デフォルト値は'>' [callout data] slot 0: '>': 前進回数(デフォルト), '<': 後退回数, 'X': 成功回数 slot 1: 前進回数 slot 2: 後退回数 ** ONIG_OPTION_FIND_LONGEST または ONIG_OPTION_FIND_NOT_EMPTY が使用されると 正確な動作ができなくなる * CMP (前進) (*CMP{x::TAG/LONG, op::STRING, y::TAG/LONG}) xの値とyの値をop演算子で比較する x, yがTAGのときにはそのcalloutのslot 0の値が参照される op: '==', '!=', '>', '<', '>=', '<=' 例: "(?:(*MAX[TA]{7})a|(*MAX[TB]{5})b)*(*CMP{TA,>=,4})" [callout data] slot 0: op値 (src/regexec.c の中の enum OP_CMP) * SKIP (前進) (*SKIP) 現在のマッチングが失敗して次の検索を開始する位置を、現在位置まで前進させる 現在のマッチングには何の影響も与えない //END jq-1.8.2/vendor/oniguruma/doc/RE0000644000175100017510000004574615215513537012147 Oniguruma Regular Expressions Version 6.9.9 2024/06/10 syntax: ONIG_SYNTAX_ONIGURUMA (default syntax) 1. Syntax elements \ escape (enable or disable meta character) | alternation (...) group [...] character class 2. Characters \t horizontal tab (0x09) \v vertical tab (0x0B) \n newline (line feed) (0x0A) \r carriage return (0x0D) \b backspace (0x08) \f form feed (0x0C) \a bell (0x07) \e escape (0x1B) \nnn octal char (encoded byte value) \xHH hexadecimal char (encoded byte value) \x{7HHHHHHH} (1-8 digits) hexadecimal char (code point value) \o{17777777777} (1-11 digits) octal char (code point value) \uHHHH hexadecimal char (code point value) \cx control char (code point value) \C-x control char (code point value) \M-x meta (x|0x80) (code point value) \M-\C-x meta control char (code point value) (* \b as backspace is effective in character class only) 2.1 Code point sequences Hexadecimal code point (1-8 digits) \x{7HHHHHHH 7HHHHHHH ... 7HHHHHHH} Octal code point (1-11 digits) \o{17777777777 17777777777 ... 17777777777} 3. Character types . any character (except newline) \w word character Not Unicode: alphanumeric, "_" and multibyte char. Unicode: General_Category -- (Letter|Mark|Number|Connector_Punctuation) \W non-word char \s whitespace char Not Unicode: \t, \n, \v, \f, \r, \x20 Unicode case: U+0009, U+000A, U+000B, U+000C, U+000D, U+0085(NEL), General_Category -- Line_Separator -- Paragraph_Separator -- Space_Separator \S non-whitespace char \d decimal digit char Unicode: General_Category -- Decimal_Number \D non-decimal-digit char \h hexadecimal digit char [0-9a-fA-F] \H non-hexdigit char \R general newline (* can't be used in character-class) "\r\n" or \n,\v,\f,\r (* but doesn't backtrack from \r\n to \r) Unicode case: "\r\n" or \n,\v,\f,\r or U+0085, U+2028, U+2029 \N negative newline (?-m:.) \O true anychar (?m:.) (* original function) \X Text Segment \X === (?>\O(?:\Y\O)*) The meaning of this operator changes depending on the setting of the option (?y{..}). \X doesn't check whether matching start position is boundary or not. Please write as \y\X if you want to ensure it. [Extended Grapheme Cluster mode] (default) Unicode case: See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] Not Unicode case: \X === (?>\r\n|\O) [Word mode] Currently, this mode is supported in Unicode only. See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] Character Property * \p{property-name} * \p{^property-name} (negative) * \P{property-name} (negative) property-name: + works on all encodings Alnum, Alpha, Blank, Cntrl, Digit, Graph, Lower, Print, Punct, Space, Upper, XDigit, Word, ASCII + works on EUC_JP, Shift_JIS Hiragana, Katakana + works on UTF8, UTF16, UTF32 See doc/UNICODE_PROPERTIES. 4. Quantifier greedy ? 1 or 0 times * 0 or more times + 1 or more times {n,m} (n <= m) at least n but no more than m times {n,} at least n times {,n} at least 0 but no more than n times ({0,n}) {n} n times reluctant ?? 0 or 1 times *? 0 or more times +? 1 or more times {n,m}? (n <= m) at least n but not more than m times {n,}? at least n times {,n}? at least 0 but not more than n times (== {0,n}?) {n}? is reluctant operator in ONIG_SYNTAX_JAVA and ONIG_SYNTAX_PERL only. (In that case, it doesn't make sense to write so.) In default syntax, /a{n}?/ === /(?:a{n})?/ possessive (greedy and does not backtrack once match) ?+ 1 or 0 times *+ 0 or more times ++ 1 or more times {n,m} (n > m) at least m but not more than n times {n,m}+, {n,}+, {n}+ are possessive operators in ONIG_SYNTAX_JAVA and ONIG_SYNTAX_PERL only. ex. /a*+/ === /(?>a*)/ 5. Anchors ^ beginning of the line $ end of the line \b word boundary \B non-word boundary \A beginning of string \Z end of string, or before newline at the end \z end of string \G where the current search attempt begins \K keep (keep start position of the result string) \y Text Segment boundary \Y Text Segment non-boundary The meaning of these operators(\y, \Y) changes depending on the setting of the option (?y{..}). [Extended Grapheme Cluster mode] (default) Unicode case: See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] Not Unicode: All positions except between \r and \n. [Word mode] Currently, this mode is supported in Unicode only. See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/] 6. Character class ^... negative class (lowest precedence) x-y range from x to y [...] set (character class in character class) ..&&.. intersection (low precedence, only higher than ^) ex. [a-w&&[^c-g]z] ==> ([a-w] AND ([^c-g] OR z)) ==> [abh-w] * If you want to use '[', '-', or ']' as a normal character in character class, you should escape them with '\'. POSIX bracket ([:xxxxx:], negate [:^xxxxx:]) Not Unicode Case: alnum alphabet or digit char alpha alphabet ascii code value: [0 - 127] blank \t, \x20 cntrl digit 0-9 graph include all of multibyte encoded characters lower print include all of multibyte encoded characters punct space \t, \n, \v, \f, \r, \x20 upper xdigit 0-9, a-f, A-F word alphanumeric, "_" and multibyte characters Unicode Case: alnum Alphabetic | Decimal_Number alpha Alphabetic ascii U+0000 - U+007F blank Space_Separator | U+0009 cntrl U+0000 - U+001F, U+007F - U+009F digit Decimal_Number graph ^White_Space && ^[[:cntrl:]] && ^Unassigned && ^Surrogate lower Lowercase print [[:graph:]] | Space_Separator punct Punctuation | Symbol space White_Space upper Uppercase xdigit U+0030 - U+0039 | U+0041 - U+0046 | U+0061 - U+0066 (0-9, a-f, A-F) word Alphabetic | Mark | Decimal_Number | Connector_Punctuation 7. Extended groups (?#...) comment (?imxWDSPy-imxWDSP:subexp) option on/off for subexp i: ignore case m: multi-line (dot (.) also matches newline) x: extended form W: ASCII only word (\w, \p{Word}, [[:word:]]) ASCII only word bound (\b) D: ASCII only digit (\d, \p{Digit}, [[:digit:]]) S: ASCII only space (\s, \p{Space}, [[:space:]]) P: ASCII only POSIX properties (includes W,D,S) (alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit, word) y{?}: Text Segment mode This option changes the meaning of \X, \y, \Y. Currently, this option is supported in Unicode only. y{g}: Extended Grapheme Cluster mode (default) y{w}: Word mode See [Unicode Standard Annex #29] (?imxWDSPy-imxWDSP) isolated option * It makes a group to the next ')' or end of the pattern. /ab(?i)c|def|gh/ == /ab(?i:c|def|gh)/ * (?i) option has no effect on word types (\w, \p{Word}). However, if the word types are used within a character class, it is valid. But, this would only be a concern when word types are used with the (?W) option. /(?CIL).../, /(?CIL:...)/ whole option This option must be placed in a position that affects the entire regular expression. C: ONIG_OPTION_DONT_CAPTURE_GROUP I: ONIG_OPTION_IGNORECASE_IS_ASCII L: ONIG_OPTION_FIND_LONGEST (?:subexp) non-capturing group (subexp) capturing group (?=subexp) look-ahead (?!subexp) negative look-ahead (?<=subexp) look-behind (?subexp) atomic group no backtracks in subexp. (?subexp), (?'name'subexp) define named group (Each character of the name must be a word character.) Not only a name but a number is assigned like a capturing group. Assigning the same name to two or more subexps is allowed. * Callouts of contents (?{...contents...}) callout in progress (?{...contents...}D) D is a direction flag char D = 'X': in progress and retraction '<': in retraction only '>': in progress only (?{...contents...}[tag]) tag assigned (?{...contents...}[tag]D) * Escape characters have no effects in contents. * contents is not allowed to start with '{'. (?{{{...contents...}}}) n times continuations '}' in contents is allowed in (n+1) times continuations {{{...}}}. Allowed tag string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) * Callouts of name (*name) (*name{args...}) with args (*name[tag]) tag assigned (*name[tag]{args...}) Allowed name string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) Allowed tag string characters: _ A-Z a-z 0-9 (* first character: _ A-Z a-z) (?~absent) Absent repeater (* proposed by Tanaka Akira) This works like .* (more precisely \O*), but it is limited by the range that does not include the string match with . This is a written abbreviation of (?~|(?:absent)|\O*). \O* is used as a repeater. (?~|absent|exp) Absent expression (* original) This works like "exp", but it is limited by the range that does not include the string match with . ex. (?~|345|\d*) "12345678" ==> "12", "1", "" (?~|absent) Absent stopper (* original) After passed this operator, string right range is limited at the point that does not include the string match with . (?~|) Range clear Clear the effects caused by Absent stoppers. * Nested Absent functions are not supported and the behavior is undefined. (?(condition_exp)then_exp|else_exp) if-then-else (?(condition_exp)then_exp) if-then condition_exp can be a backreference number/name or a normal regular expression. When condition_exp is a backreference number/name, both then_exp and else_exp can be omitted. Then it works as a backreference validity checker. [ Backreference validity checker ] (* original) (?(n)), (?(-n)), (?(+n)), (?(n+level)) ... (?()), (?('-n')), (?(<+n>)) ... (?()), (?('name')), (?()) ... 8. Backreferences When we say "backreference a group," it actually means, "re-match the same text matched by the subexp in that group." \n \k \k'n' (n >= 1) backreference the nth group in the regexp \k<-n> \k'-n' (n >= 1) backreference the nth group counting backwards from the referring position \k<+n> \k'+n' (n >= 1) backreference the nth group counting forwards from the referring position \k \k'name' backreference a group with the specified name When backreferencing with a name that is assigned to more than one groups, the last group with the name is checked first, if not matched then the previous one with the name, and so on, until there is a match. * Backreference by number is forbidden if any named group is defined and ONIG_OPTION_CAPTURE_GROUP is not set. backreference with recursion level (n >= 1, level >= 0) \k \k'n+level' \k \k'n-level' \k \k'name+level' \k \k'name-level' Destine a group on the recursion level relative to the referring position. ex 1. /\A(?|.|(?:(?.)\g\k))\z/.match("reee") /\A(?|.|(?:(?.)\g\k))\z/.match("reer") \k refers to the (?.) on the same recursion level with it. ex 2. r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED) (? \g \g* \g ){0} (? < \g \s* > ){0} (? [a-zA-Z_:]+ ){0} (? [^<&]+ (\g | [^<&]+)* ){0} (? >){0} \g __REGEXP__ p r.match("fbbbf").captures 9. Subexp calls ("Tanaka Akira special") (* original function) When we say "call a group," it actually means, "re-execute the subexp in that group." \g \g'n' (n >= 1) call the nth group \g<0> \g'0' call zero (call the total regexp) \g<-n> \g'-n' (n >= 1) call the nth group counting backwards from the calling position \g<+n> \g'+n' (n >= 1) call the nth group counting forwards from the calling position \g \g'name' call the group with the specified name * Left-most recursive calls are not allowed. ex. (?a|\gb) => error (?a|b\gc) => OK * Calls with a name that is assigned to more than one groups are not allowed. * Call by number is forbidden if any named group is defined and ONIG_OPTION_CAPTURE_GROUP is not set. * The option status of the called group is always effective. ex. /(?-i:\g)(?i:(?a)){0}/.match("A") 10. Captured group Behavior of an unnamed group (...) changes with the following conditions. (But named group is not changed.) case 1. /.../ (named group is not used, no option) (...) is treated as a capturing group. case 2. /.../g (named group is not used, 'g' option) (...) is treated as a non-capturing group (?:...). case 3. /..(?..)../ (named group is used, no option) (...) is treated as a non-capturing group. numbered-backref/call is not allowed. case 4. /..(?..)../G (named group is used, 'G' option) (...) is treated as a capturing group. numbered-backref/call is allowed. where g: ONIG_OPTION_DONT_CAPTURE_GROUP G: ONIG_OPTION_CAPTURE_GROUP ('g' and 'G' options are argued in ruby-dev ML) ----------------------------- A-1. Syntax-dependent options + ONIG_SYNTAX_ONIGURUMA (?m): dot (.) also matches newline + ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA (?s): dot (.) also matches newline (?m): ^ matches after newline, $ matches before newline A-2. Original extensions + hexadecimal digit char type \h, \H + true anychar \O + text segment boundary \y, \Y + backreference validity checker (?(...)) + named group (?...), (?'name'...) + named backref \k + subexp call \g, \g + absent expression (?~|...|...) + absent stopper (?~|...) A-3. Missing features compared with perl 5.8.0 + \N{name} + \l,\u,\L,\U,\C + (??{code}) * \Q...\E This is effective on ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA. A-4. Differences with Japanized GNU regex(version 0.12) of Ruby 1.8 + add character property (\p{property}, \P{property}) + add hexadecimal digit char type (\h, \H) + add look-behind (?<=fixed-width-pattern), (?>]/ in EUC-JP encoding. + effect range of isolated option is to next ')'. ex. (?:(?i)a|b) is interpreted as (?:(?i:a|b)), not (?:(?i:a)|b). + isolated option is not transparent to previous pattern. ex. a(?i)* is a syntax error pattern. + allowed unpaired left brace as a normal character. ex. /{/, /({)/, /a{2,3/ etc... + negative POSIX bracket [:^xxxx:] is supported. + POSIX bracket [:ascii:] is added. + repeat of look-ahead is not allowed. ex. /(?=a)*/, /(?!b){5}/ + Ignore case option is effective to escape sequence. ex. /\x61/i =~ "A" + In the range quantifier, the number of the minimum is optional. /a{,n}/ == /a{0,n}/ The omission of both minimum and maximum values is not allowed. /a{,}/ + /{n}?/ is not a reluctant quantifier. /a{n}?/ == /(?:a{n})?/ + invalid back reference is checked and raises error. /\1/, /(a)\2/ + Zero-width match in an infinite loop stops the repeat, then changes of the capture group status are checked as stop condition. /(?:()|())*\1\2/ =~ "" /(?:\1a|())*/ =~ "a" // END jq-1.8.2/vendor/oniguruma/doc/FAQ0000644000175100017510000000031215215513537012224 FAQ 2006/11/14 1. Longest match You can execute the longest match by using ONIG_OPTION_FIND_LONGEST option in onig_new(). 2. Mailing list There is no mailing list for Oniguruma. // END jq-1.8.2/vendor/oniguruma/windows/0000755000175100017510000000000015215513665012705 5jq-1.8.2/vendor/oniguruma/windows/testc.c0000644000175100017510000006664615215513537014133 /* * This program was generated by testconv.rb. */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION #endif #include #ifdef POSIX_TEST #include "onigposix.h" #else #include "oniguruma.h" #endif #include #define SLEN(s) strlen(s) static int nsucc = 0; static int nfail = 0; static int nerror = 0; static FILE* err_file; #ifndef POSIX_TEST static OnigRegion* region; #endif static void xx(char* pattern, char* str, int from, int to, int mem, int not) { int r; #ifdef POSIX_TEST regex_t reg; char buf[200]; regmatch_t pmatch[25]; r = regcomp(®, pattern, REG_EXTENDED | REG_NEWLINE); if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(err_file, "ERROR: %s\n", buf); nerror++; return ; } r = regexec(®, str, reg.re_nsub + 1, pmatch, 0); if (r != 0 && r != REG_NOMATCH) { regerror(r, ®, buf, sizeof(buf)); fprintf(err_file, "ERROR: %s\n", buf); nerror++; return ; } if (r == REG_NOMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s'\n", pattern, str); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s'\n", pattern, str); nfail++; } else { if (pmatch[mem].rm_so == from && pmatch[mem].rm_eo == to) { fprintf(stdout, "OK: /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", pattern, str, from, to, pmatch[mem].rm_so, pmatch[mem].rm_eo); nfail++; } } } regfree(®); #else regex_t* reg; OnigErrorInfo einfo; r = onig_new(®, (UChar* )pattern, (UChar* )(pattern + SLEN(pattern)), ONIG_OPTION_DEFAULT, ONIG_ENCODING_SJIS, ONIG_SYNTAX_DEFAULT, &einfo); if (r) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r, &einfo); fprintf(err_file, "ERROR: %s\n", s); nerror++; return ; } r = onig_search(reg, (UChar* )str, (UChar* )(str + SLEN(str)), (UChar* )str, (UChar* )(str + SLEN(str)), region, ONIG_OPTION_NONE); if (r < ONIG_MISMATCH) { char s[ONIG_MAX_ERROR_MESSAGE_LEN]; onig_error_code_to_str((UChar* )s, r); fprintf(err_file, "ERROR: %s\n", s); nerror++; return ; } if (r == ONIG_MISMATCH) { if (not) { fprintf(stdout, "OK(N): /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s'\n", pattern, str); nfail++; } } else { if (not) { fprintf(stdout, "FAIL(N): /%s/ '%s'\n", pattern, str); nfail++; } else { if (region->beg[mem] == from && region->end[mem] == to) { fprintf(stdout, "OK: /%s/ '%s'\n", pattern, str); nsucc++; } else { fprintf(stdout, "FAIL: /%s/ '%s' %d-%d : %d-%d\n", pattern, str, from, to, region->beg[mem], region->end[mem]); nfail++; } } } onig_free(reg); #endif } static void x2(char* pattern, char* str, int from, int to) { xx(pattern, str, from, to, 0, 0); } static void x3(char* pattern, char* str, int from, int to, int mem) { xx(pattern, str, from, to, mem, 0); } static void n(char* pattern, char* str) { xx(pattern, str, 0, 0, 0, 1); } extern int main(int argc, char* argv[]) { #ifndef POSIX_TEST static OnigEncoding use_encs[1]; use_encs[0] = ONIG_ENCODING_SJIS; onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0])); #endif err_file = stdout; #ifdef POSIX_TEST reg_set_encoding(REG_POSIX_ENCODING_SJIS); #else region = onig_region_new(); #endif x2("", "", 0, 0); x2("^", "", 0, 0); x2("$", "", 0, 0); x2("\\G", "", 0, 0); x2("\\A", "", 0, 0); x2("\\Z", "", 0, 0); x2("\\z", "", 0, 0); x2("^$", "", 0, 0); x2("\\ca", "\001", 0, 1); x2("\\C-b", "\002", 0, 1); x2("\\c\\\\", "\034", 0, 1); x2("q[\\c\\\\]", "q\034", 0, 2); x2("", "a", 0, 0); x2("a", "a", 0, 1); x2("\\x61", "a", 0, 1); x2("aa", "aa", 0, 2); x2("aaa", "aaa", 0, 3); x2("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 35); x2("ab", "ab", 0, 2); x2("b", "ab", 1, 2); x2("bc", "abc", 1, 3); x2("(?i:#RET#)", "#INS##RET#", 5, 10); x2("\\17", "\017", 0, 1); x2("\\x1f", "\x1f", 0, 1); x2("a(?#....\\\\JJJJ)b", "ab", 0, 2); x2("(?x) G (o O(?-x)oO) g L", "GoOoOgLe", 0, 7); x2(".", "a", 0, 1); n(".", ""); x2("..", "ab", 0, 2); x2("\\w", "e", 0, 1); n("\\W", "e"); x2("\\s", " ", 0, 1); x2("\\S", "b", 0, 1); x2("\\d", "4", 0, 1); n("\\D", "4"); x2("\\b", "z ", 0, 0); x2("\\b", " z", 1, 1); x2("\\B", "zz ", 1, 1); x2("\\B", "z ", 2, 2); x2("\\B", " z", 0, 0); x2("[ab]", "b", 0, 1); n("[ab]", "c"); x2("[a-z]", "t", 0, 1); n("[^a]", "a"); x2("[^a]", "\n", 0, 1); x2("[]]", "]", 0, 1); n("[^]]", "]"); x2("[\\^]+", "0^^1", 1, 3); x2("[b-]", "b", 0, 1); x2("[b-]", "-", 0, 1); x2("[\\w]", "z", 0, 1); n("[\\w]", " "); x2("[\\W]", "b$", 1, 2); x2("[\\d]", "5", 0, 1); n("[\\d]", "e"); x2("[\\D]", "t", 0, 1); n("[\\D]", "3"); x2("[\\s]", " ", 0, 1); n("[\\s]", "a"); x2("[\\S]", "b", 0, 1); n("[\\S]", " "); x2("[\\w\\d]", "2", 0, 1); n("[\\w\\d]", " "); x2("[[:upper:]]", "B", 0, 1); x2("[*[:xdigit:]+]", "+", 0, 1); x2("[*[:xdigit:]+]", "GHIKK-9+*", 6, 7); x2("[*[:xdigit:]+]", "-@^+", 3, 4); n("[[:upper]]", "A"); x2("[[:upper]]", ":", 0, 1); x2("[\\044-\\047]", "\046", 0, 1); x2("[\\x5a-\\x5c]", "\x5b", 0, 1); x2("[\\x6A-\\x6D]", "\x6c", 0, 1); n("[\\x6A-\\x6D]", "\x6E"); n("^[0-9A-F]+ 0+ UNDEF ", "75F 00000000 SECT14A notype () External | _rb_apply"); x2("[\\[]", "[", 0, 1); x2("[\\]]", "]", 0, 1); x2("[&]", "&", 0, 1); x2("[[ab]]", "b", 0, 1); x2("[[ab]c]", "c", 0, 1); n("[[^a]]", "a"); n("[^[a]]", "a"); x2("[[ab]&&bc]", "b", 0, 1); n("[[ab]&&bc]", "a"); n("[[ab]&&bc]", "c"); x2("[a-z&&b-y&&c-x]", "w", 0, 1); n("[^a-z&&b-y&&c-x]", "w"); x2("[[^a&&a]&&a-z]", "b", 0, 1); n("[[^a&&a]&&a-z]", "a"); x2("[[^a-z&&bcdef]&&[^c-g]]", "h", 0, 1); n("[[^a-z&&bcdef]&&[^c-g]]", "c"); x2("[^[^abc]&&[^cde]]", "c", 0, 1); x2("[^[^abc]&&[^cde]]", "e", 0, 1); n("[^[^abc]&&[^cde]]", "f"); x2("[a-&&-a]", "-", 0, 1); n("[a\\-&&\\-a]", "&"); n("\\wabc", " abc"); x2("a\\Wbc", "a bc", 0, 4); x2("a.b.c", "aabbc", 0, 5); x2(".\\wb\\W..c", "abb bcc", 0, 7); x2("\\s\\wzzz", " zzzz", 0, 5); x2("aa.b", "aabb", 0, 4); n(".a", "ab"); x2(".a", "aa", 0, 2); x2("^a", "a", 0, 1); x2("^a$", "a", 0, 1); x2("^\\w$", "a", 0, 1); n("^\\w$", " "); x2("^\\wab$", "zab", 0, 3); x2("^\\wabcdef$", "zabcdef", 0, 7); x2("^\\w...def$", "zabcdef", 0, 7); x2("\\w\\w\\s\\Waaa\\d", "aa aaa4", 0, 8); x2("\\A\\Z", "", 0, 0); x2("\\Axyz", "xyz", 0, 3); x2("xyz\\Z", "xyz", 0, 3); x2("xyz\\z", "xyz", 0, 3); x2("a\\Z", "a", 0, 1); x2("\\Gaz", "az", 0, 2); n("\\Gz", "bza"); n("az\\G", "az"); n("az\\A", "az"); n("a\\Az", "az"); x2("\\^\\$", "^$", 0, 2); x2("^x?y", "xy", 0, 2); x2("^(x?y)", "xy", 0, 2); x2("\\w", "_", 0, 1); n("\\W", "_"); x2("(?=z)z", "z", 0, 1); n("(?=z).", "a"); x2("(?!z)a", "a", 0, 1); n("(?!z)a", "z"); x2("(?i:a)", "a", 0, 1); x2("(?i:a)", "A", 0, 1); x2("(?i:A)", "a", 0, 1); n("(?i:A)", "b"); x2("(?i:[A-Z])", "a", 0, 1); x2("(?i:[f-m])", "H", 0, 1); x2("(?i:[f-m])", "h", 0, 1); n("(?i:[f-m])", "e"); x2("(?i:[A-c])", "D", 0, 1); n("(?i:[^a-z])", "A"); n("(?i:[^a-z])", "a"); x2("(?i:[!-k])", "Z", 0, 1); x2("(?i:[!-k])", "7", 0, 1); x2("(?i:[T-}])", "b", 0, 1); x2("(?i:[T-}])", "{", 0, 1); x2("(?i:\\?a)", "?A", 0, 2); x2("(?i:\\*A)", "*a", 0, 2); n(".", "\n"); x2("(?m:.)", "\n", 0, 1); x2("(?m:a.)", "a\n", 0, 2); x2("(?m:.b)", "a\nb", 1, 3); x2(".*abc", "dddabdd\nddabc", 8, 13); x2("(?m:.*abc)", "dddabddabc", 0, 10); n("(?i)(?-i)a", "A"); n("(?i)(?-i:a)", "A"); x2("a?", "", 0, 0); x2("a?", "b", 0, 0); x2("a?", "a", 0, 1); x2("a*", "", 0, 0); x2("a*", "a", 0, 1); x2("a*", "aaa", 0, 3); x2("a*", "baaaa", 0, 0); n("a+", ""); x2("a+", "a", 0, 1); x2("a+", "aaaa", 0, 4); x2("a+", "aabbb", 0, 2); x2("a+", "baaaa", 1, 5); x2(".?", "", 0, 0); x2(".?", "f", 0, 1); x2(".?", "\n", 0, 0); x2(".*", "", 0, 0); x2(".*", "abcde", 0, 5); x2(".+", "z", 0, 1); x2(".+", "zdswer\n", 0, 6); x2("(.*)a\\1f", "babfbac", 0, 4); x2("(.*)a\\1f", "bacbabf", 3, 7); x2("((.*)a\\2f)", "bacbabf", 3, 7); x2("(.*)a\\1f", "baczzzzzz\nbazz\nzzzzbabf", 19, 23); x2("a|b", "a", 0, 1); x2("a|b", "b", 0, 1); x2("|a", "a", 0, 0); x2("(|a)", "a", 0, 0); x2("ab|bc", "ab", 0, 2); x2("ab|bc", "bc", 0, 2); x2("z(?:ab|bc)", "zbc", 0, 3); x2("a(?:ab|bc)c", "aabc", 0, 4); x2("ab|(?:ac|az)", "az", 0, 2); x2("a|b|c", "dc", 1, 2); x2("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "pqr", 0, 2); n("a|b|cd|efg|h|ijk|lmn|o|pq|rstuvwx|yz", "mn"); x2("a|^z", "ba", 1, 2); x2("a|^z", "za", 0, 1); x2("a|\\Gz", "bza", 2, 3); x2("a|\\Gz", "za", 0, 1); x2("a|\\Az", "bza", 2, 3); x2("a|\\Az", "za", 0, 1); x2("a|b\\Z", "ba", 1, 2); x2("a|b\\Z", "b", 0, 1); x2("a|b\\z", "ba", 1, 2); x2("a|b\\z", "b", 0, 1); x2("\\w|\\s", " ", 0, 1); n("\\w|\\w", " "); x2("\\w|%", "%", 0, 1); x2("\\w|[&$]", "&", 0, 1); x2("[b-d]|[^e-z]", "a", 0, 1); x2("(?:a|[c-f])|bz", "dz", 0, 1); x2("(?:a|[c-f])|bz", "bz", 0, 2); x2("abc|(?=zz)..f", "zzf", 0, 3); x2("abc|(?!zz)..f", "abf", 0, 3); x2("(?=za)..a|(?=zz)..a", "zza", 0, 3); n("(?>a|abd)c", "abdc"); x2("(?>abd|a)c", "abdc", 0, 4); x2("a?|b", "a", 0, 1); x2("a?|b", "b", 0, 0); x2("a?|b", "", 0, 0); x2("a*|b", "aa", 0, 2); x2("a*|b*", "ba", 0, 0); x2("a*|b*", "ab", 0, 1); x2("a+|b*", "", 0, 0); x2("a+|b*", "bbb", 0, 3); x2("a+|b*", "abbb", 0, 1); n("a+|b+", ""); x2("(a|b)?", "b", 0, 1); x2("(a|b)*", "ba", 0, 2); x2("(a|b)+", "bab", 0, 3); x2("(ab|ca)+", "caabbc", 0, 4); x2("(ab|ca)+", "aabca", 1, 5); x2("(ab|ca)+", "abzca", 0, 2); x2("(a|bab)+", "ababa", 0, 5); x2("(a|bab)+", "ba", 1, 2); x2("(a|bab)+", "baaaba", 1, 4); x2("(?:a|b)(?:a|b)", "ab", 0, 2); x2("(?:a*|b*)(?:a*|b*)", "aaabbb", 0, 3); x2("(?:a*|b*)(?:a+|b+)", "aaabbb", 0, 6); x2("(?:a+|b+){2}", "aaabbb", 0, 6); x2("h{0,}", "hhhh", 0, 4); x2("(?:a+|b+){1,2}", "aaabbb", 0, 6); n("ax{2}*a", "0axxxa1"); n("a.{0,2}a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXa0"); n("a.{0,2}?a", "0aXXXXa0"); x2("^a{2,}?a$", "aaa", 0, 3); x2("^[a-z]{2,}?$", "aaa", 0, 3); x2("(?:a+|\\Ab*)cc", "cc", 0, 2); n("(?:a+|\\Ab*)cc", "abcc"); x2("(?:^a+|b+)*c", "aabbbabc", 6, 8); x2("(?:^a+|b+)*c", "aabbbbc", 0, 7); x2("a|(?i)c", "C", 0, 1); x2("(?i)c|a", "C", 0, 1); x2("(?i)c|a", "A", 0, 1); x2("(?i:c)|a", "C", 0, 1); n("(?i:c)|a", "A"); x2("[abc]?", "abc", 0, 1); x2("[abc]*", "abc", 0, 3); x2("[^abc]*", "abc", 0, 0); n("[^abc]+", "abc"); x2("a?\?", "aaa", 0, 0); x2("ba?\?b", "bab", 0, 3); x2("a*?", "aaa", 0, 0); x2("ba*?", "baa", 0, 1); x2("ba*?b", "baab", 0, 4); x2("a+?", "aaa", 0, 1); x2("ba+?", "baa", 0, 2); x2("ba+?b", "baab", 0, 4); x2("(?:a?)?\?", "a", 0, 0); x2("(?:a?\?)?", "a", 0, 0); x2("(?:a?)+?", "aaa", 0, 1); x2("(?:a+)?\?", "aaa", 0, 0); x2("(?:a+)?\?b", "aaab", 0, 4); x2("(?:ab)?{2}", "", 0, 0); x2("(?:ab)?{2}", "ababa", 0, 4); x2("(?:ab)*{0}", "ababa", 0, 0); x2("(?:ab){3,}", "abababab", 0, 8); n("(?:ab){3,}", "abab"); x2("(?:ab){2,4}", "ababab", 0, 6); x2("(?:ab){2,4}", "ababababab", 0, 8); x2("(?:ab){2,4}?", "ababababab", 0, 4); x2("(?:ab){,}", "ab{,}", 0, 5); x2("(?:abc)+?{2}", "abcabcabc", 0, 6); x2("(?:X*)(?i:xa)", "XXXa", 0, 4); x2("(d+)([^abc]z)", "dddz", 0, 4); x2("([^abc]*)([^abc]z)", "dddz", 0, 4); x2("(\\w+)(\\wz)", "dddz", 0, 4); x3("(a)", "a", 0, 1, 1); x3("(ab)", "ab", 0, 2, 1); x2("((ab))", "ab", 0, 2); x3("((ab))", "ab", 0, 2, 1); x3("((ab))", "ab", 0, 2, 2); x3("((((((((((((((((((((ab))))))))))))))))))))", "ab", 0, 2, 20); x3("(ab)(cd)", "abcd", 0, 2, 1); x3("(ab)(cd)", "abcd", 2, 4, 2); x3("()(a)bc(def)ghijk", "abcdefghijk", 3, 6, 3); x3("(()(a)bc(def)ghijk)", "abcdefghijk", 3, 6, 4); x2("(^a)", "a", 0, 1); x3("(a)|(a)", "ba", 1, 2, 1); x3("(^a)|(a)", "ba", 1, 2, 2); x3("(a?)", "aaa", 0, 1, 1); x3("(a*)", "aaa", 0, 3, 1); x3("(a*)", "", 0, 0, 1); x3("(a+)", "aaaaaaa", 0, 7, 1); x3("(a+|b*)", "bbbaa", 0, 3, 1); x3("(a+|b?)", "bbbaa", 0, 1, 1); x3("(abc)?", "abc", 0, 3, 1); x3("(abc)*", "abc", 0, 3, 1); x3("(abc)+", "abc", 0, 3, 1); x3("(xyz|abc)+", "abc", 0, 3, 1); x3("([xyz][abc]|abc)+", "abc", 0, 3, 1); x3("((?i:abc))", "AbC", 0, 3, 1); x2("(abc)(?i:\\1)", "abcABC", 0, 6); x3("((?m:a.c))", "a\nc", 0, 3, 1); x3("((?=az)a)", "azb", 0, 1, 1); x3("abc|(.abd)", "zabd", 0, 4, 1); x2("(?:abc)|(ABC)", "abc", 0, 3); x3("(?i:(abc))|(zzz)", "ABC", 0, 3, 1); x3("a*(.)", "aaaaz", 4, 5, 1); x3("a*?(.)", "aaaaz", 0, 1, 1); x3("a*?(c)", "aaaac", 4, 5, 1); x3("[bcd]a*(.)", "caaaaz", 5, 6, 1); x3("(\\Abb)cc", "bbcc", 0, 2, 1); n("(\\Abb)cc", "zbbcc"); x3("(^bb)cc", "bbcc", 0, 2, 1); n("(^bb)cc", "zbbcc"); x3("cc(bb$)", "ccbb", 2, 4, 1); n("cc(bb$)", "ccbbb"); n("(\\1)", ""); n("\\1(a)", "aa"); n("(a(b)\\1)\\2+", "ababb"); n("(?:(?:\\1|z)(a))+$", "zaa"); x2("(?:(?:\\1|z)(a))+$", "zaaa", 0, 4); x2("(a)(?=\\1)", "aa", 0, 1); n("(a)$|\\1", "az"); x2("(a)\\1", "aa", 0, 2); n("(a)\\1", "ab"); x2("(a?)\\1", "aa", 0, 2); x2("(a?\?)\\1", "aa", 0, 0); x2("(a*)\\1", "aaaaa", 0, 4); x3("(a*)\\1", "aaaaa", 0, 2, 1); x2("a(b*)\\1", "abbbb", 0, 5); x2("a(b*)\\1", "ab", 0, 1); x2("(a*)(b*)\\1\\2", "aaabbaaabb", 0, 10); x2("(a*)(b*)\\2", "aaabbbb", 0, 7); x2("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 8); x3("(((((((a*)b))))))c\\7", "aaabcaaa", 0, 3, 7); x2("(a)(b)(c)\\2\\1\\3", "abcbac", 0, 6); x2("([a-d])\\1", "cc", 0, 2); x2("(\\w\\d\\s)\\1", "f5 f5 ", 0, 6); n("(\\w\\d\\s)\\1", "f5 f5"); x2("(who|[a-c]{3})\\1", "whowho", 0, 6); x2("...(who|[a-c]{3})\\1", "abcwhowho", 0, 9); x2("(who|[a-c]{3})\\1", "cbccbc", 0, 6); x2("(^a)\\1", "aa", 0, 2); n("(^a)\\1", "baa"); n("(a$)\\1", "aa"); n("(ab\\Z)\\1", "ab"); x2("(a*\\Z)\\1", "a", 1, 1); x2(".(a*\\Z)\\1", "ba", 1, 2); x3("(.(abc)\\2)", "zabcabc", 0, 7, 1); x3("(.(..\\d.)\\2)", "z12341234", 0, 9, 1); x2("((?i:az))\\1", "AzAz", 0, 4); n("((?i:az))\\1", "Azaz"); x2("(?<=a)b", "ab", 1, 2); n("(?<=a)b", "bb"); x2("(?<=a|b)b", "bb", 1, 2); x2("(?<=a|bc)b", "bcb", 2, 3); x2("(?<=a|bc)b", "ab", 1, 2); x2("(?<=a|bc||defghij|klmnopq|r)z", "rz", 1, 2); x2("(a)\\g<1>", "aa", 0, 2); x2("(?a)", "a", 0, 1); x2("(?ab)\\g", "abab", 0, 4); x2("(?.zv.)\\k", "azvbazvb", 0, 8); x2("(?<=\\g)|-\\zEND (?XyZ)", "XyZ", 3, 3); x2("(?|a\\g)+", "", 0, 0); x2("(?|\\(\\g\\))+$", "()(())", 0, 6); x3("\\g(?.){0}", "X", 0, 1, 1); x2("\\g(abc|df(?.YZ){2,8}){0}", "XYZ", 0, 3); x2("\\A(?(a\\g)|)\\z", "aaaa", 0, 4); x2("(?|\\g\\g)\\z|\\zEND (?a|(b)\\g)", "bbbbabba", 0, 8); x2("(?\\w+\\sx)a+\\k", " fg xaaaaaaaafg x", 2, 18); x3("(z)()()(?<_9>a)\\g<_9>", "zaa", 2, 3, 1); x2("(.)(((?<_>a)))\\k<_>", "zaa", 0, 3); x2("((?\\d)|(?\\w))(\\k|\\k)", "ff", 0, 2); x2("(?:(?)|(?efg))\\k", "", 0, 0); x2("(?:(?abc)|(?efg))\\k", "abcefgefg", 3, 9); n("(?:(?abc)|(?efg))\\k", "abcefg"); x2("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "a-pyumpyum", 2, 10); x3("(?:(?.)|(?..)|(?...)|(?....)|(?.....)|(?......)|(?.......)|(?........)|(?.........)|(?..........)|(?...........)|(?............)|(?.............)|(?..............))\\k$", "xxxxabcdefghijklmnabcdefghijklmn", 4, 18, 14); x3("(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?)(?aaa)(?)$", "aaa", 0, 3, 16); x2("(?a|\\(\\g\\))", "a", 0, 1); x2("(?a|\\(\\g\\))", "((((((a))))))", 0, 13); x3("(?a|\\(\\g\\))", "((((((((a))))))))", 0, 17, 1); x2("\\g|\\zEND(?.*abc$)", "abcxxxabc", 0, 9); x2("\\g<1>|\\zEND(.a.)", "bac", 0, 3); x3("\\g<_A>\\g<_A>|\\zEND(.a.)(?<_A>.b.)", "xbxyby", 3, 6, 1); x2("\\A(?:\\g|\\g|\\zEND (?a|c\\gc)(?b|d\\gd))$", "cdcbcdc", 0, 7); x2("\\A(?|a\\g)\\z|\\zEND (?\\g)", "aaaa", 0, 4); x2("(?(a|b\\gc){3,5})", "baaaaca", 1, 5); x2("(?(a|b\\gc){3,5})", "baaaacaaaaa", 0, 10); x2("(?\\(([^\\(\\)]++|\\g)*+\\))", "((a))", 0, 5); x2("()*\\1", "", 0, 0); x2("(?:()|())*\\1\\2", "", 0, 0); x3("(?:\\1a|())*", "a", 0, 0, 1); x2("x((.)*)*x", "0x1x2x3", 1, 6); x2("x((.)*)*x(?i:\\1)\\Z", "0x1x2x1X2", 1, 9); x2("(?:()|()|()|()|()|())*\\2\\5", "", 0, 0); x2("(?:()|()|()|(x)|()|())*\\2b\\5", "b", 0, 1); x2("\\xED\\xF2", "\xed\xf2", 0, 2); x2("", "‚ ", 0, 0); x2("‚ ", "‚ ", 0, 2); n("‚¢", "‚ "); x2("‚¤‚¤", "‚¤‚¤", 0, 4); x2("‚ ‚¢‚¤", "‚ ‚¢‚¤", 0, 6); x2("‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±", "‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±‚±", 0, 70); x2("‚ ", "‚¢‚ ", 2, 4); x2("‚¢‚¤", "‚ ‚¢‚¤", 2, 6); x2("\\xca\\xb8", "\xca\xb8", 0, 2); x2(".", "‚ ", 0, 2); x2("..", "‚©‚«", 0, 4); x2("\\w", "‚¨", 0, 2); n("\\W", "‚ "); x2("[\\W]", "‚¤$", 2, 3); x2("\\S", "‚»", 0, 2); x2("\\S", "Š¿", 0, 2); x2("\\b", "‹C ", 0, 0); x2("\\b", " ‚Ù", 1, 1); x2("\\B", "‚¹‚» ", 2, 2); x2("\\B", "‚¤ ", 3, 3); x2("\\B", " ‚¢", 0, 0); x2("[‚½‚¿]", "‚¿", 0, 2); n("[‚ȂÉ]", "‚Ê"); x2("[‚¤-‚¨]", "‚¦", 0, 2); n("[^‚¯]", "‚¯"); x2("[\\w]", "‚Ë", 0, 2); n("[\\d]", "‚Ó"); x2("[\\D]", "‚Í", 0, 2); n("[\\s]", "‚­"); x2("[\\S]", "‚Ö", 0, 2); x2("[\\w\\d]", "‚æ", 0, 2); x2("[\\w\\d]", " ‚æ", 3, 5); n("\\w‹SŽÔ", " ‹SŽÔ"); x2("‹S\\WŽÔ", "‹S ŽÔ", 0, 5); x2("‚ .‚¢.‚¤", "‚ ‚ ‚¢‚¢‚¤", 0, 10); x2(".\\w‚¤\\W..‚¼", "‚¦‚¤‚¤ ‚¤‚¼‚¼", 0, 13); x2("\\s\\w‚±‚±‚±", " ‚±‚±‚±‚±", 0, 9); x2("‚ ‚ .‚¯", "‚ ‚ ‚¯‚¯", 0, 8); n(".‚¢", "‚¢‚¦"); x2(".‚¨", "‚¨‚¨", 0, 4); x2("^‚ ", "‚ ", 0, 2); x2("^‚Þ$", "‚Þ", 0, 2); x2("^\\w$", "‚É", 0, 2); x2("^\\w‚©‚«‚­‚¯‚±$", "z‚©‚«‚­‚¯‚±", 0, 11); x2("^\\w...‚¤‚¦‚¨$", "z‚ ‚¢‚¤‚¤‚¦‚¨", 0, 13); x2("\\w\\w\\s\\W‚¨‚¨‚¨\\d", "a‚¨ ‚¨‚¨‚¨4", 0, 12); x2("\\A‚½‚¿‚Â", "‚½‚¿‚Â", 0, 6); x2("‚ނ߂à\\Z", "‚ނ߂à", 0, 6); x2("‚©‚«‚­\\z", "‚©‚«‚­", 0, 6); x2("‚©‚«‚­\\Z", "‚©‚«‚­\n", 0, 6); x2("\\G‚ۂÒ", "‚ۂÒ", 0, 4); n("\\G‚¦", "‚¤‚¦‚¨"); n("‚ƂÄ\\G", "‚ƂÄ"); n("‚܂Ý\\A", "‚܂Ý"); n("‚Ü\\A‚Ý", "‚܂Ý"); x2("(?=‚¹)‚¹", "‚¹", 0, 2); n("(?=‚¤).", "‚¢"); x2("(?!‚¤)‚©", "‚©", 0, 2); n("(?!‚Æ)‚ ", "‚Æ"); x2("(?i:‚ )", "‚ ", 0, 2); x2("(?i:‚Ԃ×)", "‚Ԃ×", 0, 4); n("(?i:‚¢)", "‚¤"); x2("(?m:‚æ.)", "‚æ\n", 0, 3); x2("(?m:.‚ß)", "‚Ü\n‚ß", 2, 5); x2("‚ ?", "", 0, 0); x2("•Ï?", "‰»", 0, 0); x2("•Ï?", "•Ï", 0, 2); x2("—Ê*", "", 0, 0); x2("—Ê*", "—Ê", 0, 2); x2("Žq*", "ŽqŽqŽq", 0, 6); x2("”n*", "Ž­”n”n”n”n", 0, 0); n("ŽR+", ""); x2("‰Í+", "‰Í", 0, 2); x2("Žž+", "ŽžŽžŽžŽž", 0, 8); x2("‚¦+", "‚¦‚¦‚¤‚¤‚¤", 0, 4); x2("‚¤+", "‚¨‚¤‚¤‚¤‚¤", 2, 10); x2(".?", "‚½", 0, 2); x2(".*", "‚ς҂ՂØ", 0, 8); x2(".+", "‚ë", 0, 2); x2(".+", "‚¢‚¤‚¦‚©\n", 0, 8); x2("‚ |‚¢", "‚ ", 0, 2); x2("‚ |‚¢", "‚¢", 0, 2); x2("‚ ‚¢|‚¢‚¤", "‚ ‚¢", 0, 4); x2("‚ ‚¢|‚¢‚¤", "‚¢‚¤", 0, 4); x2("‚ð(?:‚©‚«|‚«‚­)", "‚ð‚©‚«", 0, 6); x2("‚ð(?:‚©‚«|‚«‚­)‚¯", "‚ð‚«‚­‚¯", 0, 8); x2("‚ ‚¢|(?:‚ ‚¤|‚ ‚ð)", "‚ ‚ð", 0, 4); x2("‚ |‚¢|‚¤", "‚¦‚¤", 2, 4); x2("‚ |‚¢|‚¤‚¦|‚¨‚©‚«|‚­|‚¯‚±‚³|‚µ‚·‚¹|‚»|‚½‚¿|‚‚ĂƂȂÉ|‚ʂË", "‚µ‚·‚¹", 0, 6); n("‚ |‚¢|‚¤‚¦|‚¨‚©‚«|‚­|‚¯‚±‚³|‚µ‚·‚¹|‚»|‚½‚¿|‚‚ĂƂȂÉ|‚ʂË", "‚·‚¹"); x2("‚ |^‚í", "‚Ԃ ", 2, 4); x2("‚ |^‚ð", "‚ð‚ ", 0, 2); x2("‹S|\\GŽÔ", "‚¯ŽԋS", 4, 6); x2("‹S|\\GŽÔ", "ŽԋS", 0, 2); x2("‹S|\\AŽÔ", "bŽԋS", 3, 5); x2("‹S|\\AŽÔ", "ŽÔ", 0, 2); x2("‹S|ŽÔ\\Z", "ŽԋS", 2, 4); x2("‹S|ŽÔ\\Z", "ŽÔ", 0, 2); x2("‹S|ŽÔ\\Z", "ŽÔ\n", 0, 2); x2("‹S|ŽÔ\\z", "ŽԋS", 2, 4); x2("‹S|ŽÔ\\z", "ŽÔ", 0, 2); x2("\\w|\\s", "‚¨", 0, 2); x2("\\w|%", "%‚¨", 0, 1); x2("\\w|[&$]", "‚¤&", 0, 2); x2("[‚¢-‚¯]", "‚¤", 0, 2); x2("[‚¢-‚¯]|[^‚©-‚±]", "‚ ", 0, 2); x2("[‚¢-‚¯]|[^‚©-‚±]", "‚©", 0, 2); x2("[^‚ ]", "\n", 0, 1); x2("(?:‚ |[‚¤-‚«])|‚¢‚ð", "‚¤‚ð", 0, 2); x2("(?:‚ |[‚¤-‚«])|‚¢‚ð", "‚¢‚ð", 0, 4); x2("‚ ‚¢‚¤|(?=‚¯‚¯)..‚Ù", "‚¯‚¯‚Ù", 0, 6); x2("‚ ‚¢‚¤|(?!‚¯‚¯)..‚Ù", "‚ ‚¢‚Ù", 0, 6); x2("(?=‚ð‚ )..‚ |(?=‚ð‚ð)..‚ ", "‚ð‚ð‚ ", 0, 6); x2("(?<=‚ |‚¢‚¤)‚¢", "‚¢‚¤‚¢", 4, 6); n("(?>‚ |‚ ‚¢‚¦)‚¤", "‚ ‚¢‚¦‚¤"); x2("(?>‚ ‚¢‚¦|‚ )‚¤", "‚ ‚¢‚¦‚¤", 0, 8); x2("‚ ?|‚¢", "‚ ", 0, 2); x2("‚ ?|‚¢", "‚¢", 0, 0); x2("‚ ?|‚¢", "", 0, 0); x2("‚ *|‚¢", "‚ ‚ ", 0, 4); x2("‚ *|‚¢*", "‚¢‚ ", 0, 0); x2("‚ *|‚¢*", "‚ ‚¢", 0, 2); x2("[a‚ ]*|‚¢*", "a‚ ‚¢‚¢‚¢", 0, 3); x2("‚ +|‚¢*", "", 0, 0); x2("‚ +|‚¢*", "‚¢‚¢‚¢", 0, 6); x2("‚ +|‚¢*", "‚ ‚¢‚¢‚¢", 0, 2); x2("‚ +|‚¢*", "a‚ ‚¢‚¢‚¢", 0, 0); n("‚ +|‚¢+", ""); x2("(‚ |‚¢)?", "‚¢", 0, 2); x2("(‚ |‚¢)*", "‚¢‚ ", 0, 4); x2("(‚ |‚¢)+", "‚¢‚ ‚¢", 0, 6); x2("(‚ ‚¢|‚¤‚ )+", "‚¤‚ ‚ ‚¢‚¤‚¦", 0, 8); x2("(‚ ‚¢|‚¤‚¦)+", "‚¤‚ ‚ ‚¢‚¤‚¦", 4, 12); x2("(‚ ‚¢|‚¤‚ )+", "‚ ‚ ‚¢‚¤‚ ", 2, 10); x2("(‚ ‚¢|‚¤‚ )+", "‚ ‚¢‚ð‚¤‚ ", 0, 4); x2("(‚ ‚¢|‚¤‚ )+", "$$zzzz‚ ‚¢‚ð‚¤‚ ", 6, 10); x2("(‚ |‚¢‚ ‚¢)+", "‚ ‚¢‚ ‚¢‚ ", 0, 10); x2("(‚ |‚¢‚ ‚¢)+", "‚¢‚ ", 2, 4); x2("(‚ |‚¢‚ ‚¢)+", "‚¢‚ ‚ ‚ ‚¢‚ ", 2, 8); x2("(?:‚ |‚¢)(?:‚ |‚¢)", "‚ ‚¢", 0, 4); x2("(?:‚ *|‚¢*)(?:‚ *|‚¢*)", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 6); x2("(?:‚ *|‚¢*)(?:‚ +|‚¢+)", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 12); x2("(?:‚ +|‚¢+){2}", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 12); x2("(?:‚ +|‚¢+){1,2}", "‚ ‚ ‚ ‚¢‚¢‚¢", 0, 12); x2("(?:‚ +|\\A‚¢*)‚¤‚¤", "‚¤‚¤", 0, 4); n("(?:‚ +|\\A‚¢*)‚¤‚¤", "‚ ‚¢‚¤‚¤"); x2("(?:^‚ +|‚¢+)*‚¤", "‚ ‚ ‚¢‚¢‚¢‚ ‚¢‚¤", 12, 16); x2("(?:^‚ +|‚¢+)*‚¤", "‚ ‚ ‚¢‚¢‚¢‚¢‚¤", 0, 14); x2("‚¤{0,}", "‚¤‚¤‚¤‚¤", 0, 8); x2("‚ |(?i)c", "C", 0, 1); x2("(?i)c|‚ ", "C", 0, 1); x2("(?i:‚ )|a", "a", 0, 1); n("(?i:‚ )|a", "A"); x2("[‚ ‚¢‚¤]?", "‚ ‚¢‚¤", 0, 2); x2("[‚ ‚¢‚¤]*", "‚ ‚¢‚¤", 0, 6); x2("[^‚ ‚¢‚¤]*", "‚ ‚¢‚¤", 0, 0); n("[^‚ ‚¢‚¤]+", "‚ ‚¢‚¤"); x2("‚ ?\?", "‚ ‚ ‚ ", 0, 0); x2("‚¢‚ ?\?‚¢", "‚¢‚ ‚¢", 0, 6); x2("‚ *?", "‚ ‚ ‚ ", 0, 0); x2("‚¢‚ *?", "‚¢‚ ‚ ", 0, 2); x2("‚¢‚ *?‚¢", "‚¢‚ ‚ ‚¢", 0, 8); x2("‚ +?", "‚ ‚ ‚ ", 0, 2); x2("‚¢‚ +?", "‚¢‚ ‚ ", 0, 4); x2("‚¢‚ +?‚¢", "‚¢‚ ‚ ‚¢", 0, 8); x2("(?:“V?)?\?", "“V", 0, 0); x2("(?:“V?\?)?", "“V", 0, 0); x2("(?:–²?)+?", "–²–²–²", 0, 2); x2("(?:•—+)?\?", "•—•—•—", 0, 0); x2("(?:�á+)?\?‘š", "�á�á�ᑚ", 0, 8); x2("(?:‚ ‚¢)?{2}", "", 0, 0); x2("(?:‹SŽÔ)?{2}", "‹SŽԋSŽԋS", 0, 8); x2("(?:‹SŽÔ)*{0}", "‹SŽԋSŽԋS", 0, 0); x2("(?:‹SŽÔ){3,}", "‹SŽԋSŽԋSŽԋSŽÔ", 0, 16); n("(?:‹SŽÔ){3,}", "‹SŽԋSŽÔ"); x2("(?:‹SŽÔ){2,4}", "‹SŽԋSŽԋSŽÔ", 0, 12); x2("(?:‹SŽÔ){2,4}", "‹SŽԋSŽԋSŽԋSŽԋSŽÔ", 0, 16); x2("(?:‹SŽÔ){2,4}?", "‹SŽԋSŽԋSŽԋSŽԋSŽÔ", 0, 8); x2("(?:‹SŽÔ){,}", "‹SŽÔ{,}", 0, 7); x2("(?:‚©‚«‚­)+?{2}", "‚©‚«‚­‚©‚«‚­‚©‚«‚­", 0, 12); x3("(‰Î)", "‰Î", 0, 2, 1); x3("(‰ΐ…)", "‰ΐ…", 0, 4, 1); x2("((ŽžŠÔ))", "ŽžŠÔ", 0, 4); x3("((•—�…))", "•—�…", 0, 4, 1); x3("((�ð“ú))", "�ð“ú", 0, 4, 2); x3("((((((((((((((((((((—ʎq))))))))))))))))))))", "—ʎq", 0, 4, 20); x3("(‚ ‚¢)(‚¤‚¦)", "‚ ‚¢‚¤‚¦", 0, 4, 1); x3("(‚ ‚¢)(‚¤‚¦)", "‚ ‚¢‚¤‚¦", 4, 8, 2); x3("()(‚ )‚¢‚¤(‚¦‚¨‚©)‚«‚­‚¯‚±", "‚ ‚¢‚¤‚¦‚¨‚©‚«‚­‚¯‚±", 6, 12, 3); x3("(()(‚ )‚¢‚¤(‚¦‚¨‚©)‚«‚­‚¯‚±)", "‚ ‚¢‚¤‚¦‚¨‚©‚«‚­‚¯‚±", 6, 12, 4); x3(".*(ƒtƒH)ƒ“�Eƒ}(ƒ“()ƒVƒ…ƒ^)ƒCƒ“", "ƒtƒHƒ“�Eƒ}ƒ“ƒVƒ…ƒ^ƒCƒ“", 10, 18, 2); x2("(^‚ )", "‚ ", 0, 2); x3("(‚ )|(‚ )", "‚¢‚ ", 2, 4, 1); x3("(^‚ )|(‚ )", "‚¢‚ ", 2, 4, 2); x3("(‚ ?)", "‚ ‚ ‚ ", 0, 2, 1); x3("(‚Ü*)", "‚܂܂Ü", 0, 6, 1); x3("(‚Æ*)", "", 0, 0, 1); x3("(‚é+)", "‚é‚é‚é‚é‚é‚é‚é", 0, 14, 1); x3("(‚Ó+|‚Ö*)", "‚ӂӂӂւÖ", 0, 6, 1); x3("(‚ +|‚¢?)", "‚¢‚¢‚¢‚ ‚ ", 0, 2, 1); x3("(‚ ‚¢‚¤)?", "‚ ‚¢‚¤", 0, 6, 1); x3("(‚ ‚¢‚¤)*", "‚ ‚¢‚¤", 0, 6, 1); x3("(‚ ‚¢‚¤)+", "‚ ‚¢‚¤", 0, 6, 1); x3("(‚³‚µ‚·|‚ ‚¢‚¤)+", "‚ ‚¢‚¤", 0, 6, 1); x3("([‚ȂɂÊ][‚©‚«‚­]|‚©‚«‚­)+", "‚©‚«‚­", 0, 6, 1); x3("((?i:‚ ‚¢‚¤))", "‚ ‚¢‚¤", 0, 6, 1); x3("((?m:‚ .‚¤))", "‚ \n‚¤", 0, 5, 1); x3("((?=‚ ‚ñ)‚ )", "‚ ‚ñ‚¢", 0, 2, 1); x3("‚ ‚¢‚¤|(.‚ ‚¢‚¦)", "‚񂠂¢‚¦", 0, 8, 1); x3("‚ *(.)", "‚ ‚ ‚ ‚ ‚ñ", 8, 10, 1); x3("‚ *?(.)", "‚ ‚ ‚ ‚ ‚ñ", 0, 2, 1); x3("‚ *?(‚ñ)", "‚ ‚ ‚ ‚ ‚ñ", 8, 10, 1); x3("[‚¢‚¤‚¦]‚ *(.)", "‚¦‚ ‚ ‚ ‚ ‚ñ", 10, 12, 1); x3("(\\A‚¢‚¢)‚¤‚¤", "‚¢‚¢‚¤‚¤", 0, 4, 1); n("(\\A‚¢‚¢)‚¤‚¤", "‚񂢂¢‚¤‚¤"); x3("(^‚¢‚¢)‚¤‚¤", "‚¢‚¢‚¤‚¤", 0, 4, 1); n("(^‚¢‚¢)‚¤‚¤", "‚񂢂¢‚¤‚¤"); x3("‚ë‚ë(‚é‚é$)", "‚ë‚ë‚é‚é", 4, 8, 1); n("‚ë‚ë(‚é‚é$)", "‚ë‚ë‚é‚é‚é"); x2("(–³)\\1", "–³–³", 0, 4); n("(–³)\\1", "–³•�"); x2("(‹ó?)\\1", "‹ó‹ó", 0, 4); x2("(‹ó?\?)\\1", "‹ó‹ó", 0, 0); x2("(‹ó*)\\1", "‹ó‹ó‹ó‹ó‹ó", 0, 8); x3("(‹ó*)\\1", "‹ó‹ó‹ó‹ó‹ó", 0, 4, 1); x2("‚ (‚¢*)\\1", "‚ ‚¢‚¢‚¢‚¢", 0, 10); x2("‚ (‚¢*)\\1", "‚ ‚¢", 0, 2); x2("(‚ *)(‚¢*)\\1\\2", "‚ ‚ ‚ ‚¢‚¢‚ ‚ ‚ ‚¢‚¢", 0, 20); x2("(‚ *)(‚¢*)\\2", "‚ ‚ ‚ ‚¢‚¢‚¢‚¢", 0, 14); x3("(‚ *)(‚¢*)\\2", "‚ ‚ ‚ ‚¢‚¢‚¢‚¢", 6, 10, 2); x2("(((((((‚Û*)‚Ø))))))‚Ò\\7", "‚ۂۂۂ؂҂ۂۂÛ", 0, 16); x3("(((((((‚Û*)‚Ø))))))‚Ò\\7", "‚ۂۂۂ؂҂ۂۂÛ", 0, 6, 7); x2("(‚Í)(‚Ð)(‚Ó)\\2\\1\\3", "‚͂ЂӂЂ͂Ó", 0, 12); x2("([‚«-‚¯])\\1", "‚­‚­", 0, 4); x2("(\\w\\d\\s)\\1", "‚ 5 ‚ 5 ", 0, 8); n("(\\w\\d\\s)\\1", "‚ 5 ‚ 5"); x2("(’N�H|[‚ -‚¤]{3})\\1", "’N�H’N�H", 0, 8); x2("...(’N�H|[‚ -‚¤]{3})\\1", "‚ a‚ ’N�H’N�H", 0, 13); x2("(’N�H|[‚ -‚¤]{3})\\1", "‚¤‚¢‚¤‚¤‚¢‚¤", 0, 12); x2("(^‚±)\\1", "‚±‚±", 0, 4); n("(^‚Þ)\\1", "‚߂ނÞ"); n("(‚ $)\\1", "‚ ‚ "); n("(‚ ‚¢\\Z)\\1", "‚ ‚¢"); x2("(‚ *\\Z)\\1", "‚ ", 2, 2); x2(".(‚ *\\Z)\\1", "‚¢‚ ", 2, 4); x3("(.(‚₢‚ä)\\2)", "z‚₢‚ä‚₢‚ä", 0, 13, 1); x3("(.(..\\d.)\\2)", "‚ 12341234", 0, 10, 1); x2("((?i:‚ v‚¸))\\1", "‚ v‚¸‚ v‚¸", 0, 10); x2("(?<‹ð‚©>•Ï|\\(\\g<‹ð‚©>\\))", "((((((•Ï))))))", 0, 14); x2("\\A(?:\\g<ˆ¢_1>|\\g<‰]_2>|\\z�I—¹ (?<ˆ¢_1>ŠÏ|Ž©\\g<‰]_2>Ž©)(?<‰]_2>�Ý|•ìŽF\\g<ˆ¢_1>•ìŽF))$", "•ìŽFŽ©•ìŽFŽ©�ݎ©•ìŽFŽ©•ìŽF", 0, 26); x2("[[‚ЂÓ]]", "‚Ó", 0, 2); x2("[[‚¢‚¨‚¤]‚©]", "‚©", 0, 2); n("[[^‚ ]]", "‚ "); n("[^[‚ ]]", "‚ "); x2("[^[^‚ ]]", "‚ ", 0, 2); x2("[[‚©‚«‚­]&&‚«‚­]", "‚­", 0, 2); n("[[‚©‚«‚­]&&‚«‚­]", "‚©"); n("[[‚©‚«‚­]&&‚«‚­]", "‚¯"); x2("[‚ -‚ñ&&‚¢-‚ð&&‚¤-‚ï]", "‚ï", 0, 2); n("[^‚ -‚ñ&&‚¢-‚ð&&‚¤-‚ï]", "‚ï"); x2("[[^‚ &&‚ ]&&‚ -‚ñ]", "‚¢", 0, 2); n("[[^‚ &&‚ ]&&‚ -‚ñ]", "‚ "); x2("[[^‚ -‚ñ&&‚¢‚¤‚¦‚¨]&&[^‚¤-‚©]]", "‚«", 0, 2); n("[[^‚ -‚ñ&&‚¢‚¤‚¦‚¨]&&[^‚¤-‚©]]", "‚¢"); x2("[^[^‚ ‚¢‚¤]&&[^‚¤‚¦‚¨]]", "‚¤", 0, 2); x2("[^[^‚ ‚¢‚¤]&&[^‚¤‚¦‚¨]]", "‚¦", 0, 2); n("[^[^‚ ‚¢‚¤]&&[^‚¤‚¦‚¨]]", "‚©"); x2("[‚ -&&-‚ ]", "-", 0, 1); x2("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]q-w]", "‚¦", 0, 2); x2("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]g-w]", "f", 0, 1); x2("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]g-w]", "g", 0, 1); n("[^[^a-z‚ ‚¢‚¤]&&[^bcdefg‚¤‚¦‚¨]g-w]", "2"); x2("aƒo�[ƒWƒ‡ƒ“‚̃_ƒEƒ“ƒ��[ƒh<\\/b>", "aƒo�[ƒWƒ‡ƒ“‚̃_ƒEƒ“ƒ��[ƒh", 0, 32); x2(".ƒo�[ƒWƒ‡ƒ“‚̃_ƒEƒ“ƒ��[ƒh<\\/b>", "aƒo�[ƒWƒ‡ƒ“‚̃_ƒEƒ“ƒ��[ƒh", 0, 32); fprintf(stdout, "\nRESULT SUCC: %d, FAIL: %d, ERROR: %d (by Oniguruma %s)\n", nsucc, nfail, nerror, onig_version()); #ifndef POSIX_TEST onig_region_free(region, 1); onig_end(); #endif return ((nfail == 0 && nerror == 0) ? 0 : -1); } jq-1.8.2/vendor/oniguruma/windows/CMakeLists.txt0000644000175100017510000000032015215513537015356 add_executable(testc_windows testc.c) target_link_libraries(testc_windows onig) if(NOT MSVC) target_compile_options(testc_windows PRIVATE -finput-charset=cp932 -fexec-charset=cp932 ) endif(NOT MSVC) jq-1.8.2/vendor/oniguruma/aclocal.m40000644000175100017510000012273615215513552013001 # generated automatically by aclocal 1.16.5 -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, [m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) jq-1.8.2/vendor/oniguruma/missing0000755000175100017510000001533615215513537012540 #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 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=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: jq-1.8.2/vendor/oniguruma/INSTALL0000644000175100017510000003661415215513537012174 Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2016 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 command './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 limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/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. jq-1.8.2/vendor/oniguruma/CMakeLists.txt0000644000175100017510000002016015215513537013670 cmake_minimum_required(VERSION 3.1...3.5) project(oniguruma VERSION 6.9.10 LANGUAGES C) set(PACKAGE onig) set(PACKAGE_VERSION ${PROJECT_VERSION}) option(BUILD_SHARED_LIBS "Build shared libraries" ON) option(ENABLE_POSIX_API "Include POSIX API" OFF) option(ENABLE_BINARY_COMPATIBLE_POSIX_API "Include Binary compatible POSIX API" OFF) option(ENABLE_STATISTICS "Include statistics API" OFF) option(INSTALL_DOCUMENTATION "Install documentation" ON) option(INSTALL_EXAMPLES "Install examples" OFF) option(BUILD_TEST "Build tests" ON) if(MSVC) option(MSVC_STATIC_RUNTIME "Build with static runtime" OFF) endif() set(USE_CRNL_AS_LINE_TERMINATOR 0) set(VERSION ${PACKAGE_VERSION}) include(CheckCSourceCompiles) include(CheckIncludeFiles) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckTypeSize) include(TestBigEndian) check_include_files(alloca.h HAVE_ALLOCA_H) check_include_files(stdint.h HAVE_STDINT_H) check_include_files(sys/times.h HAVE_SYS_TIMES_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(sys/types.h HAVE_SYS_TYPES_H) check_include_files(unistd.h HAVE_UNISTD_H) check_include_files(inttypes.h HAVE_INTTYPES_H) check_type_size(int SIZEOF_INT) check_type_size(long SIZEOF_LONG) check_type_size("long long" SIZEOF_LONG_LONG) check_type_size("void*" SIZEOF_VOIDP) if(HAVE_ALLOCA_H) check_symbol_exists(alloca "alloca.h" HAVE_ALLOCA) else() check_symbol_exists(alloca "stdlib.h;malloc.h" HAVE_ALLOCA) endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) set(_SRCS src/regint.h src/regparse.h src/regenc.h src/st.h src/regerror.c src/regparse.c src/regext.c src/regcomp.c src/regexec.c src/reggnu.c src/regenc.c src/regsyntax.c src/regtrav.c src/regversion.c src/st.c src/onig_init.c src/unicode.c src/ascii.c src/utf8.c src/utf16_be.c src/utf16_le.c src/utf32_be.c src/utf32_le.c src/euc_jp.c src/sjis.c src/iso8859_1.c src/iso8859_2.c src/iso8859_3.c src/iso8859_4.c src/iso8859_5.c src/iso8859_6.c src/iso8859_7.c src/iso8859_8.c src/iso8859_9.c src/iso8859_10.c src/iso8859_11.c src/iso8859_13.c src/iso8859_14.c src/iso8859_15.c src/iso8859_16.c src/euc_tw.c src/euc_kr.c src/big5.c src/gb18030.c src/koi8_r.c src/cp1251.c src/euc_jp_prop.c src/sjis_prop.c src/unicode_unfold_key.c src/unicode_fold1_key.c src/unicode_fold2_key.c src/unicode_fold3_key.c) set(_INST_HEADERS src/oniguruma.h src/oniggnu.h) if(ENABLE_POSIX_API OR ENABLE_BINARY_COMPATIBLE_POSIX_API) set(_SRCS ${_SRCS} src/regposix.c src/regposerr.c) set(_INST_HEADERS ${_INST_HEADERS} src/onigposix.h) add_definitions("-DUSE_POSIX_API") endif() if(ENABLE_BINARY_COMPATIBLE_POSIX_API) add_definitions("-DUSE_BINARY_COMPATIBLE_POSIX_API") endif() if(ENABLE_STATISTICS) add_definitions("-DONIG_DEBUG_STATISTICS") endif() add_library(onig ${_SRCS}) target_include_directories(onig PUBLIC $ $) target_compile_definitions(onig PUBLIC $<$>:ONIG_STATIC>) if(BUILD_SHARED_LIBS) # Parse SOVERSION information from LTVERSION in configure.ac file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" LTVERSION REGEX "^LTVERSION *= *\"?[0-9]+:[0-9]+:[0-9]+\"?") string(REGEX REPLACE "^LTVERSION *= *\"?([0-9]+:[0-9]+:[0-9]+)\"?.*$" "\\1" LTVERSION "${LTVERSION}") string(REGEX REPLACE "^([0-9]+):([0-9]+):([0-9]+)" "\\1" LTCURRENT ${LTVERSION}) string(REGEX REPLACE "^([0-9]+):([0-9]+):([0-9]+)" "\\2" LTREVISION ${LTVERSION}) string(REGEX REPLACE "^([0-9]+):([0-9]+):([0-9]+)" "\\3" LTAGE ${LTVERSION}) math(EXPR ONIG_SOVERSION "${LTCURRENT} - ${LTAGE}") set_target_properties(onig PROPERTIES SOVERSION "${ONIG_SOVERSION}" VERSION "${ONIG_SOVERSION}.${LTAGE}.${LTREVISION}") endif() if(MSVC) target_compile_options(onig PRIVATE #/W4 ) if(MSVC_STATIC_RUNTIME) target_compile_options(onig PRIVATE $<$:/MT> $<$:/MTd> $<$:/MT> $<$:/MTd> ) endif() if(MSVC_VERSION LESS_EQUAL "1800") # <= VS2013 target_compile_definitions(onig PRIVATE -Dinline=__inline ) endif() elseif(CMAKE_COMPILER_IS_GNUCC) target_compile_options(onig PRIVATE -Wall ) endif() # Installation (https://github.com/forexample/package-example) # Introduce variables: # * CMAKE_INSTALL_LIBDIR # * CMAKE_INSTALL_BINDIR # * CMAKE_INSTALL_INCLUDEDIR include(GNUInstallDirs) # Layout. This works for all platforms: # * /lib*/cmake/ # * /lib*/ # * /include/ set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") # Configuration set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") set(namespace "${PROJECT_NAME}::") # Include module with function 'write_basic_package_version_file' include(CMakePackageConfigHelpers) # Configure 'ConfigVersion.cmake' # Use: # * PROJECT_VERSION write_basic_package_version_file( "${version_config}" COMPATIBILITY SameMajorVersion ) # Configure 'Config.cmake' # Use variables: # * TARGETS_EXPORT_NAME # * PROJECT_NAME configure_package_config_file( "cmake/Config.cmake.in" "${project_config}" INSTALL_DESTINATION "${config_install_dir}" ) if(CMAKE_INSTALL_LIBDIR MATCHES "^/") set(onig_pkgconfig_libdir "${CMAKE_INSTALL_LIBDIR}") else() set(onig_pkgconfig_libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") endif() # Targets: # * /lib*/libonig.a # * header location after install: /include/ # * headers can be included by C code `#include ` install( TARGETS onig EXPORT "${TARGETS_EXPORT_NAME}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) # Headers: # * src/oniguruma.h -> /include/oniguruma install( FILES ${_INST_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) # Config # * /lib*/cmake/oniguruma/onigurumaConfig.cmake # * /lib*/cmake/oniguruma/onigurumaConfigVersion.cmake install( FILES "${project_config}" "${version_config}" DESTINATION "${config_install_dir}" ) # Config # * /lib*/cmake/oniguruma/onigurumaTargets.cmake install( EXPORT "${TARGETS_EXPORT_NAME}" NAMESPACE "${namespace}" DESTINATION "${config_install_dir}" ) # Documentation (uses onig not oniguruma for directory) if(INSTALL_DOCUMENTATION) install(FILES doc/API doc/API.ja doc/RE doc/RE.ja doc/FAQ doc/FAQ.ja doc/CALLOUTS.BUILTIN doc/CALLOUTS.BUILTIN.ja doc/CALLOUTS.API doc/CALLOUTS.API.ja doc/UNICODE_PROPERTIES DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/${PACKAGE}") # Other files (uses onig not oniguruma for directory) install(FILES AUTHORS COPYING HISTORY README.md DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/${PACKAGE}") endif() # Examples if(INSTALL_EXAMPLES) install(FILES sample/bug_fix.c sample/callback_each_match.c sample/callout.c sample/count.c sample/echo.c sample/encode.c sample/listcap.c sample/names.c sample/posix.c sample/regset.c sample/scan.c sample/simple.c sample/sql.c sample/syntax.c sample/user_property.c DESTINATION "${CMAKE_INSTALL_DATADIR}/examples/${PACKAGE}") endif() # pkg-config configure_file(${CMAKE_CURRENT_SOURCE_DIR}/oniguruma.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/oniguruma.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/onig-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/onig-config @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/oniguruma.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/onig-config DESTINATION "${CMAKE_INSTALL_BINDIR}") # Test if(BUILD_TEST) add_subdirectory(test) if(CMAKE_COMPILER_IS_GNUCC) add_subdirectory(windows) endif() endif(BUILD_TEST) jq-1.8.2/vendor/oniguruma/HISTORY0000644000175100017510000036512615215513537012232 History 2024/XX/XX: Version 6.9.10 2024/11/18: fix #312: Build failure with GCC 15 (C23) 2024/09/11: Update to Unicode 16.0 2024/06/20: fix #290: retry limit in match == 0 means unlimited 2024/06/15: add new callout (*SKIP) #299 2024/06/05: add new behavior ONIG_SYN_ALLOW_CHAR_TYPE_FOLLOWED_BY_MINUS_IN_CC (#298) 2024/05/28: fix #296: ONIG_SYNTAX_EMACS doesn't support 'shy groups' 2024/05/24: fix #295: Invalid result for empty match with anchors 2024/04/03: fix #293: Literal escaped braces 2024/04/02: fix total call with whole options 2024/04/01: fix #292: ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS not working for ^* pattern 2023/10/14: Version 6.9.9 2023/09/17: Update to Unicode 15.1.0 2023/07/11: Make sure oniguruma.pc is removed on distclean 2023/05/20: fix #284: .{0,99} and .* behave differently on short input 2023/03/27: fix call by number (?n), (?+n), (?-n) of ONIG_SYNTAX_PERL_NG 2023/03/27: fix #282: Dynamic library generated failed to support '(?-i)' 2022/12/30: add a new behavior ONIG_SYN_BRE_ANCHOR_AT_EDGE_OF_SUBEXP 2022/11/16: Changed the behavior of the FIND_LONGEST option to follow all alternatives 2022/09/16: Update to Unicode 15.0.0 2022/08/30: add ONIG_OPTION_MATCH_WHOLE_STRING 2022/08/28: fix ctype punct in Unicode encodings 2022/08/28: fix #268: [[:punct:]] isn't matching all expected symbols. [[:punct:]] = \p{PosixPunct} = \p{P} + \p{S} 2022/06/25: Make the behavior of \p{Word} exactly the same as \w for ignorecase 2022/06/24: (?I) invalid results for charcter classes (Issue #264) 2022/06/15: fix negative POSIX bracket bug 2022/06/03: Build tests with cmake+msvc 2022/04/29: Version 6.9.8 2022/04/11: implement whole option: (?C) 2022/04/07: implement whole option: (?L) 2022/04/04: implement whole option: (?I) 2022/03/15: fix: Insufficient backreference matching for the same name groups 2022/02/22: fix #250: ONIG_ESCAPE_REGEX_T_COLLISION doesn't work 2021/10/17: Update to Unicode 14.0 2021/08/29: fix: use CMAKE_INSTALL_LIBDIR as install lib dir, in some platforms, lib could be installed in lib64 dir but the .pc file is installed in lib dir. 2021/08/22: fix: Stack overflow for some very long patterns 2021/08/22: fix: Issue 37442 in oss-fuzz: Undefined-shift 2021/08/05: fix #239: CMake build fails to detect alloca on some platforms such as FreeBSD 2021/08/04: CMake: Make documentation and examples optional 2021/05/20: fix #235: 6.9.7 can't compile with Visual Studio 2005 2021/04/15: Version 6.9.7 revised 1 2021/04/14: fix: replace UChar to OnigUChar in oniguruma.h 2021/04/14: Version 6.9.7 2021/03/31: Release Candidate 1 for Version 6.9.7 2021/03/23: fix Issue 32340, 32345, 32355 in oss-fuzz 2021/03/12: fix invalid optimization info for if-pattern (?(cond)...) 2021/02/21: NEW API: ONIG_OPTION_CALLBACK_EACH_MATCH 2021/02/02: fix Issue 30144 in oss-fuzz: Timeout 2021/01/18: NEW API: ONIG_SYNTAX_PYTHON 2020/12/20: fix Issue 28795 in oss-fuzz: Timeout 2020/12/13: fix Issue 28554 in oss-fuzz: Timeout, check very inefficient patterns at tune_tree(NODE_CALL) 2020/12/04: fix Issue 28259 in oss-fuzz: Timeout 2020/12/03: fix invalid reduction of nested quantifiers (?:+?)* and (?:+?)+ 2020/12/01: fix Issue 28104 in oss-fuzz: Timeout 2020/11/28: NEW API: ONIG_OPTION_IGNORECASE_IS_ASCII 2020/11/07: fix Issue 27015 in oss-fuzz: Timeout 2020/11/05: Version 6.9.6 2020/11/01: fix Issue 26798 in oss-fuzz: Timeout 2020/10/27: fix Issue 26675 in oss-fuzz: Timeout 2020/10/21: Release Candidate 4 for Version 6.9.6 2020/10/20: #221: revert cbe9f8b and 8155473: Out-of-bounds write in #207 (Issues found with Coverity) is fake 2020/10/16: Release Candidate 3 for Version 6.9.6 2020/10/15: fix #220: autotools not building DLL using msys2 and mingw64 on windows 10 2020/10/12: fix #219: Binary incompatibilty between 6.9.5_rev1 -> 6.9.2_rc2: reg_number_of_names 2020/10/09: Release Candidate 2 for Version 6.9.6 2020/10/09: fix #216: build fails on Windows 2020/10/07: Release Candidate 1 for Version 6.9.6 2020/09/30: add configure option --enable-binary-compatible-posix-api 2020/09/24: fix: Issue 25893 in oss-fuzz: Stack-buffer-overflow 2020/09/22: fix Issues found with Coverity (Issue #207) 2020/08/27: fix Issue #204: define uint32_t and uint64_t for Visual Studio older than 2010 2020/08/04: fix Issue 24544 in oss-fuzz: Timeout 2020/07/21: add USE_CHECK_VALIDITY_OF_STRING_IN_TREE (fix Issue 24276 in oss-fuzz: Undefined-shift) 2020/07/20: fix: Issue 24268 in oss-fuzz: Timeout 2020/07/17: fix: Issue 24112 in oss-fuzz: Undefined-shift 2020/07/14: fix: Issue 24066 in oss-fuzz: Timeout 2020/07/05: fix: Incomplete application of ONIG_OPTION_NOTBOL to \A 2020/07/05: fix: Incomplete application of ONIG_OPTION_NOT_END_STRING to \Z (Issue #192) 2020/07/05: fix: Incomplete application of ONIG_OPTION_NOTEOL to \z 2020/07/05: fix: Incomplete application of ONIG_OPTION_NOTEOL to \Z 2020/07/01: add ONIG_OPTION_NOT_END_STRING (Issue #198) 2020/06/28: add ONIG_OPTION_NOT_BEGIN_POSITION (Issue #198) 2020/06/28: add ONIG_OPTION_NOT_BEGIN_STRING 2020/06/28: fix: Issue 23754 in oss-fuzz: Timeout 2020/06/21: fix: Issue 23525 in oss-fuzz: Timeout 2020/06/15: fix: Issue 23311 in oss-fuzz: Timeout 2020/06/03: fix: Issue 22925 in oss-fuzz: Index-out-of-bounds 2020/06/03: fix: Issue 22917 in oss-fuzz: Out-of-memory 2020/06/02: fix: Issue 22916 in oss-fuzz: Timeout 2020/05/29: fix: Issue 22744 in oss-fuzz: Integer-overflow 2020/05/28: fix: Issue 22658 in oss-fuzz: check backref with level 2020/05/28: fix: Issue 22533 in oss-fuzz: memory leak 2020/05/23: fix: Issue 22393 in oss-fuzz: Integer-overflow 2020/05/13: fix: Issue 22154 in oss-fuzz: When the option FIND_LONGEST is specified, match_at() returns ONIG_MISMATCH unless there is no need to search any more. 2020/05/06: Add SOVERSION info to library when using cmake 2020/05/04: fix: 22008 in oss-fuzz 2020/05/04: fix: 21998 in oss-fuzz 2020/05/03: fix: 21944, 21977 in oss-fuzz 2020/04/26: Version 6.9.5 revised 1 2020/04/24: fix #192: Unexpected regex match 2020/04/20: Version 6.9.5 2020/04/12: Release Candidate 2 for Version 6.9.5 2020/04/09: fix a problem (found by oss-fuzz test on my PC) 2020/04/05: Release Candidate 1 for Version 6.9.5 2020/03/30: remove src/*.py and src/*.sh from distribution files 2020/03/27: NEW: Code point sequence notation \x{HHHH ...}, \o{OOOO ...} 2020/03/24: NEW API: maximum nesting level of subexp call 2020/03/22: #165: change enable-posix-api default from YES to NO 2020/03/15: update Unicode version to 13.0.0 2020/03/10: add test_back.c 2020/03/08: tune output of debug in print_optimize_info() 2020/03/02: fix #186: Allow regset search to succeed at end of string 2020/02/13: NEW API: retry-limit-in-search functions 2020/01/20: add ONIG_SYN_VARIABLE_LEN_LOOK_BEHIND flag 2019/12/27: add USE_REGSET switch 2019/12/20: remove OPTIMIZE_STR_CASE_FOLD 2019/12/13: add test/test_syntax.c 2019/12/13: add ONIG_SYN_ISOLATED_OPTION_CONTINUE_BRANCH flag 2019/11/29: Version 6.9.4 2019/11/22: Release Candidate 3 for Version 6.9.4 2019/11/20: fix a problem found by libFuzzer test 2019/11/14: Release Candidate 2 for Version 6.9.4 2019/11/12: fix integer overflow by nested quantifier 2019/11/11: fix CVE-2019-19012: Integer overflow related to reg->dmax in search_in_range() 2019/11/07: fix CVE-2019-19203: heap-buffer-overflow in gb18030_mbc_enc_len() 2019/11/06: fix CVE-2019-19204: heap-buffer-overflow in fetch_interval_quantifier() 2019/11/06: add HAVE_INTTYPES_H into config.h.windows.in and config.h.win{32,64} 2019/11/06: add HAVE_STDINT_H into config.h.win{32,64} 2019/11/05: Release Candidate 1 for Version 6.9.4 2019/10/31: Update Unicode Emoji version to 12.1 (Nothing data changed) 2019/10/29: implement USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR configuration 2019/10/18: re-implement case fold conversion 2019/10/04: fix #156: Heap buffer overflow in match_at() with case-insensitive match 2019/09/30: NEW API: add onig_regset_replace() 2019/09/30: change Unicode VERSION value format 2019/09/20: NEW API: add regset functions 2019/09/20: add data ensure check before peek string value in OP_PUSH_IF_PEEK_NEXT 2019/09/20: fix loose code in encode-harness.c 2019/08/13: fix heap-buffer-overflow 2019/08/13: Add a macro to disable direct threading in the match engine (PR#149) 2019/08/06: Version 6.9.3 (secirity fix release) 2019/07/30: add ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC 2019/07/29: add STK_PREC_READ_START/END stack type 2019/07/29: Fix #147: Stack Exhaustion Problem caused by some parsing functions 2019/07/11: add a dictionary file for libfuzzer 2019/07/07: add harnesses directory 2019/07/05-2019/07/29: fix many problems found by libfuzzer programs 2019/06/27: deprecate onig_new_deluxe() 2019/06/27: Fix CVE-2019-13224: don't allow different encodings for onig_new_deluxe() 2019/06/27: Fix CVE-2019-13225: problem in converting if-then-else pattern 2019/05/07: Version 6.9.2 (same as Release Candidate 3) 2019/04/23: Release Candidate 3 for 6.9.2 2019/04/23: add doc/SYNTAX.md into distribution file 2019/04/09: Release Candidate 2 for 6.9.2 2019/04/09: fix #139: UAF in match_at() 2019/04/01: Release Candidate 1 for 6.9.2 2019/04/01: update Unicode version to 12.1.0 (draft) 2019/03/29: allow {n,m} (n>m) as possessive interval 2019/03/25: add ONIG_SYN_OP2_OPTION_ONIGURUMA 2019/03/22: add new options ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER and ONIG_OPTION_TEXT_SEGMENT_WORD 2019/03/21: PR #137: fix cross-compilation 2019/03/20: update Unicode version to 12.0.0 2019/03/17: add doc/SYNTAX.md 2019/03/13: {n,m}+ and {n,m}? are possessive and reluctant range operator in Perl syntax 2019/03/04: fix #132: don't execute testp if ENABLE_POSIX_API == no 2019/02/28: re-implement bytecode by using Operation struct 2019/02/26: fix #130: Build error on UWP with VS2017 2019/02/03: PR #128: regerror/toascii: do not attempt to serialize NULL pointer 2019/01/30: Build breaks without autoreconf #73 2019/01/02: fix #127: Windows VS 2008 build errors 2018/12/19: fix #126: Unable to compile when USE_CALLOUT is not defined 2018/12/11: Version 6.9.1 2018/10/08: use ENC_FLAG_SKIP_OFFSET_XXX values 2018/10/06: UTF-8 supports code range from 0x0000 to 0x10FFFF (https://tools.ietf.org/html/rfc3629) 2018/10/05: speed improvement 2018/10/03: use OPTIMIZE_STR_CASE_FOLD_FAST 2018/10/01: convert CRLF line endings to LF 2018/09/27: set SIZEOF_SIZE_T for windows platforms 2018/09/22: use Sunday quick search algorithm instead of Boyer-Moor-Horspool 2018/09/20: introduce threaded code into match_at() 2018/09/17: remove HAVE_STRINGS_H 2018/09/16: remove HAVE_PROTOTYPES and HAVE_STDARG_PROTOTYPES 2018/09/14: add a command line option '-gc' for make_unicode_property_data.py. 2018/09/08: remove AC_HEADER_STDC 2018/09/06: remove AC_OUTPUT macro call 2018/09/06: remove AC_FUNC_MEMCMP, AC_HEADER_TIME, AC_C_CONST, HAVE__SETJMP and HAVE_STRING_H 2018/09/05: remove HAVE_LIMITS_H, HAVE_FLOAT_H and HAVE_STDLIB_H 2018/09/03: Version 6.9.0 2018/08/24: add Unicode Emoji properties 2018/08/24: update Unicode version 11.0.0 2018/08/21: support gperf 3.1 instead of 3.0.4 2018/08/07: add ENABLE_POSIX_API switch into src/Makefile.windows 2018/08/02: add make_win.bat and src/config.h.windows.in 2018/06/25: add ENABLE_POSIX_API option into CMakeLists.txt 2018/06/04: add .travis.yml (for TravisCI) 2018/04/17: Version 6.8.2 2018/04/13: add doc/CALLOUTS.API.ja 2018/04/10: add doc/CALLOUTS.API 2018/04/10: fix #87: Read unknown address in onig_error_code_to_str() 2018/04/06: fix #86: typedef StateCheckNumType is unused 2018/04/02: update automake 1.16.1 2018/03/30: fix #84: stack-buffer-overflow in mbc_enc_len 2018/03/28: PR #83: Improve CMake build 2018/03/21: switch uses of UChar to OnigUChar in oniguruma.h (#80) 2018/03/19: Version 6.8.1 2018/03/19: update LTVERSION from 4:0:0 to 5:0:0 2018/03/19: add flag, sb_range etc.. into OnigEncodingType 2018/03/19: move regex structure from oniguruma.h to regint.h 2018/03/19: ONIGENC_CTYPE_XXX to be enum (Issue #33) 2018/03/16: Version 6.8.0 2018/03/12: add doc/CALLOUTS.BUILTIN for builtin callouts 2018/03/08: allow abbreviated notation for callouts (?(*name)..|..) (?(?{...})..|..) 2018/03/02: NEW API: move onigenc_strdup() from regenc.h to oniguruma.h 2018/02/21: remove all USE_COMBINATION_EXPLOSION_CHECK 2018/02/15: fix #78: bad definition of PV_() 2018/02/14: add configure option --enable-posix-api (for #77) 2018/02/08: implement callouts of name 2018/02/01: implement callouts of contents 2018/01/30: define ONIGURUMA_VERSION_INT 2018/01/29: enable USE_TRY_IN_MATCH_LIMIT by default 2018/01/29: NEW API: onig_search_with_param() onig_match_with_param() 2018/01/26: remove include windows.h from oniguruma.h 2018/01/26: Version 6.7.1 2018/01/25: disable USE_TRY_IN_MATCH_LIMIT by default 2018/01/24: implement mechanism of try-in-match-limit 2018/01/24: #76: rename EXPORT to ONIGURUMA_EXPORT 2018/01/15: #73: update for automake 1.15.1 2018/01/14: #74: update description of README 2018/01/10: #72: Correct spelling and grammar in FAQ (English) 2017/12/25: remove USE_COMBINATION_EXPLOSION_CHECK codes 2017/12/11: Version 6.7.0 2017/12/08: Disable \N and \O on ONIG_SYNTAX_RUBY 2017/12/08: add ONIG_SYNTAX_ONIGURUMA (default syntax) 2017/12/05: restructure StackType 2017/11/13: implement subexp calls (?R), (?&name), (?-n), (?+n) for Perl syntax 2017/09/25: use string pool of gperf for Unicode Property lookup function 2017/09/16: fix #70: an empty greedy regex and a word boundary (.*\b) fails 2017/09/13: remove a stack type STK_POS 2017/09/08: fix #69: add a declaration of onig_end() 2017/09/07: fix #68: Compilation failure in out-of-source build 2017/09/03: [new] hexadecimal codepoint \uHHHH 2017/08/30: Version 6.6.1 2017/08/29: fix definition of \X to (?>\O(?:\Y\O)*) 2017/08/28: Version 6.6.0 2017/08/26: fix #67: can't compile with Visual Studio 2005 2017/08/24: rename Absent clear to Range clear 2017/08/21: [new] Extended Grapheme Cluster \X and boundary \y, \Y 2017/08/17: fix: invalid index(ctype) value assigned to Unicode Block properties 2017/08/16: --enable-crnl-as-line-terminator to be deprecated 2017/08/15: [new] ASCII only mode options (?WDSP) 2017/08/14: [new] ONIG_OPTION_XXXX_IS_ASCII options 2017/08/11: disable OP_CCLASS_NODE 2017/08/11: [spec] Absent clear restore previous range value at backtrack 2017/08/07: optimize for simple one char repetition in Absent expression 2017/08/07: fix: invalid impl. for reluctant repetition in Absent expression 2017/08/04: remove compile switch USE_NAMED_GROUP 2017/08/03: Version 6.5.0 2017/07/30: [new] support Absent clear (Absent functions) 2017/07/25: abolish configure option: --enable-combination-explosion-check 2017/07/23: [new] support Absent functions (?~...) 2017/07/14: fix #65: SIZEOF_SIZE_T doesn't exist on certain architecutres 2017/07/11: [new] support \O (true anychar) 2017/07/10: [new] support \K (keep) 2017/07/10: add new node type: NODE_GIMMICK 2017/07/07: [new] support \N (no newline) 2017/07/05: [new] support \R (general newline) 2017/07/05: [new] support if-then-else syntax 2017/07/04: [new] support backref validity checker 2017/07/03: Version 6.4.0 2017/06/30: fix memory leaks 2017/06/29: fix memory leaks 2017/06/28: change encoding of doc/XXXX.ja from EUC-JP to UTF-8 2017/06/28: update doc/RE, and doc/RE.ja 2017/06/26: fix fatal bug of endless repeat check on Windows 2017/06/26: PR #62 : add check for return values 2017/06/23: [new] support call zero (\g{0}) 2017/06/23: [new] support relative call by positive number 2017/06/23: [new] support relative back-reference by positive number 2017/06/15: fix #60 : check value type 2017/06/02: change output format for ONIG_DEBUG_COMPILE and ONIG_DEBUG_MATCH 2017/05/29: Version 6.3.0 2017/05/24: fix #60 : invalid state(CCS_VALUE) in parse_char_class() 2017/05/24: fix #59 : access to invalid address by reg->dmax value 2017/05/23: fix invalid increment of start position in onig_scan() 2017/05/23: fix #58 : access to invalid address by reg->dmin value 2017/05/23: fix #57 : DATA_ENSURE() check must be before data access 2017/05/22: fix #56 : return invalid result for codepoint 0xFFFFFFFF 2017/05/19: [new] add \o{17777777777} syntax. 2017/05/19: fix #55 : Byte value expressed in octal must be smaller than 256 2017/04/08: Version 6.2.0 2017/03/15: fix: size in xmemcpy in stack_double (PR #51) 2017/02/21: Initialize return value 2017/01/03: NEW API: add onig_set_capture_num_limit() 2017/01/03: change MemNumType from short int to int 2016/12/13: fix: [0-9-a] was not allowed as [0-9\-a] 2016/12/13: fix: illegal capture after recursive call 2016/12/13: fix: problem with optimization of \z 2016/12/13: fix: .* optimization 2016/12/13: Set a limit of parser recursion 2016/12/12: fix; that warnings are not shown properly 2016/12/12: fix: /[a-c#]+\W/ =~ "def#" fails when encoding is UTF-16/32 2016/12/12: fix: /[\x{0}-X]/i doesn't match properly when UTF-16/32 is used. 2016/12/11: Version 6.1.3 2016/12/11: fix: Syntax error: redirection unexpected (expecting word) #35 2016/11/07: Version 6.1.2 2016/10/25: allow word bound, word begin and word end in look-behind. 2016/10/19: add ONIG_OPTION_CHECK_VALIDITY_OF_STRING option. 2016/10/16: fix use after free node. 2016/10/10: fix memory leaks after parsing regexp error. 2016/09/22: implement many of is_valid_mbc_string(). 2016/09/02: Version 6.1.1 2016/08/31: fix segfault /W.?{888}{888}{888}\x00/ (found by libfuzzer) 2016/08/31: fix error unmatched close parenthesis for %{(.*?)} #23 2016/08/29: Version 6.1.0 2016/08/28: add contributed/libfuzzer-onig.cpp (thanks hannob) 2016/08/28: update LTVERSION 4:0:0 2016/08/28: NEW API: onigenc_is_valid_mbc_string(). 2016/08/27: add is_valid_mbc_string() member into OnigEncodingType. 2016/08/27: fix out of bounds read. 2016/08/26: fix out of bounds read. 2016/08/25: disable USE_INVALID_CODE_SCHEME. 2016/08/24: fix out of bounds read. 2016/08/23: doc/RE improved. 2016/08/22: add onig_scan() into doc/API. 2016/08/22: fix bug: Out of bounds read in onig_strcpy() #17 2016/08/21: fix bug: infinite loop of backreference and group. 2016/08/21: fix out of bounds read in mbc_to_code() #16 2016/08/18: doc/RE refinements. 2016/08/16: add onig_scan() (NEW API) 2016/08/16: reimplement match stack allocation for case too many repeat and too many captures in regexp. 2016/08/15: number of captures <= 32767 for bytecode representation. 2016/07/17: don't use int_map_backward for thread-safe. 2016/07/04: fix case of enclosed option in look-behind. 2016/07/04: fix ignore case in look-behind. 2016/05/23: fix memory leak in onig_unicode_define_user_property() 2016/05/20: declare variables at the top of scope. (thanks nmaya) 2016/05/09: Version 6.0.0 2016/05/05: add NEW API: onig_unicode_define_user_property() 2016/05/04: update Unicode data to 8.0.0 2016/05/02: change OnigCodePoint type to unsigned int. 2016/05/02: add doc/UNICODE_PROPERTIES. 2016/04/19: add error code ONIGERR_FAIL_TO_INITIALIZE. 2016/04/18: add make_win64/32.bat. 2016/04/18: fix bug of uninitialized regex_t value on error. 2016/04/16: reimplement Unicode case folding. 2016/04/11: update LTVERSION = 3.0.0 2016/04/05: remove all THREAD_ macro. 2016/04/05: add init member into OnigEncoding. (add onig_initialize()) 2016/03/28: remove state member of regex. 2016/03/25: move source files into src/ 2016/03/23: rename configre.in to configure.ac. 2015/11/17: fix memory leak. (thanks pigzang) 2015/07/13: change mail address. 2014/12/12: Version 5.9.6 2013/11/27: [impl] add onigenc_end_unicode(). (thanks Takenori Imoto) 2013/11/27: [impl] add onig_add_end_call(). (thanks Takenori Imoto) 2013/10/21: Version 5.9.5 2013/10/21: [impl] escape warnings for -Wall. (regparse.c) 2013/10/21: [bug] fixes an issue on Windows x64. (thanks Anatoliy Belsky) The issue was discovered in PHP, see https://bugs.php.net/64769. 2013/10/21: [impl] remove unused variable. (regcomp.c) 2013/04/04: Version 5.9.4 2013/04/04: [dev] remove Makefile.in from git repository. 2013/04/04: [dist] add oniguruma.pc.in file. (for pkg-config) (thanks Giulio Paci) 2012/10/26: Version 5.9.3 2012/10/15: remove warnings "test: =: unary operator expected" in ./configure. (thanks t_okazaki) 2012/10/15: fix print_tree ENCLOSE_OPTION bug. (thanks Suraj N. Kurapati) 2010/01/09: Version 5.9.2 2010/01/05: [bug] fix utf16be_code_to_mbc() and utf16le_code_to_mbc(). 2008/09/16: [bug] fix memory leaks in parse_exp(). 2008/08/01: [bug] fix memory leaks. 2008/06/17: [bug] invalid type of argument was used in onig_st_lookup_strend(). 2008/06/16: [bug] invalid CaseFoldMap entry in ISO-8859-5. 0xdf -> 0xde 2008/02/19: [new] add: onig_reg_init(). 2008/02/19: [new] add: onig_free_body(). 2008/02/19: [new] add: onig_new_without_alloc(). 2008/02/19: [API] rename onig_alloc_init() to onig_reg_init(), and argument type changed. 2008/01/31: [impl] move UTF16_IS_SURROGATE_XXX() to regenc.h. 2008/01/30: [bug] (thanks akr) fix euctw_islead(). 2008/01/23: [bug] update enc/koi8.c. 2007/12/22: Version 5.9.1 2007/12/21: [impl] add sprint_byte(). 2007/11/28: [bug] (thanks Andy Armstrong) don't overwrite error code in fetch_name(). 2007/11/12: [bug] utf8 mbc length of code 0xfe, 0xff are not 1, 2007/10/23: [spec] onig_enc_len() takes three arguments. (not used) 2007/10/15: [impl] (thanks Rui Hirokawa) add check HAVE_STDARG_H. 2007/09/07: [API] rename enc_len() to onig_enc_len() in oniguruma.h. 2007/09/04: [API] remove ONIGENC_ERR_XXXXX. 2007/09/03: [API] add error ONIGERR_INVALID_CODE_POINT_VALUE. 2007/09/03: [impl] change error message to "invaid code point value" for ONIGERR_INVALID_WIDE_CHAR_VALUE. 2007/09/03: [bug] xxx_code_to_mbclen() should return ONIGERR_INVALID_WIDE_CHAR_VALUE for invalid code point. ex. /[\x{7fffffff}]/ for ASCII encoding. 2007/08/28: [impl] remove "warning: no previous declaration ...". 2007/08/21: [impl] remove warnings in enc/mktable.c. 2007/08/20: [impl] remove "warning: unused parameter" 2007/08/20: [impl] remove "warning: comparison between signed and unsigned". 2007/08/06: [impl] remove clear_not_flag_cclass(). 2007/08/03: [bug] fix the case of undefined USE_NAMED_GROUP. 2007/08/02: [spec] add backref by number. 2007/08/01: [API] add OnigCtype. 2007/07/27: [spec] add USE_CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS. 2007/07/24: [impl] define PLATFORM_UNALIGNED_WORD_ACCESS. 2007/07/23: [dist] fix doc/FAQ.ja. 2007/07/14: Version 5.9.0 2007/07/13: [bug] add check into onig_reduce_nested_quantifier(). 2007/06/26: [spec] (thanks K.Takata) ONIG_OPTION_SINGLELINE: '$' -> '\Z' (as Perl) 2007/06/26: [dist] (thanks K.Takata) fix documents API and API.ja. 2007/06/19: [impl] remove IS_NOT_NULL() check before onig_node_free(). 2007/06/18: [bug] (thanks KUBO Takehiro) WORD_ALIGNMENT_SIZE must be sizeof(OnigCodePoint). 2007/06/18: [impl] rename CClassNode flags. 2007/06/18: [bug] initialization miss. 2007/06/13: [impl] change node type reference NXXXX. 2007/06/11: [impl] add node type bit. 2007/06/11: [spec] allow anchor in enclosed repeater. /(\z)*/ 2007/06/11: [impl] rename node types. 2007/06/08: [impl] remove OP_SET_OPTION_PUSH and OP_SET_OPTION from match_at(). 2007/06/07: [impl] use xvsnprintf(). 2007/06/06: [tune] don't set qn->next_head_exact for string first byte is zero. 2007/06/06: [impl] remove unused variables. 2007/06/04: Version 5.8.0 2007/06/04: [impl] add #ifndef vsnprintf into regint.h. 2007/05/31: [dist] add configure option '--enable-crnl-as-line-terminator'. 2007/05/30: [dist] add sample/crnl.c. 2007/05/30: [bug] should check USE_CRNL_AS_LINE_TERMINATOR case in onig_search(). 2007/05/29: [impl] move USE_CRNL_AS_LINE_TERMINATOR into regenc.h. 2007/05/29: [impl] should check USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE in forward_search_range() and backward_search_range(). 2007/04/27: Version 5.7.0 2007/04/20: [spec] add config USE_MATCH_RANGE_IS_COMPLETE_RANGE. 2007/04/20: [impl] refactoring in match_at(). 2007/04/12: Version 5.6.1 2007/04/12: [bug] must not use UChar in oniguruma.h. 2007/04/09: [impl] change STATE_CHECK_BUFF_MAX_SIZE value from 0x8000 to 0x4000. [ruby-core:10883] 2007/04/04: Version 5.6.0 (mourning for Hideo Takamatsu) 2007/04/03: [spec] add new notation (?'name'), \k'name', \g'name'. 2007/04/03: [impl] remove unused variable. 2007/03/26: [impl] add 'void' to function declarations. 2007/03/06: Version 5.5.3 2007/03/06: [bug] add #include for bcc32. (In bcc32, alloca() is declared in malloc.h.) 2007/03/02: [bug] invalid optimization for semi-end-buf in onig_search(). ex. /\n\Z/.match("aaaaaaaaaa\n") 2007/03/02: [impl] move range > start check position in end_buf process. 2007/01/09: Version 5.5.2 2007/01/09: [impl] rename USE_EXTERNAL_LOWER_CASE_CONV_TABLE. 2007/01/05: [tune] select_opt_exact_info() didn't work for empty info. ex. /.a/ make MAP info instead of EXACT info. 2006/12/28: [impl] add print_enc_string() for ONIG_DEBUG mode. 2006/12/22: Version 5.5.1 2006/12/22: [impl] rename ADD_PAD_TO_SHORT_BYTE_STRING . to USE_PAD_TO_SHORT_BYTE_CHAR. 2006/12/21: [spec] should check too short multibyte char in parse_exp(). add ADD_PAD_TO_SHORT_BYTE_STRING. ex. /\x00/ in UTF16 should be error. 2006/12/06: Version 5.5.0 2006/12/05: [bug] should add unfold-1 codes from folded code into onigenc_unicode_get_case_fold_codes_by_str(). (ex. "S" -> "s" -> 0x017f) 2006/12/05: [new] add flag ONIGENC_CASE_FOLD_TURKISH_AZERI and USE_UNICODE_CASE_FOLD_TURKISH_AZERI. (disabled in default) 2006/12/04: [spec] remove ONIGENC_CASE_FOLD_FULL. 2006/11/30: [impl] remove unnecessary check in xxx_mbc_case_fold(). 2006/11/29: Version 5.4.0 2006/11/28: [spec] INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR is enabled in default case fold status. 2006/11/28: [spec] rename ONIGENC_CASE_FOLD_MULTI_CHAR to INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR. 2006/11/28: [impl] remove USE_UNICODE_CASE_FOLD_MULTI_CHAR. 2006/11/28: [impl] remove Fold[123]Table and add FoldTable. 2006/11/27: [impl] change tool/unicode_fc.rb to see CaseFolding.txt. 2006/11/24: [bug] should call callback for to[j] <-> to[k] in onigenc_unicode_apply_all_case_fold(). 2006/11/22: Version 5.3.0 2006/11/22: [dist] add index_ja.html. 2006/11/22: [impl] undef ONIG_ESCAPE_UCHAR_COLLISION in regint.h and regenc.h. 2006/11/21: [bug] invalid array access. 2006/11/21: [impl] escape UChar collision from config.h. 2006/11/20: [new] add Hiragana/Katakana properties into Shift_JIS. 2006/11/20: [impl] fix CR_Katakana[] values in EUC-JP. 2006/11/17: [impl] declare strend hash table functions in regint.h. 2006/11/17: [impl] move property list functions to regenc.c. 2006/11/17: [new] add Hiragana/Katakana properties into EUC-JP. 2006/11/15: [impl] remove NOT_RUBY from AM_CFLAGS. 2006/11/14: Version 5.2.0 2006/11/14: [impl] remove program codes for Ruby. 2006/11/14: [impl] reduce program codes for Ruby. 2006/11/10: [bug] 0x24, 0x2b, 0x3c, 0x3d, 0x3e, 0x5e, 0x60, 0x7c, 0x7e should be [:punct:]. 2006/11/09: [new] (thanks Byte) add new character encoding CP1251. 2006/11/08: [impl] rename QUALIFIER -> QUANTIFIER. 2006/11/07: Version 5.1.0 2006/11/07: [dist] remove test.rb, testconv.rb and testconvu.rb. 2006/11/07: [bug] get_case_fold_codes_by_str() should handle 'Ss' and 'sS' combination for ess-tsett. 2006/11/07: [impl] apply_all_case_fold() doesn't need to return all case character combination for multi-character folding. (ONIGENC_CASE_FOLD_MULTI_CHAR) 2006/11/07: [bug] (thanks Byte) add { 0xa3, 0xb3 } to CaseFoldMap[] for KOI8-R. 2006/11/06: [spec] change ONIG_OPTION_FIND_LONGEST to search all of the string range. add USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE. 2006/11/02: [impl] re-implement expand_case_fold_string() for ONIGENC_CASE_FOLD_MULTI_CHAR. 2006/10/30: [impl] add NSTR_DONT_GET_OPTINFO flag. 2006/10/30: [impl] (thanks K.Takata) add THREAD_SYSTEM_INIT and THREAD_SYSTEM_END. 2006/10/30: [bug] (thanks Wolfgang Nadasi-Donner) invalid offset value was used in STATE_CHECK_BUFF_INIT(). 2006/10/27: [tune] speed up ONIGENC_MBC_CASE_FOLD() for UTF-16, UTF-32. (ASCII code check) 2006/10/27: [tune] (thanks Kornelius Kalnbach) String#scan for long string needs long time compare with old Ruby by initialization time for combination explosion check ex. ("test " * 100_000).scan(/\w*\s?/) change STATE_CHECK_BUFF_MAX_SIZE from 0x8000000 to 0x8000. reduce initialization area of state_check_buff. 2006/10/25: [impl] add DISABLE_CASE_FOLD_MULTI_CHAR(). 2006/10/23: Version 5.0.1 2006/10/23: [bug] should fold string in expand_case_fold_string(). 2006/10/23: [bug] (thanks Km) too many case fold/unfold expansion problem. don't expand and set ambig flag to the string node. (except ONIGENC_CASE_FOLD_MULTI_CHAR). 2006/10/23: [bug] (thanks K.Takata) invalid \p{Alnum}, \p{ASCII}, [:alnum:], [:ascii:]. fix OnigEncAsciiCtypeTable[] etc... 2006/10/23: [spec] (thanks K.Takata) add [:word:] POSIX bracket. 2006/10/23: [bug] (thanks K.Takata) \p{Word} doesn't work. 2006/10/20: [impl] don't expand for AMBIG_FLAG string in expand_case_fold_string(). 2006/10/19: Version 5.0.0 2006/10/18: [bug] ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM should be 13. 2006/10/18: [impl] remove unused functions. 2006/10/18: [dist] update documents. 2006/10/18: [API] move OnigMetaCharTableType to OnigSyntaxType. 2006/10/18: [dev] add too/unicode_fc.rb, unicode_pc.rb. 2006/10/18: [dist] remove MANIFEST-RUBY from distribution. 2006/10/18: [bug] return duplicated code in onigenc_unicode_get_case_fold_codes_by_str(). 2006/10/18 [API] remove ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS. 2006/10/18: [dev] add tool/19. 2006/10/18: [dist] remove target 19 from Makefile.am. 2006/10/17: [dist] add enc/unicode.c to target 19 of win32/Makefile. 2006/10/17: [impl] change type for escape VC++ warning. 2006/10/17: [API] rename ONIGENC_CASE_FOLD_NONE to ONIGENC_CASE_FOLD_MIN. 2006/10/17: [dist] remove INSTALL-RUBY from distribution. 2006/10/17: [dist] update LTVERSION to "2:0:0". 2006/10/17: [impl] remove warnings for [make CFLAGS="-g -O2 -Wall"] in the case USE_UNICODE_PROPERTIES and USE_UNICODE_CASE_FOLD_MULTI_CHAR are undefined. 2006/10/17: [impl] remove warnings for [make CFLAGS="-g -O2 -Wall"]. 2006/10/17: [impl] re-implement onigenc_unicode_apply_all_case_fold(). multi-char by case folded char-class is treated as caseless-string (ambig flag on). enable OP_EXACT1_IC and OP_EXACTN_IC. 2006/10/16: [bug] unfold expand for 1->2, 1->3 folding in onigenc_unicode_apply_all_case_fold(). add CaseFoldExpand_12[], CaseFoldExpand_13[]. 2006/10/16: [bug] (thanks Akinori Musha) first argument of rb_warn() should be format string. 2006/10/16: [impl] add msa.state_check_buff_size initialization in onig_search(). 2006/10/16: [spec] re-implement Unicode Caseless Match codes. 2006/10/10: [bug] should call onig_st_free_table() in onig_free_shared_cclass_table(). 2006/10/10: [impl] remove OnigCompCaseFoldCodes. 2006/10/10: [impl] remove onigenc_ascii_is_mbc_ambiguous() and onigenc_mbn_is_mbc_ambiguous(). 2006/10/10: [API] remove is_mbc_ambiguous() member from OnigEncodingType. 2006/10/10: [API] rename onig_set_default_ambig_flag() to onig_set_default_case_fold_flag(), onig_get_default_ambig_flag() to onig_get_default_case_fold_flag(), onig_get_ambig_flag() to onig_get_case_fold_flag(). 2006/10/10: [API] rename ambig_flag to case_fold_flag. 2006/10/10: [API] rename OnigAmbigType to OnigCaseFoldType. 2006/10/10: [impl] rename ONIGENC_IS_CODE_SB_WORD() to IS_CODE_SB_WORD() and move to regint.h. 2006/10/10: [impl] remove OP_WORD_SB and OP_WORD_MB. 2006/10/10: [impl] remove OP_EXACT1_IC and OP_EXACTN_IC from match_at(). 2006/10/10: [impl] should free new_str in expand_case_fold_string(). 2006/10/06: [dist] add test entries to sample/encode.c. 2006/10/06: [impl] re-implement caseless match (case-fold). 2006/10/06: [impl] expand string node by case fold variations. add expand_case_fold_string(). 2006/10/05: [spec] rename OnigCompAmbigCodeItem to OnigCaseFoldCodeItem. 2006/10/05: [spec] add apply_all_case_fold() and get_case_fold_codes_by_str() to OnigEncodingType. 2006/10/05: [spec] remove ambig_flag, get_all_pair_ambig_codes() and get_all_comp_ambig_codes() member from OnigEncodingType. 2006/10/03: [impl] rename mbc_to_normalize() to mbc_case_fold(). 2006/10/03: [spec] rename ONIGENC_AMBIGUOUS_MATCH_XXX to ONIGENC_CASE_FOLD_XXX. rename ONIGENC_CASE_FOLD_COMPOUND to ONIGENC_CASE_FOLD_MULTI_CHAR. 2006/10/02: [impl] remove all ONIG_RUBY_M17N part. 2006/09/29: [impl] initialize state_check_buff_size in STATE_CHECK_BUFF_INIT(). make valgrind happy. 2006/09/22: [impl] remove parse time ctype values (CTYPE_WORD etc...) 2006/09/22: [ruby] enable USE_BACKREF_AT_LEVEL for Ruby mode. 2006/09/22: [spec] (thanks Allan Odgaard) allow upper case letter as the first character of group name. fetch_name() and fetch_name_with_level() 2006/09/21: [impl] convert to ascii for parameter string in onig_error_code_to_str(). add enc member into OnigErrorInfo. 2006/09/21: [dist] update documents for Unicode Property. 2006/09/21: [new] add Unicode Properties. (enc/unicode.c) Any, Assigned, C, Cc, L, Lm, Arabic, Greek etc... 2006/09/21: [impl] add USE_UNICODE_PROPERTIES into regenc.h. 2006/09/21: [impl] remove USE_UNICODE_FULL_RANGE_CTYPE. 2006/09/20: [impl] change ONIGENC_CTYPE_XXXX to sequential values. add BIT_CTYPE_XXXX bit flags to regenc.h. update XXXX_CtypeTable[] for BIT_CTYPE_ALNUM. 2006/09/19: [memo] move from CVS to Subversion (1.3.2). 2006/09/19: [impl] (thanks KOYAMA Tetsuji) HAVE_STDARG_PROTOTYPES was not defined in Mac OS X by Xcode 2.4(gcc 4.0.1) problem. [php-dev 1312] etc... 2006/09/15: [bug] (thanks Allan Odgaard) out of range access in bm_search_notrev(). (p < s) 2006/09/13: [impl] add ONIGENC_CTYPE_ENC_EXT flag. 2006/09/13: [spec] remove 'Is' prefix check for property name from fetch_char_property_to_ctype(). 2006/09/13: [API] add property_name_to_ctype member to OnigEncodingType. 2006/09/12: [spec][ruby] add ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY and ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT to OnigSyntaxRuby. 2006/09/08: Version 4.4.2 2006/09/08: [test] success in ruby 1.9.0 (2006-08-22) [i686-linux]. 2006/09/08: [bug] (thanks K.Takata) out of range access in bm_search_notrev(). 2006/09/04: [spec] (thanks K.Takata) allow look-behind in negative look-behind. ex. /(? (?:a*){n,n}, (?:a+){n,n} 2006/09/21: [impl] reduce (a*){n,m}, (a+){n,m} => (a*){n,n}, (a+){n,n} if backreference is not used. 2006/08/17: [bug] should check scan_env.num_call > 0 for backrefed pattern in combination explosion check. 2006/08/17: Version 4.3.0 2006/08/17: [test] success in ruby 1.9.0 (2006-07-28) [i686-linux]. 2006/08/17: [new] add config USE_COMBINATION_EXPLOSION_CHECK. check /(.+)*/, /(\s*foo\s*)*/ etc... [API] add num_comb_exp_check member in regex_t. [dist] change LTVERSION value to "1:0:0" in configure.in. 2006/08/15: [bug] OP_REPEAT_INC process in match_at(). should check repeat-count >= range-upper and range-upper may be infinite. 2006/08/11: Version 4.2.3 2006/08/11: [test] success in ruby 1.9.0 (2006-07-28) [i686-linux]. 2006/08/10: [impl] remove double call in set_qualifier(). 2006/08/10: [impl] remove by_number member in QualifierNode. 2006/08/09: [impl] remove a comma at the end of enum ReduceType for escape warning on Mac OS X. 2006/08/07: [impl] remove warning in regcomp.c. 2006/08/07: [spec] move definition of USE_BACKREF_AT_LEVEL into NOT_RUBY. 2006/08/03: Version 4.2.2 2006/08/03: [test] success in ruby 1.9.0 (2006-07-28) [i686-linux]. 2006/08/03: [bug] (thanks Hiroyuki Yamamoto) segmentation fault in regexec(). (POSIX API) 2006/08/02: [bug] combination of \G in look-ahead/look-behind and other anchors(\A, \z, \Z) cause invalid result. ex. /(?!\G)a\z/.match("ba") start arg. of MATCH_ARG_INIT() should be original arg. of onig_search(). 2006/07/31: Version 4.2.1 2006/07/31: [test] success in ruby 1.9.0 (2006-07-28) [i686-linux]. 2006/07/31: [bug] (thanks Kimura Minoru) re-implement bm_search_notrev(). 2006/07/31: [impl] bm_search_notrev() refactoring. 2006/07/31: [bug] (thanks Kimura Minoru) fix incomplete multibyte string in exact info. 2006/07/31: [impl] (thanks Seiji Masugata) remove cast in va_init_list() for Intel C Compiler. 2006/07/18: Version 4.2.0 2006/07/18: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/07/18: [new] (thanks Wolfgang Nadasi-Donner) add back reference with nest level. \k, \k 2006/07/11: [impl] change long to unsigned long for ONIG_OPTION_XXX and ONIG_SYN_XXX number literals. 2006/07/03: Version 4.1.2 2006/07/03: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/07/03: [spec] (thanks Wolfgang Nadasi-Donner) allow \G in look-behind. add ANCHOR_BEGIN_POSITION flag in setup_tree(). 2006/06/12: [impl] (thanks matz) fix cast from char* to const char* in onig_snprintf_with_pattern(). fix cast from char* to const char* for PopularQStr[] and ReduceQStr[]. 2006/05/22: Version 4.1.1 2006/05/22: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/05/22: [impl] add position string argument to STACK_BASE_CHECK(). 2006/05/22: [bug] (thanks NARUSE, Yui) add STK_NULL_CHECK_END to IS_TO_VOID_TARGET(). ex. core dump in /(?\(([^\(\)]++|\g)*+\))/.match('((a))') 2006/05/15: Version 4.1.0 2006/05/15: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/05/15: [impl] thread atomic changes for onig_end() and onig_free_node_list(). 2006/05/15: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2005/05/15: [dist] update API, API.ja, FAQ, FAQ.ja. 2006/05/15: [spec] remove onig_recompile(), onig_recompile_deluxe() and re_recompile_pattern(). add config USE_RECOMPILE_API. 2006/05/15: [impl] improved thread safe implementation of onig_search() and onig_match(). 2006/05/11: Version 4.0.4 2006/05/11: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/05/11: [bug] (thanks Yuji Kaneda) dead-lock in onig_end(). 2006/05/11: [dist] update index.html. 2006/05/08: Version 4.0.3 2006/05/08: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/05/08: [bug] (thanks Allan Odgaard) Segmentation fault in backward search. ex. /^\t.*$/ 2006/04/18: [dist] update index.html. 2006/04/05: [dist] update index.html. 2006/03/24: [dist] update doc/RE, doc/RE.ja. 2006/03/23: Version 4.0.2 2006/03/22: [test] success in ruby 1.9.0 (2006-03-01) [i686-linux]. 2006/03/22: [impl] add both of ONIG_OPTION_DONT_CAPTURE_GROUP and ONIG_OPTION_CAPTURE_GROUP check. 2006/03/22: [spec] add error code ONIGERR_INVALID_COMBINATION_OF_OPTIONS. 2006/03/22: [impl] remove USE_NAMED_GROUP condition from ONIG_OPTION_DONT_CAPTURE_GROUP check in parse_effect(). 2006/03/22: [new] add API onig_noname_group_capture_is_active(). 2006/03/01: [spec] rename regex object type from regex_t to OnigRegexType. add typedef OnigRegexType regex_t unless ONIG_ESCAPE_REGEX_T_COLLISION is defined. 2006/02/27: [spec] change ONIG_MAX_MULTI_BYTE_RANGES_NUM from 1000 to 10000. (for docdiff program) 2006/02/17: [dist] change COPYING year 2005 -> 2006. 2006/02/07: Version 4.0.1 2006/02/07: [test] success in ruby 1.9.0 (2005-11-28) [i686-linux]. 2006/02/07: [bug] memory leaks in onig_free_shared_cclass_table(). 2006/02/03: [ruby] add -m 0644 option to install command in "make 19". 2006/02/03: [impl] rename ANCHOR_ANYCHAR_STAR_PL to ANCHOR_ANYCHAR_STAR_ML. change from IS_POSIXLINE() to IS_MULTILINE() for ANCHOR_ANYCHAR_START/_ML decision in optimize_node_left(). 2006/01/26: [dist] update index.html for Oniguruma 2.5.3. 2006/01/25: [dist] update URL in index.html. 2006/01/24: Version 4.0.0 2006/01/24: [test] success in ruby 1.9.0 (2005-11-28) [i386-cygwin]. 2006/01/24: [test] success in ruby 1.9.0 (2005-11-28) [i686-linux]. 2006/01/24: [dist] remove warnings from sample/encode.c. 2006/01/24: [dist] change install description in README(.ja). 2006/01/24: [dist] remove re.c.XXX.patch from distribution and CVS. 2006/01/24: [dist] --- support shared library --- use GNU libtool/automake. change configure.in and add Makefile.am, sample/Makefile.am. add AUTHORS file. 2006/01/24: [dist] test programs return exit code -1 when test fails. 2006/01/24: [bug] (thanks KIMURA Koichi) invalid syntax definition in ONIG_SYNTAX_GREP. ONIG_SYN_OP_BRACE_INTERVAL -> ONIG_SYN_OP_ESC_BRACE_INTERVAL 2006/01/23: [dist] fix configure.in for onig-config. 2006/01/19: [new] add new config USE_UNICODE_ALL_LINE_TERMINATORS. (U+000d, U+0085, U+2028, U+2029) 2005/12/29: [dist] change pmatch array size to 25 in testconv.rb. 2005/12/26: [dist] fix name in test.rb. 2005/12/26: [dist] update index.html for 2.5.1. 2005/11/29: Version 3.9.1 2005/11/29: [test] success in ruby 1.9.0 (2005-11-28) [i686-linux]. 2005/11/24: [test] success in ruby 1.9.0 (2005-08-09) [i686-linux]. 2005/11/21: [test] success in ruby 1.9.0 (2005-11-20) [i386-cygwin]. 2005/11/21: [bug] (thanks Allan Odgaard) utf-8 character comments in extended mode leads invalid result. ex. /(?x)(?<= # o\n~) / fix onigenc_unicode_is_code_ctype() and utf8_is_code_ctype(). 2005/11/20: [bug] (thanks MATSUMOTO Satoshi) (thanks Isao Sonobe) begin-line anchor and BM search optimization leads invalid result in UTF-16/32. fix in set_optimize_exact_info(). 2005/11/20: Version 3.9.0 2005/11/20: [test] success in ruby 1.9.0 (2005-11-20) [i386-cygwin]. 2005/11/20: [test] success in ruby 1.9.0 (2005-10-18) [i386-cygwin]. 2005/11/20: [new] add new config USE_CRNL_AS_LINE_TERMINATOR. (!!! NO SUPPORT experimental option !!!) 2005/11/15: [bug] (thanks Allan Odgaard) tok->escape was not cleared in fetch_token_in_cc(). ex. [\s&&[^\n]] makes wrong result. 2005/10/18: [impl] (thanks nobu) change sjis_mbc_enc_len() and node_new_cclass_by_codepoint_range() scope to static. 2005/09/05: [dist] remove link to MultiFind. 2005/09/01: [dist] add link to yagrep. 2005/08/23: Version 3.8.9 2005/08/23: [test] success in ruby 1.9.0 (2005-08-09) [i686-linux]. 2005/08/23: [inst] fix Makefile.in for make ctest/ptest. 2005/08/23: Version 3.8.8 2005/08/23: [test] success in ruby 1.9.0 (2005-08-09) [i686-linux]. 2005/08/23: [impl] split is_code_in_cc() from onig_is_code_in_cc(). 2005/08/23: [impl] should check DATA_ENSURE() at OP_CCLASS_NODE in match_at(). 2005/08/23: [impl] (thanks akr) add ONIG_OPTION_MAXBIT for escape conflict with Ruby's option. 2005/08/22: [impl] escape GCC 4.0 warnings for testc.c. 2005/08/22: [bug] (thanks nobu, matz) [ruby-dev:26840] UTF-8 0xFE, 0xFF handling bug in code_is_in_cclass_node(). abort on /\S*/ =~ "\xfe" 2005/08/22: [impl] escape GCC 4.0 warnings for sample/*.c. 2005/08/22: [impl] fix testconvu.rb. 2005/08/22: [impl] escape GCC 4.0 warnings. 2005/08/09: Version 3.8.7 2005/08/09: [test] success in ruby 1.9.0 (2005-08-09) [i686-linux]. 2005/08/09: [bug] (thanks Allan Odgaard) should not call enc_len() for s == range in onig_search(). 2005/08/01: [dist] add mkdir $prefix, mkdir $exec_prefix to make install. 2005/07/27: Version 3.8.6 2005/07/27: [test] success in ruby 1.9.0 (2005-07-26) [i686-linux]. 2005/07/27: [impl] update onig-config.in. 2005/07/26: [new] (thanks Yen-Ju Chen) add Oniguruma configuration check program. (onig-config.in) 2005/07/14: Version 3.8.5 2005/07/14: [test] success in ruby 1.9.0 (2005-07-14) [i686-linux]. 2005/07/11: [test] success in ruby 1.9.0 (2005-07-04) [i686-linux]. 2005/07/11: [bug] (thanks nobu) [ruby-dev:26505] invalid handling for /\c\x/ and /\C-\x/. fix fetch_escaped_value(). 2005/07/05: [impl] (thanks Alexey Zakhlestine) escape GCC 4.0 warnings. 2005/07/01: Version 3.8.4 2005/07/01: [test] success in ruby 1.9.0 (2005-07-01) [i686-linux]. 2005/06/30: [test] success in ruby 1.9.0 (2005-06-28) [i686-linux]. 2005/06/30: [dist] add GB 18030 test to sample/encode.c. 2005/06/30: [impl] escape warning of gb18030_left_adjust_char_head(). 2005/06/30: [new] (contributed by KUBO Takehiro) add new character encoding ONIG_ENCODING_GB18030. 2005/06/30: [bug] invalid ctype check for multibyte encodings. ("graph", "print") fix onigenc_mb2/4_is_code_ctype(), eucjp_is_code_ctype() and sjis_is_code_ctype(). 2005/06/30: [bug] invalid conversion from code point to mbc in onigenc_mb4_code_to_mbc(). 2005/06/28: Version 3.8.3 2005/06/28: [test] success in ruby 1.9.0 (2005-06-28) [i686-linux]. 2005/06/27: [test] success in ruby 1.9.0 (2005-05-31) [i686-linux]. 2005/06/27: [bug] (thanks Wolfgang Nadasi-Donner) invalid check for never ending recursion. lower zero quantifier should be treated as a non-recursive call alternative. ex. /(?[^()]*(\(\g\)[^()]*)*)/ 2005/06/15: [impl] add divide_ambig_string_node_sub(). 2005/06/15: [dist] add a test to sample/encode.c. 2005/06/10: [new] add ONIG_SYNTAX_PERL_NG. (Perl + named group) 2005/06/01: Version 3.8.2 2005/06/01: [test] success in ruby 1.9.0 (2005-05-31) [i686-linux]. 2005/05/31: [dist] add doc/FAQ and doc/FAQ.ja. 2005/05/31: [impl] minor change in node_new(). 2005/05/30: [test] success in ruby 1.9.0 (2005-05-11) [i686-linux]. 2005/05/30: [bug] (thanks Allan Odgaard) FreeNodeList null check should be on thread-atomic in node_new(). 2005/05/11: Version 3.8.1 2005/05/11: [test] success in ruby 1.9.0 (2005-05-11) [i386-mswin32]. 2005/05/11: [dist] update win32/Makefile (make 19). 2005/05/11: [test] success in ruby 1.9.0 (2005-05-11) [i686-linux]. 2005/05/06: [test] success in ruby 1.9.0 (2005-05-06) [i686-linux]. 2005/05/06: [impl] (thanks nobu) [ruby-core:4815] add #ifdef USE_VARIABLE_META_CHARS to goto label. 2005/04/25: [test] success in ruby 1.9.0 (2005-04-25) [i686-linux]. 2005/04/25: [impl] change DEFAULT_WARN_FUNCTION and DEFAULT_VERB_WARN_FUNCTION to onig_rb_warn() and onig_rb_warning(). 2005/04/15: Version 3.8.0 2005/04/15: [test] success in ruby 1.9.0 (2005-04-14) [i686-linux]. 2005/04/01: [test] success in ruby 1.9.0 (2005-03-24) [i686-linux]. 2005/04/01: [impl] (thanks Joe Orton) (thanks Moriyoshi Koizumi) many const-ification to many *.[ch] files. 2005/03/25: Version 3.7.2 2005/03/25: [test] success in ruby 1.9.0 (2005-03-24) [i686-linux]. 2005/03/23: [test] success in ruby 1.9.0 (2005-03-20) [i686-linux]. 2005/03/23: [test] success in ruby 1.9.0 (2005-03-08) [i686-linux]. 2005/03/23: [new] add ONIG_SYNTAX_ASIS. 2005/03/23: [new] add ONIG_SYN_OP2_INEFFECTIVE_ESCAPE. 2005/03/09: [spec] rename MBCTYPE_XXX to RE_MBCTYPE_XXX. (GNU API) 2005/03/08: [test] success in ruby 1.9.0 (2005-03-08) [i686-linux]. 2005/03/08: [impl] (thanks matz) [ruby-dev:25783] should not allocate memory for key data in st.c. move st_*_strend() functions from st.c. fixed some potential memory leaks. (imported from Ruby 1.9 2005-03-08) 2005/03/07: Version 3.7.1 2005/03/07: [test] success in ruby 1.9.0 (2005-03-07) [i686-linux]. 2005/03/07: [impl] (thanks Rui Hirokawa) add ONIG_ESCAPE_UCHAR_COLLISION. rename UChar to OnigUChar in oniguruma.h. 2005/03/07: [impl] remove declarations for Ruby in oniggnu.h. 2005/03/05: [bug] ANCHOR_ANYCHAR_STAR didn't work in onig_search(). 2005/03/01: [dist] remove oniggnu.h from MANIFEST-RUBY. remove oniggnu.h from make 19. 2005/03/01: [bug] (thanks matz) [ruby-dev:25778] uninitialized member (OptEnv.backrefed_status) was used. 2005/02/19: Version 3.7.0 2005/02/19: [test] success in ruby 1.9.0 (2005-02-19) [i386-cygwin]. 2005/02/19: [new] (thanks Minero Aoki) add onig_region_set(). 2005/02/19: [API] change onig_region_init() to extern. 2005/02/19: [dist] remove reggnu.c from MANIFEST-RUBY. remove reggnu.c from make 19. 2005/02/19: [dist] update doc/API and doc/API.ja. 2005/02/19: [test] success in ruby 1.9.0 (2005-02-19) [i386-cygwin]. 2005/02/19: [impl] (thanks Alexey Zakhlestine) change UChar* to const UChar* in oniguruma.h, regenc.h and regparse.h. 2005/02/13: [impl] change UChar* to const UChar* in oniguruma.h and onigposix.h and st.h. 2005/02/12: [test] success in ruby 1.9.0 (2005-02-11) [i386-cygwin]. 2005/02/12: [bug] (thanks nobu) [ruby-dev:25676] type_cclass_hash() fix overrun. 2005/02/09: [test] success in ruby 1.9.0 (2005-02-09) [i686-linux]. 2005/02/09: [spec] add RE_OPTION_FIND_NOT_EMPTY etc.. to oniggnu.h. 2005/02/09: [dist] remove hash.c.patch. 2005/02/07: [impl] remove re_mbctab, mbctab_ascii etc... (USE_COMPATIBILITY_FOR_RUBY_EXTENSION_LIBRARY) 2005/02/04: Version 3.6.0 2005/02/04: [test] success in ruby 1.9.0 (2005-02-04) [i686-linux]. 2005/02/01: [bug] add key_free() call to st_free_table(). 2005/02/01: [new] add onig_get_default_ambig_flag() and onig_set_default_ambig_flag(). 2005/02/01: [dist] update MANIFEST-RUBY. 2005/01/31: [test] success in ruby 1.9.0 (2005-01-29) [i686-linux]. 2005/01/31: [spec] remove ONIGENC_AMBIGUOUS_MATCH_COMPOUND from ONIGENC_AMBIGUOUS_MATCH_DEFAULT. 2005/01/31: [dist] update Makefile.in (make 19). 2005/01/29: [memo] (thanks Kazuo Saito) Oniguruma 3.5.4 was merged to Ruby 1.9.0. 2005/01/28: [impl] (thanks UK-taniyama) add extern "C" { } directive to oniguruma.h, oniggnu.h and onigposix.h for C++. 2005/01/25: [impl] remove nested function call for xxx_code_to_mbclen(). (euc_kr.c, euc_tw.c, big5.c) 2005/01/19: Version 3.5.4 2005/01/19: [test] success in ruby 1.9.0 (2005-01-05) [i686-linux]. 2005/01/19: [bug] (thanks Isao Sonobe) callback function argument name_end of onig_foreach_name() was wrong. name key of name table should be null terminated for character encoding length. add strdup_with_null(), rename onig_strdup() to k_strdup(). use e->name_len in i_names(). 2005/01/17: [impl] (thanks UK-taniyama) add HAVE_SYS_TYPES_H to config.h.in. 2005/01/13: Version 3.5.3 2005/01/13: [test] success in ruby 1.9.0 (2005-01-05) [i686-linux]. 2005/01/13: [bug] ignore case match bug. ex. /s+/iu.match("SSSSS") ==> [4..5] fix OP_EXACT1_IC, OP_EXACTN_IC process. 2005/01/13: [bug] (thanks Isao Sonobe) ignore case match bug. ex. /is/iu.match("ss") fail. fix str_lower_case_match() etc. 2005/01/05: Version 3.5.2 2005/01/05: [test] success in ruby 1.9.0 (2005-01-05) [i686-linux]. 2005/01/05: [test] success in ruby 1.9.0 (2004-12-16) [i686-linux]. 2005/01/05: [bug] (thanks Isao Sonobe) ignore case match bug. ex. /s+/iu.match("sssss") ==> [4..5] fix OP_EXACT1_IC, OP_EXACTN_IC process. 2005/01/05: [bug] (thanks Isao Sonobe) group name table should be renumbered. add onig_renumber_name_table(). 2004/12/24: [dist] remove file onigcmpt200.h. 2004/12/17: Version 3.5.1 2004/12/17: [dist] add INSTALL-RUBY to archive. 2004/12/16: [test] success in ruby 1.9.0 (2004-12-16) [i686-linux]. 2004/12/16: [dist] update hash.c.patch. 2004/12/15: [bug] (thanks matz) char > 127 should be cast to unsigned char. (utf8.c) 2004/12/13: [impl] add HAVE_PROTOTYPES and HAVE_STDARG_PROTOTYPES definition to oniguruma.h in the case __cplusplus. 2004/12/06: [dist] update doc/RE and doc/RE.ja. 2004/12/03: [impl] (thanks nobu) st.h fix prototype for C++. 2004/12/03: Version 3.5.0 2004/12/02: [test] success in ruby 1.9.0 (2004-12-02) [i686-linux]. 2004/12/01: [test] success in ruby 1.9.0 (2004-12-01) [i386-mswin32]. 2004/12/01: [dist] add make targets 19 and 19up to win32/Makefile. 2004/12/01: [test] success in ruby 1.9.0 (2004-12-01) [i386-cygwin]. 2004/12/01: [test] success in ruby 1.9.0 (2004-12-01) [i686-linux]. 2004/12/01: [impl] double cast for escape warning in Cygwin. (HashDataType* )((void* )(&e)) in regparse.c 2004/12/01: [test] success in ruby 1.9.0 (2004-11-30) [i686-linux]. 2004/12/01: [tune] change implementation of clear_opt_map_info(). (which was 10-16% cost in gprof result for my test program) 2004/12/01: [dist] remove regex.c from distribution files. 2004/11/30: [memo] remove targets 16 and 18 from Makefile.in. 2004/11/30: [test] success in ruby 1.9.0 (2004-11-30) [i686-linux]. 2004/11/30: [inst] add "cp -p st.[ch] st.[ch].ruby_orig" to "make 19". 2004/11/30: [tune] map_position_value() return 20 if code is 0 and minimum enclen > 1. 2004/11/30: [test] success in ruby 1.9.0 (2004-11-29) [i686-linux]. 2004/11/30: [impl] minor changes for multi-thread in regexec.c and regcomp.c. 2004/11/30: [impl] change THREAD_PASS_LIMIT_COUNT value from 10 to 8. 2004/11/30: [impl] add THREAD_ATOMIC_XXX to FreeNodeList access in regparse.c 2004/11/29: [impl] add USE_MULTI_THREAD_SYSTEM. 2004/11/29: [memo] add hash.c.patch to CVS. 2004/11/29: [dist] change mail address to 'sndgk393 AT ...' 2004/11/29: [dist] add -s option (silent mode) to test.rb. 2004/11/29: [tune] change THRESHOLD_RANGE_NUM_FOR_SHARE_CCLASS value from 20 to 8. 2004/11/29: [inst] add make target "19up". 2004/11/29: [dist] change Oniguruma Home Page URL. 2004/11/29: [impl] remove onig_is_in_code_range_array(). 2004/11/29: [dist] fix doc/RE and RE.ja (character types). 2004/11/26: [dist] fix win32/Makefile. 2004/11/26: [dist] fix doc/RE and RE.ja (multibyte character types). 2004/11/26: [impl] add onig_free_shared_cclass_table(). 2004/11/26: [impl] move definition USE_UNICODE_FULL_RANGE_CTYPE to regenc.h. 2004/11/26: [impl] add opcode OP_CCLASS_NODE. 2004/11/26: [impl] move definition of CClassNode to regint.h. 2004/11/26: [impl] add type PointerType in regint.h. 2004/11/25: [impl] remove ONIGENC_CTYPE_MOD_NOT. 2004/11/25: [impl] rename onig_node_new_cclass_by_codepoint_range to node_new_cclass_by_codepoint_range. 2004/11/25: [impl] remove get_type_cc_node method from OnigEncodingType. 2004/11/25: [impl] move implementation of shared char-class from enc/*.c to regparse.c. 2004/11/25: [dist] add hash.c.patch for Ruby 1.9 hash.c change. 2004/11/22: [impl] change utf8_get_type_node(). 2004/11/22: [impl] add ONIGENC_CTYPE_MOD_NOT. 2004/11/22: [bug] (thanks MIYAMUKO Katsuyuki) ruby make test fail in HP-UX B.11.23 ia64. should use tok->u.code instead of tok->u.c in the case of TK_CODE_POINT. 2004/11/19: [bug] (thanks Yoshida Masato) invalid multibyte code causes segmentation fault. ex. /[\xFF-\xFF]/u 2004/11/19: [bug] (thanks Yoshida Masato) illegal check in char-class range in UTF-8. ex. s = "[\xC2\xA0-\xC3\xBE]" p(Regexp.new(s, nil, "u") =~ "\xC3\xBE") 2004/11/18: [impl] add onig_node_new_cclass_by_codepoint_range(). 2004/11/18: [impl] remove OnigCodePointRange type. (use OnigCodePoint[].) 2004/11/17: [bug] (thanks nobu) abort in "a".gsub(/a\Z/, "") fix ONIGENC_STEP_BACK() argument in onig_search(). 2004/11/16: [impl] add key2 member to st_table_entry in st.[ch]. change API of st for non-null terminated string key. 2004/11/16: [impl] add get_type_cc_node method to OnigEncodingType. 2004/11/15: [impl] add st.h and st.c from Ruby 1.9. use st-hash always. 2004/11/12: [impl] change member 'not' of CClassNode to 'flags'. add flags FLAG_CCLASS_NOT and FLAG_CCLASS_SHARE. 2004/11/12: [impl] add onig_is_in_code_range_array() to enc/unicode.c. 2004/11/12: [impl] fix CRWord in enc/unicode.c and MBWord in enc/utf8.c. 2004/11/11: [bug] fix enc/utf8.c. size 0 array initializer was compile error in VC++. 2004/11/09: [inst] (thanks Hiroki YAGITA) change installed file mode to 0644. 2004/11/09: [bug] (thanks UK-taniyama) wrong definitions GET_RELADDR_INC(), GET_ABSADDR_INC() etc... (NOT PLATFORM_UNALIGNED_WORD_ACCESS) 2004/11/09: [impl] type cast in regexec() for remove compile time warning. (WIN32, regposix.c) 2004/11/08: [spec] fix Unicode character types. 0x00ad (soft hyphen) should be [:cntrl:] and [:space:] type. [0x0009..0x000d], 0x0085 should be [:print:] type. 0x00ad should not be [:punct:] type. 2004/11/08: [inst] fix Makefile.in. (for make ctest/ptest/testcu) 2004/11/06: [impl] (thanks Kazuo Saito) too many alternatives pattern causes core dump. change implementation of onig_node_free(). 2004/11/05: [spec] rename ONIGERR_END_PATTERN_AT_BACKSLASH to ONIGERR_END_PATTERN_AT_ESCAPE. 2004/11/05: [impl] (thanks matz) escape compile time warnings for x86-64 Linux. StackIndex type int -> long 2004/11/05: [memo] (thanks Kazuo Saito) Oniguruma 3.4.0 was merged to Ruby 1.9.0. 2004/10/30: Version 3.4.0 2004/10/30: [test] success in ruby 1.9.0 (2004-09-24) [i686-linux]. 2004/10/30: [new] add hexadecimal digit char type. (\h, \H) syntax: ONIG_SYN_OP2_ESC_H_XDIGIT 2004/10/30: [bug] (thanks Guy Decoux) reluctant infinite repeat bug. ex. /^[a-z]{2,}?$/.match("aaa") fail. fix OP_REPEAT_INC_NG process in match_at(). 2004/10/18: Version 3.3.1 2004/10/18: [test] success in ruby 1.9.0 (2004-09-24) [i686-linux]. 2004/10/18: [impl] (thanks Imai Yasumasa) enclose #include by #ifndef __BORLANDC__. 2004/10/18: [bug] (thanks Imai Yasumasa) memory access violation in select_opt_exact_info(). 2004/09/25: [dist] fix doc/API and doc/API.ja. 2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE is not defined. 2004/09/17: Version 3.3.0 2004/09/17: [dist] add COPYING to program source files. 2004/09/17: [test] success in ruby 1.9.0 (2004-07-23) [i686-linux]. 2004/09/17: [bug] (thanks Isao Sonobe) memory access violations in xxx_mbc_enc_len(), and xxx_mbc_to_normalize() and xxx_left_adjust_char_head(). add string range check in match_at() and onig_search(). 2004/09/08: [dist] change mail address format.(kosako AT sofnec ...) 2004/09/04: Version 3.2.9 2004/09/04: [test] success in ruby 1.9.0 (2004-07-23) [i686-linux]. 2004/09/04: [bug] (thanks Bob Kerstetter and Richard Koch) search fail in ignore case mode. fix str_lower_case_match(). 2004/09/04: [inst] (thanks Isao Sonobe) clear sample directory in 'make clean'. 2004/09/04: [bug] fix ONIGENC_AMBIGUOUS_MATCH_COMPOUND/ASCII/NONASCII meanings in XXXXX_mbc_to_normalize() and XXXXX_is_mbc_ambiguous(). 2004/08/28: [bug] fix ONIGENC_AMBIGUOUS_MATCH_COMPOUND/ASCII/NONASCII meanings in iso_8859_XX_mbc_to_normalize() and iso_8859_XX_is_mbc_ambiguous(). 2004/08/24: Version 3.2.8 2004/08/24: [test] success in ruby 1.9.0 (2004-07-23) [i686-linux]. 2004/08/24: [spec] add ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY. /a{n}?/ == /(?:a{n})?/ 2004/08/24: [dist] fix doc/RE and doc/RE.ja. 2004/08/24: [bug] (thanks starfish) memory leak in set_optimize_exact_info(). 2004/08/21: Version 3.2.7 2004/08/21: [test] success in ruby 1.8.2 (2004-07-28) [i686-linux]. (1.8.2 preview2) 2004/08/21: [test] success in ruby 1.9.0 (2004-07-23) [i686-linux]. 2004/08/21: [bug] (thanks Isao Sonobe) (thanks kage) memory access violation in bm_search_notrev(). (forgotten to merge from 2.X) 2004/07/24: Version 3.2.6 2004/07/24: [test] success in ruby 1.9.0 (2004-07-23) [i686-linux]. 2004/07/24: [test] success in ruby 1.8.2 (2004-07-16) [i686-linux]. 2004/07/24: [bug] fix warnings for regexec.c. (gcc 2.91.66) 2004/07/24: [memo] change version control system from Subversion to CVS 1.11.17. 2004/07/20: [bug] (thanks Isao Sonobe) illegal result in negative character class in ignore case mode. fix pair-ambig-codes process in parse_exp(). ex. /[^a]/i.match("A") 2004/07/20: [bug] (thanks Isao Sonobe) undefined bytecode error happens in UTF-16BE etc.. compile_length_cclass_node() was not consistent with compile_cclass_node(). 2004/07/01: Version 3.2.5 2004/07/01: [test] success in ruby 1.8.2 (2004-06-23) [i686-linux]. 2004/07/01: [new] add onig_get_syntax_{op,op2,behavior,options}. 2004/07/01: [bug] (thanks Isao Sonobe) invalid result in onig_capture_tree_traverse(). fix make_capture_history_tree(). 2004/06/29: Version 3.2.4 2004/06/29: [test] success in ruby 1.8.2 (2004-06-23) [i686-linux]. 2004/06/29: [new] (thanks Isao Sonobe) add onig_number_of_captures(). 2004/06/25: Version 3.2.3 2004/06/25: [test] success in ruby 1.8.2 (2004-06-23) [i686-linux]. 2004/06/25: [bug] (thanks Isao Sonobe) invalid result in onig_capture_tree_traverse(). fix make_capture_history_tree(). 2004/06/24: Version 3.2.2 2004/06/24: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2004/06/24: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. 2004/06/24: [test] success in ruby 1.8.2 (2004-06-23) [i686-linux]. 2004/06/24: [new] (thanks Isao Sonobe) add onig_number_of_capture_histories(). 2004/06/24: [bug] (thanks Isao Sonobe) invalid char position match in UTF-16 and UTF-32. add onigenc_always_false_is_allowed_reverse_match(). 2004/06/17: Version 3.2.1 2004/06/17: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2004/06/17: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. 2004/06/17: [test] success in ruby 1.8.2 (2004-05-18) [i686-linux]. 2004/06/17: [impl] should not use OP_REPEAT for (...)? even if target size is long. 2004/06/17: [bug] (thanks nobu) [ruby-dev:23703] should use STACK_AT() instead of stkp in OP_REPEAT_INC. add IN_VAR_REPEAT flag in setup_tree(). 2004/06/16: [impl] change select_opt_exact_info() to use ByteValTable[]. 2004/06/16: [impl] change map_position_value() table values. 2004/06/14: [impl] (thanks John Carter) RelAddrType, AbsAddrType and LengthType change from short int to int type for the very long string match. 2004/06/14: [bug] (thanks Greg A. Woods) fix nmatch argument of regexec() is smaller than reg->num_mem + 1 case. (POSIX API) 2004/06/14: [spec] (thanks Greg A. Woods) set pmatch to NULL if nmatch is 0 in regexec(). (POSIX API) 2004/06/10: Version 3.2.0 2004/06/10: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2004/06/10: [test] success in ruby 1.9.0 (2004-05-27) [i386-mswin32]. 2004/06/10: [test] success in ruby 1.8.2 (2004-05-18) [i686-linux]. 2004/06/10: [dist] add README.ja. 2004/06/10: [new] add onig_copy_encoding(). 2004/06/10: [API] add encoding argument to onig_set_meta_char(). add meta_char_table member to OnigEncodingType. 2004/06/08: [dist] add doc/API.ja. 2004/06/07: [API] add num_of_elements member to OnigCompileInfo. 2004/05/29: [memo] (thanks Kazuo Saito) Oniguruma 3.1.0 was merged to Ruby 1.9.0. 2004/05/26: [impl] rename NST_SIMPLE_REPEAT to NST_STOP_BT_SIMPLE_REPEAT. 2004/05/26: [impl] doesn't need to check that target's simple repeat-ness for EFFECT_MEMORY type node in setup_tree(). 2004/05/25: Version 3.1.0 2004/05/25: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. 2004/05/25: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2004/05/25: [test] success in ruby 1.9.0 (2004-05-23) [i686-linux]. 2004/05/25: [test] success in ruby 1.8.2 (2004-05-18) [i686-linux]. 2004/05/25: [bug] (thanks Masahiro Sakai) [ruby-dev:23560] ruby -ruri -ve 'URI::ABS_URI =~ "http://example.org/Andr\xC3\xA9"' nested STK_REPEAT type stack can't backtrack repeat_stk[]. add OP_REPEAT_INC_SG and OP_REPEAT_INC_NG_SG. 2004/05/25: [new] support UTF-32LE. (ONIG_ENCODING_UTF32_LE) 2004/05/25: [new] support UTF-32BE. (ONIG_ENCODING_UTF32_BE) 2004/05/24: [impl] divide enc/utf16.c to utf16_be.c and utf16_le.c. 2004/05/24: [impl] add enc/unicode.c. 2004/05/24: [API] change calling sequences of onig_new_deluxe() and onig_recompile_deluxe(). define OnigCompileInfo type. 2004/05/21: [impl] perform ensure process for rb_trap_exec() in match_at(). add onig_exec_trap() and CHECK_INTERRUPT_IN_MATCH_AT. 2004/05/21: [impl] add regex status check to onig_match(). 2004/05/21: [new] add onig_get_capture_tree() and onig_capture_tree_traverse(). 2004/05/20: [spec] (thanks Isao Sonobe) capture history return capture data tree. (see sample/listcap.c) 2004/05/19: [bug] (thanks Simon Strandgaard) Control-C does not work in matching process on Ruby. add calling of CHECK_INTERRUPT into match_at(). ex. /<(?:[^">]+|"[^"]*")+>/.match('') 2004/05/19: [bug] (thanks Simon Strandgaard) define virtual codepoint values for invalid encoding byte 0xfe and 0xff in UTF-8. ex. /\w+/u.match("%a\xffb\xfec%") ==> "a" 2004/05/19: [spec] (thanks Simon Strandgaard) too big backref number should be treated as a sequence of an octal char and number digits. ex. /b\3777\c/.match("b\3777\c") 2004/05/17: [spec] rename encoding names "UTF-16 BE" and "UTF-16 LE" to "UTF-16BE" and "UTF-16LE". 2004/05/17: [impl] move ismbchar() and mbclen() from oniguruma.h to oniggnu.h. 2004/05/17: [impl] rename onigenc_single_byte_is_allowed_reverse_match() to onigenc_always_true_is_allowed_reverse_match(). 2004/05/14: Version 3.0.0 2004/05/14: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2004/05/14: [test] success in ruby 1.9.0 (2004-05-14) [i686-linux]. 2004/05/14: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. (* need to edit parse.y: register int c; ---> int c; in yylex()) 2004/05/14: [impl] add regext.c. 2004/05/14: [spec] KOI8 is not included in library archive by default setup. 2004/05/14: [impl] implementation changes are completed for all encoding files. 2004/05/12: [impl] add divide_ambig_string_node(). ambiguous string is divided and normalized before optimization and compilation process. 2004/05/11: [dist] remove INSTALL-RUBY from distribution. 2004/04/28: [memo] (thanks Kazuo Saito) Oniguruma 2.2.8 was merged to Ruby 1.9.0. 2004/04/26: [spec] change value DEFAULT_MATCH_STACK_LIMIT_SIZE = 0 : unlimited 2004/04/26: [new] add onig_get_match_stack_limit_size() and onig_set_match_stack_limit_size(). 2004/04/26: [bug] add error check to re.c.181.patch and re.c.168.patch. 2004/04/23: [impl] remove ctype_support_level from OnigEncodingType. 2004/04/22: [spec] allow the range from single byte char to multibyte char in character class for implementation reason. ex. /[a-\xbb\xcc]/ in EUC-JP encoding. 2004/04/21: [impl] remove max_enc_len_by_first_byte() from OnigEncodingType. 2004/04/20: [new] add onig_copyright(). 2004/04/20: [impl] add regversion.c. 2004/04/15: [new] add onig_get_ambig_flag(). 2004/04/14: [bug] (thanks Isao Sonobe) undefined bytecode error happens if ONIG_OPTION_FIND_LONGEST is set. should finish matching process if find-condition is fail at OP_END in match_at(). 2004/04/12: [impl] add ambig_flag to regex_t. 2004/04/09: [impl] move onig_set_meta_char() to regsyntax.c. 2004/04/09: [bug] (thanks HIROSE Masaaki) fix onig_version(). 2004/04/08: [impl] add regsyntax.c. 2004/04/07: [new] support UTF-16 LE. (ONIG_ENCODING_UTF16_LE) 2004/04/05: [impl] add ONIGENC_CTYPE_NEWLINE. 2004/04/05: [memo] (thanks Kazuo Saito) Oniguruma 2.2.6 was merged to Ruby 1.9.0. 2004/04/02: [memo] Version 2.2.6 was released. 2004/03/26: [new] support UTF-16 BE. (ONIG_ENCODING_UTF16_BE) 2004/03/25: [spec] support non 8-bit encodings. 2004/03/16: [memo] 2.X branch for 8-bit encodings only. 2004/03/16: Version 2.2.5 2004/03/16: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. 2004/03/16: [test] success in ruby 1.9.0 (2004-02-24) [i686-linux]. 2004/03/16: [impl] add property name to error message of ONIGERR_INVALID_CHAR_PROPERTY_NAME. 2004/03/16: [spec] allow prefix 'Is' for \p{...} in ONIG_SYNTAX_PERL. add syntax op. ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS. 2004/03/15: [dist] add sample/syntax.c. 2004/03/15: [spec] support NOT op. in char property. \p{^...}, \P{^...}. add syntax op. ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT. 2004/03/15: [spec] rename ONIG_SYN_OP2_ESC_P_CHAR_PROPERTY to ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY. 2004/03/10: [impl] move ONIGERR_XXX from regenc.h to oniguruma.h, rename ONIGERR_XXX to ONIGENCERR_XXX in regenc.h. 2004/03/08: [impl] (thanks eban) replace defined(__CYGWIN__) to defined(__GNUC__). 2004/03/08: [bug] (thanks eban) [ruby-dev:23172] need to separate initialization for bcc32. 2004/03/06: [memo] (thanks Kazuo Saito) Oniguruma 2.2.4 was merged to Ruby 1.9.0. 2004/03/05: [API] change second argument type of onig_set_meta_char() from unsigned int to OnigCodePoint. 2004/03/05: [dist] (thanks Kazuo Saito) add MANIFEST-RUBY. 2004/03/04: Version 2.2.4 2004/03/04: [impl] (thanks Moriyoshi Koizumi) fix many warnings in Win32 VC++ with /W3 option. 2004/03/02: Version 2.2.3 2004/03/02: [bug] (thanks Isao Sonobe) return invalid capture region value if capture history is used. (OP_MEMORY_END_PUSH_REC bug) ex. /\g

(?@

\(\g\)){0}(?(?:\g

)*|){0}/ .match("((())())") 2004/03/02: [impl] (thanks Kazuo Saito) add :nodoc: to onig_stat_print() for RDoc. 2004/03/02: [impl] don't use ONIG_SOURCE_IS_WRAPPED. 2004/02/27: Version 2.2.2 2004/02/27: [impl] fix the position of onig_stat_print(). 2004/02/27: [impl] define ONIG_RUBY_DEFINE_GLOBAL_FUNCTION() in regint.h for ignored by RDoc. 2004/02/26: Version 2.2.1 2004/02/26: [bug] [bugs.php.net:#26677] (thanks behrens) invalid definition at onig_error_code_to_str() in the case of NOT HAVE_STDARG_PROTOTYPES. 2004/02/25: Version 2.2.0 2004/02/25: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. 2004/02/24: [test] success in ruby 1.9.0 (2004-02-24) [i686-linux]. 2004/02/24: [bug] undefined IS_BLANK() and IS_GRAPH() was used in onigenc_is_code_ctype() in the case of Ruby M17N. 2004/02/24: [new] support ISO-8859-16. (ONIG_ENCODING_ISO_8859_16) 2004/02/24: [bug] should not fold match for 0xdf in iso8859_6.c. 2004/02/24: [new] support ISO-8859-14. (ONIG_ENCODING_ISO_8859_14) 2004/02/23: [new] support ISO-8859-13. (ONIG_ENCODING_ISO_8859_13) 2004/02/23: [new] support ISO-8859-10. (ONIG_ENCODING_ISO_8859_10) 2004/02/20: [bug] fix iso_8859_4_mbc_is_case_ambig(). 2004/02/20: [new] support ISO-8859-9. (ONIG_ENCODING_ISO_8859_9) 2004/02/19: [bug] correct ctype tables for ISO-8859-3, ISO-8859-4, ISO-8859-6, ISO-8859-7, ISO-8859-8, KOI8_R. 2004/02/18: [bug] wrong replaced name OnigSyntaxGnuOnigex. 2004/02/17: [spec] check capture status for empty infinite loop. [ruby-dev:20224] etc... ex. /(?:\1a|())*/.match("a"), /(?:()|()|()|(x)|()|())*\2b\5/.match("b") add USE_INFINITE_REPEAT_MONOMANIAC_MEM_STATUS_CHECK. add OP_NULL_CHECK_END_MEMST, OP_NULL_CHECK_END_MEMST_PUSH. add stack type STK_NULL_CHECK_END. 2004/02/13: [impl] add OnigEncodingEUC_CN to enc/euc_kr.c. 2004/02/13: [bug] (thanks Simon Strandgaard) parsing of nested repeat was invalid. ex. /ab{2,3}*/ was /(?:a(?:b{2,3}))*/, should be /a(?:b{2,3}*)/ 2004/02/12: [bug] (thanks Simon Strandgaard) OP_REPEAT_INC_NG process in match_at() is wrong. ex. bad match /a.{0,2}?a/ =~ "0aXXXa0" 2004/02/12: [bug] (thanks Simon Strandgaard) wrong fetch after (?x) option. ex. "(?x)\ta .\n+b" 2004/02/12: [bug] (thanks Simon Strandgaard) [\^] is not a empty char class. 2004/02/09: [new] add onig_set_syntax_op(), onig_set_syntax_op2(), onig_set_syntax_behavior(), onig_set_syntax_options(). 2004/02/06: [dist] add a new target 'site' to Makefile.in. 2004/02/06: [dist] add index.html. 2004/02/03: [bug] oniggnu.h was not installed by 'make install'. 2004/02/02: Version 2.1.0 2004/02/02: [test] success in ruby 1.9.0 (2004-02-02) [i686-linux]. 2004/02/02: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2004/02/02: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. 2004/02/02: [new] support ISO-8859-11. (ONIG_ENCODING_ISO_8859_11) 2004/02/02: [new] support ISO-8859-5. (ONIG_ENCODING_ISO_8859_5) 2004/02/02: [impl] should check single byte encoding or not in and_cclass() and or_cclass(). 2004/01/30: [dist] add oniggnu.h. 2004/01/30: [bug] ISO-8859-7 0xb7 (middle dot) is Punct type. 2004/01/30: [new] support ISO-8859-8. (ONIG_ENCODING_ISO_8859_8) 2004/01/29: [new] support ISO-8859-7. (ONIG_ENCODING_ISO_8859_7) 2004/01/29: [new] support ISO-8859-6. (ONIG_ENCODING_ISO_8859_6) 2004/01/28: [new] support KOI8-R. (ONIG_ENCODING_KOI8_R) 2004/01/28: [new] support KOI8. (ONIG_ENCODING_KOI8) 2004/01/27: [dist] rename enc/isotable.c to enc/mktable.c. 2004/01/27: [new] support ISO-8859-4. (ONIG_ENCODING_ISO_8859_4) 2004/01/26: [new] support ISO-8859-3. (ONIG_ENCODING_ISO_8859_3) 2004/01/26: [bug] EncISO_8859_{1,15}_CtypeTable[256] was wrong. (0x80 - 0xff is not ASCII) 2004/01/23: [new] support ISO-8859-2. (ONIG_ENCODING_ISO_8859_2) 2004/01/23: [dist] add enc/isotable.c. 2004/01/22: [new] support EUC-TW. (ONIG_ENCODING_EUC_TW) 2004/01/22: [bug] definition of GET_ALIGNMENT_PAD_SIZE() and ALIGNMENT_RIGHT() was wrong. type casting should be unsigned int, not int. 2004/01/22: [impl] add defined(__x86_64) || defined(__x86_64__) to unaligned word access condition. (AMD64 ?) 2004/01/21: [dist] rename enc/eucjp.c to enc/euc_jp.c. 2004/01/21: [new] support EUC-KR. (ONIG_ENCODING_EUC_KR) 2004/01/20: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2004/01/20: [dist] change Makefile.in. 2004/01/20: [spec] add \p{...}, \P{...} in char class. 2004/01/20: [new] character property operators \p{...}, \P{...}. supported in ONIG_SYNTAX_JAVA and ONIG_SYNTAX_PERL. 2004/01/19: [spec] allow /a{,n}/ as /a{0,n}/. (but don't allow /a{,}/) 2004/01/19: [dist] rename onigcomp200.h to onigcmpt200.h. 2004/01/19: [dist] update re.c.168.patch. svn add re.c.181.patch. 2004/01/16: [dist] update sample/*.c for new API. 2004/01/16: [dist] add onigcomp200.h. (for old API compatibility) 2004/01/16: [dist] update documents API, RE and RE.ja. 2004/01/16: [spec] change prefix REG_ -> ONIG_, regex_ onig_, ENC_ -> ONIGENC, enc_ -> onigenc_. 2004/01/15: [impl] rename ENC_IS_MBC_E_WORD() to ENC_IS_MBC_WORD(). rename ENC_CTYPE_SUPPORT_LEVEL_SB_ONLY to ENC_CTYPE_SUPPORT_LEVEL_SB. 2004/01/14: [impl] rename UNALIGNED_WORD_ACCESS to PLATFORM_UNALIGNED_WORD_ACCESS. 2004/01/14: [impl] change MATCH_STACK_LIMIT_SIZE value from 200000 to 500000. 2004/01/13: [impl] remove ENC_CODE_TO_MBC_FIRST(enc,code) in regenc.h. remove code_to_mbc_first member in RegCharEncodingType. 2004/01/13: [impl] remove head byte bitset information in cclass->mbuf. 2003/12/26: [impl] change macro name ismb_xxxx() in enc/*.c for escape conflict. 2003/12/24: Version 2.0.0 2003/12/24: [spec] ignore case option is effective to numbered char. ex. /\x61/i =~ "A" 2003/12/24: [test] success in ruby 1.8.1 (2003-12-24) [i686-linux]. 2003/12/24: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2003/12/24: [test] success in ruby 1.8.0 (2003-08-08) [i386-mswin32]. 2003/12/24: [test] success in regex.c compile test on ruby-m17n. (but can't make miniruby because re.c patch fail.) 2003/12/24: [bug] (thanks H.Miyamoto) /[\W]/ was wrong in 1.9.5. 2003/12/22: [spec] implement fold match on UTF-8 encoding. 2003/12/19: [impl] add ctype_support_level and ctype_add_codes() member to RegCharEncoding type. 2003/12/19: [impl] add add_ctype_to_cc() in regparse.c. 2003/12/19: [impl] add enc_is_code_ctype() in REG_RUBY_M17N case. 2003/12/19: [impl] change ENC_CODE_TO_MBC() interface. 2003/12/18: [new] implement fold match. (variable number of char match in ignore case mode.) ex. German alphabet ess-tsett(U+00DF) match "SS" and "ss". 2003/12/17: [impl] refactoring of encoding system. 2003/12/17: [impl] add enc_init() in regenc.c. 2003/12/17: [new] support Big5. (REG_ENCODING_BIG5) 2003/12/16: [impl] change CodePoint from unsigned int to unsigned long. 2003/12/16: [new] support ISO 8859-15. (REG_ENCODING_ISO_8859_15) 2003/12/16: [impl] change P_() macro definition condition for Win32. 2003/12/16: [dist] add sample/encode.c 2003/12/16: [new] support ISO 8859-1. (REG_ENCODING_ISO_8859_1) 2003/12/15: [impl] rename IS_ENC_XXXX to ENC_IS_XXXX. 2003/12/15: [impl] rename RegDefaultCharEncoding to EncDefaultCharEncoding. 2003/12/15: [impl] divide encoding files. (enc/ascii.c, enc/utf8.c etc...) 2003/12/15: [bug] unexpected infinite loop in regex_snprintf_with_pattern(). change local var. type char* to UChar*. 2003/12/15: [impl] remove REG_MBLEN_TABLE[]. 2003/12/15: [spec] rename function prefix regex_get_prev_char_head(), regex_get_left_adjust_char_head() and regex_get_right_adjust_char_head() to enc_xxxxxx(). 2003/12/15: [impl] rename function prefixes in regenc.h from regex_ to enc_. 2003/12/12: [impl] remove USE_SBMB_CLASS. 2003/12/12: [impl] rename mb -> mbc, mblen() to enc_len(). 2003/12/12: [impl] rename WCINT to CodePoint. 2003/12/11: [impl] delete IS_XXXX() ctype macros from regint.h. 2003/12/11: [impl] add enc->wc_is_ctype() and RegAsciiCtypeTable[256]. 2003/12/11: [impl] remove RegAsciiCaseAmbigTable. 2003/12/10: [impl] use ENC_TO_LOWER() for ignore case comparison. 2003/12/08: [impl] *** re-defined RegCharEncoding in oniguruma.h. *** 2003/12/08: [impl] add USE_POSIX_REGION_OPTION to regint.h. 2003/12/08: [impl] add IS_ENC_WORD() to regenc.h. 2003/12/05: [impl] rename IS_CODE_XXXX() to IS_ENC_XXXX(). 2003/12/05: [impl] delete IS_CODE_WORD() from regenc.h. 2003/12/04: [spec] rename REG_SYN_OP_BACK_REF to REG_SYN_OP_DECIMAL_BACKREF. 2003/12/04: [spec] add (REG_SYN_OP_ESC_W_WORD | REG_SYN_OP_ESC_B_WORD_BOUND | REG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | REG_SYN_OP_BACK_REF) to RegSyntaxGrep. 2003/12/04: [spec] remove REG_ENCODING_DEFAULT and REGCODE_DEFAULT. 2003/12/04: [spec] move declarations of regex_get_default_encoding() and regex_set_default_encoding() from oniguruma.h to regenc.h. 2003/12/03: [new] add regex_get_default_encoding() and regex_set_default_encoding(). 2003/12/03: [spec] REG_ENCODING_DEFAULT meaning is changed. (current default value, not initial default value.) 2003/12/03: [spec] REGCODE_XXX is obsoleted. use REG_ENCODING_XXX. 2003/12/02: [memo] alias svnst='svn status | grep -v "^\?"' 2003/12/02: [spec] move regex_set_default_trans_table() declaration from oniguruma.h to regenc.h. (obsoleted API) 2003/12/02: [impl] move variables RegDefaultCharEncoding, DefaultTransTable and AmbiguityTable to regenc.c. 2003/12/01: [impl] add regex_continuous_sbmb() to regenc.c. 2003/12/01: [dist] add regenc.h and regenc.c. 2003/11/18: [dist] change testconv.rb. 2003/11/18: [bug] (thanks Masaru Tsuda) memory leak in parse_subexp(). 2003/11/18: [bug] (thanks Masaru Tsuda) memory leak in names_clear() and parse_char_class(). 2003/11/17: [bug] memory leak in parse_char_class(). 2003/11/17: [bug] (thanks Masaru Tsuda) OptExactInfo length should not over OPT_EXACT_MAXLEN. (concat_opt_exact_info_str()) 2003/11/12: Version 1.9.5 2003/11/12: [test] success in ruby 1.8.0 (2003-08-08) [i386-cygwin]. 2003/11/12: [test] success in ruby 1.8.1 (2003-11-11) [i686-linux]. 2003/11/12: [spec] add definition of REG_INEFFECTIVE_META_CHAR. 2003/11/11: [dist] add a sample program sample/sql.c. 2003/11/11: [new] add variable meta character. regex_set_meta_char() 2003/11/11: [spec] add syntax op. REG_SYN_OP_VARIABLE_META_CHARS. 2003/11/11: [spec] rename REG_SYN_OP_ESC_CAPITAL_Q_QUOTE to REG_SYN_OP2_ESC_CAPITAL_Q_QUOTE, REG_SYN_OP_QMARK_GROUP_EFFECT to REG_SYN_OP2_QMARK_GROUP_EFFECT. 2003/11/06: [impl] define THREAD_PASS as rb_thread_schedule() in Ruby mode. 2003/11/05: [spec] add syntax behavior REG_SYN_WARN_REDUNDANT_NESTED_REPEAT. 2003/11/05: [spec] rename REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPED to REG_SYN_WARN_CC_OP_NOT_ESCAPED. 2003/11/04: [new] add regex_set_warn_func() and regex_set_verb_warn_func(). 2003/10/30: [new] add regex_name_to_backref_number(). (for multiplex definition name, see sample/names.c) 2003/10/30: [spec] add name_end and reg argument to callback function of regex_foreach_name(). (see sample/names.c) 2003/10/29: [spec] add syntax behavior REG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME. add error code REGERR_MULTIPLEX_DEFINED_NAME. 2003/10/14: [dist] modify sample/simple.c. 2003/10/03: [bug] (thanks nobu) [ruby-dev:21472] sub-anchor of optimization map info was wrong in concat_left_node_opt_info(). ex. /^(x?y)/ = "xy" fail. 2003/09/17: Version 1.9.4 2003/09/17: [spec] change specification of char-class range in ignore case mode follows with Ruby 1.8(2003-09-17). ex. /[H-c]/i ==> (H-Z, 0x5b-0x60, a-c)/i ==> H-Z, h-z, 0x5b-0x60, a-c, A-C 2003/09/16: [bug] (thanks Guy Decoux) remove env->option == option check in parse_effect(). change env->option for dynamic option in parse_exp(). (ex. bad match /(?i)(?-i)a/ =~ "A") 2003/09/12: [spec] rename REG_SYN_ALLOW_RANGE_OP_IN_CC to REG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC, REG_SYN_ESCAPE_IN_CC to REG_SYN_BACKSLASH_ESCAPE_IN_CC. 2003/09/11: [bug] change to IS_SYNTAX_OP2 at REG_SYN_OP2_ESC_GNU_BUF_ANCHOR. 2003/09/09: [spec] rename REG_SYN_OP2_ESC_M_BAR_META to REG_SYN_OP2_ESC_CAPITAL_M_BAR_META, REG_SYN_OP_ESC_Q_QUOTE to REG_SYN_OP_ESC_CAPITAL_Q_QUOTE, REG_SYN_OP_ESC_SUBEXP to REG_SYN_OP_ESC_LPAREN_SUBEXP, REG_SYN_OP_ESC_BUF_ANCHOR to REG_SYN_OP_ESC_AZ_BUF_ANCHOR, REG_SYN_OP_ESC_GNU_BUF_ANCHOR to REG_SYN_OP2_ESC_GNU_BUF_ANCHOR, REG_SYN_OP_ESC_CONTROL_CHAR to REG_SYN_OP_ESC_CONTROL_CHARS, REG_SYN_OP_ESC_WORD to REG_SYN_OP_ESC_W_WORD, REG_SYN_OP_ESC_WORD_BEGIN_END to REG_SYN_OP_ESC_LTGT_WORD_BEGIN_END, REG_SYN_OP_ESC_WORD_BOUND to REG_SYN_OP_ESC_B_WORD_BOUND, REG_SYN_OP_ESC_WHITE_SPACE to REG_SYN_OP_ESC_S_WHITE_SPACE, REG_SYN_OP_ESC_DIGIT to REG_SYN_OP_ESC_D_DIGIT, REG_SYN_OP_CC to REG_SYN_OP_BRACKET_CC, REG_SYN_OP2_CCLASS_SET to REG_SYN_OP2_CCLASS_SET_OP, REG_SYN_CONTEXT_INDEP_OPS to REG_SYN_CONTEXT_INDEP_REPEAT_OPS, REG_SYN_CONTEXT_INVALID_REPEAT_OPS to REG_SYN_CONTEXT_INVALID_REPEAT_OPS. add REG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR. 2003/09/08: [spec] rename REG_SYN_OP_ANYCHAR to REG_SYN_OP_DOT_ANYCHAR, REG_SYN_OP_0INF to REG_SYN_OP_ASTERISK_ZERO_INF, REG_SYN_OP_ESC_0INF to REG_SYN_OP_ESC_ASTERISK_ZERO_INF, REG_SYN_OP_1INF to REG_SYN_OP_PLUS_ONE_INF, REG_SYN_OP_ESC_1INF to REG_SYN_OP_ESC_PLUS_ONE_INF, REG_SYN_OP_0INF to REG_SYN_OP_QMARK_ZERO_ONE, REG_SYN_OP_ESC_0INF to REG_SYN_OP_ESC_QMARK_ZERO_ONE, REG_SYN_OP_INTERVAL to REG_SYN_OP_BRACE_INTERVAL, REG_SYN_OP_ESC_INTERVAL to REG_SYN_OP_ESC_BRACE_INTERVAL, REG_SYN_OP_SUBEXP to REG_SYN_OP_LPAREN_SUBEXP, REG_SYN_OP_ALT to REG_SYN_OP_VBAR_ALT, REG_SYN_OP_ESC_ALT to REG_SYN_OP_ESC_VBAR_ALT, REG_SYN_OP_NON_GREEDY to REG_SYN_OP_QMARK_NON_GREEDY, REG_SYN_OP_SUBEXP_EFFECT to REG_SYN_OP_QMARK_GROUP_EFFECT, REG_SYN_OP2_POSSESSIVE_{REPEAT,INTERVAL} to REG_SYN_OP2_PLUS_POSSESSIVE_{REPEAT,INTERVAL}, REG_SYN_OP2_SUBEXP_CALL to REG_SYN_OP2_ESC_G_SUBEXP_CALL, REG_SYN_OP2_NAMED_GROUP to REG_SYN_OP2_QMARK_LT_NAMED_GROUP and REG_SYN_OP2_ESC_K_NAMED_BACKREF. 2003/09/02: [tune] call reduce_nested_qualifier() after disabling capture for no-name group in noname_disable_map(). ex. /(a+)*(?...)/ 2003/09/02: [impl] include is forgotten to erase in regcomp.c. 2003/09/01: [dist] update doc/RE and doc/RE.ja. 2003/08/26: [bug] (thanks Guy Decoux) should not double free node at the case TK_CC_CC_OPEN in parse_char_class(). 2003/08/19: Version 1.9.3 2003/08/19: [inst] change re.c.180.patch. 2003/08/19: [impl] rename 'list of captures' to 'capture history'. 2003/08/19: [dist] add doc/RE.ja. (Japanese) 2003/08/19: [new] add regex_copy_syntax(). 2003/08/19: [spec] rename REG_SYN_OP2_ATMARK_LIST_OF_CAPTURES to REG_SYN_OP2_ATMARK_CAPTURE_HISTORY. 2003/08/18: [spec] (thanks nobu) don't use IMPORT in oniguruma.h and onigposix.h. 2003/08/18: [impl] (thanks nobu) change error output to stdout in testconv.rb. 2003/08/18: [inst] (thanks nobu) lacked $(srcdir) in Makefile.in. 2003/08/18: [bug] REG_MBLEN_TABLE[SJIS][0xFD-0xFF] should be 1. 2003/08/18: [bug] (thanks nobu) mbctab_sjis[0x80] should be 0. 2003/08/18: [bug] (thanks nobu) single/multi-byte decision was wrong in parse_char_class(). add regex_wc2mblen(). should not set fetched to 1 in TK_RAW_BYTE case. 2003/08/18: [bug] should update BitSet in the case inc_n >= 0 in add_wc_range_to_buf(). 2003/08/13: [bug] change re.c.180.patch for fix rb_reg_to_s() in re.c. 2003/08/11: [bug] should clear region->list in regex_region_resize(). 2003/08/08: Version 1.9.2 2003/08/08: [test] success in ruby 1.8.0 (2003-08-08) on Windows 2000 VC++ 6.0 and Cygwin. 2003/08/08: [impl] don't define macro vsnprintf for WIN32 platform, because definition is added in win32\win32.h. 2003/08/08: [test] success in ruby 1.8.0 and ruby 1.6.8(2003-08-03) on Linux. 2003/08/08: [dist] change re.c.180.patch and re.c.168.patch. 2003/08/08: [new] (thanks akr) implemented list of captures. (?@...), (?@...) 2003/08/07: [dist] add sample/listcap.c. 2003/08/06: [bug] OP_MEMORY_END_PUSH_REC case in match_at(). renewal of mem_start_stk[] should be after STACK_PUSH_MEM_END() call. 2003/07/29: [new] add regex_get_encoding(), regex_get_options() and regex_get_syntax(). 2003/07/25: [spec] (thanks akr) change group(...) to shy-group(?:...) if named group is used in the pattern. add REG_SYN_CAPTURE_ONLY_NAMED_GROUP. 2003/07/24: [spec] rename REG_OPTION_CAPTURE_ONLY_NAMED_GROUP to REG_OPTION_DONT_CAPTURE_GROUP. add REG_OPTION_CAPTURE_GROUP. 2003/07/17: [spec] rename REG_SYN_OP2_NAMED_SUBEXP to REG_SYN_OP2_NAMED_GROUP. 2003/07/17: [spec] add REGERR_EMPTY_GROUP_NAME. 2003/07/17: [spec] rename REGERR_INVALID_SUBEXP_NAME to REGERR_INVALID_CHAR_IN_GROUP_NAME. 2003/07/17: [spec] restrict usable chars of group name to alphabet, digit, '_' or multibyte-char in fetch_name(). [ruby-dev:20706] 2003/07/16: [impl] minor change of sample/names.c. 2003/07/14: [impl] rename USE_NAMED_SUBEXP to USE_NAMED_GROUP. 2003/07/14: [bug] add fetch_name() for USE_NAMED_SUBEXP off case. 2003/07/14: [API] add regex_number_of_names(). 2003/07/08: [impl] change error message for undefined group number call. 'undefined group reference: /(a)\g<2>/' --> 'undefined group <2> reference: /(a)\g<2>/' 2003/07/08: [dist] modify doc/RE. 2003/07/07: [impl] OP_SET_OPTION is not needed in compiled code. add IS_DYNAMIC_OPTION() to regint.h. 2003/07/07: [spec] called group should not ignore outside option (?i:...). ex. /(?i:(?(a)\2)){0}\g/.match("aA") add opcode OP_BACKREFN_IC and OP_BACKREF_MULTI_IC. set option status to effect memory in optimize_node_left(). 2003/07/07: [impl] add opcode OP_ANYCHAR_ML, OP_ANYCHAR_ML_STAR and OP_ANYCHAR_ML_START_PEEK_NEXT. 2003/07/07: [bug] (thanks nobu) REG_MBLEN_TABLE[SJIS][0x80] should be 1. 2003/07/07: [spec] rename REG_SYN_OP_QUOTE to REG_SYN_OP_ESC_Q_QUOTE. 2003/07/04: Version 1.9.1 2003/07/04: [new] add REG_OPTION_CAPTURE_ONLY_NAMED_GROUP. (thanks .NET) 2003/07/04: [spec] check mbuf member in the case of REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC in parse_char_class(). 2003/07/04: [spec] typo REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPEED. should be REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPED. 2003/07/04: [bug] conflict values on REG_SYN_WARN_FOR_CC_OP_NOT_ESCAPEED and REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC. (thanks nobu) 2003/07/03: [spec] add REG_SYN_OP_ESC_CONTROL_CHAR flag. 2003/07/03: [spec] remove REG_SYN_OP_ESC_OCTAL3 and REG_SYN_OP_ESC_X_HEX2 flag from RegSyntaxGnuRegex. 2003/07/03: [spec] remove REG_SYN_OP_NON_GREEDY flag from RegSyntaxGnuRegex. 2003/07/02: [dist] fix doc/RE. 2003/07/01: [impl] add config flag USE_VARIABLE_SYNTAX. (turn off variable syntax on Ruby) 2003/07/01: [spec] add syntax behavior REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND. 2003/06/30: [spec] allow different length top-level alternatives in look-behind. ex. (?<=abc|abcd), (? (?>a*)b (thanks Jeffrey E. F. Friedl) 2003/06/02: [impl] remove multibyte-BitSet for OP_CCLASS_MB/OP_CCLASS_MB_NOT. 2003/05/30: [new] char class intersection operator &&[...] like Java(TM). (thanks akr) 2003/05/30: [bug] should use bbuf_free() for CClassNode in regex_node_free(). 2003/05/29: [bug] wrong usage of syntax REG_SYN_ALLOW_EMPTY_RANGE_IN_CC. /[d-a]/ should be error. 2003/05/28: [impl] optimize stop-backtrack compiled code. (/(?>a*)/, /(?>\w+)/ etc...) add OP_POP opcode. 2003/05/28: [new] possessive repeat operator. (?+, *+, ++, {n,m}+) 2003/05/27: [spec] '-' at beginning of char-class should be warn only if it is start of range. (ex. /[--a]/) 2003/05/27: [spec] should not warn for right bracket at beginning of pattern. ex. /]aaa/ 2003/05/27: [spec] change CCEND_ESC_WARN() from VERB_WARNING() to WARNING(). 2003/05/27: [spec] /[]aaa/ should be empty char-class error. /[]aaa]/ should be warn for 'without backslash'. (add char_exist_check() in regparse.c) 2003/05/26: [bug] OP_REPEAT in recursive subexp call. ex. /(?(a|b\gc){3,5})/.match("baaaaca") => "baaaaca" was wrong result. (should be "aaaa") 2003/05/26: [impl] add num_call member to regex_t. 2003/05/26: [impl] add repeat_range member to regex_t. (for delete upper,lower members from StackType.u.repeat) 2003/05/26: [bug] change print_names() to external regex_print_names(). 2003/05/26: [tune] change OP_NULL_CHECK_END process in match_at(). 2003/05/26: [spec] change CCEND_ESC_WARN() from WARNING() to VERB_WARNING(). 2003/05/26: [spec] remove POSIXLINE option. (?p:...) (be made the same as Ruby.) 2003/05/22: [spec] use OP_NULL_CHECK_XXX only if repeat is infinite. prev. /(?:()|()){0,10}\1\2/ =~ "" ==> FAIL now /(?:()|()){0,10}\1\2/ =~ "" ==> MATCH 2003/05/22: [impl] change target_empty setting condition in setup_tree(). 2003/05/19: [impl] avoid zero length repeat optimization. (thanks matz) /()*/ ==> /()?/, /()+/ ==> /()/ etc... 2003/05/19: [impl] minor changes for gcc -Wall. (-DREG_DEBUG_STATISTICS case) 2003/05/19: [spec] rename regex_foreach_names() to regex_foreach_name(). 2003/05/16: [new] add --with-statistics option to configure. 2003/05/16: [bug] move RegOpInfo[] definition to regint.h. 2003/05/16: [new] add regex_version(). 2003/05/14: Version 1.8.6 2003/05/14: [bug] use _vsnprintf() on Win32. 2003/05/14: [spec] define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE. (/\n$/ =~ "\n", /\n\Z/ =~ "\n") [ruby-dev:20125] 2003/05/14: [impl] minor changes for gcc -Wall. 2003/05/14: [impl] add string.h check in AC_CHECK_HEADERS(). 2003/05/13: [impl] minor changes for gcc -Wall. 2003/05/13: [impl] add regex_snprintf_with_pattern(). 2003/05/13: [spec] add warning for char class meta character without escape in Ruby mode ('[', '-', ']'). 2003/05/13: [impl] define WARNING() and VERB_WARNING() in regint.h. 2003/05/13: [bug] correct is_code_ascii() for /[[:ascii:]]/. 2003/05/12: [dist] add regular expression document (doc/RE). 2003/05/12: [spec] specification of $(END_LINE) was made the same as Ruby 1.8. [ruby-dev:20130] (thanks matz) 2003/05/12: [memo] shifted to Subversion(version 0.21.0) from CVS. 2003/03/19: Version 1.8.5 2003/03/19: [impl] change REG_EXTERN definition. (thanks nobu) 2003/03/19: [impl] abbreviation for long error_par in regex_error_code_to_str(). 2003/03/18: [dist] change re.c.XXX.patch for GNU regex API changes. 2003/03/18: [spec] change API regex_new(), regex_recompile() and regex_error_code_to_str(). change API re_compile_pattern() and re_recompile_pattern(). 2003/03/18: [spec] replace REGERR_END_PATTERN_AT_GROUP_{COMMENT|OPTION} to REGERR_END_PATTERN_IN_GROUP. 2003/03/17: [impl] should free err_arg. 2003/03/17: [bug] mistake(high -> to) in add_wc_range_to_buf(). 2003/03/17: [spec] add err_arg argument to regex_new() and regex_recompile(). for detail error message. (thanks akr) 2003/03/12: Version 1.8.4 2003/03/12: [tune] use cached value of effect node in get_min_match_length(). 2003/03/12: [bug] escaped alphabet should be TK_RAW_BYTE in fetch_token() and fetch_token_in_cc(). 2003/03/12: [spec] change named backref and subexp call format. backref: \k, call: \g (thanks akr) 2003/03/11: [inst] add regparse.[ch] in win32/Makefile. 2003/03/11: [bug] if UNALIGNED_WORD_ACCESS isn't set, then compile error in unset_addr_list_fix(). (thanks knu) 2003/03/10: [impl] divide regcomp.c to regcomp.c, regparse.c and regparse.h. 2003/03/10: [bug] should handle multi-byte code name in fetch_name(). 2003/03/10: [spec] remove REGERR_TABLE_FOR_IGNORE_CASE_IS_NOT_SETTED. 2003/03/10: [spec] support POSIX API option REG_NOSUB. add comp_options member to POSIX API regex_t. 2003/03/10: Version 1.8.3 2003/03/10: [bug] can not compile with Ruby 1.6.8. (inconsistent st.h with 1.6 and 1.8) use hash table on Ruby 1.8 only. 2003/03/10: [spec] forbid to use '\' in group name. 2003/03/08: [impl] remove check_backref_number(). 2003/03/08: [bug] called group in 0-repeat should not be eliminated from compile code. ex. /(?*n)(?){0}/ (thanks akr) add is_referred member to QualifierNode. 2003/03/07: [impl] use hash table(st.[ch]) for implementation of name table. (enable on Ruby in default) 2003/03/07: [new] add regex_foreach_names(). 2003/03/06: [impl] add member reg->stack_pop_level. 2003/03/06: [impl] add operator OP_MEMORY_START and member reg->backtrack_mem. 2003/03/06: [bug] if REG_OPTION_FIND_LONGEST or REG_OPTION_NOT_EMPTY, should handle backtrack of MEM_END. add OP_MEMORY_END_PUSH and OP_MEMORY_END_PUSH_REC. 2003/03/06: [impl] rename OP_MEMORY_END_PUSH to OP_MEMORY_END_MARK. 2003/03/06: [spec] change error messages. 2003/03/06: [tune] add tiny_pop check in STACK_POP. 2003/03/05: Version 1.8.2 2003/03/05: [impl] use cache info in EFFECT_MEMORY case in optimize_node_info(). 2003/03/05: [impl] add EFFECT_MEMORY node reference count check in optimize_node_left(). 2003/03/05: [impl] add min-len, max-len, char-len cache in EffectNode. 2003/03/05: [spec] allow to call in look behind. ex. /(?<=(?*a))/ 2003/03/05: [bug] forgotten N_ANCHOR case in check_backref_number(), subexp_inf_recursive_check_trav() etc... 2003/03/05: [impl] rename USE_ONIGURUMA_EXTENSION to USE_SBMB_CLASS. 2003/03/04: [impl] add CALL-node info in optimize_node_left(). 2003/03/04: [spec] prohibit left recursion of subexp call. ex. (?|(?*n)a) add subexp_inf_recursive_check_trav(). 2003/03/04: [spec] rename REG_SYN_STRICT_CHECK_BACKREF_NUMBER to REG_SYN_STRICT_CHECK_BACKREF 2003/03/03: [bug] /(?a(?*n)|)/ isn't infinite recursion. fix N_LIST case in subexp_recursive_check(). (thanks akr) 2003/03/03: [bug] /(?|(?*n))+/ segmentation fault. should re-allocate in unset_addr_list_add(). (thanks akr) 2003/03/01: Version 1.8.1 2003/03/01: [bug] change STACK_GET_MEM_START() and STACK_PUSH_MEM_END(). 2003/03/01: [new] add reg_name_to_group_numbers() to POSIX API. 2003/03/01: [impl] use OP_MEMORY_END_PUSH in callable subexp compiled code only if subexp is recursive. 2003/03/01: [spec] rename regex_name_to_backrefs() to regex_name_to_group_numbers(). 2003/02/28: [impl] use function stack_double() instead of macro. 2003/02/28: [new] subexp call. (?*name) (thanks akr) 2003/02/28: [spec] add match stack limit check. (MATCH_STACK_LIMIT_SIZE) 2003/02/28: [impl] check recursive subexp call. 2003/02/28: [impl] add opcode OP_MEMORY_END_PUSH for callable subexp. 2003/02/28: [impl] add opcode OP_CALL, OP_RETURN. add stack type STK_CALL_FRAME, STK_RETURN, STK_MEM_END. 2003/02/26: [spec] add new syntax behavior REG_SYN_STRICT_CHECK_BACKREF_NUMBER. if it is set, then error /(\1)/, /\1(..)/ etc... 2003/02/26: [spec] if backref number is greater than max group number, then return compile error. (REGERR_INVALID_BACKREF_NUMBER) 2003/02/26: [tune] badly implemented N_ALT case in get_min_match_length(). 2003/02/26: [dist] auto update testc.c and win32/testc.c in dist target. 2003/02/26: [impl] add -win option to testconv.rb. 2003/02/25: [spec] allow to assign same name to different group. add OP_BACKREF_MULTI. 2003/02/24: [impl] reduce redundant repeat of empty target. ex. /()*/ ==> /()?/, /()+/ ==> /()/, /(?:)+/ ==> // 2003/02/24: [impl] change condition in regex_is_allow_reverse_match(). 2003/02/24: [impl] convert i(/../, ...) functions in testconv.rb. 2003/02/24: [impl] change name table struct. 2003/02/22: Version 1.8.0 2003/02/22: [new] named subexp, named back reference. (thanks akr) define: (?...), back-ref: \g 2003/02/22: [impl] use str_node_can_be_split(). 2003/02/21: [dist] add sample/posix.c 2003/02/21: [spec] rename some error code symbols. 2003/02/21: [spec] max number of multibyte ranges(255) is small. 255 --> 1000. (thanks MoonWolf) 2003/02/20: [new] supported Basic Regular Expression(BRE) in POSIX API. (REG_EXTENDED option: Extended RE) 2003/02/20: [new] variable syntax. 2003/02/12: Version 1.7.2 2003/02/12: [bug] mismatch /\?a/i.match('?A'). check raw value in scan_make_node() and scan_backslash(). (thanks Nobu) 2003/02/12: [impl] rename 'max_mem' to 'num_mem' in regex_t. 2003/02/12: [impl] rename 'code' to 'enc' in regex_t. 2003/02/12: [spec] remove transtable argument in regex_new and regex_recompile. remove transtable member in regex_t. 2003/02/10: [inst] change backup file suffix name from '.orig' to '.ruby_orig'. (win32/Makefile) 2003/02/10: [spec] number check in scan_char_class() ignore-case mode. ex. /[\x58-\x64]/i 2003/02/10: [impl] don't use OP_MEMORY_END_PUSH (and STK_MEM_END). 2003/02/10: [impl] lift up head_exact value from child qualifier node to parent. 2003/02/10: [tune] change stack type values. 2003/02/10: [dist] add HISTORY. 2003/02/08: [tune] change stack type values. 2003/02/08: [tune] add STACK_BASE_CHECK(). 2003/02/08: [tune] add STACK_PUSH_ENSURED(). 2003/02/08: [dist] change contents of doc/API. 2003/02/07: [inst] change backup file suffix name from '.orig' to '.ruby_orig'. 2003/02/07: [spec] range in char-class should be same spec. with Ruby in ignore-case mode. (ex. /[A-c]/i == /[a-c]/i) (thanks MoonWolf) 2003/02/07: [spec] [!--] should be allowed. (thanks MoonWolf) 2003/02/07: [dist] refresh re.c.180.patch for re.c (2003-02-06). 2003/02/07: Version 1.7.1 2003/02/07: [impl] check first byte of string in ignore-case mode. (get_head_exact_node()) 2003/02/07: [impl] remove redundant statements in setup_tree(). 2003/02/06: [new] create Win32 DLL. 2003/02/06: [impl] use P_() macro for function prototype. 2003/02/06: [impl] add HAVE_PROTOTYPE, HAVE_STDARG_PROTOTYPES in configure.in and config.h.in. 2003/02/06: [spec] /[0-9-a]/ is allowed as usual char '-' and 'a' in Ruby. add USE_BETTER_COMPATIBILITY_FOR_ORIGINAL_REGEX in regint.h. (thanks MoonWolf) 2003/02/06: [spec] rename REG_MBCTYPE_XXXX to REG_ENCODING_XXXX in onigposix.h. 2003/02/05: [spec] rename MBCTYPE_XXXX to REG_MBCTYPE_XXXX in onigposix.h. 2003/02/05: [spec] add POSIX API error REG_EONIG_THREAD to onigposix.h. 2003/02/05: [dist] add .cvsignore file. 2003/02/04: Version 1.7 2003/02/04: [bug] typo miss in regex_region_copy(). 2003/02/04: [impl] change THREAD_PASS macro. (regint.h) 2003/02/04: [dist] add API document file doc/API. 2003/02/04: [tune] if sub_anchor has ANCHOR_BEGIN_LINE then set REG_OPTIMIZE_EXACT_BM in set_optimize_exact_info(). 2003/02/04: [spec] reimplement regex_clone() and it is obsoleted. 2003/02/04: [bug] add REGERR_OVER_THREAD_PASS_LIMIT_COUNT to regerror.c regposix.c. 2003/02/03: [bug] Hankaku-Kana may be second byte in Shift_JIS regex_is_allow_reverse_match(). 2003/02/03: [impl] add optimization type REG_OPTIMIZE_EXACT_BM_NOT_REV. remove exact_allow_reverse_match member in regex_t. 2003/02/03: [impl] add exact_allow_reverse_match member in regex_t. 2003/02/03: [impl] compile-search conflict in regex_search() is handled. 2003/02/01: [tune] decrease regex_region_clear() calling from regex_search(). 2003/02/01: [tune] remove region argument from match_at(). 2003/01/31: [tune] don't use strlen() in regexec() and regcomp(). 2003/01/31: [tune] decrease regex_reduce_chain() calling in regex_search(). 2003/01/31: [bug] STRING_CMP() in regexec.c was wrong in ignore-case. 2003/01/31: [impl] convert to lower-case char at string compile time. change SBTRANSCMP() in regexec.c. 2003/01/31: [impl] rename TTRANS() to TOLOWER(). 2003/01/30: [bug] .c.o --> .c.obj in win32\Makefile. 2003/01/30: [impl] add -DNOT_RUBY to Makefile.in. NOT_RUBY is referred in regint.h for escape double including config.h. 2003/01/30: [impl] when string hasn't case ambiguity, don't compile to ignore case opcode. 2003/01/29: [impl] add SJIS, UTF-8 test_sb() test. 2003/01/29: [dist] add INSTALL-RUBY file. 2003/01/28: [test] success in Cygwin, Ruby 1.8.0 (2003-01-27). 2003/01/24: [inst] add rback target to Makefile.in. 2003/01/24: [impl] change SBCMP() -> IS_NEWLINE() in match_at(). 2003/01/23: [impl] add encoding arg to scan_xxxx_number(). 2003/01/23: [impl] rename WCInt to WCINT. 2003/01/22: [bug] POSIX API regexec() was not thread safe. remove region member from POSIX regex_t. [new] add search time option REG_OPTION_POSIX_REGION. (region argument is treated as regmatch_t[] type) speed up regexec(). 2003/01/22: [memo] start CVS entry in my box. 2003/01/21: Version 1.6 2003/01/21: [test] Mac OS X 10.1, Ruby 1.8.0 (2003-01-20) 2003/01/20: [impl] add UTF-8 check to test.rb. (thanks UENO Katsuhiro) 2003/01/18: [impl] change REGION_NOTPOS to REG_REGION_NOTPOS in regex.h. 2003/01/17: [dist] add sample/simple.c. 2003/01/17: [inst] add configure option --with-rubydir. 2003/01/17: [bug] badly implemented POSIX API options. default: /./ not match "\n", anchor not match "\n" REG_NEWLINE: /./ not match "\n", anchor match "\n" 2003/01/16: [impl] rewrite POSIX API regexec() for speed up. 2003/01/16: [impl] add region member to POSIX regex_t struct. 2003/01/16: [inst] rename library file from 'libregex.a' to 'libonig.a'. 2003/01/15: [dist] add testc.c to distribution file. 2003/01/15: [test] success in 'make rtest/ctest/ptest' on Windows 2000. 2003/01/15: [bug] change '/' to \' in win32/Makefile. 2003/01/14: [test] success in Ruby make test on Windows 2000. VC++6.0, Ruby 1.6.8 (2003-01-12) 2003/01/14: [inst] change Makefile.in and win32/Makefile. 2003/01/11: [inst] changes for Win32 platform. (regint.h, reggnu.c, regcomp.c) 2003/01/11: [dist] add win32 directory. (config.h, Makefile, testc.c) 2003/01/10: [inst] add onigposix.h to install target. (Makefile.in) 2003/01/10: [bug] lacked a comma in ESTRING[]. (regposerr.c) 2003/01/10: [bug] local variable name was wrong. buf -> tbuf (regerror()) 2003/01/10: [spec] remove REG_RUBY_M17N case from onigposix.h and regposix.c. 2003/01/09: Version 1.5 2003/01/09: [inst] replace Ruby re.c.XXX.patch files. (166 -> 168, 172 -> 180) 2003/01/09: [new] implement POSIX API. (thanks knu) (onigposix.h, regposix.c, regposerr.c) 2003/01/08: [spec] remove REGERR_END_PATTERN_AFTER_BACKSLASH in regex.h. 2003/01/08: [spec] region arg can be NULL in regex_search() and regex_match(). 2003/01/08: Version 1.4 2003/01/08: [inst] add test program converter (test.rb -> testc.c). 2003/01/08: [bug] move GET_WCINT() from regcomp.c to regint.h. 2003/01/07: [inst] add new test script (test.rb). 2002/12/30: [bug] wrong merge in multibyte mode (alt_merge_opt_exact_info()). 2002/12/28: [inst] add rtest target to Makefile.in. 2002/12/28: [bug] /\xfe/.match("\xfe") mismatch in multibyte mode. add "raw" flag arg to concat_opt_exact_info_str(). 2002/12/25: [bug] check condition was wrong in alt_merge_opt_map_info(). 2002/12/25: [impl] add threshold_len check in regex_search(). 2002/12/23: [bug] prec-read in alternative (/a|(?=z).f/.match("zf") => nil) 2002/12/23: [bug] \G in alternative (/a|\Gz/.match("bza") => "z"). add start member in MatchArg. (regexec.c) 2002/12/21: [impl] **** rewrite all optimization process. **** 2002/12/16: [impl] remove node subtype EFFECT_EMPTY. 2002/12/12: [impl] reconstruct node types. (regcomp.c) 2002/12/11: [impl] add regerror.c 2002/12/10: [bug] [ruby-dev:19042] (thanks Nobu) anchor(\G etc...) influenced outside of "|". (/a|\Gb/) 2002/11/30: [bug] [ruby-dev:18966] (thanks Nobu) char-class(\S, [^\s] etc...) optimize map-info was wrong. 2002/11/29: [bug] infinite loop on NULL-pointer str search (regex_search()). (thanks matz) 2002/11/29: [bug] change static -> extern (regex_chain_reduce()). 2002/11/29: [bug] change encoding to RegDefaultCharEncoding in re_recompile_pattern(). (adapt to re.c) 2002/04/24: [spec] USE_ONIGURUMA_EXTENSION is disabled in default. 2002/04/24: [new] add searching time option: REG_OPTION_NOTBOL/NOTEOL. add searching time option argument to regex_search() and regex_match(). (prepare for POSIX API) 2002/04/20: [impl] divide regex.c file into regcomp.c, regexec.c, reggnu.c and regint.h. 2002/04/09: [impl] move IS_MULTILINE() to outside of loop in OP_ANYCHAR_STAR. 2002/04/08: [impl] don't use OP_REPEAT operator for '??'. 2002/04/06: [impl] reduce redundant nested repeat operators(?,*,+,??,*?,+?). ex. (?:a*)?, (?:a??)* etc.. 2002/04/06: [spec] should not warn for /(?:a?)+?/. 2002/04/04: [spec] should allow fixed length alternative and repeat pattern in look-behind. ex. /(?<=(a|b){3})/ (thanks Guy Decoux) 2002/04/02: [spec] should warn for /(?:a+)?/ and /(?:a*)??/. (thanks akr) 2002/04/01: Version 1.3 2002/04/01: [dist] add COPYING. 2002/03/30: [spec] warn redundant nested repeat operator in Ruby verbose mode. ex. (?:a*)? 2002/03/30: [spec] nested repeat operator error check should be same with GNU regex. (thanks Guy Decoux) 2002/03/30: [new] add \x{hexadecimal-wide-char}. (thanks matz) 2002/03/27: [bug] MBCTYPE_XXX symbol values should be same with GNU regex. 2002/03/27: [impl] add THREAD_ATOMIC to regex_clone(), regex_init(), regex_end(). 2002/03/25: [spec] if encoding is utf-8, allow combination of singlebyte and multibyte code range in char class. (cancelled 2002/04/01: for M17N compatibility) 2002/03/25: [dist] description of the license condition is added to README. 2002/03/23: [bug] should set all bits of reg->mem_stats, if REG_OPTION_FIND_LONGEST or REG_OPTION_NOT_EMPTY. 2002/03/23: [new] add a new option REG_OPTION_NOT_EMPTY. 2002/03/20: [spec] allow incompleted left brace as an usual char. ex. /{/, /({)/, /a{2,3/ etc... 2002/03/20: [impl] serialize integer in bytecode. (switch by UNALIGNED_WORD_ACCESS in regex.c) 2002/03/20: [impl] change re_mbcinit() for REG_RUBY_M17N. 2002/03/19: [impl] word alignment of char class multi-byte code ranges. 2002/03/19: [impl] replace OP_EXACTMB4N with OP_EXACTMB3N. 2002/03/19: [bug] OP_CCLASS_MB_NOT process in matchAt() is wrong. 2002/03/19: [new] add re_mbctab[] for Ruby extension library compatibility. 2002/03/19: [spec] allow nested repeat operator, if operator is {n,m} type. 2002/03/19: [new] add REG_IS_PATTERN_ERROR(ecode) in regex.h 2002/03/18: [spec] /[a-b-c]/ should be error. 2002/03/18: [bug] /[\w-a]/ should be error. (thanks Guy Decoux) 2002/03/18: [bug] /[\]/ should be error. (thanks Guy Decoux) 2002/03/18: [bug] /()*/ etc.. should not be error. (thanks Guy Decoux) 2002/03/18: [spec] /a{1}*/ should not be error. (thanks Guy Decoux) 2002/03/18: [bug] ab{2}{3} was interpreded to (?:a(?:b{2})){3} (thanks Guy Decoux) 2002/03/18: [bug] abort /(?i)*a/ etc... (thanks Guy Decoux) 2002/03/18: [bug] abort /a|*/,/a|{1}/ etc... (thanks Guy Decoux) 2002/03/13: Version 1.2 2002/03/13: [test] success in rubicon/builtin/AllBuiltinTests.rb. (thanks rubicon) 2002/03/13: [bug] OP_EXACTMBN process in matchAt() is wrong. 2002/03/13: [bug] start argument of BackwardSearchRange() is wrong. 2002/03/12: [spec] change function name style from CamelCase to underline_separation. (includes API) 2002/03/12: [bug] if pattern has nested null-check, cause infinite loop. correct STACK_NULL_CHECK() macro. (thanks Guy Decoux) 2002/03/11: [bug] it is wrong that four numbers to continue as an octal value in scanBackSlash(). ex. /\0111/ (thanks matz) 2002/03/11: [new] \k (single-byte word char), \K (multi-byte char). 2002/03/09: [inst] add two targets to Makefile.in (166 and 172). 2002/03/09: [spec] decrease REG_MAX_BACKREF_NUM, REG_MAX_REPEAT_NUM values. 2002/03/08: [spec] allow use of "\A"(begin-buf) in look-behind. 2002/03/08: [impl] add a new opcode OP_PUSH_IF_PEEK_NEXT. 2002/03/08: [impl] add a new opcode OP_ANYCHAR_STAR_PEEK_NEXT. 2002/03/07: [spec] prohibit use of capture group "(...)" in negative look-behind. 2002/03/07: [inst] add configure.in, config.h.in, Makefile.in. 2002/03/07: [impl] call Init_REGEX_STAT() in RegexInit(). 2002/03/07: [spec] less length string match with negative look-behind. ex. /(? svn copy file:///home/kosako/svnreps/svnrep_onig/trunk file:///home/kosako/svnreps/svnrep_onig/tags/5.0.0 -m "ADD TAG: 5.0.0" svn propset svn:ignore -F .cvsignore . svn commit -m "..." cvs history -T cvs rtag "VERSION_X_X_X" oniguruma > brew install autoconf > brew install automake > brew install libtool * write Makefile.am and configure.in. > libtoolize or glibtoolize > aclocal > autoheader > automake --foreign --add-missing > autoconf > configure --with-rubydir=... CFLAGS="-O2 -Wall" VERSION = current:revision:age current: interface number (from 0) revision: implementation number of same interface (from 0) age: number of supported previous interfaces (if current only supported then age == 0) MacOS X $ shasum -a 256 -b onig-X.Y.Z.tar.gz > onig-X.Y.Z.tar.gz.sha256 MacOS X $ shasum -a 256 -c onig-X.Y.Z.tar.gz.sha256 //END jq-1.8.2/vendor/oniguruma/Makefile.in0000644000175100017510000007554115215513553013210 # Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = onig-config CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) 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 DATA = $(pkgconfig_DATA) 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) # 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)/onig-config.in \ AUTHORS COPYING ChangeLog INSTALL NEWS README compile \ config.guess config.sub depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXTRA_LIBONIG_LDFLAGS = @EXTRA_LIBONIG_LDFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBONIG_DEF_FILE = @LIBONIG_DEF_FILE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LTVERSION = @LTVERSION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src test sample EXTRA_DIST = oniguruma.pc.in HISTORY README_japanese README.md \ index.html index_ja.html make_win.bat \ CMakeLists.txt oniguruma.pc.cmake.in cmake/Config.cmake.in \ onig-config.cmake.in src/config.h.cmake.in \ doc/API doc/API.ja doc/RE doc/RE.ja doc/FAQ doc/FAQ.ja \ doc/CALLOUTS.BUILTIN doc/CALLOUTS.BUILTIN.ja \ doc/CALLOUTS.API doc/CALLOUTS.API.ja \ doc/SYNTAX.md doc/onig_syn_md.c doc/UNICODE_PROPERTIES \ src/Makefile.windows src/config.h.windows.in \ src/config.h.win32 src/config.h.win64 \ test/test.sh test/CMakeLists.txt \ windows/testc.c windows/CMakeLists.txt bin_SCRIPTS = onig-config do_subst = sed \ -e 's,[@]datadir[@],$(datadir),g' \ -e 's,[@]datarootdir[@],$(datarootdir),g' \ -e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \ -e 's,[@]prefix[@],$(prefix),g' \ -e 's,[@]exec_prefix[@],$(exec_prefix),g' \ -e 's,[@]libdir[@],$(libdir),g' \ -e 's,[@]includedir[@],$(includedir),g' pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = oniguruma.pc DISTCLEANFILES = oniguruma.pc all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu 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: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): onig-config: $(top_builddir)/config.status $(srcdir)/onig-config.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # 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) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binSCRIPTS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binSCRIPTS uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip dist-zstd distcheck distclean \ distclean-generic distclean-libtool distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-binSCRIPTS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-pkgconfigDATA 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 \ uninstall-binSCRIPTS uninstall-pkgconfigDATA .PRECIOUS: Makefile onig-config: onig-config.in oniguruma.pc: $(srcdir)/oniguruma.pc.in Makefile $(do_subst) < $(srcdir)/oniguruma.pc.in > $(@) all-test: cd test; make test archive: git archive --format=tar --prefix=oniguruma/ HEAD | gzip > ../oniguruma-archive.tar.gz tar: cd ..; tar cvf oniguruma-`date +%Y%m%d`.tar oniguruma; gzip oniguruma-`date +%Y%m%d`.tar debug: make clean ./configure CFLAGS="-O0 -g" make debug_out: make clean ./configure CFLAGS="-O0 -g -DONIG_DEBUG_PARSE -DONIG_DEBUG_COMPILE" make sanitize: make clean ./configure CFLAGS="-O -g -fsanitize=address" LDFLAGS="-fsanitize=address" make make all-test debug_out_sanitize: make clean ./configure CFLAGS="-O0 -g -fsanitize=address -DONIG_DEBUG_PARSE -DONIG_DEBUG_COMPILE" LDFLAGS="-fsanitize=address" make cov: make lcov-clear cd test; make CFLAGS="--coverage" test make lcov gcov: make CFLAGS="--coverage" lcov: lcov -c -d src/.libs -o coverage.info genhtml -o coverage coverage.info lcov-clear: lcov -z -d . cov-clean: clean rm -rf coverage coverage.info find . -name '*.gcno' | xargs rm -f # 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: jq-1.8.2/vendor/oniguruma/oniguruma.pc.in0000644000175100017510000000041515215513537014070 prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ datadir=@datadir@ Name: oniguruma Description: Regular expression library Version: @PACKAGE_VERSION@ Requires: Libs: -L${libdir} -lonig Cflags: -I${includedir} jq-1.8.2/vendor/decNumber/0000755000175100017510000000000015215513665011111 5jq-1.8.2/vendor/decNumber/decContext.h0000644000175100017510000003102415215513536013277 /* ------------------------------------------------------------------ */ /* Decimal Context module header */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2010. All rights reserved. */ /* */ /* This software is made available under the terms of the */ /* ICU License -- ICU 1.8.1 and later. */ /* */ /* The description and User's Guide ("The decNumber C Library") for */ /* this software is called decNumber.pdf. This document is */ /* available, together with arithmetic and format specifications, */ /* testcases, and Web links, on the General Decimal Arithmetic page. */ /* */ /* Please send comments, suggestions, and corrections to the author: */ /* mfc@uk.ibm.com */ /* Mike Cowlishaw, IBM Fellow */ /* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */ /* ------------------------------------------------------------------ */ /* */ /* Context variables must always have valid values: */ /* */ /* status -- [any bits may be cleared, but not set, by user] */ /* round -- must be one of the enumerated rounding modes */ /* */ /* The following variables are implied for fixed size formats (i.e., */ /* they are ignored) but should still be set correctly in case used */ /* with decNumber functions: */ /* */ /* clamp -- must be either 0 or 1 */ /* digits -- must be in the range 1 through 999999999 */ /* emax -- must be in the range 0 through 999999999 */ /* emin -- must be in the range 0 through -999999999 */ /* extended -- must be either 0 or 1 [present only if DECSUBSET] */ /* traps -- only defined bits may be set */ /* */ /* ------------------------------------------------------------------ */ #if !defined(DECCONTEXT) #define DECCONTEXT #define DECCNAME "decContext" /* Short name */ #define DECCFULLNAME "Decimal Context Descriptor" /* Verbose name */ #define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */ #if !defined(int32_t) #include /* C99 standard integers */ #endif #include /* for printf, etc. */ #include /* for traps */ /* Extended flags setting -- set this to 0 to use only IEEE flags */ #if !defined(DECEXTFLAG) #define DECEXTFLAG 1 /* 1=enable extended flags */ #endif /* Conditional code flag -- set this to 0 for best performance */ #if !defined(DECSUBSET) #define DECSUBSET 0 /* 1=enable subset arithmetic */ #endif /* Context for operations, with associated constants */ enum rounding { DEC_ROUND_CEILING, /* round towards +infinity */ DEC_ROUND_UP, /* round away from 0 */ DEC_ROUND_HALF_UP, /* 0.5 rounds up */ DEC_ROUND_HALF_EVEN, /* 0.5 rounds to nearest even */ DEC_ROUND_HALF_DOWN, /* 0.5 rounds down */ DEC_ROUND_DOWN, /* round towards 0 (truncate) */ DEC_ROUND_FLOOR, /* round towards -infinity */ DEC_ROUND_05UP, /* round for reround */ DEC_ROUND_MAX /* enum must be less than this */ }; #define DEC_ROUND_DEFAULT DEC_ROUND_HALF_EVEN; typedef struct { int32_t digits; /* working precision */ int32_t emax; /* maximum positive exponent */ int32_t emin; /* minimum negative exponent */ enum rounding round; /* rounding mode */ uint32_t traps; /* trap-enabler flags */ uint32_t status; /* status flags */ uint8_t clamp; /* flag: apply IEEE exponent clamp */ #if DECSUBSET uint8_t extended; /* flag: special-values allowed */ #endif } decContext; /* Maxima and Minima for context settings */ #define DEC_MAX_DIGITS 999999999 #define DEC_MIN_DIGITS 1 #define DEC_MAX_EMAX 999999999 #define DEC_MIN_EMAX 0 #define DEC_MAX_EMIN 0 #define DEC_MIN_EMIN -999999999 #define DEC_MAX_MATH 999999 /* max emax, etc., for math funcs. */ /* Classifications for decimal numbers, aligned with 754 (note that */ /* 'normal' and 'subnormal' are meaningful only with a decContext */ /* or a fixed size format). */ enum decClass { DEC_CLASS_SNAN, DEC_CLASS_QNAN, DEC_CLASS_NEG_INF, DEC_CLASS_NEG_NORMAL, DEC_CLASS_NEG_SUBNORMAL, DEC_CLASS_NEG_ZERO, DEC_CLASS_POS_ZERO, DEC_CLASS_POS_SUBNORMAL, DEC_CLASS_POS_NORMAL, DEC_CLASS_POS_INF }; /* Strings for the decClasses */ #define DEC_ClassString_SN "sNaN" #define DEC_ClassString_QN "NaN" #define DEC_ClassString_NI "-Infinity" #define DEC_ClassString_NN "-Normal" #define DEC_ClassString_NS "-Subnormal" #define DEC_ClassString_NZ "-Zero" #define DEC_ClassString_PZ "+Zero" #define DEC_ClassString_PS "+Subnormal" #define DEC_ClassString_PN "+Normal" #define DEC_ClassString_PI "+Infinity" #define DEC_ClassString_UN "Invalid" /* Trap-enabler and Status flags (exceptional conditions), and */ /* their names. The top byte is reserved for internal use */ #if DECEXTFLAG /* Extended flags */ #define DEC_Conversion_syntax 0x00000001 #define DEC_Division_by_zero 0x00000002 #define DEC_Division_impossible 0x00000004 #define DEC_Division_undefined 0x00000008 #define DEC_Insufficient_storage 0x00000010 /* [when malloc fails] */ #define DEC_Inexact 0x00000020 #define DEC_Invalid_context 0x00000040 #define DEC_Invalid_operation 0x00000080 #if DECSUBSET #define DEC_Lost_digits 0x00000100 #endif #define DEC_Overflow 0x00000200 #define DEC_Clamped 0x00000400 #define DEC_Rounded 0x00000800 #define DEC_Subnormal 0x00001000 #define DEC_Underflow 0x00002000 #else /* IEEE flags only */ #define DEC_Conversion_syntax 0x00000010 #define DEC_Division_by_zero 0x00000002 #define DEC_Division_impossible 0x00000010 #define DEC_Division_undefined 0x00000010 #define DEC_Insufficient_storage 0x00000010 /* [when malloc fails] */ #define DEC_Inexact 0x00000001 #define DEC_Invalid_context 0x00000010 #define DEC_Invalid_operation 0x00000010 #if DECSUBSET #define DEC_Lost_digits 0x00000000 #endif #define DEC_Overflow 0x00000008 #define DEC_Clamped 0x00000000 #define DEC_Rounded 0x00000000 #define DEC_Subnormal 0x00000000 #define DEC_Underflow 0x00000004 #endif /* IEEE 754 groupings for the flags */ /* [DEC_Clamped, DEC_Lost_digits, DEC_Rounded, and DEC_Subnormal */ /* are not in IEEE 754] */ #define DEC_IEEE_754_Division_by_zero (DEC_Division_by_zero) #if DECSUBSET #define DEC_IEEE_754_Inexact (DEC_Inexact | DEC_Lost_digits) #else #define DEC_IEEE_754_Inexact (DEC_Inexact) #endif #define DEC_IEEE_754_Invalid_operation (DEC_Conversion_syntax | \ DEC_Division_impossible | \ DEC_Division_undefined | \ DEC_Insufficient_storage | \ DEC_Invalid_context | \ DEC_Invalid_operation) #define DEC_IEEE_754_Overflow (DEC_Overflow) #define DEC_IEEE_754_Underflow (DEC_Underflow) /* flags which are normally errors (result is qNaN, infinite, or 0) */ #define DEC_Errors (DEC_IEEE_754_Division_by_zero | \ DEC_IEEE_754_Invalid_operation | \ DEC_IEEE_754_Overflow | DEC_IEEE_754_Underflow) /* flags which cause a result to become qNaN */ #define DEC_NaNs DEC_IEEE_754_Invalid_operation /* flags which are normally for information only (finite results) */ #if DECSUBSET #define DEC_Information (DEC_Clamped | DEC_Rounded | DEC_Inexact \ | DEC_Lost_digits) #else #define DEC_Information (DEC_Clamped | DEC_Rounded | DEC_Inexact) #endif /* IEEE 854 names (for compatibility with older decNumber versions) */ #define DEC_IEEE_854_Division_by_zero DEC_IEEE_754_Division_by_zero #define DEC_IEEE_854_Inexact DEC_IEEE_754_Inexact #define DEC_IEEE_854_Invalid_operation DEC_IEEE_754_Invalid_operation #define DEC_IEEE_854_Overflow DEC_IEEE_754_Overflow #define DEC_IEEE_854_Underflow DEC_IEEE_754_Underflow /* Name strings for the exceptional conditions */ #define DEC_Condition_CS "Conversion syntax" #define DEC_Condition_DZ "Division by zero" #define DEC_Condition_DI "Division impossible" #define DEC_Condition_DU "Division undefined" #define DEC_Condition_IE "Inexact" #define DEC_Condition_IS "Insufficient storage" #define DEC_Condition_IC "Invalid context" #define DEC_Condition_IO "Invalid operation" #if DECSUBSET #define DEC_Condition_LD "Lost digits" #endif #define DEC_Condition_OV "Overflow" #define DEC_Condition_PA "Clamped" #define DEC_Condition_RO "Rounded" #define DEC_Condition_SU "Subnormal" #define DEC_Condition_UN "Underflow" #define DEC_Condition_ZE "No status" #define DEC_Condition_MU "Multiple status" #define DEC_Condition_Length 21 /* length of the longest string, */ /* including terminator */ /* Initialization descriptors, used by decContextDefault */ #define DEC_INIT_BASE 0 #define DEC_INIT_DECIMAL32 32 #define DEC_INIT_DECIMAL64 64 #define DEC_INIT_DECIMAL128 128 /* Synonyms */ #define DEC_INIT_DECSINGLE DEC_INIT_DECIMAL32 #define DEC_INIT_DECDOUBLE DEC_INIT_DECIMAL64 #define DEC_INIT_DECQUAD DEC_INIT_DECIMAL128 /* decContext routines */ extern decContext * decContextClearStatus(decContext *, uint32_t); extern decContext * decContextDefault(decContext *, int32_t); extern enum rounding decContextGetRounding(decContext *); extern uint32_t decContextGetStatus(decContext *); extern decContext * decContextRestoreStatus(decContext *, uint32_t, uint32_t); extern uint32_t decContextSaveStatus(decContext *, uint32_t); extern decContext * decContextSetRounding(decContext *, enum rounding); extern decContext * decContextSetStatus(decContext *, uint32_t); extern decContext * decContextSetStatusFromString(decContext *, const char *); extern decContext * decContextSetStatusFromStringQuiet(decContext *, const char *); extern decContext * decContextSetStatusQuiet(decContext *, uint32_t); extern const char * decContextStatusToString(const decContext *); extern int32_t decContextTestEndian(uint8_t); extern uint32_t decContextTestSavedStatus(uint32_t, uint32_t); extern uint32_t decContextTestStatus(decContext *, uint32_t); extern decContext * decContextZeroStatus(decContext *); #endif jq-1.8.2/vendor/decNumber/decNumber.h0000644000175100017510000002652315215513536013113 /* ------------------------------------------------------------------ */ /* Decimal Number arithmetic module header */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2010. All rights reserved. */ /* */ /* This software is made available under the terms of the */ /* ICU License -- ICU 1.8.1 and later. */ /* */ /* The description and User's Guide ("The decNumber C Library") for */ /* this software is called decNumber.pdf. This document is */ /* available, together with arithmetic and format specifications, */ /* testcases, and Web links, on the General Decimal Arithmetic page. */ /* */ /* Please send comments, suggestions, and corrections to the author: */ /* mfc@uk.ibm.com */ /* Mike Cowlishaw, IBM Fellow */ /* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */ /* ------------------------------------------------------------------ */ #if !defined(DECNUMBER) #define DECNUMBER #define DECNAME "decNumber" /* Short name */ #define DECFULLNAME "Decimal Number Module" /* Verbose name */ #define DECAUTHOR "Mike Cowlishaw" /* Who to blame */ #if !defined(DECCONTEXT) #include "decContext.h" #endif /* Bit settings for decNumber.bits */ #define DECNEG 0x80 /* Sign; 1=negative, 0=positive or zero */ #define DECINF 0x40 /* 1=Infinity */ #define DECNAN 0x20 /* 1=NaN */ #define DECSNAN 0x10 /* 1=sNaN */ /* The remaining bits are reserved; they must be 0 */ #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value */ /* Define the decNumber data structure. The size and shape of the */ /* units array in the structure is determined by the following */ /* constant. This must not be changed without recompiling the */ /* decNumber library modules. */ #define DECDPUN 3 /* DECimal Digits Per UNit [must be >0 */ /* and <10; 3 or powers of 2 are best]. */ /* DECNUMDIGITS is the default number of digits that can be held in */ /* the structure. If undefined, 1 is assumed and it is assumed */ /* that the structure will be immediately followed by extra space, */ /* as required. DECNUMDIGITS is always >0. */ #if !defined(DECNUMDIGITS) #define DECNUMDIGITS 1 #endif /* The size (integer data type) of each unit is determined by the */ /* number of digits it will hold. */ #if DECDPUN<=2 #define decNumberUnit uint8_t #elif DECDPUN<=4 #define decNumberUnit uint16_t #else #define decNumberUnit uint32_t #endif /* The number of units needed is ceil(DECNUMDIGITS/DECDPUN) */ #define DECNUMUNITS ((DECNUMDIGITS+DECDPUN-1)/DECDPUN) /* The data structure... */ typedef struct { int32_t digits; /* Count of digits in the coefficient; >0 */ int32_t exponent; /* Unadjusted exponent, unbiased, in */ /* range: -1999999997 through 999999999 */ uint8_t bits; /* Indicator bits (see above) */ /* Coefficient, from least significant unit */ decNumberUnit lsu[DECNUMUNITS]; } decNumber; /* Notes: */ /* 1. If digits is > DECDPUN then there will one or more */ /* decNumberUnits immediately following the first element of lsu.*/ /* These contain the remaining (more significant) digits of the */ /* number, and may be in the lsu array, or may be guaranteed by */ /* some other mechanism (such as being contained in another */ /* structure, or being overlaid on dynamically allocated */ /* storage). */ /* */ /* Each integer of the coefficient (except potentially the last) */ /* contains DECDPUN digits (e.g., a value in the range 0 through */ /* 99999999 if DECDPUN is 8, or 0 through 999 if DECDPUN is 3). */ /* */ /* 2. A decNumber converted to a string may need up to digits+14 */ /* characters. The worst cases (non-exponential and exponential */ /* formats) are -0.00000{9...}# and -9.{9...}E+999999999# */ /* (where # is '\0') */ /* ---------------------------------------------------------------- */ /* decNumber public functions and macros */ /* ---------------------------------------------------------------- */ /* Conversions */ decNumber * decNumberFromInt32(decNumber *, int32_t); decNumber * decNumberFromUInt32(decNumber *, uint32_t); decNumber * decNumberFromString(decNumber *, const char *, decContext *); char * decNumberToString(const decNumber *, char *); char * decNumberToEngString(const decNumber *, char *); uint32_t decNumberToUInt32(const decNumber *, decContext *); int32_t decNumberToInt32(const decNumber *, decContext *); uint8_t * decNumberGetBCD(const decNumber *, uint8_t *); decNumber * decNumberSetBCD(decNumber *, const uint8_t *, uint32_t); /* Operators and elementary functions */ decNumber * decNumberAbs(decNumber *, const decNumber *, decContext *); decNumber * decNumberAdd(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberAnd(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberCompare(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberCompareSignal(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberCompareTotal(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberCompareTotalMag(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberDivide(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberDivideInteger(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberExp(decNumber *, const decNumber *, decContext *); decNumber * decNumberFMA(decNumber *, const decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberInvert(decNumber *, const decNumber *, decContext *); decNumber * decNumberLn(decNumber *, const decNumber *, decContext *); decNumber * decNumberLogB(decNumber *, const decNumber *, decContext *); decNumber * decNumberLog10(decNumber *, const decNumber *, decContext *); decNumber * decNumberMax(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberMaxMag(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberMin(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberMinMag(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberMinus(decNumber *, const decNumber *, decContext *); decNumber * decNumberMultiply(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberNormalize(decNumber *, const decNumber *, decContext *); decNumber * decNumberOr(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberPlus(decNumber *, const decNumber *, decContext *); decNumber * decNumberPower(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberQuantize(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberReduce(decNumber *, const decNumber *, decContext *); decNumber * decNumberRemainder(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberRemainderNear(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberRescale(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberRotate(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberSameQuantum(decNumber *, const decNumber *, const decNumber *); decNumber * decNumberScaleB(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberShift(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberSquareRoot(decNumber *, const decNumber *, decContext *); decNumber * decNumberSubtract(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberToIntegralExact(decNumber *, const decNumber *, decContext *); decNumber * decNumberToIntegralValue(decNumber *, const decNumber *, decContext *); decNumber * decNumberXor(decNumber *, const decNumber *, const decNumber *, decContext *); /* Utilities */ enum decClass decNumberClass(const decNumber *, decContext *); const char * decNumberClassToString(enum decClass); decNumber * decNumberCopy(decNumber *, const decNumber *); decNumber * decNumberCopyAbs(decNumber *, const decNumber *); decNumber * decNumberCopyNegate(decNumber *, const decNumber *); decNumber * decNumberCopySign(decNumber *, const decNumber *, const decNumber *); decNumber * decNumberNextMinus(decNumber *, const decNumber *, decContext *); decNumber * decNumberNextPlus(decNumber *, const decNumber *, decContext *); decNumber * decNumberNextToward(decNumber *, const decNumber *, const decNumber *, decContext *); decNumber * decNumberTrim(decNumber *); const char * decNumberVersion(void); decNumber * decNumberZero(decNumber *); /* Functions for testing decNumbers (normality depends on context) */ int32_t decNumberIsNormal(const decNumber *, decContext *); int32_t decNumberIsSubnormal(const decNumber *, decContext *); /* Macros for testing decNumber *dn */ #define decNumberIsCanonical(dn) (1) /* All decNumbers are saintly */ #define decNumberIsFinite(dn) (((dn)->bits&DECSPECIAL)==0) #define decNumberIsInfinite(dn) (((dn)->bits&DECINF)!=0) #define decNumberIsNaN(dn) (((dn)->bits&(DECNAN|DECSNAN))!=0) #define decNumberIsNegative(dn) (((dn)->bits&DECNEG)!=0) #define decNumberIsQNaN(dn) (((dn)->bits&(DECNAN))!=0) #define decNumberIsSNaN(dn) (((dn)->bits&(DECSNAN))!=0) #define decNumberIsSpecial(dn) (((dn)->bits&DECSPECIAL)!=0) #define decNumberIsZero(dn) (*(dn)->lsu==0 \ && (dn)->digits==1 \ && (((dn)->bits&DECSPECIAL)==0)) #define decNumberRadix(dn) (10) #endif jq-1.8.2/vendor/decNumber/decContext.c0000644000175100017510000005774315215513536013312 /* ------------------------------------------------------------------ */ /* Decimal Context module */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2009. All rights reserved. */ /* */ /* This software is made available under the terms of the */ /* ICU License -- ICU 1.8.1 and later. */ /* */ /* The description and User's Guide ("The decNumber C Library") for */ /* this software is called decNumber.pdf. This document is */ /* available, together with arithmetic and format specifications, */ /* testcases, and Web links, on the General Decimal Arithmetic page. */ /* */ /* Please send comments, suggestions, and corrections to the author: */ /* mfc@uk.ibm.com */ /* Mike Cowlishaw, IBM Fellow */ /* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */ /* ------------------------------------------------------------------ */ /* This module comprises the routines for handling arithmetic */ /* context structures. */ /* ------------------------------------------------------------------ */ #include // for strcmp #include // for printf if DECCHECK #include "decContext.h" // context and base types #include "decNumberLocal.h" // decNumber local types, etc. /* compile-time endian tester [assumes sizeof(Int)>1] */ static const Int mfcone=1; // constant 1 static const Flag *mfctop=(const Flag *)&mfcone; // -> top byte #define LITEND *mfctop // named flag; 1=little-endian /* ------------------------------------------------------------------ */ /* round-for-reround digits */ /* ------------------------------------------------------------------ */ const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */ /* ------------------------------------------------------------------ */ /* Powers of ten (powers[n]==10**n, 0<=n<=9) */ /* ------------------------------------------------------------------ */ const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; /* ------------------------------------------------------------------ */ /* decContextClearStatus -- clear bits in current status */ /* */ /* context is the context structure to be queried */ /* mask indicates the bits to be cleared (the status bit that */ /* corresponds to each 1 bit in the mask is cleared) */ /* returns context */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decContext *decContextClearStatus(decContext *context, uInt mask) { context->status&=~mask; return context; } // decContextClearStatus /* ------------------------------------------------------------------ */ /* decContextDefault -- initialize a context structure */ /* */ /* context is the structure to be initialized */ /* kind selects the required set of default values, one of: */ /* DEC_INIT_BASE -- select ANSI X3-274 defaults */ /* DEC_INIT_DECIMAL32 -- select IEEE 754 defaults, 32-bit */ /* DEC_INIT_DECIMAL64 -- select IEEE 754 defaults, 64-bit */ /* DEC_INIT_DECIMAL128 -- select IEEE 754 defaults, 128-bit */ /* For any other value a valid context is returned, but with */ /* Invalid_operation set in the status field. */ /* returns a context structure with the appropriate initial values. */ /* ------------------------------------------------------------------ */ decContext * decContextDefault(decContext *context, Int kind) { // set defaults... context->digits=9; // 9 digits context->emax=DEC_MAX_EMAX; // 9-digit exponents context->emin=DEC_MIN_EMIN; // .. balanced context->round=DEC_ROUND_HALF_UP; // 0.5 rises context->traps=DEC_Errors; // all but informational context->status=0; // cleared context->clamp=0; // no clamping #if DECSUBSET context->extended=0; // cleared #endif switch (kind) { case DEC_INIT_BASE: // [use defaults] break; case DEC_INIT_DECIMAL32: context->digits=7; // digits context->emax=96; // Emax context->emin=-95; // Emin context->round=DEC_ROUND_HALF_EVEN; // 0.5 to nearest even context->traps=0; // no traps set context->clamp=1; // clamp exponents #if DECSUBSET context->extended=1; // set #endif break; case DEC_INIT_DECIMAL64: context->digits=16; // digits context->emax=384; // Emax context->emin=-383; // Emin context->round=DEC_ROUND_HALF_EVEN; // 0.5 to nearest even context->traps=0; // no traps set context->clamp=1; // clamp exponents #if DECSUBSET context->extended=1; // set #endif break; case DEC_INIT_DECIMAL128: context->digits=34; // digits context->emax=6144; // Emax context->emin=-6143; // Emin context->round=DEC_ROUND_HALF_EVEN; // 0.5 to nearest even context->traps=0; // no traps set context->clamp=1; // clamp exponents #if DECSUBSET context->extended=1; // set #endif break; default: // invalid Kind // use defaults, and .. decContextSetStatus(context, DEC_Invalid_operation); // trap } return context;} // decContextDefault /* ------------------------------------------------------------------ */ /* decContextGetRounding -- return current rounding mode */ /* */ /* context is the context structure to be queried */ /* returns the rounding mode */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ enum rounding decContextGetRounding(decContext *context) { return context->round; } // decContextGetRounding /* ------------------------------------------------------------------ */ /* decContextGetStatus -- return current status */ /* */ /* context is the context structure to be queried */ /* returns status */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ uInt decContextGetStatus(decContext *context) { return context->status; } // decContextGetStatus /* ------------------------------------------------------------------ */ /* decContextRestoreStatus -- restore bits in current status */ /* */ /* context is the context structure to be updated */ /* newstatus is the source for the bits to be restored */ /* mask indicates the bits to be restored (the status bit that */ /* corresponds to each 1 bit in the mask is set to the value of */ /* the correspnding bit in newstatus) */ /* returns context */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decContext *decContextRestoreStatus(decContext *context, uInt newstatus, uInt mask) { context->status&=~mask; // clear the selected bits context->status|=(mask&newstatus); // or in the new bits return context; } // decContextRestoreStatus /* ------------------------------------------------------------------ */ /* decContextSaveStatus -- save bits in current status */ /* */ /* context is the context structure to be queried */ /* mask indicates the bits to be saved (the status bits that */ /* correspond to each 1 bit in the mask are saved) */ /* returns the AND of the mask and the current status */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ uInt decContextSaveStatus(decContext *context, uInt mask) { return context->status&mask; } // decContextSaveStatus /* ------------------------------------------------------------------ */ /* decContextSetRounding -- set current rounding mode */ /* */ /* context is the context structure to be updated */ /* newround is the value which will replace the current mode */ /* returns context */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decContext *decContextSetRounding(decContext *context, enum rounding newround) { context->round=newround; return context; } // decContextSetRounding /* ------------------------------------------------------------------ */ /* decContextSetStatus -- set status and raise trap if appropriate */ /* */ /* context is the context structure to be updated */ /* status is the DEC_ exception code */ /* returns the context structure */ /* */ /* Control may never return from this routine, if there is a signal */ /* handler and it takes a long jump. */ /* ------------------------------------------------------------------ */ decContext * decContextSetStatus(decContext *context, uInt status) { context->status|=status; if (status & context->traps) raise(SIGFPE); return context;} // decContextSetStatus /* ------------------------------------------------------------------ */ /* decContextSetStatusFromString -- set status from a string + trap */ /* */ /* context is the context structure to be updated */ /* string is a string exactly equal to one that might be returned */ /* by decContextStatusToString */ /* */ /* The status bit corresponding to the string is set, and a trap */ /* is raised if appropriate. */ /* */ /* returns the context structure, unless the string is equal to */ /* DEC_Condition_MU or is not recognized. In these cases NULL is */ /* returned. */ /* ------------------------------------------------------------------ */ decContext * decContextSetStatusFromString(decContext *context, const char *string) { if (strcmp(string, DEC_Condition_CS)==0) return decContextSetStatus(context, DEC_Conversion_syntax); if (strcmp(string, DEC_Condition_DZ)==0) return decContextSetStatus(context, DEC_Division_by_zero); if (strcmp(string, DEC_Condition_DI)==0) return decContextSetStatus(context, DEC_Division_impossible); if (strcmp(string, DEC_Condition_DU)==0) return decContextSetStatus(context, DEC_Division_undefined); if (strcmp(string, DEC_Condition_IE)==0) return decContextSetStatus(context, DEC_Inexact); if (strcmp(string, DEC_Condition_IS)==0) return decContextSetStatus(context, DEC_Insufficient_storage); if (strcmp(string, DEC_Condition_IC)==0) return decContextSetStatus(context, DEC_Invalid_context); if (strcmp(string, DEC_Condition_IO)==0) return decContextSetStatus(context, DEC_Invalid_operation); #if DECSUBSET if (strcmp(string, DEC_Condition_LD)==0) return decContextSetStatus(context, DEC_Lost_digits); #endif if (strcmp(string, DEC_Condition_OV)==0) return decContextSetStatus(context, DEC_Overflow); if (strcmp(string, DEC_Condition_PA)==0) return decContextSetStatus(context, DEC_Clamped); if (strcmp(string, DEC_Condition_RO)==0) return decContextSetStatus(context, DEC_Rounded); if (strcmp(string, DEC_Condition_SU)==0) return decContextSetStatus(context, DEC_Subnormal); if (strcmp(string, DEC_Condition_UN)==0) return decContextSetStatus(context, DEC_Underflow); if (strcmp(string, DEC_Condition_ZE)==0) return context; return NULL; // Multiple status, or unknown } // decContextSetStatusFromString /* ------------------------------------------------------------------ */ /* decContextSetStatusFromStringQuiet -- set status from a string */ /* */ /* context is the context structure to be updated */ /* string is a string exactly equal to one that might be returned */ /* by decContextStatusToString */ /* */ /* The status bit corresponding to the string is set; no trap is */ /* raised. */ /* */ /* returns the context structure, unless the string is equal to */ /* DEC_Condition_MU or is not recognized. In these cases NULL is */ /* returned. */ /* ------------------------------------------------------------------ */ decContext * decContextSetStatusFromStringQuiet(decContext *context, const char *string) { if (strcmp(string, DEC_Condition_CS)==0) return decContextSetStatusQuiet(context, DEC_Conversion_syntax); if (strcmp(string, DEC_Condition_DZ)==0) return decContextSetStatusQuiet(context, DEC_Division_by_zero); if (strcmp(string, DEC_Condition_DI)==0) return decContextSetStatusQuiet(context, DEC_Division_impossible); if (strcmp(string, DEC_Condition_DU)==0) return decContextSetStatusQuiet(context, DEC_Division_undefined); if (strcmp(string, DEC_Condition_IE)==0) return decContextSetStatusQuiet(context, DEC_Inexact); if (strcmp(string, DEC_Condition_IS)==0) return decContextSetStatusQuiet(context, DEC_Insufficient_storage); if (strcmp(string, DEC_Condition_IC)==0) return decContextSetStatusQuiet(context, DEC_Invalid_context); if (strcmp(string, DEC_Condition_IO)==0) return decContextSetStatusQuiet(context, DEC_Invalid_operation); #if DECSUBSET if (strcmp(string, DEC_Condition_LD)==0) return decContextSetStatusQuiet(context, DEC_Lost_digits); #endif if (strcmp(string, DEC_Condition_OV)==0) return decContextSetStatusQuiet(context, DEC_Overflow); if (strcmp(string, DEC_Condition_PA)==0) return decContextSetStatusQuiet(context, DEC_Clamped); if (strcmp(string, DEC_Condition_RO)==0) return decContextSetStatusQuiet(context, DEC_Rounded); if (strcmp(string, DEC_Condition_SU)==0) return decContextSetStatusQuiet(context, DEC_Subnormal); if (strcmp(string, DEC_Condition_UN)==0) return decContextSetStatusQuiet(context, DEC_Underflow); if (strcmp(string, DEC_Condition_ZE)==0) return context; return NULL; // Multiple status, or unknown } // decContextSetStatusFromStringQuiet /* ------------------------------------------------------------------ */ /* decContextSetStatusQuiet -- set status without trap */ /* */ /* context is the context structure to be updated */ /* status is the DEC_ exception code */ /* returns the context structure */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decContext * decContextSetStatusQuiet(decContext *context, uInt status) { context->status|=status; return context;} // decContextSetStatusQuiet /* ------------------------------------------------------------------ */ /* decContextStatusToString -- convert status flags to a string */ /* */ /* context is a context with valid status field */ /* */ /* returns a constant string describing the condition. If multiple */ /* (or no) flags are set, a generic constant message is returned. */ /* ------------------------------------------------------------------ */ const char *decContextStatusToString(const decContext *context) { Int status=context->status; // test the five IEEE first, as some of the others are ambiguous when // DECEXTFLAG=0 if (status==DEC_Invalid_operation ) return DEC_Condition_IO; if (status==DEC_Division_by_zero ) return DEC_Condition_DZ; if (status==DEC_Overflow ) return DEC_Condition_OV; if (status==DEC_Underflow ) return DEC_Condition_UN; if (status==DEC_Inexact ) return DEC_Condition_IE; if (status==DEC_Division_impossible ) return DEC_Condition_DI; if (status==DEC_Division_undefined ) return DEC_Condition_DU; if (status==DEC_Rounded ) return DEC_Condition_RO; if (status==DEC_Clamped ) return DEC_Condition_PA; if (status==DEC_Subnormal ) return DEC_Condition_SU; if (status==DEC_Conversion_syntax ) return DEC_Condition_CS; if (status==DEC_Insufficient_storage ) return DEC_Condition_IS; if (status==DEC_Invalid_context ) return DEC_Condition_IC; #if DECSUBSET if (status==DEC_Lost_digits ) return DEC_Condition_LD; #endif if (status==0 ) return DEC_Condition_ZE; return DEC_Condition_MU; // Multiple errors } // decContextStatusToString /* ------------------------------------------------------------------ */ /* decContextTestEndian -- test whether DECLITEND is set correctly */ /* */ /* quiet is 1 to suppress message; 0 otherwise */ /* returns 0 if DECLITEND is correct */ /* 1 if DECLITEND is incorrect and should be 1 */ /* -1 if DECLITEND is incorrect and should be 0 */ /* */ /* A message is displayed if the return value is not 0 and quiet==0. */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ Int decContextTestEndian(Flag quiet) { Int res=0; // optimist uInt dle=(uInt)DECLITEND; // unsign if (dle>1) dle=1; // ensure 0 or 1 if (LITEND!=DECLITEND) { if (!quiet) { // always refer to this #if DECPRINT const char *adj; if (LITEND) adj="little"; else adj="big"; printf("Warning: DECLITEND is set to %d, but this computer appears to be %s-endian\n", DECLITEND, adj); #endif } res=(Int)LITEND-dle; } return res; } // decContextTestEndian /* ------------------------------------------------------------------ */ /* decContextTestSavedStatus -- test bits in saved status */ /* */ /* oldstatus is the status word to be tested */ /* mask indicates the bits to be tested (the oldstatus bits that */ /* correspond to each 1 bit in the mask are tested) */ /* returns 1 if any of the tested bits are 1, or 0 otherwise */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ uInt decContextTestSavedStatus(uInt oldstatus, uInt mask) { return (oldstatus&mask)!=0; } // decContextTestSavedStatus /* ------------------------------------------------------------------ */ /* decContextTestStatus -- test bits in current status */ /* */ /* context is the context structure to be updated */ /* mask indicates the bits to be tested (the status bits that */ /* correspond to each 1 bit in the mask are tested) */ /* returns 1 if any of the tested bits are 1, or 0 otherwise */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ uInt decContextTestStatus(decContext *context, uInt mask) { return (context->status&mask)!=0; } // decContextTestStatus /* ------------------------------------------------------------------ */ /* decContextZeroStatus -- clear all status bits */ /* */ /* context is the context structure to be updated */ /* returns context */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decContext *decContextZeroStatus(decContext *context) { context->status=0; return context; } // decContextZeroStatus jq-1.8.2/vendor/decNumber/decNumber.c0000644000175100017510000140774015215513536013113 /* ------------------------------------------------------------------ */ /* Decimal Number arithmetic module */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2009. All rights reserved. */ /* */ /* This software is made available under the terms of the */ /* ICU License -- ICU 1.8.1 and later. */ /* */ /* The description and User's Guide ("The decNumber C Library") for */ /* this software is called decNumber.pdf. This document is */ /* available, together with arithmetic and format specifications, */ /* testcases, and Web links, on the General Decimal Arithmetic page. */ /* */ /* Please send comments, suggestions, and corrections to the author: */ /* mfc@uk.ibm.com */ /* Mike Cowlishaw, IBM Fellow */ /* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */ /* ------------------------------------------------------------------ */ /* This module comprises the routines for arbitrary-precision General */ /* Decimal Arithmetic as defined in the specification which may be */ /* found on the General Decimal Arithmetic pages. It implements both */ /* the full ('extended') arithmetic and the simpler ('subset') */ /* arithmetic. */ /* */ /* Usage notes: */ /* */ /* 1. This code is ANSI C89 except: */ /* */ /* a) C99 line comments (double forward slash) are used. (Most C */ /* compilers accept these. If yours does not, a simple script */ /* can be used to convert them to ANSI C comments.) */ /* */ /* b) Types from C99 stdint.h are used. If you do not have this */ /* header file, see the User's Guide section of the decNumber */ /* documentation; this lists the necessary definitions. */ /* */ /* c) If DECDPUN>4 or DECUSE64=1, the C99 64-bit int64_t and */ /* uint64_t types may be used. To avoid these, set DECUSE64=0 */ /* and DECDPUN<=4 (see documentation). */ /* */ /* The code also conforms to C99 restrictions; in particular, */ /* strict aliasing rules are observed. */ /* */ /* 2. The decNumber format which this library uses is optimized for */ /* efficient processing of relatively short numbers; in particular */ /* it allows the use of fixed sized structures and minimizes copy */ /* and move operations. It does, however, support arbitrary */ /* precision (up to 999,999,999 digits) and arbitrary exponent */ /* range (Emax in the range 0 through 999,999,999 and Emin in the */ /* range -999,999,999 through 0). Mathematical functions (for */ /* example decNumberExp) as identified below are restricted more */ /* tightly: digits, emax, and -emin in the context must be <= */ /* DEC_MAX_MATH (999999), and their operand(s) must be within */ /* these bounds. */ /* */ /* 3. Logical functions are further restricted; their operands must */ /* be finite, positive, have an exponent of zero, and all digits */ /* must be either 0 or 1. The result will only contain digits */ /* which are 0 or 1 (and will have exponent=0 and a sign of 0). */ /* */ /* 4. Operands to operator functions are never modified unless they */ /* are also specified to be the result number (which is always */ /* permitted). Other than that case, operands must not overlap. */ /* */ /* 5. Error handling: the type of the error is ORed into the status */ /* flags in the current context (decContext structure). The */ /* SIGFPE signal is then raised if the corresponding trap-enabler */ /* flag in the decContext is set (is 1). */ /* */ /* It is the responsibility of the caller to clear the status */ /* flags as required. */ /* */ /* The result of any routine which returns a number will always */ /* be a valid number (which may be a special value, such as an */ /* Infinity or NaN). */ /* */ /* 6. The decNumber format is not an exchangeable concrete */ /* representation as it comprises fields which may be machine- */ /* dependent (packed or unpacked, or special length, for example). */ /* Canonical conversions to and from strings are provided; other */ /* conversions are available in separate modules. */ /* */ /* 7. Normally, input operands are assumed to be valid. Set DECCHECK */ /* to 1 for extended operand checking (including NULL operands). */ /* Results are undefined if a badly-formed structure (or a NULL */ /* pointer to a structure) is provided, though with DECCHECK */ /* enabled the operator routines are protected against exceptions. */ /* (Except if the result pointer is NULL, which is unrecoverable.) */ /* */ /* However, the routines will never cause exceptions if they are */ /* given well-formed operands, even if the value of the operands */ /* is inappropriate for the operation and DECCHECK is not set. */ /* (Except for SIGFPE, as and where documented.) */ /* */ /* 8. Subset arithmetic is available only if DECSUBSET is set to 1. */ /* ------------------------------------------------------------------ */ /* Implementation notes for maintenance of this module: */ /* */ /* 1. Storage leak protection: Routines which use malloc are not */ /* permitted to use return for fastpath or error exits (i.e., */ /* they follow strict structured programming conventions). */ /* Instead they have a do{}while(0); construct surrounding the */ /* code which is protected -- break may be used to exit this. */ /* Other routines can safely use the return statement inline. */ /* */ /* Storage leak accounting can be enabled using DECALLOC. */ /* */ /* 2. All loops use the for(;;) construct. Any do construct does */ /* not loop; it is for allocation protection as just described. */ /* */ /* 3. Setting status in the context must always be the very last */ /* action in a routine, as non-0 status may raise a trap and hence */ /* the call to set status may not return (if the handler uses long */ /* jump). Therefore all cleanup must be done first. In general, */ /* to achieve this status is accumulated and is only applied just */ /* before return by calling decContextSetStatus (via decStatus). */ /* */ /* Routines which allocate storage cannot, in general, use the */ /* 'top level' routines which could cause a non-returning */ /* transfer of control. The decXxxxOp routines are safe (do not */ /* call decStatus even if traps are set in the context) and should */ /* be used instead (they are also a little faster). */ /* */ /* 4. Exponent checking is minimized by allowing the exponent to */ /* grow outside its limits during calculations, provided that */ /* the decFinalize function is called later. Multiplication and */ /* division, and intermediate calculations in exponentiation, */ /* require more careful checks because of the risk of 31-bit */ /* overflow (the most negative valid exponent is -1999999997, for */ /* a 999999999-digit number with adjusted exponent of -999999999). */ /* */ /* 5. Rounding is deferred until finalization of results, with any */ /* 'off to the right' data being represented as a single digit */ /* residue (in the range -1 through 9). This avoids any double- */ /* rounding when more than one shortening takes place (for */ /* example, when a result is subnormal). */ /* */ /* 6. The digits count is allowed to rise to a multiple of DECDPUN */ /* during many operations, so whole Units are handled and exact */ /* accounting of digits is not needed. The correct digits value */ /* is found by decGetDigits, which accounts for leading zeros. */ /* This must be called before any rounding if the number of digits */ /* is not known exactly. */ /* */ /* 7. The multiply-by-reciprocal 'trick' is used for partitioning */ /* numbers up to four digits, using appropriate constants. This */ /* is not useful for longer numbers because overflow of 32 bits */ /* would lead to 4 multiplies, which is almost as expensive as */ /* a divide (unless a floating-point or 64-bit multiply is */ /* assumed to be available). */ /* */ /* 8. Unusual abbreviations that may be used in the commentary: */ /* lhs -- left hand side (operand, of an operation) */ /* lsd -- least significant digit (of coefficient) */ /* lsu -- least significant Unit (of coefficient) */ /* msd -- most significant digit (of coefficient) */ /* msi -- most significant item (in an array) */ /* msu -- most significant Unit (of coefficient) */ /* rhs -- right hand side (operand, of an operation) */ /* +ve -- positive */ /* -ve -- negative */ /* ** -- raise to the power */ /* ------------------------------------------------------------------ */ #include // for malloc, free, etc. #include // for printf [if needed] #include // for strcpy #include // for lower #include "decNumber.h" // base number library #include "decNumberLocal.h" // decNumber local types, etc. /* Constants */ // Public lookup table used by the D2U macro const uByte d2utable[DECMAXD2U+1]=D2UTABLE; #define DECVERB 1 // set to 1 for verbose DECCHECK #define powers DECPOWERS // old internal name // Local constants #define DIVIDE 0x80 // Divide operators #define REMAINDER 0x40 // .. #define DIVIDEINT 0x20 // .. #define REMNEAR 0x10 // .. #define COMPARE 0x01 // Compare operators #define COMPMAX 0x02 // .. #define COMPMIN 0x03 // .. #define COMPTOTAL 0x04 // .. #define COMPNAN 0x05 // .. [NaN processing] #define COMPSIG 0x06 // .. [signaling COMPARE] #define COMPMAXMAG 0x07 // .. #define COMPMINMAG 0x08 // .. #define DEC_sNaN 0x40000000 // local status: sNaN signal #define BADINT (Int)0x80000000 // most-negative Int; error indicator // Next two indicate an integer >= 10**6, and its parity (bottom bit) #define BIGEVEN (Int)0x80000002 #define BIGODD (Int)0x80000003 static Unit uarrone[1]={1}; // Unit array of 1, used for incrementing /* Granularity-dependent code */ #if DECDPUN<=4 #define eInt Int // extended integer #define ueInt uInt // unsigned extended integer // Constant multipliers for divide-by-power-of five using reciprocal // multiply, after removing powers of 2 by shifting, and final shift // of 17 [we only need up to **4] static const uInt multies[]={131073, 26215, 5243, 1049, 210}; // QUOT10 -- macro to return the quotient of unit u divided by 10**n #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17) #else // For DECDPUN>4 non-ANSI-89 64-bit types are needed. #if !DECUSE64 #error decNumber.c: DECUSE64 must be 1 when DECDPUN>4 #endif #define eInt Long // extended integer #define ueInt uLong // unsigned extended integer #endif /* Local routines */ static decNumber * decAddOp(decNumber *, const decNumber *, const decNumber *, decContext *, uByte, uInt *); static Flag decBiStr(const char *, const char *, const char *); static uInt decCheckMath(const decNumber *, decContext *, uInt *); static void decApplyRound(decNumber *, decContext *, Int, uInt *); static Int decCompare(const decNumber *lhs, const decNumber *rhs, Flag); static decNumber * decCompareOp(decNumber *, const decNumber *, const decNumber *, decContext *, Flag, uInt *); static void decCopyFit(decNumber *, const decNumber *, decContext *, Int *, uInt *); static decNumber * decDecap(decNumber *, Int); static decNumber * decDivideOp(decNumber *, const decNumber *, const decNumber *, decContext *, Flag, uInt *); static decNumber * decExpOp(decNumber *, const decNumber *, decContext *, uInt *); static void decFinalize(decNumber *, decContext *, Int *, uInt *); static Int decGetDigits(Unit *, Int); static Int decGetInt(const decNumber *); static decNumber * decLnOp(decNumber *, const decNumber *, decContext *, uInt *); static decNumber * decMultiplyOp(decNumber *, const decNumber *, const decNumber *, decContext *, uInt *); static decNumber * decNaNs(decNumber *, const decNumber *, const decNumber *, decContext *, uInt *); static decNumber * decQuantizeOp(decNumber *, const decNumber *, const decNumber *, decContext *, Flag, uInt *); static void decReverse(Unit *, Unit *); static void decSetCoeff(decNumber *, decContext *, const Unit *, Int, Int *, uInt *); static void decSetMaxValue(decNumber *, decContext *); static void decSetOverflow(decNumber *, decContext *, uInt *); static void decSetSubnormal(decNumber *, decContext *, Int *, uInt *); static Int decShiftToLeast(Unit *, Int, Int); static Int decShiftToMost(Unit *, Int, Int); static void decStatus(decNumber *, uInt, decContext *); static void decToString(const decNumber *, char[], Flag); static decNumber * decTrim(decNumber *, decContext *, Flag, Flag, Int *); static Int decUnitAddSub(const Unit *, Int, const Unit *, Int, Int, Unit *, Int); static Int decUnitCompare(const Unit *, Int, const Unit *, Int, Int); #if !DECSUBSET /* decFinish == decFinalize when no subset arithmetic needed */ #define decFinish(a,b,c,d) decFinalize(a,b,c,d) #else static void decFinish(decNumber *, decContext *, Int *, uInt *); static decNumber * decRoundOperand(const decNumber *, decContext *, uInt *); #endif /* Local macros */ // masked special-values bits #define SPECIALARG (rhs->bits & DECSPECIAL) #define SPECIALARGS ((lhs->bits | rhs->bits) & DECSPECIAL) /* Diagnostic macros, etc. */ #if DECALLOC // Handle malloc/free accounting. If enabled, our accountable routines // are used; otherwise the code just goes straight to the system malloc // and free routines. #define malloc(a) decMalloc(a) #define free(a) decFree(a) #define DECFENCE 0x5a // corruption detector // 'Our' malloc and free: static void *decMalloc(size_t); static void decFree(void *); uInt decAllocBytes=0; // count of bytes allocated // Note that DECALLOC code only checks for storage buffer overflow. // To check for memory leaks, the decAllocBytes variable must be // checked to be 0 at appropriate times (e.g., after the test // harness completes a set of tests). This checking may be unreliable // if the testing is done in a multi-thread environment. #endif #if DECCHECK // Optional checking routines. Enabling these means that decNumber // and decContext operands to operator routines are checked for // correctness. This roughly doubles the execution time of the // fastest routines (and adds 600+ bytes), so should not normally be // used in 'production'. // decCheckInexact is used to check that inexact results have a full // complement of digits (where appropriate -- this is not the case // for Quantize, for example) #define DECUNRESU ((decNumber *)(void *)0xffffffff) #define DECUNUSED ((const decNumber *)(void *)0xffffffff) #define DECUNCONT ((decContext *)(void *)(0xffffffff)) static Flag decCheckOperands(decNumber *, const decNumber *, const decNumber *, decContext *); static Flag decCheckNumber(const decNumber *); static void decCheckInexact(const decNumber *, decContext *); #endif #if DECTRACE || DECCHECK // Optional trace/debugging routines (may or may not be used) void decNumberShow(const decNumber *); // displays the components of a number static void decDumpAr(char, const Unit *, Int); #endif /* ================================================================== */ /* Conversions */ /* ================================================================== */ /* ------------------------------------------------------------------ */ /* from-int32 -- conversion from Int or uInt */ /* */ /* dn is the decNumber to receive the integer */ /* in or uin is the integer to be converted */ /* returns dn */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decNumber * decNumberFromInt32(decNumber *dn, Int in) { uInt unsig; if (in>=0) unsig=in; else { // negative (possibly BADINT) if (in==BADINT) unsig=(uInt)1073741824*2; // special case else unsig=-in; // invert } // in is now positive decNumberFromUInt32(dn, unsig); if (in<0) dn->bits=DECNEG; // sign needed return dn; } // decNumberFromInt32 decNumber * decNumberFromUInt32(decNumber *dn, uInt uin) { Unit *up; // work pointer decNumberZero(dn); // clean if (uin==0) return dn; // [or decGetDigits bad call] for (up=dn->lsu; uin>0; up++) { *up=(Unit)(uin%(DECDPUNMAX+1)); uin=uin/(DECDPUNMAX+1); } dn->digits=decGetDigits(dn->lsu, up-dn->lsu); return dn; } // decNumberFromUInt32 /* ------------------------------------------------------------------ */ /* to-int32 -- conversion to Int or uInt */ /* */ /* dn is the decNumber to convert */ /* set is the context for reporting errors */ /* returns the converted decNumber, or 0 if Invalid is set */ /* */ /* Invalid is set if the decNumber does not have exponent==0 or if */ /* it is a NaN, Infinite, or out-of-range. */ /* ------------------------------------------------------------------ */ Int decNumberToInt32(const decNumber *dn, decContext *set) { #if DECCHECK if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0; #endif // special or too many digits, or bad exponent if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0) ; // bad else { // is a finite integer with 10 or fewer digits Int d; // work const Unit *up; // .. uInt hi=0, lo; // .. up=dn->lsu; // -> lsu lo=*up; // get 1 to 9 digits #if DECDPUN>1 // split to higher hi=lo/10; lo=lo%10; #endif up++; // collect remaining Units, if any, into hi for (d=DECDPUN; ddigits; up++, d+=DECDPUN) hi+=*up*powers[d-1]; // now low has the lsd, hi the remainder if (hi>214748364 || (hi==214748364 && lo>7)) { // out of range? // most-negative is a reprieve if (dn->bits&DECNEG && hi==214748364 && lo==8) return 0x80000000; // bad -- drop through } else { // in-range always Int i=X10(hi)+lo; if (dn->bits&DECNEG) return -i; return i; } } // integer decContextSetStatus(set, DEC_Invalid_operation); // [may not return] return 0; } // decNumberToInt32 uInt decNumberToUInt32(const decNumber *dn, decContext *set) { #if DECCHECK if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0; #endif // special or too many digits, or bad exponent, or negative (<0) if (dn->bits&DECSPECIAL || dn->digits>10 || dn->exponent!=0 || (dn->bits&DECNEG && !ISZERO(dn))); // bad else { // is a finite integer with 10 or fewer digits Int d; // work const Unit *up; // .. uInt hi=0, lo; // .. up=dn->lsu; // -> lsu lo=*up; // get 1 to 9 digits #if DECDPUN>1 // split to higher hi=lo/10; lo=lo%10; #endif up++; // collect remaining Units, if any, into hi for (d=DECDPUN; ddigits; up++, d+=DECDPUN) hi+=*up*powers[d-1]; // now low has the lsd, hi the remainder if (hi>429496729 || (hi==429496729 && lo>5)) ; // no reprieve possible else return X10(hi)+lo; } // integer decContextSetStatus(set, DEC_Invalid_operation); // [may not return] return 0; } // decNumberToUInt32 /* ------------------------------------------------------------------ */ /* to-scientific-string -- conversion to numeric string */ /* to-engineering-string -- conversion to numeric string */ /* */ /* decNumberToString(dn, string); */ /* decNumberToEngString(dn, string); */ /* */ /* dn is the decNumber to convert */ /* string is the string where the result will be laid out */ /* */ /* string must be at least dn->digits+14 characters long */ /* */ /* No error is possible, and no status can be set. */ /* ------------------------------------------------------------------ */ char * decNumberToString(const decNumber *dn, char *string){ decToString(dn, string, 0); return string; } // DecNumberToString char * decNumberToEngString(const decNumber *dn, char *string){ decToString(dn, string, 1); return string; } // DecNumberToEngString /* ------------------------------------------------------------------ */ /* to-number -- conversion from numeric string */ /* */ /* decNumberFromString -- convert string to decNumber */ /* dn -- the number structure to fill */ /* chars[] -- the string to convert ('\0' terminated) */ /* set -- the context used for processing any error, */ /* determining the maximum precision available */ /* (set.digits), determining the maximum and minimum */ /* exponent (set.emax and set.emin), determining if */ /* extended values are allowed, and checking the */ /* rounding mode if overflow occurs or rounding is */ /* needed. */ /* */ /* The length of the coefficient and the size of the exponent are */ /* checked by this routine, so the correct error (Underflow or */ /* Overflow) can be reported or rounding applied, as necessary. */ /* */ /* If bad syntax is detected, the result will be a quiet NaN. */ /* ------------------------------------------------------------------ */ decNumber * decNumberFromString(decNumber *dn, const char chars[], decContext *set) { Int exponent=0; // working exponent [assume 0] uByte bits=0; // working flags [assume +ve] Unit *res; // where result will be built Unit resbuff[SD2U(DECBUFFER+9)];// local buffer in case need temporary // [+9 allows for ln() constants] Unit *allocres=NULL; // -> allocated result, iff allocated Int d=0; // count of digits found in decimal part const char *dotchar=NULL; // where dot was found const char *cfirst=chars; // -> first character of decimal part const char *last=NULL; // -> last digit of decimal part const char *c; // work Unit *up; // .. #if DECDPUN>1 Int cut, out; // .. #endif Int residue; // rounding residue uInt status=0; // error code #if DECCHECK if (decCheckOperands(DECUNRESU, DECUNUSED, DECUNUSED, set)) return decNumberZero(dn); #endif do { // status & malloc protection for (c=chars;; c++) { // -> input character if (*c>='0' && *c<='9') { // test for Arabic digit last=c; d++; // count of real digits continue; // still in decimal part } if (*c=='.' && dotchar==NULL) { // first '.' dotchar=c; // record offset into decimal part if (c==cfirst) cfirst++; // first digit must follow continue;} if (c==chars) { // first in string... if (*c=='-') { // valid - sign cfirst++; bits=DECNEG; continue;} if (*c=='+') { // valid + sign cfirst++; continue;} } // *c is not a digit, or a valid +, -, or '.' break; } // c if (last==NULL) { // no digits yet status=DEC_Conversion_syntax;// assume the worst if (*c=='\0') break; // and no more to come... #if DECSUBSET // if subset then infinities and NaNs are not allowed if (!set->extended) break; // hopeless #endif // Infinities and NaNs are possible, here if (dotchar!=NULL) break; // .. unless had a dot decNumberZero(dn); // be optimistic if (decBiStr(c, "infinity", "INFINITY") || decBiStr(c, "inf", "INF")) { dn->bits=bits | DECINF; status=0; // is OK break; // all done } // a NaN expected // 2003.09.10 NaNs are now permitted to have a sign dn->bits=bits | DECNAN; // assume simple NaN if (*c=='s' || *c=='S') { // looks like an sNaN c++; dn->bits=bits | DECSNAN; } if (*c!='n' && *c!='N') break; // check caseless "NaN" c++; if (*c!='a' && *c!='A') break; // .. c++; if (*c!='n' && *c!='N') break; // .. c++; // now either nothing, or nnnn payload, expected // -> start of integer and skip leading 0s [including plain 0] for (cfirst=c; *cfirst=='0';) cfirst++; if (*cfirst=='\0') { // "NaN" or "sNaN", maybe with all 0s status=0; // it's good break; // .. } // something other than 0s; setup last and d as usual [no dots] for (c=cfirst;; c++, d++) { if (*c<'0' || *c>'9') break; // test for Arabic digit last=c; } if (*c!='\0') break; // not all digits if (d>set->digits-1) { // [NB: payload in a decNumber can be full length unless // clamped, in which case can only be digits-1] if (set->clamp) break; if (d>set->digits) break; } // too many digits? // good; drop through to convert the integer to coefficient status=0; // syntax is OK bits=dn->bits; // for copy-back } // last==NULL else if (*c!='\0') { // more to process... // had some digits; exponent is only valid sequence now Flag nege; // 1=negative exponent const char *firstexp; // -> first significant exponent digit status=DEC_Conversion_syntax;// assume the worst uInt expa=0; // accumulator for exponent if (*c!='e' && *c!='E') break; /* Found 'e' or 'E' -- now process explicit exponent */ // 1998.07.11: sign no longer required nege=0; c++; // to (possible) sign if (*c=='-') {nege=1; c++;} else if (*c=='+') c++; if (*c=='\0') break; for (; *c=='0' && *(c+1)!='\0';) c++; // strip insignificant zeros firstexp=c; // save exponent digit place for (; ;c++) { if (*c<'0' || *c>'9') break; // not a digit expa=X10(expa)+(Int)*c-(Int)'0'; } // c // if not now on a '\0', *c must not be a digit if (*c!='\0') break; // (this next test must be after the syntax checks) // if it was too long the exponent may have wrapped, so check // carefully and set it to a certain overflow if wrap possible if (c>=firstexp+9+1) { if (c>firstexp+9+1 || *firstexp>'1') expa=DECNUMMAXE*2; // [up to 1999999999 is OK, for example 1E-1000000998] } exponent=(Int)expa; // save exponent if (nege) exponent=-exponent; // was negative status=0; // is OK } // stuff after digits // Here when whole string has been inspected; syntax is good // cfirst->first digit (never dot), last->last digit (ditto) // strip leading zeros/dot [leave final 0 if all 0's] if (*cfirst=='0') { // [cfirst has stepped over .] for (c=cfirst; cextended) { decNumberZero(dn); // clean result break; // [could be return] } #endif } // at least one leading 0 // Handle decimal point... if (dotchar!=NULL && dotchardigits) res=dn->lsu; // fits into supplied decNumber else { // rounding needed Int needbytes=D2U(d)*sizeof(Unit);// bytes needed res=resbuff; // assume use local buffer if (needbytes>(Int)sizeof(resbuff)) { // too big for local allocres=(Unit *)malloc(needbytes); if (allocres==NULL) {status|=DEC_Insufficient_storage; break;} res=allocres; } } // res now -> number lsu, buffer, or allocated storage for Unit array // Place the coefficient into the selected Unit array // [this is often 70% of the cost of this function when DECDPUN>1] #if DECDPUN>1 out=0; // accumulator up=res+D2U(d)-1; // -> msu cut=d-(up-res)*DECDPUN; // digits in top unit for (c=cfirst;; c++) { // along the digits if (*c=='.') continue; // ignore '.' [don't decrement cut] out=X10(out)+(Int)*c-(Int)'0'; if (c==last) break; // done [never get to trailing '.'] cut--; if (cut>0) continue; // more for this unit *up=(Unit)out; // write unit up--; // prepare for unit below.. cut=DECDPUN; // .. out=0; // .. } // c *up=(Unit)out; // write lsu #else // DECDPUN==1 up=res; // -> lsu for (c=last; c>=cfirst; c--) { // over each character, from least if (*c=='.') continue; // ignore . [don't step up] *up=(Unit)((Int)*c-(Int)'0'); up++; } // c #endif dn->bits=bits; dn->exponent=exponent; dn->digits=d; // if not in number (too long) shorten into the number if (d>set->digits) { residue=0; decSetCoeff(dn, set, res, d, &residue, &status); // always check for overflow or subnormal and round as needed decFinalize(dn, set, &residue, &status); } else { // no rounding, but may still have overflow or subnormal // [these tests are just for performance; finalize repeats them] if ((dn->exponent-1emin-dn->digits) || (dn->exponent-1>set->emax-set->digits)) { residue=0; decFinalize(dn, set, &residue, &status); } } // decNumberShow(dn); } while(0); // [for break] if (allocres!=NULL) free(allocres); // drop any storage used if (status!=0) decStatus(dn, status, set); return dn; } /* decNumberFromString */ /* ================================================================== */ /* Operators */ /* ================================================================== */ /* ------------------------------------------------------------------ */ /* decNumberAbs -- absolute value operator */ /* */ /* This computes C = abs(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context */ /* */ /* See also decNumberCopyAbs for a quiet bitwise version of this. */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ /* This has the same effect as decNumberPlus unless A is negative, */ /* in which case it has the same effect as decNumberMinus. */ /* ------------------------------------------------------------------ */ decNumber * decNumberAbs(decNumber *res, const decNumber *rhs, decContext *set) { decNumber dzero; // for 0 uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif decNumberZero(&dzero); // set 0 dzero.exponent=rhs->exponent; // [no coefficient expansion] decAddOp(res, &dzero, rhs, set, (uByte)(rhs->bits & DECNEG), &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberAbs /* ------------------------------------------------------------------ */ /* decNumberAdd -- add two Numbers */ /* */ /* This computes C = A + B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X+X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ /* This just calls the routine shared with Subtract */ decNumber * decNumberAdd(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decAddOp(res, lhs, rhs, set, 0, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberAdd /* ------------------------------------------------------------------ */ /* decNumberAnd -- AND two Numbers, digitwise */ /* */ /* This computes C = A & B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X&X) */ /* lhs is A */ /* rhs is B */ /* set is the context (used for result length and error report) */ /* */ /* C must have space for set->digits digits. */ /* */ /* Logical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* ------------------------------------------------------------------ */ decNumber * decNumberAnd(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { const Unit *ua, *ub; // -> operands const Unit *msua, *msub; // -> operand msus Unit *uc, *msuc; // -> result and its msu Int msudigs; // digits in res msu #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs) || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) { decStatus(res, DEC_Invalid_operation, set); return res; } // operands are valid ua=lhs->lsu; // bottom-up ub=rhs->lsu; // .. uc=res->lsu; // .. msua=ua+D2U(lhs->digits)-1; // -> msu of lhs msub=ub+D2U(rhs->digits)-1; // -> msu of rhs msuc=uc+D2U(set->digits)-1; // -> msu of result msudigs=MSUDIGITS(set->digits); // [faster than remainder] for (; uc<=msuc; ua++, ub++, uc++) { // Unit loop Unit a, b; // extract units if (ua>msua) a=0; else a=*ua; if (ub>msub) b=0; else b=*ub; *uc=0; // can now write back if (a|b) { // maybe 1 bits to examine Int i, j; *uc=0; // can now write back // This loop could be unrolled and/or use BIN2BCD tables for (i=0; i1) { decStatus(res, DEC_Invalid_operation, set); return res; } if (uc==msuc && i==msudigs-1) break; // just did final digit } // each digit } // both OK } // each unit // [here uc-1 is the msu of the result] res->digits=decGetDigits(res->lsu, uc-res->lsu); res->exponent=0; // integer res->bits=0; // sign=0 return res; // [no status to set] } // decNumberAnd /* ------------------------------------------------------------------ */ /* decNumberCompare -- compare two Numbers */ /* */ /* This computes C = A ? B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for one digit (or NaN). */ /* ------------------------------------------------------------------ */ decNumber * decNumberCompare(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decCompareOp(res, lhs, rhs, set, COMPARE, &status); if (status!=0) decStatus(res, status, set); return res; } // decNumberCompare /* ------------------------------------------------------------------ */ /* decNumberCompareSignal -- compare, signalling on all NaNs */ /* */ /* This computes C = A ? B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for one digit (or NaN). */ /* ------------------------------------------------------------------ */ decNumber * decNumberCompareSignal(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decCompareOp(res, lhs, rhs, set, COMPSIG, &status); if (status!=0) decStatus(res, status, set); return res; } // decNumberCompareSignal /* ------------------------------------------------------------------ */ /* decNumberCompareTotal -- compare two Numbers, using total ordering */ /* */ /* This computes C = A ? B, under total ordering */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for one digit; the result will always be one of */ /* -1, 0, or 1. */ /* ------------------------------------------------------------------ */ decNumber * decNumberCompareTotal(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status); if (status!=0) decStatus(res, status, set); return res; } // decNumberCompareTotal /* ------------------------------------------------------------------ */ /* decNumberCompareTotalMag -- compare, total ordering of magnitudes */ /* */ /* This computes C = |A| ? |B|, under total ordering */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for one digit; the result will always be one of */ /* -1, 0, or 1. */ /* ------------------------------------------------------------------ */ decNumber * decNumberCompareTotalMag(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator uInt needbytes; // for space calculations decNumber bufa[D2N(DECBUFFER+1)];// +1 in case DECBUFFER=0 decNumber *allocbufa=NULL; // -> allocated bufa, iff allocated decNumber bufb[D2N(DECBUFFER+1)]; decNumber *allocbufb=NULL; // -> allocated bufb, iff allocated decNumber *a, *b; // temporary pointers #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif do { // protect allocated storage // if either is negative, take a copy and absolute if (decNumberIsNegative(lhs)) { // lhs<0 a=bufa; needbytes=sizeof(decNumber)+(D2U(lhs->digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { // need malloc space allocbufa=(decNumber *)malloc(needbytes); if (allocbufa==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} a=allocbufa; // use the allocated space } decNumberCopy(a, lhs); // copy content a->bits&=~DECNEG; // .. and clear the sign lhs=a; // use copy from here on } if (decNumberIsNegative(rhs)) { // rhs<0 b=bufb; needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufb)) { // need malloc space allocbufb=(decNumber *)malloc(needbytes); if (allocbufb==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} b=allocbufb; // use the allocated space } decNumberCopy(b, rhs); // copy content b->bits&=~DECNEG; // .. and clear the sign rhs=b; // use copy from here on } decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status); } while(0); // end protected if (allocbufa!=NULL) free(allocbufa); // drop any storage used if (allocbufb!=NULL) free(allocbufb); // .. if (status!=0) decStatus(res, status, set); return res; } // decNumberCompareTotalMag /* ------------------------------------------------------------------ */ /* decNumberDivide -- divide one number by another */ /* */ /* This computes C = A / B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X/X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberDivide(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decDivideOp(res, lhs, rhs, set, DIVIDE, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberDivide /* ------------------------------------------------------------------ */ /* decNumberDivideInteger -- divide and return integer quotient */ /* */ /* This computes C = A # B, where # is the integer divide operator */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X#X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberDivideInteger(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decDivideOp(res, lhs, rhs, set, DIVIDEINT, &status); if (status!=0) decStatus(res, status, set); return res; } // decNumberDivideInteger /* ------------------------------------------------------------------ */ /* decNumberExp -- exponentiation */ /* */ /* This computes C = exp(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context; note that rounding mode has no effect */ /* */ /* C must have space for set->digits digits. */ /* */ /* Mathematical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* */ /* Finite results will always be full precision and Inexact, except */ /* when A is a zero or -Infinity (giving 1 or 0 respectively). */ /* */ /* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */ /* almost always be correctly rounded, but may be up to 1 ulp in */ /* error in rare cases. */ /* ------------------------------------------------------------------ */ /* This is a wrapper for decExpOp which can handle the slightly wider */ /* (double) range needed by Ln (which has to be able to calculate */ /* exp(-a) where a can be the tiniest number (Ntiny). */ /* ------------------------------------------------------------------ */ decNumber * decNumberExp(decNumber *res, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator #if DECSUBSET decNumber *allocrhs=NULL; // non-NULL if rounded rhs allocated #endif #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif // Check restrictions; these restrictions ensure that if h=8 (see // decExpOp) then the result will either overflow or underflow to 0. // Other math functions restrict the input range, too, for inverses. // If not violated then carry out the operation. if (!decCheckMath(rhs, set, &status)) do { // protect allocation #if DECSUBSET if (!set->extended) { // reduce operand and set lostDigits status, as needed if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); if (allocrhs==NULL) break; rhs=allocrhs; } } #endif decExpOp(res, rhs, set, &status); } while(0); // end protected #if DECSUBSET if (allocrhs !=NULL) free(allocrhs); // drop any storage used #endif // apply significant status if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberExp /* ------------------------------------------------------------------ */ /* decNumberFMA -- fused multiply add */ /* */ /* This computes D = (A * B) + C with only one rounding */ /* */ /* res is D, the result. D may be A or B or C (e.g., X=FMA(X,X,X)) */ /* lhs is A */ /* rhs is B */ /* fhs is C [far hand side] */ /* set is the context */ /* */ /* Mathematical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberFMA(decNumber *res, const decNumber *lhs, const decNumber *rhs, const decNumber *fhs, decContext *set) { uInt status=0; // accumulator decContext dcmul; // context for the multiplication uInt needbytes; // for space calculations decNumber bufa[D2N(DECBUFFER*2+1)]; decNumber *allocbufa=NULL; // -> allocated bufa, iff allocated decNumber *acc; // accumulator pointer decNumber dzero; // work #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; if (decCheckOperands(res, fhs, DECUNUSED, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // [undefined if subset] status|=DEC_Invalid_operation; break;} #endif // Check math restrictions [these ensure no overflow or underflow] if ((!decNumberIsSpecial(lhs) && decCheckMath(lhs, set, &status)) || (!decNumberIsSpecial(rhs) && decCheckMath(rhs, set, &status)) || (!decNumberIsSpecial(fhs) && decCheckMath(fhs, set, &status))) break; // set up context for multiply dcmul=*set; dcmul.digits=lhs->digits+rhs->digits; // just enough // [The above may be an over-estimate for subset arithmetic, but that's OK] dcmul.emax=DEC_MAX_EMAX; // effectively unbounded .. dcmul.emin=DEC_MIN_EMIN; // [thanks to Math restrictions] // set up decNumber space to receive the result of the multiply acc=bufa; // may fit needbytes=sizeof(decNumber)+(D2U(dcmul.digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { // need malloc space allocbufa=(decNumber *)malloc(needbytes); if (allocbufa==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} acc=allocbufa; // use the allocated space } // multiply with extended range and necessary precision //printf("emin=%ld\n", dcmul.emin); decMultiplyOp(acc, lhs, rhs, &dcmul, &status); // Only Invalid operation (from sNaN or Inf * 0) is possible in // status; if either is seen than ignore fhs (in case it is // another sNaN) and set acc to NaN unless we had an sNaN // [decMultiplyOp leaves that to caller] // Note sNaN has to go through addOp to shorten payload if // necessary if ((status&DEC_Invalid_operation)!=0) { if (!(status&DEC_sNaN)) { // but be true invalid decNumberZero(res); // acc not yet set res->bits=DECNAN; break; } decNumberZero(&dzero); // make 0 (any non-NaN would do) fhs=&dzero; // use that } #if DECCHECK else { // multiply was OK if (status!=0) printf("Status=%08lx after FMA multiply\n", (LI)status); } #endif // add the third operand and result -> res, and all is done decAddOp(res, acc, fhs, set, 0, &status); } while(0); // end protected if (allocbufa!=NULL) free(allocbufa); // drop any storage used if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberFMA /* ------------------------------------------------------------------ */ /* decNumberInvert -- invert a Number, digitwise */ /* */ /* This computes C = ~A */ /* */ /* res is C, the result. C may be A (e.g., X=~X) */ /* rhs is A */ /* set is the context (used for result length and error report) */ /* */ /* C must have space for set->digits digits. */ /* */ /* Logical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* ------------------------------------------------------------------ */ decNumber * decNumberInvert(decNumber *res, const decNumber *rhs, decContext *set) { const Unit *ua, *msua; // -> operand and its msu Unit *uc, *msuc; // -> result and its msu Int msudigs; // digits in res msu #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif if (rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) { decStatus(res, DEC_Invalid_operation, set); return res; } // operand is valid ua=rhs->lsu; // bottom-up uc=res->lsu; // .. msua=ua+D2U(rhs->digits)-1; // -> msu of rhs msuc=uc+D2U(set->digits)-1; // -> msu of result msudigs=MSUDIGITS(set->digits); // [faster than remainder] for (; uc<=msuc; ua++, uc++) { // Unit loop Unit a; // extract unit Int i, j; // work if (ua>msua) a=0; else a=*ua; *uc=0; // can now write back // always need to examine all bits in rhs // This loop could be unrolled and/or use BIN2BCD tables for (i=0; i1) { decStatus(res, DEC_Invalid_operation, set); return res; } if (uc==msuc && i==msudigs-1) break; // just did final digit } // each digit } // each unit // [here uc-1 is the msu of the result] res->digits=decGetDigits(res->lsu, uc-res->lsu); res->exponent=0; // integer res->bits=0; // sign=0 return res; // [no status to set] } // decNumberInvert /* ------------------------------------------------------------------ */ /* decNumberLn -- natural logarithm */ /* */ /* This computes C = ln(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context; note that rounding mode has no effect */ /* */ /* C must have space for set->digits digits. */ /* */ /* Notable cases: */ /* A<0 -> Invalid */ /* A=0 -> -Infinity (Exact) */ /* A=+Infinity -> +Infinity (Exact) */ /* A=1 exactly -> 0 (Exact) */ /* */ /* Mathematical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* */ /* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */ /* almost always be correctly rounded, but may be up to 1 ulp in */ /* error in rare cases. */ /* ------------------------------------------------------------------ */ /* This is a wrapper for decLnOp which can handle the slightly wider */ /* (+11) range needed by Ln, Log10, etc. (which may have to be able */ /* to calculate at p+e+2). */ /* ------------------------------------------------------------------ */ decNumber * decNumberLn(decNumber *res, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator #if DECSUBSET decNumber *allocrhs=NULL; // non-NULL if rounded rhs allocated #endif #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif // Check restrictions; this is a math function; if not violated // then carry out the operation. if (!decCheckMath(rhs, set, &status)) do { // protect allocation #if DECSUBSET if (!set->extended) { // reduce operand and set lostDigits status, as needed if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); if (allocrhs==NULL) break; rhs=allocrhs; } // special check in subset for rhs=0 if (ISZERO(rhs)) { // +/- zeros -> error status|=DEC_Invalid_operation; break;} } // extended=0 #endif decLnOp(res, rhs, set, &status); } while(0); // end protected #if DECSUBSET if (allocrhs !=NULL) free(allocrhs); // drop any storage used #endif // apply significant status if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberLn /* ------------------------------------------------------------------ */ /* decNumberLogB - get adjusted exponent, by 754 rules */ /* */ /* This computes C = adjustedexponent(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context, used only for digits and status */ /* */ /* For an unrounded result, digits may need to be 10 (A might have */ /* 10**9 digits and an exponent of +999999999, or one digit and an */ /* exponent of -1999999999). */ /* */ /* This returns the adjusted exponent of A after (in theory) padding */ /* with zeros on the right to set->digits digits while keeping the */ /* same value. The exponent is not limited by emin/emax. */ /* */ /* Notable cases: */ /* A<0 -> Use |A| */ /* A=0 -> -Infinity (Division by zero) */ /* A=Infinite -> +Infinity (Exact) */ /* A=1 exactly -> 0 (Exact) */ /* NaNs are propagated as usual */ /* ------------------------------------------------------------------ */ decNumber * decNumberLogB(decNumber *res, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif // NaNs as usual; Infinities return +Infinity; 0->oops if (decNumberIsNaN(rhs)) decNaNs(res, rhs, NULL, set, &status); else if (decNumberIsInfinite(rhs)) decNumberCopyAbs(res, rhs); else if (decNumberIsZero(rhs)) { decNumberZero(res); // prepare for Infinity res->bits=DECNEG|DECINF; // -Infinity status|=DEC_Division_by_zero; // as per 754 } else { // finite non-zero Int ae=rhs->exponent+rhs->digits-1; // adjusted exponent if (set->digits>=10) decNumberFromInt32(res, ae); // lay it out else { decNumber buft[D2N(10)]; // temporary number decNumber *t=buft; // .. decNumberFromInt32(t, ae); // lay it out decNumberPlus(res, t, set); // round as necessary } } if (status!=0) decStatus(res, status, set); return res; } // decNumberLogB /* ------------------------------------------------------------------ */ /* decNumberLog10 -- logarithm in base 10 */ /* */ /* This computes C = log10(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context; note that rounding mode has no effect */ /* */ /* C must have space for set->digits digits. */ /* */ /* Notable cases: */ /* A<0 -> Invalid */ /* A=0 -> -Infinity (Exact) */ /* A=+Infinity -> +Infinity (Exact) */ /* A=10**n (if n is an integer) -> n (Exact) */ /* */ /* Mathematical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* */ /* An Inexact result is rounded using DEC_ROUND_HALF_EVEN; it will */ /* almost always be correctly rounded, but may be up to 1 ulp in */ /* error in rare cases. */ /* ------------------------------------------------------------------ */ /* This calculates ln(A)/ln(10) using appropriate precision. For */ /* ln(A) this is the max(p, rhs->digits + t) + 3, where p is the */ /* requested digits and t is the number of digits in the exponent */ /* (maximum 6). For ln(10) it is p + 3; this is often handled by the */ /* fastpath in decLnOp. The final division is done to the requested */ /* precision. */ /* ------------------------------------------------------------------ */ decNumber * decNumberLog10(decNumber *res, const decNumber *rhs, decContext *set) { uInt status=0, ignore=0; // status accumulators uInt needbytes; // for space calculations Int p; // working precision Int t; // digits in exponent of A // buffers for a and b working decimals // (adjustment calculator, same size) decNumber bufa[D2N(DECBUFFER+2)]; decNumber *allocbufa=NULL; // -> allocated bufa, iff allocated decNumber *a=bufa; // temporary a decNumber bufb[D2N(DECBUFFER+2)]; decNumber *allocbufb=NULL; // -> allocated bufb, iff allocated decNumber *b=bufb; // temporary b decNumber bufw[D2N(10)]; // working 2-10 digit number decNumber *w=bufw; // .. #if DECSUBSET decNumber *allocrhs=NULL; // non-NULL if rounded rhs allocated #endif decContext aset; // working context #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif // Check restrictions; this is a math function; if not violated // then carry out the operation. if (!decCheckMath(rhs, set, &status)) do { // protect malloc #if DECSUBSET if (!set->extended) { // reduce operand and set lostDigits status, as needed if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); if (allocrhs==NULL) break; rhs=allocrhs; } // special check in subset for rhs=0 if (ISZERO(rhs)) { // +/- zeros -> error status|=DEC_Invalid_operation; break;} } // extended=0 #endif decContextDefault(&aset, DEC_INIT_DECIMAL64); // clean context // handle exact powers of 10; only check if +ve finite if (!(rhs->bits&(DECNEG|DECSPECIAL)) && !ISZERO(rhs)) { Int residue=0; // (no residue) uInt copystat=0; // clean status // round to a single digit... aset.digits=1; decCopyFit(w, rhs, &aset, &residue, ©stat); // copy & shorten // if exact and the digit is 1, rhs is a power of 10 if (!(copystat&DEC_Inexact) && w->lsu[0]==1) { // the exponent, conveniently, is the power of 10; making // this the result needs a little care as it might not fit, // so first convert it into the working number, and then move // to res decNumberFromInt32(w, w->exponent); residue=0; decCopyFit(res, w, set, &residue, &status); // copy & round decFinish(res, set, &residue, &status); // cleanup/set flags break; } // not a power of 10 } // not a candidate for exact // simplify the information-content calculation to use 'total // number of digits in a, including exponent' as compared to the // requested digits, as increasing this will only rarely cost an // iteration in ln(a) anyway t=6; // it can never be >6 // allocate space when needed... p=(rhs->digits+t>set->digits?rhs->digits+t:set->digits)+3; needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { // need malloc space allocbufa=(decNumber *)malloc(needbytes); if (allocbufa==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} a=allocbufa; // use the allocated space } aset.digits=p; // as calculated aset.emax=DEC_MAX_MATH; // usual bounds aset.emin=-DEC_MAX_MATH; // .. aset.clamp=0; // and no concrete format decLnOp(a, rhs, &aset, &status); // a=ln(rhs) // skip the division if the result so far is infinite, NaN, or // zero, or there was an error; note NaN from sNaN needs copy if (status&DEC_NaNs && !(status&DEC_sNaN)) break; if (a->bits&DECSPECIAL || ISZERO(a)) { decNumberCopy(res, a); // [will fit] break;} // for ln(10) an extra 3 digits of precision are needed p=set->digits+3; needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit); if (needbytes>sizeof(bufb)) { // need malloc space allocbufb=(decNumber *)malloc(needbytes); if (allocbufb==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} b=allocbufb; // use the allocated space } decNumberZero(w); // set up 10... #if DECDPUN==1 w->lsu[1]=1; w->lsu[0]=0; // .. #else w->lsu[0]=10; // .. #endif w->digits=2; // .. aset.digits=p; decLnOp(b, w, &aset, &ignore); // b=ln(10) aset.digits=set->digits; // for final divide decDivideOp(res, a, b, &aset, DIVIDE, &status); // into result } while(0); // [for break] if (allocbufa!=NULL) free(allocbufa); // drop any storage used if (allocbufb!=NULL) free(allocbufb); // .. #if DECSUBSET if (allocrhs !=NULL) free(allocrhs); // .. #endif // apply significant status if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberLog10 /* ------------------------------------------------------------------ */ /* decNumberMax -- compare two Numbers and return the maximum */ /* */ /* This computes C = A ? B, returning the maximum by 754 rules */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberMax(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decCompareOp(res, lhs, rhs, set, COMPMAX, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberMax /* ------------------------------------------------------------------ */ /* decNumberMaxMag -- compare and return the maximum by magnitude */ /* */ /* This computes C = A ? B, returning the maximum by 754 rules */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberMaxMag(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decCompareOp(res, lhs, rhs, set, COMPMAXMAG, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberMaxMag /* ------------------------------------------------------------------ */ /* decNumberMin -- compare two Numbers and return the minimum */ /* */ /* This computes C = A ? B, returning the minimum by 754 rules */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberMin(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decCompareOp(res, lhs, rhs, set, COMPMIN, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberMin /* ------------------------------------------------------------------ */ /* decNumberMinMag -- compare and return the minimum by magnitude */ /* */ /* This computes C = A ? B, returning the minimum by 754 rules */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberMinMag(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decCompareOp(res, lhs, rhs, set, COMPMINMAG, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberMinMag /* ------------------------------------------------------------------ */ /* decNumberMinus -- prefix minus operator */ /* */ /* This computes C = 0 - A */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context */ /* */ /* See also decNumberCopyNegate for a quiet bitwise version of this. */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ /* Simply use AddOp for the subtract, which will do the necessary. */ /* ------------------------------------------------------------------ */ decNumber * decNumberMinus(decNumber *res, const decNumber *rhs, decContext *set) { decNumber dzero; uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif decNumberZero(&dzero); // make 0 dzero.exponent=rhs->exponent; // [no coefficient expansion] decAddOp(res, &dzero, rhs, set, DECNEG, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberMinus /* ------------------------------------------------------------------ */ /* decNumberNextMinus -- next towards -Infinity */ /* */ /* This computes C = A - infinitesimal, rounded towards -Infinity */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context */ /* */ /* This is a generalization of 754 NextDown. */ /* ------------------------------------------------------------------ */ decNumber * decNumberNextMinus(decNumber *res, const decNumber *rhs, decContext *set) { decNumber dtiny; // constant decContext workset=*set; // work uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif // +Infinity is the special case if ((rhs->bits&(DECINF|DECNEG))==DECINF) { decSetMaxValue(res, set); // is +ve // there is no status to set return res; } decNumberZero(&dtiny); // start with 0 dtiny.lsu[0]=1; // make number that is .. dtiny.exponent=DEC_MIN_EMIN-1; // .. smaller than tiniest workset.round=DEC_ROUND_FLOOR; decAddOp(res, rhs, &dtiny, &workset, DECNEG, &status); status&=DEC_Invalid_operation|DEC_sNaN; // only sNaN Invalid please if (status!=0) decStatus(res, status, set); return res; } // decNumberNextMinus /* ------------------------------------------------------------------ */ /* decNumberNextPlus -- next towards +Infinity */ /* */ /* This computes C = A + infinitesimal, rounded towards +Infinity */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context */ /* */ /* This is a generalization of 754 NextUp. */ /* ------------------------------------------------------------------ */ decNumber * decNumberNextPlus(decNumber *res, const decNumber *rhs, decContext *set) { decNumber dtiny; // constant decContext workset=*set; // work uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif // -Infinity is the special case if ((rhs->bits&(DECINF|DECNEG))==(DECINF|DECNEG)) { decSetMaxValue(res, set); res->bits=DECNEG; // negative // there is no status to set return res; } decNumberZero(&dtiny); // start with 0 dtiny.lsu[0]=1; // make number that is .. dtiny.exponent=DEC_MIN_EMIN-1; // .. smaller than tiniest workset.round=DEC_ROUND_CEILING; decAddOp(res, rhs, &dtiny, &workset, 0, &status); status&=DEC_Invalid_operation|DEC_sNaN; // only sNaN Invalid please if (status!=0) decStatus(res, status, set); return res; } // decNumberNextPlus /* ------------------------------------------------------------------ */ /* decNumberNextToward -- next towards rhs */ /* */ /* This computes C = A +/- infinitesimal, rounded towards */ /* +/-Infinity in the direction of B, as per 754-1985 nextafter */ /* modified during revision but dropped from 754-2008. */ /* */ /* res is C, the result. C may be A or B. */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* This is a generalization of 754-1985 NextAfter. */ /* ------------------------------------------------------------------ */ decNumber * decNumberNextToward(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { decNumber dtiny; // constant decContext workset=*set; // work Int result; // .. uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) { decNaNs(res, lhs, rhs, set, &status); } else { // Is numeric, so no chance of sNaN Invalid, etc. result=decCompare(lhs, rhs, 0); // sign matters if (result==BADINT) status|=DEC_Insufficient_storage; // rare else { // valid compare if (result==0) decNumberCopySign(res, lhs, rhs); // easy else { // differ: need NextPlus or NextMinus uByte sub; // add or subtract if (result<0) { // lhsbits&(DECINF|DECNEG))==(DECINF|DECNEG)) { decSetMaxValue(res, set); res->bits=DECNEG; // negative return res; // there is no status to set } workset.round=DEC_ROUND_CEILING; sub=0; // add, please } // plus else { // lhs>rhs, do nextminus // +Infinity is the special case if ((lhs->bits&(DECINF|DECNEG))==DECINF) { decSetMaxValue(res, set); return res; // there is no status to set } workset.round=DEC_ROUND_FLOOR; sub=DECNEG; // subtract, please } // minus decNumberZero(&dtiny); // start with 0 dtiny.lsu[0]=1; // make number that is .. dtiny.exponent=DEC_MIN_EMIN-1; // .. smaller than tiniest decAddOp(res, lhs, &dtiny, &workset, sub, &status); // + or - // turn off exceptions if the result is a normal number // (including Nmin), otherwise let all status through if (decNumberIsNormal(res, set)) status=0; } // unequal } // compare OK } // numeric if (status!=0) decStatus(res, status, set); return res; } // decNumberNextToward /* ------------------------------------------------------------------ */ /* decNumberOr -- OR two Numbers, digitwise */ /* */ /* This computes C = A | B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X|X) */ /* lhs is A */ /* rhs is B */ /* set is the context (used for result length and error report) */ /* */ /* C must have space for set->digits digits. */ /* */ /* Logical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* ------------------------------------------------------------------ */ decNumber * decNumberOr(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { const Unit *ua, *ub; // -> operands const Unit *msua, *msub; // -> operand msus Unit *uc, *msuc; // -> result and its msu Int msudigs; // digits in res msu #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs) || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) { decStatus(res, DEC_Invalid_operation, set); return res; } // operands are valid ua=lhs->lsu; // bottom-up ub=rhs->lsu; // .. uc=res->lsu; // .. msua=ua+D2U(lhs->digits)-1; // -> msu of lhs msub=ub+D2U(rhs->digits)-1; // -> msu of rhs msuc=uc+D2U(set->digits)-1; // -> msu of result msudigs=MSUDIGITS(set->digits); // [faster than remainder] for (; uc<=msuc; ua++, ub++, uc++) { // Unit loop Unit a, b; // extract units if (ua>msua) a=0; else a=*ua; if (ub>msub) b=0; else b=*ub; *uc=0; // can now write back if (a|b) { // maybe 1 bits to examine Int i, j; // This loop could be unrolled and/or use BIN2BCD tables for (i=0; i1) { decStatus(res, DEC_Invalid_operation, set); return res; } if (uc==msuc && i==msudigs-1) break; // just did final digit } // each digit } // non-zero } // each unit // [here uc-1 is the msu of the result] res->digits=decGetDigits(res->lsu, uc-res->lsu); res->exponent=0; // integer res->bits=0; // sign=0 return res; // [no status to set] } // decNumberOr /* ------------------------------------------------------------------ */ /* decNumberPlus -- prefix plus operator */ /* */ /* This computes C = 0 + A */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context */ /* */ /* See also decNumberCopy for a quiet bitwise version of this. */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ /* This simply uses AddOp; Add will take fast path after preparing A. */ /* Performance is a concern here, as this routine is often used to */ /* check operands and apply rounding and overflow/underflow testing. */ /* ------------------------------------------------------------------ */ decNumber * decNumberPlus(decNumber *res, const decNumber *rhs, decContext *set) { decNumber dzero; uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif decNumberZero(&dzero); // make 0 dzero.exponent=rhs->exponent; // [no coefficient expansion] decAddOp(res, &dzero, rhs, set, 0, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberPlus /* ------------------------------------------------------------------ */ /* decNumberMultiply -- multiply two Numbers */ /* */ /* This computes C = A x B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X+X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberMultiply(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decMultiplyOp(res, lhs, rhs, set, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberMultiply /* ------------------------------------------------------------------ */ /* decNumberPower -- raise a number to a power */ /* */ /* This computes C = A ** B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X**X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* */ /* Mathematical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* */ /* However, if 1999999997<=B<=999999999 and B is an integer then the */ /* restrictions on A and the context are relaxed to the usual bounds, */ /* for compatibility with the earlier (integer power only) version */ /* of this function. */ /* */ /* When B is an integer, the result may be exact, even if rounded. */ /* */ /* The final result is rounded according to the context; it will */ /* almost always be correctly rounded, but may be up to 1 ulp in */ /* error in rare cases. */ /* ------------------------------------------------------------------ */ decNumber * decNumberPower(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { #if DECSUBSET decNumber *alloclhs=NULL; // non-NULL if rounded lhs allocated decNumber *allocrhs=NULL; // .., rhs #endif decNumber *allocdac=NULL; // -> allocated acc buffer, iff used decNumber *allocinv=NULL; // -> allocated 1/x buffer, iff used Int reqdigits=set->digits; // requested DIGITS Int n; // rhs in binary Flag rhsint=0; // 1 if rhs is an integer Flag useint=0; // 1 if can use integer calculation Flag isoddint=0; // 1 if rhs is an integer and odd Int i; // work #if DECSUBSET Int dropped; // .. #endif uInt needbytes; // buffer size needed Flag seenbit; // seen a bit while powering Int residue=0; // rounding residue uInt status=0; // accumulators uByte bits=0; // result sign if errors decContext aset; // working context decNumber dnOne; // work value 1... // local accumulator buffer [a decNumber, with digits+elength+1 digits] decNumber dacbuff[D2N(DECBUFFER+9)]; decNumber *dac=dacbuff; // -> result accumulator // same again for possible 1/lhs calculation decNumber invbuff[D2N(DECBUFFER+9)]; #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operands and set status, as needed if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, &status); if (alloclhs==NULL) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { allocrhs=decRoundOperand(rhs, set, &status); if (allocrhs==NULL) break; rhs=allocrhs; } } #endif // [following code does not require input rounding] // handle NaNs and rhs Infinity (lhs infinity is harder) if (SPECIALARGS) { if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) { // NaNs decNaNs(res, lhs, rhs, set, &status); break;} if (decNumberIsInfinite(rhs)) { // rhs Infinity Flag rhsneg=rhs->bits&DECNEG; // save rhs sign if (decNumberIsNegative(lhs) // lhs<0 && !decNumberIsZero(lhs)) // .. status|=DEC_Invalid_operation; else { // lhs >=0 decNumberZero(&dnOne); // set up 1 dnOne.lsu[0]=1; decNumberCompare(dac, lhs, &dnOne, set); // lhs ? 1 decNumberZero(res); // prepare for 0/1/Infinity if (decNumberIsNegative(dac)) { // lhs<1 if (rhsneg) res->bits|=DECINF; // +Infinity [else is +0] } else if (dac->lsu[0]==0) { // lhs=1 // 1**Infinity is inexact, so return fully-padded 1.0000 Int shift=set->digits-1; *res->lsu=1; // was 0, make int 1 res->digits=decShiftToMost(res->lsu, 1, shift); res->exponent=-shift; // make 1.0000... status|=DEC_Inexact|DEC_Rounded; // deemed inexact } else { // lhs>1 if (!rhsneg) res->bits|=DECINF; // +Infinity [else is +0] } } // lhs>=0 break;} // [lhs infinity drops through] } // specials // Original rhs may be an integer that fits and is in range n=decGetInt(rhs); if (n!=BADINT) { // it is an integer rhsint=1; // record the fact for 1**n isoddint=(Flag)n&1; // [works even if big] if (n!=BIGEVEN && n!=BIGODD) // can use integer path? useint=1; // looks good } if (decNumberIsNegative(lhs) // -x .. && isoddint) bits=DECNEG; // .. to an odd power // handle LHS infinity if (decNumberIsInfinite(lhs)) { // [NaNs already handled] uByte rbits=rhs->bits; // save decNumberZero(res); // prepare if (n==0) *res->lsu=1; // [-]Inf**0 => 1 else { // -Inf**nonint -> error if (!rhsint && decNumberIsNegative(lhs)) { status|=DEC_Invalid_operation; // -Inf**nonint is error break;} if (!(rbits & DECNEG)) bits|=DECINF; // was not a **-n // [otherwise will be 0 or -0] res->bits=bits; } break;} // similarly handle LHS zero if (decNumberIsZero(lhs)) { if (n==0) { // 0**0 => Error #if DECSUBSET if (!set->extended) { // [unless subset] decNumberZero(res); *res->lsu=1; // return 1 break;} #endif status|=DEC_Invalid_operation; } else { // 0**x uByte rbits=rhs->bits; // save if (rbits & DECNEG) { // was a 0**(-n) #if DECSUBSET if (!set->extended) { // [bad if subset] status|=DEC_Invalid_operation; break;} #endif bits|=DECINF; } decNumberZero(res); // prepare // [otherwise will be 0 or -0] res->bits=bits; } break;} // here both lhs and rhs are finite; rhs==0 is handled in the // integer path. Next handle the non-integer cases if (!useint) { // non-integral rhs // any -ve lhs is bad, as is either operand or context out of // bounds if (decNumberIsNegative(lhs)) { status|=DEC_Invalid_operation; break;} if (decCheckMath(lhs, set, &status) || decCheckMath(rhs, set, &status)) break; // variable status decContextDefault(&aset, DEC_INIT_DECIMAL64); // clean context aset.emax=DEC_MAX_MATH; // usual bounds aset.emin=-DEC_MAX_MATH; // .. aset.clamp=0; // and no concrete format // calculate the result using exp(ln(lhs)*rhs), which can // all be done into the accumulator, dac. The precision needed // is enough to contain the full information in the lhs (which // is the total digits, including exponent), or the requested // precision, if larger, + 4; 6 is used for the exponent // maximum length, and this is also used when it is shorter // than the requested digits as it greatly reduces the >0.5 ulp // cases at little cost (because Ln doubles digits each // iteration so a few extra digits rarely causes an extra // iteration) aset.digits=MAXI(lhs->digits, set->digits)+6+4; } // non-integer rhs else { // rhs is in-range integer if (n==0) { // x**0 = 1 // (0**0 was handled above) decNumberZero(res); // result=1 *res->lsu=1; // .. break;} // rhs is a non-zero integer if (n<0) n=-n; // use abs(n) aset=*set; // clone the context aset.round=DEC_ROUND_HALF_EVEN; // internally use balanced // calculate the working DIGITS aset.digits=reqdigits+(rhs->digits+rhs->exponent)+2; #if DECSUBSET if (!set->extended) aset.digits--; // use classic precision #endif // it's an error if this is more than can be handled if (aset.digits>DECNUMMAXP) {status|=DEC_Invalid_operation; break;} } // integer path // aset.digits is the count of digits for the accumulator needed // if accumulator is too long for local storage, then allocate needbytes=sizeof(decNumber)+(D2U(aset.digits)-1)*sizeof(Unit); // [needbytes also used below if 1/lhs needed] if (needbytes>sizeof(dacbuff)) { allocdac=(decNumber *)malloc(needbytes); if (allocdac==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} dac=allocdac; // use the allocated space } // here, aset is set up and accumulator is ready for use if (!useint) { // non-integral rhs // x ** y; special-case x=1 here as it will otherwise always // reduce to integer 1; decLnOp has a fastpath which detects // the case of x=1 decLnOp(dac, lhs, &aset, &status); // dac=ln(lhs) // [no error possible, as lhs 0 already handled] if (ISZERO(dac)) { // x==1, 1.0, etc. // need to return fully-padded 1.0000 etc., but rhsint->1 *dac->lsu=1; // was 0, make int 1 if (!rhsint) { // add padding Int shift=set->digits-1; dac->digits=decShiftToMost(dac->lsu, 1, shift); dac->exponent=-shift; // make 1.0000... status|=DEC_Inexact|DEC_Rounded; // deemed inexact } } else { decMultiplyOp(dac, dac, rhs, &aset, &status); // dac=dac*rhs decExpOp(dac, dac, &aset, &status); // dac=exp(dac) } // and drop through for final rounding } // non-integer rhs else { // carry on with integer decNumberZero(dac); // acc=1 *dac->lsu=1; // .. // if a negative power the constant 1 is needed, and if not subset // invert the lhs now rather than inverting the result later if (decNumberIsNegative(rhs)) { // was a **-n [hence digits>0] decNumber *inv=invbuff; // assume use fixed buffer decNumberCopy(&dnOne, dac); // dnOne=1; [needed now or later] #if DECSUBSET if (set->extended) { // need to calculate 1/lhs #endif // divide lhs into 1, putting result in dac [dac=1/dac] decDivideOp(dac, &dnOne, lhs, &aset, DIVIDE, &status); // now locate or allocate space for the inverted lhs if (needbytes>sizeof(invbuff)) { allocinv=(decNumber *)malloc(needbytes); if (allocinv==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} inv=allocinv; // use the allocated space } // [inv now points to big-enough buffer or allocated storage] decNumberCopy(inv, dac); // copy the 1/lhs decNumberCopy(dac, &dnOne); // restore acc=1 lhs=inv; // .. and go forward with new lhs #if DECSUBSET } #endif } // Raise-to-the-power loop... seenbit=0; // set once a 1-bit is encountered for (i=1;;i++){ // for each bit [top bit ignored] // abandon if had overflow or terminal underflow if (status & (DEC_Overflow|DEC_Underflow)) { // interesting? if (status&DEC_Overflow || ISZERO(dac)) break; } // [the following two lines revealed an optimizer bug in a C++ // compiler, with symptom: 5**3 -> 25, when n=n+n was used] n=n<<1; // move next bit to testable position if (n<0) { // top bit is set seenbit=1; // OK, significant bit seen decMultiplyOp(dac, dac, lhs, &aset, &status); // dac=dac*x } if (i==31) break; // that was the last bit if (!seenbit) continue; // no need to square 1 decMultiplyOp(dac, dac, dac, &aset, &status); // dac=dac*dac [square] } /*i*/ // 32 bits // complete internal overflow or underflow processing if (status & (DEC_Overflow|DEC_Underflow)) { #if DECSUBSET // If subset, and power was negative, reverse the kind of -erflow // [1/x not yet done] if (!set->extended && decNumberIsNegative(rhs)) { if (status & DEC_Overflow) status^=DEC_Overflow | DEC_Underflow | DEC_Subnormal; else { // trickier -- Underflow may or may not be set status&=~(DEC_Underflow | DEC_Subnormal); // [one or both] status|=DEC_Overflow; } } #endif dac->bits=(dac->bits & ~DECNEG) | bits; // force correct sign // round subnormals [to set.digits rather than aset.digits] // or set overflow result similarly as required decFinalize(dac, set, &residue, &status); decNumberCopy(res, dac); // copy to result (is now OK length) break; } #if DECSUBSET if (!set->extended && // subset math decNumberIsNegative(rhs)) { // was a **-n [hence digits>0] // so divide result into 1 [dac=1/dac] decDivideOp(dac, &dnOne, dac, &aset, DIVIDE, &status); } #endif } // rhs integer path // reduce result to the requested length and copy to result decCopyFit(res, dac, set, &residue, &status); decFinish(res, set, &residue, &status); // final cleanup #if DECSUBSET if (!set->extended) decTrim(res, set, 0, 1, &dropped); // trailing zeros #endif } while(0); // end protected if (allocdac!=NULL) free(allocdac); // drop any storage used if (allocinv!=NULL) free(allocinv); // .. #if DECSUBSET if (alloclhs!=NULL) free(alloclhs); // .. if (allocrhs!=NULL) free(allocrhs); // .. #endif if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberPower /* ------------------------------------------------------------------ */ /* decNumberQuantize -- force exponent to requested value */ /* */ /* This computes C = op(A, B), where op adjusts the coefficient */ /* of C (by rounding or shifting) such that the exponent (-scale) */ /* of C has exponent of B. The numerical value of C will equal A, */ /* except for the effects of any rounding that occurred. */ /* */ /* res is C, the result. C may be A or B */ /* lhs is A, the number to adjust */ /* rhs is B, the number with exponent to match */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* */ /* Unless there is an error or the result is infinite, the exponent */ /* after the operation is guaranteed to be equal to that of B. */ /* ------------------------------------------------------------------ */ decNumber * decNumberQuantize(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decQuantizeOp(res, lhs, rhs, set, 1, &status); if (status!=0) decStatus(res, status, set); return res; } // decNumberQuantize /* ------------------------------------------------------------------ */ /* decNumberReduce -- remove trailing zeros */ /* */ /* This computes C = 0 + A, and normalizes the result */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ // Previously known as Normalize decNumber * decNumberNormalize(decNumber *res, const decNumber *rhs, decContext *set) { return decNumberReduce(res, rhs, set); } // decNumberNormalize decNumber * decNumberReduce(decNumber *res, const decNumber *rhs, decContext *set) { #if DECSUBSET decNumber *allocrhs=NULL; // non-NULL if rounded rhs allocated #endif uInt status=0; // as usual Int residue=0; // as usual Int dropped; // work #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operand and set lostDigits status, as needed if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); if (allocrhs==NULL) break; rhs=allocrhs; } } #endif // [following code does not require input rounding] // Infinities copy through; NaNs need usual treatment if (decNumberIsNaN(rhs)) { decNaNs(res, rhs, NULL, set, &status); break; } // reduce result to the requested length and copy to result decCopyFit(res, rhs, set, &residue, &status); // copy & round decFinish(res, set, &residue, &status); // cleanup/set flags decTrim(res, set, 1, 0, &dropped); // normalize in place // [may clamp] } while(0); // end protected #if DECSUBSET if (allocrhs !=NULL) free(allocrhs); // .. #endif if (status!=0) decStatus(res, status, set);// then report status return res; } // decNumberReduce /* ------------------------------------------------------------------ */ /* decNumberRescale -- force exponent to requested value */ /* */ /* This computes C = op(A, B), where op adjusts the coefficient */ /* of C (by rounding or shifting) such that the exponent (-scale) */ /* of C has the value B. The numerical value of C will equal A, */ /* except for the effects of any rounding that occurred. */ /* */ /* res is C, the result. C may be A or B */ /* lhs is A, the number to adjust */ /* rhs is B, the requested exponent */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* */ /* Unless there is an error or the result is infinite, the exponent */ /* after the operation is guaranteed to be equal to B. */ /* ------------------------------------------------------------------ */ decNumber * decNumberRescale(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decQuantizeOp(res, lhs, rhs, set, 0, &status); if (status!=0) decStatus(res, status, set); return res; } // decNumberRescale /* ------------------------------------------------------------------ */ /* decNumberRemainder -- divide and return remainder */ /* */ /* This computes C = A % B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X%X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberRemainder(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decDivideOp(res, lhs, rhs, set, REMAINDER, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberRemainder /* ------------------------------------------------------------------ */ /* decNumberRemainderNear -- divide and return remainder from nearest */ /* */ /* This computes C = A % B, where % is the IEEE remainder operator */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X%X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberRemainderNear(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decDivideOp(res, lhs, rhs, set, REMNEAR, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberRemainderNear /* ------------------------------------------------------------------ */ /* decNumberRotate -- rotate the coefficient of a Number left/right */ /* */ /* This computes C = A rot B (in base ten and rotating set->digits */ /* digits). */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=XrotX) */ /* lhs is A */ /* rhs is B, the number of digits to rotate (-ve to right) */ /* set is the context */ /* */ /* The digits of the coefficient of A are rotated to the left (if B */ /* is positive) or to the right (if B is negative) without adjusting */ /* the exponent or the sign of A. If lhs->digits is less than */ /* set->digits the coefficient is padded with zeros on the left */ /* before the rotate. Any leading zeros in the result are removed */ /* as usual. */ /* */ /* B must be an integer (q=0) and in the range -set->digits through */ /* +set->digits. */ /* C must have space for set->digits digits. */ /* NaNs are propagated as usual. Infinities are unaffected (but */ /* B must be valid). No status is set unless B is invalid or an */ /* operand is an sNaN. */ /* ------------------------------------------------------------------ */ decNumber * decNumberRotate(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator Int rotate; // rhs as an Int #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif // NaNs propagate as normal if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) decNaNs(res, lhs, rhs, set, &status); // rhs must be an integer else if (decNumberIsInfinite(rhs) || rhs->exponent!=0) status=DEC_Invalid_operation; else { // both numeric, rhs is an integer rotate=decGetInt(rhs); // [cannot fail] if (rotate==BADINT // something bad .. || rotate==BIGODD || rotate==BIGEVEN // .. very big .. || abs(rotate)>set->digits) // .. or out of range status=DEC_Invalid_operation; else { // rhs is OK decNumberCopy(res, lhs); // convert -ve rotate to equivalent positive rotation if (rotate<0) rotate=set->digits+rotate; if (rotate!=0 && rotate!=set->digits // zero or full rotation && !decNumberIsInfinite(res)) { // lhs was infinite // left-rotate to do; 0 < rotate < set->digits uInt units, shift; // work uInt msudigits; // digits in result msu Unit *msu=res->lsu+D2U(res->digits)-1; // current msu Unit *msumax=res->lsu+D2U(set->digits)-1; // rotation msu for (msu++; msu<=msumax; msu++) *msu=0; // ensure high units=0 res->digits=set->digits; // now full-length msudigits=MSUDIGITS(res->digits); // actual digits in msu // rotation here is done in-place, in three steps // 1. shift all to least up to one unit to unit-align final // lsd [any digits shifted out are rotated to the left, // abutted to the original msd (which may require split)] // // [if there are no whole units left to rotate, the // rotation is now complete] // // 2. shift to least, from below the split point only, so that // the final msd is in the right place in its Unit [any // digits shifted out will fit exactly in the current msu, // left aligned, no split required] // // 3. rotate all the units by reversing left part, right // part, and then whole // // example: rotate right 8 digits (2 units + 2), DECDPUN=3. // // start: 00a bcd efg hij klm npq // // 1a 000 0ab cde fgh|ijk lmn [pq saved] // 1b 00p qab cde fgh|ijk lmn // // 2a 00p qab cde fgh|00i jkl [mn saved] // 2b mnp qab cde fgh|00i jkl // // 3a fgh cde qab mnp|00i jkl // 3b fgh cde qab mnp|jkl 00i // 3c 00i jkl mnp qab cde fgh // Step 1: amount to shift is the partial right-rotate count rotate=set->digits-rotate; // make it right-rotate units=rotate/DECDPUN; // whole units to rotate shift=rotate%DECDPUN; // left-over digits count if (shift>0) { // not an exact number of units uInt save=res->lsu[0]%powers[shift]; // save low digit(s) decShiftToLeast(res->lsu, D2U(res->digits), shift); if (shift>msudigits) { // msumax-1 needs >0 digits uInt rem=save%powers[shift-msudigits];// split save *msumax=(Unit)(save/powers[shift-msudigits]); // and insert *(msumax-1)=*(msumax-1) +(Unit)(rem*powers[DECDPUN-(shift-msudigits)]); // .. } else { // all fits in msumax *msumax=*msumax+(Unit)(save*powers[msudigits-shift]); // [maybe *1] } } // digits shift needed // If whole units to rotate... if (units>0) { // some to do // Step 2: the units to touch are the whole ones in rotate, // if any, and the shift is DECDPUN-msudigits (which may be // 0, again) shift=DECDPUN-msudigits; if (shift>0) { // not an exact number of units uInt save=res->lsu[0]%powers[shift]; // save low digit(s) decShiftToLeast(res->lsu, units, shift); *msumax=*msumax+(Unit)(save*powers[msudigits]); } // partial shift needed // Step 3: rotate the units array using triple reverse // (reversing is easy and fast) decReverse(res->lsu+units, msumax); // left part decReverse(res->lsu, res->lsu+units-1); // right part decReverse(res->lsu, msumax); // whole } // whole units to rotate // the rotation may have left an undetermined number of zeros // on the left, so true length needs to be calculated res->digits=decGetDigits(res->lsu, msumax-res->lsu+1); } // rotate needed } // rhs OK } // numerics if (status!=0) decStatus(res, status, set); return res; } // decNumberRotate /* ------------------------------------------------------------------ */ /* decNumberSameQuantum -- test for equal exponents */ /* */ /* res is the result number, which will contain either 0 or 1 */ /* lhs is a number to test */ /* rhs is the second (usually a pattern) */ /* */ /* No errors are possible and no context is needed. */ /* ------------------------------------------------------------------ */ decNumber * decNumberSameQuantum(decNumber *res, const decNumber *lhs, const decNumber *rhs) { Unit ret=0; // return value #if DECCHECK if (decCheckOperands(res, lhs, rhs, DECUNCONT)) return res; #endif if (SPECIALARGS) { if (decNumberIsNaN(lhs) && decNumberIsNaN(rhs)) ret=1; else if (decNumberIsInfinite(lhs) && decNumberIsInfinite(rhs)) ret=1; // [anything else with a special gives 0] } else if (lhs->exponent==rhs->exponent) ret=1; decNumberZero(res); // OK to overwrite an operand now *res->lsu=ret; return res; } // decNumberSameQuantum /* ------------------------------------------------------------------ */ /* decNumberScaleB -- multiply by a power of 10 */ /* */ /* This computes C = A x 10**B where B is an integer (q=0) with */ /* maximum magnitude 2*(emax+digits) */ /* */ /* res is C, the result. C may be A or B */ /* lhs is A, the number to adjust */ /* rhs is B, the requested power of ten to use */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* */ /* The result may underflow or overflow. */ /* ------------------------------------------------------------------ */ decNumber * decNumberScaleB(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { Int reqexp; // requested exponent change [B] uInt status=0; // accumulator Int residue; // work #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif // Handle special values except lhs infinite if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) decNaNs(res, lhs, rhs, set, &status); // rhs must be an integer else if (decNumberIsInfinite(rhs) || rhs->exponent!=0) status=DEC_Invalid_operation; else { // lhs is a number; rhs is a finite with q==0 reqexp=decGetInt(rhs); // [cannot fail] // maximum range is larger than getInt can handle, so this is // more restrictive than the specification if (reqexp==BADINT // something bad .. || reqexp==BIGODD || reqexp==BIGEVEN // it was huge || (abs(reqexp)+1)/2>(set->digits+set->emax)) // .. or out of range status=DEC_Invalid_operation; else { // rhs is OK decNumberCopy(res, lhs); // all done if infinite lhs if (!decNumberIsInfinite(res)) { // prepare to scale Int exp=res->exponent; // save for overflow test res->exponent+=reqexp; // adjust the exponent if (((exp^reqexp)>=0) // same sign ... && ((exp^res->exponent)<0)) { // .. but result had different // the calculation overflowed, so force right treatment if (exp<0) res->exponent=DEC_MIN_EMIN-DEC_MAX_DIGITS; else res->exponent=DEC_MAX_EMAX+1; } residue=0; decFinalize(res, set, &residue, &status); // final check } // finite LHS } // rhs OK } // rhs finite if (status!=0) decStatus(res, status, set); return res; } // decNumberScaleB /* ------------------------------------------------------------------ */ /* decNumberShift -- shift the coefficient of a Number left or right */ /* */ /* This computes C = A << B or C = A >> -B (in base ten). */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X<digits through */ /* +set->digits. */ /* C must have space for set->digits digits. */ /* NaNs are propagated as usual. Infinities are unaffected (but */ /* B must be valid). No status is set unless B is invalid or an */ /* operand is an sNaN. */ /* ------------------------------------------------------------------ */ decNumber * decNumberShift(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator Int shift; // rhs as an Int #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif // NaNs propagate as normal if (decNumberIsNaN(lhs) || decNumberIsNaN(rhs)) decNaNs(res, lhs, rhs, set, &status); // rhs must be an integer else if (decNumberIsInfinite(rhs) || rhs->exponent!=0) status=DEC_Invalid_operation; else { // both numeric, rhs is an integer shift=decGetInt(rhs); // [cannot fail] if (shift==BADINT // something bad .. || shift==BIGODD || shift==BIGEVEN // .. very big .. || abs(shift)>set->digits) // .. or out of range status=DEC_Invalid_operation; else { // rhs is OK decNumberCopy(res, lhs); if (shift!=0 && !decNumberIsInfinite(res)) { // something to do if (shift>0) { // to left if (shift==set->digits) { // removing all *res->lsu=0; // so place 0 res->digits=1; // .. } else { // // first remove leading digits if necessary if (res->digits+shift>set->digits) { decDecap(res, res->digits+shift-set->digits); // that updated res->digits; may have gone to 1 (for a // single digit or for zero } if (res->digits>1 || *res->lsu) // if non-zero.. res->digits=decShiftToMost(res->lsu, res->digits, shift); } // partial left } // left else { // to right if (-shift>=res->digits) { // discarding all *res->lsu=0; // so place 0 res->digits=1; // .. } else { decShiftToLeast(res->lsu, D2U(res->digits), -shift); res->digits-=(-shift); } } // to right } // non-0 non-Inf shift } // rhs OK } // numerics if (status!=0) decStatus(res, status, set); return res; } // decNumberShift /* ------------------------------------------------------------------ */ /* decNumberSquareRoot -- square root operator */ /* */ /* This computes C = squareroot(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context; note that rounding mode has no effect */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ /* This uses the following varying-precision algorithm in: */ /* */ /* Properly Rounded Variable Precision Square Root, T. E. Hull and */ /* A. Abrham, ACM Transactions on Mathematical Software, Vol 11 #3, */ /* pp229-237, ACM, September 1985. */ /* */ /* The square-root is calculated using Newton's method, after which */ /* a check is made to ensure the result is correctly rounded. */ /* */ /* % [Reformatted original Numerical Turing source code follows.] */ /* function sqrt(x : real) : real */ /* % sqrt(x) returns the properly rounded approximation to the square */ /* % root of x, in the precision of the calling environment, or it */ /* % fails if x < 0. */ /* % t e hull and a abrham, august, 1984 */ /* if x <= 0 then */ /* if x < 0 then */ /* assert false */ /* else */ /* result 0 */ /* end if */ /* end if */ /* var f := setexp(x, 0) % fraction part of x [0.1 <= x < 1] */ /* var e := getexp(x) % exponent part of x */ /* var approx : real */ /* if e mod 2 = 0 then */ /* approx := .259 + .819 * f % approx to root of f */ /* else */ /* f := f/l0 % adjustments */ /* e := e + 1 % for odd */ /* approx := .0819 + 2.59 * f % exponent */ /* end if */ /* */ /* var p:= 3 */ /* const maxp := currentprecision + 2 */ /* loop */ /* p := min(2*p - 2, maxp) % p = 4,6,10, . . . , maxp */ /* precision p */ /* approx := .5 * (approx + f/approx) */ /* exit when p = maxp */ /* end loop */ /* */ /* % approx is now within 1 ulp of the properly rounded square root */ /* % of f; to ensure proper rounding, compare squares of (approx - */ /* % l/2 ulp) and (approx + l/2 ulp) with f. */ /* p := currentprecision */ /* begin */ /* precision p + 2 */ /* const approxsubhalf := approx - setexp(.5, -p) */ /* if mulru(approxsubhalf, approxsubhalf) > f then */ /* approx := approx - setexp(.l, -p + 1) */ /* else */ /* const approxaddhalf := approx + setexp(.5, -p) */ /* if mulrd(approxaddhalf, approxaddhalf) < f then */ /* approx := approx + setexp(.l, -p + 1) */ /* end if */ /* end if */ /* end */ /* result setexp(approx, e div 2) % fix exponent */ /* end sqrt */ /* ------------------------------------------------------------------ */ decNumber * decNumberSquareRoot(decNumber *res, const decNumber *rhs, decContext *set) { decContext workset, approxset; // work contexts decNumber dzero; // used for constant zero Int maxp; // largest working precision Int workp; // working precision Int residue=0; // rounding residue uInt status=0, ignore=0; // status accumulators uInt rstatus; // .. Int exp; // working exponent Int ideal; // ideal (preferred) exponent Int needbytes; // work Int dropped; // .. #if DECSUBSET decNumber *allocrhs=NULL; // non-NULL if rounded rhs allocated #endif // buffer for f [needs +1 in case DECBUFFER 0] decNumber buff[D2N(DECBUFFER+1)]; // buffer for a [needs +2 to match likely maxp] decNumber bufa[D2N(DECBUFFER+2)]; // buffer for temporary, b [must be same size as a] decNumber bufb[D2N(DECBUFFER+2)]; decNumber *allocbuff=NULL; // -> allocated buff, iff allocated decNumber *allocbufa=NULL; // -> allocated bufa, iff allocated decNumber *allocbufb=NULL; // -> allocated bufb, iff allocated decNumber *f=buff; // reduced fraction decNumber *a=bufa; // approximation to result decNumber *b=bufb; // intermediate result // buffer for temporary variable, up to 3 digits decNumber buft[D2N(3)]; decNumber *t=buft; // up-to-3-digit constant or work #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operand and set lostDigits status, as needed if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, &status); if (allocrhs==NULL) break; // [Note: 'f' allocation below could reuse this buffer if // used, but as this is rare they are kept separate for clarity.] rhs=allocrhs; } } #endif // [following code does not require input rounding] // handle infinities and NaNs if (SPECIALARG) { if (decNumberIsInfinite(rhs)) { // an infinity if (decNumberIsNegative(rhs)) status|=DEC_Invalid_operation; else decNumberCopy(res, rhs); // +Infinity } else decNaNs(res, rhs, NULL, set, &status); // a NaN break; } // calculate the ideal (preferred) exponent [floor(exp/2)] // [It would be nicer to write: ideal=rhs->exponent>>1, but this // generates a compiler warning. Generated code is the same.] ideal=(rhs->exponent&~1)/2; // target // handle zeros if (ISZERO(rhs)) { decNumberCopy(res, rhs); // could be 0 or -0 res->exponent=ideal; // use the ideal [safe] // use decFinish to clamp any out-of-range exponent, etc. decFinish(res, set, &residue, &status); break; } // any other -x is an oops if (decNumberIsNegative(rhs)) { status|=DEC_Invalid_operation; break; } // space is needed for three working variables // f -- the same precision as the RHS, reduced to 0.01->0.99... // a -- Hull's approximation -- precision, when assigned, is // currentprecision+1 or the input argument precision, // whichever is larger (+2 for use as temporary) // b -- intermediate temporary result (same size as a) // if any is too long for local storage, then allocate workp=MAXI(set->digits+1, rhs->digits); // actual rounding precision workp=MAXI(workp, 7); // at least 7 for low cases maxp=workp+2; // largest working precision needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); if (needbytes>(Int)sizeof(buff)) { allocbuff=(decNumber *)malloc(needbytes); if (allocbuff==NULL) { // hopeless -- abandon status|=DEC_Insufficient_storage; break;} f=allocbuff; // use the allocated space } // a and b both need to be able to hold a maxp-length number needbytes=sizeof(decNumber)+(D2U(maxp)-1)*sizeof(Unit); if (needbytes>(Int)sizeof(bufa)) { // [same applies to b] allocbufa=(decNumber *)malloc(needbytes); allocbufb=(decNumber *)malloc(needbytes); if (allocbufa==NULL || allocbufb==NULL) { // hopeless status|=DEC_Insufficient_storage; break;} a=allocbufa; // use the allocated spaces b=allocbufb; // .. } // copy rhs -> f, save exponent, and reduce so 0.1 <= f < 1 decNumberCopy(f, rhs); exp=f->exponent+f->digits; // adjusted to Hull rules f->exponent=-(f->digits); // to range // set up working context decContextDefault(&workset, DEC_INIT_DECIMAL64); workset.emax=DEC_MAX_EMAX; workset.emin=DEC_MIN_EMIN; // [Until further notice, no error is possible and status bits // (Rounded, etc.) should be ignored, not accumulated.] // Calculate initial approximation, and allow for odd exponent workset.digits=workp; // p for initial calculation t->bits=0; t->digits=3; a->bits=0; a->digits=3; if ((exp & 1)==0) { // even exponent // Set t=0.259, a=0.819 t->exponent=-3; a->exponent=-3; #if DECDPUN>=3 t->lsu[0]=259; a->lsu[0]=819; #elif DECDPUN==2 t->lsu[0]=59; t->lsu[1]=2; a->lsu[0]=19; a->lsu[1]=8; #else t->lsu[0]=9; t->lsu[1]=5; t->lsu[2]=2; a->lsu[0]=9; a->lsu[1]=1; a->lsu[2]=8; #endif } else { // odd exponent // Set t=0.0819, a=2.59 f->exponent--; // f=f/10 exp++; // e=e+1 t->exponent=-4; a->exponent=-2; #if DECDPUN>=3 t->lsu[0]=819; a->lsu[0]=259; #elif DECDPUN==2 t->lsu[0]=19; t->lsu[1]=8; a->lsu[0]=59; a->lsu[1]=2; #else t->lsu[0]=9; t->lsu[1]=1; t->lsu[2]=8; a->lsu[0]=9; a->lsu[1]=5; a->lsu[2]=2; #endif } decMultiplyOp(a, a, f, &workset, &ignore); // a=a*f decAddOp(a, a, t, &workset, 0, &ignore); // ..+t // [a is now the initial approximation for sqrt(f), calculated with // currentprecision, which is also a's precision.] // the main calculation loop decNumberZero(&dzero); // make 0 decNumberZero(t); // set t = 0.5 t->lsu[0]=5; // .. t->exponent=-1; // .. workset.digits=3; // initial p for (; workset.digitsexponent+=exp/2; // set correct exponent rstatus=0; // clear status residue=0; // .. and accumulator decCopyFit(a, a, &approxset, &residue, &rstatus); // reduce (if needed) decFinish(a, &approxset, &residue, &rstatus); // clean and finalize // Overflow was possible if the input exponent was out-of-range, // in which case quit if (rstatus&DEC_Overflow) { status=rstatus; // use the status as-is decNumberCopy(res, a); // copy to result break; } // Preserve status except Inexact/Rounded status|=(rstatus & ~(DEC_Rounded|DEC_Inexact)); // Carry out the Hull correction a->exponent-=exp/2; // back to 0.1->1 // a is now at final precision and within 1 ulp of the properly // rounded square root of f; to ensure proper rounding, compare // squares of (a - l/2 ulp) and (a + l/2 ulp) with f. // Here workset.digits=maxp and t=0.5, and a->digits determines // the ulp workset.digits--; // maxp-1 is OK now t->exponent=-a->digits-1; // make 0.5 ulp decAddOp(b, a, t, &workset, DECNEG, &ignore); // b = a - 0.5 ulp workset.round=DEC_ROUND_UP; decMultiplyOp(b, b, b, &workset, &ignore); // b = mulru(b, b) decCompareOp(b, f, b, &workset, COMPARE, &ignore); // b ? f, reversed if (decNumberIsNegative(b)) { // f < b [i.e., b > f] // this is the more common adjustment, though both are rare t->exponent++; // make 1.0 ulp t->lsu[0]=1; // .. decAddOp(a, a, t, &workset, DECNEG, &ignore); // a = a - 1 ulp // assign to approx [round to length] approxset.emin-=exp/2; // adjust to match a approxset.emax-=exp/2; decAddOp(a, &dzero, a, &approxset, 0, &ignore); } else { decAddOp(b, a, t, &workset, 0, &ignore); // b = a + 0.5 ulp workset.round=DEC_ROUND_DOWN; decMultiplyOp(b, b, b, &workset, &ignore); // b = mulrd(b, b) decCompareOp(b, b, f, &workset, COMPARE, &ignore); // b ? f if (decNumberIsNegative(b)) { // b < f t->exponent++; // make 1.0 ulp t->lsu[0]=1; // .. decAddOp(a, a, t, &workset, 0, &ignore); // a = a + 1 ulp // assign to approx [round to length] approxset.emin-=exp/2; // adjust to match a approxset.emax-=exp/2; decAddOp(a, &dzero, a, &approxset, 0, &ignore); } } // [no errors are possible in the above, and rounding/inexact during // estimation are irrelevant, so status was not accumulated] // Here, 0.1 <= a < 1 (still), so adjust back a->exponent+=exp/2; // set correct exponent // count droppable zeros [after any subnormal rounding] by // trimming a copy decNumberCopy(b, a); decTrim(b, set, 1, 1, &dropped); // [drops trailing zeros] // Set Inexact and Rounded. The answer can only be exact if // it is short enough so that squaring it could fit in workp // digits, so this is the only (relatively rare) condition that // a careful check is needed if (b->digits*2-1 > workp) { // cannot fit status|=DEC_Inexact|DEC_Rounded; } else { // could be exact/unrounded uInt mstatus=0; // local status decMultiplyOp(b, b, b, &workset, &mstatus); // try the multiply if (mstatus&DEC_Overflow) { // result just won't fit status|=DEC_Inexact|DEC_Rounded; } else { // plausible decCompareOp(t, b, rhs, &workset, COMPARE, &mstatus); // b ? rhs if (!ISZERO(t)) status|=DEC_Inexact|DEC_Rounded; // not equal else { // is Exact // here, dropped is the count of trailing zeros in 'a' // use closest exponent to ideal... Int todrop=ideal-a->exponent; // most that can be dropped if (todrop<0) status|=DEC_Rounded; // ideally would add 0s else { // unrounded // there are some to drop, but emax may not allow all Int maxexp=set->emax-set->digits+1; Int maxdrop=maxexp-a->exponent; if (todrop>maxdrop && set->clamp) { // apply clamping todrop=maxdrop; status|=DEC_Clamped; } if (dropped0) { // have some to drop decShiftToLeast(a->lsu, D2U(a->digits), todrop); a->exponent+=todrop; // maintain numerical value a->digits-=todrop; // new length } } } } } // double-check Underflow, as perhaps the result could not have // been subnormal (initial argument too big), or it is now Exact if (status&DEC_Underflow) { Int ae=rhs->exponent+rhs->digits-1; // adjusted exponent // check if truly subnormal #if DECEXTFLAG // DEC_Subnormal too if (ae>=set->emin*2) status&=~(DEC_Subnormal|DEC_Underflow); #else if (ae>=set->emin*2) status&=~DEC_Underflow; #endif // check if truly inexact if (!(status&DEC_Inexact)) status&=~DEC_Underflow; } decNumberCopy(res, a); // a is now the result } while(0); // end protected if (allocbuff!=NULL) free(allocbuff); // drop any storage used if (allocbufa!=NULL) free(allocbufa); // .. if (allocbufb!=NULL) free(allocbufb); // .. #if DECSUBSET if (allocrhs !=NULL) free(allocrhs); // .. #endif if (status!=0) decStatus(res, status, set);// then report status #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberSquareRoot /* ------------------------------------------------------------------ */ /* decNumberSubtract -- subtract two Numbers */ /* */ /* This computes C = A - B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X-X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* */ /* C must have space for set->digits digits. */ /* ------------------------------------------------------------------ */ decNumber * decNumberSubtract(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { uInt status=0; // accumulator decAddOp(res, lhs, rhs, set, DECNEG, &status); if (status!=0) decStatus(res, status, set); #if DECCHECK decCheckInexact(res, set); #endif return res; } // decNumberSubtract /* ------------------------------------------------------------------ */ /* decNumberToIntegralExact -- round-to-integral-value with InExact */ /* decNumberToIntegralValue -- round-to-integral-value */ /* */ /* res is the result */ /* rhs is input number */ /* set is the context */ /* */ /* res must have space for any value of rhs. */ /* */ /* This implements the IEEE special operators and therefore treats */ /* special values as valid. For finite numbers it returns */ /* rescale(rhs, 0) if rhs->exponent is <0. */ /* Otherwise the result is rhs (so no error is possible, except for */ /* sNaN). */ /* */ /* The context is used for rounding mode and status after sNaN, but */ /* the digits setting is ignored. The Exact version will signal */ /* Inexact if the result differs numerically from rhs; the other */ /* never signals Inexact. */ /* ------------------------------------------------------------------ */ decNumber * decNumberToIntegralExact(decNumber *res, const decNumber *rhs, decContext *set) { decNumber dn; decContext workset; // working context uInt status=0; // accumulator #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif // handle infinities and NaNs if (SPECIALARG) { if (decNumberIsInfinite(rhs)) decNumberCopy(res, rhs); // an Infinity else decNaNs(res, rhs, NULL, set, &status); // a NaN } else { // finite // have a finite number; no error possible (res must be big enough) if (rhs->exponent>=0) return decNumberCopy(res, rhs); // that was easy, but if negative exponent there is work to do... workset=*set; // clone rounding, etc. workset.digits=rhs->digits; // no length rounding workset.traps=0; // no traps decNumberZero(&dn); // make a number with exponent 0 decNumberQuantize(res, rhs, &dn, &workset); status|=workset.status; } if (status!=0) decStatus(res, status, set); return res; } // decNumberToIntegralExact decNumber * decNumberToIntegralValue(decNumber *res, const decNumber *rhs, decContext *set) { decContext workset=*set; // working context workset.traps=0; // no traps decNumberToIntegralExact(res, rhs, &workset); // this never affects set, except for sNaNs; NaN will have been set // or propagated already, so no need to call decStatus set->status|=workset.status&DEC_Invalid_operation; return res; } // decNumberToIntegralValue /* ------------------------------------------------------------------ */ /* decNumberXor -- XOR two Numbers, digitwise */ /* */ /* This computes C = A ^ B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X^X) */ /* lhs is A */ /* rhs is B */ /* set is the context (used for result length and error report) */ /* */ /* C must have space for set->digits digits. */ /* */ /* Logical function restrictions apply (see above); a NaN is */ /* returned with Invalid_operation if a restriction is violated. */ /* ------------------------------------------------------------------ */ decNumber * decNumberXor(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { const Unit *ua, *ub; // -> operands const Unit *msua, *msub; // -> operand msus Unit *uc, *msuc; // -> result and its msu Int msudigs; // digits in res msu #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif if (lhs->exponent!=0 || decNumberIsSpecial(lhs) || decNumberIsNegative(lhs) || rhs->exponent!=0 || decNumberIsSpecial(rhs) || decNumberIsNegative(rhs)) { decStatus(res, DEC_Invalid_operation, set); return res; } // operands are valid ua=lhs->lsu; // bottom-up ub=rhs->lsu; // .. uc=res->lsu; // .. msua=ua+D2U(lhs->digits)-1; // -> msu of lhs msub=ub+D2U(rhs->digits)-1; // -> msu of rhs msuc=uc+D2U(set->digits)-1; // -> msu of result msudigs=MSUDIGITS(set->digits); // [faster than remainder] for (; uc<=msuc; ua++, ub++, uc++) { // Unit loop Unit a, b; // extract units if (ua>msua) a=0; else a=*ua; if (ub>msub) b=0; else b=*ub; *uc=0; // can now write back if (a|b) { // maybe 1 bits to examine Int i, j; // This loop could be unrolled and/or use BIN2BCD tables for (i=0; i1) { decStatus(res, DEC_Invalid_operation, set); return res; } if (uc==msuc && i==msudigs-1) break; // just did final digit } // each digit } // non-zero } // each unit // [here uc-1 is the msu of the result] res->digits=decGetDigits(res->lsu, uc-res->lsu); res->exponent=0; // integer res->bits=0; // sign=0 return res; // [no status to set] } // decNumberXor /* ================================================================== */ /* Utility routines */ /* ================================================================== */ /* ------------------------------------------------------------------ */ /* decNumberClass -- return the decClass of a decNumber */ /* dn -- the decNumber to test */ /* set -- the context to use for Emin */ /* returns the decClass enum */ /* ------------------------------------------------------------------ */ enum decClass decNumberClass(const decNumber *dn, decContext *set) { if (decNumberIsSpecial(dn)) { if (decNumberIsQNaN(dn)) return DEC_CLASS_QNAN; if (decNumberIsSNaN(dn)) return DEC_CLASS_SNAN; // must be an infinity if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_INF; return DEC_CLASS_POS_INF; } // is finite if (decNumberIsNormal(dn, set)) { // most common if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_NORMAL; return DEC_CLASS_POS_NORMAL; } // is subnormal or zero if (decNumberIsZero(dn)) { // most common if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_ZERO; return DEC_CLASS_POS_ZERO; } if (decNumberIsNegative(dn)) return DEC_CLASS_NEG_SUBNORMAL; return DEC_CLASS_POS_SUBNORMAL; } // decNumberClass /* ------------------------------------------------------------------ */ /* decNumberClassToString -- convert decClass to a string */ /* */ /* eclass is a valid decClass */ /* returns a constant string describing the class (max 13+1 chars) */ /* ------------------------------------------------------------------ */ const char *decNumberClassToString(enum decClass eclass) { if (eclass==DEC_CLASS_POS_NORMAL) return DEC_ClassString_PN; if (eclass==DEC_CLASS_NEG_NORMAL) return DEC_ClassString_NN; if (eclass==DEC_CLASS_POS_ZERO) return DEC_ClassString_PZ; if (eclass==DEC_CLASS_NEG_ZERO) return DEC_ClassString_NZ; if (eclass==DEC_CLASS_POS_SUBNORMAL) return DEC_ClassString_PS; if (eclass==DEC_CLASS_NEG_SUBNORMAL) return DEC_ClassString_NS; if (eclass==DEC_CLASS_POS_INF) return DEC_ClassString_PI; if (eclass==DEC_CLASS_NEG_INF) return DEC_ClassString_NI; if (eclass==DEC_CLASS_QNAN) return DEC_ClassString_QN; if (eclass==DEC_CLASS_SNAN) return DEC_ClassString_SN; return DEC_ClassString_UN; // Unknown } // decNumberClassToString /* ------------------------------------------------------------------ */ /* decNumberCopy -- copy a number */ /* */ /* dest is the target decNumber */ /* src is the source decNumber */ /* returns dest */ /* */ /* (dest==src is allowed and is a no-op) */ /* All fields are updated as required. This is a utility operation, */ /* so special values are unchanged and no error is possible. */ /* ------------------------------------------------------------------ */ decNumber * decNumberCopy(decNumber *dest, const decNumber *src) { #if DECCHECK if (src==NULL) return decNumberZero(dest); #endif if (dest==src) return dest; // no copy required // Use explicit assignments here as structure assignment could copy // more than just the lsu (for small DECDPUN). This would not affect // the value of the results, but could disturb test harness spill // checking. dest->bits=src->bits; dest->exponent=src->exponent; dest->digits=src->digits; dest->lsu[0]=src->lsu[0]; if (src->digits>DECDPUN) { // more Units to come const Unit *smsup, *s; // work Unit *d; // .. // memcpy for the remaining Units would be safe as they cannot // overlap. However, this explicit loop is faster in short cases. d=dest->lsu+1; // -> first destination smsup=src->lsu+D2U(src->digits); // -> source msu+1 for (s=src->lsu+1; sdigits digits. */ /* No exception or error can occur; this is a quiet bitwise operation.*/ /* See also decNumberAbs for a checking version of this. */ /* ------------------------------------------------------------------ */ decNumber * decNumberCopyAbs(decNumber *res, const decNumber *rhs) { #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res; #endif decNumberCopy(res, rhs); res->bits&=~DECNEG; // turn off sign return res; } // decNumberCopyAbs /* ------------------------------------------------------------------ */ /* decNumberCopyNegate -- quiet negate value operator */ /* */ /* This sets C = negate(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* */ /* C must have space for set->digits digits. */ /* No exception or error can occur; this is a quiet bitwise operation.*/ /* See also decNumberMinus for a checking version of this. */ /* ------------------------------------------------------------------ */ decNumber * decNumberCopyNegate(decNumber *res, const decNumber *rhs) { #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res; #endif decNumberCopy(res, rhs); res->bits^=DECNEG; // invert the sign return res; } // decNumberCopyNegate /* ------------------------------------------------------------------ */ /* decNumberCopySign -- quiet copy and set sign operator */ /* */ /* This sets C = A with the sign of B */ /* */ /* res is C, the result. C may be A */ /* lhs is A */ /* rhs is B */ /* */ /* C must have space for set->digits digits. */ /* No exception or error can occur; this is a quiet bitwise operation.*/ /* ------------------------------------------------------------------ */ decNumber * decNumberCopySign(decNumber *res, const decNumber *lhs, const decNumber *rhs) { uByte sign; // rhs sign #if DECCHECK if (decCheckOperands(res, DECUNUSED, rhs, DECUNCONT)) return res; #endif sign=rhs->bits & DECNEG; // save sign bit decNumberCopy(res, lhs); res->bits&=~DECNEG; // clear the sign res->bits|=sign; // set from rhs return res; } // decNumberCopySign /* ------------------------------------------------------------------ */ /* decNumberGetBCD -- get the coefficient in BCD8 */ /* dn is the source decNumber */ /* bcd is the uInt array that will receive dn->digits BCD bytes, */ /* most-significant at offset 0 */ /* returns bcd */ /* */ /* bcd must have at least dn->digits bytes. No error is possible; if */ /* dn is a NaN or Infinite, digits must be 1 and the coefficient 0. */ /* ------------------------------------------------------------------ */ uByte * decNumberGetBCD(const decNumber *dn, uByte *bcd) { uByte *ub=bcd+dn->digits-1; // -> lsd const Unit *up=dn->lsu; // Unit pointer, -> lsu #if DECDPUN==1 // trivial simple copy for (; ub>=bcd; ub--, up++) *ub=*up; #else // chopping needed uInt u=*up; // work uInt cut=DECDPUN; // downcounter through unit for (; ub>=bcd; ub--) { *ub=(uByte)(u%10); // [*6554 trick inhibits, here] u=u/10; cut--; if (cut>0) continue; // more in this unit up++; u=*up; cut=DECDPUN; } #endif return bcd; } // decNumberGetBCD /* ------------------------------------------------------------------ */ /* decNumberSetBCD -- set (replace) the coefficient from BCD8 */ /* dn is the target decNumber */ /* bcd is the uInt array that will source n BCD bytes, most- */ /* significant at offset 0 */ /* n is the number of digits in the source BCD array (bcd) */ /* returns dn */ /* */ /* dn must have space for at least n digits. No error is possible; */ /* if dn is a NaN, or Infinite, or is to become a zero, n must be 1 */ /* and bcd[0] zero. */ /* ------------------------------------------------------------------ */ decNumber * decNumberSetBCD(decNumber *dn, const uByte *bcd, uInt n) { Unit *up=dn->lsu+D2U(dn->digits)-1; // -> msu [target pointer] const uByte *ub=bcd; // -> source msd #if DECDPUN==1 // trivial simple copy for (; ub=dn->lsu; up--) { // each Unit from msu *up=0; // will take <=DECDPUN digits for (; cut>0; ub++, cut--) *up=X10(*up)+*ub; cut=DECDPUN; // next Unit has all digits } #endif dn->digits=n; // set digit count return dn; } // decNumberSetBCD /* ------------------------------------------------------------------ */ /* decNumberIsNormal -- test normality of a decNumber */ /* dn is the decNumber to test */ /* set is the context to use for Emin */ /* returns 1 if |dn| is finite and >=Nmin, 0 otherwise */ /* ------------------------------------------------------------------ */ Int decNumberIsNormal(const decNumber *dn, decContext *set) { Int ae; // adjusted exponent #if DECCHECK if (decCheckOperands(DECUNRESU, DECUNUSED, dn, set)) return 0; #endif if (decNumberIsSpecial(dn)) return 0; // not finite if (decNumberIsZero(dn)) return 0; // not non-zero ae=dn->exponent+dn->digits-1; // adjusted exponent if (aeemin) return 0; // is subnormal return 1; } // decNumberIsNormal /* ------------------------------------------------------------------ */ /* decNumberIsSubnormal -- test subnormality of a decNumber */ /* dn is the decNumber to test */ /* set is the context to use for Emin */ /* returns 1 if |dn| is finite, non-zero, and exponent+dn->digits-1; // adjusted exponent if (aeemin) return 1; // is subnormal return 0; } // decNumberIsSubnormal /* ------------------------------------------------------------------ */ /* decNumberTrim -- remove insignificant zeros */ /* */ /* dn is the number to trim */ /* returns dn */ /* */ /* All fields are updated as required. This is a utility operation, */ /* so special values are unchanged and no error is possible. The */ /* zeros are removed unconditionally. */ /* ------------------------------------------------------------------ */ decNumber * decNumberTrim(decNumber *dn) { Int dropped; // work decContext set; // .. #if DECCHECK if (decCheckOperands(DECUNRESU, DECUNUSED, dn, DECUNCONT)) return dn; #endif decContextDefault(&set, DEC_INIT_BASE); // clamp=0 return decTrim(dn, &set, 0, 1, &dropped); } // decNumberTrim /* ------------------------------------------------------------------ */ /* decNumberVersion -- return the name and version of this module */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ const char * decNumberVersion(void) { return DECVERSION; } // decNumberVersion /* ------------------------------------------------------------------ */ /* decNumberZero -- set a number to 0 */ /* */ /* dn is the number to set, with space for one digit */ /* returns dn */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ // Memset is not used as it is much slower in some environments. decNumber * decNumberZero(decNumber *dn) { #if DECCHECK if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn; #endif dn->bits=0; dn->exponent=0; dn->digits=1; dn->lsu[0]=0; return dn; } // decNumberZero /* ================================================================== */ /* Local routines */ /* ================================================================== */ /* ------------------------------------------------------------------ */ /* decToString -- lay out a number into a string */ /* */ /* dn is the number to lay out */ /* string is where to lay out the number */ /* eng is 1 if Engineering, 0 if Scientific */ /* */ /* string must be at least dn->digits+14 characters long */ /* No error is possible. */ /* */ /* Note that this routine can generate a -0 or 0.000. These are */ /* never generated in subset to-number or arithmetic, but can occur */ /* in non-subset arithmetic (e.g., -1*0 or 1.234-1.234). */ /* ------------------------------------------------------------------ */ // If DECCHECK is enabled the string "?" is returned if a number is // invalid. static void decToString(const decNumber *dn, char *string, Flag eng) { Int exp=dn->exponent; // local copy Int e; // E-part value Int pre; // digits before the '.' Int cut; // for counting digits in a Unit char *c=string; // work [output pointer] const Unit *up=dn->lsu+D2U(dn->digits)-1; // -> msu [input pointer] uInt u, pow; // work #if DECCHECK if (decCheckOperands(DECUNRESU, dn, DECUNUSED, DECUNCONT)) { strcpy(string, "?"); return;} #endif if (decNumberIsNegative(dn)) { // Negatives get a minus *c='-'; c++; } if (dn->bits&DECSPECIAL) { // Is a special value if (decNumberIsInfinite(dn)) { strcpy(c, "Inf"); strcpy(c+3, "inity"); return;} // a NaN if (dn->bits&DECSNAN) { // signalling NaN *c='s'; c++; } strcpy(c, "NaN"); c+=3; // step past // if not a clean non-zero coefficient, that's all there is in a // NaN string if (exp!=0 || (*dn->lsu==0 && dn->digits==1)) return; // [drop through to add integer] } // calculate how many digits in msu, and hence first cut cut=MSUDIGITS(dn->digits); // [faster than remainder] cut--; // power of ten for digit if (exp==0) { // simple integer [common fastpath] for (;up>=dn->lsu; up--) { // each Unit from msu u=*up; // contains DECDPUN digits to lay out for (; cut>=0; c++, cut--) TODIGIT(u, cut, c, pow); cut=DECDPUN-1; // next Unit has all digits } *c='\0'; // terminate the string return;} /* non-0 exponent -- assume plain form */ pre=dn->digits+exp; // digits before '.' e=0; // no E if ((exp>0) || (pre<-5)) { // need exponential form e=exp+dn->digits-1; // calculate E value pre=1; // assume one digit before '.' if (eng && (e!=0)) { // engineering: may need to adjust Int adj; // adjustment // The C remainder operator is undefined for negative numbers, so // a positive remainder calculation must be used here if (e<0) { adj=(-e)%3; if (adj!=0) adj=3-adj; } else { // e>0 adj=e%3; } e=e-adj; // if dealing with zero still produce an exponent which is a // multiple of three, as expected, but there will only be the // one zero before the E, still. Otherwise note the padding. if (!ISZERO(dn)) pre+=adj; else { // is zero if (adj!=0) { // 0.00Esnn needed e=e+3; pre=-(2-adj); } } // zero } // eng } // need exponent /* lay out the digits of the coefficient, adding 0s and . as needed */ u=*up; if (pre>0) { // xxx.xxx or xx00 (engineering) form Int n=pre; for (; pre>0; pre--, c++, cut--) { if (cut<0) { // need new Unit if (up==dn->lsu) break; // out of input digits (pre>digits) up--; cut=DECDPUN-1; u=*up; } TODIGIT(u, cut, c, pow); } if (ndigits) { // more to come, after '.' *c='.'; c++; for (;; c++, cut--) { if (cut<0) { // need new Unit if (up==dn->lsu) break; // out of input digits up--; cut=DECDPUN-1; u=*up; } TODIGIT(u, cut, c, pow); } } else for (; pre>0; pre--, c++) *c='0'; // 0 padding (for engineering) needed } else { // 0.xxx or 0.000xxx form *c='0'; c++; *c='.'; c++; for (; pre<0; pre++, c++) *c='0'; // add any 0's after '.' for (; ; c++, cut--) { if (cut<0) { // need new Unit if (up==dn->lsu) break; // out of input digits up--; cut=DECDPUN-1; u=*up; } TODIGIT(u, cut, c, pow); } } /* Finally add the E-part, if needed. It will never be 0, has a base maximum and minimum of +999999999 through -999999999, but could range down to -1999999998 for anormal numbers */ if (e!=0) { Flag had=0; // 1=had non-zero *c='E'; c++; *c='+'; c++; // assume positive u=e; // .. if (e<0) { *(c-1)='-'; // oops, need - u=-e; // uInt, please } // lay out the exponent [_itoa or equivalent is not ANSI C] for (cut=9; cut>=0; cut--) { TODIGIT(u, cut, c, pow); if (*c=='0' && !had) continue; // skip leading zeros had=1; // had non-0 c++; // step for next } // cut } *c='\0'; // terminate the string (all paths) return; } // decToString /* ------------------------------------------------------------------ */ /* decAddOp -- add/subtract operation */ /* */ /* This computes C = A + B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X+X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* negate is DECNEG if rhs should be negated, or 0 otherwise */ /* status accumulates status for the caller */ /* */ /* C must have space for set->digits digits. */ /* Inexact in status must be 0 for correct Exact zero sign in result */ /* ------------------------------------------------------------------ */ /* If possible, the coefficient is calculated directly into C. */ /* However, if: */ /* -- a digits+1 calculation is needed because the numbers are */ /* unaligned and span more than set->digits digits */ /* -- a carry to digits+1 digits looks possible */ /* -- C is the same as A or B, and the result would destructively */ /* overlap the A or B coefficient */ /* then the result must be calculated into a temporary buffer. In */ /* this case a local (stack) buffer is used if possible, and only if */ /* too long for that does malloc become the final resort. */ /* */ /* Misalignment is handled as follows: */ /* Apad: (AExp>BExp) Swap operands and proceed as for BExp>AExp. */ /* BPad: Apply the padding by a combination of shifting (whole */ /* units) and multiplication (part units). */ /* */ /* Addition, especially x=x+1, is speed-critical. */ /* The static buffer is larger than might be expected to allow for */ /* calls from higher-level functions (notable exp). */ /* ------------------------------------------------------------------ */ static decNumber * decAddOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, uByte negate, uInt *status) { #if DECSUBSET decNumber *alloclhs=NULL; // non-NULL if rounded lhs allocated decNumber *allocrhs=NULL; // .., rhs #endif Int rhsshift; // working shift (in Units) Int maxdigits; // longest logical length Int mult; // multiplier Int residue; // rounding accumulator uByte bits; // result bits Flag diffsign; // non-0 if arguments have different sign Unit *acc; // accumulator for result Unit accbuff[SD2U(DECBUFFER*2+20)]; // local buffer [*2+20 reduces many // allocations when called from // other operations, notable exp] Unit *allocacc=NULL; // -> allocated acc buffer, iff allocated Int reqdigits=set->digits; // local copy; requested DIGITS Int padding; // work #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operands and set lostDigits status, as needed if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, status); if (alloclhs==NULL) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { allocrhs=decRoundOperand(rhs, set, status); if (allocrhs==NULL) break; rhs=allocrhs; } } #endif // [following code does not require input rounding] // note whether signs differ [used all paths] diffsign=(Flag)((lhs->bits^rhs->bits^negate)&DECNEG); // handle infinities and NaNs if (SPECIALARGS) { // a special bit set if (SPECIALARGS & (DECSNAN | DECNAN)) // a NaN decNaNs(res, lhs, rhs, set, status); else { // one or two infinities if (decNumberIsInfinite(lhs)) { // LHS is infinity // two infinities with different signs is invalid if (decNumberIsInfinite(rhs) && diffsign) { *status|=DEC_Invalid_operation; break; } bits=lhs->bits & DECNEG; // get sign from LHS } else bits=(rhs->bits^negate) & DECNEG;// RHS must be Infinity bits|=DECINF; decNumberZero(res); res->bits=bits; // set +/- infinity } // an infinity break; } // Quick exit for add 0s; return the non-0, modified as need be if (ISZERO(lhs)) { Int adjust; // work Int lexp=lhs->exponent; // save in case LHS==RES bits=lhs->bits; // .. residue=0; // clear accumulator decCopyFit(res, rhs, set, &residue, status); // copy (as needed) res->bits^=negate; // flip if rhs was negated #if DECSUBSET if (set->extended) { // exponents on zeros count #endif // exponent will be the lower of the two adjust=lexp-res->exponent; // adjustment needed [if -ve] if (ISZERO(res)) { // both 0: special IEEE 754 rules if (adjust<0) res->exponent=lexp; // set exponent // 0-0 gives +0 unless rounding to -infinity, and -0-0 gives -0 if (diffsign) { if (set->round!=DEC_ROUND_FLOOR) res->bits=0; else res->bits=DECNEG; // preserve 0 sign } } else { // non-0 res if (adjust<0) { // 0-padding needed if ((res->digits-adjust)>set->digits) { adjust=res->digits-set->digits; // to fit exactly *status|=DEC_Rounded; // [but exact] } res->digits=decShiftToMost(res->lsu, res->digits, -adjust); res->exponent+=adjust; // set the exponent. } } // non-0 res #if DECSUBSET } // extended #endif decFinish(res, set, &residue, status); // clean and finalize break;} if (ISZERO(rhs)) { // [lhs is non-zero] Int adjust; // work Int rexp=rhs->exponent; // save in case RHS==RES bits=rhs->bits; // be clean residue=0; // clear accumulator decCopyFit(res, lhs, set, &residue, status); // copy (as needed) #if DECSUBSET if (set->extended) { // exponents on zeros count #endif // exponent will be the lower of the two // [0-0 case handled above] adjust=rexp-res->exponent; // adjustment needed [if -ve] if (adjust<0) { // 0-padding needed if ((res->digits-adjust)>set->digits) { adjust=res->digits-set->digits; // to fit exactly *status|=DEC_Rounded; // [but exact] } res->digits=decShiftToMost(res->lsu, res->digits, -adjust); res->exponent+=adjust; // set the exponent. } #if DECSUBSET } // extended #endif decFinish(res, set, &residue, status); // clean and finalize break;} // [NB: both fastpath and mainpath code below assume these cases // (notably 0-0) have already been handled] // calculate the padding needed to align the operands padding=rhs->exponent-lhs->exponent; // Fastpath cases where the numbers are aligned and normal, the RHS // is all in one unit, no operand rounding is needed, and no carry, // lengthening, or borrow is needed if (padding==0 && rhs->digits<=DECDPUN && rhs->exponent>=set->emin // [some normals drop through] && rhs->exponent<=set->emax-set->digits+1 // [could clamp] && rhs->digits<=reqdigits && lhs->digits<=reqdigits) { Int partial=*lhs->lsu; if (!diffsign) { // adding partial+=*rhs->lsu; if ((partial<=DECDPUNMAX) // result fits in unit && (lhs->digits>=DECDPUN || // .. and no digits-count change partial<(Int)powers[lhs->digits])) { // .. if (res!=lhs) decNumberCopy(res, lhs); // not in place *res->lsu=(Unit)partial; // [copy could have overwritten RHS] break; } // else drop out for careful add } else { // signs differ partial-=*rhs->lsu; if (partial>0) { // no borrow needed, and non-0 result if (res!=lhs) decNumberCopy(res, lhs); // not in place *res->lsu=(Unit)partial; // this could have reduced digits [but result>0] res->digits=decGetDigits(res->lsu, D2U(res->digits)); break; } // else drop out for careful subtract } } // Now align (pad) the lhs or rhs so they can be added or // subtracted, as necessary. If one number is much larger than // the other (that is, if in plain form there is a least one // digit between the lowest digit of one and the highest of the // other) padding with up to DIGITS-1 trailing zeros may be // needed; then apply rounding (as exotic rounding modes may be // affected by the residue). rhsshift=0; // rhs shift to left (padding) in Units bits=lhs->bits; // assume sign is that of LHS mult=1; // likely multiplier // [if padding==0 the operands are aligned; no padding is needed] if (padding!=0) { // some padding needed; always pad the RHS, as any required // padding can then be effected by a simple combination of // shifts and a multiply Flag swapped=0; if (padding<0) { // LHS needs the padding const decNumber *t; padding=-padding; // will be +ve bits=(uByte)(rhs->bits^negate); // assumed sign is now that of RHS t=lhs; lhs=rhs; rhs=t; swapped=1; } // If, after pad, rhs would be longer than lhs by digits+1 or // more then lhs cannot affect the answer, except as a residue, // so only need to pad up to a length of DIGITS+1. if (rhs->digits+padding > lhs->digits+reqdigits+1) { // The RHS is sufficient // for residue use the relative sign indication... Int shift=reqdigits-rhs->digits; // left shift needed residue=1; // residue for rounding if (diffsign) residue=-residue; // signs differ // copy, shortening if necessary decCopyFit(res, rhs, set, &residue, status); // if it was already shorter, then need to pad with zeros if (shift>0) { res->digits=decShiftToMost(res->lsu, res->digits, shift); res->exponent-=shift; // adjust the exponent. } // flip the result sign if unswapped and rhs was negated if (!swapped) res->bits^=negate; decFinish(res, set, &residue, status); // done break;} // LHS digits may affect result rhsshift=D2U(padding+1)-1; // this much by Unit shift .. mult=powers[padding-(rhsshift*DECDPUN)]; // .. this by multiplication } // padding needed if (diffsign) mult=-mult; // signs differ // determine the longer operand maxdigits=rhs->digits+padding; // virtual length of RHS if (lhs->digits>maxdigits) maxdigits=lhs->digits; // Decide on the result buffer to use; if possible place directly // into result. acc=res->lsu; // assume add direct to result // If destructive overlap, or the number is too long, or a carry or // borrow to DIGITS+1 might be possible, a buffer must be used. // [Might be worth more sophisticated tests when maxdigits==reqdigits] if ((maxdigits>=reqdigits) // is, or could be, too large || (res==rhs && rhsshift>0)) { // destructive overlap // buffer needed, choose it; units for maxdigits digits will be // needed, +1 Unit for carry or borrow Int need=D2U(maxdigits)+1; acc=accbuff; // assume use local buffer if (need*sizeof(Unit)>sizeof(accbuff)) { // printf("malloc add %ld %ld\n", need, sizeof(accbuff)); allocacc=(Unit *)malloc(need*sizeof(Unit)); if (allocacc==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} acc=allocacc; } } res->bits=(uByte)(bits&DECNEG); // it's now safe to overwrite.. res->exponent=lhs->exponent; // .. operands (even if aliased) #if DECTRACE decDumpAr('A', lhs->lsu, D2U(lhs->digits)); decDumpAr('B', rhs->lsu, D2U(rhs->digits)); printf(" :h: %ld %ld\n", rhsshift, mult); #endif // add [A+B*m] or subtract [A+B*(-m)] res->digits=decUnitAddSub(lhs->lsu, D2U(lhs->digits), rhs->lsu, D2U(rhs->digits), rhsshift, acc, mult) *DECDPUN; // [units -> digits] if (res->digits<0) { // borrowed... res->digits=-res->digits; res->bits^=DECNEG; // flip the sign } #if DECTRACE decDumpAr('+', acc, D2U(res->digits)); #endif // If a buffer was used the result must be copied back, possibly // shortening. (If no buffer was used then the result must have // fit, so can't need rounding and residue must be 0.) residue=0; // clear accumulator if (acc!=res->lsu) { #if DECSUBSET if (set->extended) { // round from first significant digit #endif // remove leading zeros that were added due to rounding up to // integral Units -- before the test for rounding. if (res->digits>reqdigits) res->digits=decGetDigits(acc, D2U(res->digits)); decSetCoeff(res, set, acc, res->digits, &residue, status); #if DECSUBSET } else { // subset arithmetic rounds from original significant digit // May have an underestimate. This only occurs when both // numbers fit in DECDPUN digits and are padding with a // negative multiple (-10, -100...) and the top digit(s) become // 0. (This only matters when using X3.274 rules where the // leading zero could be included in the rounding.) if (res->digitsdigits))=0; // ensure leading 0 is there res->digits=maxdigits; } else { // remove leading zeros that added due to rounding up to // integral Units (but only those in excess of the original // maxdigits length, unless extended) before test for rounding. if (res->digits>reqdigits) { res->digits=decGetDigits(acc, D2U(res->digits)); if (res->digitsdigits=maxdigits; } } decSetCoeff(res, set, acc, res->digits, &residue, status); // Now apply rounding if needed before removing leading zeros. // This is safe because subnormals are not a possibility if (residue!=0) { decApplyRound(res, set, residue, status); residue=0; // did what needed to be done } } // subset #endif } // used buffer // strip leading zeros [these were left on in case of subset subtract] res->digits=decGetDigits(res->lsu, D2U(res->digits)); // apply checks and rounding decFinish(res, set, &residue, status); // "When the sum of two operands with opposite signs is exactly // zero, the sign of that sum shall be '+' in all rounding modes // except round toward -Infinity, in which mode that sign shall be // '-'." [Subset zeros also never have '-', set by decFinish.] if (ISZERO(res) && diffsign #if DECSUBSET && set->extended #endif && (*status&DEC_Inexact)==0) { if (set->round==DEC_ROUND_FLOOR) res->bits|=DECNEG; // sign - else res->bits&=~DECNEG; // sign + } } while(0); // end protected if (allocacc!=NULL) free(allocacc); // drop any storage used #if DECSUBSET if (allocrhs!=NULL) free(allocrhs); // .. if (alloclhs!=NULL) free(alloclhs); // .. #endif return res; } // decAddOp /* ------------------------------------------------------------------ */ /* decDivideOp -- division operation */ /* */ /* This routine performs the calculations for all four division */ /* operators (divide, divideInteger, remainder, remainderNear). */ /* */ /* C=A op B */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X/X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* op is DIVIDE, DIVIDEINT, REMAINDER, or REMNEAR respectively. */ /* status is the usual accumulator */ /* */ /* C must have space for set->digits digits. */ /* */ /* ------------------------------------------------------------------ */ /* The underlying algorithm of this routine is the same as in the */ /* 1981 S/370 implementation, that is, non-restoring long division */ /* with bi-unit (rather than bi-digit) estimation for each unit */ /* multiplier. In this pseudocode overview, complications for the */ /* Remainder operators and division residues for exact rounding are */ /* omitted for clarity. */ /* */ /* Prepare operands and handle special values */ /* Test for x/0 and then 0/x */ /* Exp =Exp1 - Exp2 */ /* Exp =Exp +len(var1) -len(var2) */ /* Sign=Sign1 * Sign2 */ /* Pad accumulator (Var1) to double-length with 0's (pad1) */ /* Pad Var2 to same length as Var1 */ /* msu2pair/plus=1st 2 or 1 units of var2, +1 to allow for round */ /* have=0 */ /* Do until (have=digits+1 OR residue=0) */ /* if exp<0 then if integer divide/residue then leave */ /* this_unit=0 */ /* Do forever */ /* compare numbers */ /* if <0 then leave inner_loop */ /* if =0 then (* quick exit without subtract *) do */ /* this_unit=this_unit+1; output this_unit */ /* leave outer_loop; end */ /* Compare lengths of numbers (mantissae): */ /* If same then tops2=msu2pair -- {units 1&2 of var2} */ /* else tops2=msu2plus -- {0, unit 1 of var2} */ /* tops1=first_unit_of_Var1*10**DECDPUN +second_unit_of_var1 */ /* mult=tops1/tops2 -- Good and safe guess at divisor */ /* if mult=0 then mult=1 */ /* this_unit=this_unit+mult */ /* subtract */ /* end inner_loop */ /* if have\=0 | this_unit\=0 then do */ /* output this_unit */ /* have=have+1; end */ /* var2=var2/10 */ /* exp=exp-1 */ /* end outer_loop */ /* exp=exp+1 -- set the proper exponent */ /* if have=0 then generate answer=0 */ /* Return (Result is defined by Var1) */ /* */ /* ------------------------------------------------------------------ */ /* Two working buffers are needed during the division; one (digits+ */ /* 1) to accumulate the result, and the other (up to 2*digits+1) for */ /* long subtractions. These are acc and var1 respectively. */ /* var1 is a copy of the lhs coefficient, var2 is the rhs coefficient.*/ /* The static buffers may be larger than might be expected to allow */ /* for calls from higher-level functions (notable exp). */ /* ------------------------------------------------------------------ */ static decNumber * decDivideOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, Flag op, uInt *status) { #if DECSUBSET decNumber *alloclhs=NULL; // non-NULL if rounded lhs allocated decNumber *allocrhs=NULL; // .., rhs #endif Unit accbuff[SD2U(DECBUFFER+DECDPUN+10)]; // local buffer Unit *acc=accbuff; // -> accumulator array for result Unit *allocacc=NULL; // -> allocated buffer, iff allocated Unit *accnext; // -> where next digit will go Int acclength; // length of acc needed [Units] Int accunits; // count of units accumulated Int accdigits; // count of digits accumulated Unit varbuff[SD2U(DECBUFFER*2+DECDPUN)]; // buffer for var1 Unit *var1=varbuff; // -> var1 array for long subtraction Unit *varalloc=NULL; // -> allocated buffer, iff used Unit *msu1; // -> msu of var1 const Unit *var2; // -> var2 array const Unit *msu2; // -> msu of var2 Int msu2plus; // msu2 plus one [does not vary] eInt msu2pair; // msu2 pair plus one [does not vary] Int var1units, var2units; // actual lengths Int var2ulen; // logical length (units) Int var1initpad=0; // var1 initial padding (digits) Int maxdigits; // longest LHS or required acc length Int mult; // multiplier for subtraction Unit thisunit; // current unit being accumulated Int residue; // for rounding Int reqdigits=set->digits; // requested DIGITS Int exponent; // working exponent Int maxexponent=0; // DIVIDE maximum exponent if unrounded uByte bits; // working sign Unit *target; // work const Unit *source; // .. uInt const *pow; // .. Int shift, cut; // .. #if DECSUBSET Int dropped; // work #endif #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operands and set lostDigits status, as needed if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, status); if (alloclhs==NULL) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { allocrhs=decRoundOperand(rhs, set, status); if (allocrhs==NULL) break; rhs=allocrhs; } } #endif // [following code does not require input rounding] bits=(lhs->bits^rhs->bits)&DECNEG; // assumed sign for divisions // handle infinities and NaNs if (SPECIALARGS) { // a special bit set if (SPECIALARGS & (DECSNAN | DECNAN)) { // one or two NaNs decNaNs(res, lhs, rhs, set, status); break; } // one or two infinities if (decNumberIsInfinite(lhs)) { // LHS (dividend) is infinite if (decNumberIsInfinite(rhs) || // two infinities are invalid .. op & (REMAINDER | REMNEAR)) { // as is remainder of infinity *status|=DEC_Invalid_operation; break; } // [Note that infinity/0 raises no exceptions] decNumberZero(res); res->bits=bits|DECINF; // set +/- infinity break; } else { // RHS (divisor) is infinite residue=0; if (op&(REMAINDER|REMNEAR)) { // result is [finished clone of] lhs decCopyFit(res, lhs, set, &residue, status); } else { // a division decNumberZero(res); res->bits=bits; // set +/- zero // for DIVIDEINT the exponent is always 0. For DIVIDE, result // is a 0 with infinitely negative exponent, clamped to minimum if (op&DIVIDE) { res->exponent=set->emin-set->digits+1; *status|=DEC_Clamped; } } decFinish(res, set, &residue, status); break; } } // handle 0 rhs (x/0) if (ISZERO(rhs)) { // x/0 is always exceptional if (ISZERO(lhs)) { decNumberZero(res); // [after lhs test] *status|=DEC_Division_undefined;// 0/0 will become NaN } else { decNumberZero(res); if (op&(REMAINDER|REMNEAR)) *status|=DEC_Invalid_operation; else { *status|=DEC_Division_by_zero; // x/0 res->bits=bits|DECINF; // .. is +/- Infinity } } break;} // handle 0 lhs (0/x) if (ISZERO(lhs)) { // 0/x [x!=0] #if DECSUBSET if (!set->extended) decNumberZero(res); else { #endif if (op&DIVIDE) { residue=0; exponent=lhs->exponent-rhs->exponent; // ideal exponent decNumberCopy(res, lhs); // [zeros always fit] res->bits=bits; // sign as computed res->exponent=exponent; // exponent, too decFinalize(res, set, &residue, status); // check exponent } else if (op&DIVIDEINT) { decNumberZero(res); // integer 0 res->bits=bits; // sign as computed } else { // a remainder exponent=rhs->exponent; // [save in case overwrite] decNumberCopy(res, lhs); // [zeros always fit] if (exponentexponent) res->exponent=exponent; // use lower } #if DECSUBSET } #endif break;} // Precalculate exponent. This starts off adjusted (and hence fits // in 31 bits) and becomes the usual unadjusted exponent as the // division proceeds. The order of evaluation is important, here, // to avoid wrap. exponent=(lhs->exponent+lhs->digits)-(rhs->exponent+rhs->digits); // If the working exponent is -ve, then some quick exits are // possible because the quotient is known to be <1 // [for REMNEAR, it needs to be < -1, as -0.5 could need work] if (exponent<0 && !(op==DIVIDE)) { if (op&DIVIDEINT) { decNumberZero(res); // integer part is 0 #if DECSUBSET if (set->extended) #endif res->bits=bits; // set +/- zero break;} // fastpath remainders so long as the lhs has the smaller // (or equal) exponent if (lhs->exponent<=rhs->exponent) { if (op&REMAINDER || exponent<-1) { // It is REMAINDER or safe REMNEAR; result is [finished // clone of] lhs (r = x - 0*y) residue=0; decCopyFit(res, lhs, set, &residue, status); decFinish(res, set, &residue, status); break; } // [unsafe REMNEAR drops through] } } // fastpaths /* Long (slow) division is needed; roll up the sleeves... */ // The accumulator will hold the quotient of the division. // If it needs to be too long for stack storage, then allocate. acclength=D2U(reqdigits+DECDPUN); // in Units if (acclength*sizeof(Unit)>sizeof(accbuff)) { // printf("malloc dvacc %ld units\n", acclength); allocacc=(Unit *)malloc(acclength*sizeof(Unit)); if (allocacc==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} acc=allocacc; // use the allocated space } // var1 is the padded LHS ready for subtractions. // If it needs to be too long for stack storage, then allocate. // The maximum units needed for var1 (long subtraction) is: // Enough for // (rhs->digits+reqdigits-1) -- to allow full slide to right // or (lhs->digits) -- to allow for long lhs // whichever is larger // +1 -- for rounding of slide to right // +1 -- for leading 0s // +1 -- for pre-adjust if a remainder or DIVIDEINT // [Note: unused units do not participate in decUnitAddSub data] maxdigits=rhs->digits+reqdigits-1; if (lhs->digits>maxdigits) maxdigits=lhs->digits; var1units=D2U(maxdigits)+2; // allocate a guard unit above msu1 for REMAINDERNEAR if (!(op&DIVIDE)) var1units++; if ((var1units+1)*sizeof(Unit)>sizeof(varbuff)) { // printf("malloc dvvar %ld units\n", var1units+1); varalloc=(Unit *)malloc((var1units+1)*sizeof(Unit)); if (varalloc==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} var1=varalloc; // use the allocated space } // Extend the lhs and rhs to full long subtraction length. The lhs // is truly extended into the var1 buffer, with 0 padding, so a // subtract in place is always possible. The rhs (var2) has // virtual padding (implemented by decUnitAddSub). // One guard unit was allocated above msu1 for rem=rem+rem in // REMAINDERNEAR. msu1=var1+var1units-1; // msu of var1 source=lhs->lsu+D2U(lhs->digits)-1; // msu of input array for (target=msu1; source>=lhs->lsu; source--, target--) *target=*source; for (; target>=var1; target--) *target=0; // rhs (var2) is left-aligned with var1 at the start var2ulen=var1units; // rhs logical length (units) var2units=D2U(rhs->digits); // rhs actual length (units) var2=rhs->lsu; // -> rhs array msu2=var2+var2units-1; // -> msu of var2 [never changes] // now set up the variables which will be used for estimating the // multiplication factor. If these variables are not exact, add // 1 to make sure that the multiplier is never overestimated. msu2plus=*msu2; // it's value .. if (var2units>1) msu2plus++; // .. +1 if any more msu2pair=(eInt)*msu2*(DECDPUNMAX+1);// top two pair .. if (var2units>1) { // .. [else treat 2nd as 0] msu2pair+=*(msu2-1); // .. if (var2units>2) msu2pair++; // .. +1 if any more } // The calculation is working in units, which may have leading zeros, // but the exponent was calculated on the assumption that they are // both left-aligned. Adjust the exponent to compensate: add the // number of leading zeros in var1 msu and subtract those in var2 msu. // [This is actually done by counting the digits and negating, as // lead1=DECDPUN-digits1, and similarly for lead2.] for (pow=&powers[1]; *msu1>=*pow; pow++) exponent--; for (pow=&powers[1]; *msu2>=*pow; pow++) exponent++; // Now, if doing an integer divide or remainder, ensure that // the result will be Unit-aligned. To do this, shift the var1 // accumulator towards least if need be. (It's much easier to // do this now than to reassemble the residue afterwards, if // doing a remainder.) Also ensure the exponent is not negative. if (!(op&DIVIDE)) { Unit *u; // work // save the initial 'false' padding of var1, in digits var1initpad=(var1units-D2U(lhs->digits))*DECDPUN; // Determine the shift to do. if (exponent<0) cut=-exponent; else cut=DECDPUN-exponent%DECDPUN; decShiftToLeast(var1, var1units, cut); exponent+=cut; // maintain numerical value var1initpad-=cut; // .. and reduce padding // clean any most-significant units which were just emptied for (u=msu1; cut>=DECDPUN; cut-=DECDPUN, u--) *u=0; } // align else { // is DIVIDE maxexponent=lhs->exponent-rhs->exponent; // save // optimization: if the first iteration will just produce 0, // preadjust to skip it [valid for DIVIDE only] if (*msu1<*msu2) { var2ulen--; // shift down exponent-=DECDPUN; // update the exponent } } // ---- start the long-division loops ------------------------------ accunits=0; // no units accumulated yet accdigits=0; // .. or digits accnext=acc+acclength-1; // -> msu of acc [NB: allows digits+1] for (;;) { // outer forever loop thisunit=0; // current unit assumed 0 // find the next unit for (;;) { // inner forever loop // strip leading zero units [from either pre-adjust or from // subtract last time around]. Leave at least one unit. for (; *msu1==0 && msu1>var1; msu1--) var1units--; if (var1units msu for (pv1=msu1; ; pv1--, pv2--) { // v1=*pv1 -- always OK v2=0; // assume in padding if (pv2>=var2) v2=*pv2; // in range if (*pv1!=v2) break; // no longer the same if (pv1==var1) break; // done; leave pv1 as is } // here when all inspected or a difference seen if (*pv1v2. Prepare for real subtraction; the lengths are equal // Estimate the multiplier (there's always a msu1-1)... // Bring in two units of var2 to provide a good estimate. mult=(Int)(((eInt)*msu1*(DECDPUNMAX+1)+*(msu1-1))/msu2pair); } // lengths the same else { // var1units > var2ulen, so subtraction is safe // The var2 msu is one unit towards the lsu of the var1 msu, // so only one unit for var2 can be used. mult=(Int)(((eInt)*msu1*(DECDPUNMAX+1)+*(msu1-1))/msu2plus); } if (mult==0) mult=1; // must always be at least 1 // subtraction needed; var1 is > var2 thisunit=(Unit)(thisunit+mult); // accumulate // subtract var1-var2, into var1; only the overlap needs // processing, as this is an in-place calculation shift=var2ulen-var2units; #if DECTRACE decDumpAr('1', &var1[shift], var1units-shift); decDumpAr('2', var2, var2units); printf("m=%ld\n", -mult); #endif decUnitAddSub(&var1[shift], var1units-shift, var2, var2units, 0, &var1[shift], -mult); #if DECTRACE decDumpAr('#', &var1[shift], var1units-shift); #endif // var1 now probably has leading zeros; these are removed at the // top of the inner loop. } // inner loop // The next unit has been calculated in full; unless it's a // leading zero, add to acc if (accunits!=0 || thisunit!=0) { // is first or non-zero *accnext=thisunit; // store in accumulator // account exactly for the new digits if (accunits==0) { accdigits++; // at least one for (pow=&powers[1]; thisunit>=*pow; pow++) accdigits++; } else accdigits+=DECDPUN; accunits++; // update count accnext--; // ready for next if (accdigits>reqdigits) break; // have enough digits } // if the residue is zero, the operation is done (unless divide // or divideInteger and still not enough digits yet) if (*var1==0 && var1units==1) { // residue is 0 if (op&(REMAINDER|REMNEAR)) break; if ((op&DIVIDE) && (exponent<=maxexponent)) break; // [drop through if divideInteger] } // also done enough if calculating remainder or integer // divide and just did the last ('units') unit if (exponent==0 && !(op&DIVIDE)) break; // to get here, var1 is less than var2, so divide var2 by the per- // Unit power of ten and go for the next digit var2ulen--; // shift down exponent-=DECDPUN; // update the exponent } // outer loop // ---- division is complete --------------------------------------- // here: acc has at least reqdigits+1 of good results (or fewer // if early stop), starting at accnext+1 (its lsu) // var1 has any residue at the stopping point // accunits is the number of digits collected in acc if (accunits==0) { // acc is 0 accunits=1; // show have a unit .. accdigits=1; // .. *accnext=0; // .. whose value is 0 } else accnext++; // back to last placed // accnext now -> lowest unit of result residue=0; // assume no residue if (op&DIVIDE) { // record the presence of any residue, for rounding if (*var1!=0 || var1units>1) residue=1; else { // no residue // Had an exact division; clean up spurious trailing 0s. // There will be at most DECDPUN-1, from the final multiply, // and then only if the result is non-0 (and even) and the // exponent is 'loose'. #if DECDPUN>1 Unit lsu=*accnext; if (!(lsu&0x01) && (lsu!=0)) { // count the trailing zeros Int drop=0; for (;; drop++) { // [will terminate because lsu!=0] if (exponent>=maxexponent) break; // don't chop real 0s #if DECDPUN<=4 if ((lsu-QUOT10(lsu, drop+1) *powers[drop+1])!=0) break; // found non-0 digit #else if (lsu%powers[drop+1]!=0) break; // found non-0 digit #endif exponent++; } if (drop>0) { accunits=decShiftToLeast(accnext, accunits, drop); accdigits=decGetDigits(accnext, accunits); accunits=D2U(accdigits); // [exponent was adjusted in the loop] } } // neither odd nor 0 #endif } // exact divide } // divide else /* op!=DIVIDE */ { // check for coefficient overflow if (accdigits+exponent>reqdigits) { *status|=DEC_Division_impossible; break; } if (op & (REMAINDER|REMNEAR)) { // [Here, the exponent will be 0, because var1 was adjusted // appropriately.] Int postshift; // work Flag wasodd=0; // integer was odd Unit *quotlsu; // for save Int quotdigits; // .. bits=lhs->bits; // remainder sign is always as lhs // Fastpath when residue is truly 0 is worthwhile [and // simplifies the code below] if (*var1==0 && var1units==1) { // residue is 0 Int exp=lhs->exponent; // save min(exponents) if (rhs->exponentexponent; decNumberZero(res); // 0 coefficient #if DECSUBSET if (set->extended) #endif res->exponent=exp; // .. with proper exponent res->bits=(uByte)(bits&DECNEG); // [cleaned] decFinish(res, set, &residue, status); // might clamp break; } // note if the quotient was odd if (*accnext & 0x01) wasodd=1; // acc is odd quotlsu=accnext; // save in case need to reinspect quotdigits=accdigits; // .. // treat the residue, in var1, as the value to return, via acc // calculate the unused zero digits. This is the smaller of: // var1 initial padding (saved above) // var2 residual padding, which happens to be given by: postshift=var1initpad+exponent-lhs->exponent+rhs->exponent; // [the 'exponent' term accounts for the shifts during divide] if (var1initpadexponent; // exponent is smaller of lhs & rhs if (rhs->exponentexponent; // Now correct the result if doing remainderNear; if it // (looking just at coefficients) is > rhs/2, or == rhs/2 and // the integer was odd then the result should be rem-rhs. if (op&REMNEAR) { Int compare, tarunits; // work Unit *up; // .. // calculate remainder*2 into the var1 buffer (which has // 'headroom' of an extra unit and hence enough space) // [a dedicated 'double' loop would be faster, here] tarunits=decUnitAddSub(accnext, accunits, accnext, accunits, 0, accnext, 1); // decDumpAr('r', accnext, tarunits); // Here, accnext (var1) holds tarunits Units with twice the // remainder's coefficient, which must now be compared to the // RHS. The remainder's exponent may be smaller than the RHS's. compare=decUnitCompare(accnext, tarunits, rhs->lsu, D2U(rhs->digits), rhs->exponent-exponent); if (compare==BADINT) { // deep trouble *status|=DEC_Insufficient_storage; break;} // now restore the remainder by dividing by two; the lsu // is known to be even. for (up=accnext; up0 || (compare==0 && wasodd)) { // adjustment needed Int exp, expunits, exprem; // work // This is effectively causing round-up of the quotient, // so if it was the rare case where it was full and all // nines, it would overflow and hence division-impossible // should be raised Flag allnines=0; // 1 if quotient all nines if (quotdigits==reqdigits) { // could be borderline for (up=quotlsu; ; up++) { if (quotdigits>DECDPUN) { if (*up!=DECDPUNMAX) break;// non-nines } else { // this is the last Unit if (*up==powers[quotdigits]-1) allnines=1; break; } quotdigits-=DECDPUN; // checked those digits } // up } // borderline check if (allnines) { *status|=DEC_Division_impossible; break;} // rem-rhs is needed; the sign will invert. Again, var1 // can safely be used for the working Units array. exp=rhs->exponent-exponent; // RHS padding needed // Calculate units and remainder from exponent. expunits=exp/DECDPUN; exprem=exp%DECDPUN; // subtract [A+B*(-m)]; the result will always be negative accunits=-decUnitAddSub(accnext, accunits, rhs->lsu, D2U(rhs->digits), expunits, accnext, -(Int)powers[exprem]); accdigits=decGetDigits(accnext, accunits); // count digits exactly accunits=D2U(accdigits); // and recalculate the units for copy // [exponent is as for original remainder] bits^=DECNEG; // flip the sign } } // REMNEAR } // REMAINDER or REMNEAR } // not DIVIDE // Set exponent and bits res->exponent=exponent; res->bits=(uByte)(bits&DECNEG); // [cleaned] // Now the coefficient. decSetCoeff(res, set, accnext, accdigits, &residue, status); decFinish(res, set, &residue, status); // final cleanup #if DECSUBSET // If a divide then strip trailing zeros if subset [after round] if (!set->extended && (op==DIVIDE)) decTrim(res, set, 0, 1, &dropped); #endif } while(0); // end protected if (varalloc!=NULL) free(varalloc); // drop any storage used if (allocacc!=NULL) free(allocacc); // .. #if DECSUBSET if (allocrhs!=NULL) free(allocrhs); // .. if (alloclhs!=NULL) free(alloclhs); // .. #endif return res; } // decDivideOp /* ------------------------------------------------------------------ */ /* decMultiplyOp -- multiplication operation */ /* */ /* This routine performs the multiplication C=A x B. */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X*X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* status is the usual accumulator */ /* */ /* C must have space for set->digits digits. */ /* */ /* ------------------------------------------------------------------ */ /* 'Classic' multiplication is used rather than Karatsuba, as the */ /* latter would give only a minor improvement for the short numbers */ /* expected to be handled most (and uses much more memory). */ /* */ /* There are two major paths here: the general-purpose ('old code') */ /* path which handles all DECDPUN values, and a fastpath version */ /* which is used if 64-bit ints are available, DECDPUN<=4, and more */ /* than two calls to decUnitAddSub would be made. */ /* */ /* The fastpath version lumps units together into 8-digit or 9-digit */ /* chunks, and also uses a lazy carry strategy to minimise expensive */ /* 64-bit divisions. The chunks are then broken apart again into */ /* units for continuing processing. Despite this overhead, the */ /* fastpath can speed up some 16-digit operations by 10x (and much */ /* more for higher-precision calculations). */ /* */ /* A buffer always has to be used for the accumulator; in the */ /* fastpath, buffers are also always needed for the chunked copies of */ /* of the operand coefficients. */ /* Static buffers are larger than needed just for multiply, to allow */ /* for calls from other operations (notably exp). */ /* ------------------------------------------------------------------ */ #define FASTMUL (DECUSE64 && DECDPUN<5) static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, uInt *status) { Int accunits; // Units of accumulator in use Int exponent; // work Int residue=0; // rounding residue uByte bits; // result sign Unit *acc; // -> accumulator Unit array Int needbytes; // size calculator void *allocacc=NULL; // -> allocated accumulator, iff allocated Unit accbuff[SD2U(DECBUFFER*4+1)]; // buffer (+1 for DECBUFFER==0, // *4 for calls from other operations) const Unit *mer, *mermsup; // work Int madlength; // Units in multiplicand Int shift; // Units to shift multiplicand by #if FASTMUL // if DECDPUN is 1 or 3 work in base 10**9, otherwise // (DECDPUN is 2 or 4) then work in base 10**8 #if DECDPUN & 1 // odd #define FASTBASE 1000000000 // base #define FASTDIGS 9 // digits in base #define FASTLAZY 18 // carry resolution point [1->18] #else #define FASTBASE 100000000 #define FASTDIGS 8 #define FASTLAZY 1844 // carry resolution point [1->1844] #endif // three buffers are used, two for chunked copies of the operands // (base 10**8 or base 10**9) and one base 2**64 accumulator with // lazy carry evaluation uInt zlhibuff[(DECBUFFER*2+1)/8+1]; // buffer (+1 for DECBUFFER==0) uInt *zlhi=zlhibuff; // -> lhs array uInt *alloclhi=NULL; // -> allocated buffer, iff allocated uInt zrhibuff[(DECBUFFER*2+1)/8+1]; // buffer (+1 for DECBUFFER==0) uInt *zrhi=zrhibuff; // -> rhs array uInt *allocrhi=NULL; // -> allocated buffer, iff allocated uLong zaccbuff[(DECBUFFER*2+1)/4+2]; // buffer (+1 for DECBUFFER==0) // [allocacc is shared for both paths, as only one will run] uLong *zacc=zaccbuff; // -> accumulator array for exact result #if DECDPUN==1 Int zoff; // accumulator offset #endif uInt *lip, *rip; // item pointers uInt *lmsi, *rmsi; // most significant items Int ilhs, irhs, iacc; // item counts in the arrays Int lazy; // lazy carry counter uLong lcarry; // uLong carry uInt carry; // carry (NB not uLong) Int count; // work const Unit *cup; // .. Unit *up; // .. uLong *lp; // .. Int p; // .. #endif #if DECSUBSET decNumber *alloclhs=NULL; // -> allocated buffer, iff allocated decNumber *allocrhs=NULL; // -> allocated buffer, iff allocated #endif #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif // precalculate result sign bits=(uByte)((lhs->bits^rhs->bits)&DECNEG); // handle infinities and NaNs if (SPECIALARGS) { // a special bit set if (SPECIALARGS & (DECSNAN | DECNAN)) { // one or two NaNs decNaNs(res, lhs, rhs, set, status); return res;} // one or two infinities; Infinity * 0 is invalid if (((lhs->bits & DECINF)==0 && ISZERO(lhs)) ||((rhs->bits & DECINF)==0 && ISZERO(rhs))) { *status|=DEC_Invalid_operation; return res;} decNumberZero(res); res->bits=bits|DECINF; // infinity return res;} // For best speed, as in DMSRCN [the original Rexx numerics // module], use the shorter number as the multiplier (rhs) and // the longer as the multiplicand (lhs) to minimise the number of // adds (partial products) if (lhs->digitsdigits) { // swap... const decNumber *hold=lhs; lhs=rhs; rhs=hold; } do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operands and set lostDigits status, as needed if (lhs->digits>set->digits) { alloclhs=decRoundOperand(lhs, set, status); if (alloclhs==NULL) break; lhs=alloclhs; } if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, status); if (allocrhs==NULL) break; rhs=allocrhs; } } #endif // [following code does not require input rounding] #if FASTMUL // fastpath can be used // use the fast path if there are enough digits in the shorter // operand to make the setup and takedown worthwhile #define NEEDTWO (DECDPUN*2) // within two decUnitAddSub calls if (rhs->digits>NEEDTWO) { // use fastpath... // calculate the number of elements in each array ilhs=(lhs->digits+FASTDIGS-1)/FASTDIGS; // [ceiling] irhs=(rhs->digits+FASTDIGS-1)/FASTDIGS; // .. iacc=ilhs+irhs; // allocate buffers if required, as usual needbytes=ilhs*sizeof(uInt); if (needbytes>(Int)sizeof(zlhibuff)) { alloclhi=(uInt *)malloc(needbytes); zlhi=alloclhi;} needbytes=irhs*sizeof(uInt); if (needbytes>(Int)sizeof(zrhibuff)) { allocrhi=(uInt *)malloc(needbytes); zrhi=allocrhi;} // Allocating the accumulator space needs a special case when // DECDPUN=1 because when converting the accumulator to Units // after the multiplication each 8-byte item becomes 9 1-byte // units. Therefore iacc extra bytes are needed at the front // (rounded up to a multiple of 8 bytes), and the uLong // accumulator starts offset the appropriate number of units // to the right to avoid overwrite during the unchunking. needbytes=iacc*sizeof(uLong); #if DECDPUN==1 zoff=(iacc+7)/8; // items to offset by needbytes+=zoff*8; #endif if (needbytes>(Int)sizeof(zaccbuff)) { allocacc=(uLong *)malloc(needbytes); zacc=(uLong *)allocacc;} if (zlhi==NULL||zrhi==NULL||zacc==NULL) { *status|=DEC_Insufficient_storage; break;} acc=(Unit *)zacc; // -> target Unit array #if DECDPUN==1 zacc+=zoff; // start uLong accumulator to right #endif // assemble the chunked copies of the left and right sides for (count=lhs->digits, cup=lhs->lsu, lip=zlhi; count>0; lip++) for (p=0, *lip=0; p0; p+=DECDPUN, cup++, count-=DECDPUN) *lip+=*cup*powers[p]; lmsi=lip-1; // save -> msi for (count=rhs->digits, cup=rhs->lsu, rip=zrhi; count>0; rip++) for (p=0, *rip=0; p0; p+=DECDPUN, cup++, count-=DECDPUN) *rip+=*cup*powers[p]; rmsi=rip-1; // save -> msi // zero the accumulator for (lp=zacc; lp0 && rip!=rmsi) continue; lazy=FASTLAZY; // reset delay count // spin up the accumulator resolving overflows for (lp=zacc; lp assume buffer for accumulator needbytes=(D2U(lhs->digits)+D2U(rhs->digits))*sizeof(Unit); if (needbytes>(Int)sizeof(accbuff)) { allocacc=(Unit *)malloc(needbytes); if (allocacc==NULL) {*status|=DEC_Insufficient_storage; break;} acc=(Unit *)allocacc; // use the allocated space } /* Now the main long multiplication loop */ // Unlike the equivalent in the IBM Java implementation, there // is no advantage in calculating from msu to lsu. So, do it // by the book, as it were. // Each iteration calculates ACC=ACC+MULTAND*MULT accunits=1; // accumulator starts at '0' *acc=0; // .. (lsu=0) shift=0; // no multiplicand shift at first madlength=D2U(lhs->digits); // this won't change mermsup=rhs->lsu+D2U(rhs->digits); // -> msu+1 of multiplier for (mer=rhs->lsu; merlsu, madlength, 0, &acc[shift], *mer) + shift; else { // extend acc with a 0; it will be used shortly *(acc+accunits)=0; // [this avoids length of <=0 later] accunits++; } // multiply multiplicand by 10**DECDPUN for next Unit to left shift++; // add this for 'logical length' } // n #if FASTMUL } // unchunked units #endif // common end-path #if DECTRACE decDumpAr('*', acc, accunits); // Show exact result #endif // acc now contains the exact result of the multiplication, // possibly with a leading zero unit; build the decNumber from // it, noting if any residue res->bits=bits; // set sign res->digits=decGetDigits(acc, accunits); // count digits exactly // There can be a 31-bit wrap in calculating the exponent. // This can only happen if both input exponents are negative and // both their magnitudes are large. If there was a wrap, set a // safe very negative exponent, from which decFinalize() will // raise a hard underflow shortly. exponent=lhs->exponent+rhs->exponent; // calculate exponent if (lhs->exponent<0 && rhs->exponent<0 && exponent>0) exponent=-2*DECNUMMAXE; // force underflow res->exponent=exponent; // OK to overwrite now // Set the coefficient. If any rounding, residue records decSetCoeff(res, set, acc, res->digits, &residue, status); decFinish(res, set, &residue, status); // final cleanup } while(0); // end protected if (allocacc!=NULL) free(allocacc); // drop any storage used #if DECSUBSET if (allocrhs!=NULL) free(allocrhs); // .. if (alloclhs!=NULL) free(alloclhs); // .. #endif #if FASTMUL if (allocrhi!=NULL) free(allocrhi); // .. if (alloclhi!=NULL) free(alloclhi); // .. #endif return res; } // decMultiplyOp /* ------------------------------------------------------------------ */ /* decExpOp -- effect exponentiation */ /* */ /* This computes C = exp(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context; note that rounding mode has no effect */ /* */ /* C must have space for set->digits digits. status is updated but */ /* not set. */ /* */ /* Restrictions: */ /* */ /* digits, emax, and -emin in the context must be less than */ /* 2*DEC_MAX_MATH (1999998), and the rhs must be within these */ /* bounds or a zero. This is an internal routine, so these */ /* restrictions are contractual and not enforced. */ /* */ /* A finite result is rounded using DEC_ROUND_HALF_EVEN; it will */ /* almost always be correctly rounded, but may be up to 1 ulp in */ /* error in rare cases. */ /* */ /* Finite results will always be full precision and Inexact, except */ /* when A is a zero or -Infinity (giving 1 or 0 respectively). */ /* ------------------------------------------------------------------ */ /* This approach used here is similar to the algorithm described in */ /* */ /* Variable Precision Exponential Function, T. E. Hull and */ /* A. Abrham, ACM Transactions on Mathematical Software, Vol 12 #2, */ /* pp79-91, ACM, June 1986. */ /* */ /* with the main difference being that the iterations in the series */ /* evaluation are terminated dynamically (which does not require the */ /* extra variable-precision variables which are expensive in this */ /* context). */ /* */ /* The error analysis in Hull & Abrham's paper applies except for the */ /* round-off error accumulation during the series evaluation. This */ /* code does not precalculate the number of iterations and so cannot */ /* use Horner's scheme. Instead, the accumulation is done at double- */ /* precision, which ensures that the additions of the terms are exact */ /* and do not accumulate round-off (and any round-off errors in the */ /* terms themselves move 'to the right' faster than they can */ /* accumulate). This code also extends the calculation by allowing, */ /* in the spirit of other decNumber operators, the input to be more */ /* precise than the result (the precision used is based on the more */ /* precise of the input or requested result). */ /* */ /* Implementation notes: */ /* */ /* 1. This is separated out as decExpOp so it can be called from */ /* other Mathematical functions (notably Ln) with a wider range */ /* than normal. In particular, it can handle the slightly wider */ /* (double) range needed by Ln (which has to be able to calculate */ /* exp(-x) where x can be the tiniest number (Ntiny). */ /* */ /* 2. Normalizing x to be <=0.1 (instead of <=1) reduces loop */ /* iterations by approximately a third with additional (although */ /* diminishing) returns as the range is reduced to even smaller */ /* fractions. However, h (the power of 10 used to correct the */ /* result at the end, see below) must be kept <=8 as otherwise */ /* the final result cannot be computed. Hence the leverage is a */ /* sliding value (8-h), where potentially the range is reduced */ /* more for smaller values. */ /* */ /* The leverage that can be applied in this way is severely */ /* limited by the cost of the raise-to-the power at the end, */ /* which dominates when the number of iterations is small (less */ /* than ten) or when rhs is short. As an example, the adjustment */ /* x**10,000,000 needs 31 multiplications, all but one full-width. */ /* */ /* 3. The restrictions (especially precision) could be raised with */ /* care, but the full decNumber range seems very hard within the */ /* 32-bit limits. */ /* */ /* 4. The working precisions for the static buffers are twice the */ /* obvious size to allow for calls from decNumberPower. */ /* ------------------------------------------------------------------ */ decNumber * decExpOp(decNumber *res, const decNumber *rhs, decContext *set, uInt *status) { uInt ignore=0; // working status Int h; // adjusted exponent for 0.xxxx Int p; // working precision Int residue; // rounding residue uInt needbytes; // for space calculations const decNumber *x=rhs; // (may point to safe copy later) decContext aset, tset, dset; // working contexts Int comp; // work // the argument is often copied to normalize it, so (unusually) it // is treated like other buffers, using DECBUFFER, +1 in case // DECBUFFER is 0 decNumber bufr[D2N(DECBUFFER*2+1)]; decNumber *allocrhs=NULL; // non-NULL if rhs buffer allocated // the working precision will be no more than set->digits+8+1 // so for on-stack buffers DECBUFFER+9 is used, +1 in case DECBUFFER // is 0 (and twice that for the accumulator) // buffer for t, term (working precision plus) decNumber buft[D2N(DECBUFFER*2+9+1)]; decNumber *allocbuft=NULL; // -> allocated buft, iff allocated decNumber *t=buft; // term // buffer for a, accumulator (working precision * 2), at least 9 decNumber bufa[D2N(DECBUFFER*4+18+1)]; decNumber *allocbufa=NULL; // -> allocated bufa, iff allocated decNumber *a=bufa; // accumulator // decNumber for the divisor term; this needs at most 9 digits // and so can be fixed size [16 so can use standard context] decNumber bufd[D2N(16)]; decNumber *d=bufd; // divisor decNumber numone; // constant 1 #if DECCHECK Int iterations=0; // for later sanity check if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif do { // protect allocated storage if (SPECIALARG) { // handle infinities and NaNs if (decNumberIsInfinite(rhs)) { // an infinity if (decNumberIsNegative(rhs)) // -Infinity -> +0 decNumberZero(res); else decNumberCopy(res, rhs); // +Infinity -> self } else decNaNs(res, rhs, NULL, set, status); // a NaN break;} if (ISZERO(rhs)) { // zeros -> exact 1 decNumberZero(res); // make clean 1 *res->lsu=1; // .. break;} // [no status to set] // e**x when 0 < x < 0.66 is < 1+3x/2, hence can fast-path // positive and negative tiny cases which will result in inexact // 1. This also allows the later add-accumulate to always be // exact (because its length will never be more than twice the // working precision). // The comparator (tiny) needs just one digit, so use the // decNumber d for it (reused as the divisor, etc., below); its // exponent is such that if x is positive it will have // set->digits-1 zeros between the decimal point and the digit, // which is 4, and if x is negative one more zero there as the // more precise result will be of the form 0.9999999 rather than // 1.0000001. Hence, tiny will be 0.0000004 if digits=7 and x>0 // or 0.00000004 if digits=7 and x<0. If RHS not larger than // this then the result will be 1.000000 decNumberZero(d); // clean *d->lsu=4; // set 4 .. d->exponent=-set->digits; // * 10**(-d) if (decNumberIsNegative(rhs)) d->exponent--; // negative case comp=decCompare(d, rhs, 1); // signless compare if (comp==BADINT) { *status|=DEC_Insufficient_storage; break;} if (comp>=0) { // rhs < d Int shift=set->digits-1; decNumberZero(res); // set 1 *res->lsu=1; // .. res->digits=decShiftToMost(res->lsu, 1, shift); res->exponent=-shift; // make 1.0000... *status|=DEC_Inexact | DEC_Rounded; // .. inexactly break;} // tiny // set up the context to be used for calculating a, as this is // used on both paths below decContextDefault(&aset, DEC_INIT_DECIMAL64); // accumulator bounds are as requested (could underflow) aset.emax=set->emax; // usual bounds aset.emin=set->emin; // .. aset.clamp=0; // and no concrete format // calculate the adjusted (Hull & Abrham) exponent (where the // decimal point is just to the left of the coefficient msd) h=rhs->exponent+rhs->digits; // if h>8 then 10**h cannot be calculated safely; however, when // h=8 then exp(|rhs|) will be at least exp(1E+7) which is at // least 6.59E+4342944, so (due to the restriction on Emax/Emin) // overflow (or underflow to 0) is guaranteed -- so this case can // be handled by simply forcing the appropriate excess if (h>8) { // overflow/underflow // set up here so Power call below will over or underflow to // zero; set accumulator to either 2 or 0.02 // [stack buffer for a is always big enough for this] decNumberZero(a); *a->lsu=2; // not 1 but < exp(1) if (decNumberIsNegative(rhs)) a->exponent=-2; // make 0.02 h=8; // clamp so 10**h computable p=9; // set a working precision } else { // h<=8 Int maxlever=(rhs->digits>8?1:0); // [could/should increase this for precisions >40 or so, too] // if h is 8, cannot normalize to a lower upper limit because // the final result will not be computable (see notes above), // but leverage can be applied whenever h is less than 8. // Apply as much as possible, up to a MAXLEVER digits, which // sets the tradeoff against the cost of the later a**(10**h). // As h is increased, the working precision below also // increases to compensate for the "constant digits at the // front" effect. Int lever=MINI(8-h, maxlever); // leverage attainable Int use=-rhs->digits-lever; // exponent to use for RHS h+=lever; // apply leverage selected if (h<0) { // clamp use+=h; // [may end up subnormal] h=0; } // Take a copy of RHS if it needs normalization (true whenever x>=1) if (rhs->exponent!=use) { decNumber *newrhs=bufr; // assume will fit on stack needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); if (needbytes>sizeof(bufr)) { // need malloc space allocrhs=(decNumber *)malloc(needbytes); if (allocrhs==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} newrhs=allocrhs; // use the allocated space } decNumberCopy(newrhs, rhs); // copy to safe space newrhs->exponent=use; // normalize; now <1 x=newrhs; // ready for use // decNumberShow(x); } // Now use the usual power series to evaluate exp(x). The // series starts as 1 + x + x^2/2 ... so prime ready for the // third term by setting the term variable t=x, the accumulator // a=1, and the divisor d=2. // First determine the working precision. From Hull & Abrham // this is set->digits+h+2. However, if x is 'over-precise' we // need to allow for all its digits to potentially participate // (consider an x where all the excess digits are 9s) so in // this case use x->digits+h+2 p=MAXI(x->digits, set->digits)+h+2; // [h<=8] // a and t are variable precision, and depend on p, so space // must be allocated for them if necessary // the accumulator needs to be able to hold 2p digits so that // the additions on the second and subsequent iterations are // sufficiently exact. needbytes=sizeof(decNumber)+(D2U(p*2)-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { // need malloc space allocbufa=(decNumber *)malloc(needbytes); if (allocbufa==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} a=allocbufa; // use the allocated space } // the term needs to be able to hold p digits (which is // guaranteed to be larger than x->digits, so the initial copy // is safe); it may also be used for the raise-to-power // calculation below, which needs an extra two digits needbytes=sizeof(decNumber)+(D2U(p+2)-1)*sizeof(Unit); if (needbytes>sizeof(buft)) { // need malloc space allocbuft=(decNumber *)malloc(needbytes); if (allocbuft==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} t=allocbuft; // use the allocated space } decNumberCopy(t, x); // term=x decNumberZero(a); *a->lsu=1; // accumulator=1 decNumberZero(d); *d->lsu=2; // divisor=2 decNumberZero(&numone); *numone.lsu=1; // constant 1 for increment // set up the contexts for calculating a, t, and d decContextDefault(&tset, DEC_INIT_DECIMAL64); dset=tset; // accumulator bounds are set above, set precision now aset.digits=p*2; // double // term bounds avoid any underflow or overflow tset.digits=p; tset.emin=DEC_MIN_EMIN; // [emax is plenty] // [dset.digits=16, etc., are sufficient] // finally ready to roll for (;;) { #if DECCHECK iterations++; #endif // only the status from the accumulation is interesting // [but it should remain unchanged after first add] decAddOp(a, a, t, &aset, 0, status); // a=a+t decMultiplyOp(t, t, x, &tset, &ignore); // t=t*x decDivideOp(t, t, d, &tset, DIVIDE, &ignore); // t=t/d // the iteration ends when the term cannot affect the result, // if rounded to p digits, which is when its value is smaller // than the accumulator by p+1 digits. There must also be // full precision in a. if (((a->digits+a->exponent)>=(t->digits+t->exponent+p+1)) && (a->digits>=p)) break; decAddOp(d, d, &numone, &dset, 0, &ignore); // d=d+1 } // iterate #if DECCHECK // just a sanity check; comment out test to show always if (iterations>p+3) printf("Exp iterations=%ld, status=%08lx, p=%ld, d=%ld\n", (LI)iterations, (LI)*status, (LI)p, (LI)x->digits); #endif } // h<=8 // apply postconditioning: a=a**(10**h) -- this is calculated // at a slightly higher precision than Hull & Abrham suggest if (h>0) { Int seenbit=0; // set once a 1-bit is seen Int i; // counter Int n=powers[h]; // always positive aset.digits=p+2; // sufficient precision // avoid the overhead and many extra digits of decNumberPower // as all that is needed is the short 'multipliers' loop; here // accumulate the answer into t decNumberZero(t); *t->lsu=1; // acc=1 for (i=1;;i++){ // for each bit [top bit ignored] // abandon if have had overflow or terminal underflow if (*status & (DEC_Overflow|DEC_Underflow)) { // interesting? if (*status&DEC_Overflow || ISZERO(t)) break;} n=n<<1; // move next bit to testable position if (n<0) { // top bit is set seenbit=1; // OK, have a significant bit decMultiplyOp(t, t, a, &aset, status); // acc=acc*x } if (i==31) break; // that was the last bit if (!seenbit) continue; // no need to square 1 decMultiplyOp(t, t, t, &aset, status); // acc=acc*acc [square] } /*i*/ // 32 bits // decNumberShow(t); a=t; // and carry on using t instead of a } // Copy and round the result to res residue=1; // indicate dirt to right .. if (ISZERO(a)) residue=0; // .. unless underflowed to 0 aset.digits=set->digits; // [use default rounding] decCopyFit(res, a, &aset, &residue, status); // copy & shorten decFinish(res, set, &residue, status); // cleanup/set flags } while(0); // end protected if (allocrhs !=NULL) free(allocrhs); // drop any storage used if (allocbufa!=NULL) free(allocbufa); // .. if (allocbuft!=NULL) free(allocbuft); // .. // [status is handled by caller] return res; } // decExpOp /* ------------------------------------------------------------------ */ /* Initial-estimate natural logarithm table */ /* */ /* LNnn -- 90-entry 16-bit table for values from .10 through .99. */ /* The result is a 4-digit encode of the coefficient (c=the */ /* top 14 bits encoding 0-9999) and a 2-digit encode of the */ /* exponent (e=the bottom 2 bits encoding 0-3) */ /* */ /* The resulting value is given by: */ /* */ /* v = -c * 10**(-e-3) */ /* */ /* where e and c are extracted from entry k = LNnn[x-10] */ /* where x is truncated (NB) into the range 10 through 99, */ /* and then c = k>>2 and e = k&3. */ /* ------------------------------------------------------------------ */ const uShort LNnn[90]={9016, 8652, 8316, 8008, 7724, 7456, 7208, 6972, 6748, 6540, 6340, 6148, 5968, 5792, 5628, 5464, 5312, 5164, 5020, 4884, 4748, 4620, 4496, 4376, 4256, 4144, 4032, 39233, 38181, 37157, 36157, 35181, 34229, 33297, 32389, 31501, 30629, 29777, 28945, 28129, 27329, 26545, 25777, 25021, 24281, 23553, 22837, 22137, 21445, 20769, 20101, 19445, 18801, 18165, 17541, 16925, 16321, 15721, 15133, 14553, 13985, 13421, 12865, 12317, 11777, 11241, 10717, 10197, 9685, 9177, 8677, 8185, 7697, 7213, 6737, 6269, 5801, 5341, 4889, 4437, 39930, 35534, 31186, 26886, 22630, 18418, 14254, 10130, 6046, 20055}; /* ------------------------------------------------------------------ */ /* decLnOp -- effect natural logarithm */ /* */ /* This computes C = ln(A) */ /* */ /* res is C, the result. C may be A */ /* rhs is A */ /* set is the context; note that rounding mode has no effect */ /* */ /* C must have space for set->digits digits. */ /* */ /* Notable cases: */ /* A<0 -> Invalid */ /* A=0 -> -Infinity (Exact) */ /* A=+Infinity -> +Infinity (Exact) */ /* A=1 exactly -> 0 (Exact) */ /* */ /* Restrictions (as for Exp): */ /* */ /* digits, emax, and -emin in the context must be less than */ /* DEC_MAX_MATH+11 (1000010), and the rhs must be within these */ /* bounds or a zero. This is an internal routine, so these */ /* restrictions are contractual and not enforced. */ /* */ /* A finite result is rounded using DEC_ROUND_HALF_EVEN; it will */ /* almost always be correctly rounded, but may be up to 1 ulp in */ /* error in rare cases. */ /* ------------------------------------------------------------------ */ /* The result is calculated using Newton's method, with each */ /* iteration calculating a' = a + x * exp(-a) - 1. See, for example, */ /* Epperson 1989. */ /* */ /* The iteration ends when the adjustment x*exp(-a)-1 is tiny enough. */ /* This has to be calculated at the sum of the precision of x and the */ /* working precision. */ /* */ /* Implementation notes: */ /* */ /* 1. This is separated out as decLnOp so it can be called from */ /* other Mathematical functions (e.g., Log 10) with a wider range */ /* than normal. In particular, it can handle the slightly wider */ /* (+9+2) range needed by a power function. */ /* */ /* 2. The speed of this function is about 10x slower than exp, as */ /* it typically needs 4-6 iterations for short numbers, and the */ /* extra precision needed adds a squaring effect, twice. */ /* */ /* 3. Fastpaths are included for ln(10) and ln(2), up to length 40, */ /* as these are common requests. ln(10) is used by log10(x). */ /* */ /* 4. An iteration might be saved by widening the LNnn table, and */ /* would certainly save at least one if it were made ten times */ /* bigger, too (for truncated fractions 0.100 through 0.999). */ /* However, for most practical evaluations, at least four or five */ /* iterations will be neede -- so this would only speed up by */ /* 20-25% and that probably does not justify increasing the table */ /* size. */ /* */ /* 5. The static buffers are larger than might be expected to allow */ /* for calls from decNumberPower. */ /* ------------------------------------------------------------------ */ decNumber * decLnOp(decNumber *res, const decNumber *rhs, decContext *set, uInt *status) { uInt ignore=0; // working status accumulator uInt needbytes; // for space calculations Int residue; // rounding residue Int r; // rhs=f*10**r [see below] Int p; // working precision Int pp; // precision for iteration Int t; // work // buffers for a (accumulator, typically precision+2) and b // (adjustment calculator, same size) decNumber bufa[D2N(DECBUFFER+12)]; decNumber *allocbufa=NULL; // -> allocated bufa, iff allocated decNumber *a=bufa; // accumulator/work decNumber bufb[D2N(DECBUFFER*2+2)]; decNumber *allocbufb=NULL; // -> allocated bufa, iff allocated decNumber *b=bufb; // adjustment/work decNumber numone; // constant 1 decNumber cmp; // work decContext aset, bset; // working contexts #if DECCHECK Int iterations=0; // for later sanity check if (decCheckOperands(res, DECUNUSED, rhs, set)) return res; #endif do { // protect allocated storage if (SPECIALARG) { // handle infinities and NaNs if (decNumberIsInfinite(rhs)) { // an infinity if (decNumberIsNegative(rhs)) // -Infinity -> error *status|=DEC_Invalid_operation; else decNumberCopy(res, rhs); // +Infinity -> self } else decNaNs(res, rhs, NULL, set, status); // a NaN break;} if (ISZERO(rhs)) { // +/- zeros -> -Infinity decNumberZero(res); // make clean res->bits=DECINF|DECNEG; // set - infinity break;} // [no status to set] // Non-zero negatives are bad... if (decNumberIsNegative(rhs)) { // -x -> error *status|=DEC_Invalid_operation; break;} // Here, rhs is positive, finite, and in range // lookaside fastpath code for ln(2) and ln(10) at common lengths if (rhs->exponent==0 && set->digits<=40) { #if DECDPUN==1 if (rhs->lsu[0]==0 && rhs->lsu[1]==1 && rhs->digits==2) { // ln(10) #else if (rhs->lsu[0]==10 && rhs->digits==2) { // ln(10) #endif aset=*set; aset.round=DEC_ROUND_HALF_EVEN; #define LN10 "2.302585092994045684017991454684364207601" decNumberFromString(res, LN10, &aset); *status|=(DEC_Inexact | DEC_Rounded); // is inexact break;} if (rhs->lsu[0]==2 && rhs->digits==1) { // ln(2) aset=*set; aset.round=DEC_ROUND_HALF_EVEN; #define LN2 "0.6931471805599453094172321214581765680755" decNumberFromString(res, LN2, &aset); *status|=(DEC_Inexact | DEC_Rounded); break;} } // integer and short // Determine the working precision. This is normally the // requested precision + 2, with a minimum of 9. However, if // the rhs is 'over-precise' then allow for all its digits to // potentially participate (consider an rhs where all the excess // digits are 9s) so in this case use rhs->digits+2. p=MAXI(rhs->digits, MAXI(set->digits, 7))+2; // Allocate space for the accumulator and the high-precision // adjustment calculator, if necessary. The accumulator must // be able to hold p digits, and the adjustment up to // rhs->digits+p digits. They are also made big enough for 16 // digits so that they can be used for calculating the initial // estimate. needbytes=sizeof(decNumber)+(D2U(MAXI(p,16))-1)*sizeof(Unit); if (needbytes>sizeof(bufa)) { // need malloc space allocbufa=(decNumber *)malloc(needbytes); if (allocbufa==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} a=allocbufa; // use the allocated space } pp=p+rhs->digits; needbytes=sizeof(decNumber)+(D2U(MAXI(pp,16))-1)*sizeof(Unit); if (needbytes>sizeof(bufb)) { // need malloc space allocbufb=(decNumber *)malloc(needbytes); if (allocbufb==NULL) { // hopeless -- abandon *status|=DEC_Insufficient_storage; break;} b=allocbufb; // use the allocated space } // Prepare an initial estimate in acc. Calculate this by // considering the coefficient of x to be a normalized fraction, // f, with the decimal point at far left and multiplied by // 10**r. Then, rhs=f*10**r and 0.1<=f<1, and // ln(x) = ln(f) + ln(10)*r // Get the initial estimate for ln(f) from a small lookup // table (see above) indexed by the first two digits of f, // truncated. decContextDefault(&aset, DEC_INIT_DECIMAL64); // 16-digit extended r=rhs->exponent+rhs->digits; // 'normalised' exponent decNumberFromInt32(a, r); // a=r decNumberFromInt32(b, 2302585); // b=ln(10) (2.302585) b->exponent=-6; // .. decMultiplyOp(a, a, b, &aset, &ignore); // a=a*b // now get top two digits of rhs into b by simple truncate and // force to integer residue=0; // (no residue) aset.digits=2; aset.round=DEC_ROUND_DOWN; decCopyFit(b, rhs, &aset, &residue, &ignore); // copy & shorten b->exponent=0; // make integer t=decGetInt(b); // [cannot fail] if (t<10) t=X10(t); // adjust single-digit b t=LNnn[t-10]; // look up ln(b) decNumberFromInt32(b, t>>2); // b=ln(b) coefficient b->exponent=-(t&3)-3; // set exponent b->bits=DECNEG; // ln(0.10)->ln(0.99) always -ve aset.digits=16; aset.round=DEC_ROUND_HALF_EVEN; // restore decAddOp(a, a, b, &aset, 0, &ignore); // acc=a+b // the initial estimate is now in a, with up to 4 digits correct. // When rhs is at or near Nmax the estimate will be low, so we // will approach it from below, avoiding overflow when calling exp. decNumberZero(&numone); *numone.lsu=1; // constant 1 for adjustment // accumulator bounds are as requested (could underflow, but // cannot overflow) aset.emax=set->emax; aset.emin=set->emin; aset.clamp=0; // no concrete format // set up a context to be used for the multiply and subtract bset=aset; bset.emax=DEC_MAX_MATH*2; // use double bounds for the bset.emin=-DEC_MAX_MATH*2; // adjustment calculation // [see decExpOp call below] // for each iteration double the number of digits to calculate, // up to a maximum of p pp=9; // initial precision // [initially 9 as then the sequence starts 7+2, 16+2, and // 34+2, which is ideal for standard-sized numbers] aset.digits=pp; // working context bset.digits=pp+rhs->digits; // wider context for (;;) { // iterate #if DECCHECK iterations++; if (iterations>24) break; // consider 9 * 2**24 #endif // calculate the adjustment (exp(-a)*x-1) into b. This is a // catastrophic subtraction but it really is the difference // from 1 that is of interest. // Use the internal entry point to Exp as it allows the double // range for calculating exp(-a) when a is the tiniest subnormal. a->bits^=DECNEG; // make -a decExpOp(b, a, &bset, &ignore); // b=exp(-a) a->bits^=DECNEG; // restore sign of a // now multiply by rhs and subtract 1, at the wider precision decMultiplyOp(b, b, rhs, &bset, &ignore); // b=b*rhs decAddOp(b, b, &numone, &bset, DECNEG, &ignore); // b=b-1 // the iteration ends when the adjustment cannot affect the // result by >=0.5 ulp (at the requested digits), which // is when its value is smaller than the accumulator by // set->digits+1 digits (or it is zero) -- this is a looser // requirement than for Exp because all that happens to the // accumulator after this is the final rounding (but note that // there must also be full precision in a, or a=0). if (decNumberIsZero(b) || (a->digits+a->exponent)>=(b->digits+b->exponent+set->digits+1)) { if (a->digits==p) break; if (decNumberIsZero(a)) { decCompareOp(&cmp, rhs, &numone, &aset, COMPARE, &ignore); // rhs=1 ? if (cmp.lsu[0]==0) a->exponent=0; // yes, exact 0 else *status|=(DEC_Inexact | DEC_Rounded); // no, inexact break; } // force padding if adjustment has gone to 0 before full length if (decNumberIsZero(b)) b->exponent=a->exponent-p; } // not done yet ... decAddOp(a, a, b, &aset, 0, &ignore); // a=a+b for next estimate if (pp==p) continue; // precision is at maximum // lengthen the next calculation pp=pp*2; // double precision if (pp>p) pp=p; // clamp to maximum aset.digits=pp; // working context bset.digits=pp+rhs->digits; // wider context } // Newton's iteration #if DECCHECK // just a sanity check; remove the test to show always if (iterations>24) printf("Ln iterations=%ld, status=%08lx, p=%ld, d=%ld\n", (LI)iterations, (LI)*status, (LI)p, (LI)rhs->digits); #endif // Copy and round the result to res residue=1; // indicate dirt to right if (ISZERO(a)) residue=0; // .. unless underflowed to 0 aset.digits=set->digits; // [use default rounding] decCopyFit(res, a, &aset, &residue, status); // copy & shorten decFinish(res, set, &residue, status); // cleanup/set flags } while(0); // end protected if (allocbufa!=NULL) free(allocbufa); // drop any storage used if (allocbufb!=NULL) free(allocbufb); // .. // [status is handled by caller] return res; } // decLnOp /* ------------------------------------------------------------------ */ /* decQuantizeOp -- force exponent to requested value */ /* */ /* This computes C = op(A, B), where op adjusts the coefficient */ /* of C (by rounding or shifting) such that the exponent (-scale) */ /* of C has the value B or matches the exponent of B. */ /* The numerical value of C will equal A, except for the effects of */ /* any rounding that occurred. */ /* */ /* res is C, the result. C may be A or B */ /* lhs is A, the number to adjust */ /* rhs is B, the requested exponent */ /* set is the context */ /* quant is 1 for quantize or 0 for rescale */ /* status is the status accumulator (this can be called without */ /* risk of control loss) */ /* */ /* C must have space for set->digits digits. */ /* */ /* Unless there is an error or the result is infinite, the exponent */ /* after the operation is guaranteed to be that requested. */ /* ------------------------------------------------------------------ */ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, Flag quant, uInt *status) { #if DECSUBSET decNumber *alloclhs=NULL; // non-NULL if rounded lhs allocated decNumber *allocrhs=NULL; // .., rhs #endif const decNumber *inrhs=rhs; // save original rhs Int reqdigits=set->digits; // requested DIGITS Int reqexp; // requested exponent [-scale] Int residue=0; // rounding residue Int etiny=set->emin-(reqdigits-1); #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operands and set lostDigits status, as needed if (lhs->digits>reqdigits) { alloclhs=decRoundOperand(lhs, set, status); if (alloclhs==NULL) break; lhs=alloclhs; } if (rhs->digits>reqdigits) { // [this only checks lostDigits] allocrhs=decRoundOperand(rhs, set, status); if (allocrhs==NULL) break; rhs=allocrhs; } } #endif // [following code does not require input rounding] // Handle special values if (SPECIALARGS) { // NaNs get usual processing if (SPECIALARGS & (DECSNAN | DECNAN)) decNaNs(res, lhs, rhs, set, status); // one infinity but not both is bad else if ((lhs->bits ^ rhs->bits) & DECINF) *status|=DEC_Invalid_operation; // both infinity: return lhs else decNumberCopy(res, lhs); // [nop if in place] break; } // set requested exponent if (quant) reqexp=inrhs->exponent; // quantize -- match exponents else { // rescale -- use value of rhs // Original rhs must be an integer that fits and is in range, // which could be from -1999999997 to +999999999, thanks to // subnormals reqexp=decGetInt(inrhs); // [cannot fail] } #if DECSUBSET if (!set->extended) etiny=set->emin; // no subnormals #endif if (reqexp==BADINT // bad (rescale only) or .. || reqexp==BIGODD || reqexp==BIGEVEN // very big (ditto) or .. || (reqexpset->emax)) { // > emax *status|=DEC_Invalid_operation; break;} // the RHS has been processed, so it can be overwritten now if necessary if (ISZERO(lhs)) { // zero coefficient unchanged decNumberCopy(res, lhs); // [nop if in place] res->exponent=reqexp; // .. just set exponent #if DECSUBSET if (!set->extended) res->bits=0; // subset specification; no -0 #endif } else { // non-zero lhs Int adjust=reqexp-lhs->exponent; // digit adjustment needed // if adjusted coefficient will definitely not fit, give up now if ((lhs->digits-adjust)>reqdigits) { *status|=DEC_Invalid_operation; break; } if (adjust>0) { // increasing exponent // this will decrease the length of the coefficient by adjust // digits, and must round as it does so decContext workset; // work workset=*set; // clone rounding, etc. workset.digits=lhs->digits-adjust; // set requested length // [note that the latter can be <1, here] decCopyFit(res, lhs, &workset, &residue, status); // fit to result decApplyRound(res, &workset, residue, status); // .. and round residue=0; // [used] // If just rounded a 999s case, exponent will be off by one; // adjust back (after checking space), if so. if (res->exponent>reqexp) { // re-check needed, e.g., for quantize(0.9999, 0.001) under // set->digits==3 if (res->digits==reqdigits) { // cannot shift by 1 *status&=~(DEC_Inexact | DEC_Rounded); // [clean these] *status|=DEC_Invalid_operation; break; } res->digits=decShiftToMost(res->lsu, res->digits, 1); // shift res->exponent--; // (re)adjust the exponent. } #if DECSUBSET if (ISZERO(res) && !set->extended) res->bits=0; // subset; no -0 #endif } // increase else /* adjust<=0 */ { // decreasing or = exponent // this will increase the length of the coefficient by -adjust // digits, by adding zero or more trailing zeros; this is // already checked for fit, above decNumberCopy(res, lhs); // [it will fit] // if padding needed (adjust<0), add it now... if (adjust<0) { res->digits=decShiftToMost(res->lsu, res->digits, -adjust); res->exponent+=adjust; // adjust the exponent } } // decrease } // non-zero // Check for overflow [do not use Finalize in this case, as an // overflow here is a "don't fit" situation] if (res->exponent>set->emax-res->digits+1) { // too big *status|=DEC_Invalid_operation; break; } else { decFinalize(res, set, &residue, status); // set subnormal flags *status&=~DEC_Underflow; // suppress Underflow [as per 754] } } while(0); // end protected #if DECSUBSET if (allocrhs!=NULL) free(allocrhs); // drop any storage used if (alloclhs!=NULL) free(alloclhs); // .. #endif return res; } // decQuantizeOp /* ------------------------------------------------------------------ */ /* decCompareOp -- compare, min, or max two Numbers */ /* */ /* This computes C = A ? B and carries out one of four operations: */ /* COMPARE -- returns the signum (as a number) giving the */ /* result of a comparison unless one or both */ /* operands is a NaN (in which case a NaN results) */ /* COMPSIG -- as COMPARE except that a quiet NaN raises */ /* Invalid operation. */ /* COMPMAX -- returns the larger of the operands, using the */ /* 754 maxnum operation */ /* COMPMAXMAG -- ditto, comparing absolute values */ /* COMPMIN -- the 754 minnum operation */ /* COMPMINMAG -- ditto, comparing absolute values */ /* COMTOTAL -- returns the signum (as a number) giving the */ /* result of a comparison using 754 total ordering */ /* */ /* res is C, the result. C may be A and/or B (e.g., X=X?X) */ /* lhs is A */ /* rhs is B */ /* set is the context */ /* op is the operation flag */ /* status is the usual accumulator */ /* */ /* C must have space for one digit for COMPARE or set->digits for */ /* COMPMAX, COMPMIN, COMPMAXMAG, or COMPMINMAG. */ /* ------------------------------------------------------------------ */ /* The emphasis here is on speed for common cases, and avoiding */ /* coefficient comparison if possible. */ /* ------------------------------------------------------------------ */ decNumber * decCompareOp(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, Flag op, uInt *status) { #if DECSUBSET decNumber *alloclhs=NULL; // non-NULL if rounded lhs allocated decNumber *allocrhs=NULL; // .., rhs #endif Int result=0; // default result value uByte merged; // work #if DECCHECK if (decCheckOperands(res, lhs, rhs, set)) return res; #endif do { // protect allocated storage #if DECSUBSET if (!set->extended) { // reduce operands and set lostDigits status, as needed if (lhs->digits>set->digits) { alloclhs=decRoundOperand(lhs, set, status); if (alloclhs==NULL) {result=BADINT; break;} lhs=alloclhs; } if (rhs->digits>set->digits) { allocrhs=decRoundOperand(rhs, set, status); if (allocrhs==NULL) {result=BADINT; break;} rhs=allocrhs; } } #endif // [following code does not require input rounding] // If total ordering then handle differing signs 'up front' if (op==COMPTOTAL) { // total ordering if (decNumberIsNegative(lhs) & !decNumberIsNegative(rhs)) { result=-1; break; } if (!decNumberIsNegative(lhs) & decNumberIsNegative(rhs)) { result=+1; break; } } // handle NaNs specially; let infinities drop through // This assumes sNaN (even just one) leads to NaN. merged=(lhs->bits | rhs->bits) & (DECSNAN | DECNAN); if (merged) { // a NaN bit set if (op==COMPARE); // result will be NaN else if (op==COMPSIG) // treat qNaN as sNaN *status|=DEC_Invalid_operation | DEC_sNaN; else if (op==COMPTOTAL) { // total ordering, always finite // signs are known to be the same; compute the ordering here // as if the signs are both positive, then invert for negatives if (!decNumberIsNaN(lhs)) result=-1; else if (!decNumberIsNaN(rhs)) result=+1; // here if both NaNs else if (decNumberIsSNaN(lhs) && decNumberIsQNaN(rhs)) result=-1; else if (decNumberIsQNaN(lhs) && decNumberIsSNaN(rhs)) result=+1; else { // both NaN or both sNaN // now it just depends on the payload result=decUnitCompare(lhs->lsu, D2U(lhs->digits), rhs->lsu, D2U(rhs->digits), 0); // [Error not possible, as these are 'aligned'] } // both same NaNs if (decNumberIsNegative(lhs)) result=-result; break; } // total order else if (merged & DECSNAN); // sNaN -> qNaN else { // here if MIN or MAX and one or two quiet NaNs // min or max -- 754 rules ignore single NaN if (!decNumberIsNaN(lhs) || !decNumberIsNaN(rhs)) { // just one NaN; force choice to be the non-NaN operand op=COMPMAX; if (lhs->bits & DECNAN) result=-1; // pick rhs else result=+1; // pick lhs break; } } // max or min op=COMPNAN; // use special path decNaNs(res, lhs, rhs, set, status); // propagate NaN break; } // have numbers if (op==COMPMAXMAG || op==COMPMINMAG) result=decCompare(lhs, rhs, 1); else result=decCompare(lhs, rhs, 0); // sign matters } while(0); // end protected if (result==BADINT) *status|=DEC_Insufficient_storage; // rare else { if (op==COMPARE || op==COMPSIG ||op==COMPTOTAL) { // returning signum if (op==COMPTOTAL && result==0) { // operands are numerically equal or same NaN (and same sign, // tested first); if identical, leave result 0 if (lhs->exponent!=rhs->exponent) { if (lhs->exponentexponent) result=-1; else result=+1; if (decNumberIsNegative(lhs)) result=-result; } // lexp!=rexp } // total-order by exponent decNumberZero(res); // [always a valid result] if (result!=0) { // must be -1 or +1 *res->lsu=1; if (result<0) res->bits=DECNEG; } } else if (op==COMPNAN); // special, drop through else { // MAX or MIN, non-NaN result Int residue=0; // rounding accumulator // choose the operand for the result const decNumber *choice; if (result==0) { // operands are numerically equal // choose according to sign then exponent (see 754) uByte slhs=(lhs->bits & DECNEG); uByte srhs=(rhs->bits & DECNEG); #if DECSUBSET if (!set->extended) { // subset: force left-hand op=COMPMAX; result=+1; } else #endif if (slhs!=srhs) { // signs differ if (slhs) result=-1; // rhs is max else result=+1; // lhs is max } else if (slhs && srhs) { // both negative if (lhs->exponentexponent) result=+1; else result=-1; // [if equal, use lhs, technically identical] } else { // both positive if (lhs->exponent>rhs->exponent) result=+1; else result=-1; // [ditto] } } // numerically equal // here result will be non-0; reverse if looking for MIN if (op==COMPMIN || op==COMPMINMAG) result=-result; choice=(result>0 ? lhs : rhs); // choose // copy chosen to result, rounding if need be decCopyFit(res, choice, set, &residue, status); decFinish(res, set, &residue, status); } } #if DECSUBSET if (allocrhs!=NULL) free(allocrhs); // free any storage used if (alloclhs!=NULL) free(alloclhs); // .. #endif return res; } // decCompareOp /* ------------------------------------------------------------------ */ /* decCompare -- compare two decNumbers by numerical value */ /* */ /* This routine compares A ? B without altering them. */ /* */ /* Arg1 is A, a decNumber which is not a NaN */ /* Arg2 is B, a decNumber which is not a NaN */ /* Arg3 is 1 for a sign-independent compare, 0 otherwise */ /* */ /* returns -1, 0, or 1 for AB, or BADINT if failure */ /* (the only possible failure is an allocation error) */ /* ------------------------------------------------------------------ */ static Int decCompare(const decNumber *lhs, const decNumber *rhs, Flag abs) { Int result; // result value Int sigr; // rhs signum Int compare; // work result=1; // assume signum(lhs) if (ISZERO(lhs)) result=0; if (abs) { if (ISZERO(rhs)) return result; // LHS wins or both 0 // RHS is non-zero if (result==0) return -1; // LHS is 0; RHS wins // [here, both non-zero, result=1] } else { // signs matter if (result && decNumberIsNegative(lhs)) result=-1; sigr=1; // compute signum(rhs) if (ISZERO(rhs)) sigr=0; else if (decNumberIsNegative(rhs)) sigr=-1; if (result > sigr) return +1; // L > R, return 1 if (result < sigr) return -1; // L < R, return -1 if (result==0) return 0; // both 0 } // signums are the same; both are non-zero if ((lhs->bits | rhs->bits) & DECINF) { // one or more infinities if (decNumberIsInfinite(rhs)) { if (decNumberIsInfinite(lhs)) result=0;// both infinite else result=-result; // only rhs infinite } return result; } // must compare the coefficients, allowing for exponents if (lhs->exponent>rhs->exponent) { // LHS exponent larger // swap sides, and sign const decNumber *temp=lhs; lhs=rhs; rhs=temp; result=-result; } compare=decUnitCompare(lhs->lsu, D2U(lhs->digits), rhs->lsu, D2U(rhs->digits), rhs->exponent-lhs->exponent); if (compare!=BADINT) compare*=result; // comparison succeeded return compare; } // decCompare /* ------------------------------------------------------------------ */ /* decUnitCompare -- compare two >=0 integers in Unit arrays */ /* */ /* This routine compares A ? B*10**E where A and B are unit arrays */ /* A is a plain integer */ /* B has an exponent of E (which must be non-negative) */ /* */ /* Arg1 is A first Unit (lsu) */ /* Arg2 is A length in Units */ /* Arg3 is B first Unit (lsu) */ /* Arg4 is B length in Units */ /* Arg5 is E (0 if the units are aligned) */ /* */ /* returns -1, 0, or 1 for AB, or BADINT if failure */ /* (the only possible failure is an allocation error, which can */ /* only occur if E!=0) */ /* ------------------------------------------------------------------ */ static Int decUnitCompare(const Unit *a, Int alength, const Unit *b, Int blength, Int exp) { Unit *acc; // accumulator for result Unit accbuff[SD2U(DECBUFFER*2+1)]; // local buffer Unit *allocacc=NULL; // -> allocated acc buffer, iff allocated Int accunits, need; // units in use or needed for acc const Unit *l, *r, *u; // work Int expunits, exprem, result; // .. if (exp==0) { // aligned; fastpath if (alength>blength) return 1; if (alength=a; l--, r--) { if (*l>*r) return 1; if (*l<*r) return -1; } return 0; // all units match } // aligned // Unaligned. If one is >1 unit longer than the other, padded // approximately, then can return easily if (alength>blength+(Int)D2U(exp)) return 1; if (alength+1sizeof(accbuff)) { allocacc=(Unit *)malloc(need*sizeof(Unit)); if (allocacc==NULL) return BADINT; // hopeless -- abandon acc=allocacc; } // Calculate units and remainder from exponent. expunits=exp/DECDPUN; exprem=exp%DECDPUN; // subtract [A+B*(-m)] accunits=decUnitAddSub(a, alength, b, blength, expunits, acc, -(Int)powers[exprem]); // [UnitAddSub result may have leading zeros, even on zero] if (accunits<0) result=-1; // negative result else { // non-negative result // check units of the result before freeing any storage for (u=acc; u=0 integers in Unit arrays */ /* */ /* This routine performs the calculation: */ /* */ /* C=A+(B*M) */ /* */ /* Where M is in the range -DECDPUNMAX through +DECDPUNMAX. */ /* */ /* A may be shorter or longer than B. */ /* */ /* Leading zeros are not removed after a calculation. The result is */ /* either the same length as the longer of A and B (adding any */ /* shift), or one Unit longer than that (if a Unit carry occurred). */ /* */ /* A and B content are not altered unless C is also A or B. */ /* C may be the same array as A or B, but only if no zero padding is */ /* requested (that is, C may be B only if bshift==0). */ /* C is filled from the lsu; only those units necessary to complete */ /* the calculation are referenced. */ /* */ /* Arg1 is A first Unit (lsu) */ /* Arg2 is A length in Units */ /* Arg3 is B first Unit (lsu) */ /* Arg4 is B length in Units */ /* Arg5 is B shift in Units (>=0; pads with 0 units if positive) */ /* Arg6 is C first Unit (lsu) */ /* Arg7 is M, the multiplier */ /* */ /* returns the count of Units written to C, which will be non-zero */ /* and negated if the result is negative. That is, the sign of the */ /* returned Int is the sign of the result (positive for zero) and */ /* the absolute value of the Int is the count of Units. */ /* */ /* It is the caller's responsibility to make sure that C size is */ /* safe, allowing space if necessary for a one-Unit carry. */ /* */ /* This routine is severely performance-critical; *any* change here */ /* must be measured (timed) to assure no performance degradation. */ /* In particular, trickery here tends to be counter-productive, as */ /* increased complexity of code hurts register optimizations on */ /* register-poor architectures. Avoiding divisions is nearly */ /* always a Good Idea, however. */ /* */ /* Special thanks to Rick McGuire (IBM Cambridge, MA) and Dave Clark */ /* (IBM Warwick, UK) for some of the ideas used in this routine. */ /* ------------------------------------------------------------------ */ static Int decUnitAddSub(const Unit *a, Int alength, const Unit *b, Int blength, Int bshift, Unit *c, Int m) { const Unit *alsu=a; // A lsu [need to remember it] Unit *clsu=c; // C ditto Unit *minC; // low water mark for C Unit *maxC; // high water mark for C eInt carry=0; // carry integer (could be Long) Int add; // work #if DECDPUN<=4 // myriadal, millenary, etc. Int est; // estimated quotient #endif #if DECTRACE if (alength<1 || blength<1) printf("decUnitAddSub: alen blen m %ld %ld [%ld]\n", alength, blength, m); #endif maxC=c+alength; // A is usually the longer minC=c+blength; // .. and B the shorter if (bshift!=0) { // B is shifted; low As copy across minC+=bshift; // if in place [common], skip copy unless there's a gap [rare] if (a==c && bshift<=alength) { c+=bshift; a+=bshift; } else for (; cmaxC) { // swap Unit *hold=minC; minC=maxC; maxC=hold; } // For speed, do the addition as two loops; the first where both A // and B contribute, and the second (if necessary) where only one or // other of the numbers contribute. // Carry handling is the same (i.e., duplicated) in each case. for (; c=0) { est=(((ueInt)carry>>11)*53687)>>18; *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder carry=est; // likely quotient [89%] if (*c>11)*53687)>>18; *c=(Unit)(carry-est*(DECDPUNMAX+1)); carry=est-(DECDPUNMAX+1); // correctly negative if (*c=0) { est=(((ueInt)carry>>3)*16777)>>21; *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder carry=est; // likely quotient [99%] if (*c>3)*16777)>>21; *c=(Unit)(carry-est*(DECDPUNMAX+1)); carry=est-(DECDPUNMAX+1); // correctly negative if (*c=0) { est=QUOT10(carry, DECDPUN); *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder carry=est; // quotient continue; } // negative case carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive est=QUOT10(carry, DECDPUN); *c=(Unit)(carry-est*(DECDPUNMAX+1)); carry=est-(DECDPUNMAX+1); // correctly negative #else // remainder operator is undefined if negative, so must test if ((ueInt)carry<(DECDPUNMAX+1)*2) { // fastpath carry +1 *c=(Unit)(carry-(DECDPUNMAX+1)); // [helps additions] carry=1; continue; } if (carry>=0) { *c=(Unit)(carry%(DECDPUNMAX+1)); carry=carry/(DECDPUNMAX+1); continue; } // negative case carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive *c=(Unit)(carry%(DECDPUNMAX+1)); carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1); #endif } // c // now may have one or other to complete // [pretest to avoid loop setup/shutdown] if (cDECDPUNMAX #if DECDPUN==4 // use divide-by-multiply if (carry>=0) { est=(((ueInt)carry>>11)*53687)>>18; *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder carry=est; // likely quotient [79.7%] if (*c>11)*53687)>>18; *c=(Unit)(carry-est*(DECDPUNMAX+1)); carry=est-(DECDPUNMAX+1); // correctly negative if (*c=0) { est=(((ueInt)carry>>3)*16777)>>21; *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder carry=est; // likely quotient [99%] if (*c>3)*16777)>>21; *c=(Unit)(carry-est*(DECDPUNMAX+1)); carry=est-(DECDPUNMAX+1); // correctly negative if (*c=0) { est=QUOT10(carry, DECDPUN); *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder carry=est; // quotient continue; } // negative case carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive est=QUOT10(carry, DECDPUN); *c=(Unit)(carry-est*(DECDPUNMAX+1)); carry=est-(DECDPUNMAX+1); // correctly negative #else if ((ueInt)carry<(DECDPUNMAX+1)*2){ // fastpath carry 1 *c=(Unit)(carry-(DECDPUNMAX+1)); carry=1; continue; } // remainder operator is undefined if negative, so must test if (carry>=0) { *c=(Unit)(carry%(DECDPUNMAX+1)); carry=carry/(DECDPUNMAX+1); continue; } // negative case carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive *c=(Unit)(carry%(DECDPUNMAX+1)); carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1); #endif } // c // OK, all A and B processed; might still have carry or borrow // return number of Units in the result, negated if a borrow if (carry==0) return c-clsu; // no carry, so no more to do if (carry>0) { // positive carry *c=(Unit)carry; // place as new unit c++; // .. return c-clsu; } // -ve carry: it's a borrow; complement needed add=1; // temporary carry... for (c=clsu; c current Unit #if DECCHECK if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn; #endif *dropped=0; // assume no zeros dropped if ((dn->bits & DECSPECIAL) // fast exit if special .. || (*dn->lsu & 0x01)) return dn; // .. or odd if (ISZERO(dn)) { // .. or 0 dn->exponent=0; // (sign is preserved) return dn; } // have a finite number which is even exp=dn->exponent; cut=1; // digit (1-DECDPUN) in Unit up=dn->lsu; // -> current Unit for (d=0; ddigits-1; d++) { // [don't strip the final digit] // slice by powers #if DECDPUN<=4 uInt quot=QUOT10(*up, cut); if ((*up-quot*powers[cut])!=0) break; // found non-0 digit #else if (*up%powers[cut]!=0) break; // found non-0 digit #endif // have a trailing 0 if (!all) { // trimming // [if exp>0 then all trailing 0s are significant for trim] if (exp<=0) { // if digit might be significant if (exp==0) break; // then quit exp++; // next digit might be significant } } cut++; // next power if (cut>DECDPUN) { // need new Unit up++; cut=1; } } // d if (d==0) return dn; // none to drop // may need to limit drop if clamping if (set->clamp && !noclamp) { Int maxd=set->emax-set->digits+1-dn->exponent; if (maxd<=0) return dn; // nothing possible if (d>maxd) d=maxd; } // effect the drop decShiftToLeast(dn->lsu, D2U(dn->digits), d); dn->exponent+=d; // maintain numerical value dn->digits-=d; // new length *dropped=d; // report the count return dn; } // decTrim /* ------------------------------------------------------------------ */ /* decReverse -- reverse a Unit array in place */ /* */ /* ulo is the start of the array */ /* uhi is the end of the array (highest Unit to include) */ /* */ /* The units ulo through uhi are reversed in place (if the number */ /* of units is odd, the middle one is untouched). Note that the */ /* digit(s) in each unit are unaffected. */ /* ------------------------------------------------------------------ */ static void decReverse(Unit *ulo, Unit *uhi) { Unit temp; for (; ulo=uar; source--, target--) *target=*source; } else { first=uar+D2U(digits+shift)-1; // where msu of source will end up for (; source>=uar; source--, target--) { // split the source Unit and accumulate remainder for next #if DECDPUN<=4 uInt quot=QUOT10(*source, cut); uInt rem=*source-quot*powers[cut]; next+=quot; #else uInt rem=*source%powers[cut]; next+=*source/powers[cut]; #endif if (target<=first) *target=(Unit)next; // write to target iff valid next=rem*powers[DECDPUN-cut]; // save remainder for next Unit } } // shift-move // propagate any partial unit to one below and clear the rest for (; target>=uar; target--) { *target=(Unit)next; next=0; } return digits+shift; } // decShiftToMost /* ------------------------------------------------------------------ */ /* decShiftToLeast -- shift digits in array towards least significant */ /* */ /* uar is the array */ /* units is length of the array, in units */ /* shift is the number of digits to remove from the lsu end; it */ /* must be zero or positive and <= than units*DECDPUN. */ /* */ /* returns the new length of the integer in the array, in units */ /* */ /* Removed digits are discarded (lost). Units not required to hold */ /* the final result are unchanged. */ /* ------------------------------------------------------------------ */ static Int decShiftToLeast(Unit *uar, Int units, Int shift) { Unit *target, *up; // work Int cut, count; // work Int quot, rem; // for division if (shift==0) return units; // [fastpath] nothing to do if (shift==units*DECDPUN) { // [fastpath] little to do *uar=0; // all digits cleared gives zero return 1; // leaves just the one } target=uar; // both paths cut=MSUDIGITS(shift); if (cut==DECDPUN) { // unit-boundary case; easy up=uar+D2U(shift); for (; updigits is > set->digits) */ /* set is the relevant context */ /* status is the status accumulator */ /* */ /* returns an allocated decNumber with the rounded result. */ /* */ /* lostDigits and other status may be set by this. */ /* */ /* Since the input is an operand, it must not be modified. */ /* Instead, return an allocated decNumber, rounded as required. */ /* It is the caller's responsibility to free the allocated storage. */ /* */ /* If no storage is available then the result cannot be used, so NULL */ /* is returned. */ /* ------------------------------------------------------------------ */ static decNumber *decRoundOperand(const decNumber *dn, decContext *set, uInt *status) { decNumber *res; // result structure uInt newstatus=0; // status from round Int residue=0; // rounding accumulator // Allocate storage for the returned decNumber, big enough for the // length specified by the context res=(decNumber *)malloc(sizeof(decNumber) +(D2U(set->digits)-1)*sizeof(Unit)); if (res==NULL) { *status|=DEC_Insufficient_storage; return NULL; } decCopyFit(res, dn, set, &residue, &newstatus); decApplyRound(res, set, residue, &newstatus); // If that set Inexact then "lost digits" is raised... if (newstatus & DEC_Inexact) newstatus|=DEC_Lost_digits; *status|=newstatus; return res; } // decRoundOperand #endif /* ------------------------------------------------------------------ */ /* decCopyFit -- copy a number, truncating the coefficient if needed */ /* */ /* dest is the target decNumber */ /* src is the source decNumber */ /* set is the context [used for length (digits) and rounding mode] */ /* residue is the residue accumulator */ /* status contains the current status to be updated */ /* */ /* (dest==src is allowed and will be a no-op if fits) */ /* All fields are updated as required. */ /* ------------------------------------------------------------------ */ static void decCopyFit(decNumber *dest, const decNumber *src, decContext *set, Int *residue, uInt *status) { dest->bits=src->bits; dest->exponent=src->exponent; decSetCoeff(dest, set, src->lsu, src->digits, residue, status); } // decCopyFit /* ------------------------------------------------------------------ */ /* decSetCoeff -- set the coefficient of a number */ /* */ /* dn is the number whose coefficient array is to be set. */ /* It must have space for set->digits digits */ /* set is the context [for size] */ /* lsu -> lsu of the source coefficient [may be dn->lsu] */ /* len is digits in the source coefficient [may be dn->digits] */ /* residue is the residue accumulator. This has values as in */ /* decApplyRound, and will be unchanged unless the */ /* target size is less than len. In this case, the */ /* coefficient is truncated and the residue is updated to */ /* reflect the previous residue and the dropped digits. */ /* status is the status accumulator, as usual */ /* */ /* The coefficient may already be in the number, or it can be an */ /* external intermediate array. If it is in the number, lsu must == */ /* dn->lsu and len must == dn->digits. */ /* */ /* Note that the coefficient length (len) may be < set->digits, and */ /* in this case this merely copies the coefficient (or is a no-op */ /* if dn->lsu==lsu). */ /* */ /* Note also that (only internally, from decQuantizeOp and */ /* decSetSubnormal) the value of set->digits may be less than one, */ /* indicating a round to left. This routine handles that case */ /* correctly; caller ensures space. */ /* */ /* dn->digits, dn->lsu (and as required), and dn->exponent are */ /* updated as necessary. dn->bits (sign) is unchanged. */ /* */ /* DEC_Rounded status is set if any digits are discarded. */ /* DEC_Inexact status is set if any non-zero digits are discarded, or */ /* incoming residue was non-0 (implies rounded) */ /* ------------------------------------------------------------------ */ // mapping array: maps 0-9 to canonical residues, so that a residue // can be adjusted in the range [-1, +1] and achieve correct rounding // 0 1 2 3 4 5 6 7 8 9 static const uByte resmap[10]={0, 3, 3, 3, 3, 5, 7, 7, 7, 7}; static void decSetCoeff(decNumber *dn, decContext *set, const Unit *lsu, Int len, Int *residue, uInt *status) { Int discard; // number of digits to discard uInt cut; // cut point in Unit const Unit *up; // work Unit *target; // .. Int count; // .. #if DECDPUN<=4 uInt temp; // .. #endif discard=len-set->digits; // digits to discard if (discard<=0) { // no digits are being discarded if (dn->lsu!=lsu) { // copy needed // copy the coefficient array to the result number; no shift needed count=len; // avoids D2U up=lsu; for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN) *target=*up; dn->digits=len; // set the new length } // dn->exponent and residue are unchanged, record any inexactitude if (*residue!=0) *status|=(DEC_Inexact | DEC_Rounded); return; } // some digits must be discarded ... dn->exponent+=discard; // maintain numerical value *status|=DEC_Rounded; // accumulate Rounded status if (*residue>1) *residue=1; // previous residue now to right, so reduce if (discard>len) { // everything, +1, is being discarded // guard digit is 0 // residue is all the number [NB could be all 0s] if (*residue<=0) { // not already positive count=len; // avoids D2U for (up=lsu; count>0; up++, count-=DECDPUN) if (*up!=0) { // found non-0 *residue=1; break; // no need to check any others } } if (*residue!=0) *status|=DEC_Inexact; // record inexactitude *dn->lsu=0; // coefficient will now be 0 dn->digits=1; // .. return; } // total discard // partial discard [most common case] // here, at least the first (most significant) discarded digit exists // spin up the number, noting residue during the spin, until get to // the Unit with the first discarded digit. When reach it, extract // it and remember its position count=0; for (up=lsu;; up++) { count+=DECDPUN; if (count>=discard) break; // full ones all checked if (*up!=0) *residue=1; } // up // here up -> Unit with first discarded digit cut=discard-(count-DECDPUN)-1; if (cut==DECDPUN-1) { // unit-boundary case (fast) Unit half=(Unit)powers[DECDPUN]>>1; // set residue directly if (*up>=half) { if (*up>half) *residue=7; else *residue+=5; // add sticky bit } else { // digits<=0) { // special for Quantize/Subnormal :-( *dn->lsu=0; // .. result is 0 dn->digits=1; // .. } else { // shift to least count=set->digits; // now digits to end up with dn->digits=count; // set the new length up++; // move to next // on unit boundary, so shift-down copy loop is simple for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN) *target=*up; } } // unit-boundary case else { // discard digit is in low digit(s), and not top digit uInt discard1; // first discarded digit uInt quot, rem; // for divisions if (cut==0) quot=*up; // is at bottom of unit else /* cut>0 */ { // it's not at bottom of unit #if DECDPUN<=4 quot=QUOT10(*up, cut); rem=*up-quot*powers[cut]; #else rem=*up%powers[cut]; quot=*up/powers[cut]; #endif if (rem!=0) *residue=1; } // discard digit is now at bottom of quot #if DECDPUN<=4 temp=(quot*6554)>>16; // fast /10 // Vowels algorithm here not a win (9 instructions) discard1=quot-X10(temp); quot=temp; #else discard1=quot%10; quot=quot/10; #endif // here, discard1 is the guard digit, and residue is everything // else [use mapping array to accumulate residue safely] *residue+=resmap[discard1]; cut++; // update cut // here: up -> Unit of the array with bottom digit // cut is the division point for each Unit // quot holds the uncut high-order digits for the current unit if (set->digits<=0) { // special for Quantize/Subnormal :-( *dn->lsu=0; // .. result is 0 dn->digits=1; // .. } else { // shift to least needed count=set->digits; // now digits to end up with dn->digits=count; // set the new length // shift-copy the coefficient array to the result number for (target=dn->lsu; ; target++) { *target=(Unit)quot; count-=(DECDPUN-cut); if (count<=0) break; up++; quot=*up; #if DECDPUN<=4 quot=QUOT10(quot, cut); rem=*up-quot*powers[cut]; #else rem=quot%powers[cut]; quot=quot/powers[cut]; #endif *target=(Unit)(*target+rem*powers[DECDPUN-cut]); count-=cut; if (count<=0) break; } // shift-copy loop } // shift to least } // not unit boundary if (*residue!=0) *status|=DEC_Inexact; // record inexactitude return; } // decSetCoeff /* ------------------------------------------------------------------ */ /* decApplyRound -- apply pending rounding to a number */ /* */ /* dn is the number, with space for set->digits digits */ /* set is the context [for size and rounding mode] */ /* residue indicates pending rounding, being any accumulated */ /* guard and sticky information. It may be: */ /* 6-9: rounding digit is >5 */ /* 5: rounding digit is exactly half-way */ /* 1-4: rounding digit is <5 and >0 */ /* 0: the coefficient is exact */ /* -1: as 1, but the hidden digits are subtractive, that */ /* is, of the opposite sign to dn. In this case the */ /* coefficient must be non-0. This case occurs when */ /* subtracting a small number (which can be reduced to */ /* a sticky bit); see decAddOp. */ /* status is the status accumulator, as usual */ /* */ /* This routine applies rounding while keeping the length of the */ /* coefficient constant. The exponent and status are unchanged */ /* except if: */ /* */ /* -- the coefficient was increased and is all nines (in which */ /* case Overflow could occur, and is handled directly here so */ /* the caller does not need to re-test for overflow) */ /* */ /* -- the coefficient was decreased and becomes all nines (in which */ /* case Underflow could occur, and is also handled directly). */ /* */ /* All fields in dn are updated as required. */ /* */ /* ------------------------------------------------------------------ */ static void decApplyRound(decNumber *dn, decContext *set, Int residue, uInt *status) { Int bump; // 1 if coefficient needs to be incremented // -1 if coefficient needs to be decremented if (residue==0) return; // nothing to apply bump=0; // assume a smooth ride // now decide whether, and how, to round, depending on mode switch (set->round) { case DEC_ROUND_05UP: { // round zero or five up (for reround) // This is the same as DEC_ROUND_DOWN unless there is a // positive residue and the lsd of dn is 0 or 5, in which case // it is bumped; when residue is <0, the number is therefore // bumped down unless the final digit was 1 or 6 (in which // case it is bumped down and then up -- a no-op) Int lsd5=*dn->lsu%5; // get lsd and quintate if (residue<0 && lsd5!=1) bump=-1; else if (residue>0 && lsd5==0) bump=1; // [bump==1 could be applied directly; use common path for clarity] break;} // r-05 case DEC_ROUND_DOWN: { // no change, except if negative residue if (residue<0) bump=-1; break;} // r-d case DEC_ROUND_HALF_DOWN: { if (residue>5) bump=1; break;} // r-h-d case DEC_ROUND_HALF_EVEN: { if (residue>5) bump=1; // >0.5 goes up else if (residue==5) { // exactly 0.5000... // 0.5 goes up iff [new] lsd is odd if (*dn->lsu & 0x01) bump=1; } break;} // r-h-e case DEC_ROUND_HALF_UP: { if (residue>=5) bump=1; break;} // r-h-u case DEC_ROUND_UP: { if (residue>0) bump=1; break;} // r-u case DEC_ROUND_CEILING: { // same as _UP for positive numbers, and as _DOWN for negatives // [negative residue cannot occur on 0] if (decNumberIsNegative(dn)) { if (residue<0) bump=-1; } else { if (residue>0) bump=1; } break;} // r-c case DEC_ROUND_FLOOR: { // same as _UP for negative numbers, and as _DOWN for positive // [negative residue cannot occur on 0] if (!decNumberIsNegative(dn)) { if (residue<0) bump=-1; } else { if (residue>0) bump=1; } break;} // r-f default: { // e.g., DEC_ROUND_MAX *status|=DEC_Invalid_context; #if DECTRACE || (DECCHECK && DECVERB) printf("Unknown rounding mode: %d\n", set->round); #endif break;} } // switch // now bump the number, up or down, if need be if (bump==0) return; // no action required // Simply use decUnitAddSub unless bumping up and the number is // all nines. In this special case set to 100... explicitly // and adjust the exponent by one (as otherwise could overflow // the array) // Similarly handle all-nines result if bumping down. if (bump>0) { Unit *up; // work uInt count=dn->digits; // digits to be checked for (up=dn->lsu; ; up++) { if (count<=DECDPUN) { // this is the last Unit (the msu) if (*up!=powers[count]-1) break; // not still 9s // here if it, too, is all nines *up=(Unit)powers[count-1]; // here 999 -> 100 etc. for (up=up-1; up>=dn->lsu; up--) *up=0; // others all to 0 dn->exponent++; // and bump exponent // [which, very rarely, could cause Overflow...] if ((dn->exponent+dn->digits)>set->emax+1) { decSetOverflow(dn, set, status); } return; // done } // a full unit to check, with more to come if (*up!=DECDPUNMAX) break; // not still 9s count-=DECDPUN; } // up } // bump>0 else { // -1 // here checking for a pre-bump of 1000... (leading 1, all // other digits zero) Unit *up, *sup; // work uInt count=dn->digits; // digits to be checked for (up=dn->lsu; ; up++) { if (count<=DECDPUN) { // this is the last Unit (the msu) if (*up!=powers[count-1]) break; // not 100.. // here if have the 1000... case sup=up; // save msu pointer *up=(Unit)powers[count]-1; // here 100 in msu -> 999 // others all to all-nines, too for (up=up-1; up>=dn->lsu; up--) *up=(Unit)powers[DECDPUN]-1; dn->exponent--; // and bump exponent // iff the number was at the subnormal boundary (exponent=etiny) // then the exponent is now out of range, so it will in fact get // clamped to etiny and the final 9 dropped. // printf(">> emin=%d exp=%d sdig=%d\n", set->emin, // dn->exponent, set->digits); if (dn->exponent+1==set->emin-set->digits+1) { if (count==1 && dn->digits==1) *sup=0; // here 9 -> 0[.9] else { *sup=(Unit)powers[count-1]-1; // here 999.. in msu -> 99.. dn->digits--; } dn->exponent++; *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded; } return; // done } // a full unit to check, with more to come if (*up!=0) break; // not still 0s count-=DECDPUN; } // up } // bump<0 // Actual bump needed. Do it. decUnitAddSub(dn->lsu, D2U(dn->digits), uarrone, 1, 0, dn->lsu, bump); } // decApplyRound #if DECSUBSET /* ------------------------------------------------------------------ */ /* decFinish -- finish processing a number */ /* */ /* dn is the number */ /* set is the context */ /* residue is the rounding accumulator (as in decApplyRound) */ /* status is the accumulator */ /* */ /* This finishes off the current number by: */ /* 1. If not extended: */ /* a. Converting a zero result to clean '0' */ /* b. Reducing positive exponents to 0, if would fit in digits */ /* 2. Checking for overflow and subnormals (always) */ /* Note this is just Finalize when no subset arithmetic. */ /* All fields are updated as required. */ /* ------------------------------------------------------------------ */ static void decFinish(decNumber *dn, decContext *set, Int *residue, uInt *status) { if (!set->extended) { if ISZERO(dn) { // value is zero dn->exponent=0; // clean exponent .. dn->bits=0; // .. and sign return; // no error possible } if (dn->exponent>=0) { // non-negative exponent // >0; reduce to integer if possible if (set->digits >= (dn->exponent+dn->digits)) { dn->digits=decShiftToMost(dn->lsu, dn->digits, dn->exponent); dn->exponent=0; } } } // !extended decFinalize(dn, set, residue, status); } // decFinish #endif /* ------------------------------------------------------------------ */ /* decFinalize -- final check, clamp, and round of a number */ /* */ /* dn is the number */ /* set is the context */ /* residue is the rounding accumulator (as in decApplyRound) */ /* status is the status accumulator */ /* */ /* This finishes off the current number by checking for subnormal */ /* results, applying any pending rounding, checking for overflow, */ /* and applying any clamping. */ /* Underflow and overflow conditions are raised as appropriate. */ /* All fields are updated as required. */ /* ------------------------------------------------------------------ */ static void decFinalize(decNumber *dn, decContext *set, Int *residue, uInt *status) { Int shift; // shift needed if clamping Int tinyexp=set->emin-dn->digits+1; // precalculate subnormal boundary // Must be careful, here, when checking the exponent as the // adjusted exponent could overflow 31 bits [because it may already // be up to twice the expected]. // First test for subnormal. This must be done before any final // round as the result could be rounded to Nmin or 0. if (dn->exponent<=tinyexp) { // prefilter Int comp; decNumber nmin; // A very nasty case here is dn == Nmin and residue<0 if (dn->exponentemin; comp=decCompare(dn, &nmin, 1); // (signless compare) if (comp==BADINT) { // oops *status|=DEC_Insufficient_storage; // abandon... return; } if (*residue<0 && comp==0) { // neg residue and dn==Nmin decApplyRound(dn, set, *residue, status); // might force down decSetSubnormal(dn, set, residue, status); return; } } // now apply any pending round (this could raise overflow). if (*residue!=0) decApplyRound(dn, set, *residue, status); // Check for overflow [redundant in the 'rare' case] or clamp if (dn->exponent<=set->emax-set->digits+1) return; // neither needed // here when might have an overflow or clamp to do if (dn->exponent>set->emax-dn->digits+1) { // too big decSetOverflow(dn, set, status); return; } // here when the result is normal but in clamp range if (!set->clamp) return; // here when need to apply the IEEE exponent clamp (fold-down) shift=dn->exponent-(set->emax-set->digits+1); // shift coefficient (if non-zero) if (!ISZERO(dn)) { dn->digits=decShiftToMost(dn->lsu, dn->digits, shift); } dn->exponent-=shift; // adjust the exponent to match *status|=DEC_Clamped; // and record the dirty deed return; } // decFinalize /* ------------------------------------------------------------------ */ /* decSetOverflow -- set number to proper overflow value */ /* */ /* dn is the number (used for sign [only] and result) */ /* set is the context [used for the rounding mode, etc.] */ /* status contains the current status to be updated */ /* */ /* This sets the sign of a number and sets its value to either */ /* Infinity or the maximum finite value, depending on the sign of */ /* dn and the rounding mode, following IEEE 754 rules. */ /* ------------------------------------------------------------------ */ static void decSetOverflow(decNumber *dn, decContext *set, uInt *status) { Flag needmax=0; // result is maximum finite value uByte sign=dn->bits&DECNEG; // clean and save sign bit if (ISZERO(dn)) { // zero does not overflow magnitude Int emax=set->emax; // limit value if (set->clamp) emax-=set->digits-1; // lower if clamping if (dn->exponent>emax) { // clamp required dn->exponent=emax; *status|=DEC_Clamped; } return; } decNumberZero(dn); switch (set->round) { case DEC_ROUND_DOWN: { needmax=1; // never Infinity break;} // r-d case DEC_ROUND_05UP: { needmax=1; // never Infinity break;} // r-05 case DEC_ROUND_CEILING: { if (sign) needmax=1; // Infinity if non-negative break;} // r-c case DEC_ROUND_FLOOR: { if (!sign) needmax=1; // Infinity if negative break;} // r-f default: break; // Infinity in all other cases } if (needmax) { decSetMaxValue(dn, set); dn->bits=sign; // set sign } else dn->bits=sign|DECINF; // Value is +/-Infinity *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded; } // decSetOverflow /* ------------------------------------------------------------------ */ /* decSetMaxValue -- set number to +Nmax (maximum normal value) */ /* */ /* dn is the number to set */ /* set is the context [used for digits and emax] */ /* */ /* This sets the number to the maximum positive value. */ /* ------------------------------------------------------------------ */ static void decSetMaxValue(decNumber *dn, decContext *set) { Unit *up; // work Int count=set->digits; // nines to add dn->digits=count; // fill in all nines to set maximum value for (up=dn->lsu; ; up++) { if (count>DECDPUN) *up=DECDPUNMAX; // unit full o'nines else { // this is the msu *up=(Unit)(powers[count]-1); break; } count-=DECDPUN; // filled those digits } // up dn->bits=0; // + sign dn->exponent=set->emax-set->digits+1; } // decSetMaxValue /* ------------------------------------------------------------------ */ /* decSetSubnormal -- process value whose exponent is extended) { decNumberZero(dn); // always full overflow *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded; return; } #endif // Full arithmetic -- allow subnormals, rounded to minimum exponent // (Etiny) if needed etiny=set->emin-(set->digits-1); // smallest allowed exponent if ISZERO(dn) { // value is zero // residue can never be non-zero here #if DECCHECK if (*residue!=0) { printf("++ Subnormal 0 residue %ld\n", (LI)*residue); *status|=DEC_Invalid_operation; } #endif if (dn->exponentexponent=etiny; *status|=DEC_Clamped; } return; } *status|=DEC_Subnormal; // have a non-zero subnormal adjust=etiny-dn->exponent; // calculate digits to remove if (adjust<=0) { // not out of range; unrounded // residue can never be non-zero here, except in the Nmin-residue // case (which is a subnormal result), so can take fast-path here // it may already be inexact (from setting the coefficient) if (*status&DEC_Inexact) *status|=DEC_Underflow; return; } // adjust>0, so need to rescale the result so exponent becomes Etiny // [this code is similar to that in rescale] workset=*set; // clone rounding, etc. workset.digits=dn->digits-adjust; // set requested length workset.emin-=adjust; // and adjust emin to match // [note that the latter can be <1, here, similar to Rescale case] decSetCoeff(dn, &workset, dn->lsu, dn->digits, residue, status); decApplyRound(dn, &workset, *residue, status); // Use 754 default rule: Underflow is set iff Inexact // [independent of whether trapped] if (*status&DEC_Inexact) *status|=DEC_Underflow; // if rounded up a 999s case, exponent will be off by one; adjust // back if so [it will fit, because it was shortened earlier] if (dn->exponent>etiny) { dn->digits=decShiftToMost(dn->lsu, dn->digits, 1); dn->exponent--; // (re)adjust the exponent. } // if rounded to zero, it is by definition clamped... if (ISZERO(dn)) *status|=DEC_Clamped; } // decSetSubnormal /* ------------------------------------------------------------------ */ /* decCheckMath - check entry conditions for a math function */ /* */ /* This checks the context and the operand */ /* */ /* rhs is the operand to check */ /* set is the context to check */ /* status is unchanged if both are good */ /* */ /* returns non-zero if status is changed, 0 otherwise */ /* */ /* Restrictions enforced: */ /* */ /* digits, emax, and -emin in the context must be less than */ /* DEC_MAX_MATH (999999), and A must be within these bounds if */ /* non-zero. Invalid_operation is set in the status if a */ /* restriction is violated. */ /* ------------------------------------------------------------------ */ static uInt decCheckMath(const decNumber *rhs, decContext *set, uInt *status) { uInt save=*status; // record if (set->digits>DEC_MAX_MATH || set->emax>DEC_MAX_MATH || -set->emin>DEC_MAX_MATH) *status|=DEC_Invalid_context; else if ((rhs->digits>DEC_MAX_MATH || rhs->exponent+rhs->digits>DEC_MAX_MATH+1 || rhs->exponent+rhs->digits<2*(1-DEC_MAX_MATH)) && !ISZERO(rhs)) *status|=DEC_Invalid_operation; return (*status!=save); } // decCheckMath /* ------------------------------------------------------------------ */ /* decGetInt -- get integer from a number */ /* */ /* dn is the number [which will not be altered] */ /* */ /* returns one of: */ /* BADINT if there is a non-zero fraction */ /* the converted integer */ /* BIGEVEN if the integer is even and magnitude > 2*10**9 */ /* BIGODD if the integer is odd and magnitude > 2*10**9 */ /* */ /* This checks and gets a whole number from the input decNumber. */ /* The sign can be determined from dn by the caller when BIGEVEN or */ /* BIGODD is returned. */ /* ------------------------------------------------------------------ */ static Int decGetInt(const decNumber *dn) { Int theInt; // result accumulator const Unit *up; // work Int got; // digits (real or not) processed Int ilength=dn->digits+dn->exponent; // integral length Flag neg=decNumberIsNegative(dn); // 1 if -ve // The number must be an integer that fits in 10 digits // Assert, here, that 10 is enough for any rescale Etiny #if DEC_MAX_EMAX > 999999999 #error GetInt may need updating [for Emax] #endif #if DEC_MIN_EMIN < -999999999 #error GetInt may need updating [for Emin] #endif if (ISZERO(dn)) return 0; // zeros are OK, with any exponent up=dn->lsu; // ready for lsu theInt=0; // ready to accumulate if (dn->exponent>=0) { // relatively easy // no fractional part [usual]; allow for positive exponent got=dn->exponent; } else { // -ve exponent; some fractional part to check and discard Int count=-dn->exponent; // digits to discard // spin up whole units until reach the Unit with the unit digit for (; count>=DECDPUN; up++) { if (*up!=0) return BADINT; // non-zero Unit to discard count-=DECDPUN; } if (count==0) got=0; // [a multiple of DECDPUN] else { // [not multiple of DECDPUN] Int rem; // work // slice off fraction digits and check for non-zero #if DECDPUN<=4 theInt=QUOT10(*up, count); rem=*up-theInt*powers[count]; #else rem=*up%powers[count]; // slice off discards theInt=*up/powers[count]; #endif if (rem!=0) return BADINT; // non-zero fraction // it looks good got=DECDPUN-count; // number of digits so far up++; // ready for next } } // now it's known there's no fractional part // tricky code now, to accumulate up to 9.3 digits if (got==0) {theInt=*up; got+=DECDPUN; up++;} // ensure lsu is there if (ilength<11) { Int save=theInt; // collect any remaining unit(s) for (; got1999999997) ilength=11; else if (!neg && theInt>999999999) ilength=11; if (ilength==11) theInt=save; // restore correct low bit } } if (ilength>10) { // too big if (theInt&1) return BIGODD; // bottom bit 1 return BIGEVEN; // bottom bit 0 } if (neg) theInt=-theInt; // apply sign return theInt; } // decGetInt /* ------------------------------------------------------------------ */ /* decDecap -- decapitate the coefficient of a number */ /* */ /* dn is the number to be decapitated */ /* drop is the number of digits to be removed from the left of dn; */ /* this must be <= dn->digits (if equal, the coefficient is */ /* set to 0) */ /* */ /* Returns dn; dn->digits will be <= the initial digits less drop */ /* (after removing drop digits there may be leading zero digits */ /* which will also be removed). Only dn->lsu and dn->digits change. */ /* ------------------------------------------------------------------ */ static decNumber *decDecap(decNumber *dn, Int drop) { Unit *msu; // -> target cut point Int cut; // work if (drop>=dn->digits) { // losing the whole thing #if DECCHECK if (drop>dn->digits) printf("decDecap called with drop>digits [%ld>%ld]\n", (LI)drop, (LI)dn->digits); #endif dn->lsu[0]=0; dn->digits=1; return dn; } msu=dn->lsu+D2U(dn->digits-drop)-1; // -> likely msu cut=MSUDIGITS(dn->digits-drop); // digits to be in use in msu if (cut!=DECDPUN) *msu%=powers[cut]; // clear left digits // that may have left leading zero digits, so do a proper count... dn->digits=decGetDigits(dn->lsu, msu-dn->lsu+1); return dn; } // decDecap /* ------------------------------------------------------------------ */ /* decBiStr -- compare string with pairwise options */ /* */ /* targ is the string to compare */ /* str1 is one of the strings to compare against (length may be 0) */ /* str2 is the other; it must be the same length as str1 */ /* */ /* returns 1 if strings compare equal, (that is, it is the same */ /* length as str1 and str2, and each character of targ is in either */ /* str1 or str2 in the corresponding position), or 0 otherwise */ /* */ /* This is used for generic caseless compare, including the awkward */ /* case of the Turkish dotted and dotless Is. Use as (for example): */ /* if (decBiStr(test, "mike", "MIKE")) ... */ /* ------------------------------------------------------------------ */ static Flag decBiStr(const char *targ, const char *str1, const char *str2) { for (;;targ++, str1++, str2++) { if (*targ!=*str1 && *targ!=*str2) return 0; // *targ has a match in one (or both, if terminator) if (*targ=='\0') break; } // forever return 1; } // decBiStr /* ------------------------------------------------------------------ */ /* decNaNs -- handle NaN operand or operands */ /* */ /* res is the result number */ /* lhs is the first operand */ /* rhs is the second operand, or NULL if none */ /* context is used to limit payload length */ /* status contains the current status */ /* returns res in case convenient */ /* */ /* Called when one or both operands is a NaN, and propagates the */ /* appropriate result to res. When an sNaN is found, it is changed */ /* to a qNaN and Invalid operation is set. */ /* ------------------------------------------------------------------ */ static decNumber * decNaNs(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set, uInt *status) { // This decision tree ends up with LHS being the source pointer, // and status updated if need be if (lhs->bits & DECSNAN) *status|=DEC_Invalid_operation | DEC_sNaN; else if (rhs==NULL); else if (rhs->bits & DECSNAN) { lhs=rhs; *status|=DEC_Invalid_operation | DEC_sNaN; } else if (lhs->bits & DECNAN); else lhs=rhs; // propagate the payload if (lhs->digits<=set->digits) decNumberCopy(res, lhs); // easy else { // too long const Unit *ul; Unit *ur, *uresp1; // copy safe number of units, then decapitate res->bits=lhs->bits; // need sign etc. uresp1=res->lsu+D2U(set->digits); for (ur=res->lsu, ul=lhs->lsu; urdigits=D2U(set->digits)*DECDPUN; // maybe still too long if (res->digits>set->digits) decDecap(res, res->digits-set->digits); } res->bits&=~DECSNAN; // convert any sNaN to NaN, while res->bits|=DECNAN; // .. preserving sign res->exponent=0; // clean exponent // [coefficient was copied/decapitated] return res; } // decNaNs /* ------------------------------------------------------------------ */ /* decStatus -- apply non-zero status */ /* */ /* dn is the number to set if error */ /* status contains the current status (not yet in context) */ /* set is the context */ /* */ /* If the status is an error status, the number is set to a NaN, */ /* unless the error was an overflow, divide-by-zero, or underflow, */ /* in which case the number will have already been set. */ /* */ /* The context status is then updated with the new status. Note that */ /* this may raise a signal, so control may never return from this */ /* routine (hence resources must be recovered before it is called). */ /* ------------------------------------------------------------------ */ static void decStatus(decNumber *dn, uInt status, decContext *set) { if (status & DEC_NaNs) { // error status -> NaN // if cause was an sNaN, clear and propagate [NaN is already set up] if (status & DEC_sNaN) status&=~DEC_sNaN; else { decNumberZero(dn); // other error: clean throughout dn->bits=DECNAN; // and make a quiet NaN } } decContextSetStatus(set, status); // [may not return] return; } // decStatus /* ------------------------------------------------------------------ */ /* decGetDigits -- count digits in a Units array */ /* */ /* uar is the Unit array holding the number (this is often an */ /* accumulator of some sort) */ /* len is the length of the array in units [>=1] */ /* */ /* returns the number of (significant) digits in the array */ /* */ /* All leading zeros are excluded, except the last if the array has */ /* only zero Units. */ /* ------------------------------------------------------------------ */ // This may be called twice during some operations. static Int decGetDigits(Unit *uar, Int len) { Unit *up=uar+(len-1); // -> msu Int digits=(len-1)*DECDPUN+1; // possible digits excluding msu #if DECDPUN>4 uInt const *pow; // work #endif // (at least 1 in final msu) #if DECCHECK if (len<1) printf("decGetDigits called with len<1 [%ld]\n", (LI)len); #endif for (; up>=uar; up--) { if (*up==0) { // unit is all 0s if (digits==1) break; // a zero has one digit digits-=DECDPUN; // adjust for 0 unit continue;} // found the first (most significant) non-zero Unit #if DECDPUN>1 // not done yet if (*up<10) break; // is 1-9 digits++; #if DECDPUN>2 // not done yet if (*up<100) break; // is 10-99 digits++; #if DECDPUN>3 // not done yet if (*up<1000) break; // is 100-999 digits++; #if DECDPUN>4 // count the rest ... for (pow=&powers[4]; *up>=*pow; pow++) digits++; #endif #endif #endif #endif break; } // up return digits; } // decGetDigits #if DECTRACE | DECCHECK /* ------------------------------------------------------------------ */ /* decNumberShow -- display a number [debug aid] */ /* dn is the number to show */ /* */ /* Shows: sign, exponent, coefficient (msu first), digits */ /* or: sign, special-value */ /* ------------------------------------------------------------------ */ // this is public so other modules can use it void decNumberShow(const decNumber *dn) { const Unit *up; // work uInt u, d; // .. Int cut; // .. char isign='+'; // main sign if (dn==NULL) { printf("NULL\n"); return;} if (decNumberIsNegative(dn)) isign='-'; printf(" >> %c ", isign); if (dn->bits&DECSPECIAL) { // Is a special value if (decNumberIsInfinite(dn)) printf("Infinity"); else { // a NaN if (dn->bits&DECSNAN) printf("sNaN"); // signalling NaN else printf("NaN"); } // if coefficient and exponent are 0, no more to do if (dn->exponent==0 && dn->digits==1 && *dn->lsu==0) { printf("\n"); return;} // drop through to report other information printf(" "); } // now carefully display the coefficient up=dn->lsu+D2U(dn->digits)-1; // msu printf("%ld", (LI)*up); for (up=up-1; up>=dn->lsu; up--) { u=*up; printf(":"); for (cut=DECDPUN-1; cut>=0; cut--) { d=u/powers[cut]; u-=d*powers[cut]; printf("%ld", (LI)d); } // cut } // up if (dn->exponent!=0) { char esign='+'; if (dn->exponent<0) esign='-'; printf(" E%c%ld", esign, (LI)abs(dn->exponent)); } printf(" [%ld]\n", (LI)dn->digits); } // decNumberShow #endif #if DECTRACE || DECCHECK /* ------------------------------------------------------------------ */ /* decDumpAr -- display a unit array [debug/check aid] */ /* name is a single-character tag name */ /* ar is the array to display */ /* len is the length of the array in Units */ /* ------------------------------------------------------------------ */ static void decDumpAr(char name, const Unit *ar, Int len) { Int i; const char *spec; #if DECDPUN==9 spec="%09d "; #elif DECDPUN==8 spec="%08d "; #elif DECDPUN==7 spec="%07d "; #elif DECDPUN==6 spec="%06d "; #elif DECDPUN==5 spec="%05d "; #elif DECDPUN==4 spec="%04d "; #elif DECDPUN==3 spec="%03d "; #elif DECDPUN==2 spec="%02d "; #else spec="%d "; #endif printf(" :%c: ", name); for (i=len-1; i>=0; i--) { if (i==len-1) printf("%ld ", (LI)ar[i]); else printf(spec, ar[i]); } printf("\n"); return;} #endif #if DECCHECK /* ------------------------------------------------------------------ */ /* decCheckOperands -- check operand(s) to a routine */ /* res is the result structure (not checked; it will be set to */ /* quiet NaN if error found (and it is not NULL)) */ /* lhs is the first operand (may be DECUNRESU) */ /* rhs is the second (may be DECUNUSED) */ /* set is the context (may be DECUNCONT) */ /* returns 0 if both operands, and the context are clean, or 1 */ /* otherwise (in which case the context will show an error, */ /* unless NULL). Note that res is not cleaned; caller should */ /* handle this so res=NULL case is safe. */ /* The caller is expected to abandon immediately if 1 is returned. */ /* ------------------------------------------------------------------ */ static Flag decCheckOperands(decNumber *res, const decNumber *lhs, const decNumber *rhs, decContext *set) { Flag bad=0; if (set==NULL) { // oops; hopeless #if DECTRACE || DECVERB printf("Reference to context is NULL.\n"); #endif bad=1; return 1;} else if (set!=DECUNCONT && (set->digits<1 || set->round>=DEC_ROUND_MAX)) { bad=1; #if DECTRACE || DECVERB printf("Bad context [digits=%ld round=%ld].\n", (LI)set->digits, (LI)set->round); #endif } else { if (res==NULL) { bad=1; #if DECTRACE // this one not DECVERB as standard tests include NULL printf("Reference to result is NULL.\n"); #endif } if (!bad && lhs!=DECUNUSED) bad=(decCheckNumber(lhs)); if (!bad && rhs!=DECUNUSED) bad=(decCheckNumber(rhs)); } if (bad) { if (set!=DECUNCONT) decContextSetStatus(set, DEC_Invalid_operation); if (res!=DECUNRESU && res!=NULL) { decNumberZero(res); res->bits=DECNAN; // qNaN } } return bad; } // decCheckOperands /* ------------------------------------------------------------------ */ /* decCheckNumber -- check a number */ /* dn is the number to check */ /* returns 0 if the number is clean, or 1 otherwise */ /* */ /* The number is considered valid if it could be a result from some */ /* operation in some valid context. */ /* ------------------------------------------------------------------ */ static Flag decCheckNumber(const decNumber *dn) { const Unit *up; // work uInt maxuint; // .. Int ae, d, digits; // .. Int emin, emax; // .. if (dn==NULL) { // hopeless #if DECTRACE // this one not DECVERB as standard tests include NULL printf("Reference to decNumber is NULL.\n"); #endif return 1;} // check special values if (dn->bits & DECSPECIAL) { if (dn->exponent!=0) { #if DECTRACE || DECVERB printf("Exponent %ld (not 0) for a special value [%02x].\n", (LI)dn->exponent, dn->bits); #endif return 1;} // 2003.09.08: NaNs may now have coefficients, so next tests Inf only if (decNumberIsInfinite(dn)) { if (dn->digits!=1) { #if DECTRACE || DECVERB printf("Digits %ld (not 1) for an infinity.\n", (LI)dn->digits); #endif return 1;} if (*dn->lsu!=0) { #if DECTRACE || DECVERB printf("LSU %ld (not 0) for an infinity.\n", (LI)*dn->lsu); #endif decDumpAr('I', dn->lsu, D2U(dn->digits)); return 1;} } // Inf // 2002.12.26: negative NaNs can now appear through proposed IEEE // concrete formats (decimal64, etc.). return 0; } // check the coefficient if (dn->digits<1 || dn->digits>DECNUMMAXP) { #if DECTRACE || DECVERB printf("Digits %ld in number.\n", (LI)dn->digits); #endif return 1;} d=dn->digits; for (up=dn->lsu; d>0; up++) { if (d>DECDPUN) maxuint=DECDPUNMAX; else { // reached the msu maxuint=powers[d]-1; if (dn->digits>1 && *upmaxuint) { #if DECTRACE || DECVERB printf("Bad Unit [%08lx] in %ld-digit number at offset %ld [maxuint %ld].\n", (LI)*up, (LI)dn->digits, (LI)(up-dn->lsu), (LI)maxuint); #endif return 1;} d-=DECDPUN; } // check the exponent. Note that input operands can have exponents // which are out of the set->emin/set->emax and set->digits range // (just as they can have more digits than set->digits). ae=dn->exponent+dn->digits-1; // adjusted exponent emax=DECNUMMAXE; emin=DECNUMMINE; digits=DECNUMMAXP; if (ae+emax) { #if DECTRACE || DECVERB printf("Adjusted exponent overflow [%ld].\n", (LI)ae); decNumberShow(dn); #endif return 1;} return 0; // it's OK } // decCheckNumber /* ------------------------------------------------------------------ */ /* decCheckInexact -- check a normal finite inexact result has digits */ /* dn is the number to check */ /* set is the context (for status and precision) */ /* sets Invalid operation, etc., if some digits are missing */ /* [this check is not made for DECSUBSET compilation or when */ /* subnormal is not set] */ /* ------------------------------------------------------------------ */ static void decCheckInexact(const decNumber *dn, decContext *set) { #if !DECSUBSET && DECEXTFLAG if ((set->status & (DEC_Inexact|DEC_Subnormal))==DEC_Inexact && (set->digits!=dn->digits) && !(dn->bits & DECSPECIAL)) { #if DECTRACE || DECVERB printf("Insufficient digits [%ld] on normal Inexact result.\n", (LI)dn->digits); decNumberShow(dn); #endif decContextSetStatus(set, DEC_Invalid_operation); } #else // next is a noop for quiet compiler if (dn!=NULL && dn->digits==0) set->status|=DEC_Invalid_operation; #endif return; } // decCheckInexact #endif #if DECALLOC #undef malloc #undef free /* ------------------------------------------------------------------ */ /* decMalloc -- accountable allocation routine */ /* n is the number of bytes to allocate */ /* */ /* Semantics is the same as the stdlib malloc routine, but bytes */ /* allocated are accounted for globally, and corruption fences are */ /* added before and after the 'actual' storage. */ /* ------------------------------------------------------------------ */ /* This routine allocates storage with an extra twelve bytes; 8 are */ /* at the start and hold: */ /* 0-3 the original length requested */ /* 4-7 buffer corruption detection fence (DECFENCE, x4) */ /* The 4 bytes at the end also hold a corruption fence (DECFENCE, x4) */ /* ------------------------------------------------------------------ */ static void *decMalloc(size_t n) { uInt size=n+12; // true size void *alloc; // -> allocated storage uByte *b, *b0; // work uInt uiwork; // for macros alloc=malloc(size); // -> allocated storage if (alloc==NULL) return NULL; // out of strorage b0=(uByte *)alloc; // as bytes decAllocBytes+=n; // account for storage UBFROMUI(alloc, n); // save n // printf(" alloc ++ dAB: %ld (%ld)\n", (LI)decAllocBytes, (LI)n); for (b=b0+4; b play area } // decMalloc /* ------------------------------------------------------------------ */ /* decFree -- accountable free routine */ /* alloc is the storage to free */ /* */ /* Semantics is the same as the stdlib malloc routine, except that */ /* the global storage accounting is updated and the fences are */ /* checked to ensure that no routine has written 'out of bounds'. */ /* ------------------------------------------------------------------ */ /* This routine first checks that the fences have not been corrupted. */ /* It then frees the storage using the 'truw' storage address (that */ /* is, offset by 8). */ /* ------------------------------------------------------------------ */ static void decFree(void *alloc) { uInt n; // original length uByte *b, *b0; // work uInt uiwork; // for macros if (alloc==NULL) return; // allowed; it's a nop b0=(uByte *)alloc; // as bytes b0-=8; // -> true start of storage n=UBTOUI(b0); // lift length for (b=b0+4; b /* for abs */ #include /* for memset, strcpy */ /* Conditional code flag -- set this to match hardware platform */ #if !defined(DECLITEND) #define DECLITEND 1 /* 1=little-endian, 0=big-endian */ #endif /* Conditional code flag -- set this to 1 for best performance */ #if !defined(DECUSE64) #define DECUSE64 1 /* 1=use int64s, 0=int32 & smaller only */ #endif /* Conditional code flag -- set this to 0 to exclude printf calls */ #if !defined(DECPRINT) #define DECPRINT 1 /* 1=allow printf calls; 0=no printf */ #endif /* Conditional check flags -- set these to 0 for best performance */ #if !defined(DECCHECK) #define DECCHECK 0 /* 1 to enable robust checking */ #endif #if !defined(DECALLOC) #define DECALLOC 0 /* 1 to enable memory accounting */ #endif #if !defined(DECTRACE) #define DECTRACE 0 /* 1 to trace certain internals, etc. */ #endif /* Tuning parameter for decNumber (arbitrary precision) module */ #if !defined(DECBUFFER) #define DECBUFFER 36 /* Size basis for local buffers. This */ /* should be a common maximum precision */ /* rounded up to a multiple of 4; must */ /* be zero or positive. */ #endif /* ---------------------------------------------------------------- */ /* Check parameter dependencies */ /* ---------------------------------------------------------------- */ #if DECCHECK & !DECPRINT #error DECCHECK needs DECPRINT to be useful #endif #if DECALLOC & !DECPRINT #error DECALLOC needs DECPRINT to be useful #endif #if DECTRACE & !DECPRINT #error DECTRACE needs DECPRINT to be useful #endif /* ---------------------------------------------------------------- */ /* Definitions for all modules (general-purpose) */ /* ---------------------------------------------------------------- */ /* Local names for common types -- for safety, decNumber modules do */ /* not use int or long directly. */ #define Flag uint8_t #define Byte int8_t #define uByte uint8_t #define Short int16_t #define uShort uint16_t #define Int int32_t #define uInt uint32_t #define Unit decNumberUnit #if DECUSE64 #define Long int64_t #define uLong uint64_t #endif /* Development-use definitions */ typedef long int LI; /* for printf arguments only */ #define DECNOINT 0 /* 1 to check no internal use of 'int' */ /* or stdint types */ #if DECNOINT /* if these interfere with your C includes, do not set DECNOINT */ #define int ? /* enable to ensure that plain C 'int' */ #define long ?? /* .. or 'long' types are not used */ #endif /* Shared lookup tables */ extern const uByte DECSTICKYTAB[10]; /* re-round digits if sticky */ extern const uInt DECPOWERS[10]; /* powers of ten table */ /* The following are included from decDPD.h */ extern const uShort DPD2BIN[1024]; /* DPD -> 0-999 */ extern const uShort BIN2DPD[1000]; /* 0-999 -> DPD */ extern const uInt DPD2BINK[1024]; /* DPD -> 0-999000 */ extern const uInt DPD2BINM[1024]; /* DPD -> 0-999000000 */ extern const uByte DPD2BCD8[4096]; /* DPD -> ddd + len */ extern const uByte BIN2BCD8[4000]; /* 0-999 -> ddd + len */ extern const uShort BCD2DPD[2458]; /* 0-0x999 -> DPD (0x999=2457)*/ /* LONGMUL32HI -- set w=(u*v)>>32, where w, u, and v are uInts */ /* (that is, sets w to be the high-order word of the 64-bit result; */ /* the low-order word is simply u*v.) */ /* This version is derived from Knuth via Hacker's Delight; */ /* it seems to optimize better than some others tried */ #define LONGMUL32HI(w, u, v) { \ uInt u0, u1, v0, v1, w0, w1, w2, t; \ u0=u & 0xffff; u1=u>>16; \ v0=v & 0xffff; v1=v>>16; \ w0=u0*v0; \ t=u1*v0 + (w0>>16); \ w1=t & 0xffff; w2=t>>16; \ w1=u0*v1 + w1; \ (w)=u1*v1 + w2 + (w1>>16);} /* ROUNDUP -- round an integer up to a multiple of n */ #define ROUNDUP(i, n) ((((i)+(n)-1)/n)*n) #define ROUNDUP4(i) (((i)+3)&~3) /* special for n=4 */ /* ROUNDDOWN -- round an integer down to a multiple of n */ #define ROUNDDOWN(i, n) (((i)/n)*n) #define ROUNDDOWN4(i) ((i)&~3) /* special for n=4 */ /* References to multi-byte sequences under different sizes; these */ /* require locally declared variables, but do not violate strict */ /* aliasing or alignment (as did the UINTAT simple cast to uInt). */ /* Variables needed are uswork, uiwork, etc. [so do not use at same */ /* level in an expression, e.g., UBTOUI(x)==UBTOUI(y) may fail]. */ /* Return a uInt, etc., from bytes starting at a char* or uByte* */ #define UBTOUS(b) (memcpy((void *)&uswork, b, 2), uswork) #define UBTOUI(b) (memcpy((void *)&uiwork, b, 4), uiwork) /* Store a uInt, etc., into bytes starting at a char* or uByte*. */ /* Returns i, evaluated, for convenience; has to use uiwork because */ /* i may be an expression. */ #define UBFROMUS(b, i) (uswork=(i), memcpy(b, (void *)&uswork, 2), uswork) #define UBFROMUI(b, i) (uiwork=(i), memcpy(b, (void *)&uiwork, 4), uiwork) /* X10 and X100 -- multiply integer i by 10 or 100 */ /* [shifts are usually faster than multiply; could be conditional] */ #define X10(i) (((i)<<1)+((i)<<3)) #define X100(i) (((i)<<2)+((i)<<5)+((i)<<6)) /* MAXI and MINI -- general max & min (not in ANSI) for integers */ #define MAXI(x,y) ((x)<(y)?(y):(x)) #define MINI(x,y) ((x)>(y)?(y):(x)) /* Useful constants */ #define BILLION 1000000000 /* 10**9 */ /* CHARMASK: 0x30303030 for ASCII/UTF8; 0xF0F0F0F0 for EBCDIC */ #define CHARMASK ((((((((uInt)'0')<<8)+'0')<<8)+'0')<<8)+'0') /* ---------------------------------------------------------------- */ /* Definitions for arbitary-precision modules (only valid after */ /* decNumber.h has been included) */ /* ---------------------------------------------------------------- */ /* Limits and constants */ #define DECNUMMAXP 999999999 /* maximum precision code can handle */ #define DECNUMMAXE 999999999 /* maximum adjusted exponent ditto */ #define DECNUMMINE -999999999 /* minimum adjusted exponent ditto */ #if (DECNUMMAXP != DEC_MAX_DIGITS) #error Maximum digits mismatch #endif #if (DECNUMMAXE != DEC_MAX_EMAX) #error Maximum exponent mismatch #endif #if (DECNUMMINE != DEC_MIN_EMIN) #error Minimum exponent mismatch #endif /* Set DECDPUNMAX -- the maximum integer that fits in DECDPUN */ /* digits, and D2UTABLE -- the initializer for the D2U table */ #if DECDPUN==1 #define DECDPUNMAX 9 #define D2UTABLE {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} #elif DECDPUN==2 #define DECDPUNMAX 99 #define D2UTABLE {0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10, \ 11,11,12,12,13,13,14,14,15,15,16,16,17,17,18, \ 18,19,19,20,20,21,21,22,22,23,23,24,24,25} #elif DECDPUN==3 #define DECDPUNMAX 999 #define D2UTABLE {0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7, \ 8,8,8,9,9,9,10,10,10,11,11,11,12,12,12,13,13, \ 13,14,14,14,15,15,15,16,16,16,17} #elif DECDPUN==4 #define DECDPUNMAX 9999 #define D2UTABLE {0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6, \ 6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11, \ 11,11,11,12,12,12,12,13} #elif DECDPUN==5 #define DECDPUNMAX 99999 #define D2UTABLE {0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5, \ 5,5,5,5,6,6,6,6,6,7,7,7,7,7,8,8,8,8,8,9,9,9, \ 9,9,10,10,10,10} #elif DECDPUN==6 #define DECDPUNMAX 999999 #define D2UTABLE {0,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4, \ 4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,8, \ 8,8,8,8,8,9} #elif DECDPUN==7 #define DECDPUNMAX 9999999 #define D2UTABLE {0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3, \ 4,4,4,4,4,4,4,5,5,5,5,5,5,5,6,6,6,6,6,6,6,7, \ 7,7,7,7,7,7} #elif DECDPUN==8 #define DECDPUNMAX 99999999 #define D2UTABLE {0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3, \ 3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6, \ 6,6,6,6,6,7} #elif DECDPUN==9 #define DECDPUNMAX 999999999 #define D2UTABLE {0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3, \ 3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5, \ 5,5,6,6,6,6} #elif defined(DECDPUN) #error DECDPUN must be in the range 1-9 #endif /* ----- Shared data (in decNumber.c) ----- */ /* Public lookup table used by the D2U macro (see below) */ #define DECMAXD2U 49 extern const uByte d2utable[DECMAXD2U+1]; /* ----- Macros ----- */ /* ISZERO -- return true if decNumber dn is a zero */ /* [performance-critical in some situations] */ #define ISZERO(dn) decNumberIsZero(dn) /* now just a local name */ /* D2U -- return the number of Units needed to hold d digits */ /* (runtime version, with table lookaside for small d) */ #if DECDPUN==8 #define D2U(d) ((unsigned)((d)<=DECMAXD2U?d2utable[d]:((d)+7)>>3)) #elif DECDPUN==4 #define D2U(d) ((unsigned)((d)<=DECMAXD2U?d2utable[d]:((d)+3)>>2)) #else #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN) #endif /* SD2U -- static D2U macro (for compile-time calculation) */ #define SD2U(d) (((d)+DECDPUN-1)/DECDPUN) /* MSUDIGITS -- returns digits in msu, from digits, calculated */ /* using D2U */ #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN) /* D2N -- return the number of decNumber structs that would be */ /* needed to contain that number of digits (and the initial */ /* decNumber struct) safely. Note that one Unit is included in the */ /* initial structure. Used for allocating space that is aligned on */ /* a decNumber struct boundary. */ #define D2N(d) \ ((((SD2U(d)-1)*sizeof(Unit))+sizeof(decNumber)*2-1)/sizeof(decNumber)) /* TODIGIT -- macro to remove the leading digit from the unsigned */ /* integer u at column cut (counting from the right, LSD=0) and */ /* place it as an ASCII character into the character pointed to by */ /* c. Note that cut must be <= 9, and the maximum value for u is */ /* 2,000,000,000 (as is needed for negative exponents of */ /* subnormals). The unsigned integer pow is used as a temporary */ /* variable. */ #define TODIGIT(u, cut, c, pow) { \ *(c)='0'; \ pow=DECPOWERS[cut]*2; \ if ((u)>pow) { \ pow*=4; \ if ((u)>=pow) {(u)-=pow; *(c)+=8;} \ pow/=2; \ if ((u)>=pow) {(u)-=pow; *(c)+=4;} \ pow/=2; \ } \ if ((u)>=pow) {(u)-=pow; *(c)+=2;} \ pow/=2; \ if ((u)>=pow) {(u)-=pow; *(c)+=1;} \ } /* ---------------------------------------------------------------- */ /* Definitions for fixed-precision modules (only valid after */ /* decSingle.h, decDouble.h, or decQuad.h has been included) */ /* ---------------------------------------------------------------- */ /* bcdnum -- a structure describing a format-independent finite */ /* number, whose coefficient is a string of bcd8 uBytes */ typedef struct { uByte *msd; /* -> most significant digit */ uByte *lsd; /* -> least ditto */ uInt sign; /* 0=positive, DECFLOAT_Sign=negative */ Int exponent; /* Unadjusted signed exponent (q), or */ /* DECFLOAT_NaN etc. for a special */ } bcdnum; /* Test if exponent or bcdnum exponent must be a special, etc. */ #define EXPISSPECIAL(exp) ((exp)>=DECFLOAT_MinSp) #define EXPISINF(exp) (exp==DECFLOAT_Inf) #define EXPISNAN(exp) (exp==DECFLOAT_qNaN || exp==DECFLOAT_sNaN) #define NUMISSPECIAL(num) (EXPISSPECIAL((num)->exponent)) /* Refer to a 32-bit word or byte in a decFloat (df) by big-endian */ /* (array) notation (the 0 word or byte contains the sign bit), */ /* automatically adjusting for endianness; similarly address a word */ /* in the next-wider format (decFloatWider, or dfw) */ #define DECWORDS (DECBYTES/4) #define DECWWORDS (DECWBYTES/4) #if DECLITEND #define DFBYTE(df, off) ((df)->bytes[DECBYTES-1-(off)]) #define DFWORD(df, off) ((df)->words[DECWORDS-1-(off)]) #define DFWWORD(dfw, off) ((dfw)->words[DECWWORDS-1-(off)]) #else #define DFBYTE(df, off) ((df)->bytes[off]) #define DFWORD(df, off) ((df)->words[off]) #define DFWWORD(dfw, off) ((dfw)->words[off]) #endif /* Tests for sign or specials, directly on DECFLOATs */ #define DFISSIGNED(df) ((DFWORD(df, 0)&0x80000000)!=0) #define DFISSPECIAL(df) ((DFWORD(df, 0)&0x78000000)==0x78000000) #define DFISINF(df) ((DFWORD(df, 0)&0x7c000000)==0x78000000) #define DFISNAN(df) ((DFWORD(df, 0)&0x7c000000)==0x7c000000) #define DFISQNAN(df) ((DFWORD(df, 0)&0x7e000000)==0x7c000000) #define DFISSNAN(df) ((DFWORD(df, 0)&0x7e000000)==0x7e000000) /* Shared lookup tables */ extern const uInt DECCOMBMSD[64]; /* Combination field -> MSD */ extern const uInt DECCOMBFROM[48]; /* exp+msd -> Combination */ /* Private generic (utility) routine */ #if DECCHECK || DECTRACE extern void decShowNum(const bcdnum *, const char *); #endif /* Format-dependent macros and constants */ #if defined(DECPMAX) /* Useful constants */ #define DECPMAX9 (ROUNDUP(DECPMAX, 9)/9) /* 'Pmax' in 10**9s */ /* Top words for a zero */ #define SINGLEZERO 0x22500000 #define DOUBLEZERO 0x22380000 #define QUADZERO 0x22080000 /* [ZEROWORD is defined to be one of these in the DFISZERO macro] */ /* Format-dependent common tests: */ /* DFISZERO -- test for (any) zero */ /* DFISCCZERO -- test for coefficient continuation being zero */ /* DFISCC01 -- test for coefficient contains only 0s and 1s */ /* DFISINT -- test for finite and exponent q=0 */ /* DFISUINT01 -- test for sign=0, finite, exponent q=0, and */ /* MSD=0 or 1 */ /* ZEROWORD is also defined here. */ /* */ /* In DFISZERO the first test checks the least-significant word */ /* (most likely to be non-zero); the penultimate tests MSD and */ /* DPDs in the signword, and the final test excludes specials and */ /* MSD>7. DFISINT similarly has to allow for the two forms of */ /* MSD codes. DFISUINT01 only has to allow for one form of MSD */ /* code. */ #if DECPMAX==7 #define ZEROWORD SINGLEZERO /* [test macros not needed except for Zero] */ #define DFISZERO(df) ((DFWORD(df, 0)&0x1c0fffff)==0 \ && (DFWORD(df, 0)&0x60000000)!=0x60000000) #elif DECPMAX==16 #define ZEROWORD DOUBLEZERO #define DFISZERO(df) ((DFWORD(df, 1)==0 \ && (DFWORD(df, 0)&0x1c03ffff)==0 \ && (DFWORD(df, 0)&0x60000000)!=0x60000000)) #define DFISINT(df) ((DFWORD(df, 0)&0x63fc0000)==0x22380000 \ ||(DFWORD(df, 0)&0x7bfc0000)==0x6a380000) #define DFISUINT01(df) ((DFWORD(df, 0)&0xfbfc0000)==0x22380000) #define DFISCCZERO(df) (DFWORD(df, 1)==0 \ && (DFWORD(df, 0)&0x0003ffff)==0) #define DFISCC01(df) ((DFWORD(df, 0)&~0xfffc9124)==0 \ && (DFWORD(df, 1)&~0x49124491)==0) #elif DECPMAX==34 #define ZEROWORD QUADZERO #define DFISZERO(df) ((DFWORD(df, 3)==0 \ && DFWORD(df, 2)==0 \ && DFWORD(df, 1)==0 \ && (DFWORD(df, 0)&0x1c003fff)==0 \ && (DFWORD(df, 0)&0x60000000)!=0x60000000)) #define DFISINT(df) ((DFWORD(df, 0)&0x63ffc000)==0x22080000 \ ||(DFWORD(df, 0)&0x7bffc000)==0x6a080000) #define DFISUINT01(df) ((DFWORD(df, 0)&0xfbffc000)==0x22080000) #define DFISCCZERO(df) (DFWORD(df, 3)==0 \ && DFWORD(df, 2)==0 \ && DFWORD(df, 1)==0 \ && (DFWORD(df, 0)&0x00003fff)==0) #define DFISCC01(df) ((DFWORD(df, 0)&~0xffffc912)==0 \ && (DFWORD(df, 1)&~0x44912449)==0 \ && (DFWORD(df, 2)&~0x12449124)==0 \ && (DFWORD(df, 3)&~0x49124491)==0) #endif /* Macros to test if a certain 10 bits of a uInt or pair of uInts */ /* are a canonical declet [higher or lower bits are ignored]. */ /* declet is at offset 0 (from the right) in a uInt: */ #define CANONDPD(dpd) (((dpd)&0x300)==0 || ((dpd)&0x6e)!=0x6e) /* declet is at offset k (a multiple of 2) in a uInt: */ #define CANONDPDOFF(dpd, k) (((dpd)&(0x300<<(k)))==0 \ || ((dpd)&(((uInt)0x6e)<<(k)))!=(((uInt)0x6e)<<(k))) /* declet is at offset k (a multiple of 2) in a pair of uInts: */ /* [the top 2 bits will always be in the more-significant uInt] */ #define CANONDPDTWO(hi, lo, k) (((hi)&(0x300>>(32-(k))))==0 \ || ((hi)&(0x6e>>(32-(k))))!=(0x6e>>(32-(k))) \ || ((lo)&(((uInt)0x6e)<<(k)))!=(((uInt)0x6e)<<(k))) /* Macro to test whether a full-length (length DECPMAX) BCD8 */ /* coefficient, starting at uByte u, is all zeros */ /* Test just the LSWord first, then the remainder as a sequence */ /* of tests in order to avoid same-level use of UBTOUI */ #if DECPMAX==7 #define ISCOEFFZERO(u) ( \ UBTOUI((u)+DECPMAX-4)==0 \ && UBTOUS((u)+DECPMAX-6)==0 \ && *(u)==0) #elif DECPMAX==16 #define ISCOEFFZERO(u) ( \ UBTOUI((u)+DECPMAX-4)==0 \ && UBTOUI((u)+DECPMAX-8)==0 \ && UBTOUI((u)+DECPMAX-12)==0 \ && UBTOUI(u)==0) #elif DECPMAX==34 #define ISCOEFFZERO(u) ( \ UBTOUI((u)+DECPMAX-4)==0 \ && UBTOUI((u)+DECPMAX-8)==0 \ && UBTOUI((u)+DECPMAX-12)==0 \ && UBTOUI((u)+DECPMAX-16)==0 \ && UBTOUI((u)+DECPMAX-20)==0 \ && UBTOUI((u)+DECPMAX-24)==0 \ && UBTOUI((u)+DECPMAX-28)==0 \ && UBTOUI((u)+DECPMAX-32)==0 \ && UBTOUS(u)==0) #endif /* Macros and masks for the sign, exponent continuation, and MSD */ /* Get the sign as DECFLOAT_Sign or 0 */ #define GETSIGN(df) (DFWORD(df, 0)&0x80000000) /* Get the exponent continuation from a decFloat *df as an Int */ #define GETECON(df) ((Int)((DFWORD((df), 0)&0x03ffffff)>>(32-6-DECECONL))) /* Ditto, from the next-wider format */ #define GETWECON(df) ((Int)((DFWWORD((df), 0)&0x03ffffff)>>(32-6-DECWECONL))) /* Get the biased exponent similarly */ #define GETEXP(df) ((Int)(DECCOMBEXP[DFWORD((df), 0)>>26]+GETECON(df))) /* Get the unbiased exponent similarly */ #define GETEXPUN(df) ((Int)GETEXP(df)-DECBIAS) /* Get the MSD similarly (as uInt) */ #define GETMSD(df) (DECCOMBMSD[DFWORD((df), 0)>>26]) /* Compile-time computes of the exponent continuation field masks */ /* full exponent continuation field: */ #define ECONMASK ((0x03ffffff>>(32-6-DECECONL))<<(32-6-DECECONL)) /* same, not including its first digit (the qNaN/sNaN selector): */ #define ECONNANMASK ((0x01ffffff>>(32-6-DECECONL))<<(32-6-DECECONL)) /* Macros to decode the coefficient in a finite decFloat *df into */ /* a BCD string (uByte *bcdin) of length DECPMAX uBytes. */ /* In-line sequence to convert least significant 10 bits of uInt */ /* dpd to three BCD8 digits starting at uByte u. Note that an */ /* extra byte is written to the right of the three digits because */ /* four bytes are moved at a time for speed; the alternative */ /* macro moves exactly three bytes (usually slower). */ #define dpd2bcd8(u, dpd) memcpy(u, &DPD2BCD8[((dpd)&0x3ff)*4], 4) #define dpd2bcd83(u, dpd) memcpy(u, &DPD2BCD8[((dpd)&0x3ff)*4], 3) /* Decode the declets. After extracting each one, it is decoded */ /* to BCD8 using a table lookup (also used for variable-length */ /* decode). Each DPD decode is 3 bytes BCD8 plus a one-byte */ /* length which is not used, here). Fixed-length 4-byte moves */ /* are fast, however, almost everywhere, and so are used except */ /* for the final three bytes (to avoid overrun). The code below */ /* is 36 instructions for Doubles and about 70 for Quads, even */ /* on IA32. */ /* Two macros are defined for each format: */ /* GETCOEFF extracts the coefficient of the current format */ /* GETWCOEFF extracts the coefficient of the next-wider format. */ /* The latter is a copy of the next-wider GETCOEFF using DFWWORD. */ #if DECPMAX==7 #define GETCOEFF(df, bcd) { \ uInt sourhi=DFWORD(df, 0); \ *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ dpd2bcd8(bcd+1, sourhi>>10); \ dpd2bcd83(bcd+4, sourhi);} #define GETWCOEFF(df, bcd) { \ uInt sourhi=DFWWORD(df, 0); \ uInt sourlo=DFWWORD(df, 1); \ *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ dpd2bcd8(bcd+1, sourhi>>8); \ dpd2bcd8(bcd+4, (sourhi<<2) | (sourlo>>30)); \ dpd2bcd8(bcd+7, sourlo>>20); \ dpd2bcd8(bcd+10, sourlo>>10); \ dpd2bcd83(bcd+13, sourlo);} #elif DECPMAX==16 #define GETCOEFF(df, bcd) { \ uInt sourhi=DFWORD(df, 0); \ uInt sourlo=DFWORD(df, 1); \ *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ dpd2bcd8(bcd+1, sourhi>>8); \ dpd2bcd8(bcd+4, (sourhi<<2) | (sourlo>>30)); \ dpd2bcd8(bcd+7, sourlo>>20); \ dpd2bcd8(bcd+10, sourlo>>10); \ dpd2bcd83(bcd+13, sourlo);} #define GETWCOEFF(df, bcd) { \ uInt sourhi=DFWWORD(df, 0); \ uInt sourmh=DFWWORD(df, 1); \ uInt sourml=DFWWORD(df, 2); \ uInt sourlo=DFWWORD(df, 3); \ *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ dpd2bcd8(bcd+1, sourhi>>4); \ dpd2bcd8(bcd+4, ((sourhi)<<6) | (sourmh>>26)); \ dpd2bcd8(bcd+7, sourmh>>16); \ dpd2bcd8(bcd+10, sourmh>>6); \ dpd2bcd8(bcd+13, ((sourmh)<<4) | (sourml>>28)); \ dpd2bcd8(bcd+16, sourml>>18); \ dpd2bcd8(bcd+19, sourml>>8); \ dpd2bcd8(bcd+22, ((sourml)<<2) | (sourlo>>30)); \ dpd2bcd8(bcd+25, sourlo>>20); \ dpd2bcd8(bcd+28, sourlo>>10); \ dpd2bcd83(bcd+31, sourlo);} #elif DECPMAX==34 #define GETCOEFF(df, bcd) { \ uInt sourhi=DFWORD(df, 0); \ uInt sourmh=DFWORD(df, 1); \ uInt sourml=DFWORD(df, 2); \ uInt sourlo=DFWORD(df, 3); \ *(bcd)=(uByte)DECCOMBMSD[sourhi>>26]; \ dpd2bcd8(bcd+1, sourhi>>4); \ dpd2bcd8(bcd+4, ((sourhi)<<6) | (sourmh>>26)); \ dpd2bcd8(bcd+7, sourmh>>16); \ dpd2bcd8(bcd+10, sourmh>>6); \ dpd2bcd8(bcd+13, ((sourmh)<<4) | (sourml>>28)); \ dpd2bcd8(bcd+16, sourml>>18); \ dpd2bcd8(bcd+19, sourml>>8); \ dpd2bcd8(bcd+22, ((sourml)<<2) | (sourlo>>30)); \ dpd2bcd8(bcd+25, sourlo>>20); \ dpd2bcd8(bcd+28, sourlo>>10); \ dpd2bcd83(bcd+31, sourlo);} #define GETWCOEFF(df, bcd) {??} /* [should never be used] */ #endif /* Macros to decode the coefficient in a finite decFloat *df into */ /* a base-billion uInt array, with the least-significant */ /* 0-999999999 'digit' at offset 0. */ /* Decode the declets. After extracting each one, it is decoded */ /* to binary using a table lookup. Three tables are used; one */ /* the usual DPD to binary, the other two pre-multiplied by 1000 */ /* and 1000000 to avoid multiplication during decode. These */ /* tables can also be used for multiplying up the MSD as the DPD */ /* code for 0 through 9 is the identity. */ #define DPD2BIN0 DPD2BIN /* for prettier code */ #if DECPMAX==7 #define GETCOEFFBILL(df, buf) { \ uInt sourhi=DFWORD(df, 0); \ (buf)[0]=DPD2BIN0[sourhi&0x3ff] \ +DPD2BINK[(sourhi>>10)&0x3ff] \ +DPD2BINM[DECCOMBMSD[sourhi>>26]];} #elif DECPMAX==16 #define GETCOEFFBILL(df, buf) { \ uInt sourhi, sourlo; \ sourlo=DFWORD(df, 1); \ (buf)[0]=DPD2BIN0[sourlo&0x3ff] \ +DPD2BINK[(sourlo>>10)&0x3ff] \ +DPD2BINM[(sourlo>>20)&0x3ff]; \ sourhi=DFWORD(df, 0); \ (buf)[1]=DPD2BIN0[((sourhi<<2) | (sourlo>>30))&0x3ff] \ +DPD2BINK[(sourhi>>8)&0x3ff] \ +DPD2BINM[DECCOMBMSD[sourhi>>26]];} #elif DECPMAX==34 #define GETCOEFFBILL(df, buf) { \ uInt sourhi, sourmh, sourml, sourlo; \ sourlo=DFWORD(df, 3); \ (buf)[0]=DPD2BIN0[sourlo&0x3ff] \ +DPD2BINK[(sourlo>>10)&0x3ff] \ +DPD2BINM[(sourlo>>20)&0x3ff]; \ sourml=DFWORD(df, 2); \ (buf)[1]=DPD2BIN0[((sourml<<2) | (sourlo>>30))&0x3ff] \ +DPD2BINK[(sourml>>8)&0x3ff] \ +DPD2BINM[(sourml>>18)&0x3ff]; \ sourmh=DFWORD(df, 1); \ (buf)[2]=DPD2BIN0[((sourmh<<4) | (sourml>>28))&0x3ff] \ +DPD2BINK[(sourmh>>6)&0x3ff] \ +DPD2BINM[(sourmh>>16)&0x3ff]; \ sourhi=DFWORD(df, 0); \ (buf)[3]=DPD2BIN0[((sourhi<<6) | (sourmh>>26))&0x3ff] \ +DPD2BINK[(sourhi>>4)&0x3ff] \ +DPD2BINM[DECCOMBMSD[sourhi>>26]];} #endif /* Macros to decode the coefficient in a finite decFloat *df into */ /* a base-thousand uInt array (of size DECLETS+1, to allow for */ /* the MSD), with the least-significant 0-999 'digit' at offset 0.*/ /* Decode the declets. After extracting each one, it is decoded */ /* to binary using a table lookup. */ #if DECPMAX==7 #define GETCOEFFTHOU(df, buf) { \ uInt sourhi=DFWORD(df, 0); \ (buf)[0]=DPD2BIN[sourhi&0x3ff]; \ (buf)[1]=DPD2BIN[(sourhi>>10)&0x3ff]; \ (buf)[2]=DECCOMBMSD[sourhi>>26];} #elif DECPMAX==16 #define GETCOEFFTHOU(df, buf) { \ uInt sourhi, sourlo; \ sourlo=DFWORD(df, 1); \ (buf)[0]=DPD2BIN[sourlo&0x3ff]; \ (buf)[1]=DPD2BIN[(sourlo>>10)&0x3ff]; \ (buf)[2]=DPD2BIN[(sourlo>>20)&0x3ff]; \ sourhi=DFWORD(df, 0); \ (buf)[3]=DPD2BIN[((sourhi<<2) | (sourlo>>30))&0x3ff]; \ (buf)[4]=DPD2BIN[(sourhi>>8)&0x3ff]; \ (buf)[5]=DECCOMBMSD[sourhi>>26];} #elif DECPMAX==34 #define GETCOEFFTHOU(df, buf) { \ uInt sourhi, sourmh, sourml, sourlo; \ sourlo=DFWORD(df, 3); \ (buf)[0]=DPD2BIN[sourlo&0x3ff]; \ (buf)[1]=DPD2BIN[(sourlo>>10)&0x3ff]; \ (buf)[2]=DPD2BIN[(sourlo>>20)&0x3ff]; \ sourml=DFWORD(df, 2); \ (buf)[3]=DPD2BIN[((sourml<<2) | (sourlo>>30))&0x3ff]; \ (buf)[4]=DPD2BIN[(sourml>>8)&0x3ff]; \ (buf)[5]=DPD2BIN[(sourml>>18)&0x3ff]; \ sourmh=DFWORD(df, 1); \ (buf)[6]=DPD2BIN[((sourmh<<4) | (sourml>>28))&0x3ff]; \ (buf)[7]=DPD2BIN[(sourmh>>6)&0x3ff]; \ (buf)[8]=DPD2BIN[(sourmh>>16)&0x3ff]; \ sourhi=DFWORD(df, 0); \ (buf)[9]=DPD2BIN[((sourhi<<6) | (sourmh>>26))&0x3ff]; \ (buf)[10]=DPD2BIN[(sourhi>>4)&0x3ff]; \ (buf)[11]=DECCOMBMSD[sourhi>>26];} #endif /* Macros to decode the coefficient in a finite decFloat *df and */ /* add to a base-thousand uInt array (as for GETCOEFFTHOU). */ /* After the addition then most significant 'digit' in the array */ /* might have a value larger then 10 (with a maximum of 19). */ #if DECPMAX==7 #define ADDCOEFFTHOU(df, buf) { \ uInt sourhi=DFWORD(df, 0); \ (buf)[0]+=DPD2BIN[sourhi&0x3ff]; \ if (buf[0]>999) {buf[0]-=1000; buf[1]++;} \ (buf)[1]+=DPD2BIN[(sourhi>>10)&0x3ff]; \ if (buf[1]>999) {buf[1]-=1000; buf[2]++;} \ (buf)[2]+=DECCOMBMSD[sourhi>>26];} #elif DECPMAX==16 #define ADDCOEFFTHOU(df, buf) { \ uInt sourhi, sourlo; \ sourlo=DFWORD(df, 1); \ (buf)[0]+=DPD2BIN[sourlo&0x3ff]; \ if (buf[0]>999) {buf[0]-=1000; buf[1]++;} \ (buf)[1]+=DPD2BIN[(sourlo>>10)&0x3ff]; \ if (buf[1]>999) {buf[1]-=1000; buf[2]++;} \ (buf)[2]+=DPD2BIN[(sourlo>>20)&0x3ff]; \ if (buf[2]>999) {buf[2]-=1000; buf[3]++;} \ sourhi=DFWORD(df, 0); \ (buf)[3]+=DPD2BIN[((sourhi<<2) | (sourlo>>30))&0x3ff]; \ if (buf[3]>999) {buf[3]-=1000; buf[4]++;} \ (buf)[4]+=DPD2BIN[(sourhi>>8)&0x3ff]; \ if (buf[4]>999) {buf[4]-=1000; buf[5]++;} \ (buf)[5]+=DECCOMBMSD[sourhi>>26];} #elif DECPMAX==34 #define ADDCOEFFTHOU(df, buf) { \ uInt sourhi, sourmh, sourml, sourlo; \ sourlo=DFWORD(df, 3); \ (buf)[0]+=DPD2BIN[sourlo&0x3ff]; \ if (buf[0]>999) {buf[0]-=1000; buf[1]++;} \ (buf)[1]+=DPD2BIN[(sourlo>>10)&0x3ff]; \ if (buf[1]>999) {buf[1]-=1000; buf[2]++;} \ (buf)[2]+=DPD2BIN[(sourlo>>20)&0x3ff]; \ if (buf[2]>999) {buf[2]-=1000; buf[3]++;} \ sourml=DFWORD(df, 2); \ (buf)[3]+=DPD2BIN[((sourml<<2) | (sourlo>>30))&0x3ff]; \ if (buf[3]>999) {buf[3]-=1000; buf[4]++;} \ (buf)[4]+=DPD2BIN[(sourml>>8)&0x3ff]; \ if (buf[4]>999) {buf[4]-=1000; buf[5]++;} \ (buf)[5]+=DPD2BIN[(sourml>>18)&0x3ff]; \ if (buf[5]>999) {buf[5]-=1000; buf[6]++;} \ sourmh=DFWORD(df, 1); \ (buf)[6]+=DPD2BIN[((sourmh<<4) | (sourml>>28))&0x3ff]; \ if (buf[6]>999) {buf[6]-=1000; buf[7]++;} \ (buf)[7]+=DPD2BIN[(sourmh>>6)&0x3ff]; \ if (buf[7]>999) {buf[7]-=1000; buf[8]++;} \ (buf)[8]+=DPD2BIN[(sourmh>>16)&0x3ff]; \ if (buf[8]>999) {buf[8]-=1000; buf[9]++;} \ sourhi=DFWORD(df, 0); \ (buf)[9]+=DPD2BIN[((sourhi<<6) | (sourmh>>26))&0x3ff]; \ if (buf[9]>999) {buf[9]-=1000; buf[10]++;} \ (buf)[10]+=DPD2BIN[(sourhi>>4)&0x3ff]; \ if (buf[10]>999) {buf[10]-=1000; buf[11]++;} \ (buf)[11]+=DECCOMBMSD[sourhi>>26];} #endif /* Set a decFloat to the maximum positive finite number (Nmax) */ #if DECPMAX==7 #define DFSETNMAX(df) \ {DFWORD(df, 0)=0x77f3fcff;} #elif DECPMAX==16 #define DFSETNMAX(df) \ {DFWORD(df, 0)=0x77fcff3f; \ DFWORD(df, 1)=0xcff3fcff;} #elif DECPMAX==34 #define DFSETNMAX(df) \ {DFWORD(df, 0)=0x77ffcff3; \ DFWORD(df, 1)=0xfcff3fcf; \ DFWORD(df, 2)=0xf3fcff3f; \ DFWORD(df, 3)=0xcff3fcff;} #endif /* [end of format-dependent macros and constants] */ #endif #else #error decNumberLocal included more than once #endif jq-1.8.2/AUTHORS0000644000175100017510000002657515215513536006714 Created By: Stephen Dolan Maintained by: David Tolnay Emanuele Torre Leonid S. Usov Mattias Wadman Muh Muhten Nicolas Williams Owen Ou William Langford itchyny pkoppstein Contributions by: 13ren A4-Tacks AJ Jordan Aaron Peschel Adam Lindberg Alanscut Aleksey Tsalolikhin Alex Chamberlain Alex Jurkiewicz Alex Ozdemir Alex Wilson Alexandre Jasmin Allan Clark Alyssa Ross Andreas Heiduk Andrew O'Brien Andrew Rodland Andrew Speed Andy Lester Ankur Anthony Shortland Anthony Sottile Assaf Gordon Attila Fülöp Benjamin Wuethrich Benoit de Chezelles Bernard Niset Bhargava Mummadireddy Binbin Qian Bradley Skaggs Brahm Lower Brendan Macmillan Cameron Sparr Chance Zibolski Charles Merriam Chris LaRose Chris Moore Christoph Anton Mitterer Christopher Degawa Ciaran McNamara <1372986+ciaranmcnamara@users.noreply.github.com> Clément MATHIEU Colin Leroy-Mira Colin von Heuring Dag-Erling Smørgrav Damian Gryski Dan Church Daniel Lange David Biesack David Fetter David Haguenauer David Korczynski David R. MacIver DavidKorczynski Dawid Ferenczy Rogožan Dennis Ameling Derrick Pallas Doug Luce Eiichi Sato Eli Schwartz Eloy Coto Eric Bréchemier Erik Brinkman Eugen Evan Zacks Fabian Dellwing Fabian Fleischer <50590395+fab1ano@users.noreply.github.com> Felix Wolfsteller Filippo Giunchedi Filippo Valsorda Florian Weimer Frederic Cambus Gabriel Marin Gaelan Steele George Hopkins Gert Van Gool Gijs Kunze Gustav HE, Tao Han Jiang Hanfei Shen Hanson Char Haochen Xie Helmut K. C. Tessarek Henré Botha Ian Miell Ikko Ashimine Ish Nagy <50555716+ishnagy@users.noreply.github.com> J Phani Mahesh J. B. Rainsberger Jack Pearkes Jakub Jirutka Jakub Wilk James Andariese James Pearson Hughes Jan Schulz Jan-Piet Mens Janne Cederberg Jason Hood Jay Satiro Jesper Rønn-Jensen Jingwen Owen Ou Joe Littlejohn Joel Nothman Joel Purra Jonathan Chan Kwan Yin Jonathan Word Josh Soref <2119212+jsoref@users.noreply.github.com> José Joaquín Atria Juan Guerrero Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com> Kartik Shah Kenny Shen Kim De Mey Kim Toms Kirk McKelvey Klemens Nanni LCD 47 Larry Aasen Lee Thompson Loamhoof Lucas Trzesniewski Lukas Lansky MCApollo <34170230+MCApollo@users.noreply.github.com> Marc Abramowitz Marc Bruggmann Marcin Kłopotek Marcin Serwin Mark Feit Mark McKinstry Markus Lanthaler Matt Clegg Matt Meyers Matti Åstrand Mattias Hansson Maxime Biais Maximilian Roos <5635139+max-sixty@users.noreply.github.com> McSinyx Michael Daines Michael Färber <01mf02@gmail.com> Mike Daines Mike Fletcher Mike McCabe Nathan Baulch Naïm Favier Nicolas Pouillard Nicole Wren Paul Chvostek Paul Wise Peter Kjellerstedt Peter van Dijk Philipp Hagemeister Ricardo Constantino Richard Groves Richard H Lee Riley Avron Rob Wills Robert Aboukhalil Rohan Santhosh Kumar <181558744+Rohan5commit@users.noreply.github.com> Roland C. Dowdeswell Roman Inflianskas Romero Malaquias Ryoichi KATO Rémy Léone SArpnt Samar Sunkaria Santiago Lapresta Scott Seal Sean Wei Sebastian Freundt Shaun Guth Shay Elkin Simon Elsbrock Stefan Stefan Seemayer Stephen Roantree Stephen Shaw Steven Ihde Steven Maude Steven Penny Sudhakar Verma <10460978+sudhackar@users.noreply.github.com> Thalia Archibald TheOdd Thomas Bozeman th026106 Thomas R. Hall Thomas Sibley Tim McCormack Timothy John Perisho Eccleston Tom Wolf Tomas Halman Travis Gockel Tyler Rockwood Ulrich Eckhardt Vladimír Marek W-Mark Kubacki William Chargin Yasuhiro Matsumoto Yeikel Yoichi Nakayama Yu-Fu Fu Ze Sheng <108382772+OwenSanzas@users.noreply.github.com> Zhaohui Mei Zhiming Wang bigmoonbit calpeconsulting <61429736+calpeconsulting@users.noreply.github.com> cdnbacon dak180 davkor dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> eitsupi <50911393+eitsupi@users.noreply.github.com> fletcher gornick github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> goodactive <167312449+goodactive@users.noreply.github.com> i jkleint lectrical <14344693+lectrical@users.noreply.github.com> liviubobocu maflcko <6399679+maflcko@users.noreply.github.com> mail6543210 mjarosie myaaaaaaaaa <103326468+myaaaaaaaaa@users.noreply.github.com> nmulcahey orbea polyester rain1 riastradh sachint <32639496+sachintu47@users.noreply.github.com> sheepster tal@whatexit.org taoky theyoucheng tlsbollei <170938166+tlsbollei@users.noreply.github.com> trantor wellweek <148746285+wellweek@users.noreply.github.com> wllm-rbnt zstadler наб 엄태용 jq-1.8.2/configure.ac0000644000175100017510000002441115215513536010115 m4_define([jq_version], m4_esyscmd_s([scripts/version]))) AC_INIT([jq],[jq_version],[https://github.com/jqlang/jq/issues],[jq],[https://jqlang.org]) dnl Created autoconf implementation thompson@dtosolutions, 26NOV12 AC_PREREQ([2.65]) AC_CONFIG_AUX_DIR([config]) AC_USE_SYSTEM_EXTENSIONS dnl Prefer GNU make on Solaris where /usr/bin/make is not suitable AS_IF([test -z "$MAKE"], [ AS_CASE(["`uname -s`"], [SunOS], [MAKE=/usr/gnu/bin/make]) ]) AM_INIT_AUTOMAKE([1.11.2 subdir-objects parallel-tests foreign -Wall]) AM_SILENT_RULES([yes]) AM_PROG_AR AM_MAINTAINER_MODE([disable]) AC_PROG_CC m4_version_prereq([2.70], [], [AC_PROG_CC_STDC]) AC_PROG_CPP_WERROR AC_PROG_YACC AC_OBJEXT AC_EXEEXT LT_INIT([shared static win32-dll]) AM_PROG_CC_C_O AC_SYS_LARGEFILE # issue 2167 dnl couldn't use AM_PROG_LEX as it doesn't support header files like the dnl AC_PROG_YACC macros... dnl check bison version if test "$USE_MAINTAINER_MODE" = yes; then if test "$YACC" != "bison -y"; then AC_MSG_CHECKING([bison version]) AC_MSG_RESULT([not bison]) else AX_PROG_BISON_VERSION([3], [], [AC_MSG_ERROR([You need bison version 3.0 or greater])]) fi AC_CHECK_PROGS(LEX, flex lex) fi AC_CHECK_FUNCS(memmem) AC_CHECK_HEADER("sys/cygwin.h", [have_cygwin=1;]) AC_CHECK_HEADER("shlwapi.h",[have_shlwapi=1;]) AM_CONDITIONAL([WIN32], [test "x$have_shlwapi" = x1 && test ! "x$have_cygwin" = x1]) dnl Running tests with Valgrind is slow. It is faster to iterate on dnl code without Valgrind until tests pass, then enable Valgrind and dnl fix leaks. AC_ARG_ENABLE([valgrind], AS_HELP_STRING([--enable-valgrind],[enable Valgrind during testing])) dnl Address sanitizer (ASan) AC_ARG_ENABLE([asan], AS_HELP_STRING([--enable-asan],[enable address sanitizer])) dnl Undefined Behavior Sanitizer AC_ARG_ENABLE([ubsan], AS_HELP_STRING([--enable-ubsan],[enable undefined behavior sanitizer])) dnl Code coverage AC_ARG_ENABLE([gcov], AS_HELP_STRING([--enable-gcov],[enable gcov code coverage tool])) dnl Don't attempt to build docs if python deps aren't installed AC_ARG_ENABLE([docs], AS_HELP_STRING([--disable-docs],[do not build docs]), [], [enable_docs=yes]) dnl Don't attempt to build the error injection object (if there is no LD_PRELOAD support) AC_ARG_ENABLE([error-injection], AS_HELP_STRING([--enable-error-injection],[build and test with error injection])) dnl Enable building all static AC_ARG_ENABLE([all-static], AS_HELP_STRING([--enable-all-static],[link jq with static libraries only])) dnl find pipenv AC_ARG_VAR([PIPENV], [pipenv command]) AC_CHECK_PROGS([PIPENV], pipenv) AS_IF([test "x$enable_docs" != "xno"],[ AC_CACHE_CHECK([for Python dependencies], [jq_cv_python_deps],[ jq_cv_python_deps=yes AS_IF([test "x$PIPENV" = "x" || \ ! bmsg="`cd ${srcdir}/docs; LC_ALL=$LANG "$PIPENV" --venv`"],[ jq_cv_python_deps=no ]) ]) AS_IF([test "x$jq_cv_python_deps" != "xyes"], [ AC_MSG_WARN([Error checking python dependencies: $bmsg ***************************************************************** * Python dependencies for building jq documentation not found. * * You can still build, install and hack on jq, but the manpage * * will not be rebuilt and new manpage tests will not be run. * * See docs/README.md for how to install the docs dependencies. * *****************************************************************]) enable_docs=no ]) ]) dnl Disable decNumber support AC_ARG_ENABLE([decnum], AS_HELP_STRING([--disable-decnum],[disable decnum support])) AS_IF([test "x$enable_decnum" != "xno"],[ AC_DEFINE([USE_DECNUM], 1, [Define to enable decnum support.]) ]) AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" = xyes]) AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = xyes]) AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = xyes]) AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes]) AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno]) AM_CONDITIONAL([ENABLE_ERROR_INJECTION], [test "x$enable_error_injection" = xyes]) AM_CONDITIONAL([ENABLE_ALL_STATIC], [test "x$enable_all_static" = xyes]) dnl Find pthread, if we have it. We do this first because we may set -pthread on CFLAGS dnl which can cause various macros to be defined (__REENTRANT on Darwin, for example) AX_PTHREAD([ AC_DEFINE([HAVE_PTHREAD], [1], [Define to enable POSIX threads support.]) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" ]) AC_FUNC_ALLOCA AC_FIND_FUNC([isatty], [c], [#include ], [0]) AC_FIND_FUNC([_isatty], [c], [#include ], [0]) AC_FIND_FUNC([strptime], [c], [#include ], [0, 0, 0]) AC_FIND_FUNC([strftime], [c], [#include ], [0, 0, 0, 0]) AC_FIND_FUNC([setenv], [c], [#include ], [0, 0, 0]) AC_FIND_FUNC([timegm], [c], [#include ], [0]) AC_FIND_FUNC([gmtime_r], [c], [#include ], [0, 0]) AC_FIND_FUNC([gmtime], [c], [#include ], [0]) AC_FIND_FUNC([localtime_r], [c], [#include ], [0, 0]) AC_FIND_FUNC([localtime], [c], [#include ], [0]) AC_FIND_FUNC([gettimeofday], [c], [#include ], [0, 0]) AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])], [], [[#include ]]) AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])], [], [[#include ]]) AC_FIND_FUNC([setlocale], [c], [#include ], [0,0]) AC_FIND_FUNC([arc4random], [c], [#include ], []) AC_FIND_FUNC([getentropy], [c], [#include ], [0, 0]) dnl Figure out if we have the pthread functions we actually need AC_FIND_FUNC_NO_LIBS([pthread_key_create], [], [#include ], [NULL, NULL]) AC_FIND_FUNC_NO_LIBS([pthread_once], [], [#include ], [NULL, NULL]) AC_FIND_FUNC_NO_LIBS([atexit], [], [#include ], [NULL]) dnl libm math.h functions AC_CHECK_MATH_FUNC(acos) AC_CHECK_MATH_FUNC(acosh) AC_CHECK_MATH_FUNC(asin) AC_CHECK_MATH_FUNC(asinh) AC_CHECK_MATH_FUNC(atan2) AC_CHECK_MATH_FUNC(atan) AC_CHECK_MATH_FUNC(atanh) AC_CHECK_MATH_FUNC(cbrt) AC_CHECK_MATH_FUNC(ceil) AC_CHECK_MATH_FUNC(copysign) AC_CHECK_MATH_FUNC(cos) AC_CHECK_MATH_FUNC(cosh) AC_CHECK_MATH_FUNC(drem) AC_CHECK_MATH_FUNC(erf) AC_CHECK_MATH_FUNC(erfc) AC_CHECK_MATH_FUNC(exp10) AC_CHECK_MATH_FUNC(__exp10) dnl macOS has an __exp10 AC_CHECK_MATH_FUNC(exp2) AC_CHECK_MATH_FUNC(exp) AC_CHECK_MATH_FUNC(expm1) AC_CHECK_MATH_FUNC(fabs) AC_CHECK_MATH_FUNC(fdim) AC_CHECK_MATH_FUNC(floor) AC_CHECK_MATH_FUNC(fma) AC_CHECK_MATH_FUNC(fmax) AC_CHECK_MATH_FUNC(fmin) AC_CHECK_MATH_FUNC(fmod) AC_CHECK_MATH_FUNC(frexp) AC_CHECK_MATH_FUNC(gamma) AC_CHECK_MATH_FUNC(hypot) AC_CHECK_MATH_FUNC(j0) AC_CHECK_MATH_FUNC(j1) AC_CHECK_MATH_FUNC(jn) AC_CHECK_MATH_FUNC(ldexp) AC_CHECK_MATH_FUNC(lgamma) AC_CHECK_MATH_FUNC(log10) AC_CHECK_MATH_FUNC(log1p) AC_CHECK_MATH_FUNC(log2) AC_CHECK_MATH_FUNC(log) AC_CHECK_MATH_FUNC(logb) AC_CHECK_MATH_FUNC(modf) AC_CHECK_MATH_FUNC(lgamma_r) AC_CHECK_MATH_FUNC(nearbyint) AC_CHECK_MATH_FUNC(nextafter) AC_CHECK_MATH_FUNC(nexttoward) AC_CHECK_MATH_FUNC(pow) AC_CHECK_MATH_FUNC(remainder) AC_CHECK_MATH_FUNC(rint) AC_CHECK_MATH_FUNC(round) AC_CHECK_MATH_FUNC(scalb) AC_CHECK_MATH_FUNC(scalbln) AC_CHECK_MATH_FUNC(significand) dnl scalbn and ilogb are used on macos to replace significand if we don't have frexp AC_CHECK_MATH_FUNC(scalbn) AC_CHECK_MATH_FUNC(ilogb) AC_CHECK_MATH_FUNC(sin) AC_CHECK_MATH_FUNC(sinh) AC_CHECK_MATH_FUNC(sqrt) AC_CHECK_MATH_FUNC(tan) AC_CHECK_MATH_FUNC(tanh) AC_CHECK_MATH_FUNC(tgamma) AC_CHECK_MATH_FUNC(trunc) AC_CHECK_MATH_FUNC(y0) AC_CHECK_MATH_FUNC(y1) AC_CHECK_MATH_FUNC(yn) dnl Thread local storage have___thread=no AC_MSG_CHECKING(for thread-local storage) AC_LINK_IFELSE([AC_LANG_SOURCE([ static __thread int x ; int main () { x = 123; return x; } ])], have___thread=yes) if test $have___thread = yes; then AC_DEFINE([HAVE___THREAD],1,[Define to 1 if the system supports __thread]) fi AC_MSG_RESULT($have___thread) AC_C_BIGENDIAN( AC_DEFINE([IEEE_MC68k], 1, [machine is bigendian]), AC_DEFINE([IEEE_8087], 1, [machine is littleendian]), AC_MSG_ERROR(unknown endianness), AC_MSG_ERROR(universal endianness not supported) ) dnl Oniguruma AC_ARG_WITH([oniguruma], [AS_HELP_STRING([--with-oniguruma=prefix], [try this for a non-standard install prefix of the oniguruma library])], , [with_oniguruma=yes]) onig_CFLAGS= onig_LDFLAGS= build_oniguruma=no AS_IF([test "x$with_oniguruma" != xno], [ save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" AS_IF([test "x$with_oniguruma" != xyes], [ AS_IF([test "x$with_oniguruma" = xbuiltin], [ build_oniguruma=yes ], [ onig_CFLAGS="-I${with_oniguruma}/include" onig_LDFLAGS="-L${with_oniguruma}/lib" ]) ]) AS_IF([test "x$build_oniguruma" = xno], [ # check for ONIGURUMA library, either in /usr or where requested CFLAGS="$CFLAGS $onig_CFLAGS" LDFLAGS="$LDFLAGS $onig_LDFLAGS" AC_CHECK_HEADER("oniguruma.h", AC_CHECK_LIB([onig],[onig_version])) # handle check results AS_IF([test "x$ac_cv_lib_onig_onig_version" != "xyes"], [ build_oniguruma=yes AC_MSG_NOTICE([Oniguruma was not found. Will use the packaged oniguruma.]) ]) ]) AS_IF([test "x$build_oniguruma" = xyes && test -f "${srcdir}/vendor/oniguruma/configure.ac" ], [ onig_CFLAGS="-I${srcdir}/vendor/oniguruma/src" onig_LDFLAGS="-L${srcdir}/vendor/oniguruma/src -Wl,-rpath,${libdir}" AC_CONFIG_SUBDIRS([vendor/oniguruma]) AC_DEFINE([HAVE_LIBONIG],1,[Define to 1 if the system includes libonig]) ]) CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS" ]) AC_SUBST(onig_CFLAGS) AC_SUBST(onig_LDFLAGS) AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes]) AM_CONDITIONAL([WITH_ONIGURUMA], [test "x$with_oniguruma" != xno]) dnl On Solaris, strptime clears the tm structure before parsing. This breaks the dnl sentinel logic in builtin.c, which then incorrectly assumes that strptime set dnl tm_wday and tm_yday. Defining _STRPTIME_DONTZERO disables that behavior. AS_IF([test "x`uname -s 2>/dev/null`" = "xSunOS"], [ CPPFLAGS="$CPPFLAGS -D_STRPTIME_DONTZERO" ]) AC_CONFIG_MACRO_DIRS([config/m4 m4]) AC_CONFIG_FILES([Makefile libjq.pc]) AC_OUTPUT jq-1.8.2/Makefile.am0000644000175100017510000002234215215513536007664 ### C source files to be built and distributed. LIBJQ_INCS = src/builtin.h src/bytecode.h src/compile.h \ src/exec_stack.h src/jq_parser.h src/jv_alloc.h src/jv_dtoa.h \ src/jv_unicode.h src/jv_utf8_tables.h src/lexer.l src/libm.h \ src/linker.h src/locfile.h src/opcode_list.h src/parser.y \ src/util.h src/jv_dtoa_tsd.h src/jv_thread.h src/jv_private.h \ vendor/decNumber/decContext.h vendor/decNumber/decNumber.h \ vendor/decNumber/decNumberLocal.h LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \ src/jq_test.c src/jv.c src/jv_alloc.c src/jv_aux.c \ src/jv_dtoa.c src/jv_file.c src/jv_parse.c src/jv_print.c \ src/jv_unicode.c src/linker.c src/locfile.c src/util.c \ src/jv_dtoa_tsd.c \ vendor/decNumber/decContext.c vendor/decNumber/decNumber.c \ ${LIBJQ_INCS} ### C build options AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function \ -Woverlength-strings -Wstrict-prototypes if WIN32 AM_CFLAGS += -municode endif ACLOCAL_AMFLAGS = -I config/m4 ### Generating the lexer and parser # While there is some autoconf macro support for lex/flex, it doesn't support # header file creation so we'll use good old make if MAINTAINER_MODE BUILT_SOURCES = src/lexer.h src/lexer.c src/parser.h src/parser.c \ src/builtin.inc src/config_opts.inc src/version.h src/lexer.c: src/lexer.l $(AM_V_LEX) flex -o src/lexer.c --header-file=src/lexer.h $< src/lexer.h: src/lexer.c else BUILT_SOURCES = src/builtin.inc src/config_opts.inc src/version.h .y.c: $(AM_V_YACC) [ "$(/dev/null`" = "x$$ver" || touch .remake-version-h src/version.h: .remake-version-h mkdir -p src $(AM_V_GEN) $(generate_ver); echo "$$ver" > $@ src/config_opts.inc: mkdir -p src $(AM_V_GEN) if test -x ./config.status; then \ ./config.status --config; \ else echo "(unknown)"; \ fi | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' -e 's/^/#define JQ_CONFIG /' > $@ src/main.c: src/version.h src/config_opts.inc src/builtin.inc: $(srcdir)/src/builtin.jq mkdir -p src $(AM_V_GEN) od -v -A n -t o1 -- $< | \ sed -e 's/$$/ /' \ -e 's/\([0123456789]\) /\1, /g' \ -e 's/ $$//' \ -e 's/ 0/ 0/g' \ -e 's/ \([123456789]\)/ 0\1/g' > $@ src/builtin.o: src/builtin.inc CLEANFILES = src/version.h .remake-version-h src/builtin.inc src/config_opts.inc bin_PROGRAMS = jq jq_SOURCES = src/main.c jq_LDADD = libjq.la -lm if ENABLE_ALL_STATIC jq_LDFLAGS = -all-static endif ### Tests (make check) TESTS = tests/mantest tests/jqtest tests/shtest tests/utf8test tests/base64test tests/uritest if !WIN32 TESTS += tests/optionaltest endif AM_TESTS_ENVIRONMENT = JQ=$(abs_builddir)/jq if ENABLE_VALGRIND AM_TESTS_ENVIRONMENT += ENABLE_VALGRIND=1 endif # This is a magic make variable that causes it to treat tests/man.test as a # DATA-type dependency for the check target. As a result, it will attempt to # run any defined targets for tests/man.test as a dependency for check. This # allows us to ensure that the tests are up-to-date if the manual has been updated check_DATA = tests/man.test ### Building the man tests # We use the examples in the manual as additional tests, to ensure they always work. # As a result, we need to rebuild the tests if the manual has been updated. # Making changes to the manpage without having the python deps means your # tests won't run. If you aren't making changes to the examples, you probably # don't care. But if you are, then you need to run the tests anyway. tests/man.test tests/manonig.test: $(srcdir)/docs/content/manual/dev/manual.yml if ENABLE_DOCS $(AM_V_GEN) ( cd ${abs_srcdir}/docs && \ $(PIPENV) run python validate_manual_schema.py content/manual/dev/manual.yml && \ $(PIPENV) run python build_mantests.py ) else @echo Changes to the manual.yml require docs to be enabled to update the manual test. @echo As a result, the manual test is out of date. endif ### Building the manpage # We build the docs from the manpage yml. If no changes have been made to the # manpage, then we'll end up using the cached version. Otherwise, we need to # rebuild it. man_MANS = jq.1 jq.1.prebuilt: $(srcdir)/docs/content/manual/dev/manual.yml if ENABLE_DOCS $(AM_V_GEN) ( cd ${abs_srcdir}/docs && \ $(PIPENV) run python validate_manual_schema.py content/manual/dev/manual.yml && \ $(PIPENV) run python build_manpage.py ) > $@ else @echo Changes to the manual.yml require docs to be enabled to update the manpage. @echo As a result, the manpage is out of date. endif jq.1: jq.1.prebuilt $(AM_V_GEN) cp $(srcdir)/jq.1.prebuilt $@ CLEANFILES += jq.1 ### Build oniguruma if BUILD_ONIGURUMA libjq_la_LIBADD += vendor/oniguruma/src/.libs/libonig.la jq_LDADD += vendor/oniguruma/src/.libs/libonig.la SUBDIRS = vendor/oniguruma endif AM_CFLAGS += $(onig_CFLAGS) if WITH_ONIGURUMA TESTS += tests/onigtest tests/manonigtest endif ### Packaging install-binaries: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-exec DOC_FILES = docs/content docs/public docs/templates \ docs/Pipfile docs/Pipfile.lock docs/build_manpage.py \ docs/build_mantests.py docs/build_website.py docs/README.md \ docs/validate_manual_schema.py docs/manual_schema.yml EXTRA_DIST = $(DOC_FILES) $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) \ jq.1.prebuilt jq.spec src/lexer.c src/lexer.h src/parser.c \ src/parser.h src/version.h src/builtin.jq scripts/version \ libjq.pc \ tests/modules/a.jq tests/modules/b/b.jq tests/modules/c/c.jq \ tests/modules/c/d.jq tests/modules/data.json \ tests/modules/home1/.jq tests/modules/home2/.jq/g.jq \ tests/modules/lib/jq/e/e.jq tests/modules/lib/jq/f.jq \ tests/modules/shadow1.jq tests/modules/shadow2.jq \ tests/modules/syntaxerror/syntaxerror.jq \ tests/modules/test_bind_order.jq \ tests/modules/test_bind_order0.jq \ tests/modules/test_bind_order1.jq \ tests/modules/test_bind_order2.jq \ tests/modules/cycle_a.jq tests/modules/cycle_b.jq \ tests/modules/cycle_self.jq \ tests/onig.supp tests/local.supp \ tests/setup tests/torture/input0.json \ tests/optional.test tests/man.test tests/manonig.test \ tests/jq.test tests/onig.test tests/base64.test tests/uri.test \ tests/jq-f-test.sh \ tests/no-main-program.jq tests/yes-main-program.jq AM_DISTCHECK_CONFIGURE_FLAGS=--with-oniguruma=builtin # README.md is expected in GitHub projects, good stuff in it, so we'll # distribute it and install it with the package in the doc directory. dist_doc_DATA = README.md NEWS.md COPYING AUTHORS pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libjq.pc RELEASE ?= 1 rpm: dist jq.spec @echo "Packaging jq as an RPM ..." mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS cp jq-$(VERSION).tar.gz rpm/SOURCES/ rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $(VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$(VERSION).tar.gz find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \; rm -rf rpm jq-1.8.2/COPYING0000644000175100017510000001731715215513536006671 jq is copyright (C) 2012 Stephen Dolan 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jq's documentation (everything found under the docs/ subdirectory in the source tree) is licensed under the Creative Commons CC BY 3.0 license, which can be found at: https://creativecommons.org/licenses/by/3.0/ The documentation website includes a copy of Twitter's Bootstrap and relies on Bonsai, Liquid templates and various other projects, look them up for detailed licensing conditions. jq incorporates David M. Gay's dtoa.c and g_fmt.c, which bear the following notices: dtoa.c: The author of this software is David M. Gay. Copyright (c) 1991, 2000, 2001 by Lucent Technologies. Permission to use, copy, modify, and distribute this software for any purpose without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software. THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. g_fmt.c: The author of this software is David M. Gay. Copyright (c) 1991, 1996 by Lucent Technologies. Permission to use, copy, modify, and distribute this software for any purpose without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software. THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. jq uses parts of the open source C library "decNumber", which is distributed under the following license: ICU License - ICU 1.8.1 and later COPYRIGHT AND PERMISSION NOTICE Copyright (c) 1995-2005 International Business Machines Corporation and others All rights reserved. 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, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. 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 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. -------------------------------------------------------------------------------- All trademarks and registered trademarks mentioned herein are the property of their respective owners. jv_thread.h is copied from Heimdal's lib/base/heimbase.h and some code in jv.c is copied from Heimdal's lib/base/dll.c: Portions Copyright (c) 2016 Kungliga Tekniska Högskolan (Royal Institute of Technology, Stockholm, Sweden). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 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. jq uses a modified version of NetBSD implementation strptime(), which is distributed under the following license: Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. All rights reserved. This code was contributed to The NetBSD Foundation by Klaus Klein. Heavily optimised by David Laight 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. THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. jq-1.8.2/ChangeLog0000644000175100017510000010100615215513536007375 2015-07-10 Nicolas Williams nico@cryptonector.com Use `include` for import into namespace Simplify import docs Fix typo in docs 2015-07-06 James Andariese james.andariese@locationlabs.com Dockerfile reorganized 2015-07-04 David Tolnay dtolnay@gmail.com Make jq.h usable from C++ 2015-07-03 Nicolas Williams nico@cryptonector.com Document math support 2015-06-30 David Tolnay dtolnay@gmail.com strftime wrong day-of-week (fix #838) 2015-06-28 Nicolas Williams nico@cryptonector.com Document --run-tests Make --run-tests' jv_test() quiet 2015-06-27 Nicolas Williams nico@cryptonector.com Make --run-tests less verbose by default Add more basic number tests Add `pow`, better libm detection (fix #443) 2015-06-27 David Tolnay dtolnay@gmail.com gcov exclusions flag to enable gcov and coveralls add configure option to run tests without valgrind 2015-06-20 David Tolnay dtolnay@gmail.com get Travis CI working 2015-06-26 Nicolas Williams nico@cryptonector.com Add `{$var}` `. as {$var}` syntax (fix #831) Add streaming utilities (fix #827) 2015-06-04 Santiago Lapresta santiago@typeform.com Add combinations/0 and combinations/1 2015-06-22 Nicolas Williams nico@cryptonector.com WriteFile() on WIN32 when stdout isatty (fix #824) 2015-06-19 David Tolnay dtolnay@gmail.com fix errors flagged by clang static analyzer 2015-06-19 Nicolas Williams nico@cryptonector.com Fix #811: use CommandLineToArgvW() and _wfopen() 2015-06-18 David Tolnay dtolnay@gmail.com fix use after free in f_strptime separate jq, oniguruma, sh, and man tests 2015-06-18 Nicolas Williams nico@cryptonector.com argv[] may not be UTF-8 (fix #811) 2015-06-18 Doug Luce doug@github.con.com Add alloca() discovery to configure.ac 2015-06-18 Nicolas Williams nico@cryptonector.com Fix `finites` 2015-06-17 David Tolnay dtolnay@gmail.com fix broken tests in manual.yml 2015-06-17 Nicolas Williams nico@cryptonector.com Add isnormal and related, rename *inf 2015-06-17 Nicolas Williams nico@cryptonector.com Fix #814: raise on div-0, add inf isinf nan isnan 2015-06-17 Nicolas Williams nico@cryptonector.com Sequence parser: wait for RS on startup (fix #687) 2015-06-07 David Tolnay dtolnay@gmail.com array and object destructuring (fix #533) 2015-06-03 Nicolas Williams nico@cryptonector.com Add --tab and -indent n options 2015-05-29 Nicolas Williams nico@cryptonector.com Fixup --slurpfile/argile docs Add --slurpfile Better handling of stdout errors 2015-05-25 Nicolas Williams nico@cryptonector.com Add ./configure --enable-all-static 2015-05-25 Nicolas Williams nico@cryptonector.com Keywords should be OK as object keys (fix #794) 2015-03-04 Travis Gockel travis@gockelhut.com Add wrapping and clamping to jv_array_slice 2015-04-17 Assaf Gordon assafgordon@gmail.com Print offending object in runtime error messages Add filename/line functions to jq (fix #753) 2015-04-17 Assaf Gordon assafgordon@gmail.com Report filename:line on runtime errors (fix #752) 2015-05-19 Nicolas Williams nico@cryptonector.com Document gsub/3 2015-05-03 Nicolas Williams nico@cryptonector.com Add error injection library 2015-04-28 Nicolas Williams nico@cryptonector.com Report read errors too (and fix #772) 2015-05-02 Nicolas Williams nico@cryptonector.com README: send questions to SO and Freenode 2015-04-28 Nicolas Williams nico@cryptonector.com usage() should check fprintf() result (fix #771) 2015-04-28 Nicolas Williams nico@cryptonector.com Fix header guards (fix #770) 2015-04-24 Nicolas Williams nico@cryptonector.com --raw-input wrongly adds NULs (fix #761) 2015-04-23 Nicolas Williams nico@cryptonector.com With `inputs` builtin, -n and -R can now coexist --raw-input ought to read NULs (partial fix #760) --slurp --raw-input is broken (fix #761) from_entries is broken (fix #767) 2015-04-22 Assaf Gordon assafgordon@gmail.com regex functions: report informative error if not available. 2015-04-21 Andrew O'Brien obrien.andrew@gmail.com Fixes manual generation with psych 2015-04-20 Assaf Gordon assafgordon@gmail.com Handle NUL in escaped-string output 2015-04-03 tal@whatexit.org tal@whatexit.org manual.yml: Clarify how to specify keys with ":" and special chars. 2015-04-15 Assaf Gordon assafgordon@gmail.com docs: expand @tsv section - add escape sequences. @tsv: escape \r, \n, \\ 2015-03-30 Nicolas Williams nico@cryptonector.com Add `$__loc__` (fix #740) 2015-03-29 Nicolas Williams nico@cryptonector.com Include filename and lineno in error messages 2015-03-06 Assaf Gordon assafgordon@gmail.com detect and report output writing errors 2015-03-18 Santiago Lapresta santiago.lapresta@gmail.com Adds Dockerfile 2015-03-10 Assaf Gordon assafgordon@gmail.com partial handling of input errors 2015-03-09 Assaf Gordon assafgordon@gmail.com always propagate input errors to exit code 2015-03-23 William Langford wlangfor@gmail.com Fix #735 (SIGFPE on modulo by 0) 2015-03-08 Nicolas Williams nico@cryptonector.com Add more date builtins Automake: jq depends on version.h (fix #721) 2015-03-06 Assaf Gordon assafgordon@gmail.com exit with non-zero code on runtime exceptions 2015-03-06 Nicolas Williams nico@cryptonector.com Add date builtins (fix #364) 2015-02-18 Stefan Seemayer stefan@seemayer.de Correct automake and autoconf version requirements 2015-02-17 Nicolas Williams nico@cryptonector.com Mention --disable-maintainer-mode in bison error 2015-02-16 Sebastian Freundt freundt@ga-group.nl Fix oniguruma detection logic 2015-02-15 Nicolas Williams nico@cryptonector.com Add --disable-maintainer-mode; make bison optional 2015-02-14 Nicolas Williams nico@cryptonector.com Make Oniguruma/regexp optional 2015-02-01 Nicolas Williams nico@cryptonector.com Refactor moar: move parts of main.c into libjq 2014-12-27 Nicolas Williams nico@cryptonector.com Refactor handling of inputs in main() (fix #667) 2015-02-10 Kim Toms kim.toms@bplglobal.net Enhance from_entries to better deal with Amazon AWS Tags 2015-01-26 Nicolas Williams nico@cryptonector.com Usage message for -h should go to stdout 2015-01-27 i isomorphisms@sdf.org readability 2015-01-14 Joel Purra code+github@joelpurra.com Empty arrays join/1 to an empty string, fixes #668 bug introduced by 9760245 2014-12-27 Nicolas Williams nico@cryptonector.com Add `debug` and `stderr` builtins 2015-01-13 Nicolas Williams nico@cryptonector.com join/1: respect empty strings (fix #668) 2015-01-13 Nicolas Williams nico@cryptonector.com Split on empty sep: fix #552 moar 2015-01-12 Nicolas Williams nico@cryptonector.com Fix docs for `split/0` 2015-01-12 Nicolas Williams nico@cryptonector.com Fix #552 2015-01-02 Nicolas Williams nico@cryptonector.com Look for jq/main.jq for imports 2015-01-01 Nicolas Williams nico@cryptonector.com Add static build instructions (fix #294) 2014-12-30 Nicolas Williams nico@cryptonector.com Further module system revamp (fix #659) 2014-12-28 Nicolas Williams nico@cryptonector.com Add `label $name | EXP`; fix `break` 2014-12-30 Nicolas Williams nico@cryptonector.com Remove string indexing by string (fix #454) 2014-12-30 Nicolas Williams nico@cryptonector.com Add support for testing erroneous programs 2014-12-30 Nicolas Williams nico@cryptonector.com Make --run-tests more informative 2014-10-06 pkoppstein pkoppstein@gmail.com transpose/0 for possibly jagged matrices 2014-10-07 pkoppstein pkoppstein@gmail.com bsearch(x) (binary search): builtin.c (tested), with documentation and test case. Always yields an integer (even if input is unsorted); returns (-1 - ix) if x is not in input array. 2014-10-06 pkoppstein pkoppstein@gmail.com ascii_upcase/0 and ascii_downcase/0 2014-12-27 Nicolas Williams nico@cryptonector.com Add `debug` builtin Don't force C API users to set input cb 2014-12-26 Nicolas Williams nico@cryptonector.com Make jq --run-tests show test line numbers Streaming parser torture tests Fuzz JSON parser 2014-12-22 Nicolas Williams nico@cryptonector.com Add Streaming parser (--stream) 2014-12-26 Nicolas Williams nico@cryptonector.com Allow C-coded functions to `empty` Add BLOCK_8() macro Fix `foreach` non-propagation of errors Allow zero-length buffers in jv_parser_set_buf() 2014-12-24 Nicolas Williams nico@cryptonector.com Add @tsv; fix #645 Module search revamp for pkg managers Fix #348: reject unescaped control chars 2014-12-23 Nicolas Williams nico@cryptonector.com Use __attribute__ __printf__ with GCC Make `values` faster (fix #652) 2014-12-22 Marc Abramowitz marc@marc-abramowitz.com .travis.yml: Set sudo false; use containers 2014-12-22 Santiago Lapresta santiago.lapresta@gmail.com Define `map_values` 2014-05-21 Santiago Lapresta santiago.lapresta@gmail.com `in` is now `inside`, added `in` as inverse of `has` 2014-05-20 Santiago Lapresta santiago.lapresta@gmail.com Added `in` command 2014-12-21 Eiichi Sato sato.eiichi@gmail.com Fix examples in manual Fix indents in manual.yml HTML-escape jq programs in manual Fix examples in manual 2014-12-12 Nicolas Williams nico@cryptonector.com Add until(cond; next); fix #639 Add --argjson, fix #648 2014-11-29 Nicolas Williams nico@cryptonector.com Fix refcount leak, fix #618 2014-11-28 Nicolas Williams nico@cryptonector.com STOREV/LOADV* should also print refcnts Enable printing of stack val refcnts Print stack value refcounts when tracing (#636) 2014-11-23 Colin von Heuring colin@janrain.com Doc correction 2014-11-11 Ian Miell ian.miell@gmail.com Requirements made slightly more complete: cf https://github.com/ianmiell/shutit/blob/master/library/jq/jq.py 2014-11-05 Steven Maude StevenMaude@users.noreply.github.com Fix typos in tutorial 2014-10-21 Santiago Lapresta santiago.lapresta@gmail.com Define {any,all}/2 independently from {any,all}/0 2014-10-20 Santiago Lapresta santiago.lapresta@gmail.com Define {any,all}/{0,1} in terms of {any,all}/2 2014-10-10 Nicolas Williams nico@cryptonector.com Add support for JSON sequence MIME type 2014-10-06 William Langford wlangfor@gmail.com Properly call onig_error_code_to_str 2014-10-06 pkoppstein pkoppstein@gmail.com fix sub (#586); add gsub/3; add transpose/0. 2014-10-03 Nicolas Williams nico@cryptonector.com Update docs about sort/group/min/max/unique from-entries should work with EC2 (fix #592) Remove sort/1 and group/1 2014-09-30 Nicolas Williams nico@cryptonector.com to_entries should not sort keys (fix #561) 2014-09-22 William Langford wlangfor@gmail.com Properly handle when objects cannot be folded 2014-08-30 Nicolas Williams nico@cryptonector.com Drop the jq version directory from search path Never close stdin; allow multiple `-` arguments Handle invalid inputs in argument files (fix #562) 2014-08-28 William Langford wlangfor@gmail.com Properly handle incomplete json when input is file 2014-08-10 Nicolas Williams nico@cryptonector.com Add `module` directive, `modulemeta` builtin 2014-08-09 Nicolas Williams nico@cryptonector.com Constant fold objects Fold constant arrays More constant folding: null, true, and false `.foo[-1] = ...` trips assertion (fix #490) Allow any number of jq-coded function arguments 2014-08-08 Nicolas Williams nico@cryptonector.com Make regexp builtins and range/3 use #524 too Use `def f($a): ...;` syntax for builtins Add `def f($arg):` syntax (fix #524) 2014-07-31 pkoppstein pkoppstein@gmail.com regex filters (#432): scan, splits, split, sub, gsub 2014-08-06 Nicolas Williams nico@cryptonector.com Better error msg for bad shell quoting (fix #538) 2014-08-04 William Langford wlangfor@gmail.com Actually check version for bison. 2014-08-03 pkoppstein pkoppstein@gmail.com Apply TCO to recurse/1, add recurse/2; tweak docs 2014-08-01 Adam Lindberg hello@alind.io Add example of selecting object with keys 2014-07-19 pkoppstein pkoppstein@gmail.com Add capture; document regular expression filters 2014-07-28 Nicolas Williams nico@cryptonector.com Add `first`, `nth`, `last` (fix #510) 2014-07-27 Nicolas Williams nico@cryptonector.com Fold constants (fix #504) 2014-07-21 William Langford wlangfor@gmail.com Changing color codes to fix #495 2014-07-09 William Langford wlangfor@gmail.com Added library system with -l, -L, and JQ_LIBRARY_PATH 2014-07-14 Simon Elsbrock simon@iodev.org jq 1.4 is in Debian 2014-07-13 Marc Bruggmann marcbr@spotify.com Fix manual example for `endswith`. 2014-07-09 Hanfei Shen qqshfox@gmail.com Fix examples for `del` in manual 2014-07-08 Zhiming Wang zmwangx@gmail.com Fix invalid YAML in manual.yml Add tests/all.trs to .gitignore 2014-07-09 Nicolas Williams nico@cryptonector.com Better document `path()`'s power; also `|=` Add `foreach EXP as $var (INIT; UPDATE)` form Make `while()` handle `break` 2014-07-07 Nicolas Williams nico@cryptonector.com Make C-coded built-ins take `jq_state *` argument `error(x)` should not `tostring` its arg; fix #466 `limit` should use `break` Make `any/2` and `all/2` efficient using `foreach` 2013-12-24 Nicolas Williams nico@cryptonector.com jv_invalid() shouldn't allocate 2013-12-31 Nicolas Williams nico@cryptonector.com jv_show() should be able to display invalid values 2014-07-07 Nicolas Williams nico@cryptonector.com Add `break` builtin for `foreach` Explain `foreach`'s powers a bit more Document `path(path_expression)` builtin $var["foo"]=1 can't work as expected; doc fix #236 Better check for lib has only functions (fix #138) 2014-07-06 Nicolas Williams nico@cryptonector.com Add `any/N` and `all/N` x N in (1, 2) (fix #455) Add `foreach` and `limit` 2014-07-04 William Langford wlangfor@gmail.com Add support for negative indices for .[]; fix #462 2014-07-06 Nicolas Williams nico@cryptonector.com Add general `?` operator 2014-07-05 Nicolas Williams nico@cryptonector.com Add `try EXP catch EXP` 2014-07-06 Nicolas Williams nico@cryptonector.com Document `error/1` 2014-07-02 Nicolas Williams nico@cryptonector.com Add `while(cond; update)` (fix #314) Add `range(init;upto;by)` (fix #317) 2014-07-01 Nicolas Williams nico@cryptonector.com Describe generators, range() with by to manual 2014-07-01 William Langford wlangfor@gmail.com Fixed base64 issue with UTF-8 strings 2014-06-30 Nicolas Williams nico@cryptonector.com TCO to the max! 2014-06-25 William Langford wlangfor@gmail.com Added cross-compilation script to build libjq for iOS. 2014-06-29 Zhiming Wang zmwangx@gmail.com Let @uri produce uppercase hexadecimal digits... 2014-06-24 Nicolas Williams nico@cryptonector.com Get "Try Online" button working (fix #440) 2014-06-22 Nicolas Williams nico@cryptonector.com Tail call optimization (close #437) 2014-06-20 Nicolas Williams nico@cryptonector.com Allow stacking of short options (fix #346) 2014-06-18 William Langford wlangfor@gmail.com Added regex support as per issue #164. 2014-06-17 Nicolas Williams nico@cryptonector.com Add `-j` / `--join-output` option, similar to `-r` 2014-06-18 Santiago Lapresta santiago.lapresta@gmail.com Simplified standard library 2014-06-16 Nicolas Williams nico@cryptonector.com Fix #280: from_entries of [] is null, should be {} 2014-06-16 Nicolas Williams nico@cryptonector.com No args default w/ tty stdout, not tty stdin #220 2014-06-16 Santiago Lapresta santiago.lapresta@gmail.com Added `flatten` and `flatten(x)` functions 2014-06-16 Nicolas Williams nico@cryptonector.com Add ChangeLog and NEWS files 2014-06-14 Nicolas Williams nico@cryptonector.com Allow multiple functions with different arities 2014-06-13 Nicolas Williams nico@cryptonector.com Add `env` builtin 2014-06-13 Nicolas Williams nico@cryptonector.com Document the lambda nature of function args #391 2014-06-13 Nicolas Williams nico@cryptonector.com Add jqplay link to the site 2014-06-12 Jingwen Owen Ou jingweno@gmail.com jqplay has a domain now 2014-06-12 Nicolas Williams nico@cryptonector.com Make a better jq.1 when Ruby deps missing 2014-06-11 Kim De Mey kim.demey@gmail.com Detect endianness at configuration with Autoconf AC_C_BIGENDIAN feature 2014-06-09 Nicolas Williams Add libm.h to dist file list Add note about cmd.exe quoting Building docs fails on powerpc (#349) 2014-06-08 Nicolas Williams Update site news Also fix configure.ac to use git describe --tags Fix scripts/version: use git describe --tags ... After tagging as 1.4 scripts/version was still producing jq-1.3-.... Add `indices(s)`, improve `index(s)`, `rindex(s)` Now these deal with arrays as input and `s` being an array or a scalar. Improve `index` and `rindex` examples Remove reference to `getpath` from docs Document `index` and `rindex` (#389) 2014-06-07 Santiago Lapresta Added `join` function 2014-06-07 Nicolas Williams String * number should be commutative 2014-06-04 Nicolas Williams Add cross-compilation notes to README A detailed set of instruction as to how to setup a cross-compilation environment for OS X and Win32/64 would be nice. Add -j option to scripts/crosscompile Add flags argument to jv_parser_new() For extensibility. We might add streaming parser options, even binary JSON encoding options. 2014-06-02 Nicolas Williams Fix tests failures on Windows And Solaris 8 and 9 too, no doubt. The problem was that non-standard vsnprintf()s that return -1 when the buffer is too small were not properly supported. 2014-05-20 Santiago Lapresta Documented `del` command 2014-05-11 Santiago Lapresta Added texts/examples to unique_by function Added unique_by function 2014-04-17 Nicolas Williams Make pthread tls configurable for Mingw build For the Mingw build we don't want to pull in the pthread DLL just because we can autodetect pthread support. That would make the jq.exe binary not self-contained. 2014-04-16 Nicolas Williams Add autoconf checks for pthreads; fix #340 2014-03-20 Jingwen Owen Ou Add link to jqplay 2014-03-13 Nicolas Williams Fix for #303 in the sources 2014-03-13 Santiago Lapresta Added `arrays` and other filters Arrays, objects, numbers, strings, booleans, nulls, values (non-nulls) -- these builtins filter out those inputs that don't match the name of the builtin. This fixes #322 and #324. 2014-03-07 Filippo Valsorda Add a recursive object merge strategy and bind it to * This commit adds a jv_object_merge_recursive function, that performs recursive object merging, and binds it to multiply when applied to two objects. Closes #320 2014-03-06 Nicolas Williams Make libm tests more portable 2014-02-26 Andrew Rodland Repair jv_show 2014-02-26 Andrew Rodland Make jq --raw-output --unbuffered work --unbuffered was only affecting the normal output case, not the --raw-output case. Make the two of them play together. This also makes sure that the output is flushed *after* printing the newline, so a consumer doesn't lag a line behind. 2014-02-21 Nicolas Williams Add cbrt (cube root) Add missing trig functions and barebones test Remove non-standard exp10() 2014-02-21 Mike McCabe Initial add of math functions. 2014-02-20 Nicolas Williams Add `?`, `.[]?`, and `..` operators Make XPath-like `//a/b` recursive structure traversal easier in jq, which then becomes: ..|.a?.b? The `?` operator suppresses errors about . not being an array or object. The `..` operator is equivalent to calling the new `recurse_down` built-in, which in turn is equivalent to recurse(.[]?) Note that `..a` is not supported; neither is `...a`. That could be add added, but it doesn't seem worth the trouble of saving the need to type a '|'. 2014-02-16 Santiago Lapresta Added `all` and `any` builtins 2014-01-25 polyester work with newer versions of automake when using a newer automake, the autoreconf step fails with warnings: "linking libtool libraries using a non-POSIX archiver requires 'AM_PROG_AR' in 'configure.ac' " This happens for instance on ubuntu 13.10. Doing just that, adding 'AM_PROG_AR' to configure.ac fixes the problem. 2014-01-01 Nicolas Williams Fix #201; check that bison accepts --warnings 2013-12-27 Joe Littlejohn Fix rpm build (`make rpm`) * Re-add VERSION as it's required for `./setup superclean` and `make rpm`. * Add *.rpm to git ignore, we never want them under version control. 2013-12-27 Filippo Giunchedi include additional files in jq.spec this will probably need changing upon SONAME bump fix rpm Makefile target and prerequisites depend on dist and the specfile, plus use automake's variables 2013-12-26 Nicolas Williams Document --version 2013-12-26 Nicolas Williams Add jv_dumpf() and jv_show() jv_dumpf() takes a FILE *. jv_show() is intended for use in debuggers, so it dumps the jv to stderr and it does not jv_free() the jv, so it's safe to "call jv_show(some_jv, -1)" in a debugger. If flags == -1 then the jv will be shown pretty-printed and in color. 2013-12-26 Nicolas Williams Document .foo.bar in manual Document exit numbers Normalize errors for -e 2013-12-25 Nicolas Williams Fix doc typos (.[foo] wanted to be .["foo"]) Add note to jq.1 about shell quoting 2013-12-20 Philipp Hagemeister Ignore the config/test-driver file This file is automatically generated and does not need to be committed. Fix @uri example Previously, the @uri example didn't match the actual behavior of the current jq, as exclamation marks do not need to be encoded in URIs. Replace the example with an input that needs encoding, and is encoded by jq. 2013-12-17 Stephen Dolan Allow negated object values without parens. Fixes #247 2013-12-17 Nicolas Williams Fix memmem() error 2013-12-13 Rémy Léone Adding a .travis.yml file to use the travis-ci.org From wikipedia: Travis CI is a hosted, distributed continuous integration service used to build and test projects hosted at GitHub. Travis CI is configured by adding a file named .travis.yml, which is a YAML format text file, to the root directory of the GitHub repository. Travis CI automatically detects when a commit has been made and pushed to a GitHub repository that is using Travis CI, and each time this happens, it will try to build the project and run tests. This includes commits to all branches, not just to the master branch. When that process has completed, it will notify a developer in the way it has been configured to do so — for example, by sending an email containing the test results (showing success or failure), or by posting a message on an IRC channel. It can be configured to run the tests on a range of different machines, with different software installed (such as older versions of a programming language, to test for compatibility). 2013-12-13 Stephen Dolan Make the testsuite run on machines without valgrind Format more integers as integers, not scientific notation. jq is now willing to put up to 15 zeros after an integer before moving to scientific notation. 2013-12-11 Nicolas Williams Complete more-arity feature not complete And test 2013-12-10 David R. MacIver convert range bounds to integers in a way that avoids undefined behaviour add checking of numeric indices to an array to see if they can reasonably be considered integers. Avoid undefined behaviour if out of bounds 2013-12-09 David R. MacIver some functions were missing prototypes. Add them 2013-12-08 David R. MacIver These vfprintfs are being used as if they were printfs. Fix that consistent use of goto out in main 2013-12-08 Stephen Dolan Refactor jv structure. New structure layout is simpler and also faster. In particular, it's now small enough to be passed in registers on amd64. Make testsuite not leak when compiled with -DNDEBUG. 2013-12-08 David R. MacIver test for losing memory on compile errors args to jq_compile_args were not getting freed when there were errors in the compile 2013-12-06 Nicolas Williams Fix double-free typo in print_error() Fix manual.yml 2013-12-04 Nicolas Williams Conditionally #define _GNU_SOURCE in compile.c Add tests for string index by string and builtins Add index and rindex builtins Add index strings by string; return string indexes % jq '.[","]' "a,bc,def,ghij,klmno" [1,4,8,13] % Make length return abs value of numeric inputs Add callback interface for errors Printing to stderr is not the right answer for a library. Add jv_string_vfmt() Document ltrimstr and rtrimstr Test ltrimstr and rtrimstr functions Add ltrimstr and rtrimstr functions Document -e / --exit-status argument Add -e | --exit-status CLI option Document tojson and fromjson builtins Test tojson and fromjson Add tojson and fromjson builtins Document split function Document string multiplication and division Document string functions and slicing Test string slicing Add string slicing Add tests for string division/splitting Add string division by string (split on separator) Test starts/endswith and string multiplication Add string multiplication by number Add startswith/endswith Add explode/implode jq functions to match jv API Use uint32_t for codepoint in jv_string_append_codepoint() Add jv string utility functions jv_string_empty() -> return an empty string with given allocated length (for fast appends) jv_string_append_codepoint -> append a single codepoint (int) to the given string jv_string_explode -> return an array of codepoints making up a string jv_string_implode -> return the UTF-8 encoding of an array of codepoint numbers Support more arguments for defs 2013-12-04 Stephen Dolan Preserve insertion order in objects. Closes #169. 2013-11-30 Nicolas Pouillard Add a few more test cases (from the man page) 2013-11-08 Stephen Dolan Add a --unbuffered option. Closes #206 2013-11-07 Peter van Dijk count should be length Example refers to a count function, which does not exist. Replacing it with length works. 2013-11-07 Stephen Dolan Fix a crash on group_by of empty list. Fixes #208. 2013-10-16 Ryoichi KATO Docs: add description of --from-file option 2013-10-06 Juan Guerrero Fix typo on error message 2013-09-19 Kenny Shen Add missing -i flag in build instructions 2013-09-14 Michael Daines Add test showing calculation of standard deviation 2013-09-13 Mike Daines Fix typo 2013-09-11 Michael Daines Add sqrt operator 2013-09-04 Jack Pearkes docs: update the tutorial to use GitHub's API 2013-09-01 Ankur Call AM_INIT_AUTOMAKE once only Fixes build with automake-1.14 2013-08-19 Joe Littlejohn Fix Makefile after refactoring of stacks in 05d90517b02 2013-06-23 Stephen Dolan Remove #includes from jv.h Fix the jv_parser interface. Use libtool's built-in symbol exporting rather than a mapfile. Move gen_utf8_tables to scripts Move libtool m4 junk to config/ and delete some autogenerated files. Remove Autoconf-generated config.h. 2013-06-22 Stephen Dolan Build libjq only once, and link it statically to ./jq This means ./jq is a real binary rather than a libtool turd. Fix distcheck. Update list of files to be distributed. Utf8 fixes. Closes #161 Reject all overlong UTF8 sequences. Fix various UTF8 parsing bugs. In particular, parse bad UTF8 by replacing the broken bits with U+FFFD and resynchronise correctly after broken sequences. Fix example in manual for `floor`. See #155. 2013-06-21 Nicolas Williams Document floor Add floor operator Document mod Add mod (and setmod) operators Update .gitignore Add libjq autoconf goo Quiet setup.sh re: tmp dir 2013-06-21 Stephen Dolan Move cfunction invocation code to the interpreter loop. 2013-06-18 Nicolas Williams Fix serious bug in handling of --argfile Fix leaks in jv_load_file() 2013-06-17 Stephen Dolan Fold opcode.{c,h} into bytecode.{c,h} Simplify block functions for variables Saner build instructions in README.md Closes #144 Remove some initialise-to-zero code. This lets valgrind find more bugs - if a field isn't given a well-defined value valgrind will now find it instead of seeing it set to zero with memset. 2013-06-17 Nicolas Williams Remove accidentally introduced use of fopen "e" 2013-06-16 Stephen Dolan Merge pull request #114 from nicowilliams/nomem_handler Add jv_nomem_handler() 2013-06-16 Nicolas Williams Remove last remnant of main.h 2013-06-15 Nicolas Williams Allow --run-tests to take a file argument Fixup API to get closer to a libjq 2013-06-15 Nicolas Williams Move slurp_file() into library as jv_load_file() Needed as part of creating a libjq. 2013-06-14 Stephen Dolan Clean up lots of stack and frame logic. Move frame defs to execute.c 2013-06-13 Stephen Dolan Simplify frame logic. Unify all stacks. Passes tests, but needs cleanup. 2013-06-11 Stephen Dolan Support ."foo" syntax for accessing fields. See #141. 2013-06-09 Stephen Dolan Unify frame and data stacks 2013-06-05 Stephen Dolan Speed up cached configure (./configure -C) Clean up flex lines in build Lex and parse .foo better. '.as' is now valid, '. foo' is now invalid. See #141. 2013-06-04 Markus Lanthaler Update README.md Update the link to the documentation. All GitHub pages are now using the github.io domain. 2013-06-03 Stephen Dolan Make jq --version print to stdout, not stderr Better error handling for .foo case in parser. See #141. Let the parser rather than the lexer handle invalid characters. Add command-line option to sort object keys. Closes #79. Clean up Makefile.am (distcheck, rebuild version.h less often) 2013-05-31 Brendan Macmillan Stop warning on fgets, simple version Stop warning on fgets, complex version 2013-05-31 Stephen Dolan Squash a warning on some GCC versions 2013-05-29 Stephen Dolan Support for printing object keys in sorted order. No command-line option to enable this yet. See #79. 2013-05-29 Brendan Macmillan Bugfix multiline off-by-one (locfile.c) locfile.h -> locfile.h + locfile.c clean up includes of a few files Hack bugfix for multiline off-by-one (locfile.c) Load library from ~/.jq 2013-05-24 Stephen Dolan Make jq --version report an actual git revision. Closes #129. 2013-05-23 Nicolas Williams Add --argfile variant of --arg (issue #117) This is useful when one has a database (in JSON form) to query using jq input data. % echo '{"a":1, "c":5}' > db.json % echo '"c"'|./jq --argfile f /tmp/a '$f[.]' 5 % echo '"a"'|./jq --argfile f /tmp/a '$f[.]' 1 % echo '"b"'|./jq --argfile f /tmp/a '$f[.]' null % 2013-05-23 Stephen Dolan 'make clean' won't delete jq.1 if it can't be rebuilt. See #131 jq-1.8.2/tests/0000755000175100017510000000000015215513665007052 5jq-1.8.2/tests/local.supp0000644000175100017510000000037415215513536010776 { macos valgrind 1 Memcheck:Leak match-leak-kinds: possible fun:calloc fun:map_images_nolock ... fun:_dyld_objc_notify_register fun:_objc_init fun:_os_object_init fun:libdispatch_init fun:libSystem_initializer ... } jq-1.8.2/tests/torture/0000755000175100017510000000000015215513665010556 5jq-1.8.2/tests/torture/input0.json0000644000175100017510000000022715215513536012606 0 12 true false null [] {} [{}] [[]] [0,01,[12,22,[34,[45,56],7]],[]] {"a":[1]} {"a":[{}]} {"a":[{},[],[[]]]} {"a":[{"b":[]}]} {"a":[{"b":[]},{},[2]]} jq-1.8.2/tests/jq.test0000644000175100017510000014600615215513536010311 # Tests are groups of three lines: program, input, expected output # Blank lines and lines starting with # are ignored # # Simple value tests to check parser. Input is irrelevant # true null true false null false null 42 null 1 null 1 -1 null -1 # FIXME: much more number testing needed {} null {} [] null [] {x:-1},{x:-.},{x:-.|abs} 1 {"x":-1} {"x":-1} {"x":1} # The input line starts with a 0xFEFF (byte order mark) codepoint # No, there is no reason to have a byte order mark in UTF8 text. # But apparently people do, so jq shouldn't break on it. . "byte order mark" "byte order mark" # We test escapes by matching them against Unicode codepoints # FIXME: more tests needed for weird unicode stuff (e.g. utf16 pairs) "Aa\r\n\t\b\f\u03bc" null "Aa\u000d\u000a\u0009\u0008\u000c\u03bc" . "Aa\r\n\t\b\f\u03bc" "Aa\u000d\u000a\u0009\u0008\u000c\u03bc" %%FAIL "u\vw" jq: error: Invalid escape at line 1, column 4 (while parsing '"\v"') at , line 1, column 3: "u\vw" ^^ "inter\("pol" + "ation")" null "interpolation" @text,@json,([1,.]|@csv,@tsv),@html,(@uri|.,@urid),@sh,(@base64|.,@base64d) "!()<>&'\"\t" "!()<>&'\"\t" "\"!()<>&'\\\"\\t\"" "1,\"!()<>&'\"\"\t\"" "1\t!()<>&'\"\\t" "!()<>&'"\t" "%21%28%29%3C%3E%26%27%22%09" "!()<>&'\"\t" "'!()<>&'\\''\"\t'" "ISgpPD4mJyIJ" "!()<>&'\"\t" # regression test for #436 @base64 "foóbar\n" "Zm/Ds2Jhcgo=" @base64d "Zm/Ds2Jhcgo=" "foóbar\n" @uri "\u03bc" "%CE%BC" @urid "%CE%BC" "\u03bc" @html "\(.)" "" "<script>hax</script>" [.[]|tojson|fromjson] ["foo", 1, ["a", 1, "b", 2, {"foo":"bar"}]] ["foo",1,["a",1,"b",2,{"foo":"bar"}]] # # Dictionary construction syntax # {a: 1} null {"a":1} {a,b,(.d):.a,e:.b} {"a":1, "b":2, "c":3, "d":"c"} {"a":1, "b":2, "c":1, "e":2} {"a",b,"a$\(1+1)"} {"a":1, "b":2, "c":3, "a$2":4} {"a":1, "b":2, "a$2":4} %%FAIL {(0):1} jq: error: Cannot use number (0) as object key at , line 1, column 3: {(0):1} ^ %%FAIL {1+2:3} jq: error: May need parentheses around object key expression at , line 1, column 2: {1+2:3} ^^^ %%FAIL {non_const:., (0):1} jq: error: Cannot use number (0) as object key at , line 1, column 16: {non_const:., (0):1} ^ # # Field access, piping # .foo {"foo": 42, "bar": 43} 42 .foo | .bar {"foo": {"bar": 42}, "bar": "badvalue"} 42 .foo.bar {"foo": {"bar": 42}, "bar": "badvalue"} 42 .foo_bar {"foo_bar": 2} 2 .["foo"].bar {"foo": {"bar": 42}, "bar": "badvalue"} 42 ."foo"."bar" {"foo": {"bar": 20}} 20 .e0, .E1, .E-1, .E+1 {"e0": 1, "E1": 2, "E": 3} 1 2 2 4 [.[]|.foo?] [1,[2],{"foo":3,"bar":4},{},{"foo":5}] [3,null,5] [.[]|.foo?.bar?] [1,[2],[],{"foo":3},{"foo":{"bar":4}},{}] [4,null] [..] [1,[[2]],{ "a":[1]}] [[1,[[2]],{"a":[1]}],1,[[2]],[2],2,{"a":[1]},[1],1] [.[]|.[]?] [1,null,[],[1,[2,[[3]]]],[{}],[{"a":[1,[2]]}]] [1,[2,[[3]]],{},{"a":[1,[2]]}] [.[]|.[1:3]?] [1,null,true,false,"abcdef",{},{"a":1,"b":2},[],[1,2,3,4,5],[1,2]] [null,"bc",[],[2,3],[2]] # chaining/suffix-list, with and without dot map(try .a[] catch ., try .a.[] catch ., .a[]?, .a.[]?) [{"a": [1,2]}, {"a": 123}] [1,2,1,2,1,2,1,2,"Cannot iterate over number (123)","Cannot iterate over number (123)"] # oss-fuzz #66070: objects[] leaks if a non-last element throws an error try ["OK", (.[] | error)] catch ["KO", .] {"a":["b"],"c":["d"]} ["KO",["b"]] # # Negative array indices # try (.foo[-1] = 0) catch . null "Out of bounds negative array index" try (.foo[-2] = 0) catch . null "Out of bounds negative array index" .[-1] = 5 [0,1,2] [0,1,5] .[-2] = 5 [0,1,2] [0,5,2] try (.[999999999] = 0) catch . null "Array index too large" # # Multiple outputs, iteration # .[] [1,2,3] 1 2 3 1,1 [] 1 1 1,. [] 1 [] [.] [2] [[2]] [[2]] [3] [[2]] [{}] [2] [{}] [.[]] ["a"] ["a"] [(.,1),((.,.[]),(2,3))] ["a","b"] [["a","b"],1,["a","b"],"a","b",2,3] [([5,5][]),.,.[]] [1,2,3] [5,5,[1,2,3],1,2,3] {x: (1,2)},{x:3} | .x null 1 2 3 [.[-4,-3,-2,-1,0,1,2,3]] [1,2,3] [null,1,2,3,1,2,3,null] [range(0;10)] null [0,1,2,3,4,5,6,7,8,9] [range(0,1;3,4)] null [0,1,2, 0,1,2,3, 1,2, 1,2,3] [range(0;10;3)] null [0,3,6,9] [range(0;10;-1)] null [] [range(0;-5;-1)] null [0,-1,-2,-3,-4] [range(0,1;4,5;1,2)] null [0,1,2,3,0,2, 0,1,2,3,4,0,2,4, 1,2,3,1,3, 1,2,3,4,1,3] [while(.<100; .*2)] 1 [1,2,4,8,16,32,64] [(label $here | .[] | if .>1 then break $here else . end), "hi!"] [0,1,2] [0,1,"hi!"] [(label $here | .[] | if .>1 then break $here else . end), "hi!"] [0,2,1] [0,"hi!"] %%FAIL . as $foo | break $foo jq: error: $*label-foo is not defined at , line 1, column 13: . as $foo | break $foo ^^^^^^^^^^ [.[]|[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]] [1,2,3,4,5] [1,2,6,24,120] [label $out | foreach .[] as $item ([3, null]; if .[0] < 1 then break $out else [.[0] -1, $item] end; .[1])] [11,22,33,44,55,66,77,88,99] [11,22,33] [foreach range(5) as $item (0; $item)] null [0,1,2,3,4] [foreach .[] as [$i, $j] (0; . + $i - $j)] [[2,1], [5,3], [6,4]] [1,3,5] [foreach .[] as {a:$a} (0; . + $a; -.)] [{"a":1}, {"b":2}, {"a":3, "b":4}] [-1, -1, -4] [-foreach -.[] as $x (0; . + $x)] [1,2,3] [1,3,6] [foreach .[] / .[] as $i (0; . + $i)] [1,2] [1,3,3.5,4.5] [foreach .[] as $x (0; . + $x) as $x | $x] [1,2,3] [1,3,6] [limit(3; .[])] [11,22,33,44,55,66,77,88,99] [11,22,33] [limit(0; error)] "badness" [] [limit(1; 1, error)] "badness" [1] try limit(-1; error) catch . null "limit doesn't support negative count" [skip(3; .[])] [1,2,3,4,5,6,7,8,9] [4,5,6,7,8,9] [skip(0,2,3,4; .[])] [1,2,3] [1,2,3,3] [skip(3; .[])] [] [] try skip(-1; error) catch . null "skip doesn't support negative count" nth(1; 0,1,error("foo")) null 1 [first(range(.)), last(range(.))] 10 [0,9] [first(range(.)), last(range(.))] 0 [] [nth(0,5,9,10,15; range(.)), try nth(-1; range(.)) catch .] 10 [0,5,9,"nth doesn't support negative indices"] # Check that first(g) does not extract more than one value from g first(1,error("foo")) null 1 # # Check that various builtins evaluate all arguments where appropriate, # doing cartesian products where appropriate. # # Check that limit does work for each value produced by n! [limit(5,7; range(9))] null [0,1,2,3,4,0,1,2,3,4,5,6] # Same check for nth [nth(5,7; range(9;0;-1))] null [4,2] # Same check for range/3 [range(0,1,2;4,3,2;2,3)] null [0,2,0,3,0,2,0,0,0,1,3,1,1,1,1,1,2,2,2,2] # Same check for range/1 [range(3,5)] null [0,1,2,0,1,2,3,4] # Same check for index/1, rindex/1, indices/1 [(index(",","|"), rindex(",","|")), indices(",","|")] "a,b|c,d,e||f,g,h,|,|,i,j" [1,3,22,19,[1,5,7,12,14,16,18,20,22],[3,9,10,17,19]] # Same check for join/1 join(",","/") ["a","b","c","d"] "a,b,c,d" "a/b/c/d" [.[]|join("a")] [[],[""],["",""],["","",""]] ["","","a","aa"] # Same check for flatten/1 flatten(3,2,1) [0, [1], [[2]], [[[3]]]] [0,1,2,3] [0,1,2,[3]] [0,1,[2],[[3]]] # # Slices # [.[3:2], .[-5:4], .[:-2], .[-2:], .[3:3][1:], .[10:]] [0,1,2,3,4,5,6] [[], [2,3], [0,1,2,3,4], [5,6], [], []] [.[3:2], .[-5:4], .[:-2], .[-2:], .[3:3][1:], .[10:]] "abcdefghi" ["","","abcdefg","hi","",""] del(.[2:4],.[0],.[-2:]) [0,1,2,3,4,5,6,7] [1,4,5] .[2:4] = ([], ["a","b"], ["a","b","c"]) [0,1,2,3,4,5,6,7] [0,1,4,5,6,7] [0,1,"a","b",4,5,6,7] [0,1,"a","b","c",4,5,6,7] # Slices at large offsets (issue #1108) # # This is written this way because [range()] is # significantly slower under valgrind than .[] = value. # # We range down rather than up so that we have just one realloc. reduce range(65540;65536;-1) as $i ([]; .[$i] = $i)|.[65536:] null [null,65537,65538,65539,65540] # # Variables # 1 as $x | 2 as $y | [$x,$y,$x] null [1,2,1] [1,2,3][] as $x | [[4,5,6,7][$x]] null [5] [6] [7] 42 as $x | . | . | . + 432 | $x + 1 34324 43 1 + 2 as $x | -$x null -3 "x" as $x | "a"+"y" as $y | $x+","+$y null "x,ay" 1 as $x | [$x,$x,$x as $x | $x] null [1,1,1] [1, {c:3, d:4}] as [$a, {c:$b, b:$c}] | $a, $b, $c null 1 3 null . as {as: $kw, "str": $str, ("e"+"x"+"p"): $exp} | [$kw, $str, $exp] {"as": 1, "str": 2, "exp": 3} [1, 2, 3] .[] as [$a, $b] | [$b, $a] [[1], [1, 2, 3]] [null, 1] [2, 1] . as $i | . as [$i] | $i [0] 0 . as [$i] | . as $i | $i [0] [0] %%FAIL . as [] | null jq: error: syntax error, unexpected ']', expecting BINDING or '[' or '{' at , line 1, column 7: . as [] | null ^ %%FAIL . as {} | null jq: error: syntax error, unexpected '}' at , line 1, column 7: . as {} | null ^ %%FAIL . as $foo | [$foo, $bar] jq: error: $bar is not defined at , line 1, column 20: . as $foo | [$foo, $bar] ^^^^ %%FAIL . as {(true):$foo} | $foo jq: error: Cannot use boolean (true) as object key at , line 1, column 8: . as {(true):$foo} | $foo ^^^^ # [.,(.[] | {x:.},.),.,.[]] # # Builtin functions # 1+1 null 2 1+1 "wtasdf" 2.0 2-1 null 1 2-(-1) null 3 1e+0+0.001e3 "I wonder what this will be?" 20e-1 .+4 15 19.0 .+null {"a":42} {"a":42} null+. null null .a+.b {"a":42} 42 [1,2,3] + [.] null [1,2,3,null] {"a":1} + {"b":2} + {"c":3} "asdfasdf" {"a":1, "b":2, "c":3} "asdf" + "jkl;" + . + . + . "some string" "asdfjkl;some stringsome stringsome string" "\u0000\u0020\u0000" + . "\u0000\u0020\u0000" "\u0000 \u0000\u0000 \u0000" 42 - . 11 31 [1,2,3,4,1] - [.,3] 1 [2,4] [-1 as $x | 1,$x] null [1,-1] [10 * 20, 20 / .] 4 [200, 5] 1 + 2 * 2 + 10 / 2 null 10 [16 / 4 / 2, 16 / 4 * 2, 16 - 4 - 2, 16 - 4 + 2] null [2, 8, 10, 14] 1e-19 + 1e-20 - 5e-21 null 1.05e-19 1 / 1e-17 null 1e+17 9E999999999, 9999999999E999999990, 1E-999999999, 0.000000001E-999999990 null 9E+999999999 9.999999999E+999999999 1E-999999999 1E-999999999 5E500000000 > 5E-5000000000, 10000E500000000 > 10000E-5000000000 null true true # #2825 (1e999999999, 10e999999999) > (1e-1147483646, 0.1e-1147483646) null true true true true 25 % 7 null 4 49732 % 472 null 172 [(infinite, -infinite) % (1, -1, infinite)] null [0,0,0,0,0,-1] [nan % 1, 1 % nan | isnan] null [true,true] 1 + tonumber + ("10" | tonumber) 4 15 "123\u0000456" | try tonumber catch . null "string (\"123\\u0000456\") cannot be parsed as a number" map(toboolean) ["false","true",false,true] [false,true,false,true] .[] | try toboolean catch . [null,0,"tru","truee","fals","falsee",[],{}] "null (null) cannot be parsed as a boolean" "number (0) cannot be parsed as a boolean" "string (\"tru\") cannot be parsed as a boolean" "string (\"truee\") cannot be parsed as a boolean" "string (\"fals\") cannot be parsed as a boolean" "string (\"falsee\") cannot be parsed as a boolean" "array ([]) cannot be parsed as a boolean" "object ({}) cannot be parsed as a boolean" "true\u0000x", "false\u0000" | try toboolean catch . null "string (\"true\\u0000x\") cannot be parsed as a boolean" "string (\"false\\u0000\") cannot be parsed as a boolean" [{"a":42},.object,10,.num,false,true,null,"b",[1,4]] | .[] as $x | [$x == .[]] {"object": {"a":42}, "num":10.0} [true, true, false, false, false, false, false, false, false] [true, true, false, false, false, false, false, false, false] [false, false, true, true, false, false, false, false, false] [false, false, true, true, false, false, false, false, false] [false, false, false, false, true, false, false, false, false] [false, false, false, false, false, true, false, false, false] [false, false, false, false, false, false, true, false, false] [false, false, false, false, false, false, false, true, false] [false, false, false, false, false, false, false, false, true ] [.[] | length] [[], {}, [1,2], {"a":42}, "asdf", "\u03bc"] [0, 0, 2, 1, 4, 1] utf8bytelength "asdf\u03bc" 6 [.[] | try utf8bytelength catch .] [[], {}, [1,2], 55, true, false] ["array ([]) only strings have UTF-8 byte length","object ({}) only strings have UTF-8 byte length","array ([1,2]) only strings have UTF-8 byte length","number (55) only strings have UTF-8 byte length","boolean (true) only strings have UTF-8 byte length","boolean (false) only strings have UTF-8 byte length"] map(keys) [{}, {"abcd":1,"abc":2,"abcde":3}, {"x":1, "z": 3, "y":2}] [[], ["abc","abcd","abcde"], ["x","y","z"]] [1,2,empty,3,empty,4] null [1,2,3,4] map(add) [[], [1,2,3], ["a","b","c"], [[3],[4,5],[6]], [{"a":1}, {"b":2}, {"a":3}]] [null, 6, "abc", [3,4,5,6], {"a":3, "b": 2}] map_values(.+1) [0,1,2] [1,2,3] [add(null), add(range(range(10))), add(empty), add(10,range(10))] null [null,120,null,55] # Real-world use case for add(empty) .sum = add(.arr[]) {"arr":[]} {"arr":[],"sum":null} add({(.[]):1}) | keys ["a","a","b","a","d","b","d","a","d"] ["a","b","d"] # # User-defined functions # Oh god. # def f: . + 1; def g: def g: . + 100; f | g | f; (f | g), g 3.0 106.0 105.0 def f: (1000,2000); f 123412345 1000 2000 def f(a;b;c;d;e;f): [a+1,b,c,d,e,f]; f(.[0];.[1];.[0];.[0];.[0];.[0]) [1,2] [2,2,1,1,1,1] def f: 1; def g: f, def f: 2; def g: 3; f, def f: g; f, g; def f: 4; [f, def f: g; def g: 5; f, g]+[f,g] null [4,1,2,3,3,5,4,1,2,3,3] # Test precedence of 'def' vs '|' def a: 0; . | a null 0 # Many arguments def f(a;b;c;d;e;f;g;h;i;j): [j,i,h,g,f,e,d,c,b,a]; f(.[0];.[1];.[2];.[3];.[4];.[5];.[6];.[7];.[8];.[9]) [0,1,2,3,4,5,6,7,8,9] [9,8,7,6,5,4,3,2,1,0] ([1,2] + [4,5]) [1,2,3] [1,2,4,5] true [1] true null,1,null "hello" null 1 null [1,2,3] [5,6] [1,2,3] [.[]|floor] [-1.1,1.1,1.9] [-2, 1, 1] [.[]|sqrt] [4,9] [2,3] (add / length) as $m | map((. - $m) as $d | $d * $d) | add / length | sqrt [2,4,4,4,5,5,7,9] 2 # Should write a test that calls the -lm function from C (or bc(1)) to # check that they match the corresponding jq functions. However, # there's so little template code standing between that it suffices to # test a handful of these. The results were checked by eye against # bc(1). atan * 4 * 1000000|floor / 1000000 1 3.141592 [(3.141592 / 2) * (range(0;20) / 20)|cos * 1000000|floor / 1000000] null [1,0.996917,0.987688,0.972369,0.951056,0.923879,0.891006,0.85264,0.809017,0.760406,0.707106,0.649448,0.587785,0.522498,0.45399,0.382683,0.309017,0.233445,0.156434,0.078459] [(3.141592 / 2) * (range(0;20) / 20)|sin * 1000000|floor / 1000000] null [0,0.078459,0.156434,0.233445,0.309016,0.382683,0.45399,0.522498,0.587785,0.649447,0.707106,0.760405,0.809016,0.85264,0.891006,0.923879,0.951056,0.972369,0.987688,0.996917] def f(x): x | x; f([.], . + [42]) [1,2,3] [[[1,2,3]]] [[1,2,3],42] [[1,2,3,42]] [1,2,3,42,42] # test multiple function arities and redefinition def f: .+1; def g: f; def f: .+100; def f(a):a+.+11; [(g|f(20)), f] 1 [33,101] # test closures and lexical scoping def id(x):x; 2000 as $x | def f(x):1 as $x | id([$x, x, x]); def g(x): 100 as $x | f($x,$x+x); g($x) "more testing" [1,100,2100.0,100,2100.0] # test def f($a) syntax def x(a;b): a as $a | b as $b | $a + $b; def y($a;$b): $a + $b; def check(a;b): [x(a;b)] == [y(a;b)]; check(.[];.[]*2) [1,2,3] true # test backtracking through function calls and returns # this test is *evil* [[20,10][1,0] as $x | def f: (100,200) as $y | def g: [$x + $y, .]; . + $x | g; f[0] | [f][0][1] | f] 999999999 [[110.0, 130.0], [210.0, 130.0], [110.0, 230.0], [210.0, 230.0], [120.0, 160.0], [220.0, 160.0], [120.0, 260.0], [220.0, 260.0]] # test recursion def fac: if . == 1 then 1 else . * (. - 1 | fac) end; [.[] | fac] [1,2,3,4] [1,2,6,24] # test stack overflow and reallocation # this test is disabled for now, it takes a realllllly long time. # def f: if length > 1000 then . else .+[1]|f end; f | length # [] # 1001 reduce .[] as $x (0; . + $x) [1,2,4] 7 reduce .[] as [$i, {j:$j}] (0; . + $i - $j) [[2,{"j":1}], [5,{"j":3}], [6,{"j":4}]] 5 reduce [[1,2,10], [3,4,10]][] as [$i,$j] (0; . + $i * $j) null 14 [-reduce -.[] as $x (0; . + $x)] [1,2,3] [6] [reduce .[] / .[] as $i (0; . + $i)] [1,2] [4.5] reduce .[] as $x (0; . + $x) as $x | $x [1,2,3] 6 # This, while useless, should still compile. reduce . as $n (.; .) null null # Destructuring . as {$a, b: [$c, {$d}]} | [$a, $c, $d] {"a":1, "b":[2,{"d":3}]} [1,2,3] . as {$a, $b:[$c, $d]}| [$a, $b, $c, $d] {"a":1, "b":[2,{"d":3}]} [1,[2,{"d":3}],2,{"d":3}] # Destructuring with alternation .[] | . as {$a, b: [$c, {$d}]} ?// [$a, {$b}, $e] ?// $f | [$a, $b, $c, $d, $e, $f] [{"a":1, "b":[2,{"d":3}]}, [4, {"b":5, "c":6}, 7, 8, 9], "foo"] [1, null, 2, 3, null, null] [4, 5, null, null, 7, null] [null, null, null, null, null, "foo"] # Destructuring DUP/POP issues .[] | . as {a:$a} ?// {a:$a} ?// {a:$a} | $a [[3],[4],[5],6] # Runtime error: "jq: Cannot index array with string (\"c\")" .[] as {a:$a} ?// {a:$a} ?// {a:$a} | $a [[3],[4],[5],6] # Runtime error: "jq: Cannot index array with string (\"c\")" [[3],[4],[5],6][] | . as {a:$a} ?// {a:$a} ?// {a:$a} | $a null # Runtime error: "jq: Cannot index array with string (\"c\")" [[3],[4],[5],6] | .[] as {a:$a} ?// {a:$a} ?// {a:$a} | $a null # Runtime error: "jq: Cannot index array with string (\"c\")" .[] | . as {a:$a} ?// {a:$a} ?// $a | $a [[3],[4],[5],6] [3] [4] [5] 6 .[] as {a:$a} ?// {a:$a} ?// $a | $a [[3],[4],[5],6] [3] [4] [5] 6 [[3],[4],[5],6][] | . as {a:$a} ?// {a:$a} ?// $a | $a null [3] [4] [5] 6 [[3],[4],[5],6] | .[] as {a:$a} ?// {a:$a} ?// $a | $a null [3] [4] [5] 6 .[] | . as {a:$a} ?// $a ?// {a:$a} | $a [[3],[4],[5],6] [3] [4] [5] 6 .[] as {a:$a} ?// $a ?// {a:$a} | $a [[3],[4],[5],6] [3] [4] [5] 6 [[3],[4],[5],6][] | . as {a:$a} ?// $a ?// {a:$a} | $a null [3] [4] [5] 6 [[3],[4],[5],6] | .[] as {a:$a} ?// $a ?// {a:$a} | $a null [3] [4] [5] 6 .[] | . as $a ?// {a:$a} ?// {a:$a} | $a [[3],[4],[5],6] [3] [4] [5] 6 .[] as $a ?// {a:$a} ?// {a:$a} | $a [[3],[4],[5],6] [3] [4] [5] 6 [[3],[4],[5],6][] | . as $a ?// {a:$a} ?// {a:$a} | $a null [3] [4] [5] 6 [[3],[4],[5],6] | .[] as $a ?// {a:$a} ?// {a:$a} | $a null [3] [4] [5] 6 . as $dot|any($dot[];not) [1,2,3,4,true,false,1,2,3,4,5] true . as $dot|any($dot[];not) [1,2,3,4,true] false . as $dot|all($dot[];.) [1,2,3,4,true,false,1,2,3,4,5] false . as $dot|all($dot[];.) [1,2,3,4,true] true # Check short-circuiting any(true, error; .) "badness" true all(false, error; .) "badness" false any(not) [] false all(not) [] true any(not) [false] true all(not) [false] true [any,all] [] [false,true] [any,all] [true] [true,true] [any,all] [false] [false,false] [any,all] [true,false] [true,false] [any,all] [null,null,true] [true,false] # # Paths # path(.foo[0,1]) null ["foo", 0] ["foo", 1] path(.[] | select(.>3)) [1,5,3] [1] path(.) 42 [] try path(.a | map(select(.b == 0))) catch . {"a":[{"b":0}]} "Invalid path expression with result [{\"b\":0}]" try path(.a | map(select(.b == 0)) | .[0]) catch . {"a":[{"b":0}]} "Invalid path expression near attempt to access element 0 of [{\"b\":0}]" try path(.a | map(select(.b == 0)) | .c) catch . {"a":[{"b":0}]} "Invalid path expression near attempt to access element \"c\" of [{\"b\":0}]" try path(.a | map(select(.b == 0)) | .[]) catch . {"a":[{"b":0}]} "Invalid path expression near attempt to iterate through [{\"b\":0}]" path(.a[path(.b)[0]]) {"a":{"b":0}} ["a","b"] [paths] [1,[[],{"a":2}]] [[0],[1],[1,0],[1,1],[1,1,"a"]] ["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p]) {"bar": 42, "foo": ["a", "b", "c", "d"]} "b" {"bar": 42, "foo": ["a", 20, "c", "d"]} {"bar": 42, "foo": ["a", "c", "d"]} map(getpath([2])), map(setpath([2]; 42)), map(delpaths([[2]])) [[0], [0,1], [0,1,2]] [null, null, 2] [[0,null,42], [0,1,42], [0,1,42]] [[0], [0,1], [0,1]] map(delpaths([[0,"foo"]])) [[{"foo":2, "x":1}], [{"bar":2}]] [[{"x":1}], [{"bar":2}]] ["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p]) {"bar":false} null {"bar":false, "foo": [null, 20]} {"bar":false} delpaths([[-200]]) [1,2,3] [1,2,3] try delpaths(0) catch . {} "Paths must be specified as an array" del(.), del(empty), del((.foo,.bar,.baz) | .[2,3,0]), del(.foo[0], .bar[0], .foo, .baz.bar[0].x) {"foo": [0,1,2,3,4], "bar": [0,1]} null {"foo": [0,1,2,3,4], "bar": [0,1]} {"foo": [1,4], "bar": [1]} {"bar": [1]} del(.[1], .[-6], .[2], .[-3:9]) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 3, 5, 6, 9] del(.[nan]) [1,2,3] [1,2,3] del(.[nan,nan]) [1,2,3] [1,2,3] # negative index setpath([-1]; 1) [0] [1] pick(.a.b.c) null {"a":{"b":{"c":null}}} pick(first) [1,2] [1] pick(first|first) [[10,20],30] [[10]] # negative indices in path expressions (since last/1 is .[-1]) try pick(last) catch . [1,2] "Out of bounds negative array index" # # Assignment # .message = "goodbye" {"message": "hello"} {"message": "goodbye"} .foo = .bar {"bar":42} {"foo":42, "bar":42} .foo |= .+1 {"foo": 42} {"foo": 43} .[] += 2, .[] *= 2, .[] -= 2, .[] /= 2, .[] %=2 [1,3,5] [3,5,7] [2,6,10] [-1,1,3] [0.5, 1.5, 2.5] [1,1,1] [.[] % 7] [-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7] [0,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,0] .foo += .foo {"foo":2} {"foo":4} .[0].a |= {"old":., "new":(.+1)} [{"a":1,"b":2}] [{"a":{"old":1, "new":2},"b":2}] def inc(x): x |= .+1; inc(.[].a) [{"a":1,"b":2},{"a":2,"b":4},{"a":7,"b":8}] [{"a":2,"b":2},{"a":3,"b":4},{"a":8,"b":8}] # #1358, getpath/1 should work in path expressions .[] | try (getpath(["a",0,"b"]) |= 5) catch . [null,{"b":0},{"a":0},{"a":null},{"a":[0,1]},{"a":{"b":1}},{"a":[{}]},{"a":[{"c":3}]}] {"a":[{"b":5}]} {"b":0,"a":[{"b":5}]} "Cannot index number with number (0)" {"a":[{"b":5}]} "Cannot index number with string (\"b\")" "Cannot index object with number (0)" {"a":[{"b":5}]} {"a":[{"c":3,"b":5}]} # #2051, deletion using assigning empty against arrays (.[] | select(. >= 2)) |= empty [1,5,3,0,7] [1,0] .[] |= select(. % 2 == 0) [0,1,2,3,4,5] [0,2,4] .foo[1,4,2,3] |= empty {"foo":[0,1,2,3,4,5]} {"foo":[0,5]} .[2][3] = 1 [4] [4, null, [null, null, null, 1]] .foo[2].bar = 1 {"foo":[11], "bar":42} {"foo":[11,null,{"bar":1}], "bar":42} try ((map(select(.a == 1))[].b) = 10) catch . [{"a":0},{"a":1}] "Invalid path expression near attempt to iterate through [{\"a\":1}]" try ((map(select(.a == 1))[].a) |= .+1) catch . [{"a":0},{"a":1}] "Invalid path expression near attempt to iterate through [{\"a\":1}]" def x: .[1,2]; x=10 [0,1,2] [0,10,10] try (def x: reverse; x=10) catch . [0,1,2] "Invalid path expression with result [2,1,0]" .[] = 1 [1,null,Infinity,-Infinity,NaN,-NaN] [1,1,1,1,1,1] # # Conditionals # [.[] | if .foo then "yep" else "nope" end] [{"foo":0},{"foo":1},{"foo":[]},{"foo":true},{"foo":false},{"foo":null},{"foo":"foo"},{}] ["yep","yep","yep","yep","nope","nope","yep","nope"] [.[] | if .baz then "strange" elif .foo then "yep" else "nope" end] [{"foo":0},{"foo":1},{"foo":[]},{"foo":true},{"foo":false},{"foo":null},{"foo":"foo"},{}] ["yep","yep","yep","yep","nope","nope","yep","nope"] [if 1,null,2 then 3 else 4 end] null [3,4,3] [if empty then 3 else 4 end] null [] [if 1 then 3,4 else 5 end] null [3,4] [if null then 3 else 5,6 end] null [5,6] [if true then 3 end] 7 [3] [if false then 3 end] 7 [7] [if false then 3 else . end] 7 [7] [if false then 3 elif false then 4 end] 7 [7] [if false then 3 elif false then 4 else . end] 7 [7] [-if true then 1 else 2 end] null [-1] {x: if true then 1 else 2 end} null {"x":1} if true then [.] else . end [] null null [.[] | [.foo[] // .bar]] [{"foo":[1,2], "bar": 42}, {"foo":[1], "bar": null}, {"foo":[null,false,3], "bar": 18}, {"foo":[], "bar":42}, {"foo": [null,false,null], "bar": 41}] [[1,2], [1], [3], [42], [41]] .[] //= .[0] ["hello",true,false,[false],null] ["hello",true,"hello",[false],"hello"] .[] | [.[0] and .[1], .[0] or .[1]] [[true,[]], [false,1], [42,null], [null,false]] [true,true] [false,true] [false,true] [false,false] [.[] | not] [1,0,false,null,true,"hello"] [false,false,true,true,false,false] # Check numeric comparison binops [10 > 0, 10 > 10, 10 > 20, 10 < 0, 10 < 10, 10 < 20] {} [true,false,false,false,false,true] [10 >= 0, 10 >= 10, 10 >= 20, 10 <= 0, 10 <= 10, 10 <= 20] {} [true,true,false,false,true,true] # And some in/equality tests [ 10 == 10, 10 != 10, 10 != 11, 10 == 11] {} [true,false,true,false] ["hello" == "hello", "hello" != "hello", "hello" == "world", "hello" != "world" ] {} [true,false,false,true] [[1,2,3] == [1,2,3], [1,2,3] != [1,2,3], [1,2,3] == [4,5,6], [1,2,3] != [4,5,6]] {} [true,false,false,true] [{"foo":42} == {"foo":42},{"foo":42} != {"foo":42}, {"foo":42} != {"bar":42}, {"foo":42} == {"bar":42}] {} [true,false,true,false] # ugly complicated thing [{"foo":[1,2,{"bar":18},"world"]} == {"foo":[1,2,{"bar":18},"world"]},{"foo":[1,2,{"bar":18},"world"]} == {"foo":[1,2,{"bar":19},"world"]}] {} [true,false] # containment operator [("foo" | contains("foo")), ("foobar" | contains("foo")), ("foo" | contains("foobar"))] {} [true, true, false] # containment operator (embedded NULs!) [contains(""), contains("\u0000")] "\u0000" [true, true] [contains(""), contains("a"), contains("ab"), contains("c"), contains("d")] "ab\u0000cd" [true, true, true, true, true] [contains("cd"), contains("b\u0000"), contains("ab\u0000")] "ab\u0000cd" [true, true, true] [contains("b\u0000c"), contains("b\u0000cd"), contains("b\u0000cd")] "ab\u0000cd" [true, true, true] [contains("@"), contains("\u0000@"), contains("\u0000what")] "ab\u0000cd" [false, false, false] # Try/catch and general `?` operator [.[]|try if . == 0 then error("foo") elif . == 1 then .a elif . == 2 then empty else . end catch .] [0,1,2,3] ["foo","Cannot index number with string (\"a\")",3] [.[]|(.a, .a)?] [null,true,{"a":1}] [null,null,1,1] [[.[]|[.a,.a]]?] [null,true,{"a":1}] [] [if error then 1 else 2 end?] "foo" [] try error(0) // 1 null 1 1, try error(2), 3 null 1 3 1 + try 2 catch 3 + 4 null 7 [-try .] 1 [-1] try -.? catch . "foo" "string (\"foo\") cannot be negated" {x: try 1, y: try error catch 2, z: if true then 3 end} null {"x":1,"y":2,"z":3} {x: 1 + 2, y: false or true, z: null // 3} null {"x":3,"y":true,"z":3} .[] | try error catch . [1,null,2] 1 null 2 try error("\($__loc__)") catch . null "{\"file\":\"\",\"line\":1}" # string operations [.[]|startswith("foo")] ["fo", "foo", "barfoo", "foobar", "barfoob"] [false, true, false, true, false] [.[]|endswith("foo")] ["fo", "foo", "barfoo", "foobar", "barfoob"] [false, true, true, false, false] [.[] | split(", ")] ["a,b, c, d, e,f",", a,b, c, d, e,f, "] [["a,b","c","d","e,f"],["","a,b","c","d","e,f",""]] split("") "abc" ["a","b","c"] [.[]|ltrimstr("foo")] ["fo", "foo", "barfoo", "foobar", "afoo"] ["fo","","barfoo","bar","afoo"] [.[]|rtrimstr("foo")] ["fo", "foo", "barfoo", "foobar", "foob"] ["fo","","bar","foobar","foob"] [.[]|trimstr("foo")] ["fo", "foo", "barfoo", "foobarfoo", "foob"] ["fo","","bar","bar","b"] [.[]|ltrimstr("")] ["a", "xx", ""] ["a", "xx", ""] [.[]|rtrimstr("")] ["a", "xx", ""] ["a", "xx", ""] [.[]|trimstr("")] ["a", "xx", ""] ["a", "xx", ""] [(index(","), rindex(",")), indices(",")] "a,bc,def,ghij,klmno" [1,13,[1,4,8,13]] [ index("aba"), rindex("aba"), indices("aba") ] "xababababax" [1,7,[1,3,5,7]] # _strindices is used by indices/1 but is callable try _strindices("abc") catch . 123 "number (123) cannot be searched, as it is not a string" try _strindices(123) catch . "abc" "number (123) is not a string" # trim # \u000b is vertical tab (\v not supported by json) map(trim), map(ltrim), map(rtrim) [" \n\t\r\f\u000b", ""," ", "a", " a ", "abc", " abc ", " abc", "abc "] ["", "", "", "a", "a", "abc", "abc", "abc", "abc"] ["", "", "", "a", "a ", "abc", "abc ", "abc", "abc "] ["", "", "", "a", " a", "abc", " abc", " abc", "abc"] trim, ltrim, rtrim "\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000abc\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000" "abc" "abc\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000" "\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000abc" try trim catch ., try ltrim catch ., try rtrim catch . 123 "trim input must be a string" "trim input must be a string" "trim input must be a string" indices(1) [0,1,1,2,3,4,1,5] [1,2,6] indices([1,2]) [0,1,2,3,1,4,2,5,1,2,6,7] [1,8] indices([1,2]) [1] [] indices(", ") "a,b, cd,e, fgh, ijkl" [3,9,14] index("!") "здравствуй мир!" 14 .[:rindex("x")] "正xyz" "正" indices("o") "🇬🇧oo" [2,3] indices("o") "ƒoo" [1,2] [.[]|split(",")] ["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] [["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]] [.[]|split(", ")] ["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] [["a","bc","def","ghij","jklmn","a,b","c,d","e,f"],["a,b,c,d","e,f,g,h"]] [.[] * 3] ["a", "ab", "abc"] ["aaa", "ababab", "abcabcabc"] [.[] * "abc"] [-1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 3.7, 10.0] [null,null,"","","abc","abc","abcabcabc","abcabcabcabcabcabcabcabcabcabc"] [. * (nan,-nan)] "abc" [null,null] . * 100000 | [.[:10],.[-10:]] "abc" ["abcabcabca","cabcabcabc"] . * 1000000000 "" "" try (. * 1000000000) catch . "abc" "Repeat string result too long" [.[] / ","] ["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] [["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]] [.[] / ", "] ["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"] [["a","bc","def","ghij","jklmn","a,b","c,d","e,f"],["a,b,c,d","e,f,g,h"]] map(.[1] as $needle | .[0] | contains($needle)) [[[],[]], [[1,2,3], [1,2]], [[1,2,3], [3,1]], [[1,2,3], [4]], [[1,2,3], [1,4]]] [true, true, true, false, false] map(.[1] as $needle | .[0] | contains($needle)) [[["foobar", "foobaz"], ["baz", "bar"]], [["foobar", "foobaz"], ["foo"]], [["foobar", "foobaz"], ["blap"]]] [true, true, false] [({foo: 12, bar:13} | contains({foo: 12})), ({foo: 12} | contains({})), ({foo: 12, bar:13} | contains({baz:14}))] {} [true, true, false] {foo: {baz: 12, blap: {bar: 13}}, bar: 14} | contains({bar: 14, foo: {blap: {}}}) {} true {foo: {baz: 12, blap: {bar: 13}}, bar: 14} | contains({bar: 14, foo: {blap: {bar: 14}}}) {} false sort [42,[2,5,3,11],10,{"a":42,"b":2},{"a":42},true,2,[2,6],"hello",null,[2,5,6],{"a":[],"b":1},"abc","ab",[3,10],{},false,"abcd",null] [null,null,false,true,2,10,42,"ab","abc","abcd","hello",[2,5,3,11],[2,5,6],[2,6],[3,10],{},{"a":42},{"a":42,"b":2},{"a":[],"b":1}] (sort_by(.b) | sort_by(.a)), sort_by(.a, .b), sort_by(.b, .c), group_by(.b), group_by(.a + .b - .c == 2) [{"a": 1, "b": 4, "c": 14}, {"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}, {"a": 0, "b": 2, "c": 43}] [{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}] [{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}] [{"a": 4, "b": 1, "c": 3}, {"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 3}, {"a": 1, "b": 4, "c": 14}] [[{"a": 4, "b": 1, "c": 3}], [{"a": 0, "b": 2, "c": 43}], [{"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}]] [[{"a": 1, "b": 4, "c": 14}, {"a": 0, "b": 2, "c": 43}], [{"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}]] unique [1,2,5,3,5,3,1,3] [1,2,3,5] unique [] [] [min, max, min_by(.[1]), max_by(.[1]), min_by(.[2]), max_by(.[2])] [[4,2,"a"],[3,1,"a"],[2,4,"a"],[1,3,"a"]] [[1,3,"a"],[4,2,"a"],[3,1,"a"],[2,4,"a"],[4,2,"a"],[1,3,"a"]] [min,max,min_by(.),max_by(.)] [] [null,null,null,null] .foo[.baz] {"foo":{"bar":4},"baz":"bar"} 4 .[] | .error = "no, it's OK" [{"error":true}] {"error": "no, it's OK"} [{a:1}] | .[] | .a=999 null {"a": 999} to_entries {"a": 1, "b": 2} [{"key":"a", "value":1}, {"key":"b", "value":2}] from_entries [{"key":"a", "value":1}, {"Key":"b", "Value":2}, {"name":"c", "value":3}, {"Name":"d", "Value":4}] {"a": 1, "b": 2, "c": 3, "d": 4} with_entries(.key |= "KEY_" + .) {"a": 1, "b": 2} {"KEY_a": 1, "KEY_b": 2} map(has("foo")) [{"foo": 42}, {}] [true, false] map(has(2)) [[0,1], ["a","b","c"]] [false, true] has(nan) [0,1,2] false keys [42,3,35] [0,1,2] [][.] 1000000000000000000 null map([1,2][0:.]) [-1, 1, 2, 3, 1000000000000000000] [[1], [1], [1,2], [1,2], [1,2]] # Test recursive object merge {"k": {"a": 1, "b": 2}} * . {"k": {"a": 0,"c": 3}} {"k": {"a": 0, "b": 2, "c": 3}} {"k": {"a": 1, "b": 2}, "hello": {"x": 1}} * . {"k": {"a": 0,"c": 3}, "hello": 1} {"k": {"a": 0, "b": 2, "c": 3}, "hello": 1} {"k": {"a": 1, "b": 2}, "hello": 1} * . {"k": {"a": 0,"c": 3}, "hello": {"x": 1}} {"k": {"a": 0, "b": 2, "c": 3}, "hello": {"x": 1}} {"a": {"b": 1}, "c": {"d": 2}, "e": 5} * . {"a": {"b": 2}, "c": {"d": 3, "f": 9}} {"a": {"b": 2}, "c": {"d": 3, "f": 9}, "e": 5} [.[]|arrays] [1,2,"foo",[],[3,[]],{},true,false,null] [[],[3,[]]] [.[]|objects] [1,2,"foo",[],[3,[]],{},true,false,null] [{}] [.[]|iterables] [1,2,"foo",[],[3,[]],{},true,false,null] [[],[3,[]],{}] [.[]|scalars] [1,2,"foo",[],[3,[]],{},true,false,null] [1,2,"foo",true,false,null] [.[]|values] [1,2,"foo",[],[3,[]],{},true,false,null] [1,2,"foo",[],[3,[]],{},true,false] [.[]|booleans] [1,2,"foo",[],[3,[]],{},true,false,null] [true,false] [.[]|nulls] [1,2,"foo",[],[3,[]],{},true,false,null] [null] flatten [0, [1], [[2]], [[[3]]]] [0, 1, 2, 3] flatten(0) [0, [1], [[2]], [[[3]]]] [0, [1], [[2]], [[[3]]]] flatten(2) [0, [1], [[2]], [[[3]]]] [0, 1, 2, [3]] flatten(2) [0, [1, [2]], [1, [[3], 2]]] [0, 1, 2, 1, [3], 2] try flatten(-1) catch . [0, [1], [[2]], [[[3]]]] "flatten depth must not be negative" transpose [[1], [2,3]] [[1,2],[null,3]] transpose [] [] ascii_upcase "useful but not for é" "USEFUL BUT NOT FOR é" bsearch(0,1,2,3,4) [1,2,3] -1 0 1 2 -4 bsearch({x:1}) [{ "x": 0 },{ "x": 1 },{ "x": 2 }] 1 try ["OK", bsearch(0)] catch ["KO",.] "aa" ["KO","string (\"aa\") cannot be searched from"] strftime("%Y-%m-%dT%H:%M:%SZ") [2015,2,5,23,51,47,4,63] "2015-03-05T23:51:47Z" strftime("%A, %B %d, %Y") 1435677542.822351 "Tuesday, June 30, 2015" strftime("%Y-%m-%dT%H:%M:%SZ") [2024,2,15] "2024-03-15T00:00:00Z" mktime [2024,8,21] 1726876800 gmtime 1425599507 [2015,2,5,23,51,47,4,63] gmtime[5] 1425599507.25 47.25 # test invalid tm input try strftime("%Y-%m-%dT%H:%M:%SZ") catch . ["a",1,2,3,4,5,6,7] "strftime/1 requires parsed datetime inputs" try strflocaltime("%Y-%m-%dT%H:%M:%SZ") catch . ["a",1,2,3,4,5,6,7] "strflocaltime/1 requires parsed datetime inputs" try mktime catch . ["a",1,2,3,4,5,6,7] "mktime requires parsed datetime inputs" # oss-fuzz #67403: non-string argument with number input fails assert try ["OK", strftime([])] catch ["KO", .] 0 ["KO","strftime/1 requires a string format"] try ["OK", strflocaltime({})] catch ["KO", .] 0 ["KO","strflocaltime/1 requires a string format"] [strptime("%Y-%m-%dT%H:%M:%SZ")|(.,mktime)] "2015-03-05T23:51:47Z" [[2015,2,5,23,51,47,4,63],1425599507] # Check day-of-week and day of year computations # (should trip an assert if this fails) last(range(365 * 67)|("1970-03-01T01:02:03Z"|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime) + (86400 * .)|strftime("%Y-%m-%dT%H:%M:%SZ")|strptime("%Y-%m-%dT%H:%M:%SZ")) null [2037,1,11,1,2,3,3,41] # module system import "a" as foo; import "b" as bar; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a] null ["a","b","c","a"] import "c" as foo; [foo::a, foo::c] null [0,"acmehbah"] include "c"; [a, c] null [0,"acmehbah"] import "data" as $e; import "data" as $d; [$d[].this,$e[].that,$d::d[].this,$e::e[].that]|join(";") null "is a test;is too;is a test;is too" # Regression test for #2000 import "data" as $a; import "data" as $b; def f: {$a, $b}; f null {"a":[{"this":"is a test","that":"is too"}],"b":[{"this":"is a test","that":"is too"}]} include "shadow1"; e null 2 include "shadow1"; include "shadow2"; e null 3 import "shadow1" as f; import "shadow2" as f; import "shadow1" as e; [e::e, f::e] null [2,3] %%FAIL module (.+1); 0 jq: error: Module metadata must be constant at , line 1, column 8: module (.+1); 0 ^^^^^ %%FAIL module []; 0 jq: error: Module metadata must be an object at , line 1, column 8: module []; 0 ^^ %%FAIL include "a" (.+1); 0 jq: error: Module metadata must be constant at , line 1, column 13: include "a" (.+1); 0 ^^^^^ %%FAIL include "a" []; 0 jq: error: Module metadata must be an object at , line 1, column 13: include "a" []; 0 ^^ %%FAIL include "\ "; 0 jq: error: Invalid escape at line 1, column 4 (while parsing '"\ "') at , line 1, column 10: include "\ "; 0 ^^ %%FAIL include "\(a)"; 0 jq: error: Import path must be constant at , line 1, column 9: include "\(a)"; 0 ^^^^^^ modulemeta "c" {"whatever":null,"deps":[{"as":"foo","is_data":false,"relpath":"a"},{"search":"./","as":"d","is_data":false,"relpath":"d"},{"search":"./","as":"d2","is_data":false,"relpath":"d"},{"search":"./../lib/jq","as":"e","is_data":false,"relpath":"e"},{"search":"./../lib/jq","as":"f","is_data":false,"relpath":"f"},{"as":"d","is_data":true,"relpath":"data"}],"defs":["a/0","c/0"]} modulemeta | .deps | length "c" 6 modulemeta | .defs | length "c" 2 %%FAIL IGNORE MSG import "syntaxerror" as e; . jq: error: syntax error, unexpected ';', expecting end of file at tests/modules/syntaxerror/syntaxerror.jq, line 1, column 4: wat; ^ %%FAIL %::wat jq: error: syntax error, unexpected '%', expecting end of file at , line 1, column 1: %::wat ^ import "test_bind_order" as check; check::check null true try -. catch . "very-long-long-long-long-string" "string (\"very-long-long-long-long...\") cannot be negated" try (.-.) catch . "very-long-long-long-long-string" "string (\"very-long-long-long-long...\") and string (\"very-long-long-long-long...\") cannot be subtracted" "x" * range(0; 12; 2) + "☆" * 8 | try -. catch . null "string (\"☆☆☆☆☆☆☆☆\") cannot be negated" "string (\"xx☆☆☆☆☆☆☆☆\") cannot be negated" "string (\"xxxx☆☆☆☆☆☆...\") cannot be negated" "string (\"xxxxxx☆☆☆☆☆☆...\") cannot be negated" "string (\"xxxxxxxx☆☆☆☆☆...\") cannot be negated" "string (\"xxxxxxxxxx☆☆☆☆...\") cannot be negated" try (. + "x") catch . == if have_decnum then "number (12345678901234567890123456...) and string (\"x\") cannot be added" else "number (12345678901234568000000000...) and string (\"x\") cannot be added" end 123456789012345678901234567890 true join(",") ["1",2,true,false,3.4] "1,2,true,false,3.4" .[] | join(",") [[], [null], [null,null], [null,null,null]] "" "" "," ",," .[] | join(",") [["a",null], [null,"a"]] "a," ",a" try join(",") catch . ["1","2",{"a":{"b":{"c":33}}}] "string (\"1,2,\") and object ({\"a\":{\"b\":{\"c\":33}}}) cannot be added" try join(",") catch . ["1","2",[3,4,5]] "string (\"1,2,\") and array ([3,4,5]) cannot be added" {if:0,and:1,or:2,then:3,else:4,elif:5,end:6,as:7,def:8,reduce:9,foreach:10,try:11,catch:12,label:13,import:14,include:15,module:16} null {"if":0,"and":1,"or":2,"then":3,"else":4,"elif":5,"end":6,"as":7,"def":8,"reduce":9,"foreach":10,"try":11,"catch":12,"label":13,"import":14,"include":15,"module":16} try (1/.) catch . 0 "number (1) and number (0) cannot be divided because the divisor is zero" try (1/0) catch . 0 "number (1) and number (0) cannot be divided because the divisor is zero" try (0/0) catch . 0 "number (0) and number (0) cannot be divided because the divisor is zero" try (1%.) catch . 0 "number (1) and number (0) cannot be divided (remainder) because the divisor is zero" try (1%0) catch . 0 "number (1) and number (0) cannot be divided (remainder) because the divisor is zero" # Basic numbers tests: integers, powers of two [range(-52;52;1)] as $powers | [$powers[]|pow(2;.)|log2|round] == $powers null true [range(-99/2;99/2;1)] as $orig | [$orig[]|pow(2;.)|log2] as $back | ($orig|keys)[]|. as $k | (($orig|.[$k])-($back|.[$k]))|if . < 0 then . * -1 else . end|select(.>.00005) null %%FAIL { jq: error: syntax error, unexpected end of file at , line 1, column 1: { ^ %%FAIL } jq: error: syntax error, unexpected INVALID_CHARACTER, expecting end of file at , line 1, column 1: } ^ (.[{}] = 0)? null INDEX(range(5)|[., "foo\(.)"]; .[0]) null {"0":[0,"foo0"],"1":[1,"foo1"],"2":[2,"foo2"],"3":[3,"foo3"],"4":[4,"foo4"]} JOIN({"0":[0,"abc"],"1":[1,"bcd"],"2":[2,"def"],"3":[3,"efg"],"4":[4,"fgh"]}; .[0]|tostring) [[5,"foo"],[3,"bar"],[1,"foobar"]] [[[5,"foo"],null],[[3,"bar"],[3,"efg"]],[[1,"foobar"],[1,"bcd"]]] range(5;10)|IN(range(10)) null true true true true true range(5;13)|IN(range(0;10;3)) null false true false false true false false false range(10;12)|IN(range(10)) null false false IN(range(10;20); range(10)) null false IN(range(5;20); range(10)) null true # Regression test for #1347 (.a as $x | .b) = "b" {"a":null,"b":null} {"a":null,"b":"b"} # Regression test for #1368 (.. | select(type == "object" and has("b") and (.b | type) == "array")|.b) |= .[0] {"a": {"b": [1, {"b": 3}]}} {"a": {"b": 1}} isempty(empty) null true isempty(range(3)) null false isempty(1,error("foo")) null false # Regression test for #1815 index("") "" null # check that dead code removal occurs after builtin it generation builtins|length > 10 null true "-1"|IN(builtins[] / "/"|.[1]) null false all(builtins[] / "/"; .[1]|tonumber >= 0) null true builtins|any(.[:1] == "_") null false ## Test ability to use keywords (uncomment after eval is pushed) #(.[] as $kw | "\"{\($kw)} as $\($kw) | $\($kw) | {$\($kw)} | {\($kw):.\($kw)}\""|eval|empty),null #["as","def","module","import","include","if","then","else","elif","end","reduce","foreach","and","or","try","catch","label","break","__loc__"] #null # #(.[] as $kw | "\"def f($\($kw)): $\($kw); f(.)\""|eval|empty),null #["as","def","module","import","include","if","then","else","elif","end","reduce","foreach","and","or","try","catch","label","break","__loc__"] #null # # Tests to cover the new toliteral number functionality # For an example see #1652 and other linked issues # # We are backward and sanity compatible map(. == 1) [1, 1.0, 1.000, 100e-2, 1e+0, 0.0001e4] [true, true, true, true, true, true] # When no arithmetic is involved jq should preserve the literal value .[0] | tostring | . == if have_decnum then "13911860366432393" else "13911860366432392" end [13911860366432393] true .x | tojson | . == if have_decnum then "13911860366432393" else "13911860366432392" end {"x":13911860366432393} true (13911860366432393 == 13911860366432392) | . == if have_decnum then false else true end null true # Applying arithmetic to the value will truncate the result to double . - 10 13911860366432393 13911860366432382 .[0] - 10 [13911860366432393] 13911860366432382 .x - 10 {"x":13911860366432393} 13911860366432382 # Unary negation preserves numerical precision -. | tojson == if have_decnum then "-13911860366432393" else "-13911860366432392" end 13911860366432393 true -. | tojson == if have_decnum then "0.12345678901234567890123456789" else "0.12345678901234568" end -0.12345678901234567890123456789 true [1E+1000,-1E+1000 | tojson] == if have_decnum then ["1E+1000","-1E+1000"] else ["1.7976931348623157e+308","-1.7976931348623157e+308"] end null true . |= try . catch . 1 1 # decnum to double conversion .[] as $n | $n+0 | [., tostring, . == $n] [-9007199254740993, -9007199254740992, 9007199254740992, 9007199254740993, 13911860366432393] [-9007199254740992,"-9007199254740992",true] [-9007199254740992,"-9007199254740992",true] [9007199254740992,"9007199254740992",true] [9007199254740992,"9007199254740992",true] [13911860366432392,"13911860366432392",true] # abs, fabs, length abs "abc" "abc" map(abs) [-0, 0, -10, -1.1] [0,0,10,1.1] map(fabs) [-0, 0, -10, -1.1] [0,0,10,1.1] map(abs == length) | unique [-10, -1.1, -1e-1, 1000000000000000002] [true] # The following is NOT prescriptive: map(abs) [0.1,1000000000000000002] [1e-1, 1000000000000000002] [1E+1000,-1E+1000 | abs | tojson] | unique == if have_decnum then ["1E+1000"] else ["1.7976931348623157e+308"] end null true [1E+1000,-1E+1000 | length | tojson] | unique == if have_decnum then ["1E+1000"] else ["1.7976931348623157e+308"] end null true # Using a keyword as variable/label name 123 as $label | $label null 123 [ label $if | range(10) | ., (select(. == 5) | break $if) ] null [0,1,2,3,4,5] reduce .[] as $then (4 as $else | $else; . as $elif | . + $then * $elif) [1,2,3] 96 1 as $foreach | 2 as $and | 3 as $or | { $foreach, $and, $or, a } {"a":4,"b":5} {"foreach":1,"and":2,"or":3,"a":4} [ foreach .[] as $try (1 as $catch | $catch - 1; . + $try; .) ] [10,9,8,7] [10,19,27,34] # Object construction { a, $__loc__, c } {"a":[1,2,3],"b":"foo","c":{"hi":"hey"}} {"a":[1,2,3],"__loc__":{"file":"","line":1},"c":{"hi":"hey"}} 1 as $x | "2" as $y | "3" as $z | { $x, as, $y: 4, ($z): 5, if: 6, foo: 7 } {"as":8} {"x":1,"as":8,"2":4,"3":5,"if":6,"foo":7} # nan is parsed as a valid NaN value from JSON fromjson | isnan "nan" true tojson | fromjson {"a":nan} {"a":null} # NaN with payload is not parsed .[] | try (fromjson | isnan) catch . ["NaN","-NaN","NaN1","NaN10","NaN100","NaN1000","NaN10000","NaN100000"] true true "Invalid numeric literal at EOF at line 1, column 4 (while parsing 'NaN1')" "Invalid numeric literal at EOF at line 1, column 5 (while parsing 'NaN10')" "Invalid numeric literal at EOF at line 1, column 6 (while parsing 'NaN100')" "Invalid numeric literal at EOF at line 1, column 7 (while parsing 'NaN1000')" "Invalid numeric literal at EOF at line 1, column 8 (while parsing 'NaN10000')" "Invalid numeric literal at EOF at line 1, column 9 (while parsing 'NaN100000')" # calling input/0, or debug/0 in a test doesn't crash jq try input catch . null "break" debug 1 1 # try/catch catches more than it should #1859 "foo" | try ((try . catch "caught too much") | error) catch "caught just right" null "caught just right" .[]|(try (if .=="hi" then . else error end) catch empty) | "\(.) there!" ["hi","ho"] "hi there!" try (["hi","ho"]|.[]|(try . catch (if .=="ho" then "BROKEN"|error else empty end)) | if .=="ho" then error else "\(.) there!" end) catch "caught outside \(.)" null "hi there!" "caught outside ho" .[]|(try . catch (if .=="ho" then "BROKEN"|error else empty end)) | if .=="ho" then error else "\(.) there!" end ["hi","ho"] "hi there!" try (try error catch "inner catch \(.)") catch "outer catch \(.)" "foo" "inner catch foo" try ((try error catch "inner catch \(.)")|error) catch "outer catch \(.)" "foo" "outer catch inner catch foo" # Also #1859, but from #1885 first(.?,.?) null null # Also #1859, but from #2140 {foo: "bar"} | .foo |= .? null {"foo": "bar"} # Also #1859, but from #2220 . |= try 2 1 2 . |= try 2 catch 3 1 2 .[] |= try tonumber ["1", "2a", "3", " 4", "5 ", "6.7", ".89", "-876", "+5.43", 21] [1, 3, 6.7, 0.89, -876, 5.43, 21] # Also 1859, but from 2073 any(keys[]|tostring?;true) {"a":"1","b":"2","c":"3"} true # explode/implode # test replacement character (65533) for outside codepoint range and 0xd800 (55296) - 0xdfff (57343) utf16 surrogate pair range # 1.1 and 1.9 to test round down of non-ints implode|explode [-1,0,1,2,3,1114111,1114112,55295,55296,57343,57344,1.1,1.9] [65533,0,1,2,3,1114111,65533,55295,65533,65533,57344,1,1] map(try implode catch .) [123,["a"],[nan]] ["implode input must be an array","string (\"a\") can't be imploded, unicode codepoint needs to be numeric","number (null) can't be imploded, unicode codepoint needs to be numeric"] try 0[implode] catch . [] "Cannot index number with string (\"\")" # walk walk(.) {"x":0} {"x":0} walk(1) {"x":0} 1 # The following is a regression test, not a requirement: [walk(.,1)] {"x":0} [{"x":0},1] # Issue #2584 walk(select(IN({}, []) | not)) {"a":1,"b":[]} {"a":1} # #2815 [range(10)] | .[1.2:3.5] null [1,2,3] [range(10)] | .[1.5:3.5] null [1,2,3] [range(10)] | .[1.7:3.5] null [1,2,3] [range(10)] | .[1.7:4294967295] null [1,2,3,4,5,6,7,8,9] [range(10)] | .[1.7:-4294967296] null [] [[range(10)] | .[1.1,1.5,1.7]] null [1,1,1] [range(5)] | .[1.1] = 5 null [0,5,2,3,4] [range(3)] | .[nan:1] null [0] [range(3)] | .[1:nan] null [1,2] [range(3)] | .[nan] null null try ([range(3)] | .[nan] = 9) catch . null "Cannot set array element at NaN index" try ("foobar" | .[1.5:3.5] = "xyz") catch . null "Cannot update string slices" try ([range(10)] | .[1.5:3.5] = ["xyz"]) catch . null [0,"xyz",4,5,6,7,8,9] try ("foobar" | .[1.5]) catch . null "Cannot index string with number (1.5)" # setpath/2 does not leak the input after an invalid get #2970 try ["ok", setpath([1]; 1)] catch ["ko", .] {"hi":"hello"} ["ko","Cannot index object with number (1)"] try fromjson catch . "{'a': 123}" "Invalid string literal; expected \", but got ' at line 1, column 5 (while parsing '{'a': 123}')" # ltrimstr/1 rtrimstr/1 don't leak on invalid input #2977 try ltrimstr(1) catch "x", try rtrimstr(1) catch "x" | "ok" "hi" "ok" "ok" try ltrimstr("x") catch "x", try rtrimstr("x") catch "x" | "ok" {"hey":[]} "ok" "ok" # ltrimstr/1 and rtrimstr/1 return an error for non-strings. #2969 .[] as [$x, $y] | try ["ok", ($x | ltrimstr($y))] catch ["ko", .] [["hi",1],[1,"hi"],["hi","hi"],[1,1]] ["ko","startswith() requires string inputs"] ["ko","startswith() requires string inputs"] ["ok",""] ["ko","startswith() requires string inputs"] .[] as [$x, $y] | try ["ok", ($x | rtrimstr($y))] catch ["ko", .] [["hi",1],[1,"hi"],["hi","hi"],[1,1]] ["ko","endswith() requires string inputs"] ["ko","endswith() requires string inputs"] ["ok",""] ["ko","endswith() requires string inputs"] # oss-fuzz #66061: setpath/2 leaks when indexing array with array try ["OK", setpath([[1]]; 1)] catch ["KO", .] [] ["KO","Cannot update field at array index of array"] # regression test for #3227 foreach .[] as $x (0, 1; . + $x) [1, 2] 1 3 2 4 # regression test for CVE-2025-49014 (use of fmt after free) # tests with both empty string literal and empty string created by function # as they seems to behave reference wise differently. strflocaltime("" | ., @uri) 0 "" "" # regression tests for #3413 # upper range bounds should be in sync with the constants defined at # src/jv_parse.c:#define MAX_PARSING_DEPTH (N) # src/jv_print.c:#define MAX_PRINT_DEPTH (N) # (N-1) reduce range(9999) as $_ ([];[.]) | tojson | fromjson | flatten null [] # (N) reduce range(10000) as $_ ([];[.]) | tojson | try (fromjson) catch . | (contains("") | not) and contains("Exceeds depth limit for parsing") null true # (N+1) reduce range(10001) as $_ ([];[.]) | tojson | contains("") null true # regression test for CVE-2026-33947 setpath([range(10000) | 0]; 0) | flatten null [0] try setpath([range(10001) | 0]; 0) catch . null "Path too deep" getpath([range(10000) | 0]) null null try getpath([range(10001) | 0]) catch . null "Path too deep" delpaths([[range(10000) | 0]]) null null try delpaths([[range(10001) | 0]]) catch . null "Path too deep" # regression test for CVE-2026-40612 reduce range(10000) as $_ ([]; [.]) | contains([[]]) null true try (reduce range(10001) as $_ ([]; [.]) as $x | $x | contains($x)) catch . null "Containment check too deep" # regression test for CVE-2026-43896 reduce range(10000) as $_ ({}; {a: .}) as $x | $x * $x | length null 1 try (reduce range(10001) as $_ ({}; {a: .}) as $x | $x * $x) catch . null "Object merge too deep" # regression test for deep structural equality recursion try ((reduce range(10001) as $_ ([]; [.])) as $x | (reduce range(10001) as $_ ([]; [.])) as $y | $x == $y) catch . null "Equality check too deep" # regression tests for deep ordering comparisons try ((reduce range(10001) as $_ ([]; [.])) as $x | [$x, $x] | sort) catch . null "Comparison too deep" try ((reduce range(10001) as $_ ([]; [.])) as $x | [$x, $x] | unique) catch . null "Comparison too deep" try ((reduce range(10001) as $_ ({}; {a: .})) as $x | [$x, $x] | sort) catch . null "Comparison too deep" try ((reduce range(10001) as $_ ({}; {a: .})) as $x | [$x, $x] | unique) catch . null "Comparison too deep" jq-1.8.2/tests/manonigtest0000755000175100017510000000015115215513536011242 #!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQBASEDIR/tests/manonig.test jq-1.8.2/tests/manonig.test0000644000175100017510000000326615215513536011327 split(", ") "a, b,c,d, e, " ["a","b,c,d","e",""] walk( if type == "object" then with_entries( .key |= sub( "^_+"; "") ) else . end ) [ { "_a": { "__b": 2 } } ] [{"a":{"b":2}}] test("foo") "foo" true .[] | test("a b c # spaces are ignored"; "ix") ["xabcd", "ABC"] true true match("(abc)+"; "g") "abc abc" {"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]} {"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]} match("foo") "foo bar foo" {"offset": 0, "length": 3, "string": "foo", "captures": []} match(["foo", "ig"]) "foo bar FOO" {"offset": 0, "length": 3, "string": "foo", "captures": []} {"offset": 8, "length": 3, "string": "FOO", "captures": []} match("foo (?bar)? foo"; "ig") "foo bar foo foo foo" {"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]} {"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": -1, "length": 0, "string": null, "name": "bar123"}]} [ match("."; "g")] | length "abc" 3 capture("(?[a-z]+)-(?[0-9]+)") "xyzzy-14" { "a": "xyzzy", "n": "14" } scan("c") "abcdefabc" "c" "c" scan("(a+)(b+)") "abaabbaaabbb" ["a","b"] ["aa","bb"] ["aaa","bbb"] split(", *"; null) "ab,cd, ef" ["ab","cd","ef"] splits(", *") "ab,cd, ef, gh" "ab" "cd" "ef" "gh" splits(",? *"; "n") "ab,cd ef, gh" "ab" "cd" "ef" "gh" sub("[^a-z]*(?[a-z]+)"; "Z\(.x)"; "g") "123abc456def" "ZabcZdef" [sub("(?.)"; "\(.a|ascii_upcase)", "\(.a|ascii_downcase)")] "aB" ["AB","aB"] gsub("(?.)[^a]*"; "+\(.x)-") "Abcabc" "+A-+a-" [gsub("p"; "a", "b")] "p" ["a","b"] jq-1.8.2/tests/setup0000755000175100017510000000170015215513536010053 #!/bin/sh # This is meant to be included by each test's shell script driver. if [ -n "$TRACE_TESTS" ]; then set -x fi set -eu JQTESTDIR=$(cd "$(dirname "$0")" && pwd) JQBASEDIR=$JQTESTDIR/.. JQ=${JQ:-$JQBASEDIR/jq} # Some tests have locale-dependent output; use C locale. Fixes #3038 LC_ALL=C export LC_ALL if [ -n "${ENABLE_VALGRIND-}" ] && which valgrind > /dev/null; then VALGRIND="valgrind --error-exitcode=1 --leak-check=full \ --suppressions=$JQTESTDIR/onig.supp \ --suppressions=$JQTESTDIR/local.supp" VG_EXIT0=--error-exitcode=0 Q=-q else VALGRIND= VG_EXIT0= Q= fi mods=$JQTESTDIR/modules clean=true d= clean () { if ! $clean; then echo "See temp files in $d!" elif [ -n "$d" ]; then rm -rf "$d" fi } trap clean EXIT d=$(mktemp -d -t jqXXXXXX || true) if [ -z "$d" ]; then echo "Your OS does not support mktemp(1) -d" 1>&2 exit 1 fi jq-1.8.2/tests/onig.test0000644000175100017510000001150315215513536010624 # match builtin [match("( )*"; "g")] "abc" [{"offset":0,"length":0,"string":"","captures":[{"offset":-1,"string":null,"length":0,"name":null}]},{"offset":1,"length":0,"string":"","captures":[{"offset":-1,"string":null,"length":0,"name":null}]},{"offset":2,"length":0,"string":"","captures":[{"offset":-1,"string":null,"length":0,"name":null}]},{"offset":3,"length":0,"string":"","captures":[{"offset":-1,"string":null,"length":0,"name":null}]}] [match("( )*"; "gn")] "abc" [] [match(""; "g")] "ab" [{"offset":0,"length":0,"string":"","captures":[]},{"offset":1,"length":0,"string":"","captures":[]},{"offset":2,"length":0,"string":"","captures":[]}] [match("a"; "gi")] "āáàä" [] [match(["(bar)"])] "foo bar" [{"offset": 4, "length": 3, "string": "bar", "captures":[{"offset": 4, "length": 3, "string": "bar", "name": null}]}] # offsets account for combining codepoints and multi-byte UTF-8 [match("bar")] "ā bar with a combining codepoint U+0304" [{"offset": 3, "length": 3, "string": "bar", "captures":[]}] # matches with combining codepoints still count them in their length [match("bār")] "a bār" [{"offset": 2, "length": 4, "string": "bār", "captures":[]}] [match(".+?\\b")] "ā two-codepoint grapheme" [{"offset": 0, "length": 2, "string": "ā", "captures":[]}] [match(["foo (?bar)? foo", "ig"])] "foo bar foo foo foo" [{"offset": 0, "length": 11, "string": "foo bar foo", "captures":[{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]},{"offset":12, "length": 8, "string": "foo foo", "captures":[{"offset": -1, "length": 0, "string": null, "name": "bar123"}]}] # non-matched optional group "a","b","c" | capture("(?a)?b?") null {"x":"a"} {"x":null} {"x":null} "a","b","c" | match("(?a)?b?") null {"offset":0,"length":1,"string":"a","captures":[{"offset":0,"length":1,"string":"a","name":"x"}]} {"offset":0,"length":1,"string":"b","captures":[{"offset":-1,"string":null,"length":0,"name":"x"}]} {"offset":0,"length":0,"string":"","captures":[{"offset":-1,"string":null,"length":0,"name":"x"}]} # same as above but allow empty match for group "a","b","c" | capture("(?a?)?b?") null {"x":"a"} {"x":""} {"x":""} "a","b","c" | match("(?a?)?b?") null {"offset":0,"length":1,"string":"a","captures":[{"offset":0,"length":1,"string":"a","name":"x"}]} {"offset":0,"length":1,"string":"b","captures":[{"offset":0,"string":"","length":0,"name":"x"}]} {"offset":0,"length":0,"string":"","captures":[{"offset":0,"string":"","length":0,"name":"x"}]} #test builtin [test("( )*"; "gn")] "abc" [false] [test("ā")] "ā" [true] capture("(?[a-z]+)-(?[0-9]+)") "xyzzy-14" {"a":"xyzzy","n":"14"} # jq-coded utilities built on match: # # The second element in these tests' inputs tests the case where the # fromstring matches both the head and tail of the string [.[] | sub(", "; ":")] ["a,b, c, d, e,f", ", a,b, c, d, e,f, "] ["a,b:c, d, e,f",":a,b, c, d, e,f, "] sub("^(?.)"; "Head=\(.head) Tail=") "abcdef" "Head=a Tail=bcdef" [.[] | gsub(", "; ":")] ["a,b, c, d, e,f",", a,b, c, d, e,f, "] ["a,b:c:d:e,f",":a,b:c:d:e,f:"] gsub("(?\\d)"; ":\(.d);") "a1b2" "a:1;b:2;" gsub("a";"b") "aaaaa" "bbbbb" gsub("(.*)"; ""; "x") "" "" gsub(""; "a"; "g") "" "a" gsub("^"; ""; "g") "a" "a" gsub(""; "a"; "g") "a" "aaa" gsub("$"; "a"; "g") "a" "aa" gsub("^"; "a") "" "a" gsub("(?=u)"; "u") "qux" "quux" gsub("^.*a"; "b") "aaa" "b" gsub("^.*?a"; "b") "aaa" "baa" # The following is for regression testing and should not be construed as a requirement: [gsub("a"; "b", "c")] "a" ["b","c"] [.[] | scan(", ")] ["a,b, c, d, e,f",", a,b, c, d, e,f, "] [", ",", ",", ",", ",", ",", ",", ",", "] [.[]|[[sub(", *";":")], [gsub(", *";":")], [scan(", *")]]] ["a,b, c, d, e,f",", a,b, c, d, e,f, "] [[["a:b, c, d, e,f"],["a:b:c:d:e:f"],[",",", ",", ",", ",","]],[[":a,b, c, d, e,f, "],[":a:b:c:d:e:f:"],[", ",",",", ",", ",", ",",",", "]]] [.[]|[[sub(", +";":")], [gsub(", +";":")], [scan(", +")]]] ["a,b, c, d, e,f",", a,b, c, d, e,f, "] [[["a,b:c, d, e,f"],["a,b:c:d:e,f"],[", ",", ",", "]],[[":a,b, c, d, e,f, "],[":a,b:c:d:e,f:"],[", ",", ",", ",", ",", "]]] [.[] | scan("b+"; "i")] ["","bBb","abcABBBCabbbc"] ["bBb","b","BBB","bbb"] # reference to named captures gsub("(?.)[^a]*"; "+\(.x)-") "Abcabc" "+A-+a-" gsub("(?.)(?[0-9])"; "\(.x|ascii_downcase)\(.y)") "A1 B2 CD" "a1 b2 CD" gsub("\\b(?.)"; "\(.x|ascii_downcase)") "ABC DEF" "aBC dEF" gsub("[^a-z]*(?[a-z]*)"; "Z\(.x)") "123foo456bar" "ZfooZbarZ" # utf-8 sub("(?.)"; "\(.x)!") "’" "’!" [sub("a"; "b", "c")] "a" ["b","c"] [sub("(?.)"; "\(.a|ascii_upcase)", "\(.a|ascii_downcase)", "c")] "aB" ["AB","aB","cB"] [gsub("(?.)"; "\(.a|ascii_upcase)", "\(.a|ascii_downcase)", "c")] "aB" ["AB","ab","cc"] # splits [splits("")] "ab" ["","a","b",""] [splits("c")] "ab" ["ab"] [splits("a+"; "i")] "abAABBabA" ["","b","BB","b",""] [splits("b+"; "i")] "abAABBabA" ["a","AA","a","A"] jq-1.8.2/tests/shtest0000755000175100017510000007127415215513536010242 #!/bin/sh -x . "${0%/*}/setup" "$@" msys=false mingw=false sunos=false case "$(uname -s)" in MSYS*) msys=true;; MINGW*) mingw=true;; SunOS*) sunos=true;; esac JQ_NO_B=$JQ JQ="$JQ -b" # On Solaris, GNU tools are available in /usr/gnu. This script should prefer # them over the native tools, because the native versions may lack some # command-line options the script relies on. $sunos && PATH="/usr/gnu/bin:$PATH" PATH=$JQBASEDIR:$PATH $JQBASEDIR/tests/jq-f-test.sh > /dev/null SHELL=/bin/sh export SHELL unset JQ_COLORS unset NO_COLOR if [ -f "$JQBASEDIR/.libs/libinject_errors.so" ]; then # Do some simple error injection tests to check that we're handling # I/O errors correctly. ( libinject=$JQBASEDIR/.libs/libinject_errors.so cd $d LD_PRELOAD=$libinject $JQ . /dev/null touch fail_read LD_PRELOAD=$libinject $JQ . fail_read && exit 2 touch fail_close LD_PRELOAD=$libinject $JQ . fail_close && exit 2 true ) fi printf 'a\0b\nc\0d\ne' > $d/input $VALGRIND $Q $JQ -Rse '. == "a\u0000b\nc\u0000d\ne"' $d/input $VALGRIND $Q $JQ -Rne '[inputs] == ["a\u0000b", "c\u0000d", "e"]' $d/input ## Test constant folding nref=$($VALGRIND $Q $JQ -n --debug-dump-disasm '"foo"' | wc -l) for exp in '1+1' '1-1' '2*3' '9/3' '9%3' '9==3' '9!=3' \ '9<3' '9>3' '9<=3' '9>=3' '1+2*3-4/5%6' '"foo" + "bar"'; do n=$($VALGRIND $Q $JQ -n --debug-dump-disasm "$exp" | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding didn't work: $exp" exit 1 fi done ## Test JSON sequence support cat > $d/expected < /dev/null 2> $d/out cmp $d/out $d/expected cat > $d/expected < /dev/null 2> $d/out cmp $d/out $d/expected # Note that here jq sees no inputs at all but it still succeeds because # --seq ignores parse errors cat > $d/expected < $d/out 2>&1 cmp $d/out $d/expected # with -e option should give 4 here as there's no valid output after # ignoring parse errors with --seq. printf '"foo' | $JQ -ce --seq . > $d/out 2>&1 || ret=$? [ $ret -eq 4 ] cmp $d/out $d/expected # Numeric values truncated by EOF are ignored cat > $d/expected < $d/out 2>&1 cmp $d/out $d/expected cat > $d/expected <:1): Unfinished abandoned text at EOF at line 2, column 0 EOF if printf '1\n' | $JQ -cen --seq '[inputs] == []' >/dev/null 2> $d/out; then printf 'Error expected but jq exited successfully\n' 1>&2 exit 2 fi cmp $d/out $d/expected # Test control characters for #2909 cat > $d/expected < $d/out 2>&1; then printf 'Error expected but jq exited successfully\n' 1>&2 exit 2 fi cmp $d/out $d/expected done printf '" ~\\u007f"\n' > $d/expected printf "\"$(printf '\\%03o' 32 126 127)\"" | $JQ '.' > $d/out 2>&1 cmp $d/out $d/expected ## Test --exit-status data='{"i": 1}\n{"i": 2}\n{"i": 3}\n' printf "$data" | $JQ --exit-status 'select(.i==1)' > /dev/null 2>&1 printf "$data" | $JQ --exit-status 'select(.i==2)' > /dev/null 2>&1 printf "$data" | $JQ --exit-status 'select(.i==3)' > /dev/null 2>&1 ret=0 printf "$data" | $JQ --exit-status 'select(.i==4)' > /dev/null 2>&1 || ret=$? [ $ret -eq 4 ] ret=0 printf "$data" | $JQ --exit-status 'select(.i==2) | false' > /dev/null 2>&1 || ret=$? [ $ret -eq 1 ] printf "$data" | $JQ --exit-status 'select(.i==2) | true' > /dev/null 2>&1 # Regression test for #951 printf '"a\n' > $d/input if $VALGRIND $Q $JQ -e . $d/input; then printf 'Issue #951 is back?\n' 1>&2 exit 2 fi # Regression test for #2146 if echo "foobar" | $JQ .; then printf 'Issue #2146 is back?\n' 1>&2 exit 1 elif [ $? -ne 5 ]; then echo "Invalid input had wrong error code" 1>&2 exit 1 fi # Regression test for #2367; make sure to call jq twice if ! echo '{"a": 1E9999999999}' | $JQ . | $JQ -e .a; then printf 'Issue #2367 is back?\n' 1>&2 exit 1 fi # Regression test for #1534 echo "[1,2,3,4]" > $d/expected printf "[1,2][3,4]" | $JQ -cs add > $d/out 2>&1 cmp $d/out $d/expected printf "[1,2][3,4]\n" | $JQ -cs add > $d/out 2>&1 cmp $d/out $d/expected # Regression test for #3273 echo "[[[0],1],[[0]],[[0],2],[[0]]]" > $d/expected printf "[1][2]" | $JQ -c -s --stream . > $d/out 2>&1 cmp $d/out $d/expected printf "[1][2]\n" | $JQ -c -s --stream . > $d/out 2>&1 cmp $d/out $d/expected # Regression test for --raw-output0 printf "a\0b\0" > $d/expected printf '["a", "b"]' | $VALGRIND $Q $JQ --raw-output0 '.[]' > $d/out cmp $d/out $d/expected printf "a\0" > $d/expected if printf '["a", "c\\u0000d", "b"]' | $VALGRIND $Q $JQ --raw-output0 '.[]' > $d/out; then echo "Should exit error on string containing NUL with --raw-output0" 1>&2 exit 1 elif [ $? -ne 5 ]; then echo "Invalid error code" 1>&2 exit 1 else cmp $d/out $d/expected fi # Regression tests for #3194 echo 42 > $d/expected $JQ -nn 42 > $d/out 2>&1 cmp $d/out $d/expected $JQ -nL. 42 > $d/out 2>&1 cmp $d/out $d/expected $JQ -nL . 42 > $d/out 2>&1 cmp $d/out $d/expected $JQ -h > $d/expected 2>&1 $JQ -hV > $d/out 2>&1 cmp $d/out $d/expected $JQ -h -V > $d/out 2>&1 cmp $d/out $d/expected $JQ -V > $d/expected 2>&1 $JQ -Vh > $d/out 2>&1 cmp $d/out $d/expected $JQ -V -h > $d/out 2>&1 cmp $d/out $d/expected # CRLF line break support #1219 if ! x=$($JQ -n "$(printf '1\r\n+\r\n2')") || [ "$x" != '3' ]; then echo 'CRLF line break support failed?' 1>&2 exit 1 fi ## Test streaming parser ## If we add an option to stream to the `import ... as $symbol;` directive ## then we can move these tests into tests/all.test. $VALGRIND $Q $JQ -c '. as $d|path(..) as $p|$d|getpath($p)|select((type|. != "array" and . != "object") or length==0)|[$p,.]' < "$JQTESTDIR/torture/input0.json" > $d/out0 $VALGRIND $Q $JQ --stream -c '.|select(length==2)' < "$JQTESTDIR/torture/input0.json" > $d/out1 diff $d/out0 $d/out1 printf '["Unfinished JSON term at EOF at line 1, column 1",[0]]\n' > $d/expected printf '[' | $VALGRIND $Q $JQ --stream-errors -c . > $d/out 2>&1 diff $d/out $d/expected ## XXX This test can be moved to tests/all.test _now_ clean=false if which seq > /dev/null 2>&1; then # XXX We should try every prefix of input0.json, but that makes this # test very, very slow when run with valgrind, and the whole point # is to run it with valgrind. # #len=$(wc -c < "$JQTESTDIR/torture/input0.json") if [ -z "$VALGRIND" ]; then start=1 end=$(wc -c < "$JQTESTDIR/torture/input0.json") else start=120 end=151 fi for i in $(seq $start $end); do dd "if=tests/torture/input0.json" bs=$i count=1 2>/dev/null | $VALGRIND $JQ -c . > $d/out0 2>$d/err || true if [ -n "$VALGRIND" ]; then grep '^==[0-9][0-9]*== ERROR SUMMARY: 0 errors' $d/err > /dev/null else tail -n1 -- "$d/err" | grep -Ei 'assert|abort|core' && false fi dd "if=tests/torture/input0.json" bs=$i count=1 2>/dev/null | $VALGRIND $JQ -cn --stream 'fromstream(inputs)' > $d/out1 2>$d/err || true if [ -n "$VALGRIND" ]; then grep '^==[0-9][0-9]*== ERROR SUMMARY: 0 errors' $d/err > /dev/null else tail -n1 -- "$d/err" | grep -Ei 'assert|abort|core' && false fi diff $d/out0 $d/out1 done else echo "Not doing torture tests" fi ## Regression test for issue #2378 assert when stream parse broken object pair echo '{"a":1,"b",' | $JQ --stream > /dev/null 2> $d/err || true grep 'Objects must consist of key:value pairs' $d/err > /dev/null ## Regression tests for issue #2463 assert when stream parse non-scalar object key echo '{{"a":"b"}}' | $JQ --stream > /dev/null 2> $d/err || true grep "Expected string key after '{', not '{'" $d/err > /dev/null echo '{"x":"y",{"a":"b"}}' | $JQ --stream > /dev/null 2> $d/err || true grep "Expected string key after ',' in object, not '{'" $d/err > /dev/null echo '{["a","b"]}' | $JQ --stream > /dev/null 2> $d/err || true grep "Expected string key after '{', not '\\['" $d/err > /dev/null echo '{"x":"y",["a","b"]}' | $JQ --stream > /dev/null 2> $d/err || true grep "Expected string key after ',' in object, not '\\['" $d/err > /dev/null # debug, stderr $VALGRIND $Q $JQ -n '"test", {} | debug, stderr' >/dev/null $JQ -n -c -j '"hello\nworld", null, [false, 0], {"foo":["bar"]}, "\n" | stderr' >$d/out 2>$d/err cat > $d/expected <<'EOF' hello worldnull[false,0]{"foo":["bar"]} EOF cmp $d/out $d/expected cmp $d/err $d/expected # --arg, --argjson, $ARGS.named $VALGRIND $JQ -n -c --arg foo 1 --argjson bar 2 '{$foo, $bar} | ., . == $ARGS.named' > $d/out printf '{"foo":"1","bar":2}\ntrue\n' > $d/expected cmp $d/out $d/expected # --slurpfile, --rawfile $VALGRIND $JQ -n --slurpfile foo $JQBASEDIR/tests/modules/data.json \ --rawfile bar $JQBASEDIR/tests/modules/data.json '{$foo, $bar}' > $d/out cat > $d/expected <<'EOF' { "foo": [ { "this": "is a test", "that": "is too" } ], "bar": "{\n \"this\": \"is a test\",\n \"that\": \"is too\"\n}\n" } EOF cmp $d/out $d/expected # --args, --jsonargs, $ARGS.positional $VALGRIND $JQ -n -c --args '$ARGS.positional' foo bar baz > $d/out printf '["foo","bar","baz"]\n' > $d/expected cmp $d/out $d/expected $VALGRIND $JQ -n -c --jsonargs '$ARGS.positional' null true '[]' '{}' > $d/out printf '[null,true,[],{}]\n' > $d/expected cmp $d/out $d/expected $VALGRIND $JQ -n -c '$ARGS.positional' --args foo 1 --jsonargs 2 '{}' --args 3 4 > $d/out printf '["foo","1",2,{},"3","4"]\n' > $d/expected cmp $d/out $d/expected $VALGRIND $JQ -n -c '$ARGS.positional' --args --jsonargs > $d/out printf '[]\n' > $d/expected cmp $d/out $d/expected ## Regression test for issue #2572 assert when using --jsonargs and invalid JSON $VALGRIND $JQ -n --jsonargs null invalid && EC=$? || EC=$? if [ "$EC" -ne 2 ]; then echo "--jsonargs exited with wrong exit code, expected 2 got $EC" 1>&2 exit 1 fi # this tests the args_done code path "--" $VALGRIND $JQ -n --jsonargs null -- invalid && EC=$? || EC=$? if [ "$EC" -ne 2 ]; then echo "--jsonargs exited with wrong exit code, expected 2 got $EC" 1>&2 exit 1 fi ## Fuzz parser ## XXX With a $(urandom) builtin we could move this test into tests/all.test clean=false if dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null; then # Have a /dev/urandom, good $VALGRIND $Q $JQ --seq . $d/rand >/dev/null 2>&1 $VALGRIND $Q $JQ --seq --stream . $d/rand >/dev/null 2>&1 dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null $VALGRIND $Q $JQ --seq . $d/rand >/dev/null 2>&1 $VALGRIND $Q $JQ --seq --stream . $d/rand >/dev/null 2>&1 dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null $VALGRIND $Q $JQ --seq . $d/rand >/dev/null 2>&1 $VALGRIND $Q $JQ --seq --stream . $d/rand >/dev/null 2>&1 fi clean=true ## Test library/module system # Check handling of ~/.jq; these can't move into jq_test.c yet because # they depend on $HOME if [ "$(HOME="$mods/home1" $VALGRIND $Q $JQ -nr fg)" != foobar ]; then echo "Bug #479 appears to be back" 1>&2 exit 1 fi if $msys || $mingw; then HOME_BAK=$HOME unset HOME if [ "$(USERPROFILE="$mods/home1" $VALGRIND $Q $JQ -nr foo)" != baz ]; then echo "Bug #3104 regressed (sourcing %USERPROFILE%/.jq on Windows)" 1>&2 exit 1 fi export HOME=$HOME_BAK unset HOME_BAK fi if [ $(HOME="$mods/home1" $VALGRIND $Q $JQ --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l) -ne 3 ]; then echo "Binding too many defs into program" 1>&2 exit 1 fi if ! HOME="$mods/home2" $VALGRIND $Q $JQ -n 'include "g"; empty'; then echo "Mishandling directory ~/.jq" 1>&2 exit 1 fi ( cd "$JQBASEDIR" # so that relative library paths are guaranteed correct if ! $VALGRIND $Q $JQ -L ./tests/modules -ne 'import "test_bind_order" as check; check::check==true'; then echo "Issue #817 regression?" 1>&2 exit 1 fi ) ( cd "$JQBASEDIR" if ! $VALGRIND $Q $JQ -L tests/modules -ne 'import "test_bind_order" as check; check::check==true'; then echo "Issue #817 regression?" 1>&2 exit 1 fi ) # CVE-2026-44777: Circular imports should be detected if $VALGRIND $JQ -L "$mods" -ne 'import "cycle_a" as a; null' 2> $d/out; then echo "Mutual import should be rejected" 1>&2 exit 1 fi if ! grep -q "circular import" $d/out; then echo "Expected circular import error" 1>&2 exit 1 fi if $VALGRIND $JQ -L "$mods" -ne 'import "cycle_self" as s; null' 2> $d/out; then echo "Self import should be rejected" 1>&2 exit 1 fi if ! grep -q "circular import" $d/out; then echo "Expected circular import error" 1>&2 exit 1 fi ## Halt if ! $VALGRIND $Q $JQ -n halt; then echo "jq halt didn't work as expected" 1>&2 exit 1 fi if $VALGRIND $Q $VG_EXIT0 $JQ -n 'halt_error(1)'; then echo "jq halt_error(1) didn't work as expected" 1>&2 exit 1 elif [ $? -ne 1 ]; then echo "jq halt_error(1) had wrong error code" 1>&2 exit 1 fi if $VALGRIND $Q $VG_EXIT0 $JQ -n 'halt_error(11)'; then echo "jq halt_error(11) didn't work as expected" 1>&2 exit 1 elif [ $? -ne 11 ]; then echo "jq halt_error(11) had wrong error code" 1>&2 exit 1 fi if [ -n "$($VALGRIND $Q $JQ -n 'halt_error(1)' 2>&1)" ]; then echo "jq halt_error(1) had unexpected output" 1>&2 exit 1 fi if [ -n "$($VALGRIND $Q $JQ -n '"xyz\n" | halt_error(1)' 2>/dev/null)" ]; then echo "jq halt_error(1) had unexpected output on stdout" 1>&2 exit 1 fi if [ "$($VALGRIND $Q $JQ -n '"xy" | halt_error(1)' 2>&1 || echo "z")" != "xyz" ]; then echo "jq halt_error(1) had unexpected output" 1>&2 exit 1 fi if [ "$($VALGRIND $Q $JQ -n '"x\u0000y\u0000z" | halt_error(1)' 2>&1 | tr '\0' '.')" != "x.y.z" ]; then echo "jq halt_error(1) had unexpected output" 1>&2 exit 1 fi if [ "$($VALGRIND $Q $JQ -n '{"a":"xyz"} | halt_error(1)' 2>&1)" != '{"a":"xyz"}' ]; then echo "jq halt_error(1) had unexpected output" 1>&2 exit 1 fi # Check $JQ_COLORS ## Default colors, null input $JQ -Ccn . > $d/color printf '\033[0;90mnull\033[0m\n' > $d/expect cmp $d/color $d/expect ## Set non-default color, null input JQ_COLORS='4;31' $JQ -Ccn . > $d/color printf '\033[4;31mnull\033[0m\n' > $d/expect cmp $d/color $d/expect ## Set implicit empty color, null input $JQ -Ccn . > $d/color printf '\033[0;90mnull\033[0m\n' > $d/expect cmp $d/color $d/expect ## Set explicit empty color, null input JQ_COLORS=':' $JQ -Ccn . > $d/color printf '\033[mnull\033[0m\n' > $d/expect cmp $d/color $d/expect ## Extra colors, null input JQ_COLORS='::::::::' $JQ -Ccn . > $d/color printf '\033[mnull\033[0m\n' > $d/expect cmp $d/color $d/expect ## Default colors, complex input $JQ -Ccn '[{"a":true,"b":false},"abc",123,null]' > $d/color { printf '\033[1;39m[\033[0m' printf '\033[1;39m{\033[0m' printf '\033[1;34m"a"\033[0m' printf '\033[1;39m:\033[0m' printf '\033[0;39mtrue\033[0m' printf '\033[1;39m,\033[0m' printf '\033[1;34m"b"\033[0m' printf '\033[1;39m:\033[0m' printf '\033[0;39mfalse\033[0m' printf '\033[1;39m}\033[0m' printf '\033[1;39m,\033[0m' printf '\033[0;32m"abc"\033[0m' printf '\033[1;39m,\033[0m' printf '\033[0;39m123\033[0m' printf '\033[1;39m,\033[0m' printf '\033[0;90mnull\033[0m' printf '\033[1;39m]\033[0m\n' } > $d/expect cmp $d/color $d/expect ## Set non-default colors, complex input JQ_COLORS='0;30:0;31:0;32:0;33:0;34:1;35:1;36:1;37' \ $JQ -Ccn '[{"a":true,"b":false},"abc",123,null]' > $d/color { printf '\033[1;35m[\033[0m' printf '\033[1;36m{\033[0m' printf '\033[1;37m"a"\033[0m' printf '\033[1;36m:\033[0m' printf '\033[0;32mtrue\033[0m' printf '\033[1;36m,\033[0m' printf '\033[1;37m"b"\033[0m' printf '\033[1;36m:\033[0m' printf '\033[0;31mfalse\033[0m' printf '\033[1;36m}\033[0m' printf '\033[1;35m,\033[0m' printf '\033[0;34m"abc"\033[0m' printf '\033[1;35m,\033[0m' printf '\033[0;33m123\033[0m' printf '\033[1;35m,\033[0m' printf '\033[0;30mnull\033[0m' printf '\033[1;35m]\033[0m\n' } > $d/expect cmp $d/color $d/expect ## Set non-default colors only for literals, complex input JQ_COLORS='0;37:0;31:0;35:0;34:0;36' \ $JQ -Ccn '[{"a":true,"b":false},"abc",123,null]' > $d/color { printf '\033[1;39m[\033[0m' printf '\033[1;39m{\033[0m' printf '\033[1;34m"a"\033[0m' printf '\033[1;39m:\033[0m' printf '\033[0;35mtrue\033[0m' printf '\033[1;39m,\033[0m' printf '\033[1;34m"b"\033[0m' printf '\033[1;39m:\033[0m' printf '\033[0;31mfalse\033[0m' printf '\033[1;39m}\033[0m' printf '\033[1;39m,\033[0m' printf '\033[0;36m"abc"\033[0m' printf '\033[1;39m,\033[0m' printf '\033[0;34m123\033[0m' printf '\033[1;39m,\033[0m' printf '\033[0;37mnull\033[0m' printf '\033[1;39m]\033[0m\n' } > $d/expect cmp $d/color $d/expect ## Default colors, complex input, indented $JQ -Cn '[{"a":true,"b":false},"abc",123,null]' > $d/color { printf '\033[1;39m[\033[0m\n' printf ' \033[1;39m{\033[0m\n' printf ' \033[1;34m"a"\033[0m' printf '\033[1;39m:\033[0m ' printf '\033[0;39mtrue\033[0m' printf '\033[1;39m,\033[0m\n' printf ' \033[1;34m"b"\033[0m' printf '\033[1;39m:\033[0m ' printf '\033[0;39mfalse\033[0m\n' printf ' \033[1;39m}\033[0m' printf '\033[1;39m,\033[0m\n' printf ' \033[0;32m"abc"\033[0m' printf '\033[1;39m,\033[0m\n' printf ' \033[0;39m123\033[0m' printf '\033[1;39m,\033[0m\n' printf ' \033[0;90mnull\033[0m\n' printf '\033[1;39m]\033[0m\n' } > $d/expect cmp $d/color $d/expect ## Set non-default colors, complex input, indented JQ_COLORS='0;30:0;31:0;32:0;33:0;34:1;35:1;36:1;37' \ $JQ -Cn '[{"a":true,"b":false},"abc",123,null]' > $d/color { printf '\033[1;35m[\033[0m\n' printf ' \033[1;36m{\033[0m\n' printf ' \033[1;37m"a"\033[0m' printf '\033[1;36m:\033[0m ' printf '\033[0;32mtrue\033[0m' printf '\033[1;36m,\033[0m\n' printf ' \033[1;37m"b"\033[0m' printf '\033[1;36m:\033[0m ' printf '\033[0;31mfalse\033[0m\n' printf ' \033[1;36m}\033[0m' printf '\033[1;35m,\033[0m\n' printf ' \033[0;34m"abc"\033[0m' printf '\033[1;35m,\033[0m\n' printf ' \033[0;33m123\033[0m' printf '\033[1;35m,\033[0m\n' printf ' \033[0;30mnull\033[0m\n' printf '\033[1;35m]\033[0m\n' } > $d/expect cmp $d/color $d/expect ## Set truecolor, complex input, indented JQ_COLORS=$(printf '38;2;%s:' \ '255;173;173' '255;214;165' '253;255;182' '202;255;191' \ '155;246;255' '160;196;255' '189;178;255' '255;198;255') \ $JQ -Cn '[{"a":true,"b":false},"abc",123,null]' > $d/color { printf '\033[38;2;160;196;255m[\033[0m\n' printf ' \033[38;2;189;178;255m{\033[0m\n' printf ' \033[38;2;255;198;255m"a"\033[0m' printf '\033[38;2;189;178;255m:\033[0m ' printf '\033[38;2;253;255;182mtrue\033[0m' printf '\033[38;2;189;178;255m,\033[0m\n' printf ' \033[38;2;255;198;255m"b"\033[0m' printf '\033[38;2;189;178;255m:\033[0m ' printf '\033[38;2;255;214;165mfalse\033[0m\n' printf ' \033[38;2;189;178;255m}\033[0m' printf '\033[38;2;160;196;255m,\033[0m\n' printf ' \033[38;2;155;246;255m"abc"\033[0m' printf '\033[38;2;160;196;255m,\033[0m\n' printf ' \033[38;2;202;255;191m123\033[0m' printf '\033[38;2;160;196;255m,\033[0m\n' printf ' \033[38;2;255;173;173mnull\033[0m\n' printf '\033[38;2;160;196;255m]\033[0m\n' } > $d/expect cmp $d/color $d/expect # Check invalid JQ_COLORS echo 'Failed to set $JQ_COLORS' > $d/expect_warning $JQ -Ccn '[{"a":true,"b":false},"abc",123,null]' > $d/expect for colors in '/' '[30' '30m' '30:31m:32' '30:*:31' 'invalid'; do export JQ_COLORS=$colors $JQ -Ccn '[{"a":true,"b":false},"abc",123,null]' > $d/color 2>$d/warning cmp $d/color $d/expect cmp $d/warning $d/expect_warning done unset JQ_COLORS # Check $NO_COLOR test_no_color=true $msys && test_no_color=false $mingw && test_no_color=false $sunos && test_no_color=false if $test_no_color && command -v script >/dev/null 2>&1; then if script -qc echo /dev/null >/dev/null 2>&1; then faketty() { script -qec "$*" /dev/null; } else # macOS faketty() { script -q /dev/null "$@" /dev/null | sed 's/^\x5E\x44\x08\x08//'; } fi faketty $JQ_NO_B -n . > $d/color printf '\033[0;90mnull\033[0m\r\n' > $d/expect od -tc $d/expect od -tc $d/color cmp $d/color $d/expect faketty env NO_COLOR= $JQ_NO_B -n . > $d/color printf '\033[0;90mnull\033[0m\r\n' > $d/expect od -tc $d/expect od -tc $d/color cmp $d/color $d/expect faketty env NO_COLOR=1 $JQ_NO_B -n . > $d/color printf 'null\r\n' > $d/expect od -tc $d/expect od -tc $d/color cmp $d/color $d/expect faketty env NO_COLOR=1 $JQ_NO_B -Cn . > $d/color printf '\033[0;90mnull\033[0m\r\n' > $d/expect od -tc $d/expect od -tc $d/color cmp $d/color $d/expect fi # #2785 if $VALGRIND $Q $JQ -n -f "$JQTESTDIR/no-main-program.jq" > $d/out 2>&1; then echo "jq -f $JQTESTDIR/no-main-program.jq succeeded" exit 1 else EC=$? if [ $EC -eq 1 ]; then echo "jq -f $JQTESTDIR/no-main-program.jq failed with memory errors" exit 1 fi if [ $EC -ne 3 ]; then echo "jq -f $JQTESTDIR/no-main-program.jq failed with wrong exit code ($EC)" exit 1 fi fi cat > $d/expected < $d/out 2>&1; then echo "jq -f $JQTESTDIR/yes-main-program.jq failed" exit 1 fi if ! $msys && ! $mingw && locales=$(locale -a); then { l=$(grep -Ev '^(C|LANG|POSIX|en)' | grep -Ei '\.utf-?8$' | head -n1) ;} \ < $d/out 2>&1; then echo 'syntax error not detected' exit 1 fi cat > $d/expected <, line 5, column 3: catch ] ^^^^^ jq: error: Possibly unterminated 'if' statement at , line 2, column 7: try if . ^^^^ jq: error: Possibly unterminated 'try' statement at , line 2, column 3: try if . ^^^^^^^^ jq: 3 compile errors EOF diff $d/out $d/expected # Test syntax error messages when error happens at the end. if $VALGRIND $Q $JQ -n 'if ' > $d/out 2>&1; then echo 'syntax error not detected' exit 1 fi cat > $d/expected <, line 1, column 3: if ^ jq: 1 compile error EOF diff $d/out $d/expected # Comments! if ! x=$($JQ -n '123 # comment') || [ "$x" != 123 ]; then echo 'comment did not work' exit 1 fi cr=$(printf \\r) if ! x=$($JQ -n "1 # foo$cr + 2") || [ "$x" != 1 ]; then echo 'regression: carriage return terminates comment' exit 1 fi if ! x=$($JQ -cn '[ 1, # foo \ 2, # bar \\ 3, 4, # baz \\\ 5, \ 6, 7 # comment \ comment \ comment ]') || [ "$x" != '[1,3,4,7]' ]; then echo 'multiline comment was not handled correctly' exit 1 fi if ! x=$($JQ -cn "$(printf '[\r\n1,# comment\r\n2,# comment\\\r\ncomment\r\n3\r\n]')") \ || [ "$x" != '[1,2,3]' ]; then echo 'multiline comment with CRLF line breaks was not handled correctly' exit 1 fi # Allow passing the inline jq script before -- #2919 if ! r=$($JQ --args -rn -- '$ARGS.positional[0]' bar) || [ "$r" != bar ]; then echo "passing the inline script after -- didn't work" exit 1 fi if ! r=$($JQ --args -rn 1 -- '$ARGS.positional[0]' bar) || [ "$r" != 1 ]; then echo "passing the inline script before -- didn't work" exit 1 fi # CVE-2023-50246: No heap overflow for '-10E-1000000001' $VALGRIND $Q $JQ . <<\NUM -10E-1000000001 NUM # test for --indent and --compact-output -- #1465 printf '[1,2]\n' > $d/expected $JQ --compact-output -n "[1,2]" > $d/out cmp $d/out $d/expected printf '[\n1,\n2\n]\n' > $d/expected $JQ --indent 0 -n "[1,2]" > $d/out cmp $d/out $d/expected printf '[\n 1,\n 2\n]\n' > $d/expected $JQ --indent 1 -n "[1,2]" > $d/out cmp $d/out $d/expected printf '[\n 1,\n 2\n]\n' > $d/expected $JQ --indent 5 -n "[1,2]" > $d/out cmp $d/out $d/expected printf '[\n{\n"a": 1\n}\n]\n' > $d/expected $JQ --indent 0 -n "[{a:1}]" > $d/out cmp $d/out $d/expected printf '[\n {\n "a": 1\n }\n]\n' > $d/expected $JQ --indent 1 -n "[{a:1}]" > $d/out cmp $d/out $d/expected printf '[\n {\n "a": 1\n }\n]\n' > $d/expected $JQ --indent 6 -n "[{a:1}]" > $d/out cmp $d/out $d/expected if ! $msys && ! $mingw; then # Test handling of timezones -- #2429, #2475 if ! r=$(TZ=Asia/Tokyo $JQ -rn '1731627341 | strflocaltime("%F %T %z %Z")') \ || [ "$r" != "2024-11-15 08:35:41 +0900 JST" ]; then echo "Incorrectly formatted local time" exit 1 fi if ! r=$(TZ=Europe/Paris $JQ -rn '1731627341 | strflocaltime("%F %T %z %Z")') \ || [ "$r" != "2024-11-15 00:35:41 +0100 CET" ]; then echo "Incorrectly formatted local time" exit 1 fi # Test when DST is in effect: #1912 if ! r=$(TZ=Europe/Paris $JQ -rn '1750500000 | strflocaltime("%F %T %z %Z")') \ || [ "$r" != "2025-06-21 12:00:00 +0200 CEST" ]; then echo "Incorrectly formatted local time" exit 1 fi if ! r=$(TZ=Europe/Paris $JQ -rn '1731627341 | strftime("%F %T %z %Z")') \ || ( [ "$r" != "2024-11-14 23:35:41 +0000 UTC" ] \ && [ "$r" != "2024-11-14 23:35:41 +0000 GMT" ] ); then echo "Incorrectly formatted universal time" exit 1 fi if ! r=$(TZ=Etc/GMT+7 $JQ -nc '1731627341 | .,. | [strftime("%FT%T"),strflocaltime("%FT%T%z")]' ) \ || [ "$r" != '["2024-11-14T23:35:41","2024-11-14T16:35:41-0700"] ["2024-11-14T23:35:41","2024-11-14T16:35:41-0700"]' ]; then echo "strftime or strftimelocal are not pure functions" exit 1 fi fi # Test ARG_NEWCLOSURE overflow protection (issue #3458) # Test 1: Too many function parameters (4097 params triggers the limit) echo "Testing function parameter limit..." cat > $d/expected < $d/prog.jq $JQ -nf $d/prog.jq 2> $d/out && { echo "Expected compile error for too many parameters" exit 1 } diff $d/out $d/expected # Test 2: Too many local functions (4097 functions triggers the limit) echo "Testing local function limit..." cat > $d/expected < $d/prog.jq $JQ -nf $d/prog.jq 2> $d/out && { echo "Expected compile error for too many local functions" exit 1 } diff $d/out $d/expected # CVE-2026-33948: No NUL truncation in the JSON parser if printf '{}\x00{}' | $JQ >/dev/null 2> /dev/null; then printf 'Error expected but jq exited successfully\n' 1>&2 exit 1 fi # CVE-2026-41256: No NUL truncation in program files loaded with -f printf '.\x00invalid' > "$d/nul_prog.jq" if echo '42' | $JQ -f "$d/nul_prog.jq" >/dev/null 2>/dev/null; then printf 'Error expected for program file with NUL bytes\n' 1>&2 exit 1 fi # CVE-2026-43895: No NUL bytes in module/data import paths printf 'import "a\\u0000b" as $x; .' > "$d/nul_import.jq" if $JQ -nf "$d/nul_import.jq" >/dev/null 2>/dev/null; then printf 'Error expected for import path with NUL bytes\n' 1>&2 exit 1 fi printf 'include "a\\u0000b"; .' > "$d/nul_include.jq" if $JQ -nf "$d/nul_include.jq" >/dev/null 2>/dev/null; then printf 'Error expected for include path with NUL bytes\n' 1>&2 exit 1 fi printf '"a\\u0000b" | modulemeta' > "$d/nul_modulemeta.jq" if $JQ -nf "$d/nul_modulemeta.jq" >/dev/null 2>/dev/null; then printf 'Error expected for modulemeta with NUL bytes\n' 1>&2 exit 1 fi exit 0 jq-1.8.2/tests/man.test0000644000175100017510000003251715215513536010453 . "Hello, world!" "Hello, world!" . 0.12345678901234567890123456789 0.12345678901234567890123456789 [., tojson] == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end 12345678909876543212345 true [1234567890987654321,-1234567890987654321 | tojson] == if have_decnum then ["1234567890987654321","-1234567890987654321"] else ["1234567890987654400","-1234567890987654400"] end null true . < 0.12345678901234567890123456788 0.12345678901234567890123456789 false map([., . == 1]) | tojson == if have_decnum then "[[1,true],[1.000,true],[1.0,true],[1.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end [1, 1.000, 1.0, 100e-2] true . as $big | [$big, $big + 1] | map(. > 10000000000000000000000000000000) | . == if have_decnum then [true, false] else [false, false] end 10000000000000000000000000000001 true .foo {"foo": 42, "bar": "less interesting data"} 42 .foo {"notfoo": true, "alsonotfoo": false} null .["foo"] {"foo": 42} 42 .foo? {"foo": 42, "bar": "less interesting data"} 42 .foo? {"notfoo": true, "alsonotfoo": false} null .["foo"]? {"foo": 42} 42 [.foo?] [1,2] [] .[0] [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] {"name":"JSON", "good":true} .[2] [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] null .[-2] [1,2,3] 2 .[2:4] ["a","b","c","d","e"] ["c", "d"] .[2:4] "abcdefghi" "cd" .[:3] ["a","b","c","d","e"] ["a", "b", "c"] .[-2:] ["a","b","c","d","e"] ["d", "e"] .[] [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] {"name":"JSON", "good":true} {"name":"XML", "good":false} .[] [] .foo[] {"foo":[1,2,3]} 1 2 3 .[] {"a": 1, "b": 1} 1 1 .foo, .bar {"foo": 42, "bar": "something else", "baz": true} 42 "something else" .user, .projects[] {"user":"stedolan", "projects": ["jq", "wikiflow"]} "stedolan" "jq" "wikiflow" .[4,2] ["a","b","c","d","e"] "e" "c" .[] | .name [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] "JSON" "XML" (. + 2) * 5 1 15 [.user, .projects[]] {"user":"stedolan", "projects": ["jq", "wikiflow"]} ["stedolan", "jq", "wikiflow"] [ .[] | . * 2] [1, 2, 3] [2, 4, 6] {user, title: .titles[]} {"user":"stedolan","titles":["JQ Primer", "More JQ"]} {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} {(.user): .titles} {"user":"stedolan","titles":["JQ Primer", "More JQ"]} {"stedolan": ["JQ Primer", "More JQ"]} .. | .a? [[{"a":1}]] 1 .a + 1 {"a": 7} 8 .a + .b {"a": [1,2], "b": [3,4]} [1,2,3,4] .a + null {"a": 1} 1 .a + 1 {} 1 {a: 1} + {b: 2} + {c: 3} + {a: 42} null {"a": 42, "b": 2, "c": 3} 4 - .a {"a":3} 1 . - ["xml", "yaml"] ["xml", "yaml", "json"] ["json"] 10 / . * 3 5 6 . / ", " "a, b,c,d, e" ["a","b,c,d","e"] {"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}} null {"k": {"a": 0, "b": 2, "c": 3}} .[] | (1 / .)? [1,0,-1] 1 -1 map(abs) [-10, -1.1, -1e-1] [10,1.1,1e-1] .[] | length [[1,2], "string", {"a":2}, null, -5] 2 6 1 0 5 utf8bytelength "\u03bc" 2 keys {"abc": 1, "abcd": 2, "Foo": 3} ["Foo", "abc", "abcd"] keys [42,3,35] [0,1,2] map(has("foo")) [{"foo": 42}, {}] [true, false] map(has(2)) [[0,1], ["a","b","c"]] [false, true] .[] | in({"foo": 42}) ["foo", "bar"] true false map(in([0,1])) [2, 0] [false, true] map(.+1) [1,2,3] [2,3,4] map_values(.+1) {"a": 1, "b": 2, "c": 3} {"a": 2, "b": 3, "c": 4} map(., .) [1,2] [1,1,2,2] map_values(. // empty) {"a": null, "b": true, "c": false} {"b":true} pick(.a, .b.c, .x) {"a": 1, "b": {"c": 2, "d": 3}, "e": 4} {"a":1,"b":{"c":2},"x":null} pick(.[2], .[0], .[0]) [1,2,3,4] [1,null,3] path(.a[0].b) null ["a",0,"b"] [path(..)] {"a":[{"b":1}]} [[],["a"],["a",0],["a",0,"b"]] del(.foo) {"foo": 42, "bar": 9001, "baz": 42} {"bar": 9001, "baz": 42} del(.[1, 2]) ["foo", "bar", "baz"] ["foo"] getpath(["a","b"]) null null [getpath(["a","b"], ["a","c"])] {"a":{"b":0, "c":1}} [0, 1] setpath(["a","b"]; 1) null {"a": {"b": 1}} setpath(["a","b"]; 1) {"a":{"b":0}} {"a": {"b": 1}} setpath([0,"a"]; 1) null [{"a":1}] delpaths([["a","b"]]) {"a":{"b":1},"x":{"y":2}} {"a":{},"x":{"y":2}} to_entries {"a": 1, "b": 2} [{"key":"a", "value":1}, {"key":"b", "value":2}] from_entries [{"key":"a", "value":1}, {"key":"b", "value":2}] {"a": 1, "b": 2} with_entries(.key |= "KEY_" + .) {"a": 1, "b": 2} {"KEY_a": 1, "KEY_b": 2} map(select(. >= 2)) [1,5,3,0,7] [5,3,7] .[] | select(.id == "second") [{"id": "first", "val": 1}, {"id": "second", "val": 2}] {"id": "second", "val": 2} .[]|numbers [[],{},1,"foo",null,true,false] 1 1, empty, 2 null 1 2 [1,2,empty,3] null [1,2,3] try error catch . "error message" "error message" try error("invalid value: \(.)") catch . 42 "invalid value: 42" try error("\($__loc__)") catch . null "{\"file\":\"\",\"line\":1}" [paths] [1,[[],{"a":2}]] [[0],[1],[1,0],[1,1],[1,1,"a"]] [paths(type == "number")] [1,[[],{"a":2}]] [[0],[1,1,"a"]] add ["a","b","c"] "abc" add [1, 2, 3] 6 add [] null add(.[].a) [{"a":3}, {"a":5}, {"b":6}] 8 any [true, false] true any [false, false] false any [] false all [true, false] false all [true, true] true all [] true flatten [1, [2], [[3]]] [1, 2, 3] flatten(1) [1, [2], [[3]]] [1, 2, [3]] flatten [[]] [] flatten [{"foo": "bar"}, [{"foo": "baz"}]] [{"foo": "bar"}, {"foo": "baz"}] range(2; 4) null 2 3 [range(2; 4)] null [2,3] [range(4)] null [0,1,2,3] [range(0; 10; 3)] null [0,3,6,9] [range(0; 10; -1)] null [] [range(0; -5; -1)] null [0,-1,-2,-3,-4] floor 3.14159 3 sqrt 9 3 .[] | tonumber [1, "1"] 1 1 .[] | toboolean ["true", "false", true, false] true false true false .[] | tostring [1, "1", [1]] "1" "1" "[1]" map(type) [0, false, [], {}, null, "hello"] ["number", "boolean", "array", "object", "null", "string"] .[] | (infinite * .) < 0 [-1, 1] true false infinite, nan | type null "number" "number" sort [8,3,null,6] [null,3,6,8] sort_by(.foo) [{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}] [{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}] sort_by(.foo, .bar) [{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}] [{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}] group_by(.foo) [{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}] [[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]] min [5,4,2,7] 2 max_by(.foo) [{"foo":1, "bar":14}, {"foo":2, "bar":3}] {"foo":2, "bar":3} unique [1,2,5,3,5,3,1,3] [1,2,3,5] unique_by(.foo) [{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}] [{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}] unique_by(length) ["chunky", "bacon", "kitten", "cicada", "asparagus"] ["bacon", "chunky", "asparagus"] reverse [1,2,3,4] [4,3,2,1] contains("bar") "foobar" true contains(["baz", "bar"]) ["foobar", "foobaz", "blarp"] true contains(["bazzzzz", "bar"]) ["foobar", "foobaz", "blarp"] false contains({foo: 12, bar: [{barp: 12}]}) {"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]} true contains({foo: 12, bar: [{barp: 15}]}) {"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]} false indices(", ") "a,b, cd, efg, hijk" [3,7,12] indices(1) [0,1,2,1,3,1,4] [1,3,5] indices([1,2]) [0,1,2,3,1,4,2,5,1,2,6,7] [1,8] index(", ") "a,b, cd, efg, hijk" 3 index(1) [0,1,2,1,3,1,4] 1 index([1,2]) [0,1,2,3,1,4,2,5,1,2,6,7] 1 rindex(", ") "a,b, cd, efg, hijk" 12 rindex(1) [0,1,2,1,3,1,4] 5 rindex([1,2]) [0,1,2,3,1,4,2,5,1,2,6,7] 8 inside("foobar") "bar" true inside(["foobar", "foobaz", "blarp"]) ["baz", "bar"] true inside(["foobar", "foobaz", "blarp"]) ["bazzzzz", "bar"] false inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}) {"foo": 12, "bar": [{"barp": 12}]} true inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]}) {"foo": 12, "bar": [{"barp": 15}]} false [.[]|startswith("foo")] ["fo", "foo", "barfoo", "foobar", "barfoob"] [false, true, false, true, false] [.[]|endswith("foo")] ["foobar", "barfoo"] [false, true] combinations [[1,2], [3, 4]] [1, 3] [1, 4] [2, 3] [2, 4] combinations(2) [0, 1] [0, 0] [0, 1] [1, 0] [1, 1] [.[]|ltrimstr("foo")] ["fo", "foo", "barfoo", "foobar", "afoo"] ["fo","","barfoo","bar","afoo"] [.[]|rtrimstr("foo")] ["fo", "foo", "barfoo", "foobar", "foob"] ["fo","","bar","foobar","foob"] [.[]|trimstr("foo")] ["fo", "foo", "barfoo", "foobarfoo", "foob"] ["fo","","bar","bar","b"] trim, ltrim, rtrim " abc " "abc" "abc " " abc" explode "foobar" [102,111,111,98,97,114] implode [65, 66, 67] "ABC" join(", ") ["a","b,c,d","e"] "a, b,c,d, e" join(" ") ["a",1,2.3,true,null,false] "a 1 2.3 true false" ascii_upcase "useful but not for é" "USEFUL BUT NOT FOR é" [while(.<100; .*2)] 1 [1,2,4,8,16,32,64] [repeat(.*2, error)?] 1 [2] [.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1] 4 24 recurse(.foo[]) {"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]} {"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]} {"foo":[]} {"foo":[{"foo":[]}]} {"foo":[]} recurse {"a":0,"b":[1]} {"a":0,"b":[1]} 0 [1] 1 recurse(. * .; . < 20) 2 2 4 16 walk(if type == "array" then sort else . end) [[4, 1, 7], [8, 5, 2], [3, 6, 9]] [[1,4,7],[2,5,8],[3,6,9]] $ENV.PAGER null "less" env.PAGER null "less" transpose [[1], [2,3]] [[1,2],[null,3]] bsearch(0) [0,1] 0 bsearch(0) [1,2,3] -1 bsearch(4) as $ix | if $ix < 0 then .[-(1+$ix)] = 4 else . end [1,2,3] [1,2,3,4] "The input was \(.), which is one less than \(.+1)" 42 "The input was 42, which is one less than 43" [.[]|tostring] [1, "foo", ["foo"]] ["1","foo","[\"foo\"]"] [.[]|tojson] [1, "foo", ["foo"]] ["1","\"foo\"","[\"foo\"]"] [.[]|tojson|fromjson] [1, "foo", ["foo"]] [1,"foo",["foo"]] @html "This works if x < y" "This works if x < y" @sh "echo \(.)" "O'Hara's Ale" "echo 'O'\\''Hara'\\''s Ale'" @base64 "This is a message" "VGhpcyBpcyBhIG1lc3NhZ2U=" @base64d "VGhpcyBpcyBhIG1lc3NhZ2U=" "This is a message" fromdate "2015-03-05T23:51:47Z" 1425599507 strptime("%Y-%m-%dT%H:%M:%SZ") "2015-03-05T23:51:47Z" [2015,2,5,23,51,47,4,63] strptime("%Y-%m-%dT%H:%M:%SZ")|mktime "2015-03-05T23:51:47Z" 1425599507 . == false null false . == {"b": {"d": (4 + 1e-20), "c": 3}, "a":1} {"a":1, "b": {"c": 3, "d": 4}} true .[] == 1 [1, 1.0, "1", "banana"] true true false false if . == 0 then "zero" elif . == 1 then "one" else "many" end 2 "many" . < 5 2 true 42 and "a string" null true (true, false) or false null true false (true, true) and (true, false) null true false true false [true, false | not] null [false, true] empty // 42 null 42 .foo // 42 {"foo": 19} 19 .foo // 42 {} 42 (false, null, 1) // 42 null 1 (false, null, 1) | . // 42 null 42 42 1 try .a catch ". is not an object" true ". is not an object" [.[]|try .a] [{}, true, {"a":1}] [null, 1] try error("some exception") catch . true "some exception" [.[] | .a?] [{}, true, {"a":1}] [null, 1] [.[] | tonumber?] ["1", "invalid", "3", 4] [1, 3, 4] .bar as $x | .foo | . + $x {"foo":10, "bar":200} 210 . as $i|[(.*2|. as $i| $i), $i] 5 [10,5] . as [$a, $b, {c: $c}] | $a + $b + $c [2, 3, {"c": 4, "d": 5}] 9 .[] as [$a, $b] | {a: $a, b: $b} [[0], [0, 1], [2, 1, 0]] {"a":0,"b":null} {"a":0,"b":1} {"a":2,"b":1} .[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, $d, $e} [{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}] {"a":1,"b":2,"d":3,"e":4} {"a":1,"b":2,"d":3,"e":4} .[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e} [{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}] {"a":1,"b":2,"d":3,"e":null} {"a":1,"b":2,"d":null,"e":4} .[] as [$a] ?// [$b] | if $a != null then error("err: \($a)") else {$a,$b} end [[3]] {"a":null,"b":3} def addvalue(f): . + [f]; map(addvalue(.[0])) [[1,2],[10,20]] [[1,2,1], [10,20,10]] def addvalue(f): f as $x | map(. + $x); addvalue(.[0]) [[1,2],[10,20]] [[1,2,1,2], [10,20,1,2]] isempty(empty) null true isempty(.[]) [] true isempty(.[]) [1,2,3] false [limit(3; .[])] [0,1,2,3,4,5,6,7,8,9] [0,1,2] [skip(3; .[])] [0,1,2,3,4,5,6,7,8,9] [3,4,5,6,7,8,9] [first(range(.)), last(range(.)), nth(5; range(.))] 10 [0,9,5] [first(empty), last(empty), nth(5; empty)] null [] [range(.)]|[first, last, nth(5)] 10 [0,9,5] reduce .[] as $item (0; . + $item) [1,2,3,4,5] 15 reduce .[] as [$i,$j] (0; . + $i * $j) [[1,2],[3,4],[5,6]] 44 reduce .[] as {$x,$y} (null; .x += $x | .y += [$y]) [{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}] {"x":"abc","y":[1,2,3]} foreach .[] as $item (0; . + $item) [1,2,3,4,5] 1 3 6 10 15 foreach .[] as $item (0; . + $item; [$item, . * 2]) [1,2,3,4,5] [1,2] [2,6] [3,12] [4,20] [5,30] foreach .[] as $item (0; . + 1; {index: ., $item}) ["foo", "bar", "baz"] {"index":1,"item":"foo"} {"index":2,"item":"bar"} {"index":3,"item":"baz"} def range(init; upto; by): def _range: if (by > 0 and . < upto) or (by < 0 and . > upto) then ., ((.+by)|_range) else empty end; if init == upto then empty elif by == 0 then init else init|_range end; range(0; 10; 3) null 0 3 6 9 def while(cond; update): def _while: if cond then ., (update | _while) else empty end; _while; [while(.<100; .*2)] 1 [1,2,4,8,16,32,64] truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]]) 1 [[0],"b"] [[0]] fromstream(1|truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]])) null ["b"] . as $dot|fromstream($dot|tostream)|.==$dot [0,[1,{"a":1},{"b":2}]] true (..|select(type=="boolean")) |= if . then 1 else 0 end [true,false,[5,true,[true,[false]],false]] [1,0,[5,1,[1,[0]],0]] .foo += 1 {"foo": 42} {"foo": 43} .a = .b {"a": {"b": 10}, "b": 20} {"a":20,"b":20} .a |= .b {"a": {"b": 10}, "b": 20} {"a":10,"b":20} (.a, .b) = range(3) null {"a":0,"b":0} {"a":1,"b":1} {"a":2,"b":2} (.a, .b) |= range(3) null {"a":0,"b":0} jq-1.8.2/tests/modules/0000755000175100017510000000000015215513665010522 5jq-1.8.2/tests/modules/test_bind_order2.jq0000644000175100017510000000001515215513536014217 def sym2: 2; jq-1.8.2/tests/modules/test_bind_order.jq0000644000175100017510000000025515215513536014143 import "test_bind_order0" as t; import "test_bind_order1" as t; import "test_bind_order2" as t; def check: if [t::sym0,t::sym1,t::sym2] == [0,1,2] then true else false end; jq-1.8.2/tests/modules/home2/0000755000175100017510000000000015215513665011534 5jq-1.8.2/tests/modules/home2/.jq/0000755000175100017510000000000015215513665012224 5jq-1.8.2/tests/modules/home2/.jq/g.jq0000644000175100017510000000001215215513536012714 def g: 1; jq-1.8.2/tests/modules/b/0000755000175100017510000000000015215513665010743 5jq-1.8.2/tests/modules/b/b.jq0000644000175100017510000000003015215513536011426 def a: "b"; def b: "c"; jq-1.8.2/tests/modules/test_bind_order0.jq0000644000175100017510000000003215215513536014214 def sym0: 0; def sym1: 0; jq-1.8.2/tests/modules/shadow2.jq0000644000175100017510000000001215215513536012333 def e: 3; jq-1.8.2/tests/modules/lib/0000755000175100017510000000000015215513665011270 5jq-1.8.2/tests/modules/lib/jq/0000755000175100017510000000000015215513665011702 5jq-1.8.2/tests/modules/lib/jq/e/0000755000175100017510000000000015215513665012126 5jq-1.8.2/tests/modules/lib/jq/e/e.jq0000644000175100017510000000002015215513536012613 def bah: "bah"; jq-1.8.2/tests/modules/lib/jq/f.jq0000644000175100017510000000002415215513536012374 def f: "f is here"; jq-1.8.2/tests/modules/test_bind_order1.jq0000644000175100017510000000003215215513536014215 def sym1: 1; def sym2: 1; jq-1.8.2/tests/modules/syntaxerror/0000755000175100017510000000000015215513665013122 5jq-1.8.2/tests/modules/syntaxerror/syntaxerror.jq0000644000175100017510000000000515215513536015766 wat; jq-1.8.2/tests/modules/c/0000755000175100017510000000000015215513665010744 5jq-1.8.2/tests/modules/c/d.jq0000644000175100017510000000002015215513536011430 def meh: "meh"; jq-1.8.2/tests/modules/c/c.jq0000644000175100017510000000126115215513536011437 module {whatever:null}; import "a" as foo; import "d" as d {search:"./"}; import "d" as d2{search:"./"}; import "e" as e {search:"./../lib/jq"}; import "f" as f {search:"./../lib/jq"}; import "data" as $d; def a: 0; def c: if $d::d[0] != {this:"is a test",that:"is too"} then error("data import is busted") elif d2::meh != d::meh then error("import twice doesn't work") elif foo::a != "a" then error("foo::a didn't work as expected") elif d::meh != "meh" then error("d::meh didn't work as expected") elif e::bah != "bah" then error("e::bah didn't work as expected") elif f::f != "f is here" then error("f::f didn't work as expected") else foo::a + "c" + d::meh + e::bah end; jq-1.8.2/tests/modules/cycle_a.jq0000644000175100017510000000004415215513536012370 import "cycle_b" as b; def f: null; jq-1.8.2/tests/modules/cycle_b.jq0000644000175100017510000000004415215513536012371 import "cycle_a" as a; def f: null; jq-1.8.2/tests/modules/home1/0000755000175100017510000000000015215513665011533 5jq-1.8.2/tests/modules/home1/.jq0000644000175100017510000000010715215513536012061 def foo: "baz"; def f: "wat"; def f: "foo"; def g: "bar"; def fg: f+g; jq-1.8.2/tests/modules/cycle_self.jq0000644000175100017510000000004715215513536013104 import "cycle_self" as s; def f: null; jq-1.8.2/tests/modules/a.jq0000644000175100017510000000004215215513536011207 module {version:1.7}; def a: "a"; jq-1.8.2/tests/modules/shadow1.jq0000644000175100017510000000002415215513536012335 def e: 1; def e: 2; jq-1.8.2/tests/modules/data.json0000644000175100017510000000005615215513536012244 { "this": "is a test", "that": "is too" } jq-1.8.2/tests/uritest0000755000175100017510000000013715215513536010415 #!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/uri.test jq-1.8.2/tests/jq-f-test.sh0000755000175100017510000000016615215513536011143 #!/bin/sh # this next line is ignored by jq, which otherwise does not continue comments \ exec jq -nef "$0" "$@" true jq-1.8.2/tests/mantest0000755000175100017510000000026515215513536010373 #!/bin/sh . "${0%/*}/setup" "$@" # We set PAGER because there's a mantest for `env` that uses it. env PAGER=less $VALGRIND $Q $JQ -L "$mods" --run-tests $JQBASEDIR/tests/man.test jq-1.8.2/tests/uri.test0000644000175100017510000000307715215513536010476 # Tests are groups of three lines: program, input, expected output # Blank lines and lines starting with # are ignored # @uri @uri "" "" @uri "\b\t\n\f\r\"\\" "%08%09%0A%0C%0D%22%5C" @uri ",-./09:;<=>?@AZ[\\]^_`az{|}~\u007f" "%2C-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F" @uri "a \u03bc \u2230 \ud83d\ude0e" "a%20%CE%BC%20%E2%88%B0%20%F0%9F%98%8E" @uri "a\u0000b\u0000c" "a%00b%00c" # @urid @urid "" "" @urid "%08%09%0A%0C%0D%22%5C" "\b\t\n\f\r\"\\" @urid "%2C-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F" ",-./09:;<=>?@AZ[\\]^_`az{|}~\u007f" @urid "a%20%CE%BC%20%E2%88%B0%20%F0%9F%98%8E" "a \u03bc \u2230 \ud83d\ude0e" @urid "a%00b%00c" "a\u0000b\u0000c" @urid "hello world" "hello world" @urid "Knäckebröd" "Knäckebröd" @urid "%c3%a4b%c3%a7d%c3%ab" "äbçdë" @urid "a\u0000b\u0000c" "a\u0000b\u0000c" # '%' at end of string . | try @urid catch . "abc%" "string (\"abc%\") is not a valid uri encoding" # '%' followed by only one hex digit . | try @urid catch . "abc%f" "string (\"abc%f\") is not a valid uri encoding" # '%' followed by non-hex character . | try @urid catch . "abc%g" "string (\"abc%g\") is not a valid uri encoding" # invalid hex value ('FX') . | try @urid catch . "%FX%9F%98%8E" "string (\"%FX%9F%98%8E\") is not a valid uri encoding" # incomplete 4-byte UTF-8 sequence (only 3 bytes) . | try @urid catch . "%F0%93%81" "string (\"%F0%93%81\") is not a valid uri encoding" # invalid continuation byte (0xC0 is not 10xxxxxx) . | try @urid catch . "%F0%C0%81%8E" "string (\"%F0%C0%81%8E\") is not a valid uri encoding" jq-1.8.2/tests/no-main-program.jq0000644000175100017510000000001215215513536012317 def a: .; jq-1.8.2/tests/optionaltest0000755000175100017510000000014415215513536011441 #!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/optional.test jq-1.8.2/tests/optional.test0000644000175100017510000000040715215513536011516 # See tests/jq.test and the jq manual for more information. # Regression test for #3276 (fails on mingw/WIN32) fromdate "2038-01-19T03:14:08Z" 2147483648 # %e is not available on mingw/WIN32 strftime("%A, %B %e, %Y") 1435677542.822351 "Tuesday, June 30, 2015" jq-1.8.2/tests/utf8test0000755000175100017510000000140015215513536010476 #!/bin/sh -x . "${0%/*}/setup" "$@" # Reading jq file does not corrupt multi-byte characters -- #1311 for l in 1 2 3 4; do $VALGRIND $Q $JQ -rn "[(range($l) | 48), (range(3000) | 128515)] | implode | \"\\(tojson) | explode | unique == [48, 128515]\"" > $d/input if ! $VALGRIND $Q $JQ -nef $d/input > /dev/null; then echo "Reading jq file corrupted multi-byte characters" exit 1 fi done # Slurping raw input does not corrupt multi-byte characters -- #3389 for l in 1 2 3 4; do $VALGRIND $Q $JQ -jn "[(range($l) | 48), (range(3000) | 128515)] | implode" > $d/input if ! $VALGRIND $Q $JQ -Rse 'explode | unique == [48, 128515]' $d/input > /dev/null; then echo "Slurping raw input corrupted multi-byte characters" exit 1 fi done exit 0 jq-1.8.2/tests/base64.test0000644000175100017510000000137415215513536010761 # Tests are groups of three lines: program, input, expected output # Blank lines and lines starting with # are ignored @base64 "" "" @base64 "<>&'\"\t" "PD4mJyIJ" # decoding encoded output results in same text (@base64|@base64d) "<>&'\"\t" "<>&'\"\t" # regression test for #436 @base64 "foóbar\n" "Zm/Ds2Jhcgo=" @base64d "" "" @base64d "=" "" @base64d "Zm/Ds2Jhcgo=" "foóbar\n" # optional trailing equals padding (With padding, this is cWl4YmF6Cg==) @base64d "cWl4YmF6Cg" "qixbaz\n" # invalid base64 characters (whitespace) . | try @base64d catch . "Not base64 data" "string (\"Not base64 data\") is not valid base64 data" # invalid base64 (too many bytes, QUJD = "ABCD" . | try @base64d catch . "QUJDa" "string (\"QUJDa\") trailing base64 byte found" jq-1.8.2/tests/base64test0000755000175100017510000000014215215513536010676 #!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/base64.test jq-1.8.2/tests/onig.supp0000644000175100017510000000035715215513536010641 { onig node recycling Memcheck:Leak ... fun:onig_parse_make_tree ... } { onig unicode case insensitivity 1 Memcheck:Leak ... fun:setup_tree ... } { onig unicode case insensitivity 2 Memcheck:Leak ... fun:onig*unicode* ... } jq-1.8.2/tests/onigtest0000755000175100017510000000014015215513536010544 #!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/onig.test jq-1.8.2/tests/yes-main-program.jq0000644000175100017510000000001415215513536012505 def a: .; 0 jq-1.8.2/tests/jqtest0000755000175100017510000000013615215513536010227 #!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/jq.test jq-1.8.2/jq.1.prebuilt0000644000175100017510000036253615215513536010165 . .TH "JQ" "1" "May 2025" "" "" . .SH "NAME" \fBjq\fR \- Command\-line JSON processor . .SH "SYNOPSIS" \fBjq\fR [\fIoptions\fR\.\.\.] \fIfilter\fR [\fIfiles\fR\.\.\.] . .P \fBjq\fR can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents\. For instance, running the command \fBjq \'map(\.price) | add\'\fR will take an array of JSON objects as input and return the sum of their "price" fields\. . .P \fBjq\fR can accept text input as well, but by default, \fBjq\fR reads a stream of JSON entities (including numbers and other literals) from \fBstdin\fR\. Whitespace is only needed to separate entities such as 1 and 2, and true and false\. One or more \fIfiles\fR may be specified, in which case \fBjq\fR will read input from those instead\. . .P The \fIoptions\fR are described in the [INVOKING JQ] section; they mostly concern input and output formatting\. The \fIfilter\fR is written in the jq language and specifies how to transform the input file or document\. . .SH "FILTERS" A jq program is a "filter": it takes an input, and produces an output\. There are a lot of builtin filters for extracting a particular field of an object, or converting a number to a string, or various other standard tasks\. . .P Filters can be combined in various ways \- you can pipe the output of one filter into another filter, or collect the output of a filter into an array\. . .P Some filters produce multiple results, for instance there\'s one that produces all the elements of its input array\. Piping that filter into a second runs the second filter for each element of the array\. Generally, things that would be done with loops and iteration in other languages are just done by gluing filters together in jq\. . .P It\'s important to remember that every filter has an input and an output\. Even literals like "hello" or 42 are filters \- they take an input but always produce the same literal as output\. Operations that combine two filters, like addition, generally feed the same input to both and combine the results\. So, you can implement an averaging filter as \fBadd / length\fR \- feeding the input array both to the \fBadd\fR filter and the \fBlength\fR filter and then performing the division\. . .P But that\'s getting ahead of ourselves\. :) Let\'s start with something simpler: . .SH "INVOKING JQ" jq filters run on a stream of JSON data\. The input to jq is parsed as a sequence of whitespace\-separated JSON values which are passed through the provided filter one at a time\. The output(s) of the filter are written to standard output, as a sequence of newline\-separated JSON data\. . .P The simplest and most common filter (or jq program) is \fB\.\fR, which is the identity operator, copying the inputs of the jq processor to the output stream\. Because the default behavior of the jq processor is to read JSON texts from the input stream, and to pretty\-print outputs, the \fB\.\fR program\'s main use is to validate and pretty\-print the inputs\. The jq programming language is quite rich and allows for much more than just validation and pretty\-printing\. . .P Note: it is important to mind the shell\'s quoting rules\. As a general rule it\'s best to always quote (with single\-quote characters on Unix shells) the jq program, as too many characters with special meaning to jq are also shell meta\-characters\. For example, \fBjq "foo"\fR will fail on most Unix shells because that will be the same as \fBjq foo\fR, which will generally fail because \fBfoo is not defined\fR\. When using the Windows command shell (cmd\.exe) it\'s best to use double quotes around your jq program when given on the command\-line (instead of the \fB\-f program\-file\fR option), but then double\-quotes in the jq program need backslash escaping\. When using the Powershell (\fBpowershell\.exe\fR) or the Powershell Core (\fBpwsh\fR/\fBpwsh\.exe\fR), use single\-quote characters around the jq program and backslash\-escaped double\-quotes (\fB\e"\fR) inside the jq program\. . .IP "\(bu" 4 Unix shells: \fBjq \'\.["foo"]\'\fR . .IP "\(bu" 4 Powershell: \fBjq \'\.[\e"foo\e"]\'\fR . .IP "\(bu" 4 Windows command shell: \fBjq "\.[\e"foo\e"]"\fR . .IP "" 0 . .P Note: jq allows user\-defined functions, but every jq program must have a top\-level expression\. . .P You can affect how jq reads and writes its input and output using some command\-line options: . .TP \fB\-\-null\-input\fR / \fB\-n\fR: . .IP Don\'t read any input at all\. Instead, the filter is run once using \fBnull\fR as the input\. This is useful when using jq as a simple calculator or to construct JSON data from scratch\. . .TP \fB\-\-raw\-input\fR / \fB\-R\fR: . .IP Don\'t parse the input as JSON\. Instead, each line of text is passed to the filter as a string\. If combined with \fB\-\-slurp\fR, then the entire input is passed to the filter as a single long string\. . .TP \fB\-\-slurp\fR / \fB\-s\fR: . .IP Instead of running the filter for each JSON object in the input, read the entire input stream into a large array and run the filter just once\. . .TP \fB\-\-compact\-output\fR / \fB\-c\fR: . .IP By default, jq pretty\-prints JSON output\. Using this option will result in more compact output by instead putting each JSON object on a single line\. . .TP \fB\-\-raw\-output\fR / \fB\-r\fR: . .IP With this option, if the filter\'s result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes\. This can be useful for making jq filters talk to non\-JSON\-based systems\. . .TP \fB\-\-raw\-output0\fR: . .IP Like \fB\-r\fR but jq will print NUL instead of newline after each output\. This can be useful when the values being output can contain newlines\. When the output value contains NUL, jq exits with non\-zero code\. . .TP \fB\-\-join\-output\fR / \fB\-j\fR: . .IP Like \fB\-r\fR but jq won\'t print a newline after each output\. . .TP \fB\-\-ascii\-output\fR / \fB\-a\fR: . .IP jq usually outputs non\-ASCII Unicode codepoints as UTF\-8, even if the input specified them as escape sequences (like "\eu03bc")\. Using this option, you can force jq to produce pure ASCII output with every non\-ASCII character replaced with the equivalent escape sequence\. . .TP \fB\-\-sort\-keys\fR / \fB\-S\fR: . .IP Output the fields of each object with the keys in sorted order\. . .TP \fB\-\-color\-output\fR / \fB\-C\fR and \fB\-\-monochrome\-output\fR / \fB\-M\fR: . .IP By default, jq outputs colored JSON if writing to a terminal\. You can force it to produce color even if writing to a pipe or a file using \fB\-C\fR, and disable color with \fB\-M\fR\. When the \fBNO_COLOR\fR environment variable is not empty, jq disables colored output by default, but you can enable it by \fB\-C\fR\. . .IP Colors can be configured with the \fBJQ_COLORS\fR environment variable (see below)\. . .TP \fB\-\-tab\fR: . .IP Use a tab for each indentation level instead of two spaces\. . .TP \fB\-\-indent n\fR: . .IP Use the given number of spaces (no more than 7) for indentation\. . .TP \fB\-\-unbuffered\fR: . .IP Flush the output after each JSON object is printed (useful if you\'re piping a slow data source into jq and piping jq\'s output elsewhere)\. . .TP \fB\-\-stream\fR: . .IP Parse the input in streaming fashion, outputting arrays of path and leaf values (scalars and empty arrays or empty objects)\. For example, \fB"a"\fR becomes \fB[[],"a"]\fR, and \fB[[],"a",["b"]]\fR becomes \fB[[0],[]]\fR, \fB[[1],"a"]\fR, and \fB[[2,0],"b"]\fR\. . .IP This is useful for processing very large inputs\. Use this in conjunction with filtering and the \fBreduce\fR and \fBforeach\fR syntax to reduce large inputs incrementally\. . .TP \fB\-\-stream\-errors\fR: . .IP Like \fB\-\-stream\fR, but invalid JSON inputs yield array values where the first element is the error and the second is a path\. For example, \fB["a",n]\fR produces \fB["Invalid literal at line 1, column 7",[1]]\fR\. . .IP Implies \fB\-\-stream\fR\. Invalid JSON inputs produce no error values when \fB\-\-stream\fR without \fB\-\-stream\-errors\fR\. . .TP \fB\-\-seq\fR: . .IP Use the \fBapplication/json\-seq\fR MIME type scheme for separating JSON texts in jq\'s input and output\. This means that an ASCII RS (record separator) character is printed before each value on output and an ASCII LF (line feed) is printed after every output\. Input JSON texts that fail to parse are ignored (but warned about), discarding all subsequent input until the next RS\. This mode also parses the output of jq without the \fB\-\-seq\fR option\. . .TP \fB\-f\fR / \fB\-\-from\-file\fR: . .IP Read the filter from a file rather than from a command line, like awk\'s \-f option\. This changes the filter argument to be interpreted as a filename, instead of the source of a program\. . .TP \fB\-L directory\fR / \fB\-\-library\-path directory\fR: . .IP Prepend \fBdirectory\fR to the search list for modules\. If this option is used then no builtin search list is used\. See the section on modules below\. . .TP \fB\-\-arg name value\fR: . .IP This option passes a value to the jq program as a predefined variable\. If you run jq with \fB\-\-arg foo bar\fR, then \fB$foo\fR is available in the program and has the value \fB"bar"\fR\. Note that \fBvalue\fR will be treated as a string, so \fB\-\-arg foo 123\fR will bind \fB$foo\fR to \fB"123"\fR\. . .IP Named arguments are also available to the jq program as \fB$ARGS\.named\fR\. When the name is not a valid identifier, this is the only way to access it\. . .TP \fB\-\-argjson name JSON\-text\fR: . .IP This option passes a JSON\-encoded value to the jq program as a predefined variable\. If you run jq with \fB\-\-argjson foo 123\fR, then \fB$foo\fR is available in the program and has the value \fB123\fR\. . .TP \fB\-\-slurpfile variable\-name filename\fR: . .IP This option reads all the JSON texts in the named file and binds an array of the parsed JSON values to the given global variable\. If you run jq with \fB\-\-slurpfile foo bar\fR, then \fB$foo\fR is available in the program and has an array whose elements correspond to the texts in the file named \fBbar\fR\. . .TP \fB\-\-rawfile variable\-name filename\fR: . .IP This option reads in the named file and binds its content to the given global variable\. If you run jq with \fB\-\-rawfile foo bar\fR, then \fB$foo\fR is available in the program and has a string whose content is set to the text in the file named \fBbar\fR\. . .TP \fB\-\-args\fR: . .IP Remaining arguments are positional string arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\. . .TP \fB\-\-jsonargs\fR: . .IP Remaining arguments are positional JSON text arguments\. These are available to the jq program as \fB$ARGS\.positional[]\fR\. . .TP \fB\-\-exit\-status\fR / \fB\-e\fR: . .IP Sets the exit status of jq to 0 if the last output value was neither \fBfalse\fR nor \fBnull\fR, 1 if the last output value was either \fBfalse\fR or \fBnull\fR, or 4 if no valid result was ever produced\. Normally jq exits with 2 if there was any usage problem or system error, 3 if there was a jq program compile error, or 0 if the jq program ran\. . .IP Another way to set the exit status is with the \fBhalt_error\fR builtin function\. . .TP \fB\-\-binary\fR / \fB\-b\fR: . .IP Windows users using WSL, MSYS2, or Cygwin, should use this option when using a native jq\.exe, otherwise jq will turn newlines (LFs) into carriage\-return\-then\-newline (CRLF)\. . .TP \fB\-\-version\fR / \fB\-V\fR: . .IP Output the jq version and exit with zero\. . .TP \fB\-\-build\-configuration\fR: . .IP Output the build configuration of jq and exit with zero\. This output has no supported format or structure and may change without notice in future releases\. . .TP \fB\-\-help\fR / \fB\-h\fR: . .IP Output the jq help and exit with zero\. . .TP \fB\-\-\fR: . .IP Terminates argument processing\. Remaining arguments are not interpreted as options\. . .TP \fB\-\-run\-tests [filename]\fR: . .IP Runs the tests in the given file or standard input\. This must be the last option given and does not honor all preceding options\. The input consists of comment lines, empty lines, and program lines followed by one input line, as many lines of output as are expected (one per output), and a terminating empty line\. Compilation failure tests start with a line containing only \fB%%FAIL\fR, then a line containing the program to compile, then a line containing an error message to compare to the actual\. . .IP Be warned that this option can change backwards\-incompatibly\. . .SH "BASIC FILTERS" . .SS "Identity: \." The absolute simplest filter is \fB\.\fR \. This filter takes its input and produces the same value as output\. That is, this is the identity operator\. . .P Since jq by default pretty\-prints all output, a trivial program consisting of nothing but \fB\.\fR can be used to format JSON output from, say, \fBcurl\fR\. . .P Although the identity filter never modifies the value of its input, jq processing can sometimes make it appear as though it does\. For example, using the current implementation of jq, we would see that the expression: . .IP "" 4 . .nf 1E1234567890 | \. . .fi . .IP "" 0 . .P produces \fB1\.7976931348623157e+308\fR on at least one platform\. This is because, in the process of parsing the number, this particular version of jq has converted it to an IEEE754 double\-precision representation, losing precision\. . .P The way in which jq handles numbers has changed over time and further changes are likely within the parameters set by the relevant JSON standards\. Moreover, build configuration options can alter how jq processes numbers\. . .P The following remarks are therefore offered with the understanding that they are intended to be descriptive of the current version of jq and should not be interpreted as being prescriptive: . .P (1) Any arithmetic operation on a number that has not already been converted to an IEEE754 double precision representation will trigger a conversion to the IEEE754 representation\. . .P (2) jq will attempt to maintain the original decimal precision of number literals (if the \fB\-\-disable\-decnum\fR build configuration option was not used), but in expressions such \fB1E1234567890\fR, precision will be lost if the exponent is too large\. . .P (3) Comparisons are carried out using the untruncated big decimal representation of numbers if available, as illustrated in one of the following examples\. . .P The examples below use the builtin function \fBhave_decnum\fR in order to demonstrate the expected effects of using / not using the \fB\-\-disable\-decnum\fR build configuration option, and also to allow automated tests derived from these examples to pass regardless of whether that option is used\. . .IP "" 4 . .nf jq \'\.\' "Hello, world!" => "Hello, world!" jq \'\.\' 0\.12345678901234567890123456789 => 0\.12345678901234567890123456789 jq \'[\., tojson] == if have_decnum then [12345678909876543212345,"12345678909876543212345"] else [12345678909876543000000,"12345678909876543000000"] end\' 12345678909876543212345 => true jq \'[1234567890987654321,\-1234567890987654321 | tojson] == if have_decnum then ["1234567890987654321","\-1234567890987654321"] else ["1234567890987654400","\-1234567890987654400"] end\' null => true jq \'\. < 0\.12345678901234567890123456788\' 0\.12345678901234567890123456789 => false jq \'map([\., \. == 1]) | tojson == if have_decnum then "[[1,true],[1\.000,true],[1\.0,true],[1\.00,true]]" else "[[1,true],[1,true],[1,true],[1,true]]" end\' [1, 1\.000, 1\.0, 100e\-2] => true jq \'\. as $big | [$big, $big + 1] | map(\. > 10000000000000000000000000000000) | \. == if have_decnum then [true, false] else [false, false] end\' 10000000000000000000000000000001 => true . .fi . .IP "" 0 . .SS "Object Identifier\-Index: \.foo, \.foo\.bar" The simplest \fIuseful\fR filter has the form \fB\.foo\fR\. When given a JSON object (aka dictionary or hash) as input, \fB\.foo\fR produces the value at the key "foo" if the key is present, or null otherwise\. . .P A filter of the form \fB\.foo\.bar\fR is equivalent to \fB\.foo | \.bar\fR\. . .P The \fB\.foo\fR syntax only works for simple, identifier\-like keys, that is, keys that are all made of alphanumeric characters and underscore, and which do not start with a digit\. . .P If the key contains special characters or starts with a digit, you need to surround it with double quotes like this: \fB\."foo$"\fR, or else \fB\.["foo$"]\fR\. . .P For example \fB\.["foo::bar"]\fR and \fB\.["foo\.bar"]\fR work while \fB\.foo::bar\fR does not\. . .IP "" 4 . .nf jq \'\.foo\' {"foo": 42, "bar": "less interesting data"} => 42 jq \'\.foo\' {"notfoo": true, "alsonotfoo": false} => null jq \'\.["foo"]\' {"foo": 42} => 42 . .fi . .IP "" 0 . .SS "Optional Object Identifier\-Index: \.foo?" Just like \fB\.foo\fR, but does not output an error when \fB\.\fR is not an object\. . .IP "" 4 . .nf jq \'\.foo?\' {"foo": 42, "bar": "less interesting data"} => 42 jq \'\.foo?\' {"notfoo": true, "alsonotfoo": false} => null jq \'\.["foo"]?\' {"foo": 42} => 42 jq \'[\.foo?]\' [1,2] => [] . .fi . .IP "" 0 . .SS "Object Index: \.[]" You can also look up fields of an object using syntax like \fB\.["foo"]\fR (\fB\.foo\fR above is a shorthand version of this, but only for identifier\-like strings)\. . .SS "Array Index: \.[]" When the index value is an integer, \fB\.[]\fR can index arrays\. Arrays are zero\-based, so \fB\.[2]\fR returns the third element\. . .P Negative indices are allowed, with \-1 referring to the last element, \-2 referring to the next to last element, and so on\. . .IP "" 4 . .nf jq \'\.[0]\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => {"name":"JSON", "good":true} jq \'\.[2]\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => null jq \'\.[\-2]\' [1,2,3] => 2 . .fi . .IP "" 0 . .SS "Array/String Slice: \.[:]" The \fB\.[:]\fR syntax can be used to return a subarray of an array or substring of a string\. The array returned by \fB\.[10:15]\fR will be of length 5, containing the elements from index 10 (inclusive) to index 15 (exclusive)\. Either index may be negative (in which case it counts backwards from the end of the array), or omitted (in which case it refers to the start or end of the array)\. Indices are zero\-based\. . .IP "" 4 . .nf jq \'\.[2:4]\' ["a","b","c","d","e"] => ["c", "d"] jq \'\.[2:4]\' "abcdefghi" => "cd" jq \'\.[:3]\' ["a","b","c","d","e"] => ["a", "b", "c"] jq \'\.[\-2:]\' ["a","b","c","d","e"] => ["d", "e"] . .fi . .IP "" 0 . .SS "Array/Object Value Iterator: \.[]" If you use the \fB\.[index]\fR syntax, but omit the index entirely, it will return \fIall\fR of the elements of an array\. Running \fB\.[]\fR with the input \fB[1,2,3]\fR will produce the numbers as three separate results, rather than as a single array\. A filter of the form \fB\.foo[]\fR is equivalent to \fB\.foo | \.[]\fR\. . .P You can also use this on an object, and it will return all the values of the object\. . .P Note that the iterator operator is a generator of values\. . .IP "" 4 . .nf jq \'\.[]\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => {"name":"JSON", "good":true}, {"name":"XML", "good":false} jq \'\.[]\' [] => jq \'\.foo[]\' {"foo":[1,2,3]} => 1, 2, 3 jq \'\.[]\' {"a": 1, "b": 1} => 1, 1 . .fi . .IP "" 0 . .SS "\.[]?" Like \fB\.[]\fR, but no errors will be output if \. is not an array or object\. A filter of the form \fB\.foo[]?\fR is equivalent to \fB\.foo | \.[]?\fR\. . .SS "Comma: ," If two filters are separated by a comma, then the same input will be fed into both and the two filters\' output value streams will be concatenated in order: first, all of the outputs produced by the left expression, and then all of the outputs produced by the right\. For instance, filter \fB\.foo, \.bar\fR, produces both the "foo" fields and "bar" fields as separate outputs\. . .P The \fB,\fR operator is one way to construct generators\. . .IP "" 4 . .nf jq \'\.foo, \.bar\' {"foo": 42, "bar": "something else", "baz": true} => 42, "something else" jq \'\.user, \.projects[]\' {"user":"stedolan", "projects": ["jq", "wikiflow"]} => "stedolan", "jq", "wikiflow" jq \'\.[4,2]\' ["a","b","c","d","e"] => "e", "c" . .fi . .IP "" 0 . .SS "Pipe: |" The | operator combines two filters by feeding the output(s) of the one on the left into the input of the one on the right\. It\'s similar to the Unix shell\'s pipe, if you\'re used to that\. . .P If the one on the left produces multiple results, the one on the right will be run for each of those results\. So, the expression \fB\.[] | \.foo\fR retrieves the "foo" field of each element of the input array\. This is a cartesian product, which can be surprising\. . .P Note that \fB\.a\.b\.c\fR is the same as \fB\.a | \.b | \.c\fR\. . .P Note too that \fB\.\fR is the input value at the particular stage in a "pipeline", specifically: where the \fB\.\fR expression appears\. Thus \fB\.a | \. | \.b\fR is the same as \fB\.a\.b\fR, as the \fB\.\fR in the middle refers to whatever value \fB\.a\fR produced\. . .IP "" 4 . .nf jq \'\.[] | \.name\' [{"name":"JSON", "good":true}, {"name":"XML", "good":false}] => "JSON", "XML" . .fi . .IP "" 0 . .SS "Parenthesis" Parenthesis work as a grouping operator just as in any typical programming language\. . .IP "" 4 . .nf jq \'(\. + 2) * 5\' 1 => 15 . .fi . .IP "" 0 . .SH "TYPES AND VALUES" jq supports the same set of datatypes as JSON \- numbers, strings, booleans, arrays, objects (which in JSON\-speak are hashes with only string keys), and "null"\. . .P Booleans, null, strings and numbers are written the same way as in JSON\. Just like everything else in jq, these simple values take an input and produce an output \- \fB42\fR is a valid jq expression that takes an input, ignores it, and returns 42 instead\. . .P Numbers in jq are internally represented by their IEEE754 double precision approximation\. Any arithmetic operation with numbers, whether they are literals or results of previous filters, will produce a double precision floating point result\. . .P However, when parsing a literal jq will store the original literal string\. If no mutation is applied to this value then it will make to the output in its original form, even if conversion to double would result in a loss\. . .SS "Array construction: []" As in JSON, \fB[]\fR is used to construct arrays, as in \fB[1,2,3]\fR\. The elements of the arrays can be any jq expression, including a pipeline\. All of the results produced by all of the expressions are collected into one big array\. You can use it to construct an array out of a known quantity of values (as in \fB[\.foo, \.bar, \.baz]\fR) or to "collect" all the results of a filter into an array (as in \fB[\.items[]\.name]\fR) . .P Once you understand the "," operator, you can look at jq\'s array syntax in a different light: the expression \fB[1,2,3]\fR is not using a built\-in syntax for comma\-separated arrays, but is instead applying the \fB[]\fR operator (collect results) to the expression 1,2,3 (which produces three different results)\. . .P If you have a filter \fBX\fR that produces four results, then the expression \fB[X]\fR will produce a single result, an array of four elements\. . .IP "" 4 . .nf jq \'[\.user, \.projects[]]\' {"user":"stedolan", "projects": ["jq", "wikiflow"]} => ["stedolan", "jq", "wikiflow"] jq \'[ \.[] | \. * 2]\' [1, 2, 3] => [2, 4, 6] . .fi . .IP "" 0 . .SS "Object Construction: {}" Like JSON, \fB{}\fR is for constructing objects (aka dictionaries or hashes), as in: \fB{"a": 42, "b": 17}\fR\. . .P If the keys are "identifier\-like", then the quotes can be left off, as in \fB{a:42, b:17}\fR\. Variable references as key expressions use the value of the variable as the key\. Key expressions other than constant literals, identifiers, or variable references, need to be parenthesized, e\.g\., \fB{("a"+"b"):59}\fR\. . .P The value can be any expression (although you may need to wrap it in parentheses if, for example, it contains colons), which gets applied to the {} expression\'s input (remember, all filters have an input and an output)\. . .IP "" 4 . .nf {foo: \.bar} . .fi . .IP "" 0 . .P will produce the JSON object \fB{"foo": 42}\fR if given the JSON object \fB{"bar":42, "baz":43}\fR as its input\. You can use this to select particular fields of an object: if the input is an object with "user", "title", "id", and "content" fields and you just want "user" and "title", you can write . .IP "" 4 . .nf {user: \.user, title: \.title} . .fi . .IP "" 0 . .P Because that is so common, there\'s a shortcut syntax for it: \fB{user, title}\fR\. . .P If one of the expressions produces multiple results, multiple dictionaries will be produced\. If the input\'s . .IP "" 4 . .nf {"user":"stedolan","titles":["JQ Primer", "More JQ"]} . .fi . .IP "" 0 . .P then the expression . .IP "" 4 . .nf {user, title: \.titles[]} . .fi . .IP "" 0 . .P will produce two outputs: . .IP "" 4 . .nf {"user":"stedolan", "title": "JQ Primer"} {"user":"stedolan", "title": "More JQ"} . .fi . .IP "" 0 . .P Putting parentheses around the key means it will be evaluated as an expression\. With the same input as above, . .IP "" 4 . .nf {(\.user): \.titles} . .fi . .IP "" 0 . .P produces . .IP "" 4 . .nf {"stedolan": ["JQ Primer", "More JQ"]} . .fi . .IP "" 0 . .P Variable references as keys use the value of the variable as the key\. Without a value then the variable\'s name becomes the key and its value becomes the value, . .IP "" 4 . .nf "f o o" as $foo | "b a r" as $bar | {$foo, $bar:$foo} . .fi . .IP "" 0 . .P produces . .IP "" 4 . .nf {"foo":"f o o","b a r":"f o o"} jq \'{user, title: \.titles[]}\' {"user":"stedolan","titles":["JQ Primer", "More JQ"]} => {"user":"stedolan", "title": "JQ Primer"}, {"user":"stedolan", "title": "More JQ"} jq \'{(\.user): \.titles}\' {"user":"stedolan","titles":["JQ Primer", "More JQ"]} => {"stedolan": ["JQ Primer", "More JQ"]} . .fi . .IP "" 0 . .SS "Recursive Descent: \.\." Recursively descends \fB\.\fR, producing every value\. This is the same as the zero\-argument \fBrecurse\fR builtin (see below)\. This is intended to resemble the XPath \fB//\fR operator\. Note that \fB\.\.a\fR does not work; use \fB\.\. | \.a\fR instead\. In the example below we use \fB\.\. | \.a?\fR to find all the values of object keys "a" in any object found "below" \fB\.\fR\. . .P This is particularly useful in conjunction with \fBpath(EXP)\fR (also see below) and the \fB?\fR operator\. . .IP "" 4 . .nf jq \'\.\. | \.a?\' [[{"a":1}]] => 1 . .fi . .IP "" 0 . .SH "BUILTIN OPERATORS AND FUNCTIONS" Some jq operators (for instance, \fB+\fR) do different things depending on the type of their arguments (arrays, numbers, etc\.)\. However, jq never does implicit type conversions\. If you try to add a string to an object you\'ll get an error message and no result\. . .P Please note that all numbers are converted to IEEE754 double precision floating point representation\. Arithmetic and logical operators are working with these converted doubles\. Results of all such operations are also limited to the double precision\. . .P The only exception to this behaviour of number is a snapshot of original number literal\. When a number which originally was provided as a literal is never mutated until the end of the program then it is printed to the output in its original literal form\. This also includes cases when the original literal would be truncated when converted to the IEEE754 double precision floating point number\. . .SS "Addition: +" The operator \fB+\fR takes two filters, applies them both to the same input, and adds the results together\. What "adding" means depends on the types involved: . .IP "\(bu" 4 \fBNumbers\fR are added by normal arithmetic\. . .IP "\(bu" 4 \fBArrays\fR are added by being concatenated into a larger array\. . .IP "\(bu" 4 \fBStrings\fR are added by being joined into a larger string\. . .IP "\(bu" 4 \fBObjects\fR are added by merging, that is, inserting all the key\-value pairs from both objects into a single combined object\. If both objects contain a value for the same key, the object on the right of the \fB+\fR wins\. (For recursive merge use the \fB*\fR operator\.) . .IP "" 0 . .P \fBnull\fR can be added to any value, and returns the other value unchanged\. . .IP "" 4 . .nf jq \'\.a + 1\' {"a": 7} => 8 jq \'\.a + \.b\' {"a": [1,2], "b": [3,4]} => [1,2,3,4] jq \'\.a + null\' {"a": 1} => 1 jq \'\.a + 1\' {} => 1 jq \'{a: 1} + {b: 2} + {c: 3} + {a: 42}\' null => {"a": 42, "b": 2, "c": 3} . .fi . .IP "" 0 . .SS "Subtraction: \-" As well as normal arithmetic subtraction on numbers, the \fB\-\fR operator can be used on arrays to remove all occurrences of the second array\'s elements from the first array\. . .IP "" 4 . .nf jq \'4 \- \.a\' {"a":3} => 1 jq \'\. \- ["xml", "yaml"]\' ["xml", "yaml", "json"] => ["json"] . .fi . .IP "" 0 . .SS "Multiplication, division, modulo: *, /, %" These infix operators behave as expected when given two numbers\. Division by zero raises an error\. \fBx % y\fR computes x modulo y\. . .P Multiplying a string by a number produces the concatenation of that string that many times\. \fB"x" * 0\fR produces \fB""\fR\. . .P Dividing a string by another splits the first using the second as separators\. . .P Multiplying two objects will merge them recursively: this works like addition but if both objects contain a value for the same key, and the values are objects, the two are merged with the same strategy\. . .IP "" 4 . .nf jq \'10 / \. * 3\' 5 => 6 jq \'\. / ", "\' "a, b,c,d, e" => ["a","b,c,d","e"] jq \'{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}\' null => {"k": {"a": 0, "b": 2, "c": 3}} jq \'\.[] | (1 / \.)?\' [1,0,\-1] => 1, \-1 . .fi . .IP "" 0 . .SS "abs" The builtin function \fBabs\fR is defined naively as: \fBif \. < 0 then \- \. else \. end\fR\. . .P For numeric input, this is the absolute value\. See the section on the identity filter for the implications of this definition for numeric input\. . .P To compute the absolute value of a number as a floating point number, you may wish use \fBfabs\fR\. . .IP "" 4 . .nf jq \'map(abs)\' [\-10, \-1\.1, \-1e\-1] => [10,1\.1,1e\-1] . .fi . .IP "" 0 . .SS "length" The builtin function \fBlength\fR gets the length of various different types of value: . .IP "\(bu" 4 The length of a \fBstring\fR is the number of Unicode codepoints it contains (which will be the same as its JSON\-encoded length in bytes if it\'s pure ASCII)\. . .IP "\(bu" 4 The length of a \fBnumber\fR is its absolute value\. . .IP "\(bu" 4 The length of an \fBarray\fR is the number of elements\. . .IP "\(bu" 4 The length of an \fBobject\fR is the number of key\-value pairs\. . .IP "\(bu" 4 The length of \fBnull\fR is zero\. . .IP "\(bu" 4 It is an error to use \fBlength\fR on a \fBboolean\fR\. . .IP "" 4 . .nf jq \'\.[] | length\' [[1,2], "string", {"a":2}, null, \-5] => 2, 6, 1, 0, 5 . .fi . .IP "" 0 . .SS "utf8bytelength" The builtin function \fButf8bytelength\fR outputs the number of bytes used to encode a string in UTF\-8\. . .IP "" 4 . .nf jq \'utf8bytelength\' "\eu03bc" => 2 . .fi . .IP "" 0 . .SS "keys, keys_unsorted" The builtin function \fBkeys\fR, when given an object, returns its keys in an array\. . .P The keys are sorted "alphabetically", by unicode codepoint order\. This is not an order that makes particular sense in any particular language, but you can count on it being the same for any two objects with the same set of keys, regardless of locale settings\. . .P When \fBkeys\fR is given an array, it returns the valid indices for that array: the integers from 0 to length\-1\. . .P The \fBkeys_unsorted\fR function is just like \fBkeys\fR, but if the input is an object then the keys will not be sorted, instead the keys will roughly be in insertion order\. . .IP "" 4 . .nf jq \'keys\' {"abc": 1, "abcd": 2, "Foo": 3} => ["Foo", "abc", "abcd"] jq \'keys\' [42,3,35] => [0,1,2] . .fi . .IP "" 0 . .SS "has(key)" The builtin function \fBhas\fR returns whether the input object has the given key, or the input array has an element at the given index\. . .P \fBhas($key)\fR has the same effect as checking whether \fB$key\fR is a member of the array returned by \fBkeys\fR, although \fBhas\fR will be faster\. . .IP "" 4 . .nf jq \'map(has("foo"))\' [{"foo": 42}, {}] => [true, false] jq \'map(has(2))\' [[0,1], ["a","b","c"]] => [false, true] . .fi . .IP "" 0 . .SS "in" The builtin function \fBin\fR returns whether or not the input key is in the given object, or the input index corresponds to an element in the given array\. It is, essentially, an inversed version of \fBhas\fR\. . .IP "" 4 . .nf jq \'\.[] | in({"foo": 42})\' ["foo", "bar"] => true, false jq \'map(in([0,1]))\' [2, 0] => [false, true] . .fi . .IP "" 0 . .SS "map(f), map_values(f)" For any filter \fBf\fR, \fBmap(f)\fR and \fBmap_values(f)\fR apply \fBf\fR to each of the values in the input array or object, that is, to the values of \fB\.[]\fR\. . .P In the absence of errors, \fBmap(f)\fR always outputs an array whereas \fBmap_values(f)\fR outputs an array if given an array, or an object if given an object\. . .P When the input to \fBmap_values(f)\fR is an object, the output object has the same keys as the input object except for those keys whose values when piped to \fBf\fR produce no values at all\. . .P The key difference between \fBmap(f)\fR and \fBmap_values(f)\fR is that the former simply forms an array from all the values of \fB($x|f)\fR for each value, \fB$x\fR, in the input array or object, but \fBmap_values(f)\fR only uses \fBfirst($x|f)\fR\. . .P Specifically, for object inputs, \fBmap_values(f)\fR constructs the output object by examining in turn the value of \fBfirst(\.[$k]|f)\fR for each key, \fB$k\fR, of the input\. If this expression produces no values, then the corresponding key will be dropped; otherwise, the output object will have that value at the key, \fB$k\fR\. . .P Here are some examples to clarify the behavior of \fBmap\fR and \fBmap_values\fR when applied to arrays\. These examples assume the input is \fB[1]\fR in all cases: . .IP "" 4 . .nf map(\.+1) #=> [2] map(\., \.) #=> [1,1] map(empty) #=> [] map_values(\.+1) #=> [2] map_values(\., \.) #=> [1] map_values(empty) #=> [] . .fi . .IP "" 0 . .P \fBmap(f)\fR is equivalent to \fB[\.[] | f]\fR and \fBmap_values(f)\fR is equivalent to \fB\.[] |= f\fR\. . .P In fact, these are their implementations\. . .IP "" 4 . .nf jq \'map(\.+1)\' [1,2,3] => [2,3,4] jq \'map_values(\.+1)\' {"a": 1, "b": 2, "c": 3} => {"a": 2, "b": 3, "c": 4} jq \'map(\., \.)\' [1,2] => [1,1,2,2] jq \'map_values(\. // empty)\' {"a": null, "b": true, "c": false} => {"b":true} . .fi . .IP "" 0 . .SS "pick(pathexps)" Emit the projection of the input object or array defined by the specified sequence of path expressions, such that if \fBp\fR is any one of these specifications, then \fB(\. | p)\fR will evaluate to the same value as \fB(\. | pick(pathexps) | p)\fR\. For arrays, negative indices and \fB\.[m:n]\fR specifications should not be used\. . .IP "" 4 . .nf jq \'pick(\.a, \.b\.c, \.x)\' {"a": 1, "b": {"c": 2, "d": 3}, "e": 4} => {"a":1,"b":{"c":2},"x":null} jq \'pick(\.[2], \.[0], \.[0])\' [1,2,3,4] => [1,null,3] . .fi . .IP "" 0 . .SS "path(path_expression)" Outputs array representations of the given path expression in \fB\.\fR\. The outputs are arrays of strings (object keys) and/or numbers (array indices)\. . .P Path expressions are jq expressions like \fB\.a\fR, but also \fB\.[]\fR\. There are two types of path expressions: ones that can match exactly, and ones that cannot\. For example, \fB\.a\.b\.c\fR is an exact match path expression, while \fB\.a[]\.b\fR is not\. . .P \fBpath(exact_path_expression)\fR will produce the array representation of the path expression even if it does not exist in \fB\.\fR, if \fB\.\fR is \fBnull\fR or an array or an object\. . .P \fBpath(pattern)\fR will produce array representations of the paths matching \fBpattern\fR if the paths exist in \fB\.\fR\. . .P Note that the path expressions are not different from normal expressions\. The expression \fBpath(\.\.|select(type=="boolean"))\fR outputs all the paths to boolean values in \fB\.\fR, and only those paths\. . .IP "" 4 . .nf jq \'path(\.a[0]\.b)\' null => ["a",0,"b"] jq \'[path(\.\.)]\' {"a":[{"b":1}]} => [[],["a"],["a",0],["a",0,"b"]] . .fi . .IP "" 0 . .SS "del(path_expression)" The builtin function \fBdel\fR removes a key and its corresponding value from an object\. . .IP "" 4 . .nf jq \'del(\.foo)\' {"foo": 42, "bar": 9001, "baz": 42} => {"bar": 9001, "baz": 42} jq \'del(\.[1, 2])\' ["foo", "bar", "baz"] => ["foo"] . .fi . .IP "" 0 . .SS "getpath(PATHS)" The builtin function \fBgetpath\fR outputs the values in \fB\.\fR found at each path in \fBPATHS\fR\. . .IP "" 4 . .nf jq \'getpath(["a","b"])\' null => null jq \'[getpath(["a","b"], ["a","c"])]\' {"a":{"b":0, "c":1}} => [0, 1] . .fi . .IP "" 0 . .SS "setpath(PATHS; VALUE)" The builtin function \fBsetpath\fR sets the \fBPATHS\fR in \fB\.\fR to \fBVALUE\fR\. . .IP "" 4 . .nf jq \'setpath(["a","b"]; 1)\' null => {"a": {"b": 1}} jq \'setpath(["a","b"]; 1)\' {"a":{"b":0}} => {"a": {"b": 1}} jq \'setpath([0,"a"]; 1)\' null => [{"a":1}] . .fi . .IP "" 0 . .SS "delpaths(PATHS)" The builtin function \fBdelpaths\fR deletes the \fBPATHS\fR in \fB\.\fR\. \fBPATHS\fR must be an array of paths, where each path is an array of strings and numbers\. . .IP "" 4 . .nf jq \'delpaths([["a","b"]])\' {"a":{"b":1},"x":{"y":2}} => {"a":{},"x":{"y":2}} . .fi . .IP "" 0 . .SS "to_entries, from_entries, with_entries(f)" These functions convert between an object and an array of key\-value pairs\. If \fBto_entries\fR is passed an object, then for each \fBk: v\fR entry in the input, the output array includes \fB{"key": k, "value": v}\fR\. . .P \fBfrom_entries\fR does the opposite conversion, and \fBwith_entries(f)\fR is a shorthand for \fBto_entries | map(f) | from_entries\fR, useful for doing some operation to all keys and values of an object\. \fBfrom_entries\fR accepts \fB"key"\fR, \fB"Key"\fR, \fB"name"\fR, \fB"Name"\fR, \fB"value"\fR, and \fB"Value"\fR as keys\. . .IP "" 4 . .nf jq \'to_entries\' {"a": 1, "b": 2} => [{"key":"a", "value":1}, {"key":"b", "value":2}] jq \'from_entries\' [{"key":"a", "value":1}, {"key":"b", "value":2}] => {"a": 1, "b": 2} jq \'with_entries(\.key |= "KEY_" + \.)\' {"a": 1, "b": 2} => {"KEY_a": 1, "KEY_b": 2} . .fi . .IP "" 0 . .SS "select(boolean_expression)" The function \fBselect(f)\fR produces its input unchanged if \fBf\fR returns true for that input, and produces no output otherwise\. . .P It\'s useful for filtering lists: \fB[1,2,3] | map(select(\. >= 2))\fR will give you \fB[2,3]\fR\. . .IP "" 4 . .nf jq \'map(select(\. >= 2))\' [1,5,3,0,7] => [5,3,7] jq \'\.[] | select(\.id == "second")\' [{"id": "first", "val": 1}, {"id": "second", "val": 2}] => {"id": "second", "val": 2} . .fi . .IP "" 0 . .SS "arrays, objects, iterables, booleans, numbers, normals, finites, strings, nulls, values, scalars" These built\-ins select only inputs that are arrays, objects, iterables (arrays or objects), booleans, numbers, normal numbers, finite numbers, strings, null, non\-null values, and non\-iterables, respectively\. . .IP "" 4 . .nf jq \'\.[]|numbers\' [[],{},1,"foo",null,true,false] => 1 . .fi . .IP "" 0 . .SS "empty" \fBempty\fR returns no results\. None at all\. Not even \fBnull\fR\. . .P It\'s useful on occasion\. You\'ll know if you need it :) . .IP "" 4 . .nf jq \'1, empty, 2\' null => 1, 2 jq \'[1,2,empty,3]\' null => [1,2,3] . .fi . .IP "" 0 . .SS "error, error(message)" Produces an error with the input value, or with the message given as the argument\. Errors can be caught with try/catch; see below\. . .IP "" 4 . .nf jq \'try error catch \.\' "error message" => "error message" jq \'try error("invalid value: \e(\.)") catch \.\' 42 => "invalid value: 42" . .fi . .IP "" 0 . .SS "halt" Stops the jq program with no further outputs\. jq will exit with exit status \fB0\fR\. . .SS "halt_error, halt_error(exit_code)" Stops the jq program with no further outputs\. The input will be printed on \fBstderr\fR as raw output (i\.e\., strings will not have double quotes) with no decoration, not even a newline\. . .P The given \fBexit_code\fR (defaulting to \fB5\fR) will be jq\'s exit status\. . .P For example, \fB"Error: something went wrong\en"|halt_error(1)\fR\. . .SS "$__loc__" Produces an object with a "file" key and a "line" key, with the filename and line number where \fB$__loc__\fR occurs, as values\. . .IP "" 4 . .nf jq \'try error("\e($__loc__)") catch \.\' null => "{\e"file\e":\e"\e",\e"line\e":1}" . .fi . .IP "" 0 . .SS "paths, paths(node_filter)" \fBpaths\fR outputs the paths to all the elements in its input (except it does not output the empty list, representing \. itself)\. . .P \fBpaths(f)\fR outputs the paths to any values for which \fBf\fR is \fBtrue\fR\. That is, \fBpaths(type == "number")\fR outputs the paths to all numeric values\. . .IP "" 4 . .nf jq \'[paths]\' [1,[[],{"a":2}]] => [[0],[1],[1,0],[1,1],[1,1,"a"]] jq \'[paths(type == "number")]\' [1,[[],{"a":2}]] => [[0],[1,1,"a"]] . .fi . .IP "" 0 . .SS "add, add(generator)" The filter \fBadd\fR takes as input an array, and produces as output the elements of the array added together\. This might mean summed, concatenated or merged depending on the types of the elements of the input array \- the rules are the same as those for the \fB+\fR operator (described above)\. . .P If the input is an empty array, \fBadd\fR returns \fBnull\fR\. . .P \fBadd(generator)\fR operates on the given generator rather than the input\. . .IP "" 4 . .nf jq \'add\' ["a","b","c"] => "abc" jq \'add\' [1, 2, 3] => 6 jq \'add\' [] => null jq \'add(\.[]\.a)\' [{"a":3}, {"a":5}, {"b":6}] => 8 . .fi . .IP "" 0 . .SS "any, any(condition), any(generator; condition)" The filter \fBany\fR takes as input an array of boolean values, and produces \fBtrue\fR as output if any of the elements of the array are \fBtrue\fR\. . .P If the input is an empty array, \fBany\fR returns \fBfalse\fR\. . .P The \fBany(condition)\fR form applies the given condition to the elements of the input array\. . .P The \fBany(generator; condition)\fR form applies the given condition to all the outputs of the given generator\. . .IP "" 4 . .nf jq \'any\' [true, false] => true jq \'any\' [false, false] => false jq \'any\' [] => false . .fi . .IP "" 0 . .SS "all, all(condition), all(generator; condition)" The filter \fBall\fR takes as input an array of boolean values, and produces \fBtrue\fR as output if all of the elements of the array are \fBtrue\fR\. . .P The \fBall(condition)\fR form applies the given condition to the elements of the input array\. . .P The \fBall(generator; condition)\fR form applies the given condition to all the outputs of the given generator\. . .P If the input is an empty array, \fBall\fR returns \fBtrue\fR\. . .IP "" 4 . .nf jq \'all\' [true, false] => false jq \'all\' [true, true] => true jq \'all\' [] => true . .fi . .IP "" 0 . .SS "flatten, flatten(depth)" The filter \fBflatten\fR takes as input an array of nested arrays, and produces a flat array in which all arrays inside the original array have been recursively replaced by their values\. You can pass an argument to it to specify how many levels of nesting to flatten\. . .P \fBflatten(2)\fR is like \fBflatten\fR, but going only up to two levels deep\. . .IP "" 4 . .nf jq \'flatten\' [1, [2], [[3]]] => [1, 2, 3] jq \'flatten(1)\' [1, [2], [[3]]] => [1, 2, [3]] jq \'flatten\' [[]] => [] jq \'flatten\' [{"foo": "bar"}, [{"foo": "baz"}]] => [{"foo": "bar"}, {"foo": "baz"}] . .fi . .IP "" 0 . .SS "range(upto), range(from; upto), range(from; upto; by)" The \fBrange\fR function produces a range of numbers\. \fBrange(4; 10)\fR produces 6 numbers, from 4 (inclusive) to 10 (exclusive)\. The numbers are produced as separate outputs\. Use \fB[range(4; 10)]\fR to get a range as an array\. . .P The one argument form generates numbers from 0 to the given number, with an increment of 1\. . .P The two argument form generates numbers from \fBfrom\fR to \fBupto\fR with an increment of 1\. . .P The three argument form generates numbers \fBfrom\fR to \fBupto\fR with an increment of \fBby\fR\. . .IP "" 4 . .nf jq \'range(2; 4)\' null => 2, 3 jq \'[range(2; 4)]\' null => [2,3] jq \'[range(4)]\' null => [0,1,2,3] jq \'[range(0; 10; 3)]\' null => [0,3,6,9] jq \'[range(0; 10; \-1)]\' null => [] jq \'[range(0; \-5; \-1)]\' null => [0,\-1,\-2,\-3,\-4] . .fi . .IP "" 0 . .SS "floor" The \fBfloor\fR function returns the floor of its numeric input\. . .IP "" 4 . .nf jq \'floor\' 3\.14159 => 3 . .fi . .IP "" 0 . .SS "sqrt" The \fBsqrt\fR function returns the square root of its numeric input\. . .IP "" 4 . .nf jq \'sqrt\' 9 => 3 . .fi . .IP "" 0 . .SS "tonumber" The \fBtonumber\fR function parses its input as a number\. It will convert correctly\-formatted strings to their numeric equivalent, leave numbers alone, and give an error on all other input\. . .IP "" 4 . .nf jq \'\.[] | tonumber\' [1, "1"] => 1, 1 . .fi . .IP "" 0 . .SS "toboolean" The \fBtoboolean\fR function parses its input as a boolean\. It will convert correctly\-formatted strings to their boolean equivalent, leave booleans alone, and give an error on all other input\. . .IP "" 4 . .nf jq \'\.[] | toboolean\' ["true", "false", true, false] => true, false, true, false . .fi . .IP "" 0 . .SS "tostring" The \fBtostring\fR function prints its input as a string\. Strings are left unchanged, and all other values are JSON\-encoded\. . .IP "" 4 . .nf jq \'\.[] | tostring\' [1, "1", [1]] => "1", "1", "[1]" . .fi . .IP "" 0 . .SS "type" The \fBtype\fR function returns the type of its argument as a string, which is one of null, boolean, number, string, array or object\. . .IP "" 4 . .nf jq \'map(type)\' [0, false, [], {}, null, "hello"] => ["number", "boolean", "array", "object", "null", "string"] . .fi . .IP "" 0 . .SS "infinite, nan, isinfinite, isnan, isfinite, isnormal" Some arithmetic operations can yield infinities and "not a number" (NaN) values\. The \fBisinfinite\fR builtin returns \fBtrue\fR if its input is infinite\. The \fBisnan\fR builtin returns \fBtrue\fR if its input is a NaN\. The \fBinfinite\fR builtin returns a positive infinite value\. The \fBnan\fR builtin returns a NaN\. The \fBisnormal\fR builtin returns true if its input is a normal number\. . .P Note that division by zero raises an error\. . .P Currently most arithmetic operations operating on infinities, NaNs, and sub\-normals do not raise errors\. . .IP "" 4 . .nf jq \'\.[] | (infinite * \.) < 0\' [\-1, 1] => true, false jq \'infinite, nan | type\' null => "number", "number" . .fi . .IP "" 0 . .SS "sort, sort_by(path_expression)" The \fBsort\fR functions sorts its input, which must be an array\. Values are sorted in the following order: . .IP "\(bu" 4 \fBnull\fR . .IP "\(bu" 4 \fBfalse\fR . .IP "\(bu" 4 \fBtrue\fR . .IP "\(bu" 4 numbers . .IP "\(bu" 4 strings, in alphabetical order (by unicode codepoint value) . .IP "\(bu" 4 arrays, in lexical order . .IP "\(bu" 4 objects . .IP "" 0 . .P The ordering for objects is a little complex: first they\'re compared by comparing their sets of keys (as arrays in sorted order), and if their keys are equal then the values are compared key by key\. . .P \fBsort_by\fR may be used to sort by a particular field of an object, or by applying any jq filter\. \fBsort_by(f)\fR compares two elements by comparing the result of \fBf\fR on each element\. When \fBf\fR produces multiple values, it firstly compares the first values, and the second values if the first values are equal, and so on\. . .IP "" 4 . .nf jq \'sort\' [8,3,null,6] => [null,3,6,8] jq \'sort_by(\.foo)\' [{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}] => [{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}] jq \'sort_by(\.foo, \.bar)\' [{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}] => [{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}] . .fi . .IP "" 0 . .SS "group_by(path_expression)" \fBgroup_by(\.foo)\fR takes as input an array, groups the elements having the same \fB\.foo\fR field into separate arrays, and produces all of these arrays as elements of a larger array, sorted by the value of the \fB\.foo\fR field\. . .P Any jq expression, not just a field access, may be used in place of \fB\.foo\fR\. The sorting order is the same as described in the \fBsort\fR function above\. . .IP "" 4 . .nf jq \'group_by(\.foo)\' [{"foo":1, "bar":10}, {"foo":3, "bar":100}, {"foo":1, "bar":1}] => [[{"foo":1, "bar":10}, {"foo":1, "bar":1}], [{"foo":3, "bar":100}]] . .fi . .IP "" 0 . .SS "min, max, min_by(path_exp), max_by(path_exp)" Find the minimum or maximum element of the input array\. . .P The \fBmin_by(path_exp)\fR and \fBmax_by(path_exp)\fR functions allow you to specify a particular field or property to examine, e\.g\. \fBmin_by(\.foo)\fR finds the object with the smallest \fBfoo\fR field\. . .IP "" 4 . .nf jq \'min\' [5,4,2,7] => 2 jq \'max_by(\.foo)\' [{"foo":1, "bar":14}, {"foo":2, "bar":3}] => {"foo":2, "bar":3} . .fi . .IP "" 0 . .SS "unique, unique_by(path_exp)" The \fBunique\fR function takes as input an array and produces an array of the same elements, in sorted order, with duplicates removed\. . .P The \fBunique_by(path_exp)\fR function will keep only one element for each value obtained by applying the argument\. Think of it as making an array by taking one element out of every group produced by \fBgroup\fR\. . .IP "" 4 . .nf jq \'unique\' [1,2,5,3,5,3,1,3] => [1,2,3,5] jq \'unique_by(\.foo)\' [{"foo": 1, "bar": 2}, {"foo": 1, "bar": 3}, {"foo": 4, "bar": 5}] => [{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}] jq \'unique_by(length)\' ["chunky", "bacon", "kitten", "cicada", "asparagus"] => ["bacon", "chunky", "asparagus"] . .fi . .IP "" 0 . .SS "reverse" This function reverses an array\. . .IP "" 4 . .nf jq \'reverse\' [1,2,3,4] => [4,3,2,1] . .fi . .IP "" 0 . .SS "contains(element)" The filter \fBcontains(b)\fR will produce true if b is completely contained within the input\. A string B is contained in a string A if B is a substring of A\. An array B is contained in an array A if all elements in B are contained in any element in A\. An object B is contained in object A if all of the values in B are contained in the value in A with the same key\. All other types are assumed to be contained in each other if they are equal\. . .IP "" 4 . .nf jq \'contains("bar")\' "foobar" => true jq \'contains(["baz", "bar"])\' ["foobar", "foobaz", "blarp"] => true jq \'contains(["bazzzzz", "bar"])\' ["foobar", "foobaz", "blarp"] => false jq \'contains({foo: 12, bar: [{barp: 12}]})\' {"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]} => true jq \'contains({foo: 12, bar: [{barp: 15}]})\' {"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]} => false . .fi . .IP "" 0 . .SS "indices(s)" Outputs an array containing the indices in \fB\.\fR where \fBs\fR occurs\. The input may be an array, in which case if \fBs\fR is an array then the indices output will be those where all elements in \fB\.\fR match those of \fBs\fR\. . .IP "" 4 . .nf jq \'indices(", ")\' "a,b, cd, efg, hijk" => [3,7,12] jq \'indices(1)\' [0,1,2,1,3,1,4] => [1,3,5] jq \'indices([1,2])\' [0,1,2,3,1,4,2,5,1,2,6,7] => [1,8] . .fi . .IP "" 0 . .SS "index(s), rindex(s)" Outputs the index of the first (\fBindex\fR) or last (\fBrindex\fR) occurrence of \fBs\fR in the input\. . .IP "" 4 . .nf jq \'index(", ")\' "a,b, cd, efg, hijk" => 3 jq \'index(1)\' [0,1,2,1,3,1,4] => 1 jq \'index([1,2])\' [0,1,2,3,1,4,2,5,1,2,6,7] => 1 jq \'rindex(", ")\' "a,b, cd, efg, hijk" => 12 jq \'rindex(1)\' [0,1,2,1,3,1,4] => 5 jq \'rindex([1,2])\' [0,1,2,3,1,4,2,5,1,2,6,7] => 8 . .fi . .IP "" 0 . .SS "inside" The filter \fBinside(b)\fR will produce true if the input is completely contained within b\. It is, essentially, an inversed version of \fBcontains\fR\. . .IP "" 4 . .nf jq \'inside("foobar")\' "bar" => true jq \'inside(["foobar", "foobaz", "blarp"])\' ["baz", "bar"] => true jq \'inside(["foobar", "foobaz", "blarp"])\' ["bazzzzz", "bar"] => false jq \'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})\' {"foo": 12, "bar": [{"barp": 12}]} => true jq \'inside({"foo": 12, "bar":[1,2,{"barp":12, "blip":13}]})\' {"foo": 12, "bar": [{"barp": 15}]} => false . .fi . .IP "" 0 . .SS "startswith(str)" Outputs \fBtrue\fR if \. starts with the given string argument\. . .IP "" 4 . .nf jq \'[\.[]|startswith("foo")]\' ["fo", "foo", "barfoo", "foobar", "barfoob"] => [false, true, false, true, false] . .fi . .IP "" 0 . .SS "endswith(str)" Outputs \fBtrue\fR if \. ends with the given string argument\. . .IP "" 4 . .nf jq \'[\.[]|endswith("foo")]\' ["foobar", "barfoo"] => [false, true] . .fi . .IP "" 0 . .SS "combinations, combinations(n)" Outputs all combinations of the elements of the arrays in the input array\. If given an argument \fBn\fR, it outputs all combinations of \fBn\fR repetitions of the input array\. . .IP "" 4 . .nf jq \'combinations\' [[1,2], [3, 4]] => [1, 3], [1, 4], [2, 3], [2, 4] jq \'combinations(2)\' [0, 1] => [0, 0], [0, 1], [1, 0], [1, 1] . .fi . .IP "" 0 . .SS "ltrimstr(str)" Outputs its input with the given prefix string removed, if it starts with it\. . .IP "" 4 . .nf jq \'[\.[]|ltrimstr("foo")]\' ["fo", "foo", "barfoo", "foobar", "afoo"] => ["fo","","barfoo","bar","afoo"] . .fi . .IP "" 0 . .SS "rtrimstr(str)" Outputs its input with the given suffix string removed, if it ends with it\. . .IP "" 4 . .nf jq \'[\.[]|rtrimstr("foo")]\' ["fo", "foo", "barfoo", "foobar", "foob"] => ["fo","","bar","foobar","foob"] . .fi . .IP "" 0 . .SS "trimstr(str)" Outputs its input with the given string removed at both ends, if it starts or ends with it\. . .IP "" 4 . .nf jq \'[\.[]|trimstr("foo")]\' ["fo", "foo", "barfoo", "foobarfoo", "foob"] => ["fo","","bar","bar","b"] . .fi . .IP "" 0 . .SS "trim, ltrim, rtrim" \fBtrim\fR trims both leading and trailing whitespace\. . .P \fBltrim\fR trims only leading (left side) whitespace\. . .P \fBrtrim\fR trims only trailing (right side) whitespace\. . .P Whitespace characters are the usual \fB" "\fR, \fB"\en"\fR \fB"\et"\fR, \fB"\er"\fR and also all characters in the Unicode character database with the whitespace property\. Note that what considers whitespace might change in the future\. . .IP "" 4 . .nf jq \'trim, ltrim, rtrim\' " abc " => "abc", "abc ", " abc" . .fi . .IP "" 0 . .SS "explode" Converts an input string into an array of the string\'s codepoint numbers\. . .IP "" 4 . .nf jq \'explode\' "foobar" => [102,111,111,98,97,114] . .fi . .IP "" 0 . .SS "implode" The inverse of explode\. . .IP "" 4 . .nf jq \'implode\' [65, 66, 67] => "ABC" . .fi . .IP "" 0 . .SS "split(str)" Splits an input string on the separator argument\. . .P \fBsplit\fR can also split on regex matches when called with two arguments (see the regular expressions section below)\. . .IP "" 4 . .nf jq \'split(", ")\' "a, b,c,d, e, " => ["a","b,c,d","e",""] . .fi . .IP "" 0 . .SS "join(str)" Joins the array of elements given as input, using the argument as separator\. It is the inverse of \fBsplit\fR: that is, running \fBsplit("foo") | join("foo")\fR over any input string returns said input string\. . .P Numbers and booleans in the input are converted to strings\. Null values are treated as empty strings\. Arrays and objects in the input are not supported\. . .IP "" 4 . .nf jq \'join(", ")\' ["a","b,c,d","e"] => "a, b,c,d, e" jq \'join(" ")\' ["a",1,2\.3,true,null,false] => "a 1 2\.3 true false" . .fi . .IP "" 0 . .SS "ascii_downcase, ascii_upcase" Emit a copy of the input string with its alphabetic characters (a\-z and A\-Z) converted to the specified case\. . .IP "" 4 . .nf jq \'ascii_upcase\' "useful but not for é" => "USEFUL BUT NOT FOR é" . .fi . .IP "" 0 . .SS "while(cond; update)" The \fBwhile(cond; update)\fR function allows you to repeatedly apply an update to \fB\.\fR until \fBcond\fR is false\. . .P Note that \fBwhile(cond; update)\fR is internally defined as a recursive jq function\. Recursive calls within \fBwhile\fR will not consume additional memory if \fBupdate\fR produces at most one output for each input\. See advanced topics below\. . .IP "" 4 . .nf jq \'[while(\.<100; \.*2)]\' 1 => [1,2,4,8,16,32,64] . .fi . .IP "" 0 . .SS "repeat(exp)" The \fBrepeat(exp)\fR function allows you to repeatedly apply expression \fBexp\fR to \fB\.\fR until an error is raised\. . .P Note that \fBrepeat(exp)\fR is internally defined as a recursive jq function\. Recursive calls within \fBrepeat\fR will not consume additional memory if \fBexp\fR produces at most one output for each input\. See advanced topics below\. . .IP "" 4 . .nf jq \'[repeat(\.*2, error)?]\' 1 => [2] . .fi . .IP "" 0 . .SS "until(cond; next)" The \fBuntil(cond; next)\fR function allows you to repeatedly apply the expression \fBnext\fR, initially to \fB\.\fR then to its own output, until \fBcond\fR is true\. For example, this can be used to implement a factorial function (see below)\. . .P Note that \fBuntil(cond; next)\fR is internally defined as a recursive jq function\. Recursive calls within \fBuntil()\fR will not consume additional memory if \fBnext\fR produces at most one output for each input\. See advanced topics below\. . .IP "" 4 . .nf jq \'[\.,1]|until(\.[0] < 1; [\.[0] \- 1, \.[1] * \.[0]])|\.[1]\' 4 => 24 . .fi . .IP "" 0 . .SS "recurse(f), recurse, recurse(f; condition)" The \fBrecurse(f)\fR function allows you to search through a recursive structure, and extract interesting data from all levels\. Suppose your input represents a filesystem: . .IP "" 4 . .nf {"name": "/", "children": [ {"name": "/bin", "children": [ {"name": "/bin/ls", "children": []}, {"name": "/bin/sh", "children": []}]}, {"name": "/home", "children": [ {"name": "/home/stephen", "children": [ {"name": "/home/stephen/jq", "children": []}]}]}]} . .fi . .IP "" 0 . .P Now suppose you want to extract all of the filenames present\. You need to retrieve \fB\.name\fR, \fB\.children[]\.name\fR, \fB\.children[]\.children[]\.name\fR, and so on\. You can do this with: . .IP "" 4 . .nf recurse(\.children[]) | \.name . .fi . .IP "" 0 . .P When called without an argument, \fBrecurse\fR is equivalent to \fBrecurse(\.[]?)\fR\. . .P \fBrecurse(f)\fR is identical to \fBrecurse(f; true)\fR and can be used without concerns about recursion depth\. . .P \fBrecurse(f; condition)\fR is a generator which begins by emitting \. and then emits in turn \.|f, \.|f|f, \.|f|f|f, \.\.\. so long as the computed value satisfies the condition\. For example, to generate all the integers, at least in principle, one could write \fBrecurse(\.+1; true)\fR\. . .P The recursive calls in \fBrecurse\fR will not consume additional memory whenever \fBf\fR produces at most a single output for each input\. . .IP "" 4 . .nf jq \'recurse(\.foo[])\' {"foo":[{"foo": []}, {"foo":[{"foo":[]}]}]} => {"foo":[{"foo":[]},{"foo":[{"foo":[]}]}]}, {"foo":[]}, {"foo":[{"foo":[]}]}, {"foo":[]} jq \'recurse\' {"a":0,"b":[1]} => {"a":0,"b":[1]}, 0, [1], 1 jq \'recurse(\. * \.; \. < 20)\' 2 => 2, 4, 16 . .fi . .IP "" 0 . .SS "walk(f)" The \fBwalk(f)\fR function applies f recursively to every component of the input entity\. When an array is encountered, f is first applied to its elements and then to the array itself; when an object is encountered, f is first applied to all the values and then to the object\. In practice, f will usually test the type of its input, as illustrated in the following examples\. The first example highlights the usefulness of processing the elements of an array of arrays before processing the array itself\. The second example shows how all the keys of all the objects within the input can be considered for alteration\. . .IP "" 4 . .nf jq \'walk(if type == "array" then sort else \. end)\' [[4, 1, 7], [8, 5, 2], [3, 6, 9]] => [[1,4,7],[2,5,8],[3,6,9]] jq \'walk( if type == "object" then with_entries( \.key |= sub( "^_+"; "") ) else \. end )\' [ { "_a": { "__b": 2 } } ] => [{"a":{"b":2}}] . .fi . .IP "" 0 . .SS "have_literal_numbers" This builtin returns true if jq\'s build configuration includes support for preservation of input number literals\. . .SS "have_decnum" This builtin returns true if jq was built with "decnum", which is the current literal number preserving numeric backend implementation for jq\. . .SS "$JQ_BUILD_CONFIGURATION" This builtin binding shows the jq executable\'s build configuration\. Its value has no particular format, but it can be expected to be at least the \fB\./configure\fR command\-line arguments, and may be enriched in the future to include the version strings for the build tooling used\. . .P Note that this can be overridden in the command\-line with \fB\-\-arg\fR and related options\. . .SS "$ENV, env" \fB$ENV\fR is an object representing the environment variables as set when the jq program started\. . .P \fBenv\fR outputs an object representing jq\'s current environment\. . .P At the moment there is no builtin for setting environment variables\. . .IP "" 4 . .nf jq \'$ENV\.PAGER\' null => "less" jq \'env\.PAGER\' null => "less" . .fi . .IP "" 0 . .SS "transpose" Transpose a possibly jagged matrix (an array of arrays)\. Rows are padded with nulls so the result is always rectangular\. . .IP "" 4 . .nf jq \'transpose\' [[1], [2,3]] => [[1,2],[null,3]] . .fi . .IP "" 0 . .SS "bsearch(x)" \fBbsearch(x)\fR conducts a binary search for x in the input array\. If the input is sorted and contains x, then \fBbsearch(x)\fR will return its index in the array; otherwise, if the array is sorted, it will return (\-1 \- ix) where ix is an insertion point such that the array would still be sorted after the insertion of x at ix\. If the array is not sorted, \fBbsearch(x)\fR will return an integer that is probably of no interest\. . .IP "" 4 . .nf jq \'bsearch(0)\' [0,1] => 0 jq \'bsearch(0)\' [1,2,3] => \-1 jq \'bsearch(4) as $ix | if $ix < 0 then \.[\-(1+$ix)] = 4 else \. end\' [1,2,3] => [1,2,3,4] . .fi . .IP "" 0 . .SS "String interpolation: \e(exp)" Inside a string, you can put an expression inside parens after a backslash\. Whatever the expression returns will be interpolated into the string\. . .IP "" 4 . .nf jq \'"The input was \e(\.), which is one less than \e(\.+1)"\' 42 => "The input was 42, which is one less than 43" . .fi . .IP "" 0 . .SS "Convert to/from JSON" The \fBtojson\fR and \fBfromjson\fR builtins dump values as JSON texts or parse JSON texts into values, respectively\. The \fBtojson\fR builtin differs from \fBtostring\fR in that \fBtostring\fR returns strings unmodified, while \fBtojson\fR encodes strings as JSON strings\. . .IP "" 4 . .nf jq \'[\.[]|tostring]\' [1, "foo", ["foo"]] => ["1","foo","[\e"foo\e"]"] jq \'[\.[]|tojson]\' [1, "foo", ["foo"]] => ["1","\e"foo\e"","[\e"foo\e"]"] jq \'[\.[]|tojson|fromjson]\' [1, "foo", ["foo"]] => [1,"foo",["foo"]] . .fi . .IP "" 0 . .SS "Format strings and escaping" The \fB@foo\fR syntax is used to format and escape strings, which is useful for building URLs, documents in a language like HTML or XML, and so forth\. \fB@foo\fR can be used as a filter on its own, the possible escapings are: . .TP \fB@text\fR: . .IP Calls \fBtostring\fR, see that function for details\. . .TP \fB@json\fR: . .IP Serializes the input as JSON\. . .TP \fB@html\fR: . .IP Applies HTML/XML escaping, by mapping the characters \fB<>&\'"\fR to their entity equivalents \fB<\fR, \fB>\fR, \fB&\fR, \fB'\fR, \fB"\fR\. . .TP \fB@uri\fR: . .IP Applies percent\-encoding, by mapping all reserved URI characters to a \fB%XX\fR sequence\. . .TP \fB@urid\fR: . .IP The inverse of \fB@uri\fR, applies percent\-decoding, by mapping all \fB%XX\fR sequences to their corresponding URI characters\. . .TP \fB@csv\fR: . .IP The input must be an array, and it is rendered as CSV with double quotes for strings, and quotes escaped by repetition\. . .TP \fB@tsv\fR: . .IP The input must be an array, and it is rendered as TSV (tab\-separated values)\. Each input array will be printed as a single line\. Fields are separated by a single tab (ascii \fB0x09\fR)\. Input characters line\-feed (ascii \fB0x0a\fR), carriage\-return (ascii \fB0x0d\fR), tab (ascii \fB0x09\fR) and backslash (ascii \fB0x5c\fR) will be output as escape sequences \fB\en\fR, \fB\er\fR, \fB\et\fR, \fB\e\e\fR respectively\. . .TP \fB@sh\fR: . .IP The input is escaped suitable for use in a command\-line for a POSIX shell\. If the input is an array, the output will be a series of space\-separated strings\. . .TP \fB@base64\fR: . .IP The input is converted to base64 as specified by RFC 4648\. . .TP \fB@base64d\fR: . .IP The inverse of \fB@base64\fR, input is decoded as specified by RFC 4648\. Note\e: If the decoded string is not UTF\-8, the results are undefined\. . .P This syntax can be combined with string interpolation in a useful way\. You can follow a \fB@foo\fR token with a string literal\. The contents of the string literal will \fInot\fR be escaped\. However, all interpolations made inside that string literal will be escaped\. For instance, . .IP "" 4 . .nf @uri "https://www\.google\.com/search?q=\e(\.search)" . .fi . .IP "" 0 . .P will produce the following output for the input \fB{"search":"what is jq?"}\fR: . .IP "" 4 . .nf "https://www\.google\.com/search?q=what%20is%20jq%3F" . .fi . .IP "" 0 . .P Note that the slashes, question mark, etc\. in the URL are not escaped, as they were part of the string literal\. . .IP "" 4 . .nf jq \'@html\' "This works if x < y" => "This works if x < y" jq \'@sh "echo \e(\.)"\' "O\'Hara\'s Ale" => "echo \'O\'\e\e\'\'Hara\'\e\e\'\'s Ale\'" jq \'@base64\' "This is a message" => "VGhpcyBpcyBhIG1lc3NhZ2U=" jq \'@base64d\' "VGhpcyBpcyBhIG1lc3NhZ2U=" => "This is a message" . .fi . .IP "" 0 . .SS "Dates" jq provides some basic date handling functionality, with some high\-level and low\-level builtins\. In all cases these builtins deal exclusively with time in UTC\. . .P The \fBfromdateiso8601\fR builtin parses datetimes in the ISO 8601 format to a number of seconds since the Unix epoch (1970\-01\-01T00:00:00Z)\. The \fBtodateiso8601\fR builtin does the inverse\. . .P The \fBfromdate\fR builtin parses datetime strings\. Currently \fBfromdate\fR only supports ISO 8601 datetime strings, but in the future it will attempt to parse datetime strings in more formats\. . .P The \fBtodate\fR builtin is an alias for \fBtodateiso8601\fR\. . .P The \fBnow\fR builtin outputs the current time, in seconds since the Unix epoch\. . .P Low\-level jq interfaces to the C\-library time functions are also provided: \fBstrptime\fR, \fBstrftime\fR, \fBstrflocaltime\fR, \fBmktime\fR, \fBgmtime\fR, and \fBlocaltime\fR\. Refer to your host operating system\'s documentation for the format strings used by \fBstrptime\fR and \fBstrftime\fR\. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality\. . .P The \fBgmtime\fR builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of Greenwich Mean Time as an array of numbers representing (in this order): the year, the month (zero\-based), the day of the month (one\-based), the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year \-\- all one\-based unless otherwise stated\. The day of the week number may be wrong on some systems for dates before March 1st 1900, or after December 31 2099\. . .P The \fBlocaltime\fR builtin works like the \fBgmtime\fR builtin, but using the local timezone setting\. . .P The \fBmktime\fR builtin consumes "broken down time" representations of time output by \fBgmtime\fR and \fBstrptime\fR\. . .P The \fBstrptime(fmt)\fR builtin parses input strings matching the \fBfmt\fR argument\. The output is in the "broken down time" representation consumed by \fBmktime\fR and output by \fBgmtime\fR\. . .P The \fBstrftime(fmt)\fR builtin formats a time (GMT) with the given format\. The \fBstrflocaltime\fR does the same, but using the local timezone setting\. . .P The format strings for \fBstrptime\fR and \fBstrftime\fR are described in typical C library documentation\. The format string for ISO 8601 datetime is \fB"%Y\-%m\-%dT%H:%M:%SZ"\fR\. . .P jq may not support some or all of this date functionality on some systems\. In particular, the \fB%u\fR and \fB%j\fR specifiers for \fBstrptime(fmt)\fR are not supported on macOS\. . .IP "" 4 . .nf jq \'fromdate\' "2015\-03\-05T23:51:47Z" => 1425599507 jq \'strptime("%Y\-%m\-%dT%H:%M:%SZ")\' "2015\-03\-05T23:51:47Z" => [2015,2,5,23,51,47,4,63] jq \'strptime("%Y\-%m\-%dT%H:%M:%SZ")|mktime\' "2015\-03\-05T23:51:47Z" => 1425599507 . .fi . .IP "" 0 . .SS "SQL\-Style Operators" jq provides a few SQL\-style operators\. . .TP \fBINDEX(stream; index_expression)\fR: . .IP This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream\. . .TP \fBJOIN($idx; stream; idx_expr; join_expr)\fR: . .IP This builtin joins the values from the given stream to the given index\. The index\'s keys are computed by applying the given index expression to each value from the given stream\. An array of the value in the stream and the corresponding value from the index is fed to the given join expression to produce each result\. . .TP \fBJOIN($idx; stream; idx_expr)\fR: . .IP Same as \fBJOIN($idx; stream; idx_expr; \.)\fR\. . .TP \fBJOIN($idx; idx_expr)\fR: . .IP This builtin joins the input \fB\.\fR to the given index, applying the given index expression to \fB\.\fR to compute the index key\. The join operation is as described above\. . .TP \fBIN(s)\fR: . .IP This builtin outputs \fBtrue\fR if \fB\.\fR appears in the given stream, otherwise it outputs \fBfalse\fR\. . .TP \fBIN(source; s)\fR: . .IP This builtin outputs \fBtrue\fR if any value in the source stream appears in the second stream, otherwise it outputs \fBfalse\fR\. . .SS "builtins" Returns a list of all builtin functions in the format \fBname/arity\fR\. Since functions with the same name but different arities are considered separate functions, \fBall/0\fR, \fBall/1\fR, and \fBall/2\fR would all be present in the list\. . .SH "CONDITIONALS AND COMPARISONS" . .SS "==, !=" The expression \'a == b\' will produce \'true\' if the results of evaluating a and b are equal (that is, if they represent equivalent JSON values) and \'false\' otherwise\. In particular, strings are never considered equal to numbers\. In checking for the equality of JSON objects, the ordering of keys is irrelevant\. If you\'re coming from JavaScript, please note that jq\'s \fB==\fR is like JavaScript\'s \fB===\fR, the "strict equality" operator\. . .P != is "not equal", and \'a != b\' returns the opposite value of \'a == b\' . .IP "" 4 . .nf jq \'\. == false\' null => false jq \'\. == {"b": {"d": (4 + 1e\-20), "c": 3}, "a":1}\' {"a":1, "b": {"c": 3, "d": 4}} => true jq \'\.[] == 1\' [1, 1\.0, "1", "banana"] => true, true, false, false . .fi . .IP "" 0 . .SS "if\-then\-else\-end" \fBif A then B else C end\fR will act the same as \fBB\fR if \fBA\fR produces a value other than false or null, but act the same as \fBC\fR otherwise\. . .P \fBif A then B end\fR is the same as \fBif A then B else \. end\fR\. That is, the \fBelse\fR branch is optional, and if absent is the same as \fB\.\fR\. This also applies to \fBelif\fR with absent ending \fBelse\fR branch\. . .P Checking for false or null is a simpler notion of "truthiness" than is found in JavaScript or Python, but it means that you\'ll sometimes have to be more explicit about the condition you want\. You can\'t test whether, e\.g\. a string is empty using \fBif \.name then A else B end\fR; you\'ll need something like \fBif \.name == "" then A else B end\fR instead\. . .P If the condition \fBA\fR produces multiple results, then \fBB\fR is evaluated once for each result that is not false or null, and \fBC\fR is evaluated once for each false or null\. . .P More cases can be added to an if using \fBelif A then B\fR syntax\. . .IP "" 4 . .nf jq \'if \. == 0 then "zero" elif \. == 1 then "one" else "many" end\' 2 => "many" . .fi . .IP "" 0 . .SS ">, >=, <=, <" The comparison operators \fB>\fR, \fB>=\fR, \fB<=\fR, \fB<\fR return whether their left argument is greater than, greater than or equal to, less than or equal to or less than their right argument (respectively)\. . .P The ordering is the same as that described for \fBsort\fR, above\. . .IP "" 4 . .nf jq \'\. < 5\' 2 => true . .fi . .IP "" 0 . .SS "and, or, not" jq supports the normal Boolean operators \fBand\fR, \fBor\fR, \fBnot\fR\. They have the same standard of truth as if expressions \- \fBfalse\fR and \fBnull\fR are considered "false values", and anything else is a "true value"\. . .P If an operand of one of these operators produces multiple results, the operator itself will produce a result for each input\. . .P \fBnot\fR is in fact a builtin function rather than an operator, so it is called as a filter to which things can be piped rather than with special syntax, as in \fB\.foo and \.bar | not\fR\. . .P These three only produce the values \fBtrue\fR and \fBfalse\fR, and so are only useful for genuine Boolean operations, rather than the common Perl/Python/Ruby idiom of "value_that_may_be_null or default"\. If you want to use this form of "or", picking between two values rather than evaluating a condition, see the \fB//\fR operator below\. . .IP "" 4 . .nf jq \'42 and "a string"\' null => true jq \'(true, false) or false\' null => true, false jq \'(true, true) and (true, false)\' null => true, false, true, false jq \'[true, false | not]\' null => [false, true] . .fi . .IP "" 0 . .SS "Alternative operator: //" The \fB//\fR operator produces all the values of its left\-hand side that are neither \fBfalse\fR nor \fBnull\fR\. If the left\-hand side produces no values other than \fBfalse\fR or \fBnull\fR, then \fB//\fR produces all the values of its right\-hand side\. . .P A filter of the form \fBa // b\fR produces all the results of \fBa\fR that are not \fBfalse\fR or \fBnull\fR\. If \fBa\fR produces no results, or no results other than \fBfalse\fR or \fBnull\fR, then \fBa // b\fR produces the results of \fBb\fR\. . .P This is useful for providing defaults: \fB\.foo // 1\fR will evaluate to \fB1\fR if there\'s no \fB\.foo\fR element in the input\. It\'s similar to how \fBor\fR is sometimes used in Python (jq\'s \fBor\fR operator is reserved for strictly Boolean operations)\. . .P Note: \fBsome_generator // defaults_here\fR is not the same as \fBsome_generator | \. // defaults_here\fR\. The latter will produce default values for all non\-\fBfalse\fR, non\-\fBnull\fR values of the left\-hand side, while the former will not\. Precedence rules can make this confusing\. For example, in \fBfalse, 1 // 2\fR the left\-hand side of \fB//\fR is \fB1\fR, not \fBfalse, 1\fR \-\- \fBfalse, 1 // 2\fR parses the same way as \fBfalse, (1 // 2)\fR\. In \fB(false, null, 1) | \. // 42\fR the left\-hand side of \fB//\fR is \fB\.\fR, which always produces just one value, while in \fB(false, null, 1) // 42\fR the left\-hand side is a generator of three values, and since it produces a value other \fBfalse\fR and \fBnull\fR, the default \fB42\fR is not produced\. . .IP "" 4 . .nf jq \'empty // 42\' null => 42 jq \'\.foo // 42\' {"foo": 19} => 19 jq \'\.foo // 42\' {} => 42 jq \'(false, null, 1) // 42\' null => 1 jq \'(false, null, 1) | \. // 42\' null => 42, 42, 1 . .fi . .IP "" 0 . .SS "try\-catch" Errors can be caught by using \fBtry EXP catch EXP\fR\. The first expression is executed, and if it fails then the second is executed with the error message\. The output of the handler, if any, is output as if it had been the output of the expression to try\. . .P The \fBtry EXP\fR form uses \fBempty\fR as the exception handler\. . .IP "" 4 . .nf jq \'try \.a catch "\. is not an object"\' true => "\. is not an object" jq \'[\.[]|try \.a]\' [{}, true, {"a":1}] => [null, 1] jq \'try error("some exception") catch \.\' true => "some exception" . .fi . .IP "" 0 . .SS "Breaking out of control structures" A convenient use of try/catch is to break out of control structures like \fBreduce\fR, \fBforeach\fR, \fBwhile\fR, and so on\. . .P For example: . .IP "" 4 . .nf # Repeat an expression until it raises "break" as an # error, then stop repeating without re\-raising the error\. # But if the error caught is not "break" then re\-raise it\. try repeat(exp) catch if \.=="break" then empty else error . .fi . .IP "" 0 . .P jq has a syntax for named lexical labels to "break" or "go (back) to": . .IP "" 4 . .nf label $out | \.\.\. break $out \.\.\. . .fi . .IP "" 0 . .P The \fBbreak $label_name\fR expression will cause the program to act as though the nearest (to the left) \fBlabel $label_name\fR produced \fBempty\fR\. . .P The relationship between the \fBbreak\fR and corresponding \fBlabel\fR is lexical: the label has to be "visible" from the break\. . .P To break out of a \fBreduce\fR, for example: . .IP "" 4 . .nf label $out | reduce \.[] as $item (null; if \.==false then break $out else \.\.\. end) . .fi . .IP "" 0 . .P The following jq program produces a syntax error: . .IP "" 4 . .nf break $out . .fi . .IP "" 0 . .P because no label \fB$out\fR is visible\. . .SS "Error Suppression / Optional Operator: ?" The \fB?\fR operator, used as \fBEXP?\fR, is shorthand for \fBtry EXP\fR\. . .IP "" 4 . .nf jq \'[\.[] | \.a?]\' [{}, true, {"a":1}] => [null, 1] jq \'[\.[] | tonumber?]\' ["1", "invalid", "3", 4] => [1, 3, 4] . .fi . .IP "" 0 . .SH "REGULAR EXPRESSIONS" jq uses the Oniguruma regular expression library, as do PHP, TextMate, Sublime Text, etc, so the description here will focus on jq specifics\. . .P Oniguruma supports several flavors of regular expression, so it is important to know that jq uses the "Perl NG" (Perl with named groups) flavor\. . .P The jq regex filters are defined so that they can be used using one of these patterns: . .IP "" 4 . .nf STRING | FILTER(REGEX) STRING | FILTER(REGEX; FLAGS) STRING | FILTER([REGEX]) STRING | FILTER([REGEX, FLAGS]) . .fi . .IP "" 0 . .P where: . .IP "\(bu" 4 STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation; . .IP "\(bu" 4 REGEX, after string interpolation, should be a valid regular expression; . .IP "\(bu" 4 FILTER is one of \fBtest\fR, \fBmatch\fR, or \fBcapture\fR, as described below\. . .IP "" 0 . .P Since REGEX must evaluate to a JSON string, some characters that are needed to form a regular expression must be escaped\. For example, the regular expression \fB\es\fR signifying a whitespace character would be written as \fB"\e\es"\fR\. . .P FLAGS is a string consisting of one of more of the supported flags: . .IP "\(bu" 4 \fBg\fR \- Global search (find all matches, not just the first) . .IP "\(bu" 4 \fBi\fR \- Case insensitive search . .IP "\(bu" 4 \fBm\fR \- Multi line mode (\fB\.\fR will match newlines) . .IP "\(bu" 4 \fBn\fR \- Ignore empty matches . .IP "\(bu" 4 \fBp\fR \- Both s and m modes are enabled . .IP "\(bu" 4 \fBs\fR \- Single line mode (\fB^\fR \-> \fB\eA\fR, \fB$\fR \-> \fB\eZ\fR) . .IP "\(bu" 4 \fBl\fR \- Find longest possible matches . .IP "\(bu" 4 \fBx\fR \- Extended regex format (ignore whitespace and comments) . .IP "" 0 . .P To match a whitespace with the \fBx\fR flag, use \fB\es\fR, e\.g\. . .IP "" 4 . .nf jq \-n \'"a b" | test("a\e\esb"; "x")\' . .fi . .IP "" 0 . .P Note that certain flags may also be specified within REGEX, e\.g\. . .IP "" 4 . .nf jq \-n \'("test", "TEst", "teST", "TEST") | test("(?i)te(?\-i)st")\' . .fi . .IP "" 0 . .P evaluates to: \fBtrue\fR, \fBtrue\fR, \fBfalse\fR, \fBfalse\fR\. . .SS "test(val), test(regex; flags)" Like \fBmatch\fR, but does not return match objects, only \fBtrue\fR or \fBfalse\fR for whether or not the regex matches the input\. . .IP "" 4 . .nf jq \'test("foo")\' "foo" => true jq \'\.[] | test("a b c # spaces are ignored"; "ix")\' ["xabcd", "ABC"] => true, true . .fi . .IP "" 0 . .SS "match(val), match(regex; flags)" \fBmatch\fR outputs an object for each match it finds\. Matches have the following fields: . .IP "\(bu" 4 \fBoffset\fR \- offset in UTF\-8 codepoints from the beginning of the input . .IP "\(bu" 4 \fBlength\fR \- length in UTF\-8 codepoints of the match . .IP "\(bu" 4 \fBstring\fR \- the string that it matched . .IP "\(bu" 4 \fBcaptures\fR \- an array of objects representing capturing groups\. . .IP "" 0 . .P Capturing group objects have the following fields: . .IP "\(bu" 4 \fBoffset\fR \- offset in UTF\-8 codepoints from the beginning of the input . .IP "\(bu" 4 \fBlength\fR \- length in UTF\-8 codepoints of this capturing group . .IP "\(bu" 4 \fBstring\fR \- the string that was captured . .IP "\(bu" 4 \fBname\fR \- the name of the capturing group (or \fBnull\fR if it was unnamed) . .IP "" 0 . .P Capturing groups that did not match anything return an offset of \-1 . .IP "" 4 . .nf jq \'match("(abc)+"; "g")\' "abc abc" => {"offset": 0, "length": 3, "string": "abc", "captures": [{"offset": 0, "length": 3, "string": "abc", "name": null}]}, {"offset": 4, "length": 3, "string": "abc", "captures": [{"offset": 4, "length": 3, "string": "abc", "name": null}]} jq \'match("foo")\' "foo bar foo" => {"offset": 0, "length": 3, "string": "foo", "captures": []} jq \'match(["foo", "ig"])\' "foo bar FOO" => {"offset": 0, "length": 3, "string": "foo", "captures": []}, {"offset": 8, "length": 3, "string": "FOO", "captures": []} jq \'match("foo (?bar)? foo"; "ig")\' "foo bar foo foo foo" => {"offset": 0, "length": 11, "string": "foo bar foo", "captures": [{"offset": 4, "length": 3, "string": "bar", "name": "bar123"}]}, {"offset": 12, "length": 8, "string": "foo foo", "captures": [{"offset": \-1, "length": 0, "string": null, "name": "bar123"}]} jq \'[ match("\."; "g")] | length\' "abc" => 3 . .fi . .IP "" 0 . .SS "capture(val), capture(regex; flags)" Collects the named captures in a JSON object, with the name of each capture as the key, and the matched string as the corresponding value\. . .IP "" 4 . .nf jq \'capture("(?[a\-z]+)\-(?[0\-9]+)")\' "xyzzy\-14" => { "a": "xyzzy", "n": "14" } . .fi . .IP "" 0 . .SS "scan(regex), scan(regex; flags)" Emit a stream of the non\-overlapping substrings of the input that match the regex in accordance with the flags, if any have been specified\. If there is no match, the stream is empty\. To capture all the matches for each input string, use the idiom \fB[ expr ]\fR, e\.g\. \fB[ scan(regex) ]\fR\. If the regex contains capturing groups, the filter emits a stream of arrays, each of which contains the captured strings\. . .IP "" 4 . .nf jq \'scan("c")\' "abcdefabc" => "c", "c" jq \'scan("(a+)(b+)")\' "abaabbaaabbb" => ["a","b"], ["aa","bb"], ["aaa","bbb"] . .fi . .IP "" 0 . .SS "split(regex; flags)" Splits an input string on each regex match\. . .P For backwards compatibility, when called with a single argument, \fBsplit\fR splits on a string, not a regex\. . .IP "" 4 . .nf jq \'split(", *"; null)\' "ab,cd, ef" => ["ab","cd","ef"] . .fi . .IP "" 0 . .SS "splits(regex), splits(regex; flags)" These provide the same results as their \fBsplit\fR counterparts, but as a stream instead of an array\. . .IP "" 4 . .nf jq \'splits(", *")\' "ab,cd, ef, gh" => "ab", "cd", "ef", "gh" jq \'splits(",? *"; "n")\' "ab,cd ef, gh" => "ab", "cd", "ef", "gh" . .fi . .IP "" 0 . .SS "sub(regex; tostring), sub(regex; tostring; flags)" Emit the string obtained by replacing the first match of regex in the input string with \fBtostring\fR, after interpolation\. \fBtostring\fR should be a jq string or a stream of such strings, each of which may contain references to named captures\. The named captures are, in effect, presented as a JSON object (as constructed by \fBcapture\fR) to \fBtostring\fR, so a reference to a captured variable named "x" would take the form: \fB"\e(\.x)"\fR\. . .IP "" 4 . .nf jq \'sub("[^a\-z]*(?[a\-z]+)"; "Z\e(\.x)"; "g")\' "123abc456def" => "ZabcZdef" jq \'[sub("(?\.)"; "\e(\.a|ascii_upcase)", "\e(\.a|ascii_downcase)")]\' "aB" => ["AB","aB"] . .fi . .IP "" 0 . .SS "gsub(regex; tostring), gsub(regex; tostring; flags)" \fBgsub\fR is like \fBsub\fR but all the non\-overlapping occurrences of the regex are replaced by \fBtostring\fR, after interpolation\. If the second argument is a stream of jq strings, then \fBgsub\fR will produce a corresponding stream of JSON strings\. . .IP "" 4 . .nf jq \'gsub("(?\.)[^a]*"; "+\e(\.x)\-")\' "Abcabc" => "+A\-+a\-" jq \'[gsub("p"; "a", "b")]\' "p" => ["a","b"] . .fi . .IP "" 0 . .SH "ADVANCED FEATURES" Variables are an absolute necessity in most programming languages, but they\'re relegated to an "advanced feature" in jq\. . .P In most languages, variables are the only means of passing around data\. If you calculate a value, and you want to use it more than once, you\'ll need to store it in a variable\. To pass a value to another part of the program, you\'ll need that part of the program to define a variable (as a function parameter, object member, or whatever) in which to place the data\. . .P It is also possible to define functions in jq, although this is is a feature whose biggest use is defining jq\'s standard library (many jq functions such as \fBmap\fR and \fBselect\fR are in fact written in jq)\. . .P jq has reduction operators, which are very powerful but a bit tricky\. Again, these are mostly used internally, to define some useful bits of jq\'s standard library\. . .P It may not be obvious at first, but jq is all about generators (yes, as often found in other languages)\. Some utilities are provided to help deal with generators\. . .P Some minimal I/O support (besides reading JSON from standard input, and writing JSON to standard output) is available\. . .P Finally, there is a module/library system\. . .SS "Variable / Symbolic Binding Operator: \.\.\. as $identifier | \.\.\." In jq, all filters have an input and an output, so manual plumbing is not necessary to pass a value from one part of a program to the next\. Many expressions, for instance \fBa + b\fR, pass their input to two distinct subexpressions (here \fBa\fR and \fBb\fR are both passed the same input), so variables aren\'t usually necessary in order to use a value twice\. . .P For instance, calculating the average value of an array of numbers requires a few variables in most languages \- at least one to hold the array, perhaps one for each element or for a loop counter\. In jq, it\'s simply \fBadd / length\fR \- the \fBadd\fR expression is given the array and produces its sum, and the \fBlength\fR expression is given the array and produces its length\. . .P So, there\'s generally a cleaner way to solve most problems in jq than defining variables\. Still, sometimes they do make things easier, so jq lets you define variables using \fBexpression as $variable\fR\. All variable names start with \fB$\fR\. Here\'s a slightly uglier version of the array\-averaging example: . .IP "" 4 . .nf length as $array_length | add / $array_length . .fi . .IP "" 0 . .P We\'ll need a more complicated problem to find a situation where using variables actually makes our lives easier\. . .P Suppose we have an array of blog posts, with "author" and "title" fields, and another object which is used to map author usernames to real names\. Our input looks like: . .IP "" 4 . .nf {"posts": [{"title": "First post", "author": "anon"}, {"title": "A well\-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}} . .fi . .IP "" 0 . .P We want to produce the posts with the author field containing a real name, as in: . .IP "" 4 . .nf {"title": "First post", "author": "Anonymous Coward"} {"title": "A well\-written article", "author": "Person McPherson"} . .fi . .IP "" 0 . .P We use a variable, \fB$names\fR, to store the realnames object, so that we can refer to it later when looking up author usernames: . .IP "" 4 . .nf \&.realnames as $names | \.posts[] | {title, author: $names[\.author]} . .fi . .IP "" 0 . .P The expression \fBexp as $x | \.\.\.\fR means: for each value of expression \fBexp\fR, run the rest of the pipeline with the entire original input, and with \fB$x\fR set to that value\. Thus \fBas\fR functions as something of a foreach loop\. . .P Just as \fB{foo}\fR is a handy way of writing \fB{foo: \.foo}\fR, so \fB{$foo}\fR is a handy way of writing \fB{foo: $foo}\fR\. . .P Multiple variables may be declared using a single \fBas\fR expression by providing a pattern that matches the structure of the input (this is known as "destructuring"): . .IP "" 4 . .nf \&. as {realnames: $names, posts: [$first, $second]} | \.\.\. . .fi . .IP "" 0 . .P The variable declarations in array patterns (e\.g\., \fB\. as [$first, $second]\fR) bind to the elements of the array in from the element at index zero on up, in order\. When there is no value at the index for an array pattern element, \fBnull\fR is bound to that variable\. . .P Variables are scoped over the rest of the expression that defines them, so . .IP "" 4 . .nf \&.realnames as $names | (\.posts[] | {title, author: $names[\.author]}) . .fi . .IP "" 0 . .P will work, but . .IP "" 4 . .nf (\.realnames as $names | \.posts[]) | {title, author: $names[\.author]} . .fi . .IP "" 0 . .P won\'t\. . .P For programming language theorists, it\'s more accurate to say that jq variables are lexically\-scoped bindings\. In particular there\'s no way to change the value of a binding; one can only setup a new binding with the same name, but which will not be visible where the old one was\. . .IP "" 4 . .nf jq \'\.bar as $x | \.foo | \. + $x\' {"foo":10, "bar":200} => 210 jq \'\. as $i|[(\.*2|\. as $i| $i), $i]\' 5 => [10,5] jq \'\. as [$a, $b, {c: $c}] | $a + $b + $c\' [2, 3, {"c": 4, "d": 5}] => 9 jq \'\.[] as [$a, $b] | {a: $a, b: $b}\' [[0], [0, 1], [2, 1, 0]] => {"a":0,"b":null}, {"a":0,"b":1}, {"a":2,"b":1} . .fi . .IP "" 0 . .SS "Destructuring Alternative Operator: ?//" The destructuring alternative operator provides a concise mechanism for destructuring an input that can take one of several forms\. . .P Suppose we have an API that returns a list of resources and events associated with them, and we want to get the user_id and timestamp of the first event for each resource\. The API (having been clumsily converted from XML) will only wrap the events in an array if the resource has multiple events: . .IP "" 4 . .nf {"resources": [{"id": 1, "kind": "widget", "events": {"action": "create", "user_id": 1, "ts": 13}}, {"id": 2, "kind": "widget", "events": [{"action": "create", "user_id": 1, "ts": 14}, {"action": "destroy", "user_id": 1, "ts": 15}]}]} . .fi . .IP "" 0 . .P We can use the destructuring alternative operator to handle this structural change simply: . .IP "" 4 . .nf \&.resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$user_id, $ts}]} | {$user_id, $kind, $id, $ts} . .fi . .IP "" 0 . .P Or, if we aren\'t sure if the input is an array of values or an object: . .IP "" 4 . .nf \&.[] as [$id, $kind, $user_id, $ts] ?// {$id, $kind, $user_id, $ts} | \.\.\. . .fi . .IP "" 0 . .P Each alternative need not define all of the same variables, but all named variables will be available to the subsequent expression\. Variables not matched in the alternative that succeeded will be \fBnull\fR: . .IP "" 4 . .nf \&.resources[] as {$id, $kind, events: {$user_id, $ts}} ?// {$id, $kind, events: [{$first_user_id, $first_ts}]} | {$user_id, $first_user_id, $kind, $id, $ts, $first_ts} . .fi . .IP "" 0 . .P Additionally, if the subsequent expression returns an error, the alternative operator will attempt to try the next binding\. Errors that occur during the final alternative are passed through\. . .IP "" 4 . .nf [[3]] | \.[] as [$a] ?// [$b] | if $a != null then error("err: \e($a)") else {$a,$b} end jq \'\.[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, $d, $e}\' [{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}] => {"a":1,"b":2,"d":3,"e":4}, {"a":1,"b":2,"d":3,"e":4} jq \'\.[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e}\' [{"a": 1, "b": 2, "c": {"d": 3, "e": 4}}, {"a": 1, "b": 2, "c": [{"d": 3, "e": 4}]}] => {"a":1,"b":2,"d":3,"e":null}, {"a":1,"b":2,"d":null,"e":4} jq \'\.[] as [$a] ?// [$b] | if $a != null then error("err: \e($a)") else {$a,$b} end\' [[3]] => {"a":null,"b":3} . .fi . .IP "" 0 . .SS "Defining Functions" You can give a filter a name using "def" syntax: . .IP "" 4 . .nf def increment: \. + 1; . .fi . .IP "" 0 . .P From then on, \fBincrement\fR is usable as a filter just like a builtin function (in fact, this is how many of the builtins are defined)\. A function may take arguments: . .IP "" 4 . .nf def map(f): [\.[] | f]; . .fi . .IP "" 0 . .P Arguments are passed as \fIfilters\fR (functions with no arguments), \fInot\fR as values\. The same argument may be referenced multiple times with different inputs (here \fBf\fR is run for each element of the input array)\. Arguments to a function work more like callbacks than like value arguments\. This is important to understand\. Consider: . .IP "" 4 . .nf def foo(f): f|f; 5|foo(\.*2) . .fi . .IP "" 0 . .P The result will be 20 because \fBf\fR is \fB\.*2\fR, and during the first invocation of \fBf\fR \fB\.\fR will be 5, and the second time it will be 10 (5 * 2), so the result will be 20\. Function arguments are filters, and filters expect an input when invoked\. . .P If you want the value\-argument behaviour for defining simple functions, you can just use a variable: . .IP "" 4 . .nf def addvalue(f): f as $f | map(\. + $f); . .fi . .IP "" 0 . .P Or use the short\-hand: . .IP "" 4 . .nf def addvalue($f): \.\.\.; . .fi . .IP "" 0 . .P With either definition, \fBaddvalue(\.foo)\fR will add the current input\'s \fB\.foo\fR field to each element of the array\. Do note that calling \fBaddvalue(\.[])\fR will cause the \fBmap(\. + $f)\fR part to be evaluated once per value in the value of \fB\.\fR at the call site\. . .P Multiple definitions using the same function name are allowed\. Each re\-definition replaces the previous one for the same number of function arguments, but only for references from functions (or main program) subsequent to the re\-definition\. See also the section below on scoping\. . .IP "" 4 . .nf jq \'def addvalue(f): \. + [f]; map(addvalue(\.[0]))\' [[1,2],[10,20]] => [[1,2,1], [10,20,10]] jq \'def addvalue(f): f as $x | map(\. + $x); addvalue(\.[0])\' [[1,2],[10,20]] => [[1,2,1,2], [10,20,1,2]] . .fi . .IP "" 0 . .SS "Scoping" There are two types of symbols in jq: value bindings (a\.k\.a\., "variables"), and functions\. Both are scoped lexically, with expressions being able to refer only to symbols that have been defined "to the left" of them\. The only exception to this rule is that functions can refer to themselves so as to be able to create recursive functions\. . .P For example, in the following expression there is a binding which is visible "to the right" of it, \fB\.\.\. | \.*3 as $times_three | [\. + $times_three] | \.\.\.\fR, but not "to the left"\. Consider this expression now, \fB\.\.\. | (\.*3 as $times_three | [\. + $times_three]) | \.\.\.\fR: here the binding \fB$times_three\fR is \fInot\fR visible past the closing parenthesis\. . .SS "isempty(exp)" Returns true if \fBexp\fR produces no outputs, false otherwise\. . .IP "" 4 . .nf jq \'isempty(empty)\' null => true jq \'isempty(\.[])\' [] => true jq \'isempty(\.[])\' [1,2,3] => false . .fi . .IP "" 0 . .SS "limit(n; expr)" The \fBlimit\fR function extracts up to \fBn\fR outputs from \fBexpr\fR\. . .IP "" 4 . .nf jq \'[limit(3; \.[])]\' [0,1,2,3,4,5,6,7,8,9] => [0,1,2] . .fi . .IP "" 0 . .SS "skip(n; expr)" The \fBskip\fR function skips the first \fBn\fR outputs from \fBexpr\fR\. . .IP "" 4 . .nf jq \'[skip(3; \.[])]\' [0,1,2,3,4,5,6,7,8,9] => [3,4,5,6,7,8,9] . .fi . .IP "" 0 . .SS "first(expr), last(expr), nth(n; expr)" The \fBfirst(expr)\fR and \fBlast(expr)\fR functions extract the first and last values from \fBexpr\fR, respectively\. . .P The \fBnth(n; expr)\fR function extracts the nth value output by \fBexpr\fR\. Note that \fBnth(n; expr)\fR doesn\'t support negative values of \fBn\fR\. . .IP "" 4 . .nf jq \'[first(range(\.)), last(range(\.)), nth(5; range(\.))]\' 10 => [0,9,5] jq \'[first(empty), last(empty), nth(5; empty)]\' null => [] . .fi . .IP "" 0 . .SS "first, last, nth(n)" The \fBfirst\fR and \fBlast\fR functions extract the first and last values from any array at \fB\.\fR\. . .P The \fBnth(n)\fR function extracts the nth value of any array at \fB\.\fR\. . .IP "" 4 . .nf jq \'[range(\.)]|[first, last, nth(5)]\' 10 => [0,9,5] . .fi . .IP "" 0 . .SS "reduce" The \fBreduce\fR syntax allows you to combine all of the results of an expression by accumulating them into a single answer\. The form is \fBreduce EXP as $var (INIT; UPDATE)\fR\. As an example, we\'ll pass \fB[1,2,3]\fR to this expression: . .IP "" 4 . .nf reduce \.[] as $item (0; \. + $item) . .fi . .IP "" 0 . .P For each result that \fB\.[]\fR produces, \fB\. + $item\fR is run to accumulate a running total, starting from 0 as the input value\. In this example, \fB\.[]\fR produces the results \fB1\fR, \fB2\fR, and \fB3\fR, so the effect is similar to running something like this: . .IP "" 4 . .nf 0 | 1 as $item | \. + $item | 2 as $item | \. + $item | 3 as $item | \. + $item jq \'reduce \.[] as $item (0; \. + $item)\' [1,2,3,4,5] => 15 jq \'reduce \.[] as [$i,$j] (0; \. + $i * $j)\' [[1,2],[3,4],[5,6]] => 44 jq \'reduce \.[] as {$x,$y} (null; \.x += $x | \.y += [$y])\' [{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}] => {"x":"abc","y":[1,2,3]} . .fi . .IP "" 0 . .SS "foreach" The \fBforeach\fR syntax is similar to \fBreduce\fR, but intended to allow the construction of \fBlimit\fR and reducers that produce intermediate results\. . .P The form is \fBforeach EXP as $var (INIT; UPDATE; EXTRACT)\fR\. As an example, we\'ll pass \fB[1,2,3]\fR to this expression: . .IP "" 4 . .nf foreach \.[] as $item (0; \. + $item; [$item, \. * 2]) . .fi . .IP "" 0 . .P Like the \fBreduce\fR syntax, \fB\. + $item\fR is run for each result that \fB\.[]\fR produces, but \fB[$item, \. * 2]\fR is run for each intermediate values\. In this example, since the intermediate values are \fB1\fR, \fB3\fR, and \fB6\fR, the \fBforeach\fR expression produces \fB[1,2]\fR, \fB[2,6]\fR, and \fB[3,12]\fR\. So the effect is similar to running something like this: . .IP "" 4 . .nf 0 | 1 as $item | \. + $item | [$item, \. * 2], 2 as $item | \. + $item | [$item, \. * 2], 3 as $item | \. + $item | [$item, \. * 2] . .fi . .IP "" 0 . .P When \fBEXTRACT\fR is omitted, the identity filter is used\. That is, it outputs the intermediate values as they are\. . .IP "" 4 . .nf jq \'foreach \.[] as $item (0; \. + $item)\' [1,2,3,4,5] => 1, 3, 6, 10, 15 jq \'foreach \.[] as $item (0; \. + $item; [$item, \. * 2])\' [1,2,3,4,5] => [1,2], [2,6], [3,12], [4,20], [5,30] jq \'foreach \.[] as $item (0; \. + 1; {index: \., $item})\' ["foo", "bar", "baz"] => {"index":1,"item":"foo"}, {"index":2,"item":"bar"}, {"index":3,"item":"baz"} . .fi . .IP "" 0 . .SS "Recursion" As described above, \fBrecurse\fR uses recursion, and any jq function can be recursive\. The \fBwhile\fR builtin is also implemented in terms of recursion\. . .P Tail calls are optimized whenever the expression to the left of the recursive call outputs its last value\. In practice this means that the expression to the left of the recursive call should not produce more than one output for each input\. . .P For example: . .IP "" 4 . .nf def recurse(f): def r: \., (f | select(\. != null) | r); r; def while(cond; update): def _while: if cond then \., (update | _while) else empty end; _while; def repeat(exp): def _repeat: exp, _repeat; _repeat; . .fi . .IP "" 0 . .SS "Generators and iterators" Some jq operators and functions are actually generators in that they can produce zero, one, or more values for each input, just as one might expect in other programming languages that have generators\. For example, \fB\.[]\fR generates all the values in its input (which must be an array or an object), \fBrange(0; 10)\fR generates the integers between 0 and 10, and so on\. . .P Even the comma operator is a generator, generating first the values generated by the expression to the left of the comma, then the values generated by the expression on the right of the comma\. . .P The \fBempty\fR builtin is the generator that produces zero outputs\. The \fBempty\fR builtin backtracks to the preceding generator expression\. . .P All jq functions can be generators just by using builtin generators\. It is also possible to construct new generators using only recursion and the comma operator\. If recursive calls are "in tail position" then the generator will be efficient\. In the example below the recursive call by \fB_range\fR to itself is in tail position\. The example shows off three advanced topics: tail recursion, generator construction, and sub\-functions\. . .IP "" 4 . .nf jq \'def range(init; upto; by): def _range: if (by > 0 and \. < upto) or (by < 0 and \. > upto) then \., ((\.+by)|_range) else empty end; if init == upto then empty elif by == 0 then init else init|_range end; range(0; 10; 3)\' null => 0, 3, 6, 9 jq \'def while(cond; update): def _while: if cond then \., (update | _while) else empty end; _while; [while(\.<100; \.*2)]\' 1 => [1,2,4,8,16,32,64] . .fi . .IP "" 0 . .SH "MATH" jq currently only has IEEE754 double\-precision (64\-bit) floating point number support\. . .P Besides simple arithmetic operators such as \fB+\fR, jq also has most standard math functions from the C math library\. C math functions that take a single input argument (e\.g\., \fBsin()\fR) are available as zero\-argument jq functions\. C math functions that take two input arguments (e\.g\., \fBpow()\fR) are available as two\-argument jq functions that ignore \fB\.\fR\. C math functions that take three input arguments are available as three\-argument jq functions that ignore \fB\.\fR\. . .P Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library\. Unavailable math functions will be defined but will raise an error\. . .P One\-input C math functions: \fBacos\fR \fBacosh\fR \fBasin\fR \fBasinh\fR \fBatan\fR \fBatanh\fR \fBcbrt\fR \fBceil\fR \fBcos\fR \fBcosh\fR \fBerf\fR \fBerfc\fR \fBexp\fR \fBexp10\fR \fBexp2\fR \fBexpm1\fR \fBfabs\fR \fBfloor\fR \fBgamma\fR \fBj0\fR \fBj1\fR \fBlgamma\fR \fBlog\fR \fBlog10\fR \fBlog1p\fR \fBlog2\fR \fBlogb\fR \fBnearbyint\fR \fBrint\fR \fBround\fR \fBsignificand\fR \fBsin\fR \fBsinh\fR \fBsqrt\fR \fBtan\fR \fBtanh\fR \fBtgamma\fR \fBtrunc\fR \fBy0\fR \fBy1\fR\. . .P Two\-input C math functions: \fBatan2\fR \fBcopysign\fR \fBdrem\fR \fBfdim\fR \fBfmax\fR \fBfmin\fR \fBfmod\fR \fBfrexp\fR \fBhypot\fR \fBjn\fR \fBldexp\fR \fBmodf\fR \fBnextafter\fR \fBnexttoward\fR \fBpow\fR \fBremainder\fR \fBscalb\fR \fBscalbln\fR \fByn\fR\. . .P Three\-input C math functions: \fBfma\fR\. . .P See your system\'s manual for more information on each of these\. . .SH "I/O" At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read\. Two builtins functions are provided for this, \fBinput\fR and \fBinputs\fR, that read from the same sources (e\.g\., \fBstdin\fR, files named on the command\-line) as jq itself\. These two builtins, and jq\'s own reading actions, can be interleaved with each other\. They are commonly used in combination with the null input option \fB\-n\fR to prevent one input from being read implicitly\. . .P Two builtins provide minimal output capabilities, \fBdebug\fR, and \fBstderr\fR\. (Recall that a jq program\'s output values are always output as JSON texts on \fBstdout\fR\.) The \fBdebug\fR builtin can have application\-specific behavior, such as for executables that use the libjq C API but aren\'t the jq executable itself\. The \fBstderr\fR builtin outputs its input in raw mode to stderr with no additional decoration, not even a newline\. . .P Most jq builtins are referentially transparent, and yield constant and repeatable value streams when applied to constant inputs\. This is not true of I/O builtins\. . .SS "input" Outputs one new input\. . .P Note that when using \fBinput\fR it is generally necessary to invoke jq with the \fB\-n\fR command\-line option, otherwise the first entity will be lost\. . .IP "" 4 . .nf echo 1 2 3 4 | jq \'[\., input]\' # [1,2] [3,4] . .fi . .IP "" 0 . .SS "inputs" Outputs all remaining inputs, one by one\. . .P This is primarily useful for reductions over a program\'s inputs\. Note that when using \fBinputs\fR it is generally necessary to invoke jq with the \fB\-n\fR command\-line option, otherwise the first entity will be lost\. . .IP "" 4 . .nf echo 1 2 3 | jq \-n \'reduce inputs as $i (0; \. + $i)\' # 6 . .fi . .IP "" 0 . .SS "debug, debug(msgs)" These two filters are like \fB\.\fR but have as a side\-effect the production of one or more messages on stderr\. . .P The message produced by the \fBdebug\fR filter has the form . .IP "" 4 . .nf ["DEBUG:",] . .fi . .IP "" 0 . .P where \fB\fR is a compact rendition of the input value\. This format may change in the future\. . .P The \fBdebug(msgs)\fR filter is defined as \fB(msgs | debug | empty), \.\fR thus allowing great flexibility in the content of the message, while also allowing multi\-line debugging statements to be created\. . .P For example, the expression: . .IP "" 4 . .nf 1 as $x | 2 | debug("Entering function foo with $x == \e($x)", \.) | (\.+1) . .fi . .IP "" 0 . .P would produce the value 3 but with the following two lines being written to stderr: . .IP "" 4 . .nf ["DEBUG:","Entering function foo with $x == 1"] ["DEBUG:",2] . .fi . .IP "" 0 . .SS "stderr" Prints its input in raw and compact mode to stderr with no additional decoration, not even a newline\. . .SS "input_filename" Returns the name of the file whose input is currently being filtered\. Note that this will not work well unless jq is running in a UTF\-8 locale\. . .SS "input_line_number" Returns the line number of the input currently being filtered\. . .SH "STREAMING" With the \fB\-\-stream\fR option jq can parse input texts in a streaming fashion, allowing jq programs to start processing large JSON texts immediately rather than after the parse completes\. If you have a single JSON text that is 1GB in size, streaming it will allow you to process it much more quickly\. . .P However, streaming isn\'t easy to deal with as the jq program will have \fB[, ]\fR (and a few other forms) as inputs\. . .P Several builtins are provided to make handling streams easier\. . .P The examples below use the streamed form of \fB["a",["b"]]\fR, which is \fB[[0],"a"],[[1,0],"b"],[[1,0]],[[1]]\fR\. . .P Streaming forms include \fB[, ]\fR (to indicate any scalar value, empty array, or empty object), and \fB[]\fR (to indicate the end of an array or object)\. Future versions of jq run with \fB\-\-stream\fR and \fB\-\-seq\fR may output additional forms such as \fB["error message"]\fR when an input text fails to parse\. . .SS "truncate_stream(stream_expression)" Consumes a number as input and truncates the corresponding number of path elements from the left of the outputs of the given streaming expression\. . .IP "" 4 . .nf jq \'truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]])\' 1 => [[0],"b"], [[0]] . .fi . .IP "" 0 . .SS "fromstream(stream_expression)" Outputs values corresponding to the stream expression\'s outputs\. . .IP "" 4 . .nf jq \'fromstream(1|truncate_stream([[0],"a"],[[1,0],"b"],[[1,0]],[[1]]))\' null => ["b"] . .fi . .IP "" 0 . .SS "tostream" The \fBtostream\fR builtin outputs the streamed form of its input\. . .IP "" 4 . .nf jq \'\. as $dot|fromstream($dot|tostream)|\.==$dot\' [0,[1,{"a":1},{"b":2}]] => true . .fi . .IP "" 0 . .SH "ASSIGNMENT" Assignment works a little differently in jq than in most programming languages\. jq doesn\'t distinguish between references to and copies of something \- two objects or arrays are either equal or not equal, without any further notion of being "the same object" or "not the same object"\. . .P If an object has two fields which are arrays, \fB\.foo\fR and \fB\.bar\fR, and you append something to \fB\.foo\fR, then \fB\.bar\fR will not get bigger, even if you\'ve previously set \fB\.bar = \.foo\fR\. If you\'re used to programming in languages like Python, Java, Ruby, JavaScript, etc\. then you can think of it as though jq does a full deep copy of every object before it does the assignment (for performance it doesn\'t actually do that, but that\'s the general idea)\. . .P This means that it\'s impossible to build circular values in jq (such as an array whose first element is itself)\. This is quite intentional, and ensures that anything a jq program can produce can be represented in JSON\. . .P All the assignment operators in jq have path expressions on the left\-hand side (LHS)\. The right\-hand side (RHS) provides values to set to the paths named by the LHS path expressions\. . .P Values in jq are always immutable\. Internally, assignment works by using a reduction to compute new, replacement values for \fB\.\fR that have had all the desired assignments applied to \fB\.\fR, then outputting the modified value\. This might be made clear by this example: \fB{a:{b:{c:1}}} | (\.a\.b|=3), \.\fR\. This will output \fB{"a":{"b":3}}\fR and \fB{"a":{"b":{"c":1}}}\fR because the last sub\-expression, \fB\.\fR, sees the original value, not the modified value\. . .P Most users will want to use modification assignment operators, such as \fB|=\fR or \fB+=\fR, rather than \fB=\fR\. . .P Note that the LHS of assignment operators refers to a value in \fB\.\fR\. Thus \fB$var\.foo = 1\fR won\'t work as expected (\fB$var\.foo\fR is not a valid or useful path expression in \fB\.\fR); use \fB$var | \.foo = 1\fR instead\. . .P Note too that \fB\.a,\.b=0\fR does not set \fB\.a\fR and \fB\.b\fR, but \fB(\.a,\.b)=0\fR sets both\. . .SS "Update\-assignment: |=" This is the "update" operator \fB|=\fR\. It takes a filter on the right\-hand side and works out the new value for the property of \fB\.\fR being assigned to by running the old value through this expression\. For instance, \fB(\.foo, \.bar) |= \.+1\fR will build an object with the \fBfoo\fR field set to the input\'s \fBfoo\fR plus 1, and the \fBbar\fR field set to the input\'s \fBbar\fR plus 1\. . .P The left\-hand side can be any general path expression; see \fBpath()\fR\. . .P Note that the left\-hand side of \fB|=\fR refers to a value in \fB\.\fR\. Thus \fB$var\.foo |= \. + 1\fR won\'t work as expected (\fB$var\.foo\fR is not a valid or useful path expression in \fB\.\fR); use \fB$var | \.foo |= \. + 1\fR instead\. . .P If the right\-hand side outputs no values (i\.e\., \fBempty\fR), then the left\-hand side path will be deleted, as with \fBdel(path)\fR\. . .P If the right\-hand side outputs multiple values, only the first one will be used (COMPATIBILITY NOTE: in jq 1\.5 and earlier releases, it used to be that only the last one was used)\. . .IP "" 4 . .nf jq \'(\.\.|select(type=="boolean")) |= if \. then 1 else 0 end\' [true,false,[5,true,[true,[false]],false]] => [1,0,[5,1,[1,[0]],0]] . .fi . .IP "" 0 . .SS "Arithmetic update\-assignment: +=, \-=, *=, /=, %=, //=" jq has a few operators of the form \fBa op= b\fR, which are all equivalent to \fBa |= \. op b\fR\. So, \fB+= 1\fR can be used to increment values, being the same as \fB|= \. + 1\fR\. . .IP "" 4 . .nf jq \'\.foo += 1\' {"foo": 42} => {"foo": 43} . .fi . .IP "" 0 . .SS "Plain assignment: =" This is the plain assignment operator\. Unlike the others, the input to the right\-hand side (RHS) is the same as the input to the left\-hand side (LHS) rather than the value at the LHS path, and all values output by the RHS will be used (as shown below)\. . .P If the RHS of \fB=\fR produces multiple values, then for each such value jq will set the paths on the left\-hand side to the value and then it will output the modified \fB\.\fR\. For example, \fB(\.a,\.b) = range(2)\fR outputs \fB{"a":0,"b":0}\fR, then \fB{"a":1,"b":1}\fR\. The "update" assignment forms (see above) do not do this\. . .P This example should show the difference between \fB=\fR and \fB|=\fR: . .P Provide input \fB{"a": {"b": 10}, "b": 20}\fR to the programs . .IP "" 4 . .nf \&.a = \.b . .fi . .IP "" 0 . .P and . .IP "" 4 . .nf \&.a |= \.b . .fi . .IP "" 0 . .P The former will set the \fBa\fR field of the input to the \fBb\fR field of the input, and produce the output \fB{"a": 20, "b": 20}\fR\. The latter will set the \fBa\fR field of the input to the \fBa\fR field\'s \fBb\fR field, producing \fB{"a": 10, "b": 20}\fR\. . .IP "" 4 . .nf jq \'\.a = \.b\' {"a": {"b": 10}, "b": 20} => {"a":20,"b":20} jq \'\.a |= \.b\' {"a": {"b": 10}, "b": 20} => {"a":10,"b":20} jq \'(\.a, \.b) = range(3)\' null => {"a":0,"b":0}, {"a":1,"b":1}, {"a":2,"b":2} jq \'(\.a, \.b) |= range(3)\' null => {"a":0,"b":0} . .fi . .IP "" 0 . .SS "Complex assignments" Lots more things are allowed on the left\-hand side of a jq assignment than in most languages\. We\'ve already seen simple field accesses on the left hand side, and it\'s no surprise that array accesses work just as well: . .IP "" 4 . .nf \&.posts[0]\.title = "JQ Manual" . .fi . .IP "" 0 . .P What may come as a surprise is that the expression on the left may produce multiple results, referring to different points in the input document: . .IP "" 4 . .nf \&.posts[]\.comments |= \. + ["this is great"] . .fi . .IP "" 0 . .P That example appends the string "this is great" to the "comments" array of each post in the input (where the input is an object with a field "posts" which is an array of posts)\. . .P When jq encounters an assignment like \'a = b\', it records the "path" taken to select a part of the input document while executing a\. This path is then used to find which part of the input to change while executing the assignment\. Any filter may be used on the left\-hand side of an equals \- whichever paths it selects from the input will be where the assignment is performed\. . .P This is a very powerful operation\. Suppose we wanted to add a comment to blog posts, using the same "blog" input above\. This time, we only want to comment on the posts written by "stedolan"\. We can find those posts using the "select" function described earlier: . .IP "" 4 . .nf \&.posts[] | select(\.author == "stedolan") . .fi . .IP "" 0 . .P The paths provided by this operation point to each of the posts that "stedolan" wrote, and we can comment on each of them in the same way that we did before: . .IP "" 4 . .nf (\.posts[] | select(\.author == "stedolan") | \.comments) |= \. + ["terrible\."] . .fi . .IP "" 0 . .SH "COMMENTS" You can write comments in your jq filters using \fB#\fR\. . .P A \fB#\fR character (not part of a string) starts a comment\. All characters from \fB#\fR to the end of the line are ignored\. . .P If the end of the line is preceded by an odd number of backslash characters, the following line is also considered part of the comment and is ignored\. . .P For example, the following code outputs \fB[1,3,4,7]\fR . .IP "" 4 . .nf [ 1, # foo \e 2, # bar \e\e 3, 4, # baz \e\e\e 5, \e 6, 7 # comment \e comment \e comment ] . .fi . .IP "" 0 . .P Backslash continuing the comment on the next line can be useful when writing the "shebang" for a jq script: . .IP "" 4 . .nf #!/bin/sh \-\- # total \- Output the sum of the given arguments (or stdin) # usage: total [numbers\.\.\.] # \e exec jq \-\-args \-MRnf \-\- "$0" "$@" $ARGS\.positional | reduce ( if \. == [] then inputs else \.[] end | \. as $dot | try tonumber catch false | if not or isnan then @json "total: Invalid number \e($dot)\.\en" | halt_error(1) end ) as $n (0; \. + $n) . .fi . .IP "" 0 . .P The \fBexec\fR line is considered a comment by jq, so it is ignored\. But it is not ignored by \fBsh\fR, since in \fBsh\fR a backslash at the end of the line does not continue the comment\. With this trick, when the script is invoked as \fBtotal 1 2\fR, \fB/bin/sh \-\- /path/to/total 1 2\fR will be run, and \fBsh\fR will then run \fBexec jq \-\-args \-MRnf \-\- /path/to/total 1 2\fR replacing itself with a \fBjq\fR interpreter invoked with the specified options (\fB\-M\fR, \fB\-R\fR, \fB\-n\fR, \fB\-\-args\fR), that evaluates the current file (\fB$0\fR), with the arguments (\fB$@\fR) that were passed to \fBsh\fR\. . .SH "MODULES" jq has a library/module system\. Modules are files whose names end in \fB\.jq\fR\. . .P Modules imported by a program are searched for in a default search path (see below)\. The \fBimport\fR and \fBinclude\fR directives allow the importer to alter this path\. . .P Paths in the search path are subject to various substitutions\. . .P For paths starting with \fB~/\fR, the user\'s home directory is substituted for \fB~\fR\. . .P For paths starting with \fB$ORIGIN/\fR, the directory where the jq executable is located is substituted for \fB$ORIGIN\fR\. . .P For paths starting with \fB\./\fR or paths that are \fB\.\fR, the path of the including file is substituted for \fB\.\fR\. For top\-level programs given on the command\-line, the current directory is used\. . .P Import directives can optionally specify a search path to which the default is appended\. . .P The default search path is the search path given to the \fB\-L\fR command\-line option, else \fB["~/\.jq", "$ORIGIN/\.\./lib/jq", "$ORIGIN/\.\./lib"]\fR\. . .P Null and empty string path elements terminate search path processing\. . .P A dependency with relative path \fBfoo/bar\fR would be searched for in \fBfoo/bar\.jq\fR and \fBfoo/bar/bar\.jq\fR in the given search path\. This is intended to allow modules to be placed in a directory along with, for example, version control files, README files, and so on, but also to allow for single\-file modules\. . .P Consecutive components with the same name are not allowed to avoid ambiguities (e\.g\., \fBfoo/foo\fR)\. . .P For example, with \fB\-L$HOME/\.jq\fR a module \fBfoo\fR can be found in \fB$HOME/\.jq/foo\.jq\fR and \fB$HOME/\.jq/foo/foo\.jq\fR\. . .P If \fB\.jq\fR exists in the user\'s home directory, and is a file (not a directory), it is automatically sourced into the main program\. . .SS "import RelativePathString as NAME [];" Imports a module found at the given path relative to a directory in a search path\. A \fB\.jq\fR suffix will be added to the relative path string\. The module\'s symbols are prefixed with \fBNAME::\fR\. . .P The optional metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR and so on\. At this time jq only uses the \fBsearch\fR key/value of the metadata\. The metadata is also made available to users via the \fBmodulemeta\fR builtin\. . .P The \fBsearch\fR key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top\-level search path\. . .SS "include RelativePathString [];" Imports a module found at the given path relative to a directory in a search path as if it were included in place\. A \fB\.jq\fR suffix will be added to the relative path string\. The module\'s symbols are imported into the caller\'s namespace as if the module\'s content had been included directly\. . .P The optional metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR and so on\. At this time jq only uses the \fBsearch\fR key/value of the metadata\. The metadata is also made available to users via the \fBmodulemeta\fR builtin\. . .SS "import RelativePathString as $NAME [];" Imports a JSON file found at the given path relative to a directory in a search path\. A \fB\.json\fR suffix will be added to the relative path string\. The file\'s data will be available as \fB$NAME::NAME\fR\. . .P The optional metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR and so on\. At this time jq only uses the \fBsearch\fR key/value of the metadata\. The metadata is also made available to users via the \fBmodulemeta\fR builtin\. . .P The \fBsearch\fR key in the metadata, if present, should have a string or array value (array of strings); this is the search path to be prefixed to the top\-level search path\. . .SS "module ;" This directive is entirely optional\. It\'s not required for proper operation\. It serves only the purpose of providing metadata that can be read with the \fBmodulemeta\fR builtin\. . .P The metadata must be a constant jq expression\. It should be an object with keys like \fBhomepage\fR\. At this time jq doesn\'t use this metadata, but it is made available to users via the \fBmodulemeta\fR builtin\. . .SS "modulemeta" Takes a module name as input and outputs the module\'s metadata as an object, with the module\'s imports (including metadata) as an array value for the \fBdeps\fR key and the module\'s defined functions as an array value for the \fBdefs\fR key\. . .P Programs can use this to query a module\'s metadata, which they could then use to, for example, search for, download, and install missing dependencies\. . .SH "COLORS" To configure alternative colors just set the \fBJQ_COLORS\fR environment variable to colon\-delimited list of partial terminal escape sequences like \fB"1;31"\fR, in this order: . .IP "\(bu" 4 color for \fBnull\fR . .IP "\(bu" 4 color for \fBfalse\fR . .IP "\(bu" 4 color for \fBtrue\fR . .IP "\(bu" 4 color for numbers . .IP "\(bu" 4 color for strings . .IP "\(bu" 4 color for arrays . .IP "\(bu" 4 color for objects . .IP "\(bu" 4 color for object keys . .IP "" 0 . .P The default color scheme is the same as setting \fBJQ_COLORS="0;90:0;39:0;39:0;39:0;32:1;39:1;39:1;34"\fR\. . .P This is not a manual for VT100/ANSI escapes\. However, each of these color specifications should consist of two numbers separated by a semi\-colon, where the first number is one of these: . .IP "\(bu" 4 1 (bright) . .IP "\(bu" 4 2 (dim) . .IP "\(bu" 4 4 (underscore) . .IP "\(bu" 4 5 (blink) . .IP "\(bu" 4 7 (reverse) . .IP "\(bu" 4 8 (hidden) . .IP "" 0 . .P and the second is one of these: . .IP "\(bu" 4 30 (black) . .IP "\(bu" 4 31 (red) . .IP "\(bu" 4 32 (green) . .IP "\(bu" 4 33 (yellow) . .IP "\(bu" 4 34 (blue) . .IP "\(bu" 4 35 (magenta) . .IP "\(bu" 4 36 (cyan) . .IP "\(bu" 4 37 (white) . .IP "" 0 . .SH "BUGS" Presumably\. Report them or discuss them at: . .IP "" 4 . .nf https://github\.com/jqlang/jq/issues . .fi . .IP "" 0 . .SH "AUTHOR" Stephen Dolan \fB\fR jq-1.8.2/aclocal.m40000644000175100017510000013257315215513555007501 # generated automatically by aclocal 1.16.5 -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, [m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_AR([ACT-IF-FAIL]) # ------------------------- # Try to determine the archiver interface, and trigger the ar-lib wrapper # if it is needed. If the detection of archiver interface fails, run # ACT-IF-FAIL (default is to abort configure with a proper error message). AC_DEFUN([AM_PROG_AR], [AC_BEFORE([$0], [LT_INIT])dnl AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([ar-lib])dnl AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) : ${AR=ar} AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], [AC_LANG_PUSH([C]) am_cv_ar_interface=ar AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a ]) AC_LANG_POP([C])]) case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # 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__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) m4_default([$1], [AC_MSG_ERROR([could not determine $AR interface])]) ;; esac AC_SUBST([AR])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_compare_version.m4]) m4_include([m4/ax_prog_bison_version.m4]) m4_include([m4/ax_pthread.m4]) m4_include([config/m4/check-math-func.m4]) m4_include([config/m4/find-func-no-libs.m4]) m4_include([config/m4/find-func-no-libs2.m4]) m4_include([config/m4/find-func.m4]) m4_include([config/m4/libtool.m4]) m4_include([config/m4/ltoptions.m4]) m4_include([config/m4/ltsugar.m4]) m4_include([config/m4/ltversion.m4]) m4_include([config/m4/lt~obsolete.m4]) m4_include([config/m4/misc.m4]) jq-1.8.2/NEWS.md0000644000175100017510000007322115215513536006730 # 1.8.2 This is a patch release with security fixes and bug fixes since 1.8.1, along with new builds for Windows arm64 and Docker arm/v7. Full commit log can be found at . ## Security fixes - CVE-2026-32316: Fix heap buffer overflow in `jvp_string_append` and `jvp_string_copy_replace_bad`. @itchyny e47e56d226519635768e6aab2f38f0ab037c09e5 - CVE-2026-33947: Limit path depth to prevent stack overflow in `jv_setpath`, `jv_getpath`, `jv_delpaths`. @itchyny fb59f1491058d58bdc3e8dd28f1773d1ac690a1f - CVE-2026-33948: Fix NUL truncation in the JSON parser. @itchyny 6374ae0bcdfe33a18eb0ae6db28493b1f34a0a5b - CVE-2026-39956: Fix `_strindices` missing runtime type checks. @tlsbollei fdf8ef0f0810e3d365cdd5160de43db46f57ed03 - CVE-2026-39979: Fix out-of-bounds read in `jv_parse_sized()`. @wader 2f09060afab23fe9390cce7cb860b10416e1bf5f - CVE-2026-40164: Randomize hash seed to mitigate hash collision DoS attacks. @AsafMeizner @itchyny 0c7d133c3c7e37c00b6d46b658a02244fdd3c784 - CVE-2026-40612: Limit containment check depth to prevent stack overflow in `contains`. @itchyny d1a12569d91641135976a8536776a4a329c02cc2 - CVE-2026-41256: Fix NUL truncation in program files loaded with `-f`. @itchyny 5a015deae35d19e3ebbc65db6c157a80e76df738 - CVE-2026-41257: Fix signed-int overflow in `stack_reallocate`. @itchyny 01b3cded76daacbfddb7f8763700b0803bcb5c6f - CVE-2026-43894: Reject numeric literals longer than `DEC_MAX_DIGITS` (999999999). @itchyny 9761ceb7d6cc48c16b25f0ab1baaef0e701927e4 - CVE-2026-43895: Reject embedded NUL bytes in module import paths. @itchyny 9d223f153c3632a207fa071caaa6292da33ae361 - CVE-2026-43896: Limit recursive object merge depth to prevent stack overflow. @itchyny 532ccea6080ed6758f39fe9f6208a44b665023d2 - CVE-2026-44777: Detect circular module imports to prevent stack overflow. @itchyny f58787c41835d9b17795730cb04925fdba25c71c - CVE-2026-47770: Guard deep structural equality and comparison recursion. @fuyu0425 7122866869960b55cea3646bc91334ef55787831 - CVE-2026-49839: Fix heap-buffer-overflow in raw file loading. @itchyny e987df0d463d85fd70825e042a082427e8275b86 - CVE-2026-54679: Tighten string length bounds and propagate invalid jv in implode. @itchyny 46d1da30944ce93dd671ac72b6513fc0eb747837 - GHSA-gf4g-95wj-4q4r: Fix use-after-free in `args2obj()` array argument path. @sseal #3498 - GHSA-hj52-j2c9-r8r4: Fix signed-int overflow in `tokenadd` to prevent buffer overflow. @itchyny 63751f8a9f94dc6d3370084ad0d60826c58b955d - Limit the number of function parameters and definitions to prevent SEGV. @OwenSanzas #3460 - Pre-allocate `tokenbuf` for string parser to avoid undefined behavior. @fab1ano #3485 - Avoid stack overflow when freeing deeply nested values. @itchyny 33d7bce3218ec718139342e5b48b475c4dea715f - Fix memory leaks and double frees. @itchyny #3487 ## Releasing - Add builds for Windows arm64. @dennisameling #3376 - Support arm/v7 architecture in Docker images. @itchyny #3463 - Update GPG signing key. @itchyny 0ff997f7c4c07660ffc6ad2506d5f56b8136208b - Add `artifact-metadata` permission for actions/attest. @itchyny #3530 - Upload attestation bundle as a release artifact, allowing unauthenticated verification via `gh attestation verify --bundle jq-attestation.json`. @itchyny #3563 ## CLI changes - Improve error message truncation with closing delimiters. @itchyny #3478 - Remove extra space from `die` function output. @krtk6160 #3391 - Fix raw input flag not to corrupt multi-byte characters. @itchyny #3421 - Fix crash when importing a module with errors twice. @itchyny #3497 - Increase the maximum printing depth from 256 to 10000. @ishnagy #3414 ## Changes to existing functions - Fix `rtrimstr("")` always outputting `""`. @A4-Tacks #3415 - Fix infinite loop and undefined behavior in `del(.[nan])`. @itchyny #3490 - Refactor `@uri` and `@urid` to fix multi-byte UTF-8 corruption. @itchyny #3495 - Fix `tonumber` and `toboolean` to reject strings with embedded null bytes. @itchyny #3496 - Fix undefined behavior in modulo operator. @fab1ano #3486 - Fix reversed pointer subtraction in `f_env` bounds check. @itchyny #3465 - Fix missing validity check in `f_strflocaltime` after `f_localtime`. @itchyny #3491 - Fix year 2038 problem on 32-bit platforms. @itchyny #3407 - Use `//` instead of `//=` in `from_entries` definition. @itchyny #3516 ## Build and test changes - Drop `strptime` test using non-portable `%F`. @alyssais #3365 - Limit oniguruma depth to 1024 in `jq_fuzz_execute`. @sudhackar #3377 - Fix localization test for time formatting functions. @itchyny #3409 - Fix expected value assertion. @itchyny #3431 #3408 - Fix typo in tests/jq.test. @bigmoonbit #3441 - Refactor `tm2jv` to handle fractional seconds. @itchyny #3489 - Fix `jq_fuzz_parse_stream`: use iterative parser API for streaming mode. @OwenSanzas #3499 - Fix crashes and resource leaks in `jq_testsuite`. @itchyny #3509 - Support building with `--disable-maintainer-mode` and source != build dir. @Saur2000 #3518 - Add Solaris support. @vlmarek #3515 - Respect `SOURCE_DATE_EPOCH` while generating man page. @McSinyx #3514 - Fix undefined pointer arithmetic in UTF-8 helpers. @theyoucheng df924eae91af10cc236a907cdadd97813827aa1f - Fix one-byte over-read in `BASE64_DECODE_TABLE`. @itchyny #3547 ## Documentation changes - Add wiki link to navigation bar. @wader #3424 - Add missing word in manual for rawfile. @jpmens #3434 - Fix typo "stder" to "stderr". @jjatria #3446 - Fix buttons in tutorial to toggle labels when clicked on. @itchyny #3493 - Fix "happened" spelling in tutorial changelog entries. @Rohan5commit #3525 # 1.8.1 This is a patch release to fix security, performance, and build issues found in 1.8.0. Full commit log can be found at . ## Security fixes - CVE-2025-49014: Fix heap use after free in `f_strftime`, `f_strflocaltime`. @wader 499c91bca9d4d027833bc62787d1bb075c03680e - GHSA-f946-j5j2-4w5m: Fix stack overflow in `node_min_byte_len` of oniguruma. @wader 5e159b34b179417e3e0404108190a2ac7d65611c ## CLI changes - Fix assertion failure when syntax error happens at the end of the query. @itchyny #3350 ## Changes to existing functions - Fix portability of `strptime/1` especially for Windows. @itchyny #3342 ## Language changes - Revert the change of `reduce`/`foreach` state variable in 1.8.0 (#3205). This change was reverted due to serious performance regression. @itchyny #3349 ## Documentation changes - Add LICENSE notice of NetBSD's `strptime()` to COPYING. @itchyny #3344 ## Build improvements - Fix build on old Mac with old sed. @qianbinbin #3336 # 1.8.0 We are pleased to announce the release of version 1.8.0. This release includes a number of improvements since the last version. Note that some changes may introduce breaking changes to existing scripts, so be sure to read the following information carefully. Full commit log can be found at . ## Releasing - Change the version number pattern to `1.X.Y` (`1.8.0` instead of `1.8`). @itchyny #2999 - Generate provenance attestations for release artifacts and docker image. @lectrical #3225 ```sh gh attestation verify --repo jqlang/jq jq-linux-amd64 gh attestation verify --repo jqlang/jq oci://ghcr.io/jqlang/jq:1.8.0 ``` ## Security fixes - CVE-2024-23337: Fix signed integer overflow in `jvp_array_write` and `jvp_object_rehash`. @itchyny de21386681c0df0104a99d9d09db23a9b2a78b1e - The fix for this issue now limits the maximum size of arrays and objects to 536870912 (`2^29`) elements. - CVE-2024-53427: Reject NaN with payload while parsing JSON. @itchyny a09a4dfd55e6c24d04b35062ccfe4509748b1dd3 - The fix for this issue now drops support for NaN with payload in JSON (like `NaN123`). Other JSON extensions like `NaN` and `Infinity` are still supported. - CVE-2025-48060: Fix heap buffer overflow in `jv_string_vfmt`. @itchyny c6e041699d8cd31b97375a2596217aff2cfca85b - Fix use of uninitialized value in `check_literal`. @itchyny #3324 - Fix segmentation fault on `strftime/1`, `strflocaltime/1`. @itchyny #3271 - Fix unhandled overflow in `@base64d`. @emanuele6 #3080 ## CLI changes - Fix `--indent 0` implicitly enabling `--compact-output`. @amarshall @gbrlmarn @itchyny #3232 ```sh $ jq --indent 0 . <<< '{ "foo": ["hello", "world"] }' { "foo": [ "hello", "world" ] } # Previously, this implied --compact-output, but now outputs with new lines. ``` - Improve error messages to show problematic position in the filter. @itchyny #3292 ```sh $ jq -n '1 + $foo + 2' jq: error: $foo is not defined at , line 1, column 5: 1 + $foo + 2 ^^^^ jq: 1 compile error ``` - Include column number in parser and compiler error messages. @liviubobocu #3257 - Fix error message for string literal beginning with single quote. @mattmeyers #2964 ```sh $ jq .foo <<< "{'foo':'bar'}" jq: parse error: Invalid string literal; expected ", but got ' at line 1, column 7 # Previously, the error message was Invalid numeric literal at line 1, column 7. ``` - Improve `JQ_COLORS` environment variable to support larger escapes like truecolor. @SArpnt #3282 ```sh JQ_COLORS="38;2;255;173;173:38;2;255;214;165:38;2;253;255;182:38;2;202;255;191:38;2;155;246;255:38;2;160;196;255:38;2;189;178;255:38;2;255;198;255" jq -nc '[null,false,true,42,{"a":"bc"}]' ``` - Add `--library-path` long option for `-L`. @thaliaarchi #3194 - Fix `--slurp --stream` when input has no trailing newline character. @itchyny #3279 - Fix `--indent` option to error for malformed values. @thaliaarchi #3195 - Fix option parsing of `--binary` on non-Windows platforms. @calestyo #3131 - Fix issue with `~/.jq` on Windows where `$HOME` is not set. @kirkoman #3114 - Fix broken non-Latin output in the command help on Windows. @itchyny #3299 - Increase the maximum parsing depth for JSON to 10000. @itchyny #3328 - Parse short options in order given. @thaliaarchi #3194 - Consistently reset color formatting. @thaliaarchi #3034 ## New functions - Add `trim/0`, `ltrim/0` and `rtrim/0` to trim leading and trailing white spaces. @wader #3056 ```sh $ jq -n '" hello " | trim, ltrim, rtrim' "hello" "hello " " hello" ``` - Add `trimstr/1` to trim string from both ends. @gbrlmarn #3319 ```sh $ jq -n '"foobarfoo" | trimstr("foo")' "bar" ``` - Add `add/1`. Generator variant of `add/0`. @myaaaaaaaaa #3144 ```sh $ jq -c '.sum = add(.xs[])' <<< '{"xs":[1,2,3]}' {"xs":[1,2,3],"sum":6} ``` - Add `skip/2` as the counterpart to `limit/2`. @itchyny #3181 ```sh $ jq -nc '[1,2,3,4,5] | [skip(2; .[])]' [3,4,5] ``` - Add `toboolean/0` to convert strings to booleans. @brahmlower @itchyny #2098 ```sh $ jq -n '"true", "false" | toboolean' true false ``` - Add `@urid` format. Reverse of `@uri`. @fmgornick #3161 ```sh $ jq -Rr '@urid' <<< '%6a%71' jq ``` ## Changes to existing functions - Use code point index for `indices/1`, `index/1` and `rindex/1`. @wader #3065 - This is a breaking change. Use `utf8bytelength/0` to get byte index. - Improve `tonumber/0` performance and rejects numbers with leading or trailing white spaces. @itchyny @thaliaarchi #3055 #3195 - This is a breaking change. Use `trim/0` to remove leading and trailing white spaces. - Populate timezone data when formatting time. This fixes timezone name in `strftime/1`, `strflocaltime/1` for DST. @marcin-serwin @sihde #3203 #3264 #3323 - Preserve numerical precision on unary negation, `abs/0`, `length/0`. @itchyny #3242 #3275 - Make `last(empty)` yield no output values like `first(empty)`. @itchyny #3179 - Make `ltrimstr/1` and `rtrimstr/1` error for non-string inputs. @emanuele6 #2969 - Make `limit/2` error for negative count. @itchyny #3181 - Fix `mktime/0` overflow and allow fewer elements in date-time representation array. @emanuele6 #3070 #3162 - Fix non-matched optional capture group. @wader #3238 - Provide `strptime/1` on all systems. @george-hopkins @fdellwing #3008 #3094 - Fix `_WIN32` port of `strptime`. @emanuele6 #3071 - Improve `bsearch/1` performance by implementing in C. @eloycoto #2945 - Improve `unique/0` and `unique_by/1` performance. @itchyny @emanuele6 #3254 #3304 - Fix error messages including long string literal not to break Unicode characters. @itchyny #3249 - Remove `pow10/0` as it has been deprecated in glibc 2.27. Use `exp10/0` instead. @itchyny #3059 - Remove private (and undocumented) `_nwise` filter. @itchyny #3260 ## Language changes - Fix precedence of binding syntax against unary and binary operators. Also, allow some expressions as object values. @itchyny #3053 #3326 - This is a breaking change that may change the output of filters with binding syntax as follows. ```sh $ jq -nc '[-1 as $x | 1,$x]' [1,-1] # previously, [-1,-1] $ jq -nc '1 | . + 2 as $x | -$x' -3 # previously, -1 $ jq -nc '{x: 1 + 2, y: false or true, z: null // 3}' {"x":3,"y":true,"z":3} # previously, syntax error ``` - Support Tcl-style multiline comments. @emanuele6 #2989 ```sh #!/bin/sh -- # Can be use to do shebang scripts. # Next line will be seen as a comment be of the trailing backslash. \ exec jq ... # this jq expression will result in [1] [ 1, # \ 2 ] ``` - Fix `foreach` not to break init backtracking with `DUPN`. @kanwren #3266 ```sh $ jq -n '[1, 2] | foreach .[] as $x (0, 1; . + $x)' 1 3 2 4 ``` - Fix `reduce`/`foreach` state variable should not be reset each iteration. @itchyny #3205 ```sh $ jq -n 'reduce range(5) as $x (0; .+$x | select($x!=2))' 8 $ jq -nc '[foreach range(5) as $x (0; .+$x | select($x!=2); [$x,.])]' [[0,0],[1,1],[3,4],[4,8]] ``` - Support CRLF line breaks in filters. @itchyny #3274 - Improve performance of repeating strings. @itchyny #3272 ## Documentation changes - Switch the homepage to custom domain [jqlang.org](https://jqlang.org). @itchyny @owenthereal #3243 - Make latest release instead of development version the default manual. @wader #3130 - Add opengraph meta tags. @wader #3247 - Replace jqplay.org with play.jqlang.org @owenthereal #3265 - Add missing line from decNumber's licence to `COPYING`. @emanuele6 #3106 - Various document improvements. @tsibley #3322, @itchyny #3240, @jhcarl0814 #3239, @01mf02 #3184, @thaliaarchi #3199, @NathanBaulch #3173, @cjlarose #3164, @sheepster1 #3105, #3103, @kishoreinvits #3042, @jbrains #3035, @thalman #3033, @SOF3 #3017, @wader #3015, @wllm-rbnt #3002 ## Build improvements - Fix build with GCC 15 (C23). @emanuele6 #3209 - Fix build with `-Woverlength-strings` @emanuele6 #3019 - Fix compiler warning `type-limits` in `found_string`. @itchyny #3263 - Fix compiler error in `jv_dtoa.c` and `builtin.c`. @UlrichEckhardt #3036 - Fix warning: a function definition without a prototype is deprecated. @itchyny #3259 - Define `_BSD_SOURCE` in `builtin.c` for OpenBSD support. @itchyny #3278 - Define empty `JV_{,V}PRINTF_LIKE` macros if `__GNUC__` is not defined. @emanuele6 #3160 - Avoid `ctype.h` abuse: cast `char` to `unsigned char` first. @riastradh #3152 - Remove multiple calls to free when successively calling `jq_reset`. @Sameesunkaria #3134 - Enable IBM z/OS support. @sachintu47 #3277 - Fix insecure `RUNPATH`. @orbea #3212 - Avoid zero-length `calloc`. @itchyny #3280 - Move oniguruma and decNumber to vendor directory. @itchyny #3234 ## Test improvements - Run tests in C locale. @emanuele6 #3039 - Improve reliability of `NO_COLOR` tests. @dag-erling #3188 - Improve `shtest` not to fail if `JQ_COLORS` and `NO_COLOR` are already set. @SArpnt #3283 - Refactor constant folding tests. @itchyny #3233 - Make tests pass when `--disable-decnum`. @nicowilliams 6d02d53f515bf1314d644eee93ba30b0d11c7d2b - Disable Valgrind by default during testing. @itchyny #3269 # 1.7.1 ## Security - CVE-2023-50246: Fix heap buffer overflow in jvp\_literal\_number\_literal - CVE-2023-50268: fix stack-buffer-overflow if comparing nan with payload ## CLI changes - Make the default background color more suitable for bright backgrounds. @mjarosie @taoky @nicowilliams @itchyny #2904 - Allow passing the inline jq script after `--`. @emanuele6 #2919 - Restrict systems operations on OpenBSD and remove unused `mkstemp`. @klemensn #2934 - Fix possible uninitialised value dereference if `jq_init()` fails. @emanuele6 @nicowilliams #2935 ## Language changes - Simplify `paths/0` and `paths/1`. @asheiduk @emanuele6 #2946 - Reject `U+001F` in string literals. @torsten-schenk @itchyny @wader #2911 - Remove unused nref accumulator in `block_bind_library`. @emanuele6 #2914 - Remove a bunch of unused variables, and useless assignments. @emanuele6 #2914 - main.c: Remove unused EXIT\_STATUS\_EXACT option. @emanuele6 #2915 - Actually use the number correctly casted from double to int as index. @emanuele6 #2916 - src/builtin.c: remove unnecessary jv\_copy-s in type\_error/type\_error2. @emanuele6 #2937 - Remove undefined behavior caught by LLVM 10 UBSAN. @Gaelan @emanuele6 #2926 - Convert decnum to binary64 (double) instead of decimal64. This makes jq behave like the JSON specification suggests and more similar to other languages. @wader @leonid-s-usov #2949 - Fix memory leaks on invalid input for `ltrimstr/1` and `rtrimstr/1`. @emanuele6 #2977 - Fix memory leak on failed get for `setpath/2`. @emanuele6 #2970 - Fix nan from json parsing also for nans with payload that start with 'n'. @emanuele6 #2985 - Allow carriage return characters in comments. @emanuele6 #2942 #2984 ## Documentation changes - Generate links in the man page. @emanuele6 #2931 - Standardize arch types to AMD64 & ARM64 from index page download dropdown. @owenthereal #2884 ## libjq - Add extern C for C++. @rockwotj #2953 ## Build and test changes - Fix incorrect syntax for checksum file. @kamontat @wader #2899 - Remove `-dirty` version suffix for windows release build. @itchyny #2888 - Make use of `od` in tests more compatible. @nabijaczleweli @emanuele6 @nicowilliams #2922 - Add dependabot. @yeikel #2889 - Extend fuzzing setup to fuzz parser and JSON serializer. @DavidKorczynski @emanuele6 #2952 - Keep releasing executables with legacy names. @itchyny #2951 # 1.7 After a five year hiatus we're back with a GitHub organization, with new admins and new maintainers who have brought a great deal of energy to make a long-awaited and long-needed new release. We're very grateful for all the new owners, admins, and maintainers. Special thanks go to Owen Ou (@owenthereal) for pushing to set up a new GitHub organization for jq, Stephen Dolan (@stedolan) for transferring the jq repository to the new organization, @itchyny for doing a great deal of work to get the release done, Mattias Wadman (@wader) and Emanuele Torre (@emanuele6) for many PRs and code reviews. Many others also contributed PRs, issues, and code reviews as well, and you can find their contributions in the Git log and on the [closed issues and PRs page](https://github.com/jqlang/jq/issues?q=is%3Aclosed+sort%3Aupdated-desc). Since the last stable release many things have happened: - jq now lives at - New maintainers, admins, and owners have been recruited. - A list of [current maintainers](https://github.com/jqlang/jq/blob/jq-1.7/AUTHORS#L4-L14) - NEWS file is replaced by NEWS.md with Markdown format. @wader #2599 - CI, scan builds, release, website builds etc now use GitHub actions. @owenthereal @wader @itchyny #2596 #2603 #2620 #2723 - Lots of documentation improvements and fixes. - Website updated with new section search box, better section ids for linking, dark mode, etc. @itchyny #2628 - Release builds for: - Linux `amd64`, `arm64`, `armel`, `armhf`, `i386`, `mips`, `mips64`, `mips64el`, `mips64r6`, `mips64r6el`, `mipsel`, `mipsr6`, `mipsr6el`, `powerpc`, `ppc64el`, `riscv64` and `s390x` - macOS `amd64` and `arm64` - Windows `i386` and `amd64` - Docker `linux/386`, `linux/amd64`, `linux/arm64`, `linux/mips64le`, `linux/ppc64le`, `linux/riscv64` and `linux/s390x` - More details see @owenthereal #2665 - Docker images are now available from `ghcr.io/jqlang/jq` instead of Docker Hub. @itchyny #2652 #2686 - OSS-fuzz. @DavidKorczynski #2760 #2762 Full commit log can be found at but here are some highlights: ## CLI changes - Make object key color configurable using `JQ_COLORS` environment variable. @itchyny @haguenau @ericpruitt #2703 ```sh # this would make "field" bold yellow (`1;33`, the last value) $ JQ_COLORS="0;90:0;37:0;37:0;37:0;32:1;37:1;37:1;33" ./jq -n '{field: 123}' { "field": 123 } ``` - Change the default color of null to Bright Black. @itchyny #2824 - Respect `NO_COLOR` environment variable to disable color output. See for details. @itchyny #2728 - Improved `--help` output. Now mentions all options and nicer order. @itchyny @wader #2747 #2766 #2799 - Fix multiple issues of exit code using `--exit-code`/`-e` option. @ryo1kato #1697 ```sh # true-ish last output value exits with zero $ jq -ne true ; echo $? true 0 # false-ish last output value (false and null) exits with 1 $ jq -ne false ; echo $? false 1 # no output value exists with 4 $ jq -ne empty ; echo $? 4 ``` - Add `--binary`/`-b` on Windows for binary output. To get `\n` instead of `\r\n` line endings. @nicowilliams 0dab2b1 - Add `--raw-output0` for NUL (zero byte) separated output. @asottile @pabs3 @itchyny #1990 #2235 #2684 ```sh # will output a zero byte after each output $ jq -n --raw-output0 '1,2,3' | xxd 00000000: 3100 3200 3300 1.2.3. # can be used with xargs -0 $ jq -n --raw-output0 '"a","b","c"' | xargs -0 -n1 a b c $ jq -n --raw-output0 '"a b c", "d\ne\nf"' | xargs -0 printf '[%s]\n' [a b c] [d e f] # can be used with read -d '' $ while IFS= read -r -d '' json; do > jq '.name' <<< "$json" > done < <(jq -n --raw-output0 '{name:"a b c"},{name:"d\ne\nf"}') "a b c" "d\ne\nf" # also it's an error to output a string containing a NUL when using NUL separator $ jq -n --raw-output0 '"\u0000"' jq: error (at ): Cannot dump a string containing NUL with --raw-output0 option ``` - Fix assert crash and validate JSON for `--jsonarg`. @wader #2658 - Remove deprecated `--argfile` option. @itchyny #2768 - Enable stack protection. @nicowilliams #2801 ## Language changes - Use decimal number literals to preserve precision. Comparison operations respects precision but arithmetic operations might truncate. @leonid-s-usov #1752 ```sh # precision is preserved $ echo '100000000000000000' | jq . 100000000000000000 # comparison respects precision (this is false in JavaScript) $ jq -n '100000000000000000 < 100000000000000001' true # sort/0 works $ jq -n -c '[100000000000000001, 100000000000000003, 100000000000000004, 100000000000000002] | sort' [100000000000000001,100000000000000002,100000000000000003,100000000000000004] # arithmetic operations might truncate (same as JavaScript) $ jq -n '100000000000000000 + 10' 100000000000000020 ``` - Adds new builtin `pick(stream)` to emit a projection of the input object or array. @pkoppstein #2656 #2779 ```sh $ jq -n '{"a": 1, "b": {"c": 2, "d": 3}, "e": 4} | pick(.a, .b.c, .x)' { "a": 1, "b": { "c": 2 }, "x": null } ``` - Adds new builtin `debug(msgs)` that works like `debug` but applies a filter on the input before writing to stderr. @pkoppstein #2710 ```sh $ jq -n '1 as $x | 2 | debug("Entering function foo with $x == \($x)", .) | (.+1)' ["DEBUG:","Entering function foo with $x == 1"] ["DEBUG:",2] 3 $ jq -n '{a: 1, b: 2, c: 3} | debug({a, b, sum: (.a+.b)})' ["DEBUG:",{"a":1,"b":2,"sum":3}] { "a": 1, "b": 2, "c": 3 } ``` - Adds new builtin `scan($re; $flags)`. Was documented but not implemented. @itchyny #1961 ```sh # look for pattern "ab" in "abAB" ignoring casing $ jq -n '"abAB" | scan("ab"; "i")' "ab" "AB" ``` - Adds new builtin `abs` to get absolute value. This potentially allows the literal value of numbers to be preserved as `length` and `fabs` convert to float. @pkoppstein #2767 - Allow `if` without `else`-branch. When skipped the `else`-branch will be `.` (identity). @chancez @wader #1825 #2481 ```sh # convert 1 to "one" otherwise keep as is $ jq -n '1,2 | if . == 1 then "one" end' "one" 2 # behaves the same as $ jq -n '1,2 | if . == 1 then "one" else . end' "one" 2 # also works with elif $ jq -n '1,2,3 | if . == 1 then "one" elif . == 2 then "two" end "one" "two" 3 ``` - Allow use of `$binding` as key in object literals. @nicowilliams 8ea4a55 ```sh $ jq -n '"a" as $key | {$key: 123}' { "a": 123 } # previously parentheses were needed $ jq -n '"a" as $key | {($key): 123}' { "a": 123 } ``` - Allow dot between chained indexes when using `.["index"]` @nicowilliams #1168 ```sh $ jq -n '{"a": {"b": 123}} | .a["b"]' 123 # now this also works $ jq -n '{"a": {"b": 123}} | .a.["b"]' 123 ``` - Allow dot for chained value iterator `.[]`, `.[]?` @wader #2650 ```sh $ jq -n '{"a": [123]} | .a[]' 123 # now this also works $ jq -n '{"a": [123]} | .a.[]' 123 ``` - Fix try/catch catches more than it should. @nicowilliams #2750 - Speed up and refactor some builtins, also remove `scalars_or_empty/0`. @muhmuhten #1845 - Now `halt` and `halt_error` exit immediately instead of continuing to the next input. @emanuele6 #2667 - Fix issue converting string to number after previous convert error. @thalman #2400 - Fix issue representing large numbers on some platforms causing invalid JSON output. @itchyny #2661 - Fix deletion using assigning empty against arrays. @itchyny #2133 ```sh # now this works as expected, filter out all values over 2 by assigning empty $ jq -c '(.[] | select(. >= 2)) |= empty' <<< '[1,5,3,0,7]' [1,0] ``` - Allow keywords to be used as binding name in more places. @emanuele6 #2681 - Allow using `nan` as NaN in JSON. @emanuele6 #2712 - Expose a module's function names in `modulemeta`. @mrwilson #2837 - Fix `contains/1` to handle strings with NUL. @nicowilliams 61cd6db - Fix `stderr/0` to output raw text without any decoration. @itchyny #2751 - Fix `nth/2` to emit empty on index out of range. @itchyny #2674 - Fix `implode` to not assert and instead replace invalid Unicode codepoints. @wader #2646 - Fix `indices/1` and `rindex/1` in case of overlapping matches in strings. @emanuele6 #2718 - Fix `sub/3` to resolve issues involving global search-and-replace (gsub) operations. @pkoppstein #2641 - Fix `significand/0`, `gamma/0` and `drem/2` to be available on macOS. @itchyny #2756 #2775 - Fix empty regular expression matches. @itchyny #2677 - Fix overflow exception of the modulo operator. @itchyny #2629 - Fix string multiplication by 0 (and less than 1) to emit empty string. @itchyny #2142 - Fix segfault when using libjq and threads. @thalman #2546 - Fix constant folding of division and reminder with zero divisor. @itchyny #2797 - Fix `error/0`, `error/1` to throw null error. @emanuele6 #2823 - Simpler and faster `transpose`. @pkoppstein #2758 - Simple and efficient implementation of `walk/1`. @pkoppstein #2795 - Remove deprecated filters `leaf_paths`, `recurse_down`. @itchyny #2666 # Previous releases Release history - jq version 1.6 was released on Fri Nov 2 2018 - jq version 1.5 was released on Sat Aug 15 2015 - jq version 1.4 was released on Mon Jun 9 2014 - jq version 1.3 was released on Sun May 19 2013 - jq version 1.2 was released on Thu Dec 20 2012 - jq version 1.1 was released on Sun Oct 21 2012 - jq version 1.0 was released on Sun Oct 21 2012 New features in 1.6 since 1.5: - Destructuring Alternation - New Builtins: - builtins/0 - stderr/0 - halt/0, halt_error/1 - isempty/1 - walk/1 - utf8bytelength/1 - localtime/0, strflocaltime/1 - SQL-style builtins - and more! - Add support for ASAN and UBSAN - Make it easier to use jq with shebangs (8f6f28c) - Add $ENV builtin variable to access environment - Add JQ_COLORS env var for configuring the output colors New features in 1.5 since 1.4: - regular expressions (with Oniguruma) - a library/module system - many new builtins - datetime builtins - math builtins - regexp-related builtins - stream-related builtins (e.g., all/1, any/1) - minimal I/O builtins (`inputs`, `debug`) - new syntactic features, including: - destructuring (`. as [$first, $second] | ...`) - try/catch, generalized `?` operator, and label/break - `foreach` - multiple definitions of a function with different numbers of arguments - command-line arguments - --join-lines / -j for raw output - --argjson and --slurpfile - --tab and --indent - --stream (streaming JSON parser) - --seq (RFC7464 JSON text sequence) - --run-tests improvements - optimizations: - tail-call optimization - reduce and foreach no longer leak a reference to . New features in 1.4 since 1.3: - command-line arguments - jq --arg-file variable file - jq --unbuffered - jq -e / --exit-status (set exit status based on outputs) - jq -S / --sort-keys (now jq no longer sorts object keys by default - syntax - .. -> like // in XPath (recursive traversal) - question mark (e.g., .a?) to suppress errors - ."foo" syntax (equivalent to .["foo"]) - better error handling for .foo - added % operator (modulo) - allow negation without requiring extra parenthesis - more function arguments (up to six) - filters: - any, all - iterables, arrays, objects, scalars, nulls, booleans, numbers, strings, values - string built-ins: - split - join (join an array of strings with a given separator string) - ltrimstr, rtrimstr - startswith, endswith - explode, implode - fromjson, tojson - index, rindex, indices - math functions - floor, sqrt, cbrt, etcetera (depends on what's available from libm) - libjq -- a C API interface to jq's JSON representation and for running jq programs from C applications jq-1.8.2/jq.spec0000644000175100017510000000262715215513536007122 # This is spec file maintained by developers of JQ, not by a OS distro. # Your OS of choice will likely ignore this RPM spec file. Summary: Command-line JSON processor Name: jq Version: %{myver} Release: %{myrel}%{?dist} Source0: jq-%{myver}.tar.gz URL: https://jqlang.org License: MIT AND ICU AND CC-BY-3.0 AutoReqProv: no #BuildPrereq: autoconf, libtool, automake, flex, bison, python Group: Applications/System # Requires: # Disables debug packages and stripping of binaries: %global _enable_debug_package 0 %global debug_package %{nil} %global __os_install_post %{nil} # Crank up the compression %define _binary_payload w7.lzdio %description jq is a command-line JSON processor %prep %setup %build echo "Building in: \"$(pwd)\"" %if "%{devbuild}" == "yes" ./configure --prefix=%{_prefix} --enable-devel %else ./configure --prefix=%{_prefix} %endif make %install echo "Installing to: \"%{buildroot}\"" make install DESTDIR=%{buildroot} %clean rm -rf %{buildroot} %files %defattr(-,root,root) %{_bindir}/jq %if "%{devbuild}" == "yes" %{_libexecdir}/%{name}/jq_test %{_libexecdir}/%{name}/testdata %endif %{_datadir}/doc/%{name}/AUTHORS %{_datadir}/doc/%{name}/COPYING %{_datadir}/doc/%{name}/README.md %{_datadir}/man/man1/jq.1 %{_includedir}/jq.h %{_includedir}/jv.h %{_prefix}/lib/libjq.a %{_prefix}/lib/libjq.la %{_prefix}/lib/libjq.so %{_prefix}/lib/libjq.so.1 %{_prefix}/lib/libjq.so.1.0.4 %changelog %pre %post jq-1.8.2/Makefile.in0000644000175100017510000022430515215513556007702 # Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ ### C source files to be built and distributed. VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @WIN32_TRUE@am__append_1 = -municode @WIN32_TRUE@am__append_2 = -lshlwapi @WIN32_TRUE@am__append_3 = -no-undefined ### Address sanitizer (ASan) @ENABLE_ASAN_TRUE@am__append_4 = -fsanitize=address ### Undefined Behavior Sanitizer @ENABLE_UBSAN_TRUE@am__append_5 = -fsanitize=undefined ### Code coverage with gcov @ENABLE_GCOV_TRUE@am__append_6 = --coverage --no-inline ### Error injection for testing @ENABLE_ERROR_INJECTION_TRUE@am__append_7 = libinject_errors.la bin_PROGRAMS = jq$(EXEEXT) @WIN32_FALSE@am__append_8 = tests/optionaltest @ENABLE_VALGRIND_TRUE@am__append_9 = ENABLE_VALGRIND=1 ### Build oniguruma @BUILD_ONIGURUMA_TRUE@am__append_10 = vendor/oniguruma/src/.libs/libonig.la @BUILD_ONIGURUMA_TRUE@am__append_11 = vendor/oniguruma/src/.libs/libonig.la @WITH_ONIGURUMA_TRUE@am__append_12 = tests/onigtest tests/manonigtest subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/ax_prog_bison_version.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/config/m4/check-math-func.m4 \ $(top_srcdir)/config/m4/find-func-no-libs.m4 \ $(top_srcdir)/config/m4/find-func-no-libs2.m4 \ $(top_srcdir)/config/m4/find-func.m4 \ $(top_srcdir)/config/m4/libtool.m4 \ $(top_srcdir)/config/m4/ltoptions.m4 \ $(top_srcdir)/config/m4/ltsugar.m4 \ $(top_srcdir)/config/m4/ltversion.m4 \ $(top_srcdir)/config/m4/lt~obsolete.m4 \ $(top_srcdir)/config/m4/misc.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) $(dist_doc_DATA) $(include_HEADERS) \ $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = libjq.pc CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)" \ "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" PROGRAMS = $(bin_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } LTLIBRARIES = $(lib_LTLIBRARIES) libinject_errors_la_DEPENDENCIES = am__libinject_errors_la_SOURCES_DIST = src/inject_errors.c am__dirstamp = $(am__leading_dot)dirstamp @ENABLE_ERROR_INJECTION_TRUE@am_libinject_errors_la_OBJECTS = \ @ENABLE_ERROR_INJECTION_TRUE@ src/inject_errors.lo libinject_errors_la_OBJECTS = $(am_libinject_errors_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libinject_errors_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libinject_errors_la_LDFLAGS) \ $(LDFLAGS) -o $@ @ENABLE_ERROR_INJECTION_TRUE@am_libinject_errors_la_rpath = -rpath \ @ENABLE_ERROR_INJECTION_TRUE@ $(libdir) am__DEPENDENCIES_1 = libjq_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_10) am__objects_1 = src/lexer.lo src/parser.lo am__objects_2 = src/builtin.lo src/bytecode.lo src/compile.lo \ src/execute.lo src/jq_test.lo src/jv.lo src/jv_alloc.lo \ src/jv_aux.lo src/jv_dtoa.lo src/jv_file.lo src/jv_parse.lo \ src/jv_print.lo src/jv_unicode.lo src/linker.lo src/locfile.lo \ src/util.lo src/jv_dtoa_tsd.lo vendor/decNumber/decContext.lo \ vendor/decNumber/decNumber.lo $(am__objects_1) am_libjq_la_OBJECTS = $(am__objects_2) libjq_la_OBJECTS = $(am_libjq_la_OBJECTS) libjq_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libjq_la_LDFLAGS) $(LDFLAGS) -o $@ am_jq_OBJECTS = src/main.$(OBJEXT) jq_OBJECTS = $(am_jq_OBJECTS) jq_DEPENDENCIES = libjq.la $(am__append_11) jq_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(jq_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = src/$(DEPDIR)/builtin.Plo \ src/$(DEPDIR)/bytecode.Plo src/$(DEPDIR)/compile.Plo \ src/$(DEPDIR)/execute.Plo src/$(DEPDIR)/inject_errors.Plo \ src/$(DEPDIR)/jq_test.Plo src/$(DEPDIR)/jv.Plo \ src/$(DEPDIR)/jv_alloc.Plo src/$(DEPDIR)/jv_aux.Plo \ src/$(DEPDIR)/jv_dtoa.Plo src/$(DEPDIR)/jv_dtoa_tsd.Plo \ src/$(DEPDIR)/jv_file.Plo src/$(DEPDIR)/jv_parse.Plo \ src/$(DEPDIR)/jv_print.Plo src/$(DEPDIR)/jv_unicode.Plo \ src/$(DEPDIR)/lexer.Plo src/$(DEPDIR)/linker.Plo \ src/$(DEPDIR)/locfile.Plo src/$(DEPDIR)/main.Po \ src/$(DEPDIR)/parser.Plo src/$(DEPDIR)/util.Plo \ vendor/decNumber/$(DEPDIR)/decContext.Plo \ vendor/decNumber/$(DEPDIR)/decNumber.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = @MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ || LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) LTLEXCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) am__v_LEX_0 = @echo " LEX " $@; am__v_LEX_1 = YLWRAP = $(top_srcdir)/config/ylwrap @MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ || am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ -e s/c++$$/h++/ -e s/c$$/h/ YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS) AM_V_YACC = $(am__v_YACC_@AM_V@) am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) am__v_YACC_0 = @echo " YACC " $@; am__v_YACC_1 = SOURCES = $(libinject_errors_la_SOURCES) $(libjq_la_SOURCES) \ $(jq_SOURCES) DIST_SOURCES = $(am__libinject_errors_la_SOURCES_DIST) \ $(libjq_la_SOURCES) $(jq_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 man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DATA = $(dist_doc_DATA) $(pkgconfig_DATA) HEADERS = $(include_HEADERS) 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 check recheck distdir distdir-am dist dist-all \ distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DIST_SUBDIRS = vendor/oniguruma am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libjq.pc.in \ $(top_srcdir)/config/ar-lib $(top_srcdir)/config/compile \ $(top_srcdir)/config/config.guess \ $(top_srcdir)/config/config.sub $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ $(top_srcdir)/config/missing $(top_srcdir)/config/test-driver \ $(top_srcdir)/config/ylwrap AUTHORS COPYING ChangeLog NEWS.md \ README.md config/ar-lib config/compile config/config.guess \ config/config.sub config/depcomp config/install-sh \ config/ltmain.sh config/missing config/ylwrap src/lexer.c \ src/parser.c src/parser.h DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BISON_VERSION = @BISON_VERSION@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB__isatty = @LIB__isatty@ LIB_arc4random = @LIB_arc4random@ LIB_atexit = @LIB_atexit@ LIB_getentropy = @LIB_getentropy@ LIB_gettimeofday = @LIB_gettimeofday@ LIB_gmtime = @LIB_gmtime@ LIB_gmtime_r = @LIB_gmtime_r@ LIB_isatty = @LIB_isatty@ LIB_localtime = @LIB_localtime@ LIB_localtime_r = @LIB_localtime_r@ LIB_pthread_key_create = @LIB_pthread_key_create@ LIB_pthread_once = @LIB_pthread_once@ LIB_setenv = @LIB_setenv@ LIB_setlocale = @LIB_setlocale@ LIB_strftime = @LIB_strftime@ LIB_strptime = @LIB_strptime@ LIB_timegm = @LIB_timegm@ 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@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIPENV = @PIPENV@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ onig_CFLAGS = @onig_CFLAGS@ onig_LDFLAGS = @onig_LDFLAGS@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBJQ_INCS = src/builtin.h src/bytecode.h src/compile.h \ src/exec_stack.h src/jq_parser.h src/jv_alloc.h src/jv_dtoa.h \ src/jv_unicode.h src/jv_utf8_tables.h src/lexer.l src/libm.h \ src/linker.h src/locfile.h src/opcode_list.h src/parser.y \ src/util.h src/jv_dtoa_tsd.h src/jv_thread.h src/jv_private.h \ vendor/decNumber/decContext.h vendor/decNumber/decNumber.h \ vendor/decNumber/decNumberLocal.h LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \ src/jq_test.c src/jv.c src/jv_alloc.c src/jv_aux.c \ src/jv_dtoa.c src/jv_file.c src/jv_parse.c src/jv_print.c \ src/jv_unicode.c src/linker.c src/locfile.c src/util.c \ src/jv_dtoa_tsd.c \ vendor/decNumber/decContext.c vendor/decNumber/decNumber.c \ ${LIBJQ_INCS} ### C build options AM_CFLAGS = -Wextra -Wall -Wno-unused-parameter -Wno-unused-function \ -Woverlength-strings -Wstrict-prototypes $(am__append_1) \ $(am__append_4) $(am__append_5) $(am__append_6) $(onig_CFLAGS) ACLOCAL_AMFLAGS = -I config/m4 @MAINTAINER_MODE_FALSE@BUILT_SOURCES = src/builtin.inc src/config_opts.inc src/version.h ### Generating the lexer and parser # While there is some autoconf macro support for lex/flex, it doesn't support # header file creation so we'll use good old make @MAINTAINER_MODE_TRUE@BUILT_SOURCES = src/lexer.h src/lexer.c src/parser.h src/parser.c \ @MAINTAINER_MODE_TRUE@ src/builtin.inc src/config_opts.inc src/version.h # Tell YACC (Bison) autoconf macros that you want a header file created. # If the --warnings=all fails, you probably have an old version of Bison # macOS ships an old Bison, so update with Homebrew or MacPorts. AM_YFLAGS = --warnings=all -Wno-yacc -d ### libjq lib_LTLIBRARIES = libjq.la $(am__append_7) libjq_la_SOURCES = ${LIBJQ_SRC} libjq_la_LIBADD = -lm $(am__append_2) $(am__append_10) libjq_la_LDFLAGS = $(onig_LDFLAGS) -export-symbols-regex '^j[qv]_' \ -version-info 1:4:0 $(am__append_3) include_HEADERS = src/jv.h src/jq.h AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/vendor @ENABLE_ERROR_INJECTION_TRUE@libinject_errors_la_SOURCES = src/inject_errors.c @ENABLE_ERROR_INJECTION_TRUE@libinject_errors_la_LIBADD = -ldl @ENABLE_ERROR_INJECTION_TRUE@libinject_errors_la_LDFLAGS = -module generate_ver = ver="`{ $(srcdir)/scripts/version || echo '$(VERSION)' ; } | xargs printf '\043define JQ_VERSION \"%s\"\n'`" CLEANFILES = src/version.h .remake-version-h src/builtin.inc \ src/config_opts.inc jq.1 jq_SOURCES = src/main.c jq_LDADD = libjq.la -lm $(am__append_11) @ENABLE_ALL_STATIC_TRUE@jq_LDFLAGS = -all-static ### Tests (make check) TESTS = tests/mantest tests/jqtest tests/shtest tests/utf8test \ tests/base64test tests/uritest $(am__append_8) \ $(am__append_12) AM_TESTS_ENVIRONMENT = JQ=$(abs_builddir)/jq $(am__append_9) # This is a magic make variable that causes it to treat tests/man.test as a # DATA-type dependency for the check target. As a result, it will attempt to # run any defined targets for tests/man.test as a dependency for check. This # allows us to ensure that the tests are up-to-date if the manual has been updated check_DATA = tests/man.test ### Building the manpage # We build the docs from the manpage yml. If no changes have been made to the # manpage, then we'll end up using the cached version. Otherwise, we need to # rebuild it. man_MANS = jq.1 @BUILD_ONIGURUMA_TRUE@SUBDIRS = vendor/oniguruma DOC_FILES = docs/content docs/public docs/templates \ docs/Pipfile docs/Pipfile.lock docs/build_manpage.py \ docs/build_mantests.py docs/build_website.py docs/README.md \ docs/validate_manual_schema.py docs/manual_schema.yml EXTRA_DIST = $(DOC_FILES) $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) \ jq.1.prebuilt jq.spec src/lexer.c src/lexer.h src/parser.c \ src/parser.h src/version.h src/builtin.jq scripts/version \ libjq.pc \ tests/modules/a.jq tests/modules/b/b.jq tests/modules/c/c.jq \ tests/modules/c/d.jq tests/modules/data.json \ tests/modules/home1/.jq tests/modules/home2/.jq/g.jq \ tests/modules/lib/jq/e/e.jq tests/modules/lib/jq/f.jq \ tests/modules/shadow1.jq tests/modules/shadow2.jq \ tests/modules/syntaxerror/syntaxerror.jq \ tests/modules/test_bind_order.jq \ tests/modules/test_bind_order0.jq \ tests/modules/test_bind_order1.jq \ tests/modules/test_bind_order2.jq \ tests/modules/cycle_a.jq tests/modules/cycle_b.jq \ tests/modules/cycle_self.jq \ tests/onig.supp tests/local.supp \ tests/setup tests/torture/input0.json \ tests/optional.test tests/man.test tests/manonig.test \ tests/jq.test tests/onig.test tests/base64.test tests/uri.test \ tests/jq-f-test.sh \ tests/no-main-program.jq tests/yes-main-program.jq AM_DISTCHECK_CONFIGURE_FLAGS = --with-oniguruma=builtin # README.md is expected in GitHub projects, good stuff in it, so we'll # distribute it and install it with the package in the doc directory. dist_doc_DATA = README.md NEWS.md COPYING AUTHORS pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libjq.pc all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .l .lo .log .o .obj .test .test$(EXEEXT) .trs .y 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): libjq.pc: $(top_builddir)/config.status $(srcdir)/libjq.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) src/inject_errors.lo: src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) libinject_errors.la: $(libinject_errors_la_OBJECTS) $(libinject_errors_la_DEPENDENCIES) $(EXTRA_libinject_errors_la_DEPENDENCIES) $(AM_V_CCLD)$(libinject_errors_la_LINK) $(am_libinject_errors_la_rpath) $(libinject_errors_la_OBJECTS) $(libinject_errors_la_LIBADD) $(LIBS) src/builtin.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/bytecode.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/compile.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/execute.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jq_test.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_alloc.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_aux.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_dtoa.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_file.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_parse.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_print.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_unicode.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/linker.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/locfile.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/util.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/jv_dtoa_tsd.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) vendor/decNumber/$(am__dirstamp): @$(MKDIR_P) vendor/decNumber @: > vendor/decNumber/$(am__dirstamp) vendor/decNumber/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) vendor/decNumber/$(DEPDIR) @: > vendor/decNumber/$(DEPDIR)/$(am__dirstamp) vendor/decNumber/decContext.lo: vendor/decNumber/$(am__dirstamp) \ vendor/decNumber/$(DEPDIR)/$(am__dirstamp) vendor/decNumber/decNumber.lo: vendor/decNumber/$(am__dirstamp) \ vendor/decNumber/$(DEPDIR)/$(am__dirstamp) src/lexer.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/parser.h: src/parser.c @if test ! -f $@; then rm -f src/parser.c; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) src/parser.c; else :; fi src/parser.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) libjq.la: $(libjq_la_OBJECTS) $(libjq_la_DEPENDENCIES) $(EXTRA_libjq_la_DEPENDENCIES) $(AM_V_CCLD)$(libjq_la_LINK) -rpath $(libdir) $(libjq_la_OBJECTS) $(libjq_la_LIBADD) $(LIBS) src/main.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) jq$(EXEEXT): $(jq_OBJECTS) $(jq_DEPENDENCIES) $(EXTRA_jq_DEPENDENCIES) @rm -f jq$(EXEEXT) $(AM_V_CCLD)$(jq_LINK) $(jq_OBJECTS) $(jq_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/*.$(OBJEXT) -rm -f src/*.lo -rm -f vendor/decNumber/*.$(OBJEXT) -rm -f vendor/decNumber/*.lo distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/builtin.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/bytecode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/compile.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/execute.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/inject_errors.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jq_test.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_alloc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_aux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_dtoa.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_dtoa_tsd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_file.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_parse.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_print.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/jv_unicode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/lexer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/linker.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/locfile.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/main.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/util.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@vendor/decNumber/$(DEPDIR)/decContext.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@vendor/decNumber/$(DEPDIR)/decNumber.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< @MAINTAINER_MODE_TRUE@.l.c: @MAINTAINER_MODE_TRUE@ $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) @MAINTAINER_MODE_TRUE@.y.c: @MAINTAINER_MODE_TRUE@ $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf src/.libs src/_libs -rm -rf vendor/decNumber/.libs vendor/decNumber/_libs distclean-libtool: -rm -f libtool config.lt install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-dist_docDATA: $(dist_doc_DATA) @$(NORMAL_INSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # 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 # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_DATA) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_DATA) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? tests/mantest.log: tests/mantest @p='tests/mantest'; \ b='tests/mantest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/jqtest.log: tests/jqtest @p='tests/jqtest'; \ b='tests/jqtest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/shtest.log: tests/shtest @p='tests/shtest'; \ b='tests/shtest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/utf8test.log: tests/utf8test @p='tests/utf8test'; \ b='tests/utf8test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/base64test.log: tests/base64test @p='tests/base64test'; \ b='tests/base64test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/uritest.log: tests/uritest @p='tests/uritest'; \ b='tests/uritest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/optionaltest.log: tests/optionaltest @p='tests/optionaltest'; \ b='tests/optionaltest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/onigtest.log: tests/onigtest @p='tests/onigtest'; \ b='tests/onigtest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tests/manonigtest.log: tests/manonigtest @p='tests/manonigtest'; \ b='tests/manonigtest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_DATA) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(MANS) $(DATA) $(HEADERS) install-binPROGRAMS: install-libLTLIBRARIES installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) 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: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) -rm -f vendor/decNumber/$(DEPDIR)/$(am__dirstamp) -rm -f vendor/decNumber/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f src/lexer.c -rm -f src/parser.c -rm -f src/parser.h -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f src/$(DEPDIR)/builtin.Plo -rm -f src/$(DEPDIR)/bytecode.Plo -rm -f src/$(DEPDIR)/compile.Plo -rm -f src/$(DEPDIR)/execute.Plo -rm -f src/$(DEPDIR)/inject_errors.Plo -rm -f src/$(DEPDIR)/jq_test.Plo -rm -f src/$(DEPDIR)/jv.Plo -rm -f src/$(DEPDIR)/jv_alloc.Plo -rm -f src/$(DEPDIR)/jv_aux.Plo -rm -f src/$(DEPDIR)/jv_dtoa.Plo -rm -f src/$(DEPDIR)/jv_dtoa_tsd.Plo -rm -f src/$(DEPDIR)/jv_file.Plo -rm -f src/$(DEPDIR)/jv_parse.Plo -rm -f src/$(DEPDIR)/jv_print.Plo -rm -f src/$(DEPDIR)/jv_unicode.Plo -rm -f src/$(DEPDIR)/lexer.Plo -rm -f src/$(DEPDIR)/linker.Plo -rm -f src/$(DEPDIR)/locfile.Plo -rm -f src/$(DEPDIR)/main.Po -rm -f src/$(DEPDIR)/parser.Plo -rm -f src/$(DEPDIR)/util.Plo -rm -f vendor/decNumber/$(DEPDIR)/decContext.Plo -rm -f vendor/decNumber/$(DEPDIR)/decNumber.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dist_docDATA install-includeHEADERS \ install-man install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 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 src/$(DEPDIR)/builtin.Plo -rm -f src/$(DEPDIR)/bytecode.Plo -rm -f src/$(DEPDIR)/compile.Plo -rm -f src/$(DEPDIR)/execute.Plo -rm -f src/$(DEPDIR)/inject_errors.Plo -rm -f src/$(DEPDIR)/jq_test.Plo -rm -f src/$(DEPDIR)/jv.Plo -rm -f src/$(DEPDIR)/jv_alloc.Plo -rm -f src/$(DEPDIR)/jv_aux.Plo -rm -f src/$(DEPDIR)/jv_dtoa.Plo -rm -f src/$(DEPDIR)/jv_dtoa_tsd.Plo -rm -f src/$(DEPDIR)/jv_file.Plo -rm -f src/$(DEPDIR)/jv_parse.Plo -rm -f src/$(DEPDIR)/jv_print.Plo -rm -f src/$(DEPDIR)/jv_unicode.Plo -rm -f src/$(DEPDIR)/lexer.Plo -rm -f src/$(DEPDIR)/linker.Plo -rm -f src/$(DEPDIR)/locfile.Plo -rm -f src/$(DEPDIR)/main.Po -rm -f src/$(DEPDIR)/parser.Plo -rm -f src/$(DEPDIR)/util.Plo -rm -f vendor/decNumber/$(DEPDIR)/decContext.Plo -rm -f vendor/decNumber/$(DEPDIR)/decNumber.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-dist_docDATA \ uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-man uninstall-pkgconfigDATA uninstall-man: uninstall-man1 .MAKE: $(am__recursive_targets) all check check-am install install-am \ install-exec install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles am--refresh check check-TESTS check-am clean \ clean-binPROGRAMS clean-cscope clean-generic \ clean-libLTLIBRARIES 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-compile distclean-generic \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dist_docDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ install-man1 install-pdf install-pdf-am install-pkgconfigDATA \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-dist_docDATA \ uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-man uninstall-man1 uninstall-pkgconfigDATA .PRECIOUS: Makefile @MAINTAINER_MODE_TRUE@src/lexer.c: src/lexer.l @MAINTAINER_MODE_TRUE@ $(AM_V_LEX) flex -o src/lexer.c --header-file=src/lexer.h $< @MAINTAINER_MODE_TRUE@src/lexer.h: src/lexer.c @MAINTAINER_MODE_FALSE@.y.c: @MAINTAINER_MODE_FALSE@ $(AM_V_YACC) [ "$(/dev/null`" = "x$$ver" || touch .remake-version-h src/version.h: .remake-version-h mkdir -p src $(AM_V_GEN) $(generate_ver); echo "$$ver" > $@ src/config_opts.inc: mkdir -p src $(AM_V_GEN) if test -x ./config.status; then \ ./config.status --config; \ else echo "(unknown)"; \ fi | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' -e 's/^/#define JQ_CONFIG /' > $@ src/main.c: src/version.h src/config_opts.inc src/builtin.inc: $(srcdir)/src/builtin.jq mkdir -p src $(AM_V_GEN) od -v -A n -t o1 -- $< | \ sed -e 's/$$/ /' \ -e 's/\([0123456789]\) /\1, /g' \ -e 's/ $$//' \ -e 's/ 0/ 0/g' \ -e 's/ \([123456789]\)/ 0\1/g' > $@ src/builtin.o: src/builtin.inc ### Building the man tests # We use the examples in the manual as additional tests, to ensure they always work. # As a result, we need to rebuild the tests if the manual has been updated. # Making changes to the manpage without having the python deps means your # tests won't run. If you aren't making changes to the examples, you probably # don't care. But if you are, then you need to run the tests anyway. tests/man.test tests/manonig.test: $(srcdir)/docs/content/manual/dev/manual.yml @ENABLE_DOCS_TRUE@ $(AM_V_GEN) ( cd ${abs_srcdir}/docs && \ @ENABLE_DOCS_TRUE@ $(PIPENV) run python validate_manual_schema.py content/manual/dev/manual.yml && \ @ENABLE_DOCS_TRUE@ $(PIPENV) run python build_mantests.py ) @ENABLE_DOCS_FALSE@ @echo Changes to the manual.yml require docs to be enabled to update the manual test. @ENABLE_DOCS_FALSE@ @echo As a result, the manual test is out of date. jq.1.prebuilt: $(srcdir)/docs/content/manual/dev/manual.yml @ENABLE_DOCS_TRUE@ $(AM_V_GEN) ( cd ${abs_srcdir}/docs && \ @ENABLE_DOCS_TRUE@ $(PIPENV) run python validate_manual_schema.py content/manual/dev/manual.yml && \ @ENABLE_DOCS_TRUE@ $(PIPENV) run python build_manpage.py ) > $@ @ENABLE_DOCS_FALSE@ @echo Changes to the manual.yml require docs to be enabled to update the manpage. @ENABLE_DOCS_FALSE@ @echo As a result, the manpage is out of date. jq.1: jq.1.prebuilt $(AM_V_GEN) cp $(srcdir)/jq.1.prebuilt $@ ### Packaging install-binaries: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-exec RELEASE ?= 1 rpm: dist jq.spec @echo "Packaging jq as an RPM ..." mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS cp jq-$(VERSION).tar.gz rpm/SOURCES/ rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $(VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$(VERSION).tar.gz find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \; rm -rf rpm # 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: jq-1.8.2/libjq.pc0000644000175100017510000000037715215513565007263 prefix=/usr/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: libjq URL: https://jqlang.org/ Description: Library to process JSON using a query language Version: 1.8.2 Libs: -L${libdir} -ljq Cflags: -I${includedir}